Prev: C25E Up: Map Next: C2F6
C296: Move the robot
Used by the routine at PLAYER_LEGS.
Called by the legs (PLAYER_LEGS) every turn, with the top kept out of the collision scans. He steps forward -- 3 units the way he faces, plus any nudge a doorway has left (CALC_PLYR_DUV) -- while jumping, during the walk into a room, or when walk is held; but not on the turn a turn starts, when the legs have an in-between graphic (bit 3 set: 24-27). 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 copied to PLAYER_DZ, a fall faster than 2 a turn makes a sound pitched by the height (BEEP_BY_Z), and ADJ_FOR_OUT_OF_BOUNDS cuts the move short against the floor, the walls and the other objects. HANDLE_EXIT_SCREEN takes him out of the room if the move carries him through a doorway, and does not come back; otherwise the move is made (the second half of DEC_DZ_AND_UPDATE_UVZ). A move down that was stopped (bit 2 of +$0C) is a landing, and ends the jump. The U and V steps are then cleared; the Z step carries over as his speed.
While the scene after a game runs (GAME_OVER) the Z step is set to 2 every turn, which gravity brings back to 0: the robot hangs where he is. Knight Lore does the same while something floats into its cauldron.
This is Knight Lore's routine, the falling sound and the exit check included; Pentagram keeps neither. The turning legs (TURNING_LEGS) come in at MOVE_IF_WALKING and APPLY_GRAVITY, and LOOSE_VALVE, PUSHABLE and EXTRA_LIFE end their own updates at CLEAR_DUV.
Input
IX the legs' record
C the controls
MOVE_PLAYER C296 LD A,(GAME_OVER) The scene after a game: a Z step of 2, to hang still
C299 AND A
C29A JR Z,MOVE_PLAYER_0
C29C LD (IX+$0B),$02
MOVE_PLAYER_0 C2A0 BIT 3,(IX+$0C) Jumping: forward
C2A4 JR NZ,MOVE_PLAYER_1
C2A6 LD A,(IX+$0C) Walking into a room: forward
C2A9 AND $F0
C2AB JR NZ,MOVE_PLAYER_1
C2AD BIT 3,(IX+$00) An in-between graphic: a turn has just started, so no step
C2B1 JR NZ,APPLY_GRAVITY
This entry point is used by the routine at TURNING_LEGS.
MOVE_IF_WALKING C2B3 BIT 2,C Walk not held: no step
C2B5 JR Z,APPLY_GRAVITY
MOVE_PLAYER_1 C2B7 PUSH BC A step forward, the controls kept
C2B8 CALL CALC_PLYR_DUV
C2BB POP BC
This entry point is used by the routine at TURNING_LEGS.
APPLY_GRAVITY C2BC LD A,(IX+$0B) The Z step negative: falling, two off
C2BF AND A
C2C0 JP M,MOVE_PLAYER_2
C2C3 BIT 3,C Rising or level with jump held: one off
C2C5 JR NZ,MOVE_PLAYER_3
MOVE_PLAYER_2 C2C7 DEC A Gravity: two off, or one
MOVE_PLAYER_3 C2C8 DEC A
C2C9 LD (IX+$0B),A The new Z step, and a copy that says afterwards which way he was going
C2CC LD (PLAYER_DZ),A
C2CF ADD A,$02 Falling faster than 2: the falling sound, pitched by Z
C2D1 CALL M,BEEP_BY_Z
C2D4 CALL ADJ_FOR_OUT_OF_BOUNDS Cut the move short where it must be
C2D7 CALL HANDLE_EXIT_SCREEN Through a doorway: into the next room, and no return
C2DA CALL ADD_DUVZ U, V and Z plus the steps
C2DD BIT 2,(IX+$0C) Stopped while moving down?
C2E1 JR Z,CLEAR_DUV
C2E3 LD A,(PLAYER_DZ)
C2E6 AND A
C2E7 JP P,CLEAR_DUV
C2EA RES 3,(IX+$0C) Then landed: the jump is over
This entry point is used by the routines at LOOSE_VALVE, PUSHABLE and EXTRA_LIFE.
CLEAR_DUV C2EE XOR A The U and V steps are one turn's; the Z step carries over as the speed
C2EF LD (IX+$09),A
C2F2 LD (IX+$0A),A
C2F5 RET
Prev: C25E Up: Map Next: C2F6