From 7968ddf0206e2c8b7118baf77c9e2c84d7f2a893 Mon Sep 17 00:00:00 2001 From: cassidoxa Date: Sun, 12 Mar 2023 17:20:54 -0400 Subject: [PATCH 1/3] Compass and map HUD display modes properly skip or draw Minor key count refactor, count HC and Sewers as both in all cases --- compasses.asm | 24 +++++++++++------------- inventory.asm | 6 +++++- newitems.asm | 10 +++++----- pendantcrystalhud.asm | 30 +++++++++++++----------------- stats.asm | 33 ++++++++++++++++++--------------- 5 files changed, 52 insertions(+), 51 deletions(-) diff --git a/compasses.asm b/compasses.asm index 2b9e431..a102cc5 100644 --- a/compasses.asm +++ b/compasses.asm @@ -13,13 +13,12 @@ RTL DrawCompassCounts: PHX - LDA.l CompassMode : BIT.w #$0002 : BNE + ; if CompassMode==2, we don't check for the compass - LDA.l CompassField : AND.w DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks - BEQ .done ; skip if we don't have compass + LDA.l CompassMode : BEQ .done + 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 ; Count sewer as Hyrule Castle - + + TXA : LSR : TAX LDA.l CompassTotalsWRAM, X : AND.w #$00FF SEP #$20 JSR HudHexToDec2Digit @@ -41,13 +40,12 @@ RTS DrawMapCounts: PHX - LDA.l MapHUDMode : BIT.w #$0002 : BNE + ; if MapHUDMode==2, we don't check for map - LDA.l MapField : AND.w DungeonItemMasks, X ; Load map values to A, mask with dungeon item masks - BEQ .done ; skip if we don't have map + LDA.l MapHUDMode : BEQ .done + 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 + - TXA : LSR : TAX : BNE + - INC ; Count sewer as Hyrule Castle - + + TXA : LSR : TAX LDA.l MapTotalsWRAM, X : AND.w #$00FF SEP #$20 JSR HudHexToDec2Digit @@ -66,7 +64,7 @@ DrawMapCounts: 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 + dw $C000, $C000, $2000, $1000, $0800, $0400, $0200, $0100 dw $0080, $0040, $0020, $0010, $0008, $0004 ;-------------------------------------------------------------------------------- InitDungeonCounts: diff --git a/inventory.asm b/inventory.asm index 64c34ac..1e41976 100644 --- a/inventory.asm +++ b/inventory.asm @@ -379,7 +379,7 @@ AddInventory: LDX.b #$02 JSR .incrementMail + CPY.b #$24 : BNE + ; Small Key - JSR .incrementKey + JSR .incrementVanillaKey JMP .done + CPY.b #$25 : BNE + ; Compass JSL MaybeFlagCompassTotalPickup @@ -615,6 +615,10 @@ RTS JSR .incrementKey RTL +.incrementVanillaKey + LDA.l SmallKeyCounter : INC : STA.l SmallKeyCounter + JSL.l UpdateKeys + .incrementKey LDA.l SmallKeyCounter : INC : STA.l SmallKeyCounter RTS diff --git a/newitems.asm b/newitems.asm index 344d22f..d64db39 100644 --- a/newitems.asm +++ b/newitems.asm @@ -348,11 +348,11 @@ AddReceivedItemExpandedGetItem: AND.b #$0F : TAX LDA.l DungeonKeys, X : INC : STA.l DungeonKeys, X ; Increment Key Count - CPX.b #$00 : BNE ++ - STA.l HyruleCastleKeys ; copy HC to sewers - ++ : CPX.b #$01 : BNE ++ - STA.l SewerKeys ; copy sewers to HC - ++ + CPX.b #$00 : BNE ++ + STA.l HyruleCastleKeys ; copy HC to sewers + ++ : CPX.b #$01 : BNE ++ + STA.l SewerKeys ; copy sewers to HC + ++ LDA.l GenericKeys : BEQ + .generic diff --git a/pendantcrystalhud.asm b/pendantcrystalhud.asm index cc11eb5..e850b95 100644 --- a/pendantcrystalhud.asm +++ b/pendantcrystalhud.asm @@ -185,23 +185,19 @@ ShowDungeonItems: RTL ;-------------------------------------------------------------------------------- UpdateKeys: - PHX : PHP - SEP #$30 ; set 8-bit accumulator & index registers - LDA.w DungeonID : CMP.b TSWQ : !BLT .skip - - LSR : TAX ; get dungeon index and store to X - - LDA.l CurrentSmallKeys ; load current key count - STA.l DungeonKeys, X ; save to main counts - - CPX.b #$00 : BNE + - STA.l HyruleCastleKeys ; copy HC to sewers - + : CPX.b #$01 : BNE + - STA.l SewerKeys ; copy sewers to HC - + - .skip - JSL.l PostItemGet - PLP : PLX + PHX : PHP + SEP #$30 ; set 8-bit accumulator & index registers + LDA.w DungeonID : CMP.b TSWQ : !BLT .skip + LSR : TAX ; get dungeon index and store to X + LDA.l DungeonKeys, X : INC : STA.l DungeonKeys, X + + CPX.b #$00 : BNE + + STA.l HyruleCastleKeys ; copy HC to sewers + + : CPX.b #$01 : BNE + + STA.l SewerKeys ; copy sewers to HC + + + .skip + PLP : PLX RTL ;$37C = Sewer Passage ;$37D = Hyrule Castle diff --git a/stats.asm b/stats.asm index 5f68128..ed0cc5b 100644 --- a/stats.asm +++ b/stats.asm @@ -115,21 +115,24 @@ CountChestKeyLong: ; called from ItemDowngradeFix in itemdowngrade.asm RTL ;-------------------------------------------------------------------------------- CountChestKey: ; called by neighbor functions - PHA : PHX - CPY.b #$24 : BEQ + ; small key for this dungeon - use DungeonID - CPY.b #$A0 : !BLT .end ; Ignore most items - 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 - INC - ++ TAX : BRA .count ; use Key id instead of DungeonID (Keysanity) - + LDA.w DungeonID : LSR - BNE + - INC ; combines HC and Sewer counts - + TAX - .count - LDA.l DungeonCollectedKeys, X : INC : STA.l DungeonCollectedKeys, X - .end - PLX : PLA + PHA : PHX + CPY.b #$24 : BEQ + ; small key for this dungeon - use DungeonID + CPY.b #$A0 : !BLT .end ; Ignore most items + CPY.b #$AE : !BGE .end ; Ignore reserved key and generic key + TAX : BRA .count ; use Key id instead of DungeonID (Keysanity) + + + LDA.w DungeonID : LSR : TAX + .count + 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 + PLX : PLA RTS ;-------------------------------------------------------------------------------- CountBonkItem: ; called from GetBonkItem in bookofmudora.asm From df60b3641b04a5bfd6f2fd4a565bcb38e7d48cbd Mon Sep 17 00:00:00 2001 From: cassidoxa Date: Sun, 12 Mar 2023 18:30:02 -0400 Subject: [PATCH 2/3] Draw flute, shovel, powder, mushroom correctly on file select --- fileselect.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fileselect.asm b/fileselect.asm index aa65424..cf9a114 100644 --- a/fileselect.asm +++ b/fileselect.asm @@ -234,7 +234,7 @@ DrawPlayerFileShared: ; %fs_drawItemBasic(EquipmentSRAM+$03,3,18,FileSelectItems_bombs) ; Powder - LDA.l InventoryTrackingSRAM : AND.w #$0010 : BEQ + + LDA.l InventoryTrackingSRAM : AND.w #$1000 : BEQ + %fs_drawItem(3,20,FileSelectItems_powder) BRA ++ + @@ -242,7 +242,7 @@ DrawPlayerFileShared: ++ ; Mushroom - LDA.l InventoryTrackingSRAM : AND.w #$0008 : BEQ + + LDA.l InventoryTrackingSRAM : AND.w #$2800 : BEQ + %fs_drawItem(3,18,FileSelectItems_mushroom) BRA ++ + @@ -250,7 +250,7 @@ DrawPlayerFileShared: ++ ; Flute - LDA.l InventoryTrackingSRAM : AND.w #$0003 : BEQ + + LDA.l InventoryTrackingSRAM : AND.w #$0300 : BEQ + %fs_drawItem(7,16,FileSelectItems_flute) BRA ++ + @@ -258,7 +258,7 @@ DrawPlayerFileShared: ++ ; Shovel - LDA.l InventoryTrackingSRAM : AND.w #$0004 : BEQ + + LDA.l InventoryTrackingSRAM : AND.w #$0400 : BEQ + %fs_drawItem(9,12,FileSelectItems_shovel) BRA ++ + From efa5d288a894c5b8f2fea1629b540664c3c6d724 Mon Sep 17 00:00:00 2001 From: cassidoxa Date: Sun, 12 Mar 2023 19:14:14 -0400 Subject: [PATCH 3/3] Fix typo --- pendantcrystalhud.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pendantcrystalhud.asm b/pendantcrystalhud.asm index e850b95..9086510 100644 --- a/pendantcrystalhud.asm +++ b/pendantcrystalhud.asm @@ -187,7 +187,7 @@ RTL UpdateKeys: PHX : PHP 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 LDA.l DungeonKeys, X : INC : STA.l DungeonKeys, X