mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-09-29 18:38:13 +03:00
Merge upstream changes: Prevent menu selection when cursor is out of window
This was introduced in System3-sdl2 71728db only for nact_sys3. TOTO took
this change and expanded for nact_sys1 and nact_sys2 as well.
This commit is contained in:
+18
-6
@@ -352,7 +352,7 @@ void NACT_Sys1::cmd_open_menu()
|
||||
set_cursor(mx, my);
|
||||
|
||||
// メニュー選択
|
||||
for(;;) {
|
||||
for(bool selectable = true;;) {
|
||||
// 入力待機
|
||||
int val = 0, current_mx = mx, current_my = my;
|
||||
for(;;) {
|
||||
@@ -388,6 +388,9 @@ void NACT_Sys1::cmd_open_menu()
|
||||
if(sx <= mx && mx <= ex && 0 <= index && index < menu_index) {
|
||||
current_index = index;
|
||||
ags->redraw_menu_window(menu_window, current_index);
|
||||
selectable = true;
|
||||
} else {
|
||||
selectable = false;
|
||||
}
|
||||
} else if(val == 1 || val == 2 || val == 4 || val == 8) {
|
||||
if(val == 1) {
|
||||
@@ -400,7 +403,8 @@ void NACT_Sys1::cmd_open_menu()
|
||||
current_index = menu_index - 1;
|
||||
}
|
||||
ags->redraw_menu_window(menu_window, current_index);
|
||||
} else if(val == 16) {
|
||||
selectable = true;
|
||||
} else if(val == 16 && selectable) {
|
||||
break;
|
||||
} else if(val == 32) {
|
||||
current_index = -1;
|
||||
@@ -544,7 +548,7 @@ top2:
|
||||
set_cursor(mx, my);
|
||||
|
||||
// メニュー選択
|
||||
for(;;) {
|
||||
for(bool selectable = true;;) {
|
||||
// 入力待機
|
||||
int val = 0, current_mx = mx, current_my = my;
|
||||
for(;;) {
|
||||
@@ -580,6 +584,9 @@ top2:
|
||||
if(sx <= mx && mx <= ex && 0 <= mindex && mindex < index) {
|
||||
current_index = mindex;
|
||||
ags->redraw_menu_window(menu_window, current_index);
|
||||
selectable = true;
|
||||
} else {
|
||||
selectable = false;
|
||||
}
|
||||
} else if(val == 1 || val == 2 || val == 4 || val == 8) {
|
||||
if(val == 1) {
|
||||
@@ -592,7 +599,8 @@ top2:
|
||||
current_index = index - 1;
|
||||
}
|
||||
ags->redraw_menu_window(menu_window, current_index);
|
||||
} else if(val == 16) {
|
||||
selectable = true;
|
||||
} else if(val == 16 && selectable) {
|
||||
break;
|
||||
} else if(val == 32) {
|
||||
current_index = -1;
|
||||
@@ -732,7 +740,7 @@ top2:
|
||||
set_cursor(mx, my);
|
||||
|
||||
// メニュー選択
|
||||
for(;;) {
|
||||
for(bool selectable = true;;) {
|
||||
// 入力待機
|
||||
int val = 0, current_mx = mx, current_my = my;
|
||||
for(;;) {
|
||||
@@ -768,6 +776,9 @@ top2:
|
||||
if(sx <= mx && mx <= ex && 0 <= mindex && mindex < index) {
|
||||
current_index = mindex;
|
||||
ags->redraw_menu_window(menu_window, current_index);
|
||||
selectable = true;
|
||||
} else {
|
||||
selectable = false;
|
||||
}
|
||||
} else if(val == 1 || val == 2 || val == 4 || val == 8) {
|
||||
if(val == 1) {
|
||||
@@ -780,7 +791,8 @@ top2:
|
||||
current_index = index - 1;
|
||||
}
|
||||
ags->redraw_menu_window(menu_window, current_index);
|
||||
} else if(val == 16) {
|
||||
selectable = true;
|
||||
} else if(val == 16 && selectable) {
|
||||
break;
|
||||
} else if(val == 32) {
|
||||
current_index = -1;
|
||||
|
||||
Reference in New Issue
Block a user