use floats for ctx.frame_number and ctx.random_seed

This commit is contained in:
veclavtalica
2025-01-10 02:20:21 +03:00
parent f3848d2d52
commit 951d9c76c8
4 changed files with 9 additions and 9 deletions

View File

@ -236,7 +236,7 @@ static void main_loop(void) {
preserve_persistent_ctx_fields();
ctx.frame_accumulator -= ctx.desired_frametime;
ctx.game.frame_number = (ctx.game.frame_number % ULLONG_MAX) + 1;
ctx.game.frame_number++;
ctx.game.initialization_needed = false;
}
}
@ -584,9 +584,9 @@ static bool initialize(void) {
/* random seeding */
/* SDL_GetPerformanceCounter returns some platform-dependent number. */
/* it should vary between game instances. i checked! random enough for me. */
ctx.game.random_seed = SDL_GetPerformanceCounter();
ctx.game.random_seed = (float)(SDL_GetPerformanceCounter() % 16777216);
srand((unsigned int)ctx.game.random_seed);
stbds_rand_seed(ctx.game.random_seed);
stbds_rand_seed((size_t)ctx.game.random_seed);
/* main loop machinery */
toml_datum_t datum_ticks_per_second = toml_int_in(engine, "ticks_per_second");