Merge branch 'newcontrols' into next-newcontrols

This commit is contained in:
fickleheart 2020-01-04 09:56:24 -06:00
commit f0e6a56b6b
21 changed files with 212 additions and 126 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

@ -427,20 +427,21 @@ static void COM_TokenizeString(char *ptext)
com_argc = 0; com_argc = 0;
com_args = NULL; com_args = NULL;
com_flags = 0;
if (ptext[0] == '\033')
{
com_flags = (unsigned)ptext[1];
ptext += 2;
}
else
com_flags = 0;
while (com_argc < MAX_ARGS) while (com_argc < MAX_ARGS)
{ {
// Skip whitespace up to a newline. // Skip whitespace up to a newline.
while (*ptext != '\0' && *ptext <= ' ' && *ptext != '\n') while (*ptext != '\0' && *ptext <= ' ' && *ptext != '\n')
ptext++; {
if (ptext[0] == '\033')
{
com_flags = (unsigned)ptext[1];
ptext += 2;
}
else
ptext++;
}
// A newline means end of command in buffer, // A newline means end of command in buffer,
// thus end of this command's args too. // thus end of this command's args too.
@ -2174,8 +2175,13 @@ skipwhite:
com_token[len] = 0; com_token[len] = 0;
return data; return data;
} }
com_token[len] = c; if (c == '\033')
len++; data++;
else
{
com_token[len] = c;
len++;
}
} }
} }
@ -2191,10 +2197,22 @@ skipwhite:
// parse a regular word // parse a regular word
do do
{ {
com_token[len] = c; if (c == '\033')
data++; {
len++; do
c = *data; {
data += 2;
c = *data;
}
while (c == '\033') ;
}
else
{
com_token[len] = c;
data++;
len++;
c = *data;
}
if (c == '{' || c == '}' || c == ')'|| c == '(' || c == '\'') if (c == '{' || c == '}' || c == ')'|| c == '(' || c == '\'')
break; break;
} while (c > 32); } while (c > 32);

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

@ -3004,8 +3004,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

@ -1169,26 +1169,6 @@ void D_SRB2Main(void)
if (M_CheckParm("-server") || dedicated) if (M_CheckParm("-server") || dedicated)
netgame = server = true; netgame = server = true;
if (M_CheckParm("-warp") && M_IsNextParm())
{
const char *word = M_GetNextParm();
char ch; // use this with sscanf to catch non-digits with
if (fastncmp(word, "MAP", 3)) // MAPxx name
pstartmap = M_MapNumber(word[3], word[4]);
else if (sscanf(word, "%d%c", &pstartmap, &ch) != 1) // a plain number
I_Error("Cannot warp to map %s (invalid map name)\n", word);
// Don't check if lump exists just yet because the wads haven't been loaded!
// Just do a basic range check here.
if (pstartmap < 1 || pstartmap > NUMMAPS)
I_Error("Cannot warp to map %d (out of range)\n", pstartmap);
else
{
if (!M_CheckParm("-server"))
G_SetGameModified(true);
autostart = true;
}
}
CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n"); CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n");
Z_Init(); Z_Init();
@ -1245,6 +1225,20 @@ void D_SRB2Main(void)
mainwadstally = packetsizetally; // technically not accurate atm, remember to port the two-stage -file process from kart in 2.2.x mainwadstally = packetsizetally; // technically not accurate atm, remember to port the two-stage -file process from kart in 2.2.x
if (M_CheckParm("-warp") && M_IsNextParm())
{
const char *word = M_GetNextParm();
pstartmap = G_FindMapByNameOrCode(word, 0);
if (! pstartmap)
I_Error("Cannot find a map remotely named '%s'\n", word);
else
{
if (!M_CheckParm("-server"))
G_SetGameModified(true);
autostart = true;
}
}
cht_Init(); cht_Init();
//---------------------------------------------------- READY SCREEN //---------------------------------------------------- READY SCREEN

View File

