fix zora mask resurface bug when entering dungeons from ow after diving

This commit is contained in:
scawful
2024-05-28 08:00:35 -04:00
parent 15b502ed54
commit acd4730bcc

View File

@@ -27,18 +27,18 @@ UpdateZoraPalette:
; ========================================================= ; =========================================================
; TODO: Change from "bunny palette" to blue zora palette colors ; TODO: Finish the Zora palette
zora_palette: zora_palette:
dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$4E48, #$3582 dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$4E48, #$3582
dw #$55BB, #$6EF7, #$7BDE, #$55C7, #$6ECD, #$2E5A, #$1970, #$7616 dw #$55BB, #$6EF7, #$7BDE, #$55C7, #$6ECD, #$2E5A, #$1970, #$7616
; dw #$6565, #$7271, #$2AB7, #$477E, #$1997, #$14B5, #$459B, #$69F2 ; dw #$6565, #$7271, #$2AB7, #$477E, #$1997, #$14B5, #$459B, #$69F2
; dw #$7AB8, #$2609, #$19D8, #$3D95, #$567C, #$1890, #$52F6, #$2357, #$0000 ; dw #$7AB8, #$2609, #$19D8, #$3D95, #$567C, #$1890, #$52F6, #$2357
; zora_palette: ; zora_palette:
; dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$19FD, #$14B6 ; dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$19FD, #$14B6
; dw #$55BB, #$362A, #$3F4E, #$162B, #$22D0, #$2E5A, #$1970, #$7616 ; dw #$55BB, #$362A, #$3F4E, #$162B, #$22D0, #$2E5A, #$1970, #$7616
; dw #$6565, #$7271, #$2AB7, #$477E, #$1997, #$14B5, #$459B, #$69F2 ; dw #$6565, #$7271, #$2AB7, #$477E, #$1997, #$14B5, #$459B, #$69F2
; dw #$7AB8, #$2609, #$19D8, #$3D95, #$567C, #$1890, #$52F6, #$2357, #$0000 ; dw #$7AB8, #$2609, #$19D8, #$3D95, #$567C, #$1890, #$52F6, #$2357
; ========================================================= ; =========================================================
@@ -76,11 +76,10 @@ LinkState_UsingZoraMask:
{ {
; Check if the mask is equipped ; Check if the mask is equipped
LDA $02B2 : CMP #$02 : BNE .normal : CLC LDA $02B2 : CMP #$02 : BNE .normal : CLC
; Check if we are in water or not ; Check if we are in water or not
LDA $5D : CMP #$04 : BEQ .swimming : CLC LDA $5D : CMP #$04 : BEQ .swimming : CLC
.normal .normal
; Return to normal state ; Return to normal state
STZ $55 STZ $55
STZ $5E ; Reset speed to normal STZ $5E ; Reset speed to normal
@@ -88,7 +87,7 @@ LinkState_UsingZoraMask:
STZ $0351 STZ $0351
JMP .return JMP .return
.swimming .swimming
; Check if we are indoors or outdoors ; Check if we are indoors or outdoors
LDA $1B : BNE .dungeon ; z flag is 1 LDA $1B : BNE .dungeon ; z flag is 1
@@ -137,13 +136,8 @@ LinkState_UsingZoraMask:
{ {
; Check if we are in water or not ; Check if we are in water or not
LDA $5D : CMP #$04 : BNE .return_dungeon : CLC LDA $5D : CMP #$04 : BNE .return_dungeon : CLC
; Check if already underwater ; Check if already underwater
LDA !ZoraDiving : BNE .return_dungeon : CLC LDA !ZoraDiving : BNE .return_dungeon : CLC
; Check if we are on a proper tile or not
;
; Check the Y button and clear state if activated ; Check the Y button and clear state if activated
JSR Link_CheckNewY_ButtonPress : BCC .return_dungeon JSR Link_CheckNewY_ButtonPress : BCC .return_dungeon
LDA $3A : AND.b #$BF : STA $3A LDA $3A : AND.b #$BF : STA $3A
@@ -180,13 +174,10 @@ warnpc $078364
pullpc pullpc
.dungeon_resurface ; TODO: Fix resurfacing bug. .dungeon_resurface
{ {
LDA $1B : BEQ .return_default ; We are in overworld actually LDA $1B : BEQ .return_default ; We are in overworld actually
; Check if we are swimming
LDA $5D : CMP #$04 : BNE .return_default
; Check if the player is actually diving ; Check if the player is actually diving
LDA !ZoraDiving : BEQ .return_default LDA !ZoraDiving : BEQ .return_default
@@ -224,7 +215,8 @@ pullpc
JMP .return_default JMP .return_default
} }
.return_default .return_default
STZ !ZoraDiving
STZ $0302 STZ $0302
RTS RTS
} }
@@ -245,7 +237,7 @@ pullpc
STZ $5E ; Reset speed to normal STZ $5E ; Reset speed to normal
STZ !ZoraDiving ; Reset underwater flag STZ !ZoraDiving ; Reset underwater flag
LDA #$62 : STA $9A ; Reset dungeon layer LDA #$62 : STA $9A ; Reset dungeon layer
.return_hop .return_hop
LDA #$06 : STA $5D ; Set Link to Recoil State LDA #$06 : STA $5D ; Set Link to Recoil State
RTS RTS
} }
@@ -262,11 +254,10 @@ LinkState_ResetMaskAnimated:
CMP.b #$06 : BEQ .gbc_form CMP.b #$06 : BEQ .gbc_form
CMP.b #$02 : BEQ .no_mask CMP.b #$02 : BEQ .no_mask
CMP #$01 : BNE .transform CMP #$01 : BNE .transform
; Restore the sword, shield, and bow override ; Restore the sword, shield, and bow override
LDA $0AAF : STA.l $7EF35A LDA $0AAF : STA.l $7EF35A
.transform .transform
LDY.b #$04 : LDA.b #$23 LDY.b #$04 : LDA.b #$23
JSL AddTransformationCloud JSL AddTransformationCloud
LDA.b #$14 : JSR Player_DoSfx2 LDA.b #$14 : JSR Player_DoSfx2
@@ -274,8 +265,8 @@ LinkState_ResetMaskAnimated:
STZ $02B2 STZ $02B2
JSL Palette_ArmorAndGloves JSL Palette_ArmorAndGloves
LDA #$10 : STA $BC LDA #$10 : STA $BC
.no_mask .no_mask
.gbc_form .gbc_form
RTL RTL
} }