Prev: 8D06 Up: Map Next: 8EC5
8E5A: Face Jetman Right
Set bit 02 of the actor type so Jetman faces right, then accelerate or cap the horizontal speed.
Input
IX Actor slot
Decrease to the 0-based sprite index, set bit 2 to face right, then write the 1-based ID back.
FaceJetmanRight 8E5A LD A,(IX+$00) Fetch the actor type.
8E5D DEC A Decrease it to a 0-based sprite index.
8E5E SET 2,A Set the facing bit.
8E60 INC A Restore the 1-based sprite ID.
8E61 LD (IX+$00),A Write it back to *IX+00.
Push the speed right while any fuel remains. Bit 0 of the actor flags is set while Jetman is carrying an item, which slows him down.
8E64 BIT 0,(IX+$08) Jump to FaceJetmanRight_Carrying if Jetman is carrying an item.
8E68 JR NZ,FaceJetmanRight_Carrying
8E6A LD A,(IX+$05) Jump to FaceJetmanRight_ReverseLeft if the horizontal speed is negative.
8E6D AND A
8E6E JP M,FaceJetmanRight_ReverseLeft
Settle on the slow speed if the fuel has run out.
8E71 EX AF,AF' Stash the speed in AF'.
8E72 LD A,($608F) Jump to FaceJetmanRight_NoFuel if FuelLevel_2 is zero.
8E75 AND A
8E76 JR Z,FaceJetmanRight_NoFuel
Speed up to the right unless the speed is already at the cap.
8E78 EX AF,AF' Restore the speed.
8E79 CP $40 Jump to Handler_JetmanMovement_Read if the speed is already at least 40.
8E7B JP NC,Handler_JetmanMovement_Read
8E7E ADD A,$08 Add 08 to the speed.
8E80 CP $30 Jump to FaceJetmanRight_Loop if it is still less than 30.
8E82 JR C,FaceJetmanRight_Loop
8E84 ADD A,$10 Add a further 10 to leave the mid-band.
This entry point is used by the routine at FaceJetmanLeft.
FaceJetmanRight_Loop 8E86 JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
Reverse a leftward speed toward the right.
FaceJetmanRight_ReverseLeft 8E89 CP $D0 Jump to FaceJetmanRight_AddStep if the speed is at least D0.
8E8B JR NC,FaceJetmanRight_AddStep
8E8D ADD A,$10 Add 10 to the speed.
FaceJetmanRight_AddStep 8E8F ADD A,$08 Add 08 to the speed.
8E91 JR FaceJetmanRight_Loop Jump to FaceJetmanRight_Loop.
With no fuel, settle on a slow rightward speed of 10 (signed +10).
FaceJetmanRight_NoFuel 8E93 LD A,$10 Set a slow rightward speed of 10.
8E95 JR FaceJetmanRight_Loop Jump to FaceJetmanRight_Loop.
While carrying an item, use a slower rightward cap.
FaceJetmanRight_Carrying 8E97 LD A,(IX+$05) Jump to FaceJetmanRight_CarryingClamp if the horizontal speed is negative.
8E9A AND A
8E9B JP M,FaceJetmanRight_CarryingClamp
Settle on the slow speed if the fuel has run out.
8E9E EX AF,AF' Stash the speed in AF'.
8E9F LD A,($608F) Jump to FaceJetmanRight_CarryingSlow if FuelLevel_2 is zero.
8EA2 AND A
8EA3 JR Z,FaceJetmanRight_CarryingSlow
Speed up to the right unless the speed is already at the cap.
8EA5 EX AF,AF' Restore the speed.
8EA6 CP $20 Jump to FaceJetmanRight_CarryingFast if the speed is already at least 20.
8EA8 JP NC,FaceJetmanRight_CarryingFast
8EAB ADD A,$04 Add 04 to the speed.
8EAD JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
Reverse a leftward speed toward the right.
FaceJetmanRight_CarryingClamp 8EB0 CP $D0 Jump to FaceJetmanRight_CarryingStep if the speed is at least D0.
8EB2 JR NC,FaceJetmanRight_CarryingStep
8EB4 ADD A,$10 Add 10 to the speed.
FaceJetmanRight_CarryingStep 8EB6 ADD A,$08 Add 08 to the speed.
8EB8 JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
With no fuel while carrying an item, settle on 10 (signed +10).
FaceJetmanRight_CarryingSlow 8EBB LD A,$10 Set a slow rightward speed of 10.
8EBD JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
Cap the rightward speed at 20 while carrying an item.
FaceJetmanRight_CarryingFast 8EC0 LD A,$20 Set a rightward cap of 20.
8EC2 JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
Prev: 8D06 Up: Map Next: 8EC5