From ffb24fc06f1eae9de5c3e0172790a319f3afa676 Mon Sep 17 00:00:00 2001 From: erysdren Date: Sun, 13 Oct 2024 10:10:43 -0500 Subject: [PATCH] sdl3: improve cmdline map selection logic --- platform/sdl3/main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/platform/sdl3/main.c b/platform/sdl3/main.c index 9dd6562..136a6a5 100644 --- a/platform/sdl3/main.c +++ b/platform/sdl3/main.c @@ -22,7 +22,7 @@ static bool focused = true; static Sint64 now = 0, then = 0; -static int requested_map = 0; +static int requested_map = -1; static void die(const char *fmt, ...) { @@ -87,14 +87,15 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) /* get requested map */ if (argc > 1) + { requested_map = SDL_atoi(argv[1]); - - SDL_Log("Loading map %d", requested_map); - - if (requested_map >= 0) + SDL_Log("Loading map %d", requested_map); game_load_map(&yeti, maps[requested_map]); + } else + { game_load_map(&yeti, &map_e1m1); + } game_goto(&yeti.game, GAME_MODE_PLAY);