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 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 org $1BCADE
JSL EntranceAnimation JSL ZoraTemple_EntranceAnimation
RTS
org $1BCBA6
JSL Castle_EntranceAnimation
RTS RTS
pullpc pullpc
;=============================================== ;===============================================
; Entrance Animation ; Entrance Animation
;=============================================== ;===============================================
; don't forget to set $C8 to zero (STZ.b $C8) ; don't forget to set $C8 to zero (STZ.b $C8)
; don't forget to set $B0 to zero (STZ.b $B0) ; don't forget to set $B0 to zero (STZ.b $B0)
; Rename this into something unique ZoraTemple_EntranceAnimation:
EntranceAnimation:
{ {
REP #$20 REP #$20
LDA $0618 : CMP.w #$0630 : BCC + LDA $0618 : CMP.w #$0630 : BCC +
@@ -119,7 +116,6 @@ EntranceAnimation:
+ +
SEP #$20 SEP #$20
LDA.b $B0 ; Get animation state LDA.b $B0 ; Get animation state
ASL A ASL A
TAX ; x2 TAX ; x2
@@ -127,7 +123,6 @@ EntranceAnimation:
JSR.w (.AnimationFrames, X) JSR.w (.AnimationFrames, X)
RTL RTL
}
.AnimationFrames .AnimationFrames
dw Frame0 dw Frame0
@@ -138,12 +133,14 @@ dw Frame4
dw Frame5 dw Frame5
dw Frame6 dw Frame6
dw Frame7 dw Frame7
}
;=================================================== ; =========================================================
; Shake screen ; Shake screen
;=================================================== ; =========================================================
; if you already have that function delete this one
ShakeScreen: ShakeScreen:
{
REP #$20 REP #$20
LDA.b $1A LDA.b $1A
AND.w #$0001 AND.w #$0001
@@ -159,8 +156,10 @@ STA.w $011C
.exit .exit
SEP #$20 SEP #$20
RTS RTS
}
Frame0: Frame0:
{
LDA.b $C8 : BEQ .doInit ; Load the timer LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe JMP .notfirstframe
.doInit .doInit
@@ -211,7 +210,10 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame STZ.b $C8 ; reset timer for next frame
.wait .wait
RTS RTS
}
Frame1: Frame1:
{
LDA.b $C8 : BEQ .doInit ; Load the timer LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe JMP .notfirstframe
.doInit .doInit
@@ -263,7 +265,10 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame STZ.b $C8 ; reset timer for next frame
.wait .wait
RTS RTS
}
Frame2: Frame2:
{
LDA.b $C8 : BEQ .doInit ; Load the timer LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe JMP .notfirstframe
.doInit .doInit
@@ -314,7 +319,10 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame STZ.b $C8 ; reset timer for next frame
.wait .wait
RTS RTS
}
Frame3: Frame3:
{
LDA.b $C8 : BEQ .doInit ; Load the timer LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe JMP .notfirstframe
.doInit .doInit
@@ -371,7 +379,10 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame STZ.b $C8 ; reset timer for next frame
.wait .wait
RTS RTS
}
Frame4: Frame4:
{
LDA.b $C8 : BEQ .doInit ; Load the timer LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe JMP .notfirstframe
.doInit .doInit
@@ -417,7 +428,10 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame STZ.b $C8 ; reset timer for next frame
.wait .wait
RTS RTS
}
Frame5: Frame5:
{
LDA.b $C8 : BEQ .doInit ; Load the timer LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe JMP .notfirstframe
.doInit .doInit
@@ -482,7 +496,10 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame STZ.b $C8 ; reset timer for next frame
.wait .wait
RTS RTS
}
Frame6: Frame6:
{
LDA.b $C8 : BEQ .doInit ; Load the timer LDA.b $C8 : BEQ .doInit ; Load the timer
JMP .notfirstframe JMP .notfirstframe
.doInit .doInit
@@ -546,7 +563,89 @@ INC.b $B0 ; increase frame
STZ.b $C8 ; reset timer for next frame STZ.b $C8 ; reset timer for next frame
.wait .wait
RTS RTS
}
Frame7: 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 ; Castle Drawbridge