Prev: 61361 Up: Map Next: 61545
61460: Script Routine: (4) Move entity up one character
Shift the current entity one character up.
Input
IX Address of complex state data for an entity
ScriptRoutine_MoveUp 61460 LD A,(IX+6) Load A with the current entity's y-extent.
61463 CP 27 Is A equal to 27? If not, jump to ScriptRoutine_MoveUp_AfterCeilingExit.
61465 JR NZ,ScriptRoutine_MoveUp_AfterCeilingExit
61467 LD HL,47565 Point HL at Berk's left-facing idle script (47565).
61470 JP ScriptInstruction Jump to ScriptInstruction to execute the script instruction at HL.
Past the ceiling band: optionally step back one room, then move up.
ScriptRoutine_MoveUp_AfterCeilingExit 61473 LD A,(IX+4) Load A with the current entity's room index.
61476 CP 0 Is A equal to 0? If so, jump to ScriptRoutine_MoveUp_DecY.
61478 JR Z,ScriptRoutine_MoveUp_DecY
61480 DEC (IX+4) Move this entity back one room.
Move the entity (and any carried partner) one character up.
ScriptRoutine_MoveUp_DecY 61483 DEC (IX+5) Move this entity one character up.
61486 DEC (IX+6)
61489 BIT 4,(IX+3) Is bit 4 of flags byte 3 (IX+3) set? If not, jump to ScriptRoutine_MoveUp_CheckHoldingLock.
61493 JR Z,ScriptRoutine_MoveUp_CheckHoldingLock
61495 LD IY,(29356) Load IY with the current-entity pointer (Pointer_CurrentEntity).
61499 CP 0 Is A equal to 0? If so, jump to ScriptRoutine_MoveUp_DecHeldY.
61501 JR Z,ScriptRoutine_MoveUp_DecHeldY
61503 DEC (IY+4) Decrease the referenced entity's room index.
Move the carried entity one character up to match Berk.
ScriptRoutine_MoveUp_DecHeldY 61506 DEC (IY+5) Move the referenced entity one character up.
61509 DEC (IY+6)
61512 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
If a linked camera-follow partner is locked (bit 3), clear the lock and lift it too.
ScriptRoutine_MoveUp_CheckHoldingLock 61515 BIT 3,(IX+3) Is bit 3 of flags byte 3 (IX+3) set? If not, jump to AdvanceScriptInstruction.
61519 JP Z,AdvanceScriptInstruction
61522 RES 3,(IX+3) Reset bit 3 of the current entity's flags byte 3.
61526 LD IY,(37031) Load IY from the camera-follow entity's extra-state pointer (37031 = StateData_Berk+12).
61530 CP 0 Is A equal to 0? If so, jump to ScriptRoutine_MoveUp_DecLinkedY.
61532 JR Z,ScriptRoutine_MoveUp_DecLinkedY
61534 DEC (IY+4) Decrease the referenced entity's room index.
Move the linked partner one character up, then clear its pointer and thud.
ScriptRoutine_MoveUp_DecLinkedY 61537 DEC (IY+5) Move the referenced entity one character up.
61540 DEC (IY+6)
61543 JR ScriptRoutine_Move_ClearLinkedAndThud Jump to ScriptRoutine_Move_ClearLinkedAndThud to continue this routine.
Prev: 61361 Up: Map Next: 61545