Remove popupmenu_opened flag

With the blocking modal_run(), the game's main loop is frozen while a
menu is open, so the flag's input-suppression and VM-pause checks are
unreachable. Quit requested during a modal is now handled by closing the
modal and letting it propagate through the main loop.
This commit is contained in:
kichikuou
2026-06-28 13:27:39 +09:00
parent 6f631d073d
commit fb63d42ec1
9 changed files with 13 additions and 47 deletions
+1 -2
View File
@@ -56,8 +56,7 @@ static void InitGame() { /* 1 */
nact->msgout = ntmsg_add;
nact->ags.eventcb = ntev_callback;
nact->callback = ntev_main;
nt_gr_init();
ntmsg_init();
nt_sstr_init();
-15
View File
@@ -53,11 +53,6 @@ static void cb_waitkey_selection(agsevent_t *e) {
}
void ntev_callback(agsevent_t *e) {
// menu open中は無視
if (nact->popupmenu_opened) {
return;
}
if (e->type == AGSEVENT_KEY_PRESS && e->code == KEY_CTRL) {
night.waitskiplv = 2;
night.waitkey = e->code;
@@ -90,15 +85,5 @@ void ntev_callback(agsevent_t *e) {
default:
return;
}
}
/*
system35のメインループからで呼ばれるコールバック
*/
void ntev_main() {
// デフォルトのコールバックのうち、ここで必要なものだけ処理。
if (nact->popupmenu_opened) {
if (nact->is_quit) sys_exit(0);
}
}
-1
View File
@@ -2,7 +2,6 @@
#define __NT_EVENT_H__
extern void ntev_callback(agsevent_t *e);
extern void ntev_main();
#endif /* __NT_EVENT_H__ */
+10 -12
View File
@@ -55,19 +55,17 @@ static void ntmain(struct _scoadr inadr) {
while (!nact->is_quit && !is_yield_requested()) {
scheduler_on_command();
//SACT_DEBUG("%d:%x", sl_getPage(), sl_getIndex());
if (!nact->popupmenu_opened) {
exec_command();
if (sl_getPage() == inadr.page &&
sl_getIndex() == inadr.index) {
// ~E%05dからの戻り
if (nact->fnc_return_value == 0) {
return;
} else {
scono = nact->fnc_return_value;
}
curadr = scene2adr(scono);
sl_callFar2(curadr.page -1, curadr.index);
exec_command();
if (sl_getPage() == inadr.page &&
sl_getIndex() == inadr.index) {
// ~E%05dからの戻り
if (nact->fnc_return_value == 0) {
return;
} else {
scono = nact->fnc_return_value;
}
curadr = scene2adr(scono);
sl_callFar2(curadr.page -1, curadr.index);
}
nact->callback();
}
-5
View File
@@ -426,11 +426,6 @@ static void cb_waitkey_backlog(agsevent_t *e) {
X|SDL のイベントディスパッチャからくる最初の場所
*/
void spev_callback(agsevent_t *e) {
// menu open中は無視
if (nact->popupmenu_opened) {
return;
}
if (sact.waittype != KEYWAIT_BACKLOG) {
if (e->type == AGSEVENT_KEY_PRESS && e->code == KEY_CTRL) {
sact.waitskiplv = 2;
-6
View File
@@ -117,10 +117,4 @@ void spev_main() {
e.type = AGSEVENT_TIMER;
tevent_callback(&e);
// デフォルトのコールバックのうち、ここで必要なものだけ
// 処理。(VAコマンドcallbackはなし)
if (nact->popupmenu_opened) {
if (nact->is_quit) sys_exit(0);
}
}
+1 -4
View File
@@ -241,12 +241,10 @@ void modal_run(modal *m) {
assert(!event_custom_handler);
event_custom_handler = modal_event_trampoline;
nact->popupmenu_opened = true;
mu_Id prev_hash = 0;
bool open = true;
while (open) {
while (open && !nact->is_quit) {
event_get_key(); // pump SDL events -> trampoline -> m->handler -> microui
mu_begin(ctx);
@@ -263,7 +261,6 @@ void modal_run(modal *m) {
sys_wait_vsync(); // -> gfx_updateScreen() -> menu_render_overlay()
}
nact->popupmenu_opened = false;
event_custom_handler = NULL;
current_modal = NULL;
free(ctx);
+1 -1
View File
@@ -119,7 +119,7 @@ void nact_main() {
exec_command();
scheduler_on_command();
if (is_yield_requested() || nact->popupmenu_opened || dbg_trapped()) {
if (is_yield_requested() || dbg_trapped()) {
nact->callback(); // Async in emscripten
sys_getInputInfo();
scheduler_yield();
-1
View File
@@ -72,7 +72,6 @@ typedef struct {
void (*callback)(void); /* main の callback */
bool is_va_animation; /* VA command working */
bool is_cursor_animation; /* animation cursor working */
bool popupmenu_opened; /* popup menu が 開いているか */
CharacterEncoding encoding;
char *game_title_utf8;