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

@@ -13,32 +13,32 @@
UpdateZoraPalette: UpdateZoraPalette:
{ {
REP #$30 ; change 16 bit mode REP #$30 ; change 16 bit mode
LDX #$001E LDX #$001E
.loop .loop
LDA.l zora_palette, X : STA $7EC6E0, X LDA.l zora_palette, X : STA $7EC6E0, X
DEX : DEX : BPL .loop DEX : DEX : BPL .loop
SEP #$30 ; go back to 8 bit mode SEP #$30 ; go back to 8 bit mode
INC $15 ; update the palette INC $15 ; update the palette
RTL RTL
} }
; ========================================================= ; =========================================================
; 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
LDA $5D : CMP #$04 : BEQ .swimming : CLC
; Check if we are in water or not .normal
LDA $5D : CMP #$04 : BEQ .swimming : CLC
.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,31 +136,26 @@ 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
LDA !ZoraDiving : BNE .return_dungeon : CLC
; Check the Y button and clear state if activated
JSR Link_CheckNewY_ButtonPress : BCC .return_dungeon
LDA $3A : AND.b #$BF : STA $3A
; Check if already underwater .dive_dungeon
LDA !ZoraDiving : BNE .return_dungeon : CLC ; Splash effect
LDA.b #$15 : LDY.b #$00
JSL AddTransitionSplash
; Check if we are on a proper tile or not STZ $5D ; reset player to ground state
; STZ $EE ; move link to lower level
; Check the Y button and clear state if activated LDA #$72 : STA $9A ; Set layer
JSR Link_CheckNewY_ButtonPress : BCC .return_dungeon LDA #$08 : STA $5E ; Set the player speed
LDA $3A : AND.b #$BF : STA $3A STZ $0345 ; Reset deep water flag
LDA #$01 : STA !ZoraDiving ; Set the player underwater flag
.dive_dungeon .return_dungeon
; Splash effect
LDA.b #$15 : LDY.b #$00
JSL AddTransitionSplash
STZ $5D ; reset player to ground state
STZ $EE ; move link to lower level
LDA #$72 : STA $9A ; Set layer
LDA #$08 : STA $5E ; Set the player speed
STZ $0345 ; Reset deep water flag
LDA #$01 : STA !ZoraDiving ; Set the player underwater flag
.return_dungeon
JSR $E8F0 ; HandleIndoorCameraAndDoors JSR $E8F0 ; HandleIndoorCameraAndDoors
RTS RTS
} }
@@ -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
@@ -206,17 +197,17 @@ pullpc
{ {
; Restore Swimming Effects ; Restore Swimming Effects
LDA.b #$15 : LDY.b #$00 : JSL AddTransitionSplash LDA.b #$15 : LDY.b #$00 : JSL AddTransitionSplash
.remove_dive .remove_dive
LDA #$04 : STA $5D ; Set Link to Swimming State LDA #$04 : STA $5D ; Set Link to Swimming State
LDA #$01 : STA $EE ; Set Link to upper level LDA #$01 : STA $EE ; Set Link to upper level
STA $0345 ; Set deep water flag STA $0345 ; Set deep water flag
; Remove Diving Effects ; Remove Diving Effects
.player_is_falling .player_is_falling
LDA $67 : AND #$01 : STA $2F LDA $67 : AND #$01 : STA $2F
STZ $5E ; Reset speed to normal STZ $5E ; Reset speed to normal
STZ !ZoraDiving ; Reset underwater flag STZ !ZoraDiving ; Reset underwater flag
STZ $0351 ; Reset ripple flag STZ $0351 ; Reset ripple flag
STZ $24 ; Reset z coordinate for link STZ $24 ; Reset z coordinate for link
STZ $0372 ; Reset link bounce flag STZ $0372 ; Reset link bounce flag
@@ -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
LDA $0AAF : STA.l $7EF35A
; Restore the sword, shield, and bow override .transform
LDA $0AAF : STA.l $7EF35A
.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
} }