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 next
This commit is contained in:
commit
0c40a466d8
9 changed files with 152 additions and 88 deletions
|
@ -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 += 2;
|
||||
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);
|
||||
|
|
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
|
||||
|
|
|
@ -849,7 +849,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);
|
||||
|
@ -1811,18 +1813,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))
|
||||
{
|
||||
|
@ -1882,43 +1881,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)
|
||||
{
|
||||
|
@ -1927,11 +1891,6 @@ static void Command_Map_f(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (usemapcode)
|
||||
{
|
||||
realmapname = G_BuildMapTitle(newmapnum);
|
||||
}
|
||||
|
||||
if (mustmodifygame && option_force)
|
||||
{
|
||||
G_SetGameModified(false);
|
||||
|
|
55
src/g_game.c
55
src/g_game.c
|
@ -4829,6 +4829,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);
|
||||
|
|
31
src/m_menu.c
31
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)
|
||||
{
|
||||
|
@ -2973,7 +2983,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 +2995,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
|
||||
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
|
|
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue