Prev: B0E4 Up: Map Next: B16F
B115: Read the controls, and burn fuel for steering and thrust
Used by the routine at move_ship.
Reads the current player's control method (read_control_method) into controls_now, after three overrides: no thrust at the ceiling -- the view on y page 5 (page 0 with add-on 5) and view_y, the view's line within its page, below $60; only fire and the special key while the special beam is on (special_beam_on); and once the ship has docked with the finished rocket (launch_state set) nothing is read at all and move_ship flies the ship itself.
Then the fuel: 8 a pass while steering or thrusting, 16 while doing both at once, halved with add-on 6 and halved again if fuel_saver is set (by ship_contact when something knocks the ship sideways; cleared every pass in update_objects). It is added to the fuel word through add_fuel, which counts up towards empty.
Input
IX the ship's record
read_controls B115 CALL read_control_method C = the controls: bit 0 right, 1 left, 2 down, 3 up (thrust), 4 fire, 5 the special key
B118 LD B,$00 the ceiling: page 5, or 0 with add-on 5
B11A LD A,(addon_five)
B11D AND A
B11E JR NZ,read_controls_0
B120 LD B,$05
read_controls_0 B122 LD A,(view_row)
B125 CP B
B126 JR NZ,read_controls_1
B128 LD A,(view_y)
B12B CP $60
B12D JR NC,read_controls_1
B12F LD A,C
B130 AND $F7
B132 LD C,A
read_controls_1 B133 LD A,(special_beam_on) the special beam on: only fire and the special key
B136 AND A
B137 JR Z,read_controls_2
B139 LD A,C
B13A AND $30
B13C LD C,A
read_controls_2 B13D LD A,(launch_state) docked with the rocket: nothing
B140 AND A
B141 RET NZ
B142 LD A,C this pass's controls
B143 LD (controls_now),A
B146 AND $0B not steering or thrusting: no fuel burned
B148 RET Z
B149 LD DE,$0008 8, or 16 for thrust and steering together
B14C BIT 3,A
B14E JR Z,read_controls_3
B150 AND $03
B152 JR Z,read_controls_3
B154 LD DE,$0010
read_controls_3 B157 LD A,(addon_six) add-on 6: half
B15A AND A
B15B JR Z,read_controls_4
B15D SRA D
B15F RR E
read_controls_4 B161 LD A,(fuel_saver) knocked sideways this pass: half again; burn it
B164 AND A
B165 JP Z,add_fuel
B168 SRA D
B16A RR E
B16C JP add_fuel
Prev: B0E4 Up: Map Next: B16F