Add HUD map mode flag, "chest key" totals table, and seen-counter flags

for tracking
This commit is contained in:
cassidoxa
2023-02-23 20:46:40 -05:00
parent 66fd23fc61
commit a2020c9c76
8 changed files with 85 additions and 18 deletions

View File

@@ -42,11 +42,16 @@ DungeonItemMasks: ; these are dungeon correlations to $7EF364 - $7EF369 so it kn
dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004
;--------------------------------------------------------------------------------
InitCompassTotalsRAM:
LDX.b #$00
InitDungeonCounts:
LDX.b #$0F
-
LDA.l CompassTotalsROM, X : STA.l CompassTotalsWRAM, X
INX
CPX.b #$0F : !BLT -
DEX
BPL -
LDX.b #$0F
-
LDA.l ChestKeys, X : STA.l MapTotalsWRAM, X
DEX
BPL -
RTL

View File

@@ -16,7 +16,7 @@ JML.l ReturnFromOnDrawHud
;--------------------------------------------------------------------------------
OnDungeonEntrance:
STA.l PegColor ; thing we wrote over
JSL MaybeFlagCompassTotalEntrance
JSL MaybeFlagDungeonTotalsEntrance
RTL
;--------------------------------------------------------------------------------
OnPlayerDead:

View File

@@ -67,6 +67,6 @@ Init_PostRAMClear:
JSL MSUInit
JSL InitRNGPointerTable
JSL InitCompassTotalsRAM
JSL InitDungeonCounts
JML $00D463 ; The original target of the jump table that we hijacked

View File

@@ -408,6 +408,7 @@ AddInventory:
JSR .incrementBigKey
JMP .done
+ CPY.b #$33 : BNE + ; Map
JSL MaybeFlagMapTotalPickup
JSR .incrementMap
JMP .done
+ CPY.b #$37 : !BLT + ; Items $37 - $39 - Pendants
@@ -492,6 +493,7 @@ AddInventory:
JMP .done
+ CPY.b #$70 : !BLT + ; Items $70 - $7F - Free Maps
CPY.b #$80 : !BGE +
JSL MaybeFlagMapTotalPickup
JSR .incrementMap
JMP .done
+ CPY.b #$80 : !BLT + ; Items $80 - $8F - Free Compasses

View File

@@ -1087,14 +1087,23 @@ MaybeFlagCompassTotalPickup:
.done
RTL
;--------------------------------------------------------------------------------
; Set the compass count display flag if we're entering a dungeon and alerady have
; that compass
MaybeFlagCompassTotalEntrance:
LDX.w DungeonID : CPX.b #$FF : BEQ .done ; Skip if we're not entering dungeon
LDA.l CompassMode : AND.w #$000F : BEQ .done ; Skip if we're not showing compass counts
CMP.w #$0002 : BEQ .countShown
; Set the dungeon item count display flags if we're entering a dungeon and have the
; corresponding dungeon item
MaybeFlagDungeonTotalsEntrance:
LDX.w DungeonID : CPX.b #$FF : BEQ .done ; Skip if we're not entering dungeon
LDA.l CompassMode : AND.w #$000F : BEQ .maps ; Skip if we're not showing compass counts
JSR.w FlagCompassCount
.maps
LDA.l MapHUDMode : AND.w #$000F : BEQ .done
LDX.w DungeonID
JSR.w FlagMapCount
.done
RTL
;--------------------------------------------------------------------------------
FlagCompassCount:
CMP.w #$0002 : BEQ .compassShown
LDA.l CompassField : AND.l DungeonItemMasks, X : BEQ .done ; skip if we don't have compass
.countShown
.compassShown
SEP #$20
TXA : LSR : STA.b Scrap04 : LDA.b #$0F : !SUB Scrap04 ; Compute flag index
CMP.b #$08 : !BGE ++
@@ -1109,5 +1118,46 @@ MaybeFlagCompassTotalEntrance:
ORA.l CompassCountDisplay+1 : STA.l CompassCountDisplay+1
REP #$20
.done
RTS
;--------------------------------------------------------------------------------
FlagMapCount:
CMP.w #$0002 : BEQ .mapShown
LDA.l MapField : AND.l DungeonItemMasks, X : BEQ .done ; skip if we don't have map
.mapShown
SEP #$20
TXA : LSR : STA.b Scrap04 : LDA.b #$0F : !SUB Scrap04 ; Compute flag index
CMP.b #$08 : !BGE ++
%ValueShift()
ORA.l MapCountDisplay : STA.l MapCountDisplay
REP #$20
BRA .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ + : LDA.b #$C0 : + ; Make Hyrule Castle / Sewers Count for Both
ORA.l MapCountDisplay+1 : STA.l MapCountDisplay+1
REP #$20
.done
RTS
;--------------------------------------------------------------------------------
MaybeFlagMapTotalPickup:
LDA.l MapMode : AND.b #$0F : BEQ .done
LDA.w DungeonID : CMP.b #$FF : BEQ .done
LSR : STA.b Scrap04 : LDA.b #$0F : !SUB Scrap04 ; Compute flag "index"
CPY.b #$25 : BEQ .setFlag ; Set flag if it's a compass for this dungeon
STA.b Scrap04
TYA : AND.b #$0F : CMP.b Scrap04 : BNE .done ; Check if map is for this dungeon
.setFlag
CMP.b #$08 : !BGE ++
%ValueShift()
ORA.l MapCountDisplay : STA.l MapCountDisplay
BRA .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ + : LDA.b #$C0 : + ; Make Hyrule Castle / Sewers Count for Both
ORA.l MapCountDisplay+1 : STA.l MapCountDisplay+1
.done
RTL
;--------------------------------------------------------------------------------

