![]() |
Routines |
| Prev: 45028 | Up: Map | Next: 45082 |
|
Used by the routines at HandlerHippoWarthog, HandlerGuardian, HandlerWulf, HandlerTribesman, HandlerRhino, PlayerMovement and GamePlay_Start.
Works out the new position of an actor from its velocities. The velocities are signed and in units of one sixteenth of a pixel, so they are first scaled by GetWholePixels. The new position is returned in E and D and is not written to the actor record.
If the actor would move off the screen it is moved to the neighbouring room instead, using EnterRoomLeft (left), EnterRoomRight (right), EnterRoomBelow (below) or EnterRoomAbove (above). The top of the screen is at 40 the bottom at 192 and the width of the actor (held in Actor_Width) is taken into account at the right.
|
||||||||||||||
| MoveActor | 45032 | LD A,(IX+1) | Store the room of the actor in Moved_Actor_Room. | |||||||||||
| 45035 | LD (38571),A | |||||||||||||
| 45038 | LD D,(IX+4) | Fetch the Y position of the actor into D. | ||||||||||||
| 45041 | LD A,(IX+6) | Fetch the X velocity of the actor. | ||||||||||||
| 45044 | CALL GetWholePixels | Convert the X velocity to whole pixels. | ||||||||||||
| 45047 | AND A | Jump to MoveActorLeft if the actor is moving left. | ||||||||||||
| 45048 | JP M,MoveActorLeft | |||||||||||||
|
The actor is moving right.
|
||||||||||||||
| 45051 | ADD A,(IX+3) | Add the X position of the actor. | ||||||||||||
| 45054 | LD E,A | Stash the new X position in E. | ||||||||||||
| 45055 | LD A,(38573) | Fetch the width of the actor from Actor_Width. | ||||||||||||
| 45058 | ADD A,E | Add the new X position to find the right edge of the actor. | ||||||||||||
| 45059 | JP C,EnterRoomRight | Jump to EnterRoomRight if the actor has left the screen on the right. | ||||||||||||
|
This entry point is used by the routine at MoveActorLeft.
Now move the actor up or down.
|
||||||||||||||
| MoveActor_Vertical | 45062 | LD A,(IX+7) | Fetch the Y velocity of the actor. | |||||||||||
| 45065 | CALL GetWholePixels | Convert the Y velocity to whole pixels. | ||||||||||||
| 45068 | AND A | Jump to MoveActorUp if the actor is moving up. | ||||||||||||
| 45069 | JP M,MoveActorUp | |||||||||||||
| 45072 | ADD A,(IX+4) | Add the Y position of the actor. | ||||||||||||
| 45075 | LD D,A | Stash the new Y position in D. | ||||||||||||
| 45076 | CP 192 | Jump to EnterRoomBelow if the actor has left the screen at the bottom. | ||||||||||||
| 45078 | JP NC,EnterRoomBelow | |||||||||||||
| 45081 | RET | Return. | ||||||||||||
| Prev: 45028 | Up: Map | Next: 45082 |