Prev: 8E5A Up: Map Next: 8F34
8EC5: Face Jetman Left
Reset bit 02 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 8EC5 LD A,(IX+$00) Fetch the actor type.
8EC8 DEC A Decrease it to a 0-based sprite index.
8EC9 RES 2,A Reset the facing bit.
8ECB INC A Restore the 1-based sprite ID.
8ECC LD (IX+$00),A Write it back to *IX+00.
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.
8ECF BIT 0,(IX+$08) Jump to FaceJetmanLeft_Carrying if Jetman is carrying an item.
8ED3 JR NZ,FaceJetmanLeft_Carrying
8ED5 LD A,(IX+$05) Jump to FaceJetmanLeft_ReverseRight if the horizontal speed is positive.
8ED8 AND A
8ED9 JP P,FaceJetmanLeft_ReverseRight
Settle on the slow speed if the fuel has run out.
8EDC EX AF,AF' Stash the speed in AF'.
8EDD LD A,($608F) Jump to FaceJetmanLeft_NoFuel if FuelLevel_2 is zero.
8EE0 AND A
8EE1 JR Z,FaceJetmanLeft_NoFuel
Speed up to the left unless the speed is already at the cap.
8EE3 EX AF,AF' Restore the speed.
8EE4 CP $D0 Jump to Handler_JetmanMovement_Read if the speed is already below D0.
8EE6 JP C,Handler_JetmanMovement_Read
8EE9 SUB $08 Subtract 08 from the speed.
8EEB CP $E0 Jump to FaceJetmanRight_Loop if it is still at least E0.
8EED JR NC,FaceJetmanRight_Loop
8EEF SUB $10 Subtract a further 10 to leave the mid-band.
8EF1 JR FaceJetmanRight_Loop Jump to FaceJetmanRight_Loop.
Reverse a rightward speed toward the left.
FaceJetmanLeft_ReverseRight 8EF3 CP $30 Jump to FaceJetmanLeft_SubtractStep if the speed is less than 30.
8EF5 JR C,FaceJetmanLeft_SubtractStep
8EF7 SUB $10 Subtract 10 from the speed.
8EF9 JR FaceJetmanRight_Loop Jump to FaceJetmanRight_Loop.
FaceJetmanLeft_SubtractStep 8EFB SUB $08 Subtract 08 from the speed.
8EFD JR FaceJetmanRight_Loop Jump to FaceJetmanRight_Loop.
With no fuel, settle on a slow leftward speed of F0 (signed -10).
FaceJetmanLeft_NoFuel 8EFF LD A,$F0 Set a slow leftward speed of F0.
8F01 JR FaceJetmanRight_Loop Jump to FaceJetmanRight_Loop.
While carrying an item, use a slower leftward cap.
FaceJetmanLeft_Carrying 8F03 LD A,(IX+$05) Jump to FaceJetmanLeft_CarryingClamp if the horizontal speed is positive.
8F06 AND A
8F07 JP P,FaceJetmanLeft_CarryingClamp
Settle on the slow speed if the fuel has run out.
8F0A EX AF,AF' Stash the speed in AF'.
8F0B LD A,($608F) Jump to FaceJetmanLeft_CarryingSlow if FuelLevel_2 is zero.
8F0E AND A
8F0F JR Z,FaceJetmanLeft_CarryingSlow
Speed up to the left unless the speed is already at the cap.
8F11 EX AF,AF' Restore the speed.
8F12 CP $F0 Jump to FaceJetmanLeft_CarryingFast if the speed is already below F0.
8F14 JP C,FaceJetmanLeft_CarryingFast
8F17 SUB $04 Subtract 04 from the speed.
8F19 JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
Reverse a rightward speed toward the left.
FaceJetmanLeft_CarryingClamp 8F1C CP $30 Jump to FaceJetmanLeft_CarryingStep if the speed is less than 30.
8F1E JR C,FaceJetmanLeft_CarryingStep
8F20 SUB $10 Subtract 10 from the speed.
8F22 JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
FaceJetmanLeft_CarryingStep 8F25 SUB $08 Subtract 08 from the speed.
8F27 JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
With no fuel while carrying an item, settle on F0 (signed -10).
FaceJetmanLeft_CarryingSlow 8F2A LD A,$F0 Set a slow leftward speed of F0.
8F2C JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
Cap the leftward speed at E0 (signed -20) while carrying an item.
FaceJetmanLeft_CarryingFast 8F2F LD A,$E0 Set a leftward cap of E0.
8F31 JP Handler_JetmanMovement_Grounded Jump to Handler_JetmanMovement_Grounded.
Prev: 8E5A Up: Map Next: 8F34