diff --git a/LIB/asm/nesdash.s b/LIB/asm/nesdash.s index 568d0600..eb6512c3 100644 --- a/LIB/asm/nesdash.s +++ b/LIB/asm/nesdash.s @@ -2,7 +2,7 @@ .importzp _gamemode .importzp _tmp1, _tmp2, _tmp3, _tmp4, _tmp5, _tmp6, _tmp7, _tmp8, _tmp9, _temptemp5 ; C-safe temp storage .import pusha, pushax, callptr4 -.import _scroll_x, _cursedmusic +.import _scroll_x, _cursedmusic, _draw_arrow .macpack longbranch diff --git a/LIB/asm/neslib.s b/LIB/asm/neslib.s index 42a6fcaa..d1f18863 100644 --- a/LIB/asm/neslib.s +++ b/LIB/asm/neslib.s @@ -26,7 +26,7 @@ .export __memcpy,__memfill,_delay .export _flush_vram_update2, _oam_set, _oam_get - .import _disco_sprites, _slowmode, _kandoframecnt, _kandokidshack4, _pauseStatus,_coins_inserted, _CREDITS1_PREV, _CREDITS2_PREV + .import _disco_sprites, _slowmode, _kandoframecnt, _kandokidshack4, _pauseStatus,_coins_inserted, _CREDITS1_PREV, _CREDITS2_PREV, _showarrownow .segment "NESLIB" ;NMI handler @@ -125,16 +125,16 @@ nmi: bne @skipAll @calc: - lda noMouse - bne @SkipMouse +; lda noMouse +; bne @SkipMouse ; Read the raw controller data synced with OAM DMA to prevent ; DMC DMA bugs ;jsr oam_and_readjoypad - lda <(mouse + kMouseButtons) - and #$0f - cmp #$01 - beq :+ +; lda <(mouse + kMouseButtons) +; and #$0f +; cmp #$01 +; beq :+ @SkipMouse: LDA #>OAM_BUF STA PPU_OAM_DMA @@ -163,6 +163,11 @@ nmi: lda _coins_inserted cmp #$FF beq @skip1 + cmp #0 + bne @justinc + lda #1 + sta _showarrownow +@justinc: inc _coins_inserted @skip1: lda #sfx_coin @@ -182,6 +187,11 @@ nmi: lda _coins_inserted cmp #$FF beq @skip2 + cmp #0 + bne @justinc2 + lda #1 + sta _showarrownow +@justinc2: inc _coins_inserted @skip2: lda #sfx_coin @@ -1623,62 +1633,7 @@ CONTROLLER_PORT = CTRL_PORT1 rts snes_mouse_detected: - ; convert the X/Y displacement into X/Y positions on the screen - ldx #1 -loop: - lda mouse + kMouseY,x - bpl :+ - ; subtract the negative number instead - and #$7f - sta mouse + kMouseZero ; reuse this value as a temp value - lda TEMP,x - sec - sbc mouse + kMouseZero - ; check if we underflowed - bcc wrappednegative - ; check the lower bounds - cmp MouseBoundsMin,x - bcs setvalue ; didn't wrap so set the value now - wrappednegative: - lda MouseBoundsMin,x - jmp setvalue - : - ; add the positive number - clc - adc TEMP,x - ; check if we wrapped, set to the max bounds if we did - bcs wrapped - ; check the upper bounds - cmp MouseBoundsMax,x - bcc setvalue ; didn't wrap so set the value -wrapped: - lda MouseBoundsMax,x -setvalue: - sta mouse + kMouseY,x - dex - bpl loop - ; calculate newly pressed buttons and shift it into byte zero - lda TEMP+2 - eor #%11000000 - and mouse + kMouseButtons - rol - ror mouse + kMouseZero - rol - ror mouse + kMouseZero - - ; calculate newly released buttons - lda mouse + kMouseButtons - eor #%11000000 - and TEMP+2 - rol - ror mouse + kMouseZero - rol - ror mouse + kMouseZero - - ; Set the connected bit - sec - ror mouse + kMouseZero - + rts MOUSE_Y_MINIMUM = 1 diff --git a/SAUCE/famidash.h b/SAUCE/famidash.h index 393bd513..fffc74d0 100644 --- a/SAUCE/famidash.h +++ b/SAUCE/famidash.h @@ -311,6 +311,7 @@ uint8_t normalorcommlevels; uint8_t mouse_timer; uint8_t prev_mouse_x; uint8_t prev_mouse_y; +uint8_t showarrownow; extern uint8_t parallax_scroll_column; extern uint8_t parallax_scroll_column_start; diff --git a/SAUCE/gamestates/state_menu.h b/SAUCE/gamestates/state_menu.h index 0895ab1b..5e7cded2 100644 --- a/SAUCE/gamestates/state_menu.h +++ b/SAUCE/gamestates/state_menu.h @@ -763,6 +763,7 @@ const unsigned char vstext[] = "VS"; void state_menu() { poweroffcheck = 0xff; + menuselection = 0; if (exitingLevelSelect) { draw_both_progress_bars(); pal_fade_to_withmusic(4,0); @@ -844,10 +845,10 @@ void state_menu() { //POKE(0x203, 0x00); // Expand the data for the menu nametable while the PPU is still off - vram_adr(NAMETABLE_A); - vram_unrle(game_start_screen); + vram_adr(NAMETABLE_A); + vram_unrle(game_start_screen); vram_adr(NAMETABLE_B); - vram_unrle(game_start_screen); + vram_unrle(game_start_screen); set_scroll_x(0); @@ -857,8 +858,10 @@ void state_menu() { pal_fade_to_withmusic(0,4); tmp4 = menuselection; ++tmp4; tmp5 = loNTAddrTableTitleScreen[tmp4]|(hiNTAddrTableTitleScreen[tmp4]<<8); - one_vram_buffer('a', tmp5); - one_vram_buffer('b', addloNOC(tmp5, 1)); + if (coins_inserted) { + one_vram_buffer('a', tmp5); + one_vram_buffer('b', addloNOC(tmp5, 1)); + } roll_new_mode(); kandoframecnt = 0; teleport_output = 0Xff; @@ -882,6 +885,16 @@ void state_menu() { */ while (!(joypad1.press & (PAD_START | PAD_A)) || !coins_inserted){ + + if (showarrownow == 1) { + tmp4 = menuselection; ++tmp4; + tmp5 = loNTAddrTableTitleScreen[tmp4]|(hiNTAddrTableTitleScreen[tmp4]<<8); + one_vram_buffer('a', tmp5); + one_vram_buffer('b', addloNOC(tmp5, 1)); + showarrownow = 0; + } + + if (joypad1.press & PAD_SELECT && coins_inserted != 255) { for (tmp2 = 0; tmp2 < 255; tmp2++) { @@ -1343,14 +1356,14 @@ void state_menu() { dec_mouse_timer(); tmp3 = 0; - if (joypad1.press_right) { + if (joypad1.press_right && coins_inserted) { if (menuselection == 5) menuselection = 0; else if (menuselection == 1) { menuselection = 5; tmp3--; tmp3--; tmp3--; } else menuselection++; tmp3--; menutimer = 0; } - if (joypad1.press_left) { + if (joypad1.press_left && coins_inserted) { if (menuselection == 0) menuselection = 5; else if (menuselection == 5) { menuselection = 1; tmp3++; tmp3++; tmp3++; } else menuselection--; @@ -1358,7 +1371,7 @@ void state_menu() { menutimer = 0; } - if (tmp3 ) { // menu selection incremented + if (tmp3 && coins_inserted) { // menu selection incremented tmp4 = menuselection; ++tmp4; tmp5 = loNTAddrTableTitleScreen[tmp4]|(hiNTAddrTableTitleScreen[tmp4]<<8); if (menuselection != 4) {