mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 15:32:33 +00:00
point limit/time limit
This commit is contained in:
parent
396106829a
commit
04ee98a1a1
3 changed files with 33 additions and 11 deletions
|
@ -328,6 +328,10 @@ consvar_t cv_numlaps = {"numlaps", "4", CV_NETVAR|CV_CALL|CV_NOINIT, numlaps_con
|
|||
static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, "Map default"}, {0, NULL}};
|
||||
consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Point and time limits for every gametype
|
||||
INT32 pointlimits[NUMGAMETYPES];
|
||||
INT32 timelimits[NUMGAMETYPES];
|
||||
|
||||
// log elemental hazards -- not a netvar, is local to current player
|
||||
consvar_t cv_hazardlog = {"hazardlog", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
@ -3951,6 +3955,15 @@ void D_GameTypeChanged(INT32 lastgametype)
|
|||
if (!cv_itemrespawntime.changed)
|
||||
CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally
|
||||
break;
|
||||
default:
|
||||
if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits
|
||||
{
|
||||
CV_SetValue(&cv_timelimit, timelimits[gametype]);
|
||||
CV_SetValue(&cv_pointlimit, pointlimits[gametype]);
|
||||
}
|
||||
if (!cv_itemrespawntime.changed)
|
||||
CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!multiplayer && !netgame)
|
||||
|
|
|
@ -60,9 +60,12 @@ extern consvar_t cv_flagtime;
|
|||
extern consvar_t cv_touchtag;
|
||||
extern consvar_t cv_hidetime;
|
||||
|
||||
extern consvar_t cv_friendlyfire;
|
||||
extern consvar_t cv_pointlimit;
|
||||
extern consvar_t cv_timelimit;
|
||||
extern INT32 pointlimits[NUMGAMETYPES];
|
||||
extern INT32 timelimits[NUMGAMETYPES];
|
||||
|
||||
extern consvar_t cv_friendlyfire;
|
||||
extern consvar_t cv_numlaps;
|
||||
extern consvar_t cv_basenumlaps;
|
||||
extern UINT32 timelimitintics;
|
||||
|
|
|
@ -1152,6 +1152,8 @@ static void readgametype(MYFILE *f, char *gtname)
|
|||
INT16 newgtidx = 0;
|
||||
UINT32 newgtrules = 0;
|
||||
UINT32 newgttol = 0;
|
||||
INT32 newgtpointlimit = 0;
|
||||
INT32 newgttimelimit = 0;
|
||||
UINT8 newgtleftcolor = 0;
|
||||
UINT8 newgtrightcolor = 0;
|
||||
int newgtinttype = 0;
|
||||
|
@ -1223,31 +1225,31 @@ static void readgametype(MYFILE *f, char *gtname)
|
|||
word2[strlen(word2)-1] = '\0';
|
||||
i = atoi(word2);
|
||||
|
||||
// Game type rules
|
||||
if (fastcmp(word, "RULES"))
|
||||
{
|
||||
// Game type rules (GTR_)
|
||||
// GTR_
|
||||
newgtrules = (UINT32)get_number(word2);
|
||||
}
|
||||
// Point and time limits
|
||||
else if (fastcmp(word, "DEFAULTPOINTLIMIT"))
|
||||
newgtpointlimit = (INT32)i;
|
||||
else if (fastcmp(word, "DEFAULTTIMELIMIT"))
|
||||
newgttimelimit = (INT32)i;
|
||||
// Level platter
|
||||
else if (fastcmp(word, "HEADERCOLOR") || fastcmp(word, "HEADERCOLOUR"))
|
||||
{
|
||||
// Level platter
|
||||
newgtleftcolor = newgtrightcolor = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "HEADERLEFTCOLOR") || fastcmp(word, "HEADERLEFTCOLOUR"))
|
||||
{
|
||||
// Level platter
|
||||
newgtleftcolor = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "HEADERRIGHTCOLOR") || fastcmp(word, "HEADERRIGHTCOLOUR"))
|
||||
{
|
||||
// Level platter
|
||||
newgtrightcolor = (UINT8)get_number(word2);
|
||||
}
|
||||
// Type of intermission
|
||||
else if (fastcmp(word, "INTERMISSIONTYPE"))
|
||||
{
|
||||
// Case sensitive
|
||||
newgtinttype = (int)get_number(word2lwr);
|
||||
}
|
||||
// Type of level
|
||||
else if (fastcmp(word, "TYPEOFLEVEL"))
|
||||
{
|
||||
if (i) // it's just a number
|
||||
|
@ -1304,7 +1306,11 @@ static void readgametype(MYFILE *f, char *gtname)
|
|||
newgtidx = G_AddGametype(newgtrules);
|
||||
G_AddGametypeTOL(newgtidx, newgttol);
|
||||
G_SetGametypeDescription(newgtidx, gtdescription, newgtleftcolor, newgtrightcolor);
|
||||
|
||||
// Not covered by G_AddGametype alone.
|
||||
intermissiontypes[newgtidx] = newgtinttype;
|
||||
pointlimits[newgtidx] = newgtpointlimit;
|
||||
timelimits[newgtidx] = newgttimelimit;
|
||||
|
||||
// Write the new gametype name.
|
||||
Gametype_Names[newgtidx] = Z_StrDup((const char *)gtname);
|
||||
|
|
Loading…
Reference in a new issue