Rework menu dungeon item + select behavior

Fix colored heart animations
This commit is contained in:
cassidoxa
2023-08-22 01:40:53 -04:00
parent 66540f2819
commit e2525ebdb1
4 changed files with 163 additions and 169 deletions

View File

@@ -10,10 +10,9 @@ ProcessMenuButtons:
BIT.b #$20 : BNE .sel_pressed ; check for P1 Select button BIT.b #$20 : BNE .sel_pressed ; check for P1 Select button
LDA.b Joy1A_All : BIT.b #$20 : BNE .sel_held LDA.b Joy1A_All : BIT.b #$20 : BNE .sel_held
.sel_unheld .sel_unheld
LDA.l HudFlag : AND.b #$20 : BEQ + LDA.l HudFlag : AND.b #$60 : BEQ +
LDA.l HudFlag : AND.b #$DF : STA.l HudFlag ; select is released, unset hud flag LDA.b #$00 : STA.l HudFlag
LDA.b IndoorsFlag : BEQ + ; skip if outdoors JSL.l MaybePlaySelectSFX
LDA.b #$20 : STA.w SFX3 ; menu select sound
+ +
JSL.l ResetEquipment JSL.l ResetEquipment
+ +
@@ -21,8 +20,14 @@ ProcessMenuButtons:
CLC ; no buttons CLC ; no buttons
RTL RTL
.sel_pressed .sel_pressed
LDA.l HudFlag : ORA.b #$20 : STA.l HudFlag ; set hud flag LDA.l HUDDungeonItems : BIT.b #$0C : BNE +
LDA.b #$20 : STA.w SFX3 ; menu select sound LDA.b #$40
BRA .store_flag
+
LDA.b #$60
.store_flag
STA.l HudFlag
JSL.l MaybePlaySelectSFX
JSL.l ResetEquipment JSL.l ResetEquipment
RTL RTL
.y_pressed ; Note: used as entry point by quickswap code. Must preserve X. .y_pressed ; Note: used as entry point by quickswap code. Must preserve X.
@@ -737,3 +742,14 @@ RTL
} }
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
MaybePlaySelectSFX:
LDA.w DungeonID : BMI .not_dungeon
.play
LDA.b #$20 : STA.w SFX3 ; menu select sound
RTL
.not_dungeon
LDA.l HUDDungeonItems : BIT.b #$13 : BEQ .dont_play
BIT.b #$0C : BEQ .dont_play
BRA .play
.dont_play
RTL

View File

@@ -494,9 +494,11 @@ CheckHeartPalette:
RTS RTS
ColorAnimatedHearts: ColorAnimatedHearts:
PHX
REP #$20 REP #$20
LDA.l HUDHeartColors_index : ASL : TAX LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X LDA.l HUDHeartColors_masks_game_hud,X
PLX
ORA.l HeartFramesBaseTiles,X ORA.l HeartFramesBaseTiles,X
STA.b [Scrap00],Y STA.b [Scrap00],Y
SEP #$20 SEP #$20

View File

