![]() |
Routines |
| Prev: 41064 | Up: Map | Next: 41386 |
|
Test the action key and drop or collect the current object.
|
||||||||
| Handler_PickupAction | 41208 | CALL TestActionKey | Jump to Handler_PickupAction_TestRover if the action key is pressed. | |||||
| 41211 | JR NZ,Handler_PickupAction_TestRover | |||||||
| 41213 | RES 1,(IX+8) | Reset bit 1 of the actor flags. | ||||||
| Handler_PickupAction_TestRover | 41217 | LD A,(24720) | Fetch Rover_Slot. | |||||
| 41220 | SUB 26 | Subtract 26. | ||||||
| 41222 | CP 16 | Jump to Handler_PickupAction_PickOffset if that is not a rover frame. | ||||||
| 41224 | JR NC,Handler_PickupAction_PickOffset | |||||||
| 41226 | CALL Handler_HeldObject_Loop | Call Handler_HeldObject_Loop. | ||||||
| 41229 | JR Handler_PickupAction_TestAction | Jump to Handler_PickupAction_TestAction. | ||||||
|
Type 22 and above is seated facing right; hang the object on the left.
|
||||||||
| Handler_PickupAction_PickOffset | 41231 | LD A,(24696) | Fetch Jetman_Slot. | |||||
| 41234 | CP 22 | Jump to Handler_PickupAction_OnFootOffset if Jetman's type is less than 22. | ||||||
| 41236 | JR C,Handler_PickupAction_OnFootOffset | |||||||
| 41238 | LD BC,65524 | Set the offset in BC to 65524 (-12). | ||||||
|
Place the object at Jetman's X plus the offset, then go to collect it.
|
||||||||
| Handler_PickupAction_Loop | 41241 | LD HL,(24698) | Fetch Jetman_Position. | |||||
| 41244 | CALL Handler_HeldObject_WriteX | Call Handler_HeldObject_WriteX. | ||||||
| 41247 | JR Handler_PickupAction_Collect | Jump to Handler_PickupAction_Collect. | ||||||
| Handler_PickupAction_OnFootOffset | 41249 | LD BC,18 | Set the offset in BC to 0018. | |||||
| 41252 | JR Handler_PickupAction_Loop | Jump to Handler_PickupAction_Loop. | ||||||
|
Skip the collect test unless the action key is pressed.
|
||||||||
| Handler_PickupAction_TestAction | 41254 | CALL TestActionKey | Call TestActionKey. | |||||
| 41257 | JP Z,Handler_Pickup_Teleport | Jump to Handler_Pickup_Teleport if the action key is not pressed. | ||||||
|
Collect this object if Jetman is free and in range.
|
||||||||
| Handler_PickupAction_Collect | 41260 | LD A,(24704) | Fetch Jetman_Flags. | |||||
| 41263 | AND %00000001 | Keep only bit 0. | ||||||
| 41265 | JP NZ,Handler_Pickup_Teleport | Jump to Handler_Pickup_Teleport if Jetman is already carrying. | ||||||
| 41268 | LD A,(IX+8) | Fetch the actor flags. | ||||||
| 41271 | AND %01110111 | Keep only bits 0-2 and 4-6. | ||||||
| 41273 | JP NZ,Handler_Pickup_Teleport | Jump to Handler_Pickup_Teleport if any of those bits are set. | ||||||
|
Check the object is in range of Jetman.
|
||||||||
| 41276 | CALL TestJetmanAction_ComparePosition | Call TestJetmanAction_ComparePosition. | ||||||
| 41279 | JP NC,Handler_Pickup_Teleport | Jump to Handler_Pickup_Teleport if the object is out of range. | ||||||
|
Free the rover if this object was attached to it.
|
||||||||
| 41282 | BIT 3,(IX+8) | Jump to Handler_PickupAction_SetCarrying if bit 3 of the actor flags is reset. | ||||||
| 41286 | JR Z,Handler_PickupAction_SetCarrying | |||||||
| 41288 | XOR A | Write 0 to RoverCargoFlag. | ||||||
| 41289 | LD (24227),A | |||||||
|
Mark Jetman as carrying the object and play the pickup sound.
|
||||||||
| Handler_PickupAction_SetCarrying | 41292 | LD A,(24704) | Fetch Jetman_Flags. | |||||
| 41295 | OR %00000001 | Set bit 0. | ||||||
| 41297 | LD (24704),A | Write it back. | ||||||
| 41300 | LD (IX+8),6 | Write 6 to the actor flags. | ||||||
| 41304 | JP SoundsTakeObject | Jump to SoundsTakeObject. | ||||||
|
Snap the object onto Jetman.
|
||||||||
| Handler_PickupAction_SnapToJetman | 41307 | LD HL,(24698) | Fetch Jetman_Position. | |||||
| 41310 | LD (IX+2),L | Write the low byte as the object world X. | ||||||
| 41313 | LD (IX+3),H | Write the high byte. | ||||||
| 41316 | LD A,(24700) | Fetch Jetman_Y. | ||||||
| 41319 | ADD A,18 | Add 18. | ||||||
| 41321 | CP 175 | Jump to Handler_PickupAction_WriteY if that is still above the ground line. | ||||||
| 41323 | JR C,Handler_PickupAction_WriteY | |||||||
|
175 is the ground line.
|
||||||||
| 41325 | LD A,175 | A=175. | ||||||
| Handler_PickupAction_WriteY | 41327 | LD (IX+4),A | Write it as the object Y. | |||||
| 41330 | CALL TestActionKey | Jump to Handler_PickupAction_Throw if the action key is pressed. | ||||||
| 41333 | JR NZ,Handler_PickupAction_Throw | |||||||
| 41335 | RES 1,(IX+8) | Reset bit 1 of the actor flags. | ||||||
| 41339 | RET | Return. | ||||||
|
Throw the object on a second action press.
|
||||||||
| Handler_PickupAction_Throw | 41340 | BIT 1,(IX+8) | Return if bit 1 of the actor flags is set. | |||||
| 41344 | RET NZ | |||||||
| 41345 | RES 2,(IX+8) | Reset bit 2 of the actor flags. | ||||||
| 41349 | LD A,(24704) | Fetch Jetman_Flags. | ||||||
| 41352 | AND %11111110 | Reset bit 0. | ||||||
| 41354 | LD (24704),A | Write it back. | ||||||
| 41357 | SET 1,(IX+8) | Set bit 1 of the actor flags. | ||||||
| 41361 | SET 7,(IX+8) | Set bit 7 of the actor flags. | ||||||
|
Give the object Jetman's speed and play the drop sound.
|
||||||||
| 41365 | LD A,(24701) | Fetch Jetman_Speed. | ||||||
| 41368 | SRA A | Divide it by 16. | ||||||
| 41370 | SRA A | |||||||
| 41372 | SRA A | |||||||
| 41374 | SRA A | |||||||
| 41376 | LD (IX+5),A | Write it as the object speed. | ||||||
| 41379 | LD (IX+6),1 | Write 1 to the object thrust. | ||||||
| 41383 | JP SoundsDropItem | Jump to SoundsDropItem. | ||||||
| Prev: 41064 | Up: Map | Next: 41386 |