Routines |
Prev: 9D78 | Up: Map | Next: 9DCF |
This is the main game loop.
Unlike in higher-level languages The Great Escape's calling convention is not always strictly hierarchical. At points in the game where a reset or transition is required (see transition, enter_room) the game will "give up" and call squash_stack_goto_main. It will reset the stack pointer and jump to this main loop.
Used by the routine at squash_stack_goto_main.
|
||||
main_loop | 9D7B | CALL check_morale | Check morale level, report if (near) zero and inhibit player control if exhausted | |
9D7E | CALL keyscan_break | Check for a BREAK keypress | ||
9D81 | CALL message_display | Incrementally wipe and display queued game messages | ||
9D84 | CALL process_player_input | Process player input | ||
9D87 | CALL in_permitted_area | Check the hero's map position and colour the flag accordingly | ||
9D8A | CALL restore_tiles | Paint any tiles occupied by visible characters with tiles from tile_buf | ||
9D8D | CALL move_a_character | Move a character around | ||
9D90 | CALL automatics | Make characters follow the hero if he's being suspicious | ||
9D93 | CALL purge_invisible_characters | Run through all visible characters, resetting them if they're off-screen | ||
9D96 | CALL spawn_characters | Spawn characters | ||
9D99 | CALL mark_nearby_items | Mark nearby items | ||
9D9C | CALL ring_bell | Ring the alarm bell (1) | ||
9D9F | CALL animate | Animate all visible characters | ||
9DA2 | CALL move_map | Move the map when the hero walks | ||
9DA5 | CALL message_display | Incrementally wipe and display queued game messages | ||
9DA8 | CALL ring_bell | Ring the alarm bell (2) | ||
9DAB | CALL plot_sprites | Plot vischars and items in order | ||
9DAE | CALL plot_game_window | Plot the game screen | ||
9DB1 | CALL ring_bell | Ring the alarm bell (3) | ||
9DB4 | LD A,($A146) | If the night-time flag is set, turns white screen elements light blue and tracks the hero with a searchlight | ||
9DB7 | AND A | |||
9DB8 | CALL NZ,nighttime | |||
9DBB | LD A,($68A0) | If the global current room index is non-zero then slow the game down with a delay loop | ||
9DBE | AND A | |||
9DBF | CALL NZ,interior_delay_loop | |||
9DC2 | CALL wave_morale_flag | Wave the morale flag | ||
9DC5 | LD A,($A12F) | Dispatch a timed event event once every 64 ticks of the game counter | ||
9DC8 | AND $3F | |||
9DCA | CALL Z,dispatch_timed_event | |||
9DCD | JR main_loop | ...loop forever |
Prev: 9D78 | Up: Map | Next: 9DCF |