Grab mouse again when closing menu, unpausing, etc

This commit is contained in:
Louis-Antoine 2020-01-02 00:45:28 +01:00
parent 62397a36ec
commit 5bde4df439
11 changed files with 34 additions and 0 deletions

View File

@ -245,6 +245,8 @@ void I_GetJoystick2Events(void){}
void I_GetMouseEvents(void){}
void I_UpdateMouseGrab(void){}
char *I_GetEnv(const char *name)
{
LOGW("I_GetEnv() called?!");

View File

@ -592,6 +592,8 @@ void CON_ToggleOff(void)
CON_ClearHUD();
con_forcepic = 0;
con_clipviewtop = -1; // remove console clipping of view
I_UpdateMouseGrab();
}
boolean CON_Ready(void)
@ -616,6 +618,7 @@ void CON_Ticker(void)
consoletoggle = false;
con_destlines = 0;
CON_ClearHUD();
I_UpdateMouseGrab();
}
// console key was pushed
@ -628,6 +631,7 @@ void CON_Ticker(void)
{
con_destlines = 0;
CON_ClearHUD();
I_UpdateMouseGrab();
}
else
CON_ChangeHeight();

View File

@ -2203,6 +2203,8 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
else
S_ResumeAudio();
}
I_UpdateMouseGrab();
}
// Command for stuck characters in netgames, griefing, etc.

View File

@ -4539,11 +4539,13 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
if (introchanged)
{
menuactive = false;
I_UpdateMouseGrab();
COM_BufAddText("playintro");
}
else if (titlechanged)
{
menuactive = false;
I_UpdateMouseGrab();
COM_BufAddText("exitgame"); // Command_ExitGame_f() but delayed
}
}

View File

@ -150,6 +150,8 @@ void I_GetJoystick2Events(void){}
void I_GetMouseEvents(void){}
void I_UpdateMouseGrab(void){}
char *I_GetEnv(const char *name)
{
(void)name;

View File

@ -1832,6 +1832,7 @@ void G_DoLoadLevel(boolean resetplayer)
titlemapinaction = TITLEMAP_OFF;
G_SetGamestate(GS_LEVEL);
I_UpdateMouseGrab();
for (i = 0; i < MAXPLAYERS; i++)
{

View File

@ -1173,6 +1173,8 @@ void HU_clearChatChars(void)
w_chat[i] = 0; // reset this.
chat_on = false;
c_input = 0;
I_UpdateMouseGrab();
}
#ifndef NONET
@ -1323,6 +1325,7 @@ boolean HU_Responder(event_t *ev)
chat_on = false;
c_input = 0; // reset input cursor
chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :)
I_UpdateMouseGrab();
}
else if (c == KEY_ESCAPE
|| ((c == gamecontrol[gc_talkkey][0] || c == gamecontrol[gc_talkkey][1]
@ -1331,6 +1334,7 @@ boolean HU_Responder(event_t *ev)
{
chat_on = false;
c_input = 0; // reset input cursor
I_UpdateMouseGrab();
}
else if ((c == KEY_UPARROW || c == KEY_MOUSEWHEELUP) && chat_scroll > 0 && !OLDCHAT) // CHAT SCROLLING YAYS!
{

View File

@ -288,6 +288,10 @@ void I_GetJoystick2Events(void);
*/
void I_GetMouseEvents(void);
/** \brief Checks if the mouse needs to be grabbed
*/
void I_UpdateMouseGrab(void);
char *I_GetEnv(const char *name);
INT32 I_PutEnv(char *variable);

View File

@ -2867,6 +2867,7 @@ static void M_GoBack(INT32 choice)
menuactive = false;
wipetypepre = menupres[M_GetYoungestChildMenu()].exitwipe;
I_UpdateMouseGrab();
D_StartTitle();
}
else
@ -3592,6 +3593,8 @@ void M_ClearMenus(boolean callexitmenufunc)
currentMenu = &MainDef; // Not like it matters
menuactive = false;
hidetitlemap = false;
I_UpdateMouseGrab();
}
//

View File

@ -388,6 +388,14 @@ void SDLforceUngrabMouse(void)
}
}
void I_UpdateMouseGrab(void)
{
if (SDL_WasInit(SDL_INIT_VIDEO) == SDL_INIT_VIDEO && window != NULL
&& SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window
&& !IGNORE_MOUSE)
SDLdoGrabMouse();
}
static void VID_Command_NumModes_f (void)
{
CONS_Printf(M_GetText("%d video mode(s) available(s)\n"), VID_NumModes());

View File

@ -1354,6 +1354,8 @@ getBufferedData:
}
}
void I_UpdateMouseGrab(void) {}
// ===========================================================================================
// DIRECT INPUT JOYSTICK
// ===========================================================================================