fix: bunch of fixes for key counting system
This commit is contained in:
@@ -71,9 +71,12 @@ DRHUD_DrawCurrentDungeonIndicator: ; mX
|
||||
DRHUD_DrawKeyCounter:
|
||||
LDA.l DRFlags : AND.b #$04 : BEQ DRHUD_Finished
|
||||
REP #$20
|
||||
TXA : LSR : TAX
|
||||
TXA : LSR : BNE .dungeon_id
|
||||
INC
|
||||
.dungeon_id
|
||||
TAX
|
||||
LDA.l GenericKeys : AND.w #$00FF : BNE .total_only
|
||||
LDA.w DungeonKeys, X : JSR ConvertToDisplay : STA.w HUDKeysObtained
|
||||
LDA.w DungeonAllCollectedKeys-1, X : JSR ConvertToDisplay : STA.w HUDKeysObtained
|
||||
LDA.w #!SlashTile : STA.w HUDKeysSlash
|
||||
.total_only
|
||||
LDA.l TotalKeys, x : JSR ConvertToDisplay : STA.w HUDKeysTotal
|
||||
@@ -240,7 +243,13 @@ ConvertToDisplay2:
|
||||
++ lda.w #$2827 : rts ; 0/O for 0 or placeholder digit ;2483
|
||||
|
||||
CountAbsorbedKeys:
|
||||
JML IncrementSmallKeysNoPrimary
|
||||
CPY.b #$24 : BNE .done
|
||||
PHA : PHX
|
||||
LDA.b #$84 : TAX ; pretend this isn't a smallkey, but an absorbed object (small heart)
|
||||
REP #$10 : JSL CountAllKey : SEP #$10
|
||||
PLX : PLA
|
||||
.done
|
||||
JML IncrementSmallKeysNoPrimary
|
||||
|
||||
;================================================================================
|
||||
; 8-bit registers
|
||||
|
||||
@@ -31,7 +31,7 @@ StalfosKnightDrawOverride:
|
||||
|
||||
.vanilla
|
||||
JSL Sprite_PrepOAMCoordLong
|
||||
JML Sprite_91_StalfosKnight_continue
|
||||
RTL
|
||||
|
||||
BlobDrawOverride:
|
||||
PLA : PLA : PLA ; fix the call stack
|
||||
|
||||
@@ -220,7 +220,8 @@ DungeonIncrement:
|
||||
REP #$10
|
||||
PHX
|
||||
LDA.w InventoryTable_properties,X : BIT.b #$40 : BEQ +
|
||||
JSL CountChestKeyLong
|
||||
CPY.w #$0024 : BEQ + ; keys for this dungeon are done elsewhere
|
||||
JSL CountAllKey
|
||||
+
|
||||
LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done
|
||||
SEP #$10
|
||||
|
||||
17
sram.asm
17
sram.asm
@@ -361,7 +361,21 @@ TRCollectedKeys: skip 1 ; | Turtle Rock
|
||||
GTCollectedKeys: skip 1 ; / Ganon's Tower
|
||||
skip 2 ; Reserved for previous table
|
||||
FileMarker: skip 1 ; $FF = Active save file | $00 = Inactive save file
|
||||
skip 13 ; Unused
|
||||
DungeonAllCollectedKeys: ; \ Key Counters. Counts all keys for a dungeon. Chests and drops.
|
||||
; | Note, this label is not indexed like others due to space. Sewers has no decicated entry.
|
||||
HCAllCollectedKeys: skip 1 ; | Hyrule Castle
|
||||
EPAllCollectedKeys: skip 1 ; | Eastern Palace
|
||||
DPAllCollectedKeys: skip 1 ; | Desert Palace
|
||||
CTAllCollectedKeys: skip 1 ; | Agahnim's Tower
|
||||
SPAllCollectedKeys: skip 1 ; | Swamp Palace
|
||||
PDAllCollectedKeys: skip 1 ; | Palace of Darkness
|
||||
MMAllCollectedKeys: skip 1 ; | Misery Mire
|
||||
SWAllCollectedKeys: skip 1 ; | Skull Woods
|
||||
IPAllCollectedKeys: skip 1 ; | Ice Palace
|
||||
THAllCollectedKeys: skip 1 ; | Tower of Hera
|
||||
TTAllCollectedKeys: skip 1 ; | Thieves' Town
|
||||
TRAllCollectedKeys: skip 1 ; | Turtle Rock
|
||||
GTAllCollectedKeys: skip 1 ; / Ganon's Tower
|
||||
InverseChecksumWRAM: skip 2 ; Vanilla Inverse Checksum. Don't write unless computing checksum.
|
||||
|
||||
;================================================================================
|
||||
@@ -623,6 +637,7 @@ endmacro
|
||||
%assertSRAM(TRCollectedKeys, $7EF4EC)
|
||||
%assertSRAM(GTCollectedKeys, $7EF4ED)
|
||||
%assertSRAM(FileMarker, $7EF4F0)
|
||||
%assertSRAM(DungeonAllCollectedKeys, $7EF4F1)
|
||||
;--------------------------------------------------------------------------------
|
||||
%assertSRAM(ExtendedSaveDataWRAM, $7F6000)
|
||||
%assertSRAM(ExtendedFileNameWRAM, $7F6000)
|
||||
|
||||
60
stats.asm
60
stats.asm
@@ -115,38 +115,42 @@ DecrementSmallKeys:
|
||||
STA.l CurrentSmallKeys ; thing we wrote over, write small key count
|
||||
JSL UpdateKeys
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
CountChestKeyLong:
|
||||
PHX : PHP
|
||||
SEP #$30
|
||||
JSR CountChestKey
|
||||
PLP : PLX
|
||||
RTL
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
CountChestKey:
|
||||
PHA : PHX
|
||||
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .done
|
||||
LDA.l StatsLocked : BNE .done
|
||||
CPY.b #$24 : BEQ .this_dungeon
|
||||
TYA
|
||||
AND.b #$0F : CMP.b #$02 : BCC .hc_sewers
|
||||
TAX
|
||||
LDA.l DungeonCollectedKeys,X : INC : STA.l DungeonCollectedKeys,X
|
||||
BRA .done
|
||||
.this_dungeon
|
||||
LDA.w DungeonID : CMP.b #$03 : BCC .hc_sewers
|
||||
LSR : TAX
|
||||
LDA.l DungeonCollectedKeys,X : INC : STA.l DungeonCollectedKeys,X
|
||||
BRA .done
|
||||
; Expects 16 bit index mode upon entering. 8-bit Acumulator
|
||||
CountAllKey:
|
||||
PHP : PHA : PHX
|
||||
SEP #$10
|
||||
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .done
|
||||
CPY.b #$24 : BEQ .this_dungeon
|
||||
TYA : AND.b #$0F : CMP.b #$02 : BCC .hc_sewers
|
||||
BRA .all_dungoens
|
||||
|
||||
.hc_sewers
|
||||
LDA.l SewerCollectedKeys : INC
|
||||
STA.l SewerCollectedKeys : STA.l HCCollectedKeys
|
||||
.this_dungeon
|
||||
LDA.w DungeonID : CMP.b #$03 : BCC .hc_sewers
|
||||
LSR
|
||||
|
||||
.done
|
||||
PLX : PLA
|
||||
RTS
|
||||
.all_dungoens
|
||||
STA.b Scrap00 : TAX ; store dungeon index in X, $00
|
||||
LDA.l DungeonAllCollectedKeys-1, X : INC : STA.l DungeonAllCollectedKeys-1, X
|
||||
REP #$10 : PLX : PHX ; 16 bit index
|
||||
LDA.l InventoryTable_properties, X : BIT.b #$40 : BEQ .done
|
||||
SEP #$10 : LDX.b Scrap00
|
||||
LDA.l DungeonCollectedKeys,X : INC : STA.l DungeonCollectedKeys,X
|
||||
BRA .done
|
||||
|
||||
.hc_sewers
|
||||
LDA.l HCAllCollectedKeys : INC : STA.l HCAllCollectedKeys
|
||||
REP #$10 : PLX : PHX ; 16 bit index
|
||||
LDA.l InventoryTable_properties, X : BIT.b #$40 : BEQ .done
|
||||
LDA.l SewerCollectedKeys : INC
|
||||
STA.l SewerCollectedKeys : STA.l HCCollectedKeys
|
||||
|
||||
.done
|
||||
REP #$10
|
||||
PLX : PLA : PLP
|
||||
RTL
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
IncrementAgahnim2Sword:
|
||||
|
||||
Reference in New Issue
Block a user