mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
Merge remote-tracking branch 'origin/master' into more-opengl-fixes
This commit is contained in:
commit
03245b28fd
22 changed files with 278 additions and 127 deletions
15
appveyor.yml
15
appveyor.yml
|
@ -9,7 +9,7 @@ environment:
|
|||
# c:\mingw-w64 i686 has gcc 6.3.0, so use c:\msys64 7.3.0 instead
|
||||
MINGW_SDK: c:\msys64\mingw32
|
||||
# c:\msys64 x86_64 has gcc 8.2.0, so use c:\mingw-w64 7.3.0 instead
|
||||
MINGW_SDK_64: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64
|
||||
MINGW_SDK_64: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64
|
||||
CFLAGS: -Wall -W -Werror -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3 -Wno-tautological-compare -Wno-error=suggest-attribute=noreturn
|
||||
NASM_ZIP: nasm-2.12.01
|
||||
NASM_URL: http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/win64/nasm-2.12.01-win64.zip
|
||||
|
@ -55,8 +55,6 @@ cache:
|
|||
install:
|
||||
- if [%CONFIGURATION%] == [SDL64] ( set "X86_64=1" )
|
||||
- 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 "CCACHE_CC=%CCACHE_CC_64%" )
|
||||
|
||||
|
@ -75,13 +73,6 @@ install:
|
|||
configuration:
|
||||
- SDL
|
||||
- SDL64
|
||||
- DD
|
||||
- DD64
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- configuration: DD
|
||||
- configuration: DD64
|
||||
|
||||
before_build:
|
||||
- set "Path=%MINGW_SDK%\bin;%Path%"
|
||||
|
@ -92,8 +83,8 @@ before_build:
|
|||
- ccache -V
|
||||
- ccache -s
|
||||
- if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" )
|
||||
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 GCC73=1 NOOBJDUMP=1 %NOUPX%"
|
||||
- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1" ) else ( set "MINGW_FLAGS=MINGW=1 GCC91=1" )
|
||||
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 NOOBJDUMP=1 %NOUPX%"
|
||||
- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1 GCC81=1" ) else ( set "MINGW_FLAGS=MINGW=1 GCC91=1" )
|
||||
- set "SRB2_MFLAGS=%SRB2_MFLAGS% %MINGW_FLAGS% %CONFIGURATION%=1"
|
||||
|
||||
build_script:
|
||||
|
|
|
@ -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?!");
|
||||
|
|
|
@ -427,20 +427,21 @@ static void COM_TokenizeString(char *ptext)
|
|||
|
||||
com_argc = 0;
|
||||
com_args = NULL;
|
||||
|
||||
if (ptext[0] == '\033')
|
||||
{
|
||||
com_flags = (unsigned)ptext[1];
|
||||
ptext += 2;
|
||||
}
|
||||
else
|
||||
com_flags = 0;
|
||||
com_flags = 0;
|
||||
|
||||
while (com_argc < MAX_ARGS)
|
||||
{
|
||||
// Skip whitespace up to a newline.
|
||||
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,
|
||||
// thus end of this command's args too.
|
||||
|
@ -2169,8 +2170,13 @@ skipwhite:
|
|||
com_token[len] = 0;
|
||||
return data;
|
||||
}
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
if (c == '\033')
|
||||
data++;
|
||||
else
|
||||
{
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2186,10 +2192,22 @@ skipwhite:
|
|||
// parse a regular word
|
||||
do
|
||||
{
|
||||
com_token[len] = c;
|
||||
data++;
|
||||
len++;
|
||||
c = *data;
|
||||
if (c == '\033')
|
||||
{
|
||||
do
|
||||
{
|
||||
data += 2;
|
||||
c = *data;
|
||||
}
|
||||
while (c == '\033') ;
|
||||
}
|
||||
else
|
||||
{
|
||||
com_token[len] = c;
|
||||
data++;
|
||||
len++;
|
||||
c = *data;
|
||||
}
|
||||
if (c == '{' || c == '}' || c == ')'|| c == '(' || c == '\'')
|
||||
break;
|
||||
} while (c > 32);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -2985,8 +2985,8 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
|||
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_joinnextround = {"joinnextround", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done
|
||||
consvar_t cv_allownewplayer = {"allowjoin", "On", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
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}};
|
||||
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}};
|
||||
|
|
34
src/d_main.c
34
src/d_main.c
|
@ -1169,26 +1169,6 @@ void D_SRB2Main(void)
|
|||
if (M_CheckParm("-server") || dedicated)
|
||||
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");
|
||||
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
|
||||
|
||||
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();
|
||||
|
||||
//---------------------------------------------------- READY SCREEN
|
||||
|
|
|
@ -842,7 +842,9 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_fullscreen);
|
||||
CV_RegisterVar(&cv_renderview);
|
||||
CV_RegisterVar(&cv_renderer);
|
||||
#ifdef HWRENDER
|
||||
CV_RegisterVar(&cv_newrenderer);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_scr_depth);
|
||||
CV_RegisterVar(&cv_scr_width);
|
||||
CV_RegisterVar(&cv_scr_height);
|
||||
|
@ -1804,18 +1806,15 @@ static void Command_Map_f(void)
|
|||
boolean newresetplayers;
|
||||
|
||||
boolean mustmodifygame;
|
||||
boolean usemapcode = false;
|
||||
|
||||
INT32 newmapnum;
|
||||
|
||||
char * mapname;
|
||||
size_t mapnamelen;
|
||||
char *realmapname = NULL;
|
||||
|
||||
INT32 newgametype = gametype;
|
||||
|
||||
INT32 d;
|
||||
char *p;
|
||||
|
||||
if (client && !IsPlayerAdmin(consoleplayer))
|
||||
{
|
||||
|
@ -1875,43 +1874,8 @@ static void Command_Map_f(void)
|
|||
}
|
||||
|
||||
mapname = ConcatCommandArgv(1, first_option);
|
||||
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]) ) == 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);
|
||||
}
|
||||
}
|
||||
newmapnum = G_FindMapByNameOrCode(mapname, &realmapname);
|
||||
|
||||
if (newmapnum == 0)
|
||||
{
|
||||
|
@ -1920,11 +1884,6 @@ static void Command_Map_f(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (usemapcode)
|
||||
{
|
||||
realmapname = G_BuildMapTitle(newmapnum);
|
||||
}
|
||||
|
||||
if (mustmodifygame && option_force)
|
||||
{
|
||||
G_SetGameModified(false);
|
||||
|
@ -2203,6 +2162,8 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
|
|||
else
|
||||
S_ResumeAudio();
|
||||
}
|
||||
|
||||
I_UpdateMouseGrab();
|
||||
}
|
||||
|
||||
// Command for stuck characters in netgames, griefing, etc.
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,6 +150,8 @@ void I_GetJoystick2Events(void){}
|
|||
|
||||
void I_GetMouseEvents(void){}
|
||||
|
||||
void I_UpdateMouseGrab(void){}
|
||||
|
||||
char *I_GetEnv(const char *name)
|
||||
{
|
||||
(void)name;
|
||||
|
|
56
src/g_game.c
56
src/g_game.c
|
@ -1832,6 +1832,7 @@ void G_DoLoadLevel(boolean resetplayer)
|
|||
titlemapinaction = TITLEMAP_OFF;
|
||||
|
||||
G_SetGamestate(GS_LEVEL);
|
||||
I_UpdateMouseGrab();
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
@ -4536,6 +4537,61 @@ void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc)
|
|||
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
|
||||
//
|
||||
|
|
|
@ -130,6 +130,9 @@ INT32 G_FindMap(const char *query, char **foundmapnamep,
|
|||
mapsearchfreq_t **freqp, 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
|
||||
mapthing_t *G_FindCTFStart(INT32 playernum);
|
||||
mapthing_t *G_FindMatchStart(INT32 playernum);
|
||||
|
|
|
@ -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!
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
104
src/m_menu.c
104
src/m_menu.c
|
@ -389,7 +389,9 @@ static void M_ResetCvars(void);
|
|||
|
||||
// Consvar onchange functions
|
||||
static void Newgametype_OnChange(void);
|
||||
#ifdef HWRENDER
|
||||
static void Newrenderer_OnChange(void);
|
||||
#endif
|
||||
static void Dummymares_OnChange(void);
|
||||
|
||||
// ==========================================================================
|
||||
|
@ -414,8 +416,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};
|
||||
|
||||
#ifdef HWRENDER
|
||||
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! */
|
||||
#endif
|
||||
|
||||
static CV_PossibleValue_t serversort_cons_t[] = {
|
||||
{0,"Ping"},
|
||||
|
@ -1216,7 +1220,11 @@ static menuitem_t OP_VideoOptionsMenu[] =
|
|||
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 11},
|
||||
#endif
|
||||
{IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 16},
|
||||
#ifdef HWRENDER
|
||||
{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_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness (F11)", &cv_globalgamma,36},
|
||||
|
@ -2229,6 +2237,7 @@ static void Newgametype_OnChange(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
static void Newrenderer_AREYOUSURE(INT32 c)
|
||||
{
|
||||
int n;
|
||||
|
@ -2266,6 +2275,7 @@ static void Newrenderer_OnChange(void)
|
|||
);
|
||||
}
|
||||
}
|
||||
#endif/*HWRENDER*/
|
||||
|
||||
void Screenshot_option_Onchange(void)
|
||||
{
|
||||
|
@ -2867,6 +2877,7 @@ static void M_GoBack(INT32 choice)
|
|||
|
||||
menuactive = false;
|
||||
wipetypepre = menupres[M_GetYoungestChildMenu()].exitwipe;
|
||||
I_UpdateMouseGrab();
|
||||
D_StartTitle();
|
||||
}
|
||||
else
|
||||
|
@ -2973,7 +2984,7 @@ static void M_NextOpt(void)
|
|||
itemOn = 0;
|
||||
else
|
||||
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)
|
||||
|
@ -2985,7 +2996,7 @@ static void M_PrevOpt(void)
|
|||
itemOn = currentMenu->numitems - 1;
|
||||
else
|
||||
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
|
||||
|
@ -3211,10 +3222,7 @@ boolean M_Responder(event_t *ev)
|
|||
|
||||
case KEY_ESCAPE: // Pop up menu
|
||||
if (chat_on)
|
||||
{
|
||||
HU_clearChatChars();
|
||||
chat_on = false;
|
||||
}
|
||||
else
|
||||
M_StartControlPanel();
|
||||
return true;
|
||||
|
@ -3592,6 +3600,8 @@ void M_ClearMenus(boolean callexitmenufunc)
|
|||
currentMenu = &MainDef; // Not like it matters
|
||||
menuactive = false;
|
||||
hidetitlemap = false;
|
||||
|
||||
I_UpdateMouseGrab();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -3619,11 +3629,11 @@ void M_SetupNextMenu(menu_t *menudef)
|
|||
|
||||
// the curent item can be disabled,
|
||||
// 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++)
|
||||
{
|
||||
if ((currentMenu->menuitems[i].status & IT_TYPE) != IT_SPACE)
|
||||
if (!( (currentMenu->menuitems[i].status & IT_TYPE) & IT_SPACE ))
|
||||
{
|
||||
itemOn = i;
|
||||
break;
|
||||
|
@ -4306,7 +4316,18 @@ static void M_DrawGenericScrollMenu(void)
|
|||
}
|
||||
break;
|
||||
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;
|
||||
case IT_QUESTIONMARKS:
|
||||
V_DrawString(x, y, V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
|
||||
|
@ -10485,15 +10506,78 @@ static void M_HandleConnectIP(INT32 choice)
|
|||
break;
|
||||
|
||||
case KEY_DEL:
|
||||
if (setupm_ip[0])
|
||||
if (setupm_ip[0] && !shiftdown) // Shift+Delete is used for something else.
|
||||
{
|
||||
S_StartSound(NULL,sfx_menu1); // Tails
|
||||
setupm_ip[0] = 0;
|
||||
}
|
||||
break;
|
||||
if (!shiftdown) // Shift+Delete is used for something else.
|
||||
break;
|
||||
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
l = strlen(setupm_ip);
|
||||
|
||||
if ( ctrldown ) {
|
||||
switch (choice) {
|
||||
case 'v':
|
||||
case 'V': // ctrl+v, pasting
|
||||
{
|
||||
const char *paste = I_ClipboardPaste();
|
||||
|
||||
if (paste != NULL) {
|
||||
strncat(setupm_ip, paste, 28-1 - l); // Concat the ip field with clipboard
|
||||
if (strlen(paste) != 0) // Don't play sound if nothing was pasted
|
||||
S_StartSound(NULL,sfx_menu1); // Tails
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case KEY_INS:
|
||||
case 'c':
|
||||
case 'C': // ctrl+c, ctrl+insert, copying
|
||||
I_ClipboardCopy(setupm_ip, l);
|
||||
S_StartSound(NULL,sfx_menu1); // Tails
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
case 'X': // ctrl+x, cutting
|
||||
I_ClipboardCopy(setupm_ip, l);
|
||||
S_StartSound(NULL,sfx_menu1); // Tails
|
||||
setupm_ip[0] = 0;
|
||||
break;
|
||||
|
||||
default: // otherwise do nothing
|
||||
break;
|
||||
}
|
||||
break; // don't check for typed keys
|
||||
}
|
||||
|
||||
if ( shiftdown ) {
|
||||
switch (choice) {
|
||||
case KEY_INS: // shift+insert, pasting
|
||||
{
|
||||
const char *paste = I_ClipboardPaste();
|
||||
|
||||
if (paste != NULL) {
|
||||
strncat(setupm_ip, paste, 28-1 - l); // Concat the ip field with clipboard
|
||||
if (strlen(paste) != 0) // Don't play sound if nothing was pasted
|
||||
S_StartSound(NULL,sfx_menu1); // Tails
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case KEY_DEL: // shift+delete, cutting
|
||||
I_ClipboardCopy(setupm_ip, l);
|
||||
S_StartSound(NULL,sfx_menu1); // Tails
|
||||
setupm_ip[0] = 0;
|
||||
break;
|
||||
default: // otherwise do nothing.
|
||||
break;
|
||||
}
|
||||
break; // don't check for typed keys
|
||||
}
|
||||
|
||||
if (l >= 28-1)
|
||||
break;
|
||||
|
||||
|
|
|
@ -222,13 +222,14 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt);
|
|||
|
||||
// flags for items in the menu
|
||||
// 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_SPACE 1 // no handling
|
||||
#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_SUBMENU 6 // go to sub menu
|
||||
#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_DISPLAY (48+64+128) // 16+32+64+128
|
||||
|
|
|
@ -324,8 +324,8 @@ UINT8 ASTBlendPixel_8bpp(UINT8 background, UINT8 foreground, int style, UINT8 al
|
|||
else if (style != AST_TRANSLUCENT)
|
||||
{
|
||||
RGBA_t texel;
|
||||
RGBA_t bg = V_GetColor(background);
|
||||
RGBA_t fg = V_GetColor(foreground);
|
||||
RGBA_t bg = V_GetMasterColor(background);
|
||||
RGBA_t fg = V_GetMasterColor(foreground);
|
||||
texel.rgba = ASTBlendPixel(bg, fg, style, alpha);
|
||||
return NearestColor(texel.s.red, texel.s.green, texel.s.blue);
|
||||
}
|
||||
|
@ -1664,7 +1664,7 @@ static void R_CreateFadeColormaps(void)
|
|||
#define GETCOLOR \
|
||||
px = colormaps[i%256]; \
|
||||
fade = (i/256) * (256 / FADECOLORMAPROWS); \
|
||||
rgba = V_GetColor(px);
|
||||
rgba = V_GetMasterColor(px);
|
||||
|
||||
// to black
|
||||
makeblack:
|
||||
|
|
|
@ -985,7 +985,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
|||
|
||||
//
|
||||
// R_SplitSprite
|
||||
// runs through a sector's lightlist and
|
||||
// runs through a sector's lightlist and Knuckles
|
||||
static void R_SplitSprite(vissprite_t *sprite)
|
||||
{
|
||||
INT32 i, lightnum, lindex;
|
||||
|
|
15
src/screen.c
15
src/screen.c
|
@ -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};
|
||||
|
||||
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};
|
||||
|
||||
static void SCR_ChangeFullscreen(void);
|
||||
|
@ -454,9 +460,12 @@ void SCR_ChangeRenderer(void)
|
|||
if (con_startup)
|
||||
{
|
||||
target_renderer = cv_renderer.value;
|
||||
#ifdef HWRENDER
|
||||
if (M_CheckParm("-opengl"))
|
||||
target_renderer = rendermode = render_opengl;
|
||||
else if (M_CheckParm("-software"))
|
||||
else
|
||||
#endif
|
||||
if (M_CheckParm("-software"))
|
||||
target_renderer = rendermode = render_soft;
|
||||
// set cv_renderer back
|
||||
SCR_ChangeRendererCVars(rendermode);
|
||||
|
@ -477,7 +486,9 @@ void SCR_ChangeRendererCVars(INT32 mode)
|
|||
CV_StealthSetValue(&cv_renderer, 1);
|
||||
else if (mode == render_opengl)
|
||||
CV_StealthSetValue(&cv_renderer, 2);
|
||||
#ifdef HWRENDER
|
||||
CV_StealthSetValue(&cv_newrenderer, cv_renderer.value);
|
||||
#endif
|
||||
}
|
||||
|
||||
boolean SCR_IsAspectCorrect(INT32 width, INT32 height)
|
||||
|
|
|
@ -184,7 +184,9 @@ extern UINT8 *scr_borderpatch; // patch used to fill the view borders
|
|||
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;
|
||||
#ifdef HWRENDER
|
||||
extern consvar_t cv_newrenderer;
|
||||
#endif
|
||||
// wait for page flipping to end or not
|
||||
extern consvar_t cv_vidwait;
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "../s_sound.h"
|
||||
#include "../i_joy.h"
|
||||
#include "../st_stuff.h"
|
||||
#include "../hu_stuff.h"
|
||||
#include "../g_game.h"
|
||||
#include "../i_video.h"
|
||||
#include "../console.h"
|
||||
|
@ -99,6 +100,7 @@ boolean highcolor = false;
|
|||
// synchronize page flipping with screen refresh
|
||||
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_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
|
||||
|
||||
|
@ -108,6 +110,7 @@ static SDL_bool disable_fullscreen = SDL_FALSE;
|
|||
#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)?0:cv_fullscreen.value
|
||||
static SDL_bool disable_mouse = SDL_FALSE;
|
||||
#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 MOUSEBUTTONS_MAX MOUSEBUTTONS
|
||||
|
||||
|
@ -378,12 +381,15 @@ static void SDLdoUngrabMouse(void)
|
|||
void SDLforceUngrabMouse(void)
|
||||
{
|
||||
if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO && window != NULL)
|
||||
{
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
SDL_SetWindowGrab(window, SDL_FALSE);
|
||||
wrapmouseok = SDL_FALSE;
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
}
|
||||
SDLdoUngrabMouse();
|
||||
}
|
||||
|
||||
void I_UpdateMouseGrab(void)
|
||||
{
|
||||
if (SDL_WasInit(SDL_INIT_VIDEO) == SDL_INIT_VIDEO && window != NULL
|
||||
&& SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window
|
||||
&& USE_MOUSEINPUT && !IGNORE_MOUSE)
|
||||
SDLdoGrabMouse();
|
||||
}
|
||||
|
||||
static void VID_Command_NumModes_f (void)
|
||||
|
@ -590,7 +596,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
|||
}
|
||||
//else firsttimeonmouse = SDL_FALSE;
|
||||
|
||||
if (USE_MOUSEINPUT)
|
||||
if (USE_MOUSEINPUT && !IGNORE_MOUSE)
|
||||
SDLdoGrabMouse();
|
||||
}
|
||||
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 boolean firstmove = true;
|
||||
|
||||
if (USE_MOUSEINPUT)
|
||||
{
|
||||
if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window))
|
||||
if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window) || (IGNORE_MOUSE && !firstmove))
|
||||
{
|
||||
SDLdoUngrabMouse();
|
||||
firstmove = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -655,6 +664,7 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
|
|||
mousemovey += -evt.yrel;
|
||||
SDL_SetWindowGrab(window, SDL_TRUE);
|
||||
}
|
||||
firstmove = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -662,6 +672,7 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
|
|||
// of the screen then ignore it.
|
||||
if ((evt.x == realwidth/2) && (evt.y == realheight/2))
|
||||
{
|
||||
firstmove = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -674,6 +685,8 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
|
|||
SDLdoGrabMouse();
|
||||
}
|
||||
}
|
||||
|
||||
firstmove = false;
|
||||
}
|
||||
|
||||
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,
|
||||
// resulting in whatever key was pressed down getting "stuck" if we don't ignore it.
|
||||
// -- Monster Iestyn (28/05/18)
|
||||
if (SDL_GetMouseFocus() != window)
|
||||
if (SDL_GetMouseFocus() != window || IGNORE_MOUSE)
|
||||
return;
|
||||
|
||||
/// \todo inputEvent.button.which
|
||||
|
@ -1069,7 +1082,7 @@ void I_StartupMouse(void)
|
|||
}
|
||||
else
|
||||
firsttimeonmouse = SDL_FALSE;
|
||||
if (cv_usemouse.value)
|
||||
if (cv_usemouse.value && !IGNORE_MOUSE)
|
||||
SDLdoGrabMouse();
|
||||
else
|
||||
SDLdoUngrabMouse();
|
||||
|
@ -1614,6 +1627,7 @@ void I_StartupGraphics(void)
|
|||
COM_AddCommand ("vid_mode", VID_Command_Mode_f);
|
||||
CV_RegisterVar (&cv_vidwait);
|
||||
CV_RegisterVar (&cv_stretch);
|
||||
CV_RegisterVar (&cv_alwaysgrabmouse);
|
||||
disable_mouse = M_CheckParm("-nomouse");
|
||||
disable_fullscreen = M_CheckParm("-win") ? 1 : 0;
|
||||
|
||||
|
@ -1702,12 +1716,7 @@ void I_StartupGraphics(void)
|
|||
SDL_RaiseWindow(window);
|
||||
|
||||
if (mousegrabok && !disable_mouse)
|
||||
{
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
wrapmouseok = SDL_TRUE;
|
||||
SDL_SetWindowGrab(window, SDL_TRUE);
|
||||
}
|
||||
SDLdoGrabMouse();
|
||||
|
||||
graphics_started = true;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue);
|
|||
|
||||
// Retrieve the ARGB value from a palette color index
|
||||
#define V_GetColor(color) (pLocalPalette[color&0xFF])
|
||||
#define V_GetMasterColor(color) (pMasterPalette[color&0xFF])
|
||||
|
||||
// Bottom 8 bits are used for parameter (screen or character)
|
||||
#define V_PARAMMASK 0x000000FF
|
||||
|
|
|
@ -1354,6 +1354,8 @@ getBufferedData:
|
|||
}
|
||||
}
|
||||
|
||||
void I_UpdateMouseGrab(void) {}
|
||||
|
||||
// ===========================================================================================
|
||||
// DIRECT INPUT JOYSTICK
|
||||
// ===========================================================================================
|
||||
|
|
Loading…
Reference in a new issue