Ocarina Song of Storms Rain Effect

This commit is contained in:
scawful
2023-05-15 18:23:05 -05:00
parent 8d1d5d5982
commit 4cc84f0853

View File

@@ -11,6 +11,11 @@ org $0994FE
org $098D11 org $098D11
AddWeathervaneExplosion: AddWeathervaneExplosion:
org $078021
Player_DoSfx1:
; =============================================================================
; SFX2_Accomp ; SFX2_Accomp
; SFX2 13 (Previous $3E) ; SFX2 13 (Previous $3E)
org $1A8C60 org $1A8C60
@@ -33,38 +38,55 @@ Song_of_Healing:
db $00 db $00
} }
; =============================================================================
; D F D - D F D - E F E - F E C ; D F D - D F D - E F E - F E C
; D F d D F d e f e f e c ; D F d D F d e f e f e c
; SFX2_12 ; SFX2_12
org $1A977D ; org $1A977D
!Storms_Duration = $0F
!Storms_Params = $46
!Storms_Duration2 = $1E
!Storms_Params2 = $3C
; SFX1_18
org $1A8F93
Song_of_Storms:
{ {
db $E0, $0D ; set sfx instrument - twee db $E0, $0D ; set sfx instrument - twee
db $0F, $46 ; duration 1/4, params db !Storms_Duration
db !Storms_Params ; duration 1/4
db $9A ; play note D3 db $9A ; play note D3
db $9D ; play note F3 db $9D ; play note F3
db $1E, $46 ; duration 1/2, params db !Storms_Duration2
db !Storms_Params ; duration 1/2
db $9A ; play note D3 db $9A ; play note D3
db $0F, $46 ; duration 1/4, params db !Storms_Duration
db !Storms_Params ; duration 1/4
db $9A ; play note D3 db $9A ; play note D3
db $9D ; play note F3 db $9D ; play note F3
db $1E, $46 ; duration 1/2, params db !Storms_Duration2
db !Storms_Params ; duration 1/2
db $9A ; play note D3 db $9A ; play note D3
db $0F, $3C ; duration 1/4, params db !Storms_Duration
db !Storms_Params2 ; duration 1/4
db $9C ; play note E3 db $9C ; play note E3
db $9D ; play note F3 db $9D ; play note F3
db $9C ; play note E3 db $9C ; play note E3
db $9D ; play note F3 db $9D ; play note F3
db $9C ; play note E3 db $9C ; play note E3
db $1E, $3C ; duration 1/2, params db !Storms_Duration2
db !Storms_Params2 ; duration 1/2
db $98 ; play note C3 db $98 ; play note C3
db $00 ; end sfx db $00 ; end sfx
} }
; ============================================================================= ; =============================================================================
org $07A3DB org $07A3DB
@@ -74,11 +96,15 @@ LinkItem_FluteHook:
RTS RTS
} }
; =============================================================================
; Free Space Bank07 ; Free Space Bank07
org $07FC69 org $07FC69
ReturnFromFluteHook: ReturnFromFluteHook:
RTS RTS
; =============================================================================
LinkItem_NewFlute: LinkItem_NewFlute:
{ {
; Code for the flute item (with or without the bird activated) ; Code for the flute item (with or without the bird activated)
@@ -106,7 +132,8 @@ LinkItem_NewFlute:
.song_of_storms .song_of_storms
; Play the Song of Storms SFX ; Play the Song of Storms SFX
LDA.b #$12 : JSR Player_DoSfx2 ; LDA.b #$12 : JSR Player_DoSfx2
LDA.b #$18 : JSR Player_DoSfx1
JSR OcarinaEffect_SummonStorms JSR OcarinaEffect_SummonStorms
RTS RTS
@@ -128,6 +155,7 @@ LinkItem_NewFlute:
; 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
; If there isn't one, keep checking. ; If there isn't one, keep checking.
DEX : BPL .next_ancillary_slot DEX : BPL .next_ancillary_slot
@@ -249,44 +277,42 @@ OcarinaEffect_SummonStorms:
org $208100 org $208100
LoadRainEffect: LoadRainEffect:
{ {
lda $7EE00E LDA $7EE00E : BNE .On
bne .On LDA $7EE00D : BNE .Off
lda $7EE00D BRA LoadRainEffect_End
bne .Off
bra Rain_End LoadRainEffect_On:
Rain_On: LDA #$01 : STA $7EE00F : STA $7EE00C
lda #$01 LDA #$01 : STA $7EE00E
sta $7EE00F BRA LoadRainEffect_End
sta $7EE00C
lda #$01 LoadRainEffect_Off:
sta $7EE00E LDA #$00
bra Rain_End STA $7EE00F
Rain_Off: STA $7EE00C
lda #$00 STA $7EE00D
sta $7EE00F BRA LoadRainEffect_End
sta $7EE00C
sta $7EE00D LoadRainEffect_End:
bra Rain_End LDA #$00
Rain_End: STA $7EE00E
lda #$00 STA $7EE00D
sta $7EE00E LDA $7EF3C5
sta $7EE00D RTL
lda $7EF3C5
rtl
} }
org $208200 ; these are executed every frame org $208200 ; these are executed every frame
RainOnTime: RainOnTime:
lda $7EE001 LDA $7EE001
cmp #$1E cmp #$1E
bne .End bne .End
lda $7EE000 LDA $7EE000
cmp #$01 cmp #$01
bne .End bne .End
lda $7EE00B LDA $7EE00B
bne .End bne .End
lda #$01 LDA #$01
sta $7EE00E sta $7EE00E
sta $7EE00F sta $7EE00F
RainOnTime_End: RainOnTime_End:
@@ -294,25 +320,24 @@ RainOnTime_End:
org $208300 ; these are executed every frame org $208300 ; these are executed every frame
RainOffTime: RainOffTime:
lda $7EE001 LDA $7EE001
cmp #$1E cmp #$1E
bne .End bne .End
lda $7EE000 LDA $7EE000
cmp #$03 cmp #$03
bne .End bne .End
lda #$01 LDA #$01
sta $7EE00D sta $7EE00D
RainOffTime_End: RainOffTime_End:
rtl rtl
org $20C000 ; moved this function to expanded space to change it, don't think i needed to though :( ; moved this function to expanded space to change it, don't think i needed to though :()
LDA $8A org $20C000
CMP #$70 LDA $8A : CMP #$70 : BEQ BRANCH_EVIL_SWAMP
BEQ BRANCH_EVIL_SWAMP LDA $7EE00F : BEQ BRANCH_SKIPMOVEMENT
LDA $7EE00F
Beq BRANCH_SKIPMOVEMENT
BRANCH_EVIL_SWAMP: BRANCH_EVIL_SWAMP:
LDA $7EF2F0 ; If misery mire has been opened already, weíre done LDA $7EF2F0 ; If misery mire has been opened already, we're done
AND #$20 AND #$20
BNE BRANCH_SKIPMOVEMENT BNE BRANCH_SKIPMOVEMENT
LDA $1A ; Check the frame counter. LDA $1A ; Check the frame counter.
@@ -361,73 +386,86 @@ BRANCH_SKIPMOVEMENT:
RTL RTL
org $02A4CD ; rain animating overlays, thunder lightning, darkness (can do immediate) org $02A4CD ; rain animating overlays, thunder lightning, darkness (can do immediate)
jsl $20C000 JSL $20C000
bra $59 BRA $59
org $02AC12 ; load overlays OW to OW org $02AC12 ; load overlays OW to OW
lda $7EE00C
nop #2
beq $03
org $02AFFC ; load overlays dungeon to OW
lda $7EE00C
nop #06
beq $03
org $02838C ; indoor ambience (can do immediate)
lda $7EE00F
nop #02
beq $1e
org $02845D ; music routine
lda $7EE00C
nop #02
beq $02
org $0284EA ; outdoor ambience
lda $7EE00C
nop #2
beq $02
org $02C463 ; overworld music routine, modified to use the 'Beginning' music if 7EE00C is not equal to zero (Rain activated)
PHB
PHK
PLB
REP #$10
LDA #$02
STA $00
LDX #$0000
LDA $7EE00C LDA $7EE00C
BNE $25 NOP #2
LDY #$00C0 BEQ $03
LDA $7EF3C5
CMP #$03 org $02AFFC ; load overlays dungeon to OW
BCS $1D LDA $7EE00C
LDY #$0080 NOP #06
LDA $7EF359 BEQ $03
CMP #$02
BCS $12 org $02838C ; indoor ambience (can do immediate)
LDA #$05 LDA $7EE00F
STA $00 NOP #02
LDY #$0040 BEQ $1e
LDA $7EF3C5
CMP #$02 org $02845D ; music routine
BCS $03 LDA $7EE00C
LDY #$0000 NOP #02
LDA $C303,Y BEQ $02
STA $7F5B00,X
INY org $0284EA ; outdoor ambience
INX LDA $7EE00C
CPX #$0040 NOP #2
BNE $F2 BEQ $02
LDY #$0000
LDA $C403,Y ; overworld music routine
STA $7F5B00,X ; modified to use the 'Beginning' music if 7EE00C is not zero (Rain activated)
INX org $02C463
INY PHB : PHK : PLB
CPY #$0060 REP #$10
BNE $F2 LDA #$02 : STA $00
LDA $00 LDX #$0000
STA $7F5B80 LDA $7EE00C
BNE $25
LDY #$00C0
LDA $7EF3C5
CMP #$03
BCS $1D
LDY #$0080
LDA $7EF359
CMP #$02
BCS $12
LDA #$05
STA $00
LDY #$0040
LDA $7EF3C5
CMP #$02
BCS $03
LDY #$0000
LDA $C303,Y
STA $7F5B00,X
INY
INX
CPX #$0040
BNE $F2
LDY #$0000
LDA $C403,Y
STA $7F5B00,X
INX
INY
CPY #$0060
BNE $F2
LDA $00
STA $7F5B80
SEP #$10 SEP #$10
PLB PLB
RTL RTL
org $02C303 ; Overworld beginning music for each OW Screen changes the music to use heavy rain outside of lost woods, and light rain inside ; Overworld beginning music for each OW Screen
; changes the music to use heavy rain outside of lost woods, and light rain inside
org $02C303
db $25,$25,$13,$13,$13,$13,$13,$13 db $25,$25,$13,$13,$13,$13,$13,$13
db $25,$25,$13,$13,$13,$13,$13,$13 db $25,$25,$13,$13,$13,$13,$13,$13
db $13,$13,$13,$13,$13,$13,$13,$13 db $13,$13,$13,$13,$13,$13,$13,$13
@@ -439,5 +477,4 @@ org $02C303 ; Overworld beginning music for each OW Screen changes the music to
; executed on dungoen load ; executed on dungoen load
org $028356 ; replaced an LDA $7EF3C5 which is read before we return org $028356 ; replaced an LDA $7EF3C5 which is read before we return
; org $02A4CD JSL $208100
JSL $208100