Prev: 46056 Up: Map Next: 46274
46176: Handler: Falling Sprite
Tick the sprite delay, move the debris and, once the thrust reaches 1, play SquareWave_Loop and become type 231.
Input
IX Actor slot
Reload the delay from *IX+17 when it expires.
Handler_FallingSprite 46176 DEC (IX+16) Decrease *IX+16 by one.
46179 JR NZ,Handler_FallingSprite_CycleType Jump to Handler_FallingSprite_CycleType if it is not zero.
46181 LD A,(IX+17) A=*IX+17.
46184 LD (IX+16),A Write A to *IX+16.
Increase the thrust and land once it reaches 1.
46187 INC (IX+6) Increment *IX+6 by one.
46190 LD A,(IX+6) A=*IX+6.
46193 CP 1 Compare A with 1.
46195 JR Z,Handler_FallingSprite_Land Jump to Handler_FallingSprite_Land if they are equal.
Step the type (230 becomes 231, else reset to 228), then move.
Handler_FallingSprite_CycleType 46197 LD A,(IX+0) A=*IX+0.
46200 INC A Increment A by one.
46201 CP 231 Compare A with 231.
46203 JR NC,Handler_FallingSprite_MoveDown Jump to Handler_FallingSprite_MoveDown if A is 231 or higher.
""Explosion: Frame 5"".
46205 LD A,228 A=228.
Handler_FallingSprite_MoveDown 46207 LD (IX+0),A Write A to *IX+0.
46210 CALL MoveBySpeed Call MoveBySpeed.
46213 LD (IX+4),A Write A to *IX+4.
46216 JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
Play SquareWave_Loop and become type 231.
Handler_FallingSprite_Land 46219 LD C,(IX+4) C=*IX+4.
46222 LD D,4 D=4.
46224 CALL SquareWave_Loop Call SquareWave_Loop.
""Explosion: Frame 8"".
46227 LD (IX+0),231 Write 231 to *IX+0.
46231 JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
Step the type on and redraw.
Handler_FallingSprite_StepType 46234 INC (IX+0) Increase the actor type by one.
46237 JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
Flip the type every eighth frame, then drop.
Handler_FallingSprite_FlipType 46240 LD A,(24130) Fetch GameTimer.
46243 AND %00000111 Keep only bits 0-2.
46245 JR NZ,Handler_FallingSprite_IncreaseY Jump to Handler_FallingSprite_IncreaseY if the result is not zero.
46247 LD A,(IX+0) Fetch the actor type.
46250 XOR %00000001 Flip bit 0.
46252 LD (IX+0),A Write it back.
Handler_FallingSprite_IncreaseY 46255 INC (IX+4) Increase the actor Y by one.
Remove the sprite once it reaches the ground line.
46258 LD A,(IX+4) Fetch the actor Y.
46261 CP 175 Jump to DrawCurrentActor_Draw if it is still above the ground line.
46263 JP C,DrawCurrentActor_Draw
46266 CALL DrawCachedSprite Call DrawCachedSprite.
46269 LD (IX+0),0 Write 0 to the actor type.
46273 RET Return.
Prev: 46056 Up: Map Next: 46274