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

@@ -37,17 +37,13 @@
Sprite_Booki_Long: Sprite_Booki_Long:
{ {
PHB : PHK : PLB PHB : PHK : PLB
JSR Sprite_Booki_Draw
JSR Sprite_Booki_Draw ; Call the draw code
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_Booki_Main
JSR Sprite_Booki_Main ; Call the main sprite code
.SpriteIsNotActive .SpriteIsNotActive
PLB ; Get back the databank we stored previously PLB
RTL ; Go back to original code RTL
} }
; ========================================================= ; =========================================================
@@ -55,11 +51,9 @@ Sprite_Booki_Long:
Sprite_Booki_Prep: Sprite_Booki_Prep:
{ {
PHB : PHK : PLB PHB : PHK : PLB
LDA.l SWORD : 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
STZ.w SprMiscB, X STZ.w SprMiscB, X
PLB PLB
RTL RTL

View File

@@ -35,23 +35,16 @@
Sprite_Poltergeist_Long: Sprite_Poltergeist_Long:
{ {
PHB : PHK : PLB PHB : PHK : PLB
JSR Sprite_Poltergeist_Draw
JSR Sprite_Poltergeist_Draw ; Call the draw code
LDA $E0 : CMP #$F0 : BNE .onscreen LDA $E0 : CMP #$F0 : BNE .onscreen
LDA.w SprMiscA, X : BEQ .SpriteIsNotActive LDA.w SprMiscA, X : BEQ .SpriteIsNotActive
STZ.w SprState, X ; kill the sprite if offscreen and activated STZ.w SprState, X ; kill the sprite if offscreen and activated
.onscreen .onscreen
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
JSL Sprite_CheckActive ; Check if game is not paused JSR Sprite_Poltergeist_Main
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
JSR Sprite_Poltergeist_Main ; Call the main sprite code
.SpriteIsNotActive .SpriteIsNotActive
PLB
PLB ; Get back the databank we stored previously RTL
RTL ; Go back to original code
} }
; ========================================================= ; =========================================================
@@ -69,7 +62,6 @@ Sprite_Poltergeist_Prep:
STZ.w SprMiscA, X STZ.w SprMiscA, X
STZ.w SprAction, X STZ.w SprAction, X
JMP .done JMP .done
.notPictureFrame .notPictureFrame
CMP #$11 : BNE .notAxe CMP #$11 : BNE .notAxe
@@ -77,21 +69,18 @@ Sprite_Poltergeist_Prep:
LDA #$02 : STA.w SprAction, X LDA #$02 : STA.w SprAction, X
LDA #$04 : STA.w SprNbrOAM, X LDA #$04 : STA.w SprNbrOAM, X
BRA .done BRA .done
.notAxe .notAxe
CMP #$12 : BNE .notKnife CMP #$12 : BNE .notKnife
LDA #15 : STA.w SprFrame, X LDA #15 : STA.w SprFrame, X
LDA #$02 : STA.w SprAction, X LDA #$02 : STA.w SprAction, X
BRA .done BRA .done
.notKnife .notKnife
CMP #$13 : BNE .notFork CMP #$13 : BNE .notFork
LDA #37 : STA.w SprFrame, X LDA #37 : STA.w SprFrame, X
LDA #$02 : STA.w SprAction, X LDA #$02 : STA.w SprAction, X
BRA .done BRA .done
.notFork .notFork
CMP #$14 : BNE .notBed CMP #$14 : BNE .notBed
@@ -99,7 +88,6 @@ Sprite_Poltergeist_Prep:
LDA #$01 : STA.w SprAction, X LDA #$01 : STA.w SprAction, X
LDA #$06 : STA.w SprNbrOAM, X LDA #$06 : STA.w SprNbrOAM, X
BRA .done BRA .done
.notBed .notBed
CMP #$15 : BNE .notDoor CMP #$15 : BNE .notDoor
@@ -109,20 +97,17 @@ Sprite_Poltergeist_Prep:
LDA.w SprY, X : SEC : SBC #$0C : STA.w SprY, X LDA.w SprY, X : SEC : SBC #$0C : STA.w SprY, X
LDA.w SprX, X : CLC : ADC #$08 : STA.w SprX, X LDA.w SprX, X : CLC : ADC #$08 : STA.w SprX, X
BRA .done BRA .done
.notDoor .notDoor
LDA.w SprSubtype, X : AND #$08 : BNE .secondset ;2nd set LDA.w SprSubtype, X : AND #$08 : BNE .secondset ;2nd set
LDA.w SprSubtype, X : CLC : ADC #23 : STA.w SprFrame, X LDA.w SprSubtype, X : CLC : ADC #23 : STA.w SprFrame, X
BRA .done BRA .done
.secondset .secondset
LDA.w SprSubtype, X : AND #$07 : CLC : ADC #30 : STA.w SprFrame, X LDA.w SprSubtype, X : AND #$07 : CLC : ADC #30 : STA.w SprFrame, X
LDA.w SprSubtype, X LDA.w SprSubtype, X
.done .done
PLB PLB
RTL RTL
} }
@@ -393,21 +378,18 @@ Axe:
PlayAxe: PlayAxe:
{ {
%PlayAnimation(7, 14, 6) %PlayAnimation(7, 14, 6)
RTS RTS
} }
PlayFork: PlayFork:
{ {
%PlayAnimation(37, 44, 6) %PlayAnimation(37, 44, 6)
RTS RTS
} }
PlayKnife: PlayKnife:
{ {
%PlayAnimation(15, 22, 6) %PlayAnimation(15, 22, 6)
RTS RTS
} }

View File

@@ -99,7 +99,6 @@ Sprite_MoveAltitude:
; movement, collision are handled by this function ; movement, collision are handled by this function
; $09 = speed, $08 = max height ( e.g. height:20 = vitreous) ; $09 = speed, $08 = max height ( e.g. height:20 = vitreous)
Sprite_BounceTowardPlayer: Sprite_BounceTowardPlayer:
{ {
JSL Sprite_MoveAltitude JSL Sprite_MoveAltitude
@@ -700,7 +699,6 @@ GetDistance8bit_Long:
RTL RTL
} }
; ========================================================= ; =========================================================
Intro_Dungeon_Main: Intro_Dungeon_Main: