Prev: C5D3 Up: Map Next: C66A
C61D: Move the player
Used by the routine at PLAYER_LEGS.
The player steps forward when walk is held, and also without it during a jump and during the walk into a room: 3 units in the way he faces, plus any nudge an arch has left him (CALC_PLYR_DUV). Then gravity: 2 off the Z step every turn, or 1 while he is still rising (or level) with jump held, so that holding jump jumps higher. The Z step is kept in Z_STEP before ADJ_FOR_OUT_OF_BOUNDS cuts the move short against the floor, the walls and the other objects, and then the move is made. A move down that was stopped (bit 2 of +$0C) is a landing, and ends the jump.
Knight Lore's routine is the same with two calls taken out: the falling sound (the ADD A,2 before the collision code is its test, and nothing reads it now) and the check for walking out of the room, which here is an empty routine (EXIT_STUB) because Pentagram's arches do that themselves (HANDLE_EXIT_SCREEN).
Input
IX The player's legs
C The controls
MOVE_PLAYER C61D BIT 3,(IX+$0C) Jumping: forward
C621 JR NZ,MOVE_PLAYER_0
C623 LD A,(IX+$0C) Walking into a room: forward
C626 AND $F0
C628 JR NZ,MOVE_PLAYER_0
C62A BIT 2,C Walk not held: no step
C62C JR Z,MOVE_PLAYER_1
MOVE_PLAYER_0 C62E PUSH BC A step forward, the controls kept
C62F CALL CALC_PLYR_DUV
C632 POP BC
MOVE_PLAYER_1 C633 LD A,(IX+$0B) Z step negative: falling, two off
C636 AND A
C637 JP M,MOVE_PLAYER_2
C63A BIT 3,C Rising or level with jump held: one off
C63C JR NZ,MOVE_PLAYER_3
MOVE_PLAYER_2 C63E DEC A Gravity: two off, or one
MOVE_PLAYER_3 C63F DEC A
C640 LD (IX+$0B),A The new Z step, and a copy that says afterwards which way he was going
C643 LD (Z_STEP),A
C646 ADD A,$02 Left over from Knight Lore's falling sound: nothing reads A
C648 CALL ADJ_FOR_OUT_OF_BOUNDS Cut the move short where it must be
C64B CALL EXIT_STUB Knight Lore's exit check, now a RET
C64E CALL ADD_DUVZ U, V and Z plus the steps
C651 BIT 2,(IX+$0C) Stopped while moving down?
C655 JR Z,MOVE_PLAYER_4
C657 LD A,(Z_STEP)
C65A AND A
C65B JP P,MOVE_PLAYER_4
C65E RES 3,(IX+$0C) Then landed: the jump is over
MOVE_PLAYER_4 C662 XOR A The U and V steps are one turn's; the Z step carries over as the speed
C663 LD (IX+$09),A
C666 LD (IX+$0A),A
C669 RET
Prev: C5D3 Up: Map Next: C66A