Cleanup HelmetChuchu sprite

This commit is contained in:
scawful
2024-10-06 12:51:10 -04:00
parent 93553232ce
commit c37860bd83

View File

@@ -1,6 +1,6 @@
; ========================================================= ; =========================================================
; Sprite Properties ; Sprite Properties
; ========================================================= ; =========================================================
!SPRID = Sprite_HelmetChuchu !SPRID = Sprite_HelmetChuchu
!NbrTiles = 03 ; Number of tiles used in a frame !NbrTiles = 03 ; Number of tiles used in a frame
@@ -11,7 +11,7 @@
!DeathAnimation = 00 ; 00 = normal death, 01 = no death animation !DeathAnimation = 00 ; 00 = normal death, 01 = no death animation
!ImperviousAll = 00 ; 00 = Can be attack, 01 = attack will clink on it !ImperviousAll = 00 ; 00 = Can be attack, 01 = attack will clink on it
!SmallShadow = 00 ; 01 = small shadow, 00 = no shadow !SmallShadow = 00 ; 01 = small shadow, 00 = no shadow
!Shadow = 00 ; 00 = don't draw shadow, 01 = draw a shadow !Shadow = 00 ; 00 = don't draw shadow, 01 = draw a shadow
!Palette = 00 ; Unused in this template (can be 0 to 7) !Palette = 00 ; Unused in this template (can be 0 to 7)
!Hitbox = 00 ; 00 to 31, can be viewed in sprite draw tool !Hitbox = 00 ; 00 to 31, can be viewed in sprite draw tool
!Persist = 00 ; 01 = your sprite continue to live offscreen !Persist = 00 ; 01 = your sprite continue to live offscreen
@@ -32,34 +32,29 @@
%Set_Sprite_Properties(Sprite_HelmetChuchu_Prep, Sprite_HelmetChuchu_Long) %Set_Sprite_Properties(Sprite_HelmetChuchu_Prep, Sprite_HelmetChuchu_Long)
; =========================================================
; 0-1: No Helmet Green
; 2-3: Mask Red
; 4-5: Helmet Green
Sprite_HelmetChuchu_Long: Sprite_HelmetChuchu_Long:
{ {
PHB : PHK : PLB PHB : PHK : PLB
JSR Sprite_HelmetChuchu_Draw ; Call the draw code JSR Sprite_HelmetChuchu_Draw
JSL Sprite_DrawShadow JSL Sprite_DrawShadow
JSL Sprite_CheckActive ; Check if game is not paused JSL Sprite_CheckActive : BCC .SpriteIsNotActive
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive JSR Sprite_HelmetChuchu_Main
JSR Sprite_HelmetChuchu_Main ; Call the main sprite code
.SpriteIsNotActive .SpriteIsNotActive
PLB ; Get back the databank we stored previously PLB
RTL ; Go back to original code RTL
} }
; =========================================================
; 0-1: No Helmet Green
; 2-3: Mask Red
; 4-5: Helmet Green
Sprite_HelmetChuchu_Prep: Sprite_HelmetChuchu_Prep:
{ {
PHB : PHK : PLB PHB : PHK : PLB
LDA.l $7EF359 : DEC A : TAY LDA.l SWORD : DEC A : TAY
LDA.w .health, Y : STA.w SprHealth, X LDA.w .health, Y : STA.w SprHealth, X
JSL GetRandomInt : AND.b #$02 : STA.w SprAction, X JSL GetRandomInt : AND.b #$02 : STA.w SprAction, X
STZ.w SprMiscB, X STZ.w SprMiscB, X
@@ -94,17 +89,17 @@ Sprite_HelmetChuchu_Main:
dw RedChuchu_NoMask dw RedChuchu_NoMask
dw HelmetSubtype dw HelmetSubtype
dw MaskSubtype dw MaskSubtype
GreenChuchu_Helmet: GreenChuchu_Helmet:
{ {
%StartOnFrame(4) %StartOnFrame(4)
%PlayAnimation(4, 5, 16) %PlayAnimation(4, 5, 16)
JSR Sprite_CheckForHookshot : BCC + JSR Sprite_CheckForHookshot : BCC +
LDA.w SprFlash, X : BEQ + LDA.w SprFlash, X : BEQ +
%GotoAction(1) %GotoAction(1)
+ +
JSL Sprite_CheckDamageFromPlayer JSL Sprite_CheckDamageFromPlayer
JSR Sprite_Chuchu_Move JSR Sprite_Chuchu_Move
RTS RTS
} }
@@ -112,7 +107,7 @@ Sprite_HelmetChuchu_Main:
{ {
%StartOnFrame(0) %StartOnFrame(0)
%PlayAnimation(0, 1, 16) %PlayAnimation(0, 1, 16)
LDA.w SprMiscD, X : BNE + LDA.w SprMiscD, X : BNE +
JSR HelmetChuchu_SpawnHookshotDrag JSR HelmetChuchu_SpawnHookshotDrag
LDA.b #$01 : STA.w SprMiscD, X LDA.b #$01 : STA.w SprMiscD, X
+ +
@@ -126,7 +121,7 @@ Sprite_HelmetChuchu_Main:
%StartOnFrame(2) %StartOnFrame(2)
%PlayAnimation(2, 3, 16) %PlayAnimation(2, 3, 16)
JSR Sprite_CheckForHookshot : BCC + JSR Sprite_CheckForHookshot : BCC +
LDA.w SprFlash, X : BEQ + LDA.w SprFlash, X : BEQ +
%GotoAction(3) %GotoAction(3)
+ +
JSL Sprite_CheckDamageFromPlayer JSL Sprite_CheckDamageFromPlayer
@@ -138,7 +133,7 @@ Sprite_HelmetChuchu_Main:
{ {
%StartOnFrame(6) %StartOnFrame(6)
%PlayAnimation(6, 7, 16) %PlayAnimation(6, 7, 16)
LDA.w SprMiscD, X : BNE + LDA.w SprMiscD, X : BNE +
JSR HelmetChuchu_SpawnHookshotDrag JSR HelmetChuchu_SpawnHookshotDrag
LDA.b #$01 : STA.w SprMiscD, X LDA.b #$01 : STA.w SprMiscD, X
+ +
@@ -202,11 +197,11 @@ HelmetChuchu_SpawnHookshotDrag:
PLX PLX
RTS RTS
.speed_x .speed_x
db 16, -11, -16, 11 db 16, -11, -16, 11
.speed_y .speed_y
db 0, 11, 0, -11 db 0, 11, 0, -11
} }
; Based on Sprite_CancelHookshot ; Based on Sprite_CancelHookshot
@@ -215,20 +210,20 @@ HelmetChuchu_SpawnHookshotDrag:
Sprite_CheckForHookshot: Sprite_CheckForHookshot:
{ {
PHX PHX
#_0FF544: LDX.b #$0A LDX.b #$0A
.next_ancilla .next_ancilla
#_0FF546: LDA.w $0C4A,X LDA.w $0C4A,X
#_0FF549: CMP.b #$1F ; ANCILLA 1F CMP.b #$1F ; ANCILLA 1F
#_0FF54B: BNE .not_hooker BNE .not_hooker
PLX PLX
SEC SEC
RTS RTS
.not_hooker .not_hooker
#_0FF557: DEX DEX
#_0FF558: BPL .next_ancilla BPL .next_ancilla
PLX PLX
CLC CLC
RTS RTS
@@ -240,7 +235,7 @@ Sprite_Chuchu_Move:
JSL Sprite_BounceFromTileCollision JSL Sprite_BounceFromTileCollision
JSL Sprite_PlayerCantPassThrough JSL Sprite_PlayerCantPassThrough
LDA.w SprMiscB, X LDA.w SprMiscB, X
JSL UseImplicitRegIndexedLocalJumpTable JSL UseImplicitRegIndexedLocalJumpTable
dw BounceTowardPlayer dw BounceTowardPlayer
@@ -312,17 +307,16 @@ Sprite_HelmetChuchu_Draw:
.nextTile .nextTile
PHX ; Save current Tile Index? PHX ; Save current Tile Index?
TXA : CLC : ADC $06 ; Add Animation Index Offset TXA : CLC : ADC $06 ; Add Animation Index Offset
PHA ; Keep the value with animation index offset? PHA ; Keep the value with animation index offset?
ASL A : TAX ASL A : TAX
REP #$20 REP #$20
LDA $00 : STA ($90), Y LDA $00 : STA ($90), Y
AND.w #$0100 : STA $0E AND.w #$0100 : STA $0E
INY INY
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
CLC : ADC #$0010 : CMP.w #$0100 CLC : ADC #$0010 : CMP.w #$0100
@@ -339,14 +333,10 @@ Sprite_HelmetChuchu_Draw:
INY INY
LDA .properties, X : ORA $08 : STA ($90), Y LDA .properties, X : ORA $08 : STA ($90), Y
PHY PHY
TYA : LSR #2 : TAY TYA : LSR #2 : TAY
LDA.b #$02 : ORA $0F : STA ($92), Y ; store size in oam buffer LDA.b #$02 : ORA $0F : STA ($92), Y ; store size in oam buffer
PLY : INY PLY : INY
PLX : DEX : BPL .nextTile PLX : DEX : BPL .nextTile
PLX PLX