Merge pull request #188 from cassidoxa/keys_hud

Compass and map HUD display modes properly skip or draw
This commit is contained in:
Lexi Rose
2023-03-12 20:42:04 -05:00
committed by GitHub
6 changed files with 56 additions and 55 deletions

View File

@@ -13,13 +13,12 @@ RTL
DrawCompassCounts: DrawCompassCounts:
PHX PHX
LDA.l CompassMode : BIT.w #$0002 : BNE + ; if CompassMode==2, we don't check for the compass LDA.l CompassMode : BEQ .done
LDA.l CompassField : AND.w DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks 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 BEQ .done ; skip if we don't have compass
+ +
TXA : LSR : TAX : BNE + TXA : LSR : TAX
INC ; Count sewer as Hyrule Castle
+
LDA.l CompassTotalsWRAM, X : AND.w #$00FF LDA.l CompassTotalsWRAM, X : AND.w #$00FF
SEP #$20 SEP #$20
JSR HudHexToDec2Digit JSR HudHexToDec2Digit
@@ -41,13 +40,12 @@ RTS
DrawMapCounts: DrawMapCounts:
PHX PHX
LDA.l MapHUDMode : BIT.w #$0002 : BNE + ; if MapHUDMode==2, we don't check for map LDA.l MapHUDMode : BEQ .done
LDA.l MapField : AND.w DungeonItemMasks, X ; Load map values to A, mask with dungeon item masks 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 BEQ .done ; skip if we don't have map
+ +
TXA : LSR : TAX : BNE + TXA : LSR : TAX
INC ; Count sewer as Hyrule Castle
+
LDA.l MapTotalsWRAM, X : AND.w #$00FF LDA.l MapTotalsWRAM, X : AND.w #$00FF
SEP #$20 SEP #$20
JSR HudHexToDec2Digit JSR HudHexToDec2Digit
@@ -66,7 +64,7 @@ DrawMapCounts:
RTS RTS
DungeonItemMasks: ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc 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 dw $C000, $C000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004 dw $0080, $0040, $0020, $0010, $0008, $0004
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
InitDungeonCounts: InitDungeonCounts:

View File

@@ -234,7 +234,7 @@ DrawPlayerFileShared:
; %fs_drawItemBasic(EquipmentSRAM+$03,3,18,FileSelectItems_bombs) ; %fs_drawItemBasic(EquipmentSRAM+$03,3,18,FileSelectItems_bombs)
; Powder ; Powder
LDA.l InventoryTrackingSRAM : AND.w #$0010 : BEQ + LDA.l InventoryTrackingSRAM : AND.w #$1000 : BEQ +
%fs_drawItem(3,20,FileSelectItems_powder) %fs_drawItem(3,20,FileSelectItems_powder)
BRA ++ BRA ++
+ +
@@ -242,7 +242,7 @@ DrawPlayerFileShared:
++ ++
; Mushroom ; Mushroom
LDA.l InventoryTrackingSRAM : AND.w #$0008 : BEQ + LDA.l InventoryTrackingSRAM : AND.w #$2800 : BEQ +
%fs_drawItem(3,18,FileSelectItems_mushroom) %fs_drawItem(3,18,FileSelectItems_mushroom)
BRA ++ BRA ++
+ +
@@ -250,7 +250,7 @@ DrawPlayerFileShared:
++ ++
; Flute ; Flute
LDA.l InventoryTrackingSRAM : AND.w #$0003 : BEQ + LDA.l InventoryTrackingSRAM : AND.w #$0300 : BEQ +
%fs_drawItem(7,16,FileSelectItems_flute) %fs_drawItem(7,16,FileSelectItems_flute)
BRA ++ BRA ++
+ +
@@ -258,7 +258,7 @@ DrawPlayerFileShared:
++ ++
; Shovel ; Shovel
LDA.l InventoryTrackingSRAM : AND.w #$0004 : BEQ + LDA.l InventoryTrackingSRAM : AND.w #$0400 : BEQ +
%fs_drawItem(9,12,FileSelectItems_shovel) %fs_drawItem(9,12,FileSelectItems_shovel)
BRA ++ BRA ++
+ +

