Fix mouse driven thermos (#2207)

* Deactivate mouse driven thermo when clearing menu

* Restore value of mouse driven, deferred action thermos when canceled
This commit is contained in:
ceski 2025-02-16 22:31:34 -08:00 committed by GitHub
parent 2f21b4e7cf
commit 0f2363c19d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 6 deletions

View File

@ -101,7 +101,7 @@ static int saveCharIndex; // which char we're editing
static char saveOldString[SAVESTRINGSIZE];
boolean menuactive; // The menus are up
static boolean mouse_active_thermo;
static boolean options_active;
backdrop_t menu_backdrop;
@ -2158,6 +2158,7 @@ static void M_Setup(int choice)
void MN_ClearMenus(void)
{
menuactive = 0;
mouse_active_thermo = false;
options_active = false;
print_warning_about_changes = 0; // killough 8/15/98
default_verify = 0; // killough 10/98
@ -2844,18 +2845,16 @@ static boolean MouseResponder(void)
return false;
}
static boolean active_thermo;
if (M_InputActivated(input_menu_enter))
{
active_thermo = true;
mouse_active_thermo = true;
}
else if (M_InputDeactivated(input_menu_enter))
{
active_thermo = false;
mouse_active_thermo = false;
}
if (active_thermo)
if (mouse_active_thermo)
{
int dot = mouse_state_x - (rect->x + M_THRM_STEP + video.deltaw);
int step = M_MAX_VOL * FRACUNIT / (rect->w - M_THRM_STEP * 3);

View File

@ -4474,6 +4474,13 @@ boolean MN_SetupResponder(menu_action_t action, int ch)
if (action == MENU_ESCAPE || action == MENU_BACKSPACE)
{
if (active_thermo && setup_cancel != -1)
{
default_t *def = active_thermo->var.def;
*def->location.i = setup_cancel;
setup_cancel = -1;
}
SetItemOn(set_item_on);
SetPageIndex(current_page);
@ -4591,6 +4598,7 @@ boolean MN_SetupMouseResponder(int x, int y)
}
}
active_thermo = NULL;
setup_cancel = -1;
}
if (M_InputActivated(input_menu_enter))
@ -4623,6 +4631,11 @@ boolean MN_SetupMouseResponder(int x, int y)
if (M_InputActivated(input_menu_enter))
{
active_thermo = current_item;
if (flags & S_ACTION && setup_cancel == -1)
{
setup_cancel = *def->location.i;
}
}
}