Prev: EFB0 Up: Map Next: F014
EFB1: Script Routine: (03) Move entity right one character
Shift the current entity one character right.
Input
IX Address of complex state data for an entity
ScriptRoutine_MoveRight EFB1 INC (IX+$07) Move this entity one character right.
EFB4 INC (IX+$08)
EFB7 BIT 4,(IX+$03) Is bit 04 of flags byte 3 (IX+03) set? If not, jump to Script_MoveRight_TestBit3.
EFBB JR Z,Script_MoveRight_TestBit3
EFBD LD IY,($72AC) Load IY with the current-entity pointer (Pointer_CurrentEntity).
EFC1 INC (IY+$07) Move the referenced entity one character right.
EFC4 INC (IY+$08)
EFC7 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
If the entity is locked to a linked partner (bit 03), scan collisions with code 81.
Script_MoveRight_TestBit3 EFCA BIT 3,(IX+$03) Is bit 03 of flags byte 3 (IX+03) set? If not, jump to AdvanceScriptInstruction.
EFCE JP Z,AdvanceScriptInstruction
EFD1 LD A,$81 Load A with 81.
This entry point is used by the routine at ScriptRoutine_MoveLeft.
Remember the push direction in Flag_ScriptPushDirection and walk complex entities for a type-32 hitch.
Script_MoveHorizontal_ScanCollisions EFD3 LD ($EFB0),A Set Flag_ScriptPushDirection.
EFD6 PUSH IX Stash IX and DE on the stack.
EFD8 PUSH DE
EFD9 LD DE,$000E Load DE with 000E.
EFDC LD IX,$8EE9 Point IX at Boney's complex entity state (StateData_Boney).
Scan complex entities; stop when type 32 is reached.
Script_PushHitch_ScanSceneryBlock EFE0 LD A,(IX+$00) Fetch the current entity's type for the type test.
EFE3 CP $32 Is A equal to 32? If not, jump to Script_PushHitch_Shove.
EFE5 JR NZ,Script_PushHitch_Shove
EFE7 POP DE Restore DE and IX from the stack.
EFE8 POP IX
EFEA JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
On a matching push-direction hitch, shove it left or right and play the movement click.
Script_PushHitch_Shove EFED LD A,($EFB0) Load A from Flag_ScriptPushDirection.
EFF0 CP (IX+$09) Does A match this entity's direction/state? If not, jump to Script_PushHitch_NextEntity.
EFF3 JR NZ,Script_PushHitch_NextEntity
EFF5 LD (IX+$09),$00 Write 00 to the current entity's direction / state.
EFF9 CP $82 Is A equal to 82? If so, jump to Script_PushHitch_ShoveLeft.
EFFB JR Z,Script_PushHitch_ShoveLeft
EFFD INC (IX+$07) Move this entity one character right.
F000 INC (IX+$08)
F003 JR Script_PushHitch_Click Jump to Script_PushHitch_Click to continue this routine.
Shove the hitch one character left (push-left path).
Script_PushHitch_ShoveLeft F005 DEC (IX+$07) Move this entity one character left.
F008 DEC (IX+$08)
Script_PushHitch_Click F00B LD A,$10 Load A with 10.
F00D CALL Queue_Sound Call Queue_Sound to queue a sound effect.
Advance to the next complex entity in the horizontal-push scan.
Script_PushHitch_NextEntity F010 ADD IX,DE IX+=DE.
F012 JR Script_PushHitch_ScanSceneryBlock Jump to Script_PushHitch_ScanSceneryBlock to continue this routine.
View the equivalent code in;
Prev: EFB0 Up: Map Next: F014