Merge branch 'master' into next

This commit is contained in:
Alam Ed Arias 2020-01-03 14:56:37 -05:00
commit a26c5f5428
14 changed files with 54 additions and 31 deletions

View File

@ -55,8 +55,6 @@ cache:
install: install:
- if [%CONFIGURATION%] == [SDL64] ( set "X86_64=1" ) - if [%CONFIGURATION%] == [SDL64] ( set "X86_64=1" )
- if [%CONFIGURATION%] == [SDL64] ( set "CONFIGURATION=SDL" ) - if [%CONFIGURATION%] == [SDL64] ( set "CONFIGURATION=SDL" )
- if [%CONFIGURATION%] == [DD64] ( set "X86_64=1" )
- if [%CONFIGURATION%] == [DD64] ( set "CONFIGURATION=DD" )
- if [%X86_64%] == [1] ( set "MINGW_SDK=%MINGW_SDK_64%" ) - if [%X86_64%] == [1] ( set "MINGW_SDK=%MINGW_SDK_64%" )
- if [%X86_64%] == [1] ( set "CCACHE_CC=%CCACHE_CC_64%" ) - if [%X86_64%] == [1] ( set "CCACHE_CC=%CCACHE_CC_64%" )
@ -75,13 +73,6 @@ install:
configuration: configuration:
- SDL - SDL
- SDL64 - SDL64
- DD
- DD64
matrix:
allow_failures:
- configuration: DD
- configuration: DD64
before_build: before_build:
- set "Path=%MINGW_SDK%\bin;%Path%" - set "Path=%MINGW_SDK%\bin;%Path%"

View File

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

View File

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

View File

