![]() |
Routines |
| Prev: A068 | Up: Map | Next: A1AA |
|
Test the action key and drop or collect the current object.
|
||||||||
| Handler_PickupAction | A0F8 | CALL TestActionKey | Jump to Handler_PickupAction_TestRover if the action key is pressed. | |||||
| A0FB | JR NZ,Handler_PickupAction_TestRover | |||||||
| A0FD | RES 1,(IX+$08) | Reset bit 1 of the actor flags. | ||||||
| Handler_PickupAction_TestRover | A101 | LD A,($6090) | Fetch Rover_Slot. | |||||
| A104 | SUB $1A | Subtract 1A. | ||||||
| A106 | CP $10 | Jump to Handler_PickupAction_PickOffset if that is not a rover frame. | ||||||
| A108 | JR NC,Handler_PickupAction_PickOffset | |||||||
| A10A | CALL Handler_HeldObject_Loop | Call Handler_HeldObject_Loop. | ||||||
| A10D | JR Handler_PickupAction_TestAction | Jump to Handler_PickupAction_TestAction. | ||||||
|
Type 16 and above is seated facing right; hang the object on the left.
|
||||||||
| Handler_PickupAction_PickOffset | A10F | LD A,($6078) | Fetch Jetman_Slot. | |||||
| A112 | CP $16 | Jump to Handler_PickupAction_OnFootOffset if Jetman's type is less than 16. | ||||||
| A114 | JR C,Handler_PickupAction_OnFootOffset | |||||||
| A116 | LD BC,$FFF4 | Set the offset in BC to FFF4 (-0C). | ||||||
|
Place the object at Jetman's X plus the offset, then go to collect it.
|
||||||||
| Handler_PickupAction_Loop | A119 | LD HL,($607A) | Fetch Jetman_Position. | |||||
| A11C | CALL Handler_HeldObject_WriteX | Call Handler_HeldObject_WriteX. | ||||||
| A11F | JR Handler_PickupAction_Collect | Jump to Handler_PickupAction_Collect. | ||||||
| Handler_PickupAction_OnFootOffset | A121 | LD BC,$0012 | Set the offset in BC to 0012. | |||||
| A124 | JR Handler_PickupAction_Loop | Jump to Handler_PickupAction_Loop. | ||||||
|
Skip the collect test unless the action key is pressed.
|
||||||||
| Handler_PickupAction_TestAction | A126 | CALL TestActionKey | Call TestActionKey. | |||||
| A129 | 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 | A12C | LD A,($6080) | Fetch Jetman_Flags. | |||||
| A12F | AND %00000001 | Keep only bit 0. | ||||||
| A131 | JP NZ,Handler_Pickup_Teleport | Jump to Handler_Pickup_Teleport if Jetman is already carrying. | ||||||
| A134 | LD A,(IX+$08) | Fetch the actor flags. | ||||||
| A137 | AND %01110111 | Keep only bits 0-2 and 4-6. | ||||||
| A139 | 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.
|
||||||||
| A13C | CALL TestJetmanAction_ComparePosition | Call TestJetmanAction_ComparePosition. | ||||||
| A13F | 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.
|
||||||||
| A142 | BIT 3,(IX+$08) | Jump to Handler_PickupAction_SetCarrying if bit 3 of the actor flags is reset. | ||||||
| A146 | JR Z,Handler_PickupAction_SetCarrying | |||||||
| A148 | XOR A | Write 00 to RoverCargoFlag. | ||||||
| A149 | LD ($5EA3),A | |||||||
|
Mark Jetman as carrying the object and play the pickup sound.
|
||||||||
| Handler_PickupAction_SetCarrying | A14C | LD A,($6080) | Fetch Jetman_Flags. | |||||
| A14F | OR %00000001 | Set bit 0. | ||||||
| A151 | LD ($6080),A | Write it back. | ||||||
| A154 | LD (IX+$08),$06 | Write 06 to the actor flags. | ||||||
| A158 | JP SoundsTakeObject | Jump to SoundsTakeObject. | ||||||
|
Snap the object onto Jetman.
|
||||||||
| Handler_PickupAction_SnapToJetman | A15B | LD HL,($607A) | Fetch Jetman_Position. | |||||
| A15E | LD (IX+$02),L | Write the low byte as the object world X. | ||||||
| A161 | LD (IX+$03),H | Write the high byte. | ||||||
| A164 | LD A,($607C) | Fetch Jetman_Y. | ||||||
| A167 | ADD A,$12 | Add 12. | ||||||
| A169 | CP $AF | Jump to Handler_PickupAction_WriteY if that is still above the ground line. | ||||||
| A16B | JR C,Handler_PickupAction_WriteY | |||||||
|
AF is the ground line.
|
||||||||
| A16D | LD A,$AF | A=AF. | ||||||
| Handler_PickupAction_WriteY | A16F | LD (IX+$04),A | Write it as the object Y. | |||||
| A172 | CALL TestActionKey | Jump to Handler_PickupAction_Throw if the action key is pressed. | ||||||
| A175 | JR NZ,Handler_PickupAction_Throw | |||||||
| A177 | RES 1,(IX+$08) | Reset bit 1 of the actor flags. | ||||||
| A17B | RET | Return. | ||||||
|
Throw the object on a second action press.
|
||||||||
| Handler_PickupAction_Throw | A17C | BIT 1,(IX+$08) | Return if bit 1 of the actor flags is set. | |||||
| A180 | RET NZ | |||||||
| A181 | RES 2,(IX+$08) | Reset bit 2 of the actor flags. | ||||||
| A185 | LD A,($6080) | Fetch Jetman_Flags. | ||||||
| A188 | AND %11111110 | Reset bit 0. | ||||||
| A18A | LD ($6080),A | Write it back. | ||||||
| A18D | SET 1,(IX+$08) | Set bit 1 of the actor flags. | ||||||
| A191 | SET 7,(IX+$08) | Set bit 7 of the actor flags. | ||||||
|
Give the object Jetman's speed and play the drop sound.
|
||||||||
| A195 | LD A,($607D) | Fetch Jetman_Speed. | ||||||
| A198 | SRA A | Divide it by 10. | ||||||
| A19A | SRA A | |||||||
| A19C | SRA A | |||||||
| A19E | SRA A | |||||||
| A1A0 | LD (IX+$05),A | Write it as the object speed. | ||||||
| A1A3 | LD (IX+$06),$01 | Write 01 to the object thrust. | ||||||
| A1A7 | JP SoundsDropItem | Jump to SoundsDropItem. | ||||||
| Prev: A068 | Up: Map | Next: A1AA |