Prev: AB2F Up: Map Next: AB9D
AB48: Animate Debris Burst
Play the explosion tick and move the 10 debris particles.
Tick the explosion pitch and walk the debris particles.
AnimateDebrisBurst AB48 XOR A Write 00 to DebrisCount.
AB49 LD ($5E69),A
AB4C LD A,($5E7B) Fetch Debris_Pitch.
AB4F INC A Increase it by one.
AB50 LD ($5E7B),A Write it back.
AB53 CALL SoundsDebris Call SoundsDebris.
AB56 LD IX,$AA4B IX=Debris_Particles.
AB5A LD B,$10 Set a particle counter in B for 10 loops.
Move one particle, then loop until all 10 have moved.
AnimateDebrisBurst_Loop AB5C PUSH BC Stash the particle counter on the stack.
AB5D CALL AnimateDebrisBurst_TestParkedX Call AnimateDebrisBurst_TestParkedX.
AB60 LD BC,$0005 Set the step to the next particle in BC to 0005.
AB63 ADD IX,BC Move onto the next particle.
AB65 POP BC Restore the particle counter from the stack.
AB66 DJNZ AnimateDebrisBurst_Loop Decrease the particle counter by one and loop back to AnimateDebrisBurst_Loop until all 10 have moved.
Repeat the whole pass while any particle is still moving.
AB68 LD A,($5E69) Fetch DebrisCount.
AB6B AND A Jump back to AnimateDebrisBurst if any particles remain.
AB6C JR NZ,AnimateDebrisBurst
AB6E RET Return.
Return if this parked particle's Y matches Debris_Y. Otherwise move it.
AnimateDebrisBurst_CompareY AB6F LD A,($5E6A) Fetch Debris_Y.
AB72 CP (IX+$01) Return if it matches this particle Y.
AB75 RET Z
AB76 JR AnimateDebrisBurst_AddX Jump to AnimateDebrisBurst_AddX.
AnimateDebrisBurst_TestParkedX AB78 LD A,(IX+$00) Fetch the particle X.
AB7B CP $80 Jump to AnimateDebrisBurst_CompareY if it is 80.
AB7D JR Z,AnimateDebrisBurst_CompareY
Add the velocity to the particle position.
AnimateDebrisBurst_AddX AB7F LD A,(IX+$00) Fetch the particle X.
AB82 ADD A,(IX+$02) Add the X velocity.
AB85 LD L,A Copy the new X into L.
AB86 LD A,(IX+$01) Fetch the particle Y.
AB89 ADD A,(IX+$03) Add the Y velocity.
AB8C LD H,A Copy the new Y into H.
Return if the new X is 80 and the new Y matches Debris_Y. Otherwise jump to MoveDebrisParticle_TestX.
AB8D LD A,L Fetch the new X.
AB8E CP $80 Jump to AnimateDebrisBurst_CompareNewY if it is 80.
AB90 JR Z,AnimateDebrisBurst_CompareNewY
AB92 JP MoveDebrisParticle_TestX Jump to MoveDebrisParticle_TestX.
AnimateDebrisBurst_CompareNewY AB95 LD A,($5E6A) Fetch Debris_Y.
AB98 CP H Return if it matches the new Y.
AB99 RET Z
AB9A JP MoveDebrisParticle_TestX Jump to MoveDebrisParticle_TestX.
Prev: AB2F Up: Map Next: AB9D