Prev: 47016 Up: Map Next: 47120
47036: Carry Bomb
Stick the bomb to Jetman, or on action drop it with his current X speed and play SoundsDropItem.
Input
IX Actor slot
Stick the bomb to Jetman, or drop it on action.
CarryBomb 47036 CALL TestActionKey Call TestActionKey.
47039 JR NZ,CarryBomb_TestDrop Jump to CarryBomb_TestDrop if action is pressed.
47041 RES 7,(IX+8) Reset bit 7 of the actor flags.
Keep the bomb under Jetman.
CarryBomb_Loop 47045 LD HL,(24698) Fetch Jetman_Position.
47048 LD (IX+2),L Write the low world X.
47051 LD (IX+3),H Write the high world X.
47054 LD A,(24700) Fetch Jetman_Y.
47057 ADD A,16 Add 16.
47059 CP 175 Jump to CarryBomb_WriteY if it is still above the ground line.
47061 JR C,CarryBomb_WriteY
175 is the ground line.
47063 LD A,175 A=175.
CarryBomb_WriteY 47065 LD (IX+4),A Write the actor Y.
47068 JR CollectBomb_Loop Jump to CollectBomb_Loop.
Drop the bomb, throwing it with a share of Jetman's speed unless it is on the ground line.
CarryBomb_TestDrop 47070 BIT 7,(IX+8) Jump to CarryBomb_Loop if bit 7 of the actor flags is set.
47074 JR NZ,CarryBomb_Loop
47076 LD A,(IX+4) Fetch the actor Y.
47079 CP 175 Jump to CarryBomb_OnGround if it is on the ground line.
47081 JR Z,CarryBomb_OnGround
Mark the bomb as thrown with a share of Jetman's speed.
47083 LD (IX+8),130 Write 130 to the actor flags.
47087 LD A,(24701) Fetch Jetman_Speed.
47090 SRA A Divide it by 16.
47092 SRA A
47094 SRA A
47096 SRA A
47098 LD (IX+5),A Write it as the bomb speed.
Clear bit 0 of Jetman's flags and play the drop sound.
CarryBomb_ClearCarrying 47101 LD A,(24704) Fetch Jetman_Flags.
47104 AND %11111110 Clear bit 0.
47106 LD (24704),A Write it back.
47109 CALL SoundsDropItem Call SoundsDropItem.
47112 JR CollectBomb_Loop Jump to CollectBomb_Loop.
CarryBomb_OnGround 47114 LD (IX+8),128 Write 128 to the actor flags.
47118 JR CarryBomb_ClearCarrying Jump to CarryBomb_ClearCarrying.
Prev: 47016 Up: Map Next: 47120