Sprite housekeeping

This commit is contained in:
scawful
2024-11-21 21:29:50 -05:00
parent d4843293f2
commit daf8d4c39d
3 changed files with 107 additions and 133 deletions

View File

@@ -11,7 +11,7 @@
!DeathAnimation = 00 ; 00 = normal death, 01 = no death animation
!ImperviousAll = 00 ; 00 = Can be attack, 01 = attack will clink on it
!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)
!Hitbox = 00 ; 00 to 31, can be viewed in sprite draw tool
!Persist = 00 ; 01 = your sprite continue to live offscreen
@@ -37,17 +37,13 @@
Sprite_Booki_Long:
{
PHB : PHK : PLB
JSR Sprite_Booki_Draw ; Call the draw code
JSR Sprite_Booki_Draw
JSL Sprite_DrawShadow
JSL Sprite_CheckActive ; Check if game is not paused
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
JSR Sprite_Booki_Main ; Call the main sprite code
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
JSR Sprite_Booki_Main
.SpriteIsNotActive
PLB ; Get back the databank we stored previously
RTL ; Go back to original code
PLB
RTL
}
; =========================================================
@@ -55,11 +51,9 @@ Sprite_Booki_Long:
Sprite_Booki_Prep:
{
PHB : PHK : PLB
LDA.l SWORD : DEC A : TAY
LDA.w .health, Y : STA.w SprHealth, X
STZ.w SprMiscB, X
PLB
RTL
@@ -153,7 +147,7 @@ Sprite_Booki_Move:
PHX
JSL Sprite_DirectionToFacePlayer
LDA.b $0E : CMP.b #$1A : BCS .NotTooClose
LDA.b $0F : CMP.b #$1A : BCS .NotTooClose
LDA.b #$01 : STA.w SprMiscB, X
@@ -169,7 +163,7 @@ Sprite_Booki_Move:
{
JSL GetRandomInt : AND.b #$04
JSL Sprite_FloatAwayFromPlayer
PHX
JSL Sprite_DirectionToFacePlayer
LDA.b $0E : CMP.b #$1B : BCC .NotTooClose
@@ -193,7 +187,7 @@ Sprite_Booki_Draw:
LDA.w SprGfx, X : CLC : ADC.w SprFrame, X : TAY;Animation Frame
LDA .start_index, Y : STA $06
LDA.w SprFlash, X : STA $08
LDA.w SprMiscC, X : STA $09
@@ -203,17 +197,17 @@ Sprite_Booki_Draw:
.nextTile
PHX ; Save current Tile Index?
TXA : CLC : ADC $06 ; Add Animation Index Offset
PHA ; Keep the value with animation index offset?
ASL A : TAX
ASL A : TAX
REP #$20
LDA $00 : STA ($90), Y
AND.w #$0100 : STA $0E
AND.w #$0100 : STA $0E
INY
LDA $02 : STA ($90), Y
CLC : ADC #$0010 : CMP.w #$0100
@@ -236,14 +230,14 @@ Sprite_Booki_Draw:
.Prop
ORA $08 : STA ($90), Y
PHY
PHY
TYA : LSR #2 : TAY
LDA.b #$02 : ORA $0F : STA ($92), Y ; store size in oam buffer
PLY : INY
PLX : DEX : BPL .nextTile
PLX
@@ -268,4 +262,4 @@ Sprite_Booki_Draw:
db $2C
db $0C
db $0E
}
}