@ -867,7 +867,9 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_fullscreen); CV_RegisterVar(&cv_fullscreen);
CV_RegisterVar(&cv_renderview); CV_RegisterVar(&cv_renderview);
CV_RegisterVar(&cv_renderer); CV_RegisterVar(&cv_renderer);
#ifdef HWRENDER
CV_RegisterVar(&cv_newrenderer); CV_RegisterVar(&cv_newrenderer);
#endif
CV_RegisterVar(&cv_scr_depth); CV_RegisterVar(&cv_scr_depth);
CV_RegisterVar(&cv_scr_width); CV_RegisterVar(&cv_scr_width);
CV_RegisterVar(&cv_scr_height); CV_RegisterVar(&cv_scr_height);
@ -1829,18 +1831,15 @@ static void Command_Map_f(void)
boolean newresetplayers; boolean newresetplayers;
boolean mustmodifygame; boolean mustmodifygame;
boolean usemapcode = false;
INT32 newmapnum; INT32 newmapnum;
char * mapname; char * mapname;
size_t mapnamelen;
char *realmapname = NULL; char *realmapname = NULL;
INT32 newgametype = gametype; INT32 newgametype = gametype;
INT32 d; INT32 d;
char *p;
if (client && !IsPlayerAdmin(consoleplayer)) if (client && !IsPlayerAdmin(consoleplayer))
{ {
@ -1900,43 +1899,8 @@ static void Command_Map_f(void)
} }
mapname = ConcatCommandArgv(1, first_option); mapname = ConcatCommandArgv(1, first_option);
mapnamelen = strlen(mapname);
if (mapnamelen == 2)/* maybe two digit code */ newmapnum = G_FindMapByNameOrCode(mapname, &realmapname);
{
if (( newmapnum = M_MapNumber(mapname[0], mapname[1]) ))
usemapcode = true;
}
else if (mapnamelen == 5 && strnicmp(mapname, "MAP", 3) == 0)
{
if (( newmapnum = M_MapNumber(mapname[3], mapname[4]) ) == 0)
{
CONS_Alert(CONS_ERROR, M_GetText("Invalid map code '%s'.\n"), mapname);
Z_Free(mapname);
return;
}
usemapcode = true;
}
if (!usemapcode)
{
/* Now detect map number in base 10, which no one asked for. */
newmapnum = strtol(mapname, &p, 10);
if (*p == '\0')/* we got it */
{
if (newmapnum < 1 || newmapnum > NUMMAPS)
{
CONS_Alert(CONS_ERROR, M_GetText("Invalid map number %d.\n"), newmapnum);
Z_Free(mapname);
return;
}
usemapcode = true;
}
else
{
newmapnum = G_FindMap(mapname, &realmapname, NULL, NULL);
}
}
if (newmapnum == 0) if (newmapnum == 0)
{ {
@ -1945,11 +1909,6 @@ static void Command_Map_f(void)
return; return;
} }
if (usemapcode)
{
realmapname = G_BuildMapTitle(newmapnum);
}
if (mustmodifygame && option_force) if (mustmodifygame && option_force)
{ {
G_SetGameModified(false); G_SetGameModified(false);
@ -2229,6 +2188,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

@ -1493,8 +1493,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (PLAYERINPUTDOWN(ssplayer, gc_camreset)) if (PLAYERINPUTDOWN(ssplayer, gc_camreset))
{ {
if (camera.chase && !resetdown[forplayer]) if (thiscam->chase && !resetdown[forplayer])
P_ResetCamera(&players[ssplayer == 1 ? displayplayer : secondarydisplayplayer], &camera); P_ResetCamera(&players[ssplayer == 1 ? displayplayer : secondarydisplayplayer], thiscam);
resetdown[forplayer] = true; resetdown[forplayer] = true;
} }
@ -1512,7 +1512,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
INT32 player_invert = invertmouse ? -1 : 1; INT32 player_invert = invertmouse ? -1 : 1;
INT32 screen_invert = INT32 screen_invert =
(player->mo && (player->mo->eflags & MFE_VERTICALFLIP) (player->mo && (player->mo->eflags & MFE_VERTICALFLIP)
&& (!camera.chase || player->pflags & PF_FLIPCAM)) //because chasecam's not inverted && (!thiscam->chase || player->pflags & PF_FLIPCAM)) //because chasecam's not inverted
? -1 : 1; // set to -1 or 1 to multiply ? -1 : 1; // set to -1 or 1 to multiply
INT32 lookaxis = ssplayer == 1 ? cv_lookaxis.value : cv_lookaxis2.value; INT32 lookaxis = ssplayer == 1 ? cv_lookaxis.value : cv_lookaxis2.value;
@ -1596,7 +1596,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
} }
//Silly hack to make 2d mode *somewhat* playable with no chasecam. //Silly hack to make 2d mode *somewhat* playable with no chasecam.
if ((twodlevel || (player->mo && player->mo->flags2 & MF2_TWOD)) && !camera.chase) if ((twodlevel || (player->mo && player->mo->flags2 & MF2_TWOD)) && !thiscam->chase)
{ {
INT32 temp = forward; INT32 temp = forward;
forward = side; forward = side;
@ -1633,7 +1633,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->angleturn = (INT16)(*myangle >> 16); cmd->angleturn = (INT16)(*myangle >> 16);
// Adjust camera angle by player input // Adjust camera angle by player input
if (controlstyle == CS_SIMPLE && !forcestrafe && camera.chase && !turnheld[forplayer] && !ticcmd_centerviewdown[forplayer] && !player->climbing && player->powers[pw_carry] != CR_MINECART) if (controlstyle == CS_SIMPLE && !forcestrafe && thiscam->chase && !turnheld[forplayer] && !ticcmd_centerviewdown[forplayer] && !player->climbing && player->powers[pw_carry] != CR_MINECART)
{ {
fixed_t camadjustfactor = cv_cam_turnfacinginput[forplayer].value; fixed_t camadjustfactor = cv_cam_turnfacinginput[forplayer].value;
@ -1655,7 +1655,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// Adjust camera angle to face player direction, depending on circumstances // Adjust camera angle to face player direction, depending on circumstances
// Nothing happens if cam left/right are held, so you can hold both to lock the camera in one direction // Nothing happens if cam left/right are held, so you can hold both to lock the camera in one direction
if (controlstyle == CS_SIMPLE && !forcestrafe && camera.chase && !turnheld[forplayer] && !ticcmd_centerviewdown[forplayer] && player->powers[pw_carry] != CR_MINECART) if (controlstyle == CS_SIMPLE && !forcestrafe && thiscam->chase && !turnheld[forplayer] && !ticcmd_centerviewdown[forplayer] && player->powers[pw_carry] != CR_MINECART)
{ {
fixed_t camadjustfactor; fixed_t camadjustfactor;
boolean alt = false; // Reduce intensity on diagonals and prevent backwards movement from turning the camera boolean alt = false; // Reduce intensity on diagonals and prevent backwards movement from turning the camera
@ -1826,6 +1826,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++)
{ {
@ -4766,6 +4767,61 @@ void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc)
Z_Free(freq); Z_Free(freq);
} }
INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
{
boolean usemapcode = false;
INT32 newmapnum;
size_t mapnamelen;
char *p;
mapnamelen = strlen(mapname);
if (mapnamelen == 2)/* maybe two digit code */
{
if (( newmapnum = M_MapNumber(mapname[0], mapname[1]) ))
usemapcode = true;
}
else if (mapnamelen == 5 && strnicmp(mapname, "MAP", 3) == 0)
{
if (( newmapnum = M_MapNumber(mapname[3], mapname[4]) ))
usemapcode = true;
}
if (!usemapcode)
{
/* Now detect map number in base 10, which no one asked for. */
newmapnum = strtol(mapname, &p, 10);
if (*p == '\0')/* we got it */
{
if (newmapnum < 1 || newmapnum > NUMMAPS)
{
CONS_Alert(CONS_ERROR, M_GetText("Invalid map number %d.\n"), newmapnum);
return 0;
}
usemapcode = true;
}
else
{
newmapnum = G_FindMap(mapname, realmapnamep, NULL, NULL);
}
}
if (usemapcode)
{
/* we can't check mapheaderinfo for this hahahaha */
if (W_CheckNumForName(G_BuildMapName(newmapnum)) == LUMPERROR)
return 0;
if (realmapnamep)
(*realmapnamep) = G_BuildMapTitle(newmapnum);
}
return newmapnum;
}
// //
// DEMO RECORDING // DEMO RECORDING
// //

View File

@ -154,6 +154,9 @@ INT32 G_FindMap(const char *query, char **foundmapnamep,
mapsearchfreq_t **freqp, INT32 *freqc); mapsearchfreq_t **freqp, INT32 *freqc);
void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc); void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc);
/* Match map name by search + 2 digit map code or map number. */
INT32 G_FindMapByNameOrCode(const char *query, char **foundmapnamep);
// XMOD spawning // XMOD spawning
mapthing_t *G_FindCTFStart(INT32 playernum); mapthing_t *G_FindCTFStart(INT32 playernum);
mapthing_t *G_FindMatchStart(INT32 playernum); mapthing_t *G_FindMatchStart(INT32 playernum);

View File

@ -374,7 +374,6 @@ light_t *t_lspr[NUMSPRITES] =
&lspr[NOLIGHT], // SPR_ADST &lspr[NOLIGHT], // SPR_ADST
&lspr[NOLIGHT], // SPR_MCRT &lspr[NOLIGHT], // SPR_MCRT
&lspr[NOLIGHT], // SPR_MCSP &lspr[NOLIGHT], // SPR_MCSP
&lspr[NOLIGHT], // SPR_NON2
&lspr[NOLIGHT], // SPR_SALD &lspr[NOLIGHT], // SPR_SALD
&lspr[NOLIGHT], // SPR_TRAE &lspr[NOLIGHT], // SPR_TRAE
&lspr[NOLIGHT], // SPR_TRAI &lspr[NOLIGHT], // SPR_TRAI

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

@ -396,7 +396,9 @@ static void M_ResetCvars(void);
// Consvar onchange functions // Consvar onchange functions
static void Newgametype_OnChange(void); static void Newgametype_OnChange(void);
#ifdef HWRENDER
static void Newrenderer_OnChange(void); static void Newrenderer_OnChange(void);
#endif
static void Dummymares_OnChange(void); static void Dummymares_OnChange(void);
// ========================================================================== // ==========================================================================
@ -421,8 +423,10 @@ CV_PossibleValue_t gametype_cons_t[NUMGAMETYPES+1];
consvar_t cv_newgametype = {"newgametype", "Co-op", CV_HIDEN|CV_CALL, gametype_cons_t, Newgametype_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_newgametype = {"newgametype", "Co-op", CV_HIDEN|CV_CALL, gametype_cons_t, Newgametype_OnChange, 0, NULL, NULL, 0, 0, NULL};
#ifdef HWRENDER
consvar_t cv_newrenderer = {"newrenderer", "Software", CV_HIDEN|CV_CALL, cv_renderer_t, Newrenderer_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_newrenderer = {"newrenderer", "Software", CV_HIDEN|CV_CALL, cv_renderer_t, Newrenderer_OnChange, 0, NULL, NULL, 0, 0, NULL};
static int newrenderer_set = 1;/* Software doesn't need confirmation! */ static int newrenderer_set = 1;/* Software doesn't need confirmation! */
#endif
static CV_PossibleValue_t serversort_cons_t[] = { static CV_PossibleValue_t serversort_cons_t[] = {
{0,"Ping"}, {0,"Ping"},
@ -1287,7 +1291,11 @@ static menuitem_t OP_VideoOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 11}, {IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 11},
#endif #endif
{IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 16}, {IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 16},
#ifdef HWRENDER
{IT_STRING | IT_CVAR, NULL, "Renderer", &cv_newrenderer, 21}, {IT_STRING | IT_CVAR, NULL, "Renderer", &cv_newrenderer, 21},
#else
{IT_TRANSTEXT | IT_PAIR, "Renderer", "Software", &cv_renderer, 21},
#endif
{IT_HEADER, NULL, "Color Profile", NULL, 30}, {IT_HEADER, NULL, "Color Profile", NULL, 30},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness (F11)", &cv_globalgamma,36}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness (F11)", &cv_globalgamma,36},
@ -2341,6 +2349,7 @@ static void Newgametype_OnChange(void)
} }
} }
#ifdef HWRENDER
static void Newrenderer_AREYOUSURE(INT32 c) static void Newrenderer_AREYOUSURE(INT32 c)
{ {
int n; int n;
@ -2378,6 +2387,7 @@ static void Newrenderer_OnChange(void)
); );
} }
} }
#endif/*HWRENDER*/
void Screenshot_option_Onchange(void) void Screenshot_option_Onchange(void)
{ {
@ -2979,6 +2989,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
@ -3085,7 +3096,7 @@ static void M_NextOpt(void)
itemOn = 0; itemOn = 0;
else else
itemOn++; itemOn++;
} while (oldItemOn != itemOn && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE); } while (oldItemOn != itemOn && ( (currentMenu->menuitems[itemOn].status & IT_TYPE) & IT_SPACE ));
} }
static void M_PrevOpt(void) static void M_PrevOpt(void)
@ -3097,7 +3108,7 @@ static void M_PrevOpt(void)
itemOn = currentMenu->numitems - 1; itemOn = currentMenu->numitems - 1;
else else
itemOn--; itemOn--;
} while (oldItemOn != itemOn && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE); } while (oldItemOn != itemOn && ( (currentMenu->menuitems[itemOn].status & IT_TYPE) & IT_SPACE ));
} }
// lock out further input in a tic when important buttons are pressed // lock out further input in a tic when important buttons are pressed
@ -3323,10 +3334,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;
@ -3704,6 +3712,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();
} }
// //
@ -3731,11 +3741,11 @@ void M_SetupNextMenu(menu_t *menudef)
// the curent item can be disabled, // the curent item can be disabled,
// this code go up until an enabled item found // this code go up until an enabled item found
if ((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE) if (( (currentMenu->menuitems[itemOn].status & IT_TYPE) & IT_SPACE ))
{ {
for (i = 0; i < currentMenu->numitems; i++) for (i = 0; i < currentMenu->numitems; i++)
{ {
if ((currentMenu->menuitems[i].status & IT_TYPE) != IT_SPACE) if (!( (currentMenu->menuitems[i].status & IT_TYPE) & IT_SPACE ))
{ {
itemOn = i; itemOn = i;
break; break;
@ -4516,7 +4526,18 @@ static void M_DrawGenericScrollMenu(void)
} }
break; break;
case IT_TRANSTEXT: case IT_TRANSTEXT:
V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text); switch (currentMenu->menuitems[i].status & IT_TYPE)
{
case IT_PAIR:
V_DrawString(x, y,
V_TRANSLUCENT, currentMenu->menuitems[i].patch);
V_DrawRightAlignedString(BASEVIDWIDTH - x, y,
V_TRANSLUCENT, currentMenu->menuitems[i].text);
break;
default:
V_DrawString(x, y,
V_TRANSLUCENT, currentMenu->menuitems[i].text);
}
break; break;
case IT_QUESTIONMARKS: case IT_QUESTIONMARKS:
V_DrawString(x, y, V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text)); V_DrawString(x, y, V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));

View File

@ -224,13 +224,14 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt);
// flags for items in the menu // flags for items in the menu
// menu handle (what we do when key is pressed // menu handle (what we do when key is pressed
#define IT_TYPE 14 // (2+4+8) #define IT_TYPE 15 // (1+2+4+8)
#define IT_CALL 0 // call the function #define IT_CALL 0 // call the function
#define IT_SPACE 1 // no handling
#define IT_ARROWS 2 // call function with 0 for left arrow and 1 for right arrow in param #define IT_ARROWS 2 // call function with 0 for left arrow and 1 for right arrow in param
#define IT_KEYHANDLER 4 // call with the key in param #define IT_KEYHANDLER 4 // call with the key in param
#define IT_SUBMENU 6 // go to sub menu #define IT_SUBMENU 6 // go to sub menu
#define IT_CVAR 8 // handle as a cvar #define IT_CVAR 8 // handle as a cvar
#define IT_SPACE 10 // no handling #define IT_PAIR 11 // no handling, define both sides of text
#define IT_MSGHANDLER 12 // same as key but with event and sometime can handle y/n key (special for message) #define IT_MSGHANDLER 12 // same as key but with event and sometime can handle y/n key (special for message)
#define IT_DISPLAY (48+64+128) // 16+32+64+128 #define IT_DISPLAY (48+64+128) // 16+32+64+128

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

@ -64,7 +64,13 @@ consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NUL
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static void SCR_ActuallyChangeRenderer(void); static void SCR_ActuallyChangeRenderer(void);
CV_PossibleValue_t cv_renderer_t[] = {{1, "Software"}, {2, "OpenGL"}, {0, NULL}}; CV_PossibleValue_t cv_renderer_t[] = {
{1, "Software"},
#ifdef HWRENDER
{2, "OpenGL"},
#endif
{0, NULL}
};
consvar_t cv_renderer = {"renderer", "Software", CV_SAVE|CV_NOLUA|CV_CALL, cv_renderer_t, SCR_ChangeRenderer, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_renderer = {"renderer", "Software", CV_SAVE|CV_NOLUA|CV_CALL, cv_renderer_t, SCR_ChangeRenderer, 0, NULL, NULL, 0, 0, NULL};
static void SCR_ChangeFullscreen(void); static void SCR_ChangeFullscreen(void);
@ -454,9 +460,12 @@ void SCR_ChangeRenderer(void)
if (con_startup) if (con_startup)
{ {
target_renderer = cv_renderer.value; target_renderer = cv_renderer.value;
#ifdef HWRENDER
if (M_CheckParm("-opengl")) if (M_CheckParm("-opengl"))
target_renderer = rendermode = render_opengl; target_renderer = rendermode = render_opengl;
else if (M_CheckParm("-software")) else
#endif
if (M_CheckParm("-software"))
target_renderer = rendermode = render_soft; target_renderer = rendermode = render_soft;
// set cv_renderer back // set cv_renderer back
SCR_ChangeRendererCVars(rendermode); SCR_ChangeRendererCVars(rendermode);
@ -477,7 +486,9 @@ void SCR_ChangeRendererCVars(INT32 mode)
CV_StealthSetValue(&cv_renderer, 1); CV_StealthSetValue(&cv_renderer, 1);
else if (mode == render_opengl) else if (mode == render_opengl)
CV_StealthSetValue(&cv_renderer, 2); CV_StealthSetValue(&cv_renderer, 2);
#ifdef HWRENDER
CV_StealthSetValue(&cv_newrenderer, cv_renderer.value); CV_StealthSetValue(&cv_newrenderer, cv_renderer.value);
#endif
} }
boolean SCR_IsAspectCorrect(INT32 width, INT32 height) boolean SCR_IsAspectCorrect(INT32 width, INT32 height)

View File

@ -184,7 +184,9 @@ extern UINT8 *scr_borderpatch; // patch used to fill the view borders
extern CV_PossibleValue_t cv_renderer_t[]; extern CV_PossibleValue_t cv_renderer_t[];
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_fullscreen; extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_fullscreen;
#ifdef HWRENDER
extern consvar_t cv_newrenderer; extern consvar_t cv_newrenderer;
#endif
// wait for page flipping to end or not // wait for page flipping to end or not
extern consvar_t cv_vidwait; extern consvar_t cv_vidwait;

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
// =========================================================================================== // ===========================================================================================