mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'refactor-pointlimit' into 'master'
Refactor pointlimit to be delayed until next round, just like timelimit See merge request KartKrew/Kart!966
This commit is contained in:
commit
67062bb920
7 changed files with 41 additions and 21 deletions
|
|
@ -4944,23 +4944,30 @@ static void PointLimit_OnChange(void)
|
|||
return;
|
||||
}
|
||||
|
||||
// Don't allow pointlimit in non-pointlimited gametypes!
|
||||
if (server && Playing() && !(gametyperules & GTR_POINTLIMIT))
|
||||
if (gamestate == GS_LEVEL && leveltime < starttime)
|
||||
{
|
||||
if (cv_pointlimit.value)
|
||||
CV_StealthSetValue(&cv_pointlimit, 0);
|
||||
return;
|
||||
}
|
||||
{
|
||||
CONS_Printf(M_GetText("Point limit has been set to %d.\n"), cv_pointlimit.value);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf(M_GetText("Point limit has been disabled.\n"));
|
||||
}
|
||||
|
||||
if (cv_pointlimit.value)
|
||||
{
|
||||
CONS_Printf(M_GetText("Levels will end after %s scores %d point%s.\n"),
|
||||
G_GametypeHasTeams() ? M_GetText("a team") : M_GetText("someone"),
|
||||
cv_pointlimit.value,
|
||||
cv_pointlimit.value > 1 ? "s" : "");
|
||||
g_pointlimit = cv_pointlimit.value;
|
||||
}
|
||||
else
|
||||
CONS_Printf(M_GetText("Point limit disabled\n"));
|
||||
{
|
||||
if (cv_pointlimit.value)
|
||||
{
|
||||
CONS_Printf(M_GetText("Point limit will be %d next round.\n"), cv_pointlimit.value);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf(M_GetText("Point limit will be disabled next round.\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void NetTimeout_OnChange(void)
|
||||
|
|
@ -4985,6 +4992,8 @@ UINT32 timelimitintics = 0;
|
|||
UINT32 extratimeintics = 0;
|
||||
UINT32 secretextratime = 0;
|
||||
|
||||
UINT32 g_pointlimit = 0;
|
||||
|
||||
/** Deals with a timelimit change by printing the change to the console.
|
||||
* If the gametype is single player, cooperative, or race, the timelimit is
|
||||
* silently disabled again.
|
||||
|
|
@ -6465,7 +6474,7 @@ static void Command_ShowScores_f(void)
|
|||
// FIXME: %lu? what's wrong with %u? ~Callum (produces warnings...)
|
||||
CONS_Printf(M_GetText("%s's score is %u\n"), player_names[i], players[i].score);
|
||||
}
|
||||
CONS_Printf(M_GetText("The pointlimit is %d\n"), cv_pointlimit.value);
|
||||
CONS_Printf(M_GetText("The pointlimit is %d\n"), g_pointlimit);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ extern consvar_t cv_pointlimit;
|
|||
extern consvar_t cv_timelimit;
|
||||
extern consvar_t cv_numlaps;
|
||||
extern UINT32 timelimitintics, extratimeintics, secretextratime;
|
||||
extern UINT32 g_pointlimit;
|
||||
extern consvar_t cv_allowexitlevel;
|
||||
|
||||
extern consvar_t cv_autobalance;
|
||||
|
|
|
|||
|
|
@ -2453,10 +2453,10 @@ static void HU_DrawRankings(void)
|
|||
|
||||
timedone = true;
|
||||
}
|
||||
else if ((gametyperules & GTR_POINTLIMIT) && cv_pointlimit.value > 0)
|
||||
else if ((gametyperules & GTR_POINTLIMIT) && g_pointlimit > 0)
|
||||
{
|
||||
V_DrawCenteredString(64, 8, 0, "POINT LIMIT");
|
||||
V_DrawCenteredString(64, 16, hilicol, va("%d", cv_pointlimit.value));
|
||||
V_DrawCenteredString(64, 16, hilicol, va("%d", g_pointlimit));
|
||||
pointsdone = true;
|
||||
}
|
||||
else if (gametyperules & GTR_CIRCUIT)
|
||||
|
|
@ -2494,10 +2494,10 @@ static void HU_DrawRankings(void)
|
|||
V_DrawCenteredString(256, 16, hilicol, "OVERTIME");
|
||||
}
|
||||
}
|
||||
else if (!pointsdone && (gametyperules & GTR_POINTLIMIT) && cv_pointlimit.value > 0)
|
||||
else if (!pointsdone && (gametyperules & GTR_POINTLIMIT) && g_pointlimit > 0)
|
||||
{
|
||||
V_DrawCenteredString(256, 8, 0, "POINT LIMIT");
|
||||
V_DrawCenteredString(256, 16, hilicol, va("%d", cv_pointlimit.value));
|
||||
V_DrawCenteredString(256, 16, hilicol, va("%d", g_pointlimit));
|
||||
}
|
||||
else if (gametyperules & GTR_CIRCUIT)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ void K_TimerReset(void)
|
|||
numbulbs = 1;
|
||||
inDuel = rainbowstartavailable = false;
|
||||
timelimitintics = extratimeintics = secretextratime = 0;
|
||||
g_pointlimit = 0;
|
||||
}
|
||||
|
||||
void K_TimerInit(void)
|
||||
|
|
@ -206,6 +207,11 @@ void K_TimerInit(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (gametyperules & GTR_POINTLIMIT)
|
||||
{
|
||||
g_pointlimit = cv_pointlimit.value;
|
||||
}
|
||||
|
||||
if (inDuel == true)
|
||||
{
|
||||
K_SpawnDuelOnlyItems();
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ int LUA_PushGlobals(lua_State *L, const char *word)
|
|||
lua_pushinteger(L, timelimitintics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"pointlimit")) {
|
||||
lua_pushinteger(L, cv_pointlimit.value);
|
||||
lua_pushinteger(L, g_pointlimit);
|
||||
return 1;
|
||||
// begin map vars
|
||||
} else if (fastcmp(word,"titlemap")) {
|
||||
|
|
|
|||
|
|
@ -798,7 +798,7 @@ void P_CheckPointLimit(void)
|
|||
if (!K_CanChangeRules(true))
|
||||
return;
|
||||
|
||||
if (!cv_pointlimit.value)
|
||||
if (!g_pointlimit)
|
||||
return;
|
||||
|
||||
if (!(gametyperules & GTR_POINTLIMIT))
|
||||
|
|
@ -811,7 +811,7 @@ void P_CheckPointLimit(void)
|
|||
if (G_GametypeHasTeams())
|
||||
{
|
||||
// Just check both teams
|
||||
if ((UINT32)cv_pointlimit.value <= redscore || (UINT32)cv_pointlimit.value <= bluescore)
|
||||
if (g_pointlimit <= redscore || g_pointlimit <= bluescore)
|
||||
{
|
||||
if (server)
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||
|
|
@ -824,7 +824,7 @@ void P_CheckPointLimit(void)
|
|||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
|
||||
if ((UINT32)cv_pointlimit.value <= players[i].roundscore)
|
||||
if (g_pointlimit <= players[i].roundscore)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++) // AAAAA nested loop using the same iteration variable ;;
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4988,6 +4988,8 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
|
|||
WRITEUINT32(save->p, extratimeintics);
|
||||
WRITEUINT32(save->p, secretextratime);
|
||||
|
||||
WRITEUINT32(save->p, g_pointlimit);
|
||||
|
||||
// Is it paused?
|
||||
if (paused)
|
||||
WRITEUINT8(save->p, 0x2f);
|
||||
|
|
@ -5158,6 +5160,8 @@ static inline boolean P_NetUnArchiveMisc(savebuffer_t *save, boolean reloading)
|
|||
extratimeintics = READUINT32(save->p);
|
||||
secretextratime = READUINT32(save->p);
|
||||
|
||||
g_pointlimit = READUINT32(save->p);
|
||||
|
||||
// Is it paused?
|
||||
if (READUINT8(save->p) == 0x2f)
|
||||
paused = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue