Prev: F014 Up: Map Next: F0C7
F069: Script Routine: (05) Move entity down one character
Shift the current entity one character down.
Input
IX Address of complex state data for an entity
ScriptRoutine_MoveDown F069 LD A,(IX+$04) Load A with the current entity's room index.
F06C CP $04 Is A equal to 04? If not, jump to ScriptRoutine_MoveDown_AfterFloorExit.
F06E JR NZ,ScriptRoutine_MoveDown_AfterFloorExit
F070 LD HL,$B9AD Point HL at Berk's right-facing idle script (B9AD).
F073 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 F076 LD A,(IX+$06) Load A with the current entity's y-extent.
F079 CP $23 Is A less than 23? If so, jump to ScriptRoutine_MoveDown_IncY.
F07B JR C,ScriptRoutine_MoveDown_IncY
F07D INC (IX+$04) Advance this entity into the next room.
Move the entity (and any carried partner) one character down.
ScriptRoutine_MoveDown_IncY F080 INC (IX+$05) Move this entity one character down.
F083 INC (IX+$06)
F086 BIT 4,(IX+$03) Is bit 04 of flags byte 3 (IX+03) set? If not, jump to ScriptRoutine_MoveDown_CheckHoldingLock.
F08A JR Z,ScriptRoutine_MoveDown_CheckHoldingLock
F08C LD IY,($72AC) Load IY with the current-entity pointer (Pointer_CurrentEntity).
F090 CP $23 Is A less than 23? If so, jump to ScriptRoutine_MoveDown_IncHeldY.
F092 JR C,ScriptRoutine_MoveDown_IncHeldY
F094 INC (IY+$04) Increment the referenced entity's room index.
Move the carried entity one character down to match Berk.
ScriptRoutine_MoveDown_IncHeldY F097 INC (IY+$05) Move the referenced entity one character down.
F09A INC (IY+$06)
F09D JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
If a linked camera-follow partner is locked (bit 03), clear the lock and drop it too.
ScriptRoutine_MoveDown_CheckHoldingLock F0A0 BIT 3,(IX+$03) Is bit 03 of flags byte 3 (IX+03) set? If not, jump to AdvanceScriptInstruction.
F0A4 JP Z,AdvanceScriptInstruction
F0A7 RES 3,(IX+$03) Reset bit 03 of the current entity's flags byte 3.
F0AB LD IY,($90A7) Load IY from the camera-follow entity's extra-state pointer (90A7 = StateData_Berk+0C).
F0AF INC (IY+$05) Move the referenced entity one character down.
F0B2 INC (IY+$06)
F0B5 INC (IY+$04) Increment the referenced entity's room index.
This entry point is used by the routine at ScriptRoutine_MoveUp.
Clear the linked-entity pointer at 90A7 and queue movement sound 10.
ScriptRoutine_Move_ClearLinkedAndThud F0B8 LD BC,$0000 Clear BC ready to wipe the linked-entity pointer.
F0BB LD ($90A7),BC Clear the camera-follow entity's extra-state pointer at 90A7.
F0BF LD A,$10 Load A with 10.
F0C1 CALL Queue_Sound Call Queue_Sound to queue a sound effect.
F0C4 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
Prev: F014 Up: Map Next: F0C7