Prev: F0E3 Up: Map Next: F166
F13E: Script Routine: (14) Have entity pick up / restore held entity state
Make the entity pick up / restore the held-entity state.
Input
IX Address of complex state data for an entity
ScriptRoutine_PickUpHeld F13E RES 4,(IX+$03) Reset bit 04 of the current entity's flags byte 3.
F142 LD A,($72EE) Load A with the saved held-entity height from CameraXCoordinate.
F145 LD C,A Keep the camera origin X in C.
F146 LD A,($72E9) Load A with the held-entity y-extent (HeldEntityYExtent).
F149 OR A Is the held-entity y-extent (HeldEntityYExtent) zero? If not, jump to ScriptRoutine_PickUpHeld_ApplyHeldY.
F14A JR NZ,ScriptRoutine_PickUpHeld_ApplyHeldY
F14C LD A,(IX+$06) Load A with the current entity's y-extent.
F14F DEC A Decrease A by one.
Snap the held entity back under Berk using height CameraXCoordinate and clear bit 05.
ScriptRoutine_PickUpHeld_ApplyHeldY F150 LD IY,($72AC) Load IY with the current-entity pointer (Pointer_CurrentEntity).
F154 RES 5,(IY+$01) Reset bit 05 of the referenced entity's flags byte 1.
F158 LD (IY+$06),A Set the referenced entity's y-extent.
F15B SUB C Subtract C from A.
F15C LD (IY+$05),A Set the referenced entity's y-coordinate.
F15F XOR A Clear A to 00.
F160 LD ($72E9),A Set the held-entity y-extent (HeldEntityYExtent).
F163 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
Prev: F0E3 Up: Map Next: F166