Prev: 60300 Up: Map Next: 60499
60462: Advance HL To Next Script Instruction And Execute
Used by the routines at ScriptRoutine_AnimateTrapDoorBerk, Update_Berk_ReadControls, Berk_ReadControls_DownBranch, Berk_Interact_With_Entity, Berk_Pick_Up_Entity, Update_ThingUpstairs_Entity_State, ScriptRoutine_ThingUpstairsRaise, ScriptRoutine_ThingUpstairsResetRoom, ScriptRoutine_ThingUpstairsFillAttributes, ScriptRoutine_ThingUpstairsChase, Update_TaskTwoEntityState, ScriptRoutine_TaskTwoArmScriptFlags, ScriptRoutine_TaskTwoWalkVertical, ScriptRoutine_TaskTwoRiseOnEvent, ScriptRoutine_TaskTwoWalkRight, ScriptRoutine_TaskTwoWalkHorizontal, ScriptRoutine_TaskTwoSpawnHelper, Update_Task_Three_Entity_State, ScriptRoutine_TaskThreeQueueSound, ScriptRoutine_TaskThreeSeekBerk, ScriptRoutine_TaskThreeClearUpstairs, ScriptRoutine_TaskThreeBerkRightWindow, ScriptRoutine_SlimyDropAndHeat, ScriptRoutine_ArmCauldronFlags, Update_TaskFourEntityState, ScriptRoutine_TaskFourAlignCreature, ScriptRoutine_TaskFourRandomiseExtra, ScriptRoutine_TaskFourStepToward, ScriptRoutine_TaskFourArmScriptFlags, ScriptRoutine_TaskFourTickOfferItem, ScriptRoutine_TaskFourRaiseY, ScriptRoutine_TaskFourLowerY, ScriptRoutine_TaskFourBerkOverlap, Update_Vat, ScriptRoutine_VatQueueSound, ScriptRoutine_VatRoomTransition, ScriptRoutine_VatDecY, ScriptRoutine_VatIncY, ScriptRoutine_VatClearBit6AndReset, Collect_Entity, ScriptRoutine_CollectibleScanCounter, ScriptRoutine_CollectibleSetHeld, ScriptRoutine_CollectibleIncRoomTwice, ScriptRoutine_CollectibleIncXIfClearAbove, ScriptRoutine_CollectibleDecXIfClearLeft, ScriptRoutine_CollectibleLeaveRoomDown, ScriptRoutine_CollectibleLeaveRoomUp, ScriptRoutine_EndScriptLoop, ScriptRoutine_BerkDoorInFront, ScriptRoutine_BerkDoorBehind, ScriptRoutine_CloseTrapDoor, ScriptRoutine_OpenTrapDoor, ScriptRoutine_MoveHeldUpOneRoom, ScriptRoutine_StartLoop, ScriptRoutine_ResetDirectionFlags, ScriptRoutine_FaceRight, ScriptRoutine_FaceLeft, ScriptRoutine_FaceUp, ScriptRoutine_FaceDown, ScriptRoutine_JumpIfCarrying, ScriptRoutine_MoveLeft, ScriptRoutine_MoveRight, ScriptRoutine_MoveUp, ScriptRoutine_MoveDown, ScriptRoutine_MoveLeftTwo, ScriptRoutine_MoveRightTwo, ScriptRoutine_MoveDownTwo, ScriptRoutine_MoveUpTwo, ScriptRoutine_PutDownCarried, ScriptRoutine_PickUpHeld, ScriptRoutine_FaceLeftAfterPutDown, ScriptRoutine_FaceRightAfterPutDown, ScriptRoutine_PlacePutDownLeft, ScriptRoutine_PlacePutDownRight, ScriptRoutine_StartDruttScript and ScriptRoutine_ContinueToNextInstruction.
Advance the script pointer by two bytes and execute the instruction at HL. A zero high byte means a script opcode (dispatched via TableScriptHandlers); otherwise the word is a graphic layout address stored into the entity at IX.
Input
IX Address of complex state data for an entity
Output
HL Current position in script data
AdvanceScriptInstruction 60462 INC HL Advance HL to the next script instruction.
60463 INC HL
ScriptInstruction 60464 INC HL Advance HL to the next script byte.
60465 LD A,(HL) Load A from *HL.
60466 DEC HL Step HL back one byte in the current data stream.
60467 OR A Is A zero? If so, jump to ExecuteScript to dispatch the script opcode.
60468 JR Z,ExecuteScript
60470 LD (29391),HL Store HL in the active script cursor (Pointer_ActiveScriptCursor).
60473 LD A,(HL) Load A from *HL.
60474 LD (IX+10),A Set the current entity's graphic layout address (low).
60477 INC HL Advance HL to the next script byte.
60478 LD A,(HL) Load A from *HL.
60479 LD (IX+11),A Set the current entity's graphic layout address (high).
60482 RET Return.
Dispatch the script opcode in the low byte at HL via TableScriptHandlers.
ExecuteScript 60483 LD A,(HL) Load A from *HL.
60484 PUSH HL Stash HL on the stack.
60485 LD HL,60300 Point HL at the script handler table (TableScriptHandlers).
60488 ADD A,A Double A to form a word index into the script/handler table.
60489 LD C,A Keep the index in C.
60490 LD B,0 Load B with 0.
60492 ADD HL,BC HL+=BC.
60493 LD C,(HL) Fetch the word at HL into BC.
60494 INC HL
60495 LD B,(HL)
60496 POP HL Restore HL from the stack.
60497 PUSH BC Stash BC on the stack.
60498 RET Return.
Prev: 60300 Up: Map Next: 60499