From 086230bb8cc230adf8e78555c26884420e76cdc0 Mon Sep 17 00:00:00 2001 From: Catobat <69204835+Catobat@users.noreply.github.com> Date: Sat, 28 Aug 2021 04:01:28 +0200 Subject: [PATCH 1/5] Fix check for wild maps --- newhud.asm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/newhud.asm b/newhud.asm index a8d0e3c..bb1db93 100644 --- a/newhud.asm +++ b/newhud.asm @@ -152,9 +152,8 @@ SEP #$30 LDA $10 : CMP #$12 : BEQ .noprize - REP #$20 - LDA.l MapMode + REP #$20 BEQ .drawprize LDA.l $7EF368 From bbc8228175e023347d0e017925008ebe8bd81a9f Mon Sep 17 00:00:00 2001 From: cassidy Date: Mon, 6 Sep 2021 17:21:48 -0400 Subject: [PATCH 2/5] utilities: Fix shields overflowing with narrow sprites --- utilities.asm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/utilities.asm b/utilities.asm index fa059fa..fad70c6 100644 --- a/utilities.asm +++ b/utilities.asm @@ -324,13 +324,10 @@ IsNarrowSprite: + : BRA .continue ++ : CMP.b #$5F : BNE ++ ; Progressive Shield LDA !PROGRESSIVE_SHIELD : AND #$C0 : BNE + : SEC : BRA .done ; No Shield - LSR #6 : CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit + + : LSR #6 : CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit LDA.l ProgressiveShieldReplacement JSL.l IsNarrowSprite BRA .done - + - ;LDA $7EF35A : BNE + : SEC : BRA .done : +; No Shield - BRA .false ; Everything Else ++ CMP.b #$60 : BNE ++ ; Progressive Armor LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit LDA.l ProgressiveArmorReplacement From 9f1933d8c04598559dadab4e3a6acd9451cb0a0b Mon Sep 17 00:00:00 2001 From: cassidy Date: Mon, 6 Sep 2021 20:16:41 -0400 Subject: [PATCH 3/5] utilities: Progressive Bow overflow narrow sprites --- utilities.asm | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/utilities.asm b/utilities.asm index fad70c6..5e81d75 100644 --- a/utilities.asm +++ b/utilities.asm @@ -314,32 +314,44 @@ IsNarrowSprite: LDA.l BottleLimitReplacement JSL.l IsNarrowSprite JMP .done - + : BRA .continue + + : JMP .continue .notBottle CMP.b #$5E : BNE ++ ; Progressive Sword LDA $7EF359 : CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit LDA.l ProgressiveSwordReplacement JSL.l IsNarrowSprite - BRA .done - + : BRA .continue - ++ : CMP.b #$5F : BNE ++ ; Progressive Shield - LDA !PROGRESSIVE_SHIELD : AND #$C0 : BNE + : SEC : BRA .done ; No Shield - + : LSR #6 : CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit + JMP .done + + : JMP .continue + ++ CMP.b #$5F : BNE ++ ; Progressive Shield + LDA !PROGRESSIVE_SHIELD : AND #$C0 : BNE + : SEC : JMP .done ; No Shield + + : LSR #6 : CMP.l ProgressiveShieldLimit : !BLT .continue LDA.l ProgressiveShieldReplacement JSL.l IsNarrowSprite - BRA .done + JMP .done ++ CMP.b #$60 : BNE ++ ; Progressive Armor - LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit + LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT .continue LDA.l ProgressiveArmorReplacement JSL.l IsNarrowSprite - BRA .done + JMP .done + ++ CMP.b #$62 : BNE ++ ; RNG Item (Single) - JSL.l GetRNGItemSingle : BRA .continue + JSL.l GetRNGItemSingle : JMP .continue ++ CMP.b #$63 : BNE ++ ; RNG Item (Multi) JSL.l GetRNGItemMulti - ++ - + ++ CMP.b #$64 : BEQ .progressivebow ; Progressive Bow + CMP.b #$65 : BNE .continue ; Progressive Bow (alt) + .progressivebow + LDA $7EF38E : BIT #$A0 : BEQ .continue ; No Progressive Bows + LDX.b #$0 ; Bow counter + CMP #$80 : BEQ + ; We have only one of two + CMP #$20 : BEQ + ; progressive bows + INX + + + INX + TXA : CMP.l ProgressiveBowLimit : !BLT .continue + LDA.l ProgressiveBowReplacement + JSL.l IsNarrowSprite + JMP .done .continue ;-------- From c37dcec6eaf86d5c38a959097d50b8e7a58e642f Mon Sep 17 00:00:00 2001 From: cassidy Date: Mon, 6 Sep 2021 20:20:12 -0400 Subject: [PATCH 4/5] utilities: refactor some JSL X : RTL into JMP X --- utilities.asm | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/utilities.asm b/utilities.asm index 5e81d75..6c2aae0 100644 --- a/utilities.asm +++ b/utilities.asm @@ -23,8 +23,7 @@ GetSpriteID: .bottle PHA : JSR.w CountBottles : CMP.l BottleLimit : !BLT + PLA : LDA.l BottleLimitReplacement - JSL.l GetSpriteID - RTL + JMP GetSpriteID + PLA : BRA .normal .server_F0 @@ -57,16 +56,14 @@ RTL ++ CMP.b #$FD : BNE ++ ; Progressive Armor LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit LDA.l ProgressiveArmorReplacement - JSL.l GetSpriteID - RTL + JMP GetSpriteID + LDA.b #$04 : RTL ++ CMP.b #$FE : BNE ++ ; Progressive Sword LDA $7EF359 CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit LDA.l ProgressiveSwordReplacement - JSL.l GetSpriteID - RTL + JMP GetSpriteID + : CMP.b #$00 : BNE + ; No Sword LDA.b #$43 : RTL + : CMP.b #$01 : BNE + ; Fighter Sword @@ -80,8 +77,7 @@ RTL LDA !PROGRESSIVE_SHIELD : AND #$C0 : LSR #6 CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit LDA.l ProgressiveShieldReplacement - JSL.l GetSpriteID - RTL + JMP GetSpriteID + : CMP.b #$00 : BNE + ; No Shield LDA.b #$2D : RTL + : CMP.b #$01 : BNE + ; Fighter Shield @@ -92,8 +88,7 @@ RTL LDA $7EF340 : INC : LSR CMP.l ProgressiveBowLimit : !BLT + LDA.l ProgressiveBowReplacement - JSL.l GetSpriteID - RTL + JMP GetSpriteID + : CMP.b #$00 : BNE + ; No Bow LDA.b #$29 : RTL + ; Any Bow @@ -176,8 +171,7 @@ GetSpritePalette: .bottle PHA : JSR.w CountBottles : CMP.l BottleLimit : !BLT + PLA : LDA.l BottleLimitReplacement - JSL.l GetSpritePalette - RTL + JMP GetSpritePalette + PLA : .notBottle PHX @@ -192,8 +186,7 @@ RTL LDA $7EF359 CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit LDA.l ProgressiveSwordReplacement - JSL.l GetSpritePalette - RTL + JMP GetSpritePalette + : CMP.b #$00 : BNE + ; No Sword LDA.b #$04 : RTL + : CMP.b #$01 : BNE + ; Fighter Sword @@ -206,8 +199,7 @@ RTL LDA !PROGRESSIVE_SHIELD : AND #$C0 : LSR #6 CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit LDA.l ProgressiveShieldReplacement - JSL.l GetSpritePalette - RTL + JMP GetSpritePalette + : CMP.b #$00 : BNE + ; No Shield LDA.b #$04 : RTL + : CMP.b #$01 : BNE + ; Fighter Shield @@ -217,8 +209,7 @@ RTL ++ : CMP.b #$FF : BNE ++ ; Progressive Armor LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit LDA.l ProgressiveArmorReplacement - JSL.l GetSpritePalette - RTL + JMP GetSpritePalette + : CMP.b #$00 : BNE + ; Green Tunic LDA.b #$04 : RTL + ; Everything Else @@ -232,8 +223,7 @@ RTL LDA $7EF340 : INC : LSR CMP.l ProgressiveBowLimit : !BLT + LDA.l ProgressiveBowReplacement - JSL.l GetSpritePalette - RTL + JMP GetSpritePalette + : CMP.b #$00 : BNE + ; No Bow LDA.b #$08 : RTL + ; Any Bow From aca809862d48ca42d70c51e0b83ff383116920c6 Mon Sep 17 00:00:00 2001 From: cassidy Date: Wed, 8 Sep 2021 01:00:55 -0400 Subject: [PATCH 5/5] utilities: Rewrite prog bow narrow sprite overflow to check sram This uses Bonta's method which is more efficient and reliable when it comes to bow state and potential mixture of progressive, none-progressive, and silver arrows upgrade. --- utilities.asm | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/utilities.asm b/utilities.asm index 6c2aae0..209cf58 100644 --- a/utilities.asm +++ b/utilities.asm @@ -328,20 +328,13 @@ IsNarrowSprite: JSL.l GetRNGItemSingle : JMP .continue ++ CMP.b #$63 : BNE ++ ; RNG Item (Multi) JSL.l GetRNGItemMulti - ++ CMP.b #$64 : BEQ .progressivebow ; Progressive Bow + ++ CMP.b #$64 : BEQ + ; Progressive Bow CMP.b #$65 : BNE .continue ; Progressive Bow (alt) - .progressivebow - LDA $7EF38E : BIT #$A0 : BEQ .continue ; No Progressive Bows - LDX.b #$0 ; Bow counter - CMP #$80 : BEQ + ; We have only one of two - CMP #$20 : BEQ + ; progressive bows - INX - + - INX - TXA : CMP.l ProgressiveBowLimit : !BLT .continue - LDA.l ProgressiveBowReplacement - JSL.l IsNarrowSprite - JMP .done + + : LDA $7EF340 : INC : LSR + CMP.l ProgressiveBowLimit : !BLT + + LDA.l ProgressiveBowReplacement + JSL.l IsNarrowSprite + JMP .done .continue ;--------