cleanup overlay animation code

This commit is contained in:
scawful
2024-05-24 09:22:04 -04:00
parent daeb2b4061
commit 1493130d6d

View File

@@ -90,26 +90,23 @@ JML $07A493 ; returnPos ; do not !
pushpc
;===============================================
; Entrance Animation
;===============================================
; don't forget to set $C8 to zero (STZ.b $C8)
; don't forget to set $B0 to zero (STZ.b $B0)
; Rename this into something unique
org $1BCADE
JSL EntranceAnimation
JSL ZoraTemple_EntranceAnimation
RTS
org $1BCBA6
JSL Castle_EntranceAnimation
RTS
pullpc
;===============================================
; Entrance Animation
;===============================================
; don't forget to set $C8 to zero (STZ.b $C8)
; don't forget to set $B0 to zero (STZ.b $B0)
; Rename this into something unique
EntranceAnimation:
ZoraTemple_EntranceAnimation:
{
REP #$20
LDA $0618 : CMP.w #$0630 : BCC +
@@ -119,7 +116,6 @@ EntranceAnimation:
+
SEP #$20
LDA.b $B0 ; Get animation state
ASL A
TAX ; x2
@@ -127,7 +123,6 @@ EntranceAnimation:
JSR.w (.AnimationFrames, X)
RTL
}
.AnimationFrames
dw Frame0
@@ -138,12 +133,14 @@ dw Frame4
dw Frame5
dw Frame6
dw Frame7
}
;===================================================
; =========================================================
; Shake screen
;===================================================
; if you already have that function delete this one
; =========================================================
ShakeScreen:
{
REP #$20
LDA.b $1A
AND.w #$0001
@@ -159,8 +156,10 @@ STA.w $011C
.exit
SEP #$20
RTS
}
Frame0:
{
LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe
.doInit
@@ -211,7 +210,10 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame
.wait
RTS
}
Frame1:
{
LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe
.doInit
@@ -263,7 +265,10 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame
.wait
RTS
}
Frame2:
{
LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe
.doInit
@@ -314,7 +319,10 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame
.wait
RTS
}
Frame3:
{
LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe
.doInit
@@ -371,7 +379,10 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame
.wait
RTS
}
Frame4:
{
LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe
.doInit
@@ -417,7 +428,10 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame
.wait
RTS
}
Frame5:
{
LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe
.doInit
@@ -482,7 +496,10 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame
.wait
RTS
}
Frame6:
{
LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe
.doInit
@@ -546,7 +563,89 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame
.wait
RTS
}
Frame7:
{
LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe
.doInit
; Init code for the frame here
REP #$30 ; 16 bit mode
LDA.w #$00C7
LDX.w #$0014
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$0158
LDX.w #$0016
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$0158
LDX.w #$0018
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$00C8
LDX.w #$001A
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$00C7
LDX.w #$0094
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$0158
LDX.w #$0096
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$0158
LDX.w #$0098
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$00C8
LDX.w #$009A
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$00C7
LDX.w #$0114
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$0158
LDX.w #$0116
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$0158
LDX.w #$0118
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$00C8
LDX.w #$011A
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$00C7
LDX.w #$0194
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$0158
LDX.w #$0196
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$0158
LDX.w #$0198
JSL $1BC97C ; Overworld_DrawMap16_Persist
LDA.w #$00C8
LDX.w #$019A
JSL $1BC97C ; Overworld_DrawMap16_Persist
SEP #$30 ; 8 bit mode
INC.b $14 ; Do tiles transfer
LDA.b #$0D : STA.w $012D
.notfirstframe
JSR ShakeScreen ; make the screen shake
INC.b $C8 : LDA.b $C8 : CMP.b #$1E ; Load and compare timer
BNE .wait
INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame
STZ.w $04C6
STZ.b $B0
STZ.w $0710
STZ.w $02E4
STZ.w $0FC1
STZ.w $011A
STZ.w $011B
STZ.w $011C
STZ.w $011D
; set the overlay
LDX.b $8A
LDA.l $7EF280,X
ORA.b #$20
STA.l $7EF280,X
.wait
RTS
}
; =========================================================
; Castle Drawbridge