Prev: 45583 Up: Map Next: 45730
45592: Tick Then Explode
Move the actor by its fractional speed and thrust and cycle its frame. Start StartSmallExplosion when the timer at *IX+8 reaches zero, when the actor reaches the ground or leaves the top of the play area, or when it touches Jetman.
Input
IX Actor slot
Decrease the actor timer and explode when it reaches zero.
TickThenExplode 45592 BIT 0,(IX+16) Jump to ScoreSmallHit if bit 0 of the explode flag is set.
45596 JP NZ,ScoreSmallHit
45599 DEC (IX+8) Decrease the actor timer by one.
45602 JP Z,StartSmallExplosion Jump to StartSmallExplosion if it is now zero.
Work out the horizontal step from the actor speed.
45605 LD A,(IX+5) Fetch the actor speed.
45608 AND A Jump to AdvanceAnimation if the speed is positive.
45609 JP P,AdvanceAnimation
Add a negative speed to the X fraction and make the step negative.
45612 ADD A,(IX+16) Add the X nibble.
45615 LD C,A Stash the sum in C.
45616 AND %00001111 Keep only bits 0-3.
45618 NEG Negate it.
45620 AND %11111110 Reset bit 0.
45622 LD (IX+16),A Write it back as the X nibble.
Turn the carried bits of the sum into the negative step.
45625 LD A,C Copy the sum into A.
45626 NEG Negate it.
45628 RRCA Rotate the high nibble down into bits 0-3.
45629 RRCA
45630 RRCA
45631 RRCA
45632 AND %00001111 Keep only bits 0-3.
45634 NEG Negate it.
45636 LD B,255 B=255.
Move the world X by the step and wrap it.
TickThenExplode_AddX 45638 ADD A,(IX+2) Add the step to the world X.
45641 LD (IX+2),A Write it back.
45644 LD A,(IX+3) Fetch the high byte.
45647 ADC A,B Add the sign.
45648 AND %00011111 Keep only bits 0-4.
45650 LD (IX+3),A Write the high byte back.
Work out the vertical step from the actor thrust.
45653 LD A,(IX+6) Fetch the actor thrust.
45656 AND A Jump to AdvanceAnimation_AddYNibble if the thrust is positive.
45657 JP P,AdvanceAnimation_AddYNibble
Add a negative thrust to the Y fraction and make the step negative.
45660 ADD A,(IX+17) Add the Y nibble.
45663 LD C,A Stash the sum in C.
45664 AND %00001111 Keep only bits 0-3.
45666 NEG Negate it.
45668 LD (IX+17),A Write it back as the Y nibble.
Turn the carried bits of the sum into the negative step.
45671 LD A,C Copy the sum into A.
45672 NEG Negate it.
45674 RRCA Rotate the high nibble down into bits 0-3.
45675 RRCA
45676 RRCA
45677 RRCA
45678 AND %00001111 Keep only bits 0-3.
45680 NEG Negate it.
Move the actor Y, exploding on the ground or above the play area.
TickThenExplode_AddY 45682 ADD A,(IX+4) Add the step to the actor Y.
45685 CP 175 Compare it against 175.
45687 JP NC,StartSmallExplosion Jump to StartSmallExplosion if the actor is on the ground.
45690 CP 48 Compare it against 48.
45692 JP C,StartSmallExplosion Jump to StartSmallExplosion if the actor is above the play area.
45695 LD (IX+4),A Write the new Y.
Advance the frame within the actor's type family.
45698 LD A,(IX+0) Fetch the actor type.
45701 AND %11111100 Keep only bits 2-7.
45703 LD C,A Stash the family in C.
45704 LD A,(IX+0) Fetch the actor type.
45707 INC A Increase it by one.
45708 AND %00000011 Keep only bits 0-1.
45710 OR C Merge the family back in.
45711 LD (IX+0),A Write it to the actor type.
Draw the sprite and write its attributes.
45714 CALL DrawObjectSprite Call DrawObjectSprite.
45717 CALL ColouriseSprite Call ColouriseSprite.
Explode the actor if it is touching Jetman.
45720 CALL TickThenExplode_CloseRange Call TickThenExplode_CloseRange.
45723 RET NC Return if Jetman is out of range.
45724 CALL TickThenExplode_KillJetman Call TickThenExplode_KillJetman.
45727 JP StartSmallExplosion Jump to StartSmallExplosion.
Prev: 45583 Up: Map Next: 45730