Prev: B3E8 Up: Map Next: B4C2
B460: Handler: Falling Sprite
Tick the sprite delay, move the debris and, once the thrust reaches 01, play SquareWave_Loop and become type E7.
Input
IX Actor slot
Reload the delay from *IX+11 when it expires.
Handler_FallingSprite B460 DEC (IX+$10) Decrease *IX+10 by one.
B463 JR NZ,Handler_FallingSprite_CycleType Jump to Handler_FallingSprite_CycleType if it is not zero.
B465 LD A,(IX+$11) A=*IX+11.
B468 LD (IX+$10),A Write A to *IX+10.
Increase the thrust and land once it reaches 01.
B46B INC (IX+$06) Increment *IX+06 by one.
B46E LD A,(IX+$06) A=*IX+06.
B471 CP $01 Compare A with 01.
B473 JR Z,Handler_FallingSprite_Land Jump to Handler_FallingSprite_Land if they are equal.
Step the type (E6 becomes E7, else reset to E4), then move.
Handler_FallingSprite_CycleType B475 LD A,(IX+$00) A=*IX+00.
B478 INC A Increment A by one.
B479 CP $E7 Compare A with E7.
B47B JR NC,Handler_FallingSprite_MoveDown Jump to Handler_FallingSprite_MoveDown if A is E7 or higher.
""Explosion: Frame 5"".
B47D LD A,$E4 A=E4.
Handler_FallingSprite_MoveDown B47F LD (IX+$00),A Write A to *IX+00.
B482 CALL MoveBySpeed Call MoveBySpeed.
B485 LD (IX+$04),A Write A to *IX+04.
B488 JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
Play SquareWave_Loop and become type E7.
Handler_FallingSprite_Land B48B LD C,(IX+$04) C=*IX+04.
B48E LD D,$04 D=04.
B490 CALL SquareWave_Loop Call SquareWave_Loop.
""Explosion: Frame 8"".
B493 LD (IX+$00),$E7 Write E7 to *IX+00.
B497 JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
Step the type on and redraw.
Handler_FallingSprite_StepType B49A INC (IX+$00) Increase the actor type by one.
B49D JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
Flip the type every eighth frame, then drop.
Handler_FallingSprite_FlipType B4A0 LD A,($5E42) Fetch GameTimer.
B4A3 AND %00000111 Keep only bits 0-2.
B4A5 JR NZ,Handler_FallingSprite_IncreaseY Jump to Handler_FallingSprite_IncreaseY if the result is not zero.
B4A7 LD A,(IX+$00) Fetch the actor type.
B4AA XOR %00000001 Flip bit 0.
B4AC LD (IX+$00),A Write it back.
Handler_FallingSprite_IncreaseY B4AF INC (IX+$04) Increase the actor Y by one.
Remove the sprite once it reaches the ground line.
B4B2 LD A,(IX+$04) Fetch the actor Y.
B4B5 CP $AF Jump to DrawCurrentActor_Draw if it is still above the ground line.
B4B7 JP C,DrawCurrentActor_Draw
B4BA CALL DrawCachedSprite Call DrawCachedSprite.
B4BD LD (IX+$00),$00 Write 00 to the actor type.
B4C1 RET Return.
Prev: B3E8 Up: Map Next: B4C2