Prev: C89D Up: Map Next: C8BE
C89F: Turn the player
Used by the routine at player_controls.
Two control schemes. Rotational control, the only one the keyboard has, uses left and right to turn a quarter at a time: see left_right_rotational. Directional control, which a joystick gets when option 5 on the menu is on (bit 3 of $5BA4), treats the stick as four compass points: pushing one turns the player towards it and, once facing it, walks that way.
In directional mode nothing happens during the room-entry walk or in the air -- bit 2 of +$0C, set by the collision code when a downward move is stopped, is what "standing on something" means here. Otherwise the stick is read in the order up (unless left is also held), right, down, left.
Input
C the controls: bit 0 left, 1 right, 2 up, 3 jump, 4 down
C on exit, bit 2 set if the player should walk forward
handle_left_right C89F LD HL,$5BA4 bits 1-2 of $5BA4 are the control method; 0, the keyboard, is always rotational
C8A2 LD A,(HL)
C8A3 AND $06
C8A5 JR Z,left_right_rotational
C8A7 BIT 3,(HL) directional control switched off
C8A9 JR Z,left_right_rotational
C8AB LD A,(IX+$0C) not during the room-entry walk
C8AE AND $F0
C8B0 RET NZ
C8B1 BIT 2,(IX+$0C) not in the air
C8B5 RET Z
C8B6 BIT 0,C left pressed: skip the test for up; up: face N
C8B8 JR NZ,directional_pick
C8BA BIT 2,C
C8BC JR NZ,chk_facing_N
Prev: C89D Up: Map Next: C8BE