@ -3002,8 +3002,8 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
CL_RemovePlayer(pnum, kickreason); CL_RemovePlayer(pnum, kickreason);
} }
consvar_t cv_allownewplayer = {"allowjoin", "On", CV_SAVE|CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL }; consvar_t cv_allownewplayer = {"allowjoin", "On", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
consvar_t cv_joinnextround = {"joinnextround", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done consvar_t cv_joinnextround = {"joinnextround", "Off", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done
static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {32, "MAX"}, {0, NULL}}; static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {32, "MAX"}, {0, NULL}};
consvar_t cv_maxplayers = {"maxplayers", "8", CV_SAVE, maxplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_maxplayers = {"maxplayers", "8", CV_SAVE, maxplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t resynchattempts_cons_t[] = {{1, "MIN"}, {20, "MAX"}, {0, "No"}, {0, NULL}}; static CV_PossibleValue_t resynchattempts_cons_t[] = {{1, "MIN"}, {20, "MAX"}, {0, "No"}, {0, NULL}};

View File

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

View File

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

View File

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

View File

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

View File

@ -1173,6 +1173,8 @@ void HU_clearChatChars(void)
w_chat[i] = 0; // reset this. w_chat[i] = 0; // reset this.
chat_on = false; chat_on = false;
c_input = 0; c_input = 0;
I_UpdateMouseGrab();
} }
#ifndef NONET #ifndef NONET
@ -1323,6 +1325,7 @@ boolean HU_Responder(event_t *ev)
chat_on = false; chat_on = false;
c_input = 0; // reset input cursor c_input = 0; // reset input cursor
chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :) chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :)
I_UpdateMouseGrab();
} }
else if (c == KEY_ESCAPE else if (c == KEY_ESCAPE
|| ((c == gamecontrol[gc_talkkey][0] || c == gamecontrol[gc_talkkey][1] || ((c == gamecontrol[gc_talkkey][0] || c == gamecontrol[gc_talkkey][1]
@ -1331,6 +1334,7 @@ boolean HU_Responder(event_t *ev)
{ {
chat_on = false; chat_on = false;
c_input = 0; // reset input cursor c_input = 0; // reset input cursor
I_UpdateMouseGrab();
} }
else if ((c == KEY_UPARROW || c == KEY_MOUSEWHEELUP) && chat_scroll > 0 && !OLDCHAT) // CHAT SCROLLING YAYS! 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); void I_GetMouseEvents(void);
/** \brief Checks if the mouse needs to be grabbed
*/
void I_UpdateMouseGrab(void);
char *I_GetEnv(const char *name); char *I_GetEnv(const char *name);
INT32 I_PutEnv(char *variable); INT32 I_PutEnv(char *variable);

View File

@ -2877,6 +2877,7 @@ static void M_GoBack(INT32 choice)
menuactive = false; menuactive = false;
wipetypepre = menupres[M_GetYoungestChildMenu()].exitwipe; wipetypepre = menupres[M_GetYoungestChildMenu()].exitwipe;
I_UpdateMouseGrab();
D_StartTitle(); D_StartTitle();
} }
else else
@ -3221,10 +3222,7 @@ boolean M_Responder(event_t *ev)
case KEY_ESCAPE: // Pop up menu case KEY_ESCAPE: // Pop up menu
if (chat_on) if (chat_on)
{
HU_clearChatChars(); HU_clearChatChars();
chat_on = false;
}
else else
M_StartControlPanel(); M_StartControlPanel();
return true; return true;
@ -3602,6 +3600,8 @@ void M_ClearMenus(boolean callexitmenufunc)
currentMenu = &MainDef; // Not like it matters currentMenu = &MainDef; // Not like it matters
menuactive = false; menuactive = false;
hidetitlemap = false; hidetitlemap = false;
I_UpdateMouseGrab();
} }
// //

View File

@ -987,7 +987,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
// //
// R_SplitSprite // R_SplitSprite
// runs through a sector's lightlist and // runs through a sector's lightlist and Knuckles
static void R_SplitSprite(vissprite_t *sprite) static void R_SplitSprite(vissprite_t *sprite)
{ {
INT32 i, lightnum, lindex; INT32 i, lightnum, lindex;

View File

@ -67,6 +67,7 @@
#include "../s_sound.h" #include "../s_sound.h"
#include "../i_joy.h" #include "../i_joy.h"
#include "../st_stuff.h" #include "../st_stuff.h"
#include "../hu_stuff.h"
#include "../g_game.h" #include "../g_game.h"
#include "../i_video.h" #include "../i_video.h"
#include "../console.h" #include "../console.h"
@ -99,6 +100,7 @@ boolean highcolor = false;
// synchronize page flipping with screen refresh // synchronize page flipping with screen refresh
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static consvar_t cv_alwaysgrabmouse = {"alwaysgrabmouse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
UINT8 graphics_started = 0; // Is used in console.c and screen.c UINT8 graphics_started = 0; // Is used in console.c and screen.c
@ -108,6 +110,7 @@ static SDL_bool disable_fullscreen = SDL_FALSE;
#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)?0:cv_fullscreen.value #define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)?0:cv_fullscreen.value
static SDL_bool disable_mouse = SDL_FALSE; static SDL_bool disable_mouse = SDL_FALSE;
#define USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && havefocus) #define USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && havefocus)
#define IGNORE_MOUSE (!cv_alwaysgrabmouse.value && (menuactive || paused || con_destlines || chat_on || gamestate != GS_LEVEL))
#define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN) #define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN)
#define MOUSEBUTTONS_MAX MOUSEBUTTONS #define MOUSEBUTTONS_MAX MOUSEBUTTONS
@ -378,12 +381,15 @@ static void SDLdoUngrabMouse(void)
void SDLforceUngrabMouse(void) void SDLforceUngrabMouse(void)
{ {
if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO && window != NULL) if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO && window != NULL)
{ SDLdoUngrabMouse();
SDL_ShowCursor(SDL_ENABLE); }
SDL_SetWindowGrab(window, SDL_FALSE);
wrapmouseok = SDL_FALSE; void I_UpdateMouseGrab(void)
SDL_SetRelativeMouseMode(SDL_FALSE); {
} 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) static void VID_Command_NumModes_f (void)
@ -590,7 +596,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
} }
//else firsttimeonmouse = SDL_FALSE; //else firsttimeonmouse = SDL_FALSE;
if (USE_MOUSEINPUT) if (USE_MOUSEINPUT && !IGNORE_MOUSE)
SDLdoGrabMouse(); SDLdoGrabMouse();
} }
else if (!mousefocus && !kbfocus) else if (!mousefocus && !kbfocus)
@ -637,11 +643,14 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type)
static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
{ {
static boolean firstmove = true;
if (USE_MOUSEINPUT) if (USE_MOUSEINPUT)
{ {
if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window)) if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window) || (IGNORE_MOUSE && !firstmove))
{ {
SDLdoUngrabMouse(); SDLdoUngrabMouse();
firstmove = false;
return; return;
} }
@ -655,6 +664,7 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
mousemovey += -evt.yrel; mousemovey += -evt.yrel;
SDL_SetWindowGrab(window, SDL_TRUE); SDL_SetWindowGrab(window, SDL_TRUE);
} }
firstmove = false;
return; return;
} }
@ -662,6 +672,7 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
// of the screen then ignore it. // of the screen then ignore it.
if ((evt.x == realwidth/2) && (evt.y == realheight/2)) if ((evt.x == realwidth/2) && (evt.y == realheight/2))
{ {
firstmove = false;
return; return;
} }
@ -674,6 +685,8 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
SDLdoGrabMouse(); SDLdoGrabMouse();
} }
} }
firstmove = false;
} }
static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type) static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
@ -687,7 +700,7 @@ static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
// this apparently makes a mouse button down event but not a mouse button up event, // this apparently makes a mouse button down event but not a mouse button up event,
// resulting in whatever key was pressed down getting "stuck" if we don't ignore it. // resulting in whatever key was pressed down getting "stuck" if we don't ignore it.
// -- Monster Iestyn (28/05/18) // -- Monster Iestyn (28/05/18)
if (SDL_GetMouseFocus() != window) if (SDL_GetMouseFocus() != window || IGNORE_MOUSE)
return; return;
/// \todo inputEvent.button.which /// \todo inputEvent.button.which
@ -1069,7 +1082,7 @@ void I_StartupMouse(void)
} }
else else
firsttimeonmouse = SDL_FALSE; firsttimeonmouse = SDL_FALSE;
if (cv_usemouse.value) if (cv_usemouse.value && !IGNORE_MOUSE)
SDLdoGrabMouse(); SDLdoGrabMouse();
else else
SDLdoUngrabMouse(); SDLdoUngrabMouse();
@ -1614,6 +1627,7 @@ void I_StartupGraphics(void)
COM_AddCommand ("vid_mode", VID_Command_Mode_f); COM_AddCommand ("vid_mode", VID_Command_Mode_f);
CV_RegisterVar (&cv_vidwait); CV_RegisterVar (&cv_vidwait);
CV_RegisterVar (&cv_stretch); CV_RegisterVar (&cv_stretch);
CV_RegisterVar (&cv_alwaysgrabmouse);
disable_mouse = M_CheckParm("-nomouse"); disable_mouse = M_CheckParm("-nomouse");
disable_fullscreen = M_CheckParm("-win") ? 1 : 0; disable_fullscreen = M_CheckParm("-win") ? 1 : 0;
@ -1702,12 +1716,7 @@ void I_StartupGraphics(void)
SDL_RaiseWindow(window); SDL_RaiseWindow(window);
if (mousegrabok && !disable_mouse) if (mousegrabok && !disable_mouse)
{ SDLdoGrabMouse();
SDL_ShowCursor(SDL_DISABLE);
SDL_SetRelativeMouseMode(SDL_TRUE);
wrapmouseok = SDL_TRUE;
SDL_SetWindowGrab(window, SDL_TRUE);
}
graphics_started = true; graphics_started = true;
} }

View File

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