@@ -116,10 +116,14 @@ RTL
;================================================================================ ;================================================================================
ShowDungeonItems: ShowDungeonItems:
REP #$30 REP #$30
LDA.w DungeonID : AND.w #$00FF : CMP.w #$00FF : BNE + : RTL : + ; return normal result if outdoors or in a cave LDA.w DungeonID-1 : BMI .no_dungeon
LDA.l HudFlag : AND.w #$0020 ; check hud flag LDA.l HudFlag : AND.w #$0040 : BEQ +
BEQ + : LDA.w #$0000 : RTL : + ; if set, send the zero onwards .no_dungeon
LDA.w DungeonID : AND.w #$00FF : CMP.w #$00FF ; original logic LDA.w #$0000
RTL
+
LDA.w IndoorsFlag
.done
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
UpdateKeys: UpdateKeys:
@@ -190,7 +194,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawHUDDungeonItems: DrawHUDDungeonItems:
LDA.l HUDDungeonItems : BNE .continue LDA.l HUDDungeonItems : BNE .continue
RTL RTL
.dungeon_positions .dungeon_positions
dw 0 ; Hyrule Castle dw 0 ; Hyrule Castle
@@ -253,28 +257,19 @@ DrawHUDDungeonItems:
dw $A4*2 ; ; Turtle Rock dw $A4*2 ; ; Turtle Rock
dw $0D*2 ; ; Ganon's Tower dw $0D*2 ; ; Ganon's Tower
.continue .continue
PHP PHP : PHB
PHK : PLB
PHB REP #$30
PHK
PLB
REP #$30
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
; dungeon names ; dungeon names
LDA.w #$2D50 LDA.w #$2D50
LDY.w #00 LDY.w #00
.next_dungeon_name
.next_dungeon_name
LDX.w .dungeon_positions,Y LDX.w .dungeon_positions,Y
STA.w GFXStripes+$0646,X STA.w GFXStripes+$0646,X
INC INC
INY : INY INY : INY
CPY.w #26 : BCC .next_dungeon_name CPY.w #26 : BCC .next_dungeon_name
@@ -286,163 +281,138 @@ DrawHUDDungeonItems:
STA.w GFXStripes+$06C6,X STA.w GFXStripes+$06C6,X
STA.w GFXStripes+$0706,X STA.w GFXStripes+$0706,X
DEX : DEX : BPL -- DEX : DEX
BPL --
LDA.l HudFlag : AND.w #$0020 : BEQ + LDA.l HudFlag : AND.w #$0020 : BEQ +
JMP .maps_and_compasses
JMP .maps_and_compasses
+
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
+
LDA.l HUDDungeonItems : AND.w #$0001 : BNE +
LDA.w #$24F5 : STA.w GFXStripes+$0684 ; blank tile
BRA .skip_small_keys
+
.draw_small_keys
LDA.w #$2810 : STA.w GFXStripes+$0684 ; small keys icon
LDY.w #0
CLC
LDA.l HUDDungeonItems : AND.w #$0001 : BEQ .skip_small_keys .next_small_key
LDX.w .small_key_x_offset,Y
LDA.l DungeonKeys,X
AND.w #$00FF
.draw_small_keys LDX.w .dungeon_positions,Y
LDA.w #$2810 : STA.w GFXStripes+$0684 ; small keys icon ADC.w #$2816
STA.w GFXStripes+$0686,X
LDY.w #0 INY : INY
CPY.w #26 : BCC .next_small_key
; Clear the carry only once
; it will be cleared by looping condition afterwards
CLC
.next_small_key
LDX.w .small_key_x_offset,Y
LDA.l DungeonKeys,X
AND.w #$00FF
LDX.w .dungeon_positions,Y
ADC.w #$2816
STA.w GFXStripes+$0686,X
INY : INY
CPY.w #26 : BCC .next_small_key
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
.skip_small_keys .skip_small_keys
; Big Keys
LDA.l HUDDungeonItems : AND.w #$0002 : BNE +
LDA.w #$24F5 : STA.w GFXStripes+$06C4 ; blank tile
BRA .skip_big_keys
+
LDA.w #$2811 : STA.w GFXStripes+$06C4 ; big key icon
LDX.w #0
LDA.l BigKeyField
; Big Keys .next_big_key
LDA.l HUDDungeonItems : AND.w #$0002 : BEQ .skip_big_keys BIT.w .dungeon_bitmasks,X
BEQ ..skip_key
LDY.w .dungeon_positions,X
LDA.w #$2826
STA.w GFXStripes+$06C6,Y
LDA.l BigKeyField
LDA.w #$2811 : STA.w GFXStripes+$06C4 ; big key icon ..skip_key
INX : INX
; use X so we can BIT CPX.w #26 : BCC .next_big_key
LDX.w #0
; load once and test multiple times
LDA.l BigKeyField
.next_big_key
BIT.w .dungeon_bitmasks,X
BEQ ..skip_key
LDY.w .dungeon_positions,X
LDA.w #$2826
STA.w GFXStripes+$06C6,Y
; reload
LDA.l BigKeyField
..skip_key
INX : INX
CPX.w #26 : BCC .next_big_key
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
.skip_big_keys .skip_big_keys
LDA.l HUDDungeonItems : AND.w #$0010 : BNE +
LDA.w #$24F5 : STA.w GFXStripes+$0704 ; blank tile
BRA .skip_boss_kills
+
LDA.w #$280F : STA.w GFXStripes+$0704 ; skull icon
LDY.w #0
LDA.l HUDDungeonItems : AND.w #$0010 : BEQ .skip_boss_kills .next_boss_kill
LDA.w #$280F : STA.w GFXStripes+$0704 ; skull icon LDX.w .boss_room_ids,Y
LDY.w #0 LDA.l RoomDataWRAM.l,X
AND.w #$0800
BEQ ..skip_boss_kill
LDA.w #$2826
LDX.w .dungeon_positions,Y
STA.w GFXStripes+$0706,X
..skip_boss_kill
INY : INY
CPY.w #26 : BCC .next_boss_kill
.next_boss_kill ;-------------------------------------------------------------------------------
LDX.w .boss_room_ids,Y .skip_boss_kills
LDA.l RoomDataWRAM.l,X LDA.l HUDDungeonItems : BIT.w #$00F3 : BEQ .maps_and_compasses
AND.w #$0800 JMP .exit
BEQ ..skip_boss_kill ;-------------------------------------------------------------------------------
.maps_and_compasses
LDA.w #$24F5 : STA.w GFXStripes+$0704 ; blank tile boss icon
; Maps
LDA.l HUDDungeonItems : AND.w #$0004 : BNE +
LDA.w #$24F5 : STA.w GFXStripes+$0684 ; map icon
BRA .skip_maps
+
LDA.w #$2821 : STA.w GFXStripes+$0684 ; map icon
LDX.w #0
LDA.l MapField
LDA.w #$2826 .next_map
LDX.w .dungeon_positions,Y BIT.w .dungeon_bitmasks,X
STA.w GFXStripes+$0706,X BEQ ..skip_map
..skip_boss_kill LDY.w .dungeon_positions,X
INY : INY LDA.w #$2826
CPY.w #26 : BCC .next_boss_kill STA.w GFXStripes+$0686,Y
LDA.l MapField
..skip_map
INX : INX
CPX.w #26 : BCC .next_map
.skip_maps
LDA.l HUDDungeonItems : AND.w #$0008 : BNE +
LDA.w #$24F5 : STA.w GFXStripes+$06C4 ; blank tile
BRA .skip_compasses
+
LDA.w #$2C20 : STA.w GFXStripes+$06C4 ; compass icon
LDX.w #0
LDA.l CompassField
.next_compass
BIT.w .dungeon_bitmasks,X
BEQ ..skip_compass
LDY.w .dungeon_positions,X
LDA.w #$2826
STA.w GFXStripes+$06C6,Y
LDA.l CompassField
..skip_compass
INX : INX
CPX.w #26 : BCC .next_compass
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
.skip_boss_kills .skip_compasses
JMP .exit .exit
PLB
;------------------------------------------------------------------------------- PLP
; This should only display if select is pressed in hud
.maps_and_compasses
; Maps
LDA.l HUDDungeonItems : AND.w #$0004 : BEQ .skip_maps
LDA.w #$2821 : STA.w GFXStripes+$0684 ; map icon
; use X so we can BIT
LDX.w #0
; load once and test multiple times
LDA.l MapField
.next_map
BIT.w .dungeon_bitmasks,X
BEQ ..skip_map
LDY.w .dungeon_positions,X
LDA.w #$2826
STA.w GFXStripes+$0686,Y
; reload
LDA.l MapField
..skip_map
INX : INX
CPX.w #26 : BCC .next_map
;-------------------------------------------------------------------------------
.skip_maps
; Compasses
LDA.l HUDDungeonItems : AND.w #$0008 : BEQ .skip_compasses
LDA.w #$2C20 : STA.w GFXStripes+$06C4 ; compass icon
; use X so we can BIT
LDX.w #0
; load once and test multiple times
LDA.l CompassField
.next_compass
BIT.w .dungeon_bitmasks,X
BEQ ..skip_compass
LDY.w .dungeon_positions,X
LDA.w #$2826
STA.w GFXStripes+$06C6,Y
; reload
LDA.l CompassField
..skip_compass
INX : INX
CPX.w #26 : BCC .next_compass
;-------------------------------------------------------------------------------
.skip_compasses
.exit
PLB
PLP
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;================================================================================ ;================================================================================
@@ -598,15 +568,19 @@ HandleEmptyMenu:
LDA.b Joy1A_New : BIT.b #$DF : BNE .close_menu ; Not select, close menu LDA.b Joy1A_New : BIT.b #$DF : BNE .close_menu ; Not select, close menu
BIT.b #$20 : BNE .sel_pressed BIT.b #$20 : BNE .sel_pressed
LDA.b Joy1A_All : BIT.b #$20 : BNE .wait_for_change LDA.b Joy1A_All : BIT.b #$20 : BNE .wait_for_change
LDA.l HudFlag : AND.b #$20 : BEQ .wait_for_change ; HUD flag off, skip drawing work LDA.l HudFlag : AND.b #$60 : BEQ .wait_for_change
LDA.l HudFlag : AND.b #$DF : STA.l HudFlag ; Unset without select LDA.l HudFlag : AND.b #$9F : STA.l HudFlag ; Unset without select
LDA.b IndoorsFlag : BEQ ++ ; skip if outdoors JSL.l MaybePlaySelectSFX
LDA.b #$20 : STA.w SFX3 LDA.b #$0C : BRA .done
++
LDA.b #$0C : BRA .done
.sel_pressed .sel_pressed
LDA.l HudFlag : ORA.b #$20 : STA.l HudFlag LDA.l HUDDungeonItems : BIT.b #$0C : BNE +
LDA.b #$20 : STA.w SFX3 LDA.b #$40
BRA .store_flag
+
LDA.b #$60
.store_flag
STA.l HudFlag
JSL.l MaybePlaySelectSFX
LDA.b #$0C : BRA .done LDA.b #$0C : BRA .done
.wait_for_change .wait_for_change
LDA.b #$03 : BRA .done LDA.b #$03 : BRA .done
@@ -665,3 +639,4 @@ dw $2084, $6084, $2085, $6085 ; 0 heart pieces
dw $20AD, $6084, $2085, $6085 ; 1 heart piece dw $20AD, $6084, $2085, $6085 ; 1 heart piece
dw $20AD, $6084, $20AE, $6085 ; 2 heart pieces dw $20AD, $6084, $20AE, $6085 ; 2 heart pieces
dw $20AD, $60AD, $20AE, $6085 ; 3 heart pieces dw $20AD, $60AD, $20AE, $6085 ; 3 heart pieces
;-------------------------------------------------------------------------------

View File

@@ -255,7 +255,8 @@ MapOverlay: skip 2 ; Used to reveal dungeon prizes on the map in mo
; | m = Misery Mire | d = Palace of Darkness | s = Swamp Palace ; | m = Misery Mire | d = Palace of Darkness | s = Swamp Palace
; | a = Aga Tower | t = Desert Palace | e = Eastern Palace ; | a = Aga Tower | t = Desert Palace | e = Eastern Palace
; / h = Hyrule Castle | s = Sewer Passage ; / h = Hyrule Castle | s = Sewer Passage
HudFlag: ; HudFlag: ; - h c - - - - -
; c = show maps and compasses | h = show heart pieces
IgnoreFaeries: ; IgnoreFaeries: ;
HasGroveItem: ; HasGroveItem: ;
GeneralFlags: skip 1 ; - - h - - i - g (bitfield) GeneralFlags: skip 1 ; - - h - - i - g (bitfield)