disallow song of storms on maps with overlays, dismiss maps with rain already

This commit is contained in:
scawful
2024-06-18 17:48:45 -04:00
parent c643fb8a91
commit b359fb6937

View File

@@ -113,7 +113,7 @@ LinkItem_NewFlute:
DEC.w $03F0 : LDA.w $03F0 : BNE ReturnFromFluteHook DEC.w $03F0 : LDA.w $03F0 : BNE ReturnFromFluteHook
LDA.b $3A : AND.b #$BF : STA.b $3A LDA.b $3A : AND.b #$BF : STA.b $3A
.y_button_not_held .y_button_not_held
; Check for Switch Swong ; Check for Switch Swong
JSR UpdateFluteSong JSR UpdateFluteSong
@@ -122,24 +122,23 @@ LinkItem_NewFlute:
; Success... play the flute. ; Success... play the flute.
LDA.b #$80 : STA.w $03F0 LDA.b #$80 : STA.w $03F0
LDA $030F LDA.w $030F
CMP.b #$01 : BEQ .song_of_storms CMP.b #$01 : BEQ .song_of_storms
CMP.b #$02 : BEQ .song_of_healing CMP.b #$02 : BEQ .song_of_healing
CMP.b #$03 : BEQ .song_of_soaring CMP.b #$03 : BEQ .song_of_soaring
.song_of_healing .song_of_healing
LDA.b #$13 : JSR Player_DoSfx2 LDA.b #$13 : JSR Player_DoSfx2
LDA.b #$01 : STA $FE LDA.b #$01 : STA $FE
RTS RTS
.song_of_storms .song_of_storms
; Play the Song of Storms SFX ; Play the Song of Storms SFX
; LDA.b #$18 : JSR Player_DoSfx1
LDA.b #$2F : JSR Player_DoSfx2 LDA.b #$2F : JSR Player_DoSfx2
JSL OcarinaEffect_SummonStorms JSL OcarinaEffect_SummonStorms
RTS RTS
.song_of_soaring .song_of_soaring
LDA.b #$3E : JSR Player_DoSfx2 LDA.b #$3E : JSR Player_DoSfx2
; Are we indoors? ; Are we indoors?
@@ -153,7 +152,7 @@ LinkItem_NewFlute:
LDX.b #$04 LDX.b #$04
.next_ancillary_slot .next_ancillary_slot
; Is there already a travel bird effect in this slot? ; Is there already a travel bird effect in this slot?
LDA $0C4A, X : CMP.b #$27 : BEQ .return LDA $0C4A, X : CMP.b #$27 : BEQ .return
@@ -191,19 +190,19 @@ LinkItem_NewFlute:
LDA.b #$37 LDA.b #$37
JSL AddWeathervaneExplosion JSL AddWeathervaneExplosion
.not_weathervane_trigger .not_weathervane_trigger
SEP #$20 SEP #$20
BRA .return BRA .return
.travel_bird_already_released .travel_bird_already_released
LDY.b #$04 LDY.b #$04
LDA.b #$27 LDA.b #$27
JSL AddTravelBird JSL AddTravelBird
STZ $03F8 STZ $03F8
.return .return
RTS RTS
} }
@@ -225,19 +224,38 @@ org $02B011
org $3C8000 org $3C8000
OcarinaEffect_SummonStorms: OcarinaEffect_SummonStorms:
{ {
; Dismiss the rain in the Zora area where it is already raining
LDA.w $8A : CMP.b #$1E : BEQ .dismissStorms
CMP.b #$2E : BEQ .dismissStorms
CMP.b #$2F : BEQ .dismissStorms
; Check for areas which should not be allowed to have rain
CMP.b #$05 : BEQ .errorBeep
CMP.b #$06 : BEQ .errorBeep
CMP.b #$07 : BEQ .errorBeep
CMP.b #$10 : BEQ .errorBeep
CMP.b #$18 : BEQ .errorBeep
CMP.b #$28 : BEQ .errorBeep
CMP.b #$29 : BEQ .errorBeep
; If the rain is already summoned, dismiss it
LDA.l $7EE00E : BEQ .summonStorms LDA.l $7EE00E : BEQ .summonStorms
.dismissStorms
LDA #$FF : STA $8C LDA #$FF : STA $8C
LDA #$00 : STA $7EE00E LDA #$00 : STA $7EE00E
STZ $1D STZ $1D
STZ $9A STZ $9A
RTL RTL
.summonStorms .summonStorms
LDA #$9F : STA $8C LDA #$9F : STA $8C
LDA.b #$01 : STA.b $1D LDA.b #$01 : STA.b $1D
LDA.b #$72 : STA.b $9A LDA.b #$72 : STA.b $9A
LDA #$01 : STA $7EE00E LDA #$01 : STA $7EE00E
RTL RTL
.errorBeep
LDA.b #$3C : STA.w $012E ; Error beep
RTL
} }
PlayThunderAndRain: PlayThunderAndRain:
@@ -251,14 +269,13 @@ CheckRealTable:
{ {
LDA $7EE00E : CMP #$00 : BEQ .continue LDA $7EE00E : CMP #$00 : BEQ .continue
JML RainAnimation_Overridden_rainOverlaySet JML RainAnimation_Overridden_rainOverlaySet
.continue .continue
LDA #$05 : STA $012D LDA #$05 : STA $012D
LDA.b $8A : ASL : TAX LDA.b $8A : ASL : TAX
LDA.l Pool_OverlayTable, X LDA.l Pool_OverlayTable, X
CMP.b #$9F : BNE .not_rain_area CMP.b #$9F : BNE .not_rain_area
RTL RTL
.not_rain_area .not_rain_area
JML RainAnimation_Overridden_skipMovement JML RainAnimation_Overridden_skipMovement
} }
@@ -292,14 +309,15 @@ UpdateFluteSong_Long:
LDA $7EF34C : CMP.b #$01 : BEQ .notPressed LDA $7EF34C : CMP.b #$01 : BEQ .notPressed
LDA $030F : BNE .songExists LDA $030F : BNE .songExists
LDA #$01 : STA $030F ; if this code is running, we have the flute song 1 ; if this code is running, we have the flute song 1
.songExists LDA #$01 : STA $030F
.songExists
LDA.b $F6 LDA.b $F6
BIT.b #$20 : BNE .left ; pressed left BIT.b #$20 : BNE .left ; pressed left
BIT.b #$10 : BNE .right ; pressed right BIT.b #$10 : BNE .right ; pressed right
RTL RTL
.left .left
; L Button Pressed - Decrement song ; L Button Pressed - Decrement song
; LDA.b #$13 : JSR Player_DoSfx2 ; LDA.b #$13 : JSR Player_DoSfx2
DEC $030F DEC $030F
@@ -307,29 +325,31 @@ UpdateFluteSong_Long:
CMP #$00 : BEQ .wrap_to_max CMP #$00 : BEQ .wrap_to_max
BRA .update_song BRA .update_song
.right .right
; R Button Pressed - Increment song ; R Button Pressed - Increment song
INC $030F ; increment $030F Song RAM INC $030F ; increment $030F Song RAM
LDA $030F ; load incremented Song RAM LDA $030F ; load incremented Song RAM
CMP.b #$04 CMP.b #$04
BCS .wrap_to_min BCS .wrap_to_min
.update_song .update_song
RTL RTL
.wrap_to_max .wrap_to_max
LDA $7EF34C : CMP.b #$02 : BEQ .set_max_to_2 LDA $7EF34C : CMP.b #$02 : BEQ .set_max_to_2
LDA #$03 : STA $030F : RTL LDA #$03 : STA $030F : RTL
.set_max_to_2 .set_max_to_2
LDA #$02 : STA $030F : RTL LDA #$02 : STA $030F : RTL
.wrap_to_min .wrap_to_min
LDA #$01 : STA $030F LDA #$01 : STA $030F
.notPressed .notPressed
RTL RTL
} }
warnpc $3CA62A
org $02F210 ; OverworldTransitionScrollAndLoadMap org $02F210 ; OverworldTransitionScrollAndLoadMap
{ {
JSL ResetOcarinaFlag JSL ResetOcarinaFlag