diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 5710617d6..7fc0cf2a7 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -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); } diff --git a/src/d_netcmd.h b/src/d_netcmd.h index c9006a7ba..61171d393 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -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; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index a457fe774..cd4277dc6 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -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) { diff --git a/src/k_kart.c b/src/k_kart.c index 3afd92124..61f7dc2f9 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -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(); diff --git a/src/lua_script.c b/src/lua_script.c index 17dd61a8d..ed35d9e69 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -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")) { diff --git a/src/p_inter.c b/src/p_inter.c index c9121620e..3938b90d8 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -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 ;; { diff --git a/src/p_saveg.c b/src/p_saveg.c index 75c08b834..2e0838212 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -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;