Prev: C1DA Up: Map Next: C22D
C1E2: The robot's legs while he turns (graphics 24 to 27)
The update routine (UPDATES) of the in-between views a quarter turn passes through. HANDLE_LEFT_RIGHT starts a turn by giving the legs one of them (TURN_RIGHT_VIEWS, TURN_LEFT_VIEWS) and a count of one in bits 1-2 of +$0D, with bit 0 set for a right turn. While the count runs this routine only lets the robot fall; once it has run out it gives the legs the standing graphic of the new facing (TURN_RIGHT_ENDS, TURN_LEFT_ENDS), with a sound. So the in-between view is on the screen for two turns, and a walking robot stands still for three: the turn a turn starts (MOVE_PLAYER takes no step with an in-between graphic), and these two (measured in the simulator: a left turn from facing 1 showed graphic 26 for two turns and then 17 mirrored, facing 2; with walk held through a right turn U did not change until the turn after the new facing).
Like the legs' own routine (PLAYER_LEGS) it reads the controls, gives the legs the whole robot's height, 23, and the top none while he moves, keeps the top out of the collision scans meanwhile, and ends in that routine's tail: heights 12 and 11, and a redraw. Unlike it, it does not look at the killed bit of +$0D, nor count down the walk into a room.
The finishing branch means to take a step if walk is held: it comes into MOVE_PLAYER at MOVE_IF_WALKING, which tests bit 2 of C. But the sound it makes first (FOOTSTEP, at the entry that skips the frame test) counts C down to zero, so the step is never taken and gravity takes its full two units whatever is held. HANDLE_FORWARD keeps BC around the same sound.
Input
IX the legs' record
TURNING_LEGS C1E2 CALL DRAW_AT_L16_D7 Drawn 16 left and 7 down
C1E5 LD (IX+$06),$17 While he moves, the legs' box is the whole robot's, 23 high, and the top has no height
C1E9 LD (IX+$26),$00
C1ED CALL READ_CONTROLS C = the controls
C1F0 LD A,(IX+$0D) The turn's count, bits 1-2 of +$0D, still running?
C1F3 AND $06
C1F5 JR Z,TURNING_LEGS_0
C1F7 LD A,(IX+$0D) Count it down
C1FA SUB $02
C1FC LD (IX+$0D),A
C1FF SET 1,(IX+$27) The top out of the scans; fall, without a step
C203 CALL APPLY_GRAVITY
C206 JR TURNING_LEGS_2
TURNING_LEGS_0 C208 BIT 0,(IX+$0D) Bit 0: a right turn ends from TURN_RIGHT_ENDS...
C20C JR Z,TURNING_LEGS_3
C20E LD HL,TURN_RIGHT_ENDS
TURNING_LEGS_1 C211 LD A,(IX+$00) ...the standing graphic and mirror bit of the new facing, by the in-between graphic's low two bits
C214 CALL SET_TURN_GRAPHIC
C217 CALL FOOTSTEP_NOW The turn's sound; it leaves C at zero
C21A SET 1,(IX+$27) The top out of the scans; a step if walk is held (never, C being zero), then fall
C21E CALL MOVE_IF_WALKING
TURNING_LEGS_2 C221 RES 1,(IX+$27) The top back in the scans; heights 12 and 11 and the redraw, in the tail of PLAYER_LEGS
C225 JP PLAYER_LEGS_DONE
TURNING_LEGS_3 C228 LD HL,TURN_LEFT_ENDS A left turn ends from TURN_LEFT_ENDS
C22B JR TURNING_LEGS_1
Prev: C1DA Up: Map Next: C22D