Port map key counter on HUD from DR

This commit is contained in:
cassidoxa
2023-02-23 21:46:27 -05:00
parent a2020c9c76
commit 068d4c2449
3 changed files with 39 additions and 18 deletions

View File

@@ -1,22 +1,24 @@
DrawDungeonCompassCounts:
DrawDungeonItemCounts:
LDX.b IndoorsFlag : BNE + : RTL : + ; Skip if outdoors
; extra hard safeties for getting dungeon ID to prevent crashes
PHA
LDA.w DungeonID : AND.w #$00FE : TAX ; force dungeon ID to be multiple of 2
PLA
CPX.b #$1B : BCS .done ; Skip if not in a valid dungeon ID
TXA : LSR : TAX : BNE +
INC ; Count sewer as Hyrule Castle
+
JSR.w DrawCompassCounts
JSR.w DrawMapCounts
.done
RTL
BIT.w #$0002 : BNE ++ ; if CompassMode==2, we don't check for the compass
DrawCompassCounts:
PHX
LDA.l CompassMode : BIT.w #$0002 : BNE + ; if CompassMode==2, we don't check for the compass
LDA.l CompassField : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks
BEQ .done ; skip if we don't have compass
++
TXA : LSR : TAX
BNE +
INC
+
+
LDA.l CompassTotalsWRAM, X : AND.w #$00FF
SEP #$20
JSR HudHexToDec2Digit
@@ -25,18 +27,39 @@ DrawDungeonCompassCounts:
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$9A
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$9C
PLX
LDA.l DungeonLocationsChecked, X : AND.w #$00FF
SEP #$20
JSR HudHexToDec2Digit
REP #$20
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$94 ; Draw the item count
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$96
LDA.w #$2830 : STA.l HUDTileMapBuffer+$98 ; draw the slash
.done
PLX
RTS
.done
RTL
DrawMapCounts:
PHX
LDA.l MapHUDMode : BIT.w #$0002 : BNE + ; if MapHUDMode==2, we don't check for map
LDA.l MapField : AND.l DungeonItemMasks, X ; Load map values to A, mask with dungeon item masks
BEQ .done ; skip if we don't have map
+
LDA.l MapTotalsWRAM, X : AND.w #$00FF
SEP #$20
JSR HudHexToDec2Digit
REP #$20
PHX
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$A6
PLX
LDA.l DungeonCollectedKeys, X : AND.w #$00FF
SEP #$20
JSR HudHexToDec2Digit
REP #$20
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$A2
LDA.w #$2830 : STA.l HUDTileMapBuffer+$A4 ; draw the slash
.done
PLX
RTS
DungeonItemMasks: ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc
dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100

View File

@@ -85,9 +85,7 @@ NewDrawHud:
;================================================================================
; Draw Dungeon Compass Counts
;================================================================================
LDA.l CompassMode : AND.w #$00FF : BEQ + ; skip if CompassMode is 0.
JSL.l DrawDungeonCompassCounts ; compasses.asm
+
JSL.l DrawDungeonItemCounts ; compasses.asm
;================================================================================
; Draw key count

View File

@@ -118,7 +118,7 @@ org $308038 ; PC 0x180038
LampConeSewers:
db #$01 ; #$00 = Off - #$01 = On (default)
;--------------------------------------------------------------------------------
; 0x180039 - 0x180039 (Unused)
; 0x180039 (Unused)
;--------------------------------------------------------------------------------
org $30803A ; PC 0x18003B - PC 0x18003C
MapHUDMode: