Prev: 9DE5 Up: Map Next: 9E98
9E07: Process player input
This first checks for reasons to not handle the player's input, such as the hero being in solitary, the 'game over' state of his morale being exhausted, or the hero being busy picking a lock or cutting through a wire fence. If none of those are the case we fetch the current player input into A. If the player's input is non-zero (ie. the player is pressing a button) we reset the automatic_player_counter and check for the hero being in bed, or at breakfast. If the hero was in bed, or at breakfast, we make him stand up, then update the scenery and refresh the screen. We then check for 'pick up', 'drop' and 'use' input events which are handled by process_player_input_fire. Finally assign the new input value to the hero's vischar then set the kick flag to make it update.
Used by the routine at main_loop.
Morale exhausted? If so then don't allow input.
process_player_input 9E07 LD HL,($A13A) Simultaneously load the in_solitary and morale_exhausted flags
9E0A XOR A Return if either is set. This inhibits the player's control
9E0B OR H
9E0C OR L
9E0D RET NZ
9E0E LD A,($8001) Is the hero is picking a lock, or cutting wire?
9E11 AND $03
9E13 JR Z,process_player_input_no_flags Jump if not
Hero is picking a lock, or cutting through a wire fence.
9E15 LD HL,$A139 Postpone automatic control for 31 turns of this routine
9E18 LD (HL),$1F
9E1A CP $01 Is the hero picking a lock?
9E1C JP Z,picking_lock Jump to picking_lock if so
9E1F JP cutting_wire Jump to cutting_wire otherwise
process_player_input_no_flags 9E22 CALL $F075 Call the input routine. Input is returned in A. (Note: The routine lives at same address as static_tiles_plot_direction)
9E25 LD HL,$A139 Take address of the automatic player counter
9E28 CP $00 Did the input routine return input_NONE? (zero)
9E2A JP NZ,process_player_input_received Jump if not
No user input was received: count down the automatic player counter
9E2D LD A,(HL) If the automatic player counter is zero then return
9E2E AND A
9E2F RET Z
9E30 DEC (HL) Decrement the automatic player counter
9E31 XOR A Set input to input_NONE
9E32 JR process_player_input_set_kick Jump to end bit
User input was received.
Postpone automatic control for 31 turns.
process_player_input_received 9E34 LD (HL),$1F Set the automatic player counter to 31
9E36 PUSH AF Bank input routine result
9E37 LD A,($A13F) Load hero in bed flag
9E3A AND A Is it zero?
9E3B JR NZ,process_player_input_in_bed Jump to 'hero was in bed' case if not
9E3D LD A,($A137) Load hero at breakfast flag
9E40 AND A Is it zero?
9E41 JR Z,process_player_input_check_fire Jump to 'not bed or breakfast' case if so
Hero was at breakfast: make him stand up
9E43 LD HL,$002B Set hero's route to 43, step 0
9E46 LD ($8002),HL
9E49 LD HL,$800F Set hero's (x,y) pos to (52,62)
9E4C LD (HL),$34
9E4E INC L
9E4F INC L
9E50 LD (HL),$3E
9E52 LD HL,$6F58 Set room definition 25's bench_G object to interiorobject_EMPTY_BENCH
9E55 LD (HL),$0D
9E57 LD HL,$A137 Point HL at hero at breakfast flag
9E5A JR process_player_input_common Jump to common part
Hero was in bed: make him get up
process_player_input_in_bed 9E5C LD HL,$012C Set hero's route to 44, step 1
9E5F LD ($8002),HL
9E62 LD HL,$2E2E Set hero's target (x,y) to (46,46)
9E65 LD ($8004),HL
9E68 LD H,$00 Set hero's (x,y) pos to (46,46)
9E6A LD ($800F),HL
9E6D LD ($8011),HL
9E70 LD A,$18 Set hero's height to 24
9E72 LD ($8013),A
9E75 LD HL,$6C61 Set room definition 2's bed object to interiorobject_EMPTY_BED
9E78 LD (HL),$09
9E7A LD HL,$A13F Point HL at hero in bed flag
process_player_input_common 9E7D LD (HL),$00 Clear the hero at breakfast / hero in bed flag
9E7F CALL setup_room Expand out the room definition for room_index
9E82 CALL plot_interior_tiles Render visible tiles array into the screen buffer
process_player_input_check_fire 9E85 POP AF Unbank input routine result
9E86 CP $09 Was fire pressed?
9E88 JR C,process_player_input_set_kick Jump if not
9E8A CALL process_player_input_fire Check for 'pick up', 'drop' and 'use' input events
9E8D LD A,$80 Set A to input_KICK ($80)
If input state has changed then kick a sprite update.
process_player_input_set_kick 9E8F LD HL,$800D Did the input state change from the hero's existing input?
9E92 CP (HL)
9E93 RET Z Return if not
9E94 OR $80 Kick a sprite update if it did
9E96 LD (HL),A
9E97 RET Return
Prev: 9DE5 Up: Map Next: 9E98