Prev: 61360 Up: Map Next: 61460
61361: Script Routine: (3) Move entity right one character
Shift the current entity one character right.
Input
IX Address of complex state data for an entity
ScriptRoutine_MoveRight 61361 INC (IX+7) Move this entity one character right.
61364 INC (IX+8)
61367 BIT 4,(IX+3) Is bit 4 of flags byte 3 (IX+3) set? If not, jump to Script_MoveRight_TestBit3.
61371 JR Z,Script_MoveRight_TestBit3
61373 LD IY,(29356) Load IY with the current-entity pointer (Pointer_CurrentEntity).
61377 INC (IY+7) Move the referenced entity one character right.
61380 INC (IY+8)
61383 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
If the entity is locked to a linked partner (bit 3), scan collisions with code 129.
Script_MoveRight_TestBit3 61386 BIT 3,(IX+3) Is bit 3 of flags byte 3 (IX+3) set? If not, jump to AdvanceScriptInstruction.
61390 JP Z,AdvanceScriptInstruction
61393 LD A,129 Load A with 129.
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-50 hitch.
Script_MoveHorizontal_ScanCollisions 61395 LD (61360),A Set Flag_ScriptPushDirection.
61398 PUSH IX Stash IX and DE on the stack.
61400 PUSH DE
61401 LD DE,14 Load DE with 0014.
61404 LD IX,36585 Point IX at Boney's complex entity state (StateData_Boney).
Scan complex entities; stop when type 50 is reached.
Script_PushHitch_ScanSceneryBlock 61408 LD A,(IX+0) Fetch the current entity's type for the type test.
61411 CP 50 Is A equal to 50? If not, jump to Script_PushHitch_Shove.
61413 JR NZ,Script_PushHitch_Shove
61415 POP DE Restore DE and IX from the stack.
61416 POP IX
61418 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 61421 LD A,(61360) Load A from Flag_ScriptPushDirection.
61424 CP (IX+9) Does A match this entity's direction/state? If not, jump to Script_PushHitch_NextEntity.
61427 JR NZ,Script_PushHitch_NextEntity
61429 LD (IX+9),0 Write 0 to the current entity's direction / state.
61433 CP 130 Is A equal to 130? If so, jump to Script_PushHitch_ShoveLeft.
61435 JR Z,Script_PushHitch_ShoveLeft
61437 INC (IX+7) Move this entity one character right.
61440 INC (IX+8)
61443 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 61445 DEC (IX+7) Move this entity one character left.
61448 DEC (IX+8)
Script_PushHitch_Click 61451 LD A,16 Load A with 16.
61453 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 61456 ADD IX,DE IX+=DE.
61458 JR Script_PushHitch_ScanSceneryBlock Jump to Script_PushHitch_ScanSceneryBlock to continue this routine.
View the equivalent code in;
Prev: 61360 Up: Map Next: 61460