Prev: 61460 Up: Map Next: 61639
61545: Script Routine: (5) Move entity down one character
Shift the current entity one character down.
Input
IX Address of complex state data for an entity
ScriptRoutine_MoveDown 61545 LD A,(IX+4) Load A with the current entity's room index.
61548 CP 4 Is A equal to 4? If not, jump to ScriptRoutine_MoveDown_AfterFloorExit.
61550 JR NZ,ScriptRoutine_MoveDown_AfterFloorExit
61552 LD HL,47533 Point HL at Berk's right-facing idle script (47533).
61555 JP ScriptInstruction Jump to ScriptInstruction to execute the script instruction at HL.
Past the floor band: optionally advance one room, then move down.
ScriptRoutine_MoveDown_AfterFloorExit 61558 LD A,(IX+6) Load A with the current entity's y-extent.
61561 CP 35 Is A less than 35? If so, jump to ScriptRoutine_MoveDown_IncY.
61563 JR C,ScriptRoutine_MoveDown_IncY
61565 INC (IX+4) Advance this entity into the next room.
Move the entity (and any carried partner) one character down.
ScriptRoutine_MoveDown_IncY 61568 INC (IX+5) Move this entity one character down.
61571 INC (IX+6)
61574 BIT 4,(IX+3) Is bit 4 of flags byte 3 (IX+3) set? If not, jump to ScriptRoutine_MoveDown_CheckHoldingLock.
61578 JR Z,ScriptRoutine_MoveDown_CheckHoldingLock
61580 LD IY,(29356) Load IY with the current-entity pointer (Pointer_CurrentEntity).
61584 CP 35 Is A less than 35? If so, jump to ScriptRoutine_MoveDown_IncHeldY.
61586 JR C,ScriptRoutine_MoveDown_IncHeldY
61588 INC (IY+4) Increment the referenced entity's room index.
Move the carried entity one character down to match Berk.
ScriptRoutine_MoveDown_IncHeldY 61591 INC (IY+5) Move the referenced entity one character down.
61594 INC (IY+6)
61597 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 drop it too.
ScriptRoutine_MoveDown_CheckHoldingLock 61600 BIT 3,(IX+3) Is bit 3 of flags byte 3 (IX+3) set? If not, jump to AdvanceScriptInstruction.
61604 JP Z,AdvanceScriptInstruction
61607 RES 3,(IX+3) Reset bit 3 of the current entity's flags byte 3.
61611 LD IY,(37031) Load IY from the camera-follow entity's extra-state pointer (37031 = StateData_Berk+12).
61615 INC (IY+5) Move the referenced entity one character down.
61618 INC (IY+6)
61621 INC (IY+4) Increment the referenced entity's room index.
This entry point is used by the routine at ScriptRoutine_MoveUp.
Clear the linked-entity pointer at 37031 and queue movement sound 16.
ScriptRoutine_Move_ClearLinkedAndThud 61624 LD BC,0 Clear BC ready to wipe the linked-entity pointer.
61627 LD (37031),BC Clear the camera-follow entity's extra-state pointer at 37031.
61631 LD A,16 Load A with 16.
61633 CALL Queue_Sound Call Queue_Sound to queue a sound effect.
61636 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
Prev: 61460 Up: Map Next: 61639