Prev: 43823 Up: Map Next: 43933
43848: Animate Debris Burst
Play the explosion tick and move the 16 debris particles.
Tick the explosion pitch and walk the debris particles.
AnimateDebrisBurst 43848 XOR A Write 0 to DebrisCount.
43849 LD (24169),A
43852 LD A,(24187) Fetch Debris_Pitch.
43855 INC A Increase it by one.
43856 LD (24187),A Write it back.
43859 CALL SoundsDebris Call SoundsDebris.
43862 LD IX,43595 IX=Debris_Particles.
43866 LD B,16 Set a particle counter in B for 16 loops.
Move one particle, then loop until all 16 have moved.
AnimateDebrisBurst_Loop 43868 PUSH BC Stash the particle counter on the stack.
43869 CALL AnimateDebrisBurst_TestParkedX Call AnimateDebrisBurst_TestParkedX.
43872 LD BC,5 Set the step to the next particle in BC to 0005.
43875 ADD IX,BC Move onto the next particle.
43877 POP BC Restore the particle counter from the stack.
43878 DJNZ AnimateDebrisBurst_Loop Decrease the particle counter by one and loop back to AnimateDebrisBurst_Loop until all 16 have moved.
Repeat the whole pass while any particle is still moving.
43880 LD A,(24169) Fetch DebrisCount.
43883 AND A Jump back to AnimateDebrisBurst if any particles remain.
43884 JR NZ,AnimateDebrisBurst
43886 RET Return.
Return if this parked particle's Y matches Debris_Y. Otherwise move it.
AnimateDebrisBurst_CompareY 43887 LD A,(24170) Fetch Debris_Y.
43890 CP (IX+1) Return if it matches this particle Y.
43893 RET Z
43894 JR AnimateDebrisBurst_AddX Jump to AnimateDebrisBurst_AddX.
AnimateDebrisBurst_TestParkedX 43896 LD A,(IX+0) Fetch the particle X.
43899 CP 128 Jump to AnimateDebrisBurst_CompareY if it is 128.
43901 JR Z,AnimateDebrisBurst_CompareY
Add the velocity to the particle position.
AnimateDebrisBurst_AddX 43903 LD A,(IX+0) Fetch the particle X.
43906 ADD A,(IX+2) Add the X velocity.
43909 LD L,A Copy the new X into L.
43910 LD A,(IX+1) Fetch the particle Y.
43913 ADD A,(IX+3) Add the Y velocity.
43916 LD H,A Copy the new Y into H.
Return if the new X is 128 and the new Y matches Debris_Y. Otherwise jump to MoveDebrisParticle_TestX.
43917 LD A,L Fetch the new X.
43918 CP 128 Jump to AnimateDebrisBurst_CompareNewY if it is 128.
43920 JR Z,AnimateDebrisBurst_CompareNewY
43922 JP MoveDebrisParticle_TestX Jump to MoveDebrisParticle_TestX.
AnimateDebrisBurst_CompareNewY 43925 LD A,(24170) Fetch Debris_Y.
43928 CP H Return if it matches the new Y.
43929 RET Z
43930 JP MoveDebrisParticle_TestX Jump to MoveDebrisParticle_TestX.
Prev: 43823 Up: Map Next: 43933