View File

@@ -544,8 +544,9 @@ RxStatus: skip 1 ;
TxBuffer: skip $7F ;
TxStatus: skip 1 ;
skip $10 ; Unused
CompassTotalsWRAM: skip $10 ; skip $10
skip $40 ; Reserved for general dungeon tracking data. May have over
CompassTotalsWRAM: skip $10 ; \ Compass and map dungeon HUD display totals. Placed in WRAM
MapTotalsWRAM: skip $10 ; / on boot for tracking.
skip $30 ; Reserved for general dungeon tracking data. May have over
; allocated here. Feel free to reassign.
skip $40 ; Unused
skip $260 ; Unused
@@ -913,6 +914,7 @@ endmacro
%assertRAM(TxBuffer, $7F5380)
%assertRAM(TxStatus, $7F53FF)
%assertRAM(CompassTotalsWRAM, $7F5410)
%assertRAM(MapTotalsWRAM, $7F5420)
%assertRAM(DialogBuffer, $7F5700)
%assertRAM(MiniGameTime, $7FFE00)
%assertRAM(MiniGameTimeFinal, $7FFE04)

View File

@@ -317,7 +317,8 @@ HeartPieceCounter: skip 1 ; Total Number of heartpieces collected (integer
CrystalCounter: skip 1 ; Total Number of crystals collected (integer)
DungeonsCompleted: skip 2 ; Bitfield indicating whether a dungeon's prize has been collected.
; This has the same shape as the dungeon item bitfields.
skip 44 ; Unused
MapCountDisplay: skip 2 ;
skip 42 ; Unused
ServiceSequence: ; See servicerequest.asm
ServiceSequenceRx: skip 8 ; Service sequence receive
ServiceSequenceTx: skip 8 ; Service sequence transmit
@@ -602,6 +603,7 @@ endmacro
%assertSRAM(HeartPieceCounter, $7EF470)
%assertSRAM(CrystalCounter, $7EF471)
%assertSRAM(DungeonsCompleted, $7EF472)
%assertSRAM(MapCountDisplay, $7EF474)
;--------------------------------------------------------------------------------
%assertSRAM(ServiceSequence, $7EF4A0)
%assertSRAM(ServiceSequenceRx, $7EF4A0)

View File

@@ -118,9 +118,11 @@ org $308038 ; PC 0x180038
LampConeSewers:
db #$01 ; #$00 = Off - #$01 = On (default)
;--------------------------------------------------------------------------------
; 0x180039 - 0x18003A (Unused)
; 0x180039 - 0x180039 (Unused)
;--------------------------------------------------------------------------------
org $30803B ; PC 0x18003B - PC 0x18003C
org $30803A ; PC 0x18003B - PC 0x18003C
MapHUDMode:
db #$00 ; #$00 = Off (default) - #$01 = Display Dungeon Count w/Map - #$02 = Display Dungeon Count Always
MapMode:
db #$00 ; #$00 = Always On (default) - #$01 = Require Map Item
CompassMode:
@@ -2544,6 +2546,10 @@ org $30F000 ; PC 0x187000-0x18700F
CompassTotalsROM:
db $08, $08, $06, $06, $02, $0A, $0E, $08, $08, $08, $06, $08, $0C, $1B, $00, $00
org $30F010
ChestKeys: ; PC 0x187010-0x18701F
db $01, $01, $00, $01, $02, $01, $06, $03, $03, $02, $01, $01, $04, $04, $00, $00
;--------------------------------------------------------------------------------
; 0x187010 - 187FFF (unused)
;--------------------------------------------------------------------------------