aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-02-16 01:17:42 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-02-16 01:17:42 +0100
commit7b00d8fb5fc3adc16938f608f490ad05b9aa76fd (patch)
tree8a44b8549823576016848326cd4c6744a9ac6a76
parente5cbec2ebf31c414b7fe21ccc85357aa5d8acf54 (diff)
Inline update_timers()
-rw-r--r--src/ahoy/main.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/ahoy/main.c b/src/ahoy/main.c
index a293fce..b7f0639 100644
--- a/src/ahoy/main.c
+++ b/src/ahoy/main.c
@@ -77,19 +77,6 @@ main(int argc, char **argv)
return EXIT_SUCCESS;
}
-static void
-update_timers(void)
-{
- if (c8.DT > 0)
- c8.DT--;
-
- if (c8.ST > 0) {
- c8.ST--;
- auplay(false);
- } else
- auplay(true);
-}
-
void
run(int fd, const char *fn)
{
@@ -136,14 +123,17 @@ run(int fd, const char *fn)
dt = (double)((et - st) * 1000) / SDL_GetPerformanceFrequency();
SDL_Delay(16.67f > dt ? 16.67f - dt : 0);
- // Update window with changes every 60hz
if (c8.needs_redraw)
windrw();
- // Update delay & sound timers every 60hz
- update_timers();
+ if (c8.DT > 0)
+ c8.DT--;
- emutick();
+ if (c8.ST > 0) {
+ c8.ST--;
+ auplay(false);
+ } else
+ auplay(true);
}
u8strfree(sb);