Prev: 43595 Up: Map Next: 43743
43675: Animate Debris
Move the 16 explosion particles at Debris_Particles until DebrisCount returns to zero.
Walk all 16 debris particles until none remain.
AnimateDebris 43675 XOR A Write 0 to DebrisCount.
43676 LD (24169),A
43679 LD IX,43595 IX=Debris_Particles.
43683 LD B,16 Set a particle counter in B for 16 loops.
Move each particle in turn.
AnimateDebris_Loop 43685 PUSH BC Stash the particle counter on the stack.
43686 CALL AnimateDebris_AddVelocity Call AnimateDebris_AddVelocity.
43689 LD BC,5 Set the step to the next particle in BC to 0005.
43692 ADD IX,BC Move onto the next particle.
43694 POP BC Restore the particle counter from the stack.
43695 DJNZ AnimateDebris_Loop Decrease the particle counter by one and loop back to AnimateDebris_Loop until all 16 have moved.
Repeat the pass until no particles remain on screen.
43697 LD A,(24169) Fetch DebrisCount.
43700 AND A Jump back to AnimateDebris if any particles remain.
43701 JR NZ,AnimateDebris
43703 RET Return.
Add this particle's velocity and keep it on-screen.
AnimateDebris_AddVelocity 43704 LD A,(IX+0) Fetch the particle X.
43707 ADD A,(IX+2) Add the X velocity.
43710 LD L,A Copy the new X into L.
43711 LD A,(IX+1) Fetch the particle Y.
43714 ADD A,(IX+3) Add the Y velocity.
43717 LD H,A Copy the new Y into H.
Return unless the new position is inside the play area.
43718 LD A,L Fetch the new X.
43719 CP 8 Return if it is less than 8.
43721 RET C
43722 CP 248 Return if it is at least 248.
43724 RET NC
43725 LD A,H Fetch the new Y.
43726 CP 48 Return if it is less than 48.
43728 RET C
43729 CP 168 Return if it is at least 168.
43731 RET NC
Keep the new position and count this particle as still moving.
43732 LD (IX+0),L Write the new X.
43735 LD (IX+1),H Write the new Y.
43738 LD HL,24169 HL=DebrisCount.
43741 INC (HL) Increase DebrisCount by one.
43742 RET Return.
Prev: 43595 Up: Map Next: 43743