diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-04-07 16:25:11 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-04-07 16:25:11 -0400 |
| commit | 8c0dbef6b21a0331916ae96ea5cd3b5613e50b6b (patch) | |
| tree | bfbc487de4bc212c00f57e1ba38e08cccac6978d /src/game.cpp | |
| parent | 7b43a9b51d9df0bc0e18102415f877772031f440 (diff) | |
pke: temp load scene by file path
Diffstat (limited to 'src/game.cpp')
| -rw-r--r-- | src/game.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/game.cpp b/src/game.cpp index f5afa82..03ea495 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -149,10 +149,15 @@ void Game_Main(PKEWindowProperties windowProps, const char *executablePath) { // if we were passed only a scene name, create a faux level. if (!pkeSettings.args.levelName && pkeSettings.args.sceneName) { - pkeSettings.rt.nextLevel = PkeLevel_Create("faux-level")->levelHandle; - PkeLevel *lvl = PkeLevel_Get(pkeSettings.rt.nextLevel); + PkeLevel *lvl = PkeLevel_Create("faux-level"); + pkeSettings.rt.nextLevel = lvl->levelHandle; scene_instance si{}; - si.scene_handle = pke_scene_get_by_name(pkeSettings.args.sceneName)->scene_handle; + pke_scene *scn = pke_scene_get_by_path(pkeSettings.args.sceneName); + if (scn == nullptr) { + fprintf(stdout, "[Game_Main] Did not find scene by name: '%s'\n", pkeSettings.args.sceneName); + goto GAME_SHUTDOWN; + } + si.scene_handle = scn->scene_handle; pk_arr_append_t(&lvl->scene_instances, si); } @@ -281,6 +286,7 @@ void Game_Main(PKEWindowProperties windowProps, const char *executablePath) { } catch (...) { fprintf(stderr, "Game_Main UNHANDLED EXCEPTION\n"); } +GAME_SHUTDOWN: fprintf(stdout, "Game_Main SHUTDOWN INITIATED\n"); #ifndef NDEBUG pk_memory_debug_print(); |
