Prev: AA4B Up: Map Next: AADF
AA9B: Animate Debris
Used by the routine at FinishTeleport.
Move the 10 explosion particles at Debris_Particles until DebrisCount returns to zero.
Walk all 10 debris particles until none remain.
AnimateDebris AA9B XOR A Write 00 to DebrisCount.
AA9C LD ($5E69),A
AA9F LD IX,$AA4B IX=Debris_Particles.
AAA3 LD B,$10 Set a particle counter in B for 10 loops.
Move each particle in turn.
AnimateDebris_Loop AAA5 PUSH BC Stash the particle counter on the stack.
AAA6 CALL AnimateDebris_AddVelocity Call AnimateDebris_AddVelocity.
AAA9 LD BC,$0005 Set the step to the next particle in BC to 0005.
AAAC ADD IX,BC Move onto the next particle.
AAAE POP BC Restore the particle counter from the stack.
AAAF DJNZ AnimateDebris_Loop Decrease the particle counter by one and loop back to AnimateDebris_Loop until all 10 have moved.
Repeat the pass until no particles remain on screen.
AAB1 LD A,($5E69) Fetch DebrisCount.
AAB4 AND A Jump back to AnimateDebris if any particles remain.
AAB5 JR NZ,AnimateDebris
AAB7 RET Return.
Add this particle's velocity and keep it on-screen.
AnimateDebris_AddVelocity AAB8 LD A,(IX+$00) Fetch the particle X.
AABB ADD A,(IX+$02) Add the X velocity.
AABE LD L,A Copy the new X into L.
AABF LD A,(IX+$01) Fetch the particle Y.
AAC2 ADD A,(IX+$03) Add the Y velocity.
AAC5 LD H,A Copy the new Y into H.
Return unless the new position is inside the play area.
AAC6 LD A,L Fetch the new X.
AAC7 CP $08 Return if it is less than 08.
AAC9 RET C
AACA CP $F8 Return if it is at least F8.
AACC RET NC
AACD LD A,H Fetch the new Y.
AACE CP $30 Return if it is less than 30.
AAD0 RET C
AAD1 CP $A8 Return if it is at least A8.
AAD3 RET NC
Keep the new position and count this particle as still moving.
AAD4 LD (IX+$00),L Write the new X.
AAD7 LD (IX+$01),H Write the new Y.
AADA LD HL,$5E69 HL=DebrisCount.
AADD INC (HL) Increase DebrisCount by one.
AADE RET Return.
Prev: AA4B Up: Map Next: AADF