From d61ce9a18e76eb33ad3a8042e9a2d1ae3576be64 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sun, 24 Jan 2021 11:43:23 +0900 Subject: [PATCH] SACT/NIGHTDLL: Check nact->is_quit flag in wait loops --- modules/NIGHTDLL/nt_msg.c | 2 +- modules/SACT/SACT.c | 4 ++-- modules/SACT/sactsound.c | 2 +- modules/SACT/sprite_keywait.c | 2 +- modules/SACT/sprite_msg.c | 2 +- modules/SACT/sprite_sel.c | 2 ++ 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/NIGHTDLL/nt_msg.c b/modules/NIGHTDLL/nt_msg.c index 1f4ab0f..1610628 100644 --- a/modules/NIGHTDLL/nt_msg.c +++ b/modules/NIGHTDLL/nt_msg.c @@ -312,7 +312,7 @@ static int ntmsg_keywait() { night.waittype = KEYWAIT_MESSAGE; night.waitkey = -1; - while (night.waitkey == -1) { + while (night.waitkey == -1 && !nact->is_quit) { int st = get_high_counter(SYSTEMCOUNTER_MSEC); int interval = 25; diff --git a/modules/SACT/SACT.c b/modules/SACT/SACT.c index 27b504d..057c4aa 100644 --- a/modules/SACT/SACT.c +++ b/modules/SACT/SACT.c @@ -1012,7 +1012,7 @@ static void WaitKeySimple() { sact.waittype = KEYWAIT_SIMPLE; sact.waitkey = -1; - while(sact.waitkey == -1) { + while (sact.waitkey == -1 && !nact->is_quit) { sys_keywait(25, KEYWAIT_CANCELABLE); } @@ -1587,7 +1587,7 @@ static void TimerWait() { int wTimerID = getCaliValue(); int wCount = getCaliValue(); - while(wCount > stimer_get(wTimerID)) { + while (wCount > stimer_get(wTimerID) && !nact->is_quit) { sys_keywait(10, KEYWAIT_NONCANCELABLE); } diff --git a/modules/SACT/sactsound.c b/modules/SACT/sactsound.c index 8cc1824..35925a4 100644 --- a/modules/SACT/sactsound.c +++ b/modules/SACT/sactsound.c @@ -135,7 +135,7 @@ int ssnd_waitkey(int no, int *res) { sact.waittype = KEYWAIT_SIMPLE; sact.waitkey = -1; - while(sact.waitkey == -1 && mus_wav_get_playposition(slot)) { + while (sact.waitkey == -1 && mus_wav_get_playposition(slot) && !nact->is_quit) { sys_keywait(25, KEYWAIT_CANCELABLE); } diff --git a/modules/SACT/sprite_keywait.c b/modules/SACT/sprite_keywait.c index 54bb709..3bc1325 100644 --- a/modules/SACT/sprite_keywait.c +++ b/modules/SACT/sprite_keywait.c @@ -150,7 +150,7 @@ int sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeout endtime = timeout < 0 ? INT_MAX : (curtime + timeout * 10); // スプライトキー待ちメイン - while (!waitcond(endtime)) { + while (!waitcond(endtime) && !nact->is_quit) { sys_keywait(25, KEYWAIT_CANCELABLE); } diff --git a/modules/SACT/sprite_msg.c b/modules/SACT/sprite_msg.c index 7e7bfc3..9056f48 100644 --- a/modules/SACT/sprite_msg.c +++ b/modules/SACT/sprite_msg.c @@ -403,7 +403,7 @@ int smsg_keywait(int wNum1, int wNum2, int msglen) { sact.waittype = KEYWAIT_MESSAGE; sact.waitkey = -1; - while (sact.waitkey == -1) { + while (sact.waitkey == -1 && !nact->is_quit) { int st = get_high_counter(SYSTEMCOUNTER_MSEC); int interval = 25; diff --git a/modules/SACT/sprite_sel.c b/modules/SACT/sprite_sel.c index 4a6b4c5..5af1eb7 100644 --- a/modules/SACT/sprite_sel.c +++ b/modules/SACT/sprite_sel.c @@ -238,6 +238,8 @@ static int sel_main() { while(selected_item == -1) { sys_keywait(25, KEYWAIT_CANCELABLE); + if (nact->is_quit) + selected_item = 0; } sact.waittype = KEYWAIT_NONE;