Prevent mouse motion when returning from message prompts (#1722)

* Flush mouse motion when clearing relative state

* Clear relative mouse state when clearing input variables

* Prevent mouse motion when returning from message prompts
This commit is contained in:
ceski 2024-05-31 23:23:29 -07:00 committed by GitHub
parent 4f95da2225
commit 32be8190c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View File

@ -820,6 +820,7 @@ void G_ClearInput(void)
ClearLocalView();
G_ClearCarry();
memset(&basecmd, 0, sizeof(basecmd));
I_ResetRelativeMouseState();
}
//

View File

@ -220,6 +220,8 @@ void I_ShowMouseCursor(boolean toggle)
void I_ResetRelativeMouseState(void)
{
SDL_PumpEvents();
SDL_FlushEvent(SDL_MOUSEMOTION);
SDL_GetRelativeMouseState(NULL, NULL);
}
@ -1782,8 +1784,6 @@ void I_InitGraphics(void)
ResetLogicalSize();
// clear out events waiting at the start and center the mouse
SDL_PumpEvents();
SDL_FlushEvent(SDL_MOUSEMOTION);
I_ResetRelativeMouseState();
}

View File

@ -1900,7 +1900,6 @@ void MN_ClearMenus(void)
// sendpause = true;
G_ClearInput();
I_ResetRelativeMouseState();
}
void MN_Back(void)
@ -2727,6 +2726,7 @@ boolean M_Responder(event_t *ev)
messageRoutine(ch);
}
G_ClearInput();
menuactive = false;
M_StartSound(sfx_swtchx);
return true;