mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
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:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define __NT_EVENT_H__
|
||||
|
||||
extern void ntev_callback(agsevent_t *e);
|
||||
extern void ntev_main();
|
||||
|
||||
|
||||
#endif /* __NT_EVENT_H__ */
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user