Fix level-select dropdown loading into game instead of editor #17
14
src/main.c
14
src/main.c
@@ -440,6 +440,18 @@ static void game_update(float dt) {
|
|||||||
/* Handle deferred level load from JS shell dropdown. */
|
/* Handle deferred level load from JS shell dropdown. */
|
||||||
if (s_js_load_request && s_js_load_path[0]) {
|
if (s_js_load_request && s_js_load_path[0]) {
|
||||||
s_js_load_request = 0;
|
s_js_load_request = 0;
|
||||||
|
|
||||||
|
if (s_mode == MODE_EDITOR) {
|
||||||
|
/* Load the selected level into the editor, not gameplay. */
|
||||||
|
if (!editor_load(&s_editor, s_js_load_path)) {
|
||||||
|
fprintf(stderr, "Failed to load level in editor: %s\n",
|
||||||
|
s_js_load_path);
|
||||||
|
}
|
||||||
|
snprintf(s_edit_path, sizeof(s_edit_path), "%s", s_js_load_path);
|
||||||
|
s_js_load_path[0] = '\0';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
end_session("quit");
|
end_session("quit");
|
||||||
|
|
||||||
/* Tear down whatever mode we are in. */
|
/* Tear down whatever mode we are in. */
|
||||||
@@ -447,8 +459,6 @@ static void game_update(float dt) {
|
|||||||
|| s_mode == MODE_TRANSITION) {
|
|| s_mode == MODE_TRANSITION) {
|
||||||
transition_reset(&s_transition);
|
transition_reset(&s_transition);
|
||||||
level_free(&s_level);
|
level_free(&s_level);
|
||||||
} else if (s_mode == MODE_EDITOR) {
|
|
||||||
editor_free(&s_editor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s_mode = MODE_PLAY;
|
s_mode = MODE_PLAY;
|
||||||
|
|||||||
Reference in New Issue
Block a user