Merge remote-tracking branch 'baserom/master' into MergeDecompression

# Conflicts:
#	goalitem.asm
#	inventory.asm
#	invertedmaps.asm
#	newhud.asm
#	pendantcrystalhud.asm

Also some bugfixes here and there
This commit is contained in:
aerinon
2023-08-24 16:16:31 -06:00
22 changed files with 955 additions and 809 deletions

View File

@@ -115,11 +115,15 @@ CheckCloseItemMenu:
RTL
;================================================================================
ShowDungeonItems:
REP #$30
LDA.w DungeonID : AND.w #$00FF : CMP.w #$00FF : BNE + : RTL : + ; return normal result if outdoors or in a cave
LDA.l HudFlag : AND.w #$0020 ; check hud flag
BEQ + : LDA.w #$0000 : RTL : + ; if set, send the zero onwards
LDA.w DungeonID : AND.w #$00FF : CMP.w #$00FF ; original logic
LDA.w DungeonID-1 : BMI .no_dungeon
LDA.l HudFlag : AND.w #$0040 : BEQ +
.no_dungeon
LDA.w #$0000
RTL
+
LDA.w DungeonID
REP #$02
.done
RTL
;--------------------------------------------------------------------------------
UpdateKeys:
@@ -190,7 +194,7 @@ RTL
;--------------------------------------------------------------------------------
DrawHUDDungeonItems:
LDA.l HUDDungeonItems : BNE .continue
RTL
RTL
.dungeon_positions
dw 0 ; Hyrule Castle
@@ -253,28 +257,19 @@ DrawHUDDungeonItems:
dw $A4*2 ; ; Turtle Rock
dw $0D*2 ; ; Ganon's Tower
.continue
PHP
PHB
PHK
PLB
REP #$30
.continue
PHP : PHB
PHK : PLB
REP #$30
;-------------------------------------------------------------------------------
; dungeon names
LDA.w #$2D50
LDY.w #00
.next_dungeon_name
.next_dungeon_name
LDX.w .dungeon_positions,Y
STA.w GFXStripes+$0646,X
INC
INY : INY
CPY.w #26 : BCC .next_dungeon_name
@@ -286,165 +281,138 @@ DrawHUDDungeonItems:
STA.w GFXStripes+$06C6,X
STA.w GFXStripes+$0706,X
DEX : DEX : BPL --
DEX : DEX
BPL --
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
LDA.w #$2810 : STA.w GFXStripes+$0684 ; small keys icon
LDX.w .dungeon_positions,Y
ADC.w #$2816
STA.w GFXStripes+$0686,X
LDY.w #0
; 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
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
LDA.l HUDDungeonItems : AND.w #$0002 : BEQ .skip_big_keys
.next_big_key
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
; use X so we can BIT
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_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
LDA.w #$280F : STA.w GFXStripes+$0704 ; skull icon
LDY.w #0
.next_boss_kill
LDX.w .boss_room_ids,Y
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
LDA.l RoomDataWRAM.l,X
AND.w #$0800
BEQ ..skip_boss_kill
;-------------------------------------------------------------------------------
.skip_boss_kills
LDA.l HUDDungeonItems : BIT.w #$00F3 : BEQ .maps_and_compasses
JMP .exit
;-------------------------------------------------------------------------------
.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
LDX.w .dungeon_positions,Y
STA.w GFXStripes+$0706,X
.next_map
BIT.w .dungeon_bitmasks,X
BEQ ..skip_map
..skip_boss_kill
INY : INY
CPY.w #26 : BCC .next_boss_kill
LDY.w .dungeon_positions,X
LDA.w #$2826
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
JMP .exit
;-------------------------------------------------------------------------------
; 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
BNE ..draw_map
; MapMode indicates if maps are needed for the info
LDA.l MapMode : AND #$00FF : BNE ..skip_map
..draw_map
LDY.w .dungeon_positions,X
JSL MapIndicatorLong
STA.w GFXStripes+$0686,Y
..skip_map
; reload
LDA.l MapField
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
.skip_compasses
.exit
PLB
PLP
RTL
;--------------------------------------------------------------------------------
;================================================================================
@@ -600,15 +568,19 @@ HandleEmptyMenu:
LDA.b Joy1A_New : BIT.b #$DF : BNE .close_menu ; Not select, close menu
BIT.b #$20 : BNE .sel_pressed
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 #$DF : STA.l HudFlag ; Unset without select
LDA.b IndoorsFlag : BEQ ++ ; skip if outdoors
LDA.b #$20 : STA.w SFX3
++
LDA.b #$0C : BRA .done
LDA.l HudFlag : AND.b #$60 : BEQ .wait_for_change
LDA.l HudFlag : AND.b #$9F : STA.l HudFlag ; Unset without select
JSL.l MaybePlaySelectSFX
LDA.b #$0C : BRA .done
.sel_pressed
LDA.l HudFlag : ORA.b #$20 : STA.l HudFlag
LDA.b #$20 : STA.w SFX3
LDA.l HUDDungeonItems : BIT.b #$0C : BNE +
LDA.b #$40
BRA .store_flag
+
LDA.b #$60
.store_flag
STA.l HudFlag
JSL.l MaybePlaySelectSFX
LDA.b #$0C : BRA .done
.wait_for_change
LDA.b #$03 : BRA .done
@@ -667,3 +639,4 @@ dw $2084, $6084, $2085, $6085 ; 0 heart pieces
dw $20AD, $6084, $2085, $6085 ; 1 heart piece
dw $20AD, $6084, $20AE, $6085 ; 2 heart pieces
dw $20AD, $60AD, $20AE, $6085 ; 3 heart pieces
;-------------------------------------------------------------------------------