Prev: 38921 Up: Map Next: 39043
39018: Set Player Velocity
Used by the routine at EnterDoor.
Sets the velocities of the player (offsets 6 and 7) from bits 6-7 of the attribute of a door, using DoorVelocities. This is done by EnterDoor so that the player moves out of the door.
Input
IX The door entity
SetPlayerVelocity 39018 LD A,(IX+5) Fetch the attribute of the door.
39021 RLCA Rotate A left three times.
39022 RLCA
39023 RLCA
39024 AND %00000110 Keep only bits 1-2, which were bits 6-7.
39026 LD C,A Keep the velocity index in C.
39027 LD B,0 B=0.
39029 LD HL,39043 Point HL at the door velocities at DoorVelocities.
39032 ADD HL,BC Find the velocities for the door in the table.
39033 LD A,(HL) Fetch the X velocity.
39034 INC HL Move HL on to the next byte.
39035 LD (60054),A Update the X velocity of the player (offset 6).
39038 LD A,(HL) Fetch the Y velocity.
39039 LD (60055),A Update the Y velocity of the player (offset 7).
39042 RET Return.
Prev: 38921 Up: Map Next: 39043