Prev: A39C Up: Map Next: A3FF
A3C1: Place Carried Item
Used by the routine at Handler_WorldObject.
On action, snap the object to the ground using the terrain under Jetman.
Input
IX Actor slot
On action, snap the object to the ground under Jetman.
PlaceCarriedItem A3C1 CALL TestActionKey Call TestActionKey.
A3C4 JR Z,PlaceCarriedItem_Facing Jump to PlaceCarriedItem_Facing if the action key is not pressed.
A3C6 BIT 1,(IX+$08) Jump to PlaceCarriedItem_Facing if bit 1 of the actor flags is set.
A3CA JR NZ,PlaceCarriedItem_Facing
A3CC CALL ReadTerrainCell Call ReadTerrainCell.
A3CF LD A,D Fetch the first terrain byte under the object.
A3D0 AND A Jump to ReleaseCarriedItem if that cell is not empty.
A3D1 JR NZ,ReleaseCarriedItem
Bit 2 of Jetman's 0-based sprite index is facing. Copy that into bit 3 of this object.
PlaceCarriedItem_Facing A3D3 LD A,($6078) Fetch Jetman_Slot.
A3D6 DEC A Decrease it to a 0-based sprite index.
A3D7 AND %00000100 Keep only the facing bit.
A3D9 JR NZ,PlaceCarriedItem_SetBit3 Jump to PlaceCarriedItem_SetBit3 if Jetman is facing right.
A3DB RES 3,(IX+$00) Reset bit 3 of the actor type.
Place the object at Jetman's X, just below his Y.
PlaceCarriedItem_Loop A3DF LD HL,($607A) Fetch Jetman_Position.
A3E2 LD (IX+$02),L Write the low byte as the object world X.
A3E5 LD (IX+$03),H Write the high byte.
A3E8 LD A,($607C) Fetch Jetman_Y.
A3EB ADD A,$08 Add 08.
A3ED CP $AF Jump to PlaceCarriedItem_WriteY if that is still above the ground line.
A3EF JR C,PlaceCarriedItem_WriteY
AF is the ground line.
A3F1 LD A,$AF A=AF.
PlaceCarriedItem_WriteY A3F3 LD (IX+$04),A Write it as the object Y.
A3F6 JP Handler_WorldObject_Loop Jump to Handler_WorldObject_Loop.
PlaceCarriedItem_SetBit3 A3F9 SET 3,(IX+$00) Set bit 3 of the actor type.
A3FD JR PlaceCarriedItem_Loop Jump to PlaceCarriedItem_Loop.
Prev: A39C Up: Map Next: A3FF