Prev: 36442 Up: Map Next: 36660
36549: Face Jetman Left
Reset bit 2 of the actor type so Jetman faces left, then accelerate or cap the horizontal speed.
Input
IX Actor slot
Decrease to the 0-based sprite index, reset bit 2 to face left, then write the 1-based ID back.
FaceJetmanLeft 36549 LD A,(IX+0) Fetch the actor type.
36552 DEC A Decrease it to a 0-based sprite index.
36553 RES 2,A Reset the facing bit.
36555 INC A Restore the 1-based sprite ID.
36556 LD (IX+0),A Write it back to *IX+0.
Push the speed left while any fuel remains. Bit 0 of the actor flags is set while Jetman is carrying an item, which slows him down.
36559 BIT 0,(IX+8) Jump to FaceJetmanLeft_Carrying if Jetman is carrying an item.
36563 JR NZ,FaceJetmanLeft_Carrying
36565 LD A,(IX+5) Jump to FaceJetmanLeft_ReverseRight if the horizontal speed is positive.
36568 AND A
36569 JP P,FaceJetmanLeft_ReverseRight
Settle on the slow speed if the fuel has run out.
36572 EX AF,AF' Stash the speed in AF'.
36573 LD A,(24719) Jump to FaceJetmanLeft_NoFuel if FuelLevel_2 is zero.
36576 AND A
36577 JR Z,FaceJetmanLeft_NoFuel
Speed up to the left unless the speed is already at the cap.
36579 EX AF,AF' Restore the speed.
36580 CP 208 Jump to Handler_JetmanMovement_Read if the speed is already below 208.
36582 JP C,Handler_JetmanMovement_Read
36585 SUB 8 Subtract 8 from the speed.
36587 CP 224 Jump to FaceJetmanRight_Loop if it is still at least 224.
36589 JR NC,FaceJetmanRight_Loop
36591 SUB 16 Subtract a further 16 to leave the mid-band.
36593 JR FaceJetmanRight_Loop Jump to FaceJetmanRight_Loop.
Reverse a rightward speed toward the left.
FaceJetmanLeft_ReverseRight 36595 CP 48 Jump to FaceJetmanLeft_SubtractStep if the speed is less than 48.
36597 JR C,FaceJetmanLeft_SubtractStep
36599 SUB 16 Subtract 16 from the speed.
36601 JR FaceJetmanRight_Loop Jump to FaceJetmanRight_Loop.
FaceJetmanLeft_SubtractStep 36603 SUB 8 Subtract 8 from the speed.
36605 JR FaceJetmanRight_Loop Jump to FaceJetmanRight_Loop.
With no fuel, settle on a slow leftward speed of 240 (signed -16).
FaceJetmanLeft_NoFuel 36607 LD A,240 Set a slow leftward speed of 240.
36609 JR FaceJetmanRight_Loop Jump to FaceJetmanRight_Loop.
While carrying an item, use a slower leftward cap.
FaceJetmanLeft_Carrying 36611 LD A,(IX+5) Jump to FaceJetmanLeft_CarryingClamp if the horizontal speed is positive.
36614 AND A
36615 JP P,FaceJetmanLeft_CarryingClamp
Settle on the slow speed if the fuel has run out.
36618 EX AF,AF' Stash the speed in AF'.
36619 LD A,(24719) Jump to FaceJetmanLeft_CarryingSlow if FuelLevel_2 is zero.
36622 AND A
36623 JR Z,FaceJetmanLeft_CarryingSlow
Speed up to the left unless the speed is already at the cap.
36625 EX AF,AF' Restore the speed.
36626 CP 240 Jump to FaceJetmanLeft_CarryingFast if the speed is already below 240.
36628 JP C,FaceJetmanLeft_CarryingFast
36631 SUB 4 Subtract 4 from the speed.
36633 JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
Reverse a rightward speed toward the left.
FaceJetmanLeft_CarryingClamp 36636 CP 48 Jump to FaceJetmanLeft_CarryingStep if the speed is less than 48.
36638 JR C,FaceJetmanLeft_CarryingStep
36640 SUB 16 Subtract 16 from the speed.
36642 JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
FaceJetmanLeft_CarryingStep 36645 SUB 8 Subtract 8 from the speed.
36647 JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
With no fuel while carrying an item, settle on 240 (signed -16).
FaceJetmanLeft_CarryingSlow 36650 LD A,240 Set a slow leftward speed of 240.
36652 JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
Cap the leftward speed at 224 (signed -32) while carrying an item.
FaceJetmanLeft_CarryingFast 36655 LD A,224 Set a leftward cap of 224.
36657 JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
Prev: 36442 Up: Map Next: 36660