rage1
rage1 copied to clipboard
game_state: add user-controlled in-game timers
Allow definition of game timers:
- 16 bit counters
- They count seconds
- They have a name (for DATAGEN)
- They can be RESET, STARTed and STOPped
- They can be checked (FLOW checks)
- They can be acted upon (FLOW actions)
- There is always at least one global game timer (GAME_TIME) - This is to be implemented separately in #98
- Not managed by IM2 ISR, but from the main game loop - check for current_time.seconds changes
Tasks:
- [ ] New data
struct timer_data_s
: counter, state and initial state (running, stopped) - [ ] New global table
all_timers
- [ ] New functions:
timer_init
(called at program initialization),timer_reset
(called on game initialization and in FLOW action),timer_start
(called at game start and in flow action),timer_stop
(called in flow action),timer_update_all_timers
(called from main game loop),timer_reset_all_timers
(called on game initialization) - [ ] FLOW checks: TIMER_EQUAL, TIMER_MORE_THAN, TIMER_LESS_THAN
- [ ] FLOW actions: TIMER_STOP, TIMER_START, TIMER_RESET
- [ ] DATAGEN: directive for TIMER in GAME_CONFIG: name, initial_state