Sprite housekeeping

This commit is contained in:
scawful
2024-10-04 09:12:17 -04:00
parent e22303cb74
commit 1d0f140ced
3 changed files with 24 additions and 36 deletions

View File

@@ -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
@@ -56,12 +56,10 @@ Sprite_EonScrub_Long:
Sprite_EonScrub_Prep: Sprite_EonScrub_Prep:
{ {
PHB : PHK : PLB PHB : PHK : PLB
LDA.w SprSubtype, X : CMP #$01 : BNE .normal_scrub LDA.w SprSubtype, X : CMP #$01 : BNE .normal_scrub
LDA.b #$06 : STA.w SprAction, X ; Pea Shot State LDA.b #$06 : STA.w SprAction, X ; Pea Shot State
LDA.b #$20 : STA.b SprPrize, X LDA.b #$20 : STA.b SprPrize, X
.normal_scrub .normal_scrub
PLB PLB
RTL RTL
} }

View File

@@ -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
@@ -37,22 +37,18 @@
Sprite_Goriya_Long: Sprite_Goriya_Long:
{ {
PHB : PHK : PLB PHB : PHK : PLB
LDA.w SprSubtype, X : BEQ +
LDA.w SprSubtype, X : BEQ +
JSR Sprite_Boomerang_Draw JSR Sprite_Boomerang_Draw
JMP ++ JMP ++
+ +
JSR Sprite_Goriya_Draw JSR Sprite_Goriya_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_Goriya_Main ; Call the main sprite code
JSR Sprite_Goriya_Main ; Call the main sprite code
.SpriteIsNotActive .SpriteIsNotActive
PLB ; Get back the databank we stored previously PLB
RTL ; Go back to original code RTL
} }
; ========================================================= ; =========================================================
@@ -114,7 +110,7 @@ Sprite_Goriya_Main:
{ {
%PlayAnimation(0, 3, 6) %PlayAnimation(0, 3, 6)
LDA.w SprTimerD, X : BNE + LDA.w SprTimerD, X : BNE +
LDA.b #$16 LDA.b #$16
JSL Sprite_ApplySpeedTowardsPlayer JSL Sprite_ApplySpeedTowardsPlayer
%SetTimerD($50) %SetTimerD($50)
@@ -157,7 +153,7 @@ Goriya_HandleTileCollision:
STA.w SprMiscE, X STA.w SprMiscE, X
%SetTimerC(60) %SetTimerC(60)
JMP + JMP +
.down .down
%GotoAction(1) %GotoAction(1)
STA.w SprMiscE, X STA.w SprMiscE, X
%SetTimerC(60) %SetTimerC(60)
@@ -179,7 +175,7 @@ Goriya_HandleTileCollision:
Goriya_BoomerangAttack: Goriya_BoomerangAttack:
{ {
LDA.b #$2C LDA.b #$2C
JSL Sprite_SpawnDynamically : BMI + JSL Sprite_SpawnDynamically : BMI +
LDA.b #$01 : STA.w SprSubtype, Y LDA.b #$01 : STA.w SprSubtype, Y
LDA.b #$04 : STA.w SprAction, Y LDA.b #$04 : STA.w SprAction, Y
@@ -237,7 +233,7 @@ Sprite_Goriya_Move:
STZ.w SprXSpeed, X STZ.w SprXSpeed, X
%GotoAction(0) %GotoAction(0)
LDA.b #$00 : STA.w SprMiscE, X LDA.b #$00 : STA.w SprMiscE, X
RTS RTS
} }
Goriya_MoveDown: Goriya_MoveDown:
@@ -246,7 +242,7 @@ Sprite_Goriya_Move:
STZ.w SprXSpeed, X STZ.w SprXSpeed, X
%GotoAction(1) %GotoAction(1)
LDA.b #$01 : STA.w SprMiscE, X LDA.b #$01 : STA.w SprMiscE, X
RTS RTS
} }
Goriya_MoveLeft: Goriya_MoveLeft:
@@ -255,7 +251,7 @@ Sprite_Goriya_Move:
LDA.b #-GoriyaMovementSpeed : STA.w SprXSpeed, X LDA.b #-GoriyaMovementSpeed : STA.w SprXSpeed, X
%GotoAction(2) %GotoAction(2)
LDA.b #$02 : STA.w SprMiscE, X LDA.b #$02 : STA.w SprMiscE, X
RTS RTS
} }
Goriya_MoveRight: Goriya_MoveRight:
@@ -264,7 +260,7 @@ Sprite_Goriya_Move:
LDA.b #GoriyaMovementSpeed : STA.w SprXSpeed, X LDA.b #GoriyaMovementSpeed : STA.w SprXSpeed, X
%GotoAction(3) %GotoAction(3)
LDA.b #$03 : STA.w SprMiscE, X LDA.b #$03 : STA.w SprMiscE, X
RTS RTS
} }
Goriya_Wait: Goriya_Wait:
@@ -306,7 +302,7 @@ Sprite_Goriya_Draw:
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 : CLC : ADC .x_offsets, X : STA ($90), Y LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
@@ -325,11 +321,10 @@ Sprite_Goriya_Draw:
LDA .chr, X : STA ($90), Y : INY LDA .chr, X : STA ($90), Y : 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
@@ -398,17 +393,16 @@ Sprite_Boomerang_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 : STA ($90), Y LDA $02 : STA ($90), Y
CLC : ADC #$0010 : CMP.w #$0100 CLC : ADC #$0010 : CMP.w #$0100
@@ -425,14 +419,10 @@ Sprite_Boomerang_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 #$02 : ORA $0F : STA ($92), Y ; store size in oam buffer LDA #$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
@@ -454,4 +444,5 @@ Sprite_Boomerang_Draw:
db $A2 db $A2
db $E2 db $E2
db $62 db $62
} }

View File

@@ -45,7 +45,6 @@ Sprite_Poltergeist_Long:
.onscreen .onscreen
JSL Sprite_CheckActive ; Check if game is not paused JSL Sprite_CheckActive ; Check if game is not paused
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
JSR Sprite_Poltergeist_Main ; Call the main sprite code JSR Sprite_Poltergeist_Main ; Call the main sprite code
@@ -55,7 +54,7 @@ Sprite_Poltergeist_Long:
RTL ; Go back to original code RTL ; Go back to original code
} }
; ========================================================= ; =========================================================
Sprite_Poltergeist_Prep: Sprite_Poltergeist_Prep:
{ {
@@ -790,4 +789,4 @@ Sprite_Poltergeist_Draw:
db $00, $00 db $00, $00
db $02 db $02
db $00, $00 db $00, $00
db $02 db $02