View File

@@ -379,7 +379,7 @@ AddInventory:
LDX.b #$02 LDX.b #$02
JSR .incrementMail JSR .incrementMail
+ CPY.b #$24 : BNE + ; Small Key + CPY.b #$24 : BNE + ; Small Key
JSR .incrementKey JSR .incrementVanillaKey
JMP .done JMP .done
+ CPY.b #$25 : BNE + ; Compass + CPY.b #$25 : BNE + ; Compass
JSL MaybeFlagCompassTotalPickup JSL MaybeFlagCompassTotalPickup
@@ -615,6 +615,10 @@ RTS
JSR .incrementKey JSR .incrementKey
RTL RTL
.incrementVanillaKey
LDA.l SmallKeyCounter : INC : STA.l SmallKeyCounter
JSL.l UpdateKeys
.incrementKey .incrementKey
LDA.l SmallKeyCounter : INC : STA.l SmallKeyCounter LDA.l SmallKeyCounter : INC : STA.l SmallKeyCounter
RTS RTS

View File

@@ -187,12 +187,9 @@ RTL
UpdateKeys: UpdateKeys:
PHX : PHP PHX : PHP
SEP #$30 ; set 8-bit accumulator & index registers SEP #$30 ; set 8-bit accumulator & index registers
LDA.w DungeonID : CMP.b TSWQ : !BLT .skip LDA.w DungeonID : CMP.b #$1F : !BGE .skip
LSR : TAX ; get dungeon index and store to X LSR : TAX ; get dungeon index and store to X
LDA.l DungeonKeys, X : INC : STA.l DungeonKeys, X
LDA.l CurrentSmallKeys ; load current key count
STA.l DungeonKeys, X ; save to main counts
CPX.b #$00 : BNE + CPX.b #$00 : BNE +
STA.l HyruleCastleKeys ; copy HC to sewers STA.l HyruleCastleKeys ; copy HC to sewers
@@ -200,7 +197,6 @@ UpdateKeys:
STA.l SewerKeys ; copy sewers to HC STA.l SewerKeys ; copy sewers to HC
+ +
.skip .skip
JSL.l PostItemGet
PLP : PLX PLP : PLX
RTL RTL
;$37C = Sewer Passage ;$37C = Sewer Passage

View File

@@ -119,15 +119,18 @@ CountChestKey: ; called by neighbor functions
CPY.b #$24 : BEQ + ; small key for this dungeon - use DungeonID CPY.b #$24 : BEQ + ; small key for this dungeon - use DungeonID
CPY.b #$A0 : !BLT .end ; Ignore most items CPY.b #$A0 : !BLT .end ; Ignore most items
CPY.b #$AE : !BGE .end ; Ignore reserved key and generic key CPY.b #$AE : !BGE .end ; Ignore reserved key and generic key
TYA : AND.B #$0F : BNE ++ ; If this is an HC key, instead count it as a sewers key TAX : BRA .count ; use Key id instead of DungeonID (Keysanity)
INC +
++ TAX : BRA .count ; use Key id instead of DungeonID (Keysanity) LDA.w DungeonID : LSR : TAX
+ LDA.w DungeonID : LSR
BNE +
INC ; combines HC and Sewer counts
+ TAX
.count .count
LDA.l DungeonCollectedKeys, X : INC : STA.l DungeonCollectedKeys, X LDA.l DungeonCollectedKeys, X : INC : STA.l DungeonCollectedKeys, X
CPX.b #$00 : BNE +
STA.l HCCollectedKeys ; copy HC to sewers
+
CPX.b #$01 : BNE +
STA.l SewerCollectedKeys ; copy sewers to HC
+
.end .end
PLX : PLA PLX : PLA
RTS RTS