Prev: 35953 Up: Map Next: 36102
36028: Handler: Jetman Walk
Jetman is walking on the ground. Keep him walking while there is ground beneath him, or launch him if UP is pressed or the ground ends.
Input
IX Actor slot
Set the vertical thrust first. 240 is a signed -16 upward thrust.
Handler_JetmanWalk 36028 LD (IX+6),240 Write 240 to *IX+6.
36032 CALL HandlerControls Call HandlerControls.
36035 BIT 3,A Jump to LaunchJetman if UP is pressed.
36037 JP Z,LaunchJetman
Keep walking if there is ground under Jetman, otherwise launch.
36040 CALL ReadTerrainCell Call ReadTerrainCell.
36043 LD A,D Jump to LaunchJetman if there is no terrain under Jetman.
36044 AND A
36045 JP Z,LaunchJetman
36048 LD A,E Jump to LaunchJetman if the cell beside Jetman is empty.
36049 AND A
36050 JP Z,LaunchJetman
36053 LD A,E Jump to LaunchJetman if bit 3 of the second terrain byte is set (a crater tile).
36054 OR E
36055 BIT 3,A
36057 JP NZ,LaunchJetman
36060 JP Handler_JetmanMovement_Animate Jump to Handler_JetmanMovement_Animate to move and animate Jetman.
This entry point is used by the routine at Handler_Jetman.
Handler_JetmanWalk_Face 36063 JP Handler_JetmanMovement_Draw Jump to Handler_JetmanMovement_Draw.
Face Jetman left and keep walking. 240 is a signed -16 leftward speed.
Handler_JetmanWalk_FaceLeft 36066 LD A,240 Write 240 to *IX+5.
36068 LD (IX+5),A
Bit 2 of the 0-based sprite index is the facing: reset means left and set means right.
36071 LD A,(IX+0) A=*IX+0.
36074 DEC A Decrease it to a 0-based sprite index.
36075 RES 2,A Reset the facing bit.
36077 INC A Restore the 1-based sprite ID.
36078 LD (IX+0),A Write A back to *IX+0.
36081 JP Handler_JetmanWalk Jump to Handler_JetmanWalk.
Face Jetman right and keep walking. 16 is a signed +16 rightward speed.
Handler_JetmanWalk_FaceRight 36084 LD A,16 Write 16 to *IX+5.
36086 LD (IX+5),A
Same 0-based facing bit as 36071, but set it for right.
36089 LD A,(IX+0) A=*IX+0.
36092 DEC A Decrease it to a 0-based sprite index.
36093 SET 2,A Set the facing bit.
36095 INC A Restore the 1-based sprite ID.
36096 LD (IX+0),A Write A back to *IX+0.
36099 JP Handler_JetmanWalk Jump to Handler_JetmanWalk.
Prev: 35953 Up: Map Next: 36102