mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add "allowdemos" option to K_CanChangeRules()
It's been used interchangably as "this is a singleplayer gameplay context" and "This is a no cvar changing context". This addition repairs some behaviour which might have been inconsistent between netgame and netreplay.
This commit is contained in:
parent
e7f111c25a
commit
ca2ecf6e9f
10 changed files with 32 additions and 29 deletions
|
|
@ -4032,7 +4032,7 @@ void Schedule_Run(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (K_CanChangeRules() == false)
|
||||
if (K_CanChangeRules(false) == false)
|
||||
{
|
||||
// Don't engage in automation while in a restricted context.
|
||||
return;
|
||||
|
|
@ -4168,7 +4168,7 @@ void Automate_Run(automateEvents_t type)
|
|||
return;
|
||||
}
|
||||
|
||||
if (K_CanChangeRules() == false)
|
||||
if (K_CanChangeRules(false) == false)
|
||||
{
|
||||
// Don't engage in automation while in a restricted context.
|
||||
return;
|
||||
|
|
@ -4963,7 +4963,7 @@ UINT32 secretextratime = 0;
|
|||
*/
|
||||
static void TimeLimit_OnChange(void)
|
||||
{
|
||||
if (K_CanChangeRules() == false)
|
||||
if (K_CanChangeRules(false) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -6570,7 +6570,7 @@ static void Command_ShowTime_f(void)
|
|||
// SRB2Kart: On change messages
|
||||
static void NumLaps_OnChange(void)
|
||||
{
|
||||
if (K_CanChangeRules() == false)
|
||||
if (K_CanChangeRules(false) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -6588,7 +6588,7 @@ static void NumLaps_OnChange(void)
|
|||
|
||||
static void KartFrantic_OnChange(void)
|
||||
{
|
||||
if (K_CanChangeRules() == false)
|
||||
if (K_CanChangeRules(false) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -6606,7 +6606,7 @@ static void KartFrantic_OnChange(void)
|
|||
|
||||
static void KartSpeed_OnChange(void)
|
||||
{
|
||||
if (K_CanChangeRules() == false)
|
||||
if (K_CanChangeRules(false) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -6624,7 +6624,7 @@ static void KartSpeed_OnChange(void)
|
|||
|
||||
static void KartEncore_OnChange(void)
|
||||
{
|
||||
if (K_CanChangeRules() == false)
|
||||
if (K_CanChangeRules(false) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -6634,7 +6634,7 @@ static void KartEncore_OnChange(void)
|
|||
|
||||
static void KartEliminateLast_OnChange(void)
|
||||
{
|
||||
if (K_CanChangeRules() == false)
|
||||
if (K_CanChangeRules(false) == false)
|
||||
{
|
||||
CV_StealthSet(&cv_karteliminatelast, cv_karteliminatelast.defaultvalue);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3920,7 +3920,7 @@ static void G_GetNextMap(void)
|
|||
nextmap = cm;
|
||||
}
|
||||
|
||||
if (K_CanChangeRules())
|
||||
if (K_CanChangeRules(true))
|
||||
{
|
||||
switch (cv_advancemap.value)
|
||||
{
|
||||
|
|
@ -4013,8 +4013,9 @@ static void G_DoCompleted(void)
|
|||
}
|
||||
}
|
||||
|
||||
// See Y_StartIntermission timer handling
|
||||
if ((gametyperules & GTR_CIRCUIT) && ((multiplayer && demo.playback) || j == r_splitscreen+1) && (!K_CanChangeRules(false) || cv_inttime.value > 0))
|
||||
// play some generic music if there's no win/cool/lose music going on (for exitlevel commands)
|
||||
if ((gametyperules & GTR_CIRCUIT) && ((multiplayer && demo.playback) || j == r_splitscreen+1) && (!K_CanChangeRules() || cv_inttime.value > 0))
|
||||
S_ChangeMusicInternal("racent", true);
|
||||
|
||||
if (automapactive)
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ void K_CheckBumpers(void)
|
|||
winnerscoreadd -= players[i].roundscore;
|
||||
}
|
||||
|
||||
if (K_CanChangeRules() == false)
|
||||
if (K_CanChangeRules(true) == false)
|
||||
{
|
||||
if (nobumpers)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -697,18 +697,12 @@ void K_PlayerLoseLife(player_t *player)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_CanChangeRules(void)
|
||||
boolean K_CanChangeRules(boolean allowdemos)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
boolean K_CanChangeRules(void)
|
||||
boolean K_CanChangeRules(boolean allowdemos)
|
||||
{
|
||||
if (demo.playback)
|
||||
{
|
||||
// We've already got our important settings!
|
||||
return false;
|
||||
}
|
||||
|
||||
if (grandprixinfo.gp == true && grandprixinfo.roundnum > 0)
|
||||
{
|
||||
// Don't cheat the rules of the GP!
|
||||
|
|
@ -739,5 +733,11 @@ boolean K_CanChangeRules(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!allowdemos && demo.playback)
|
||||
{
|
||||
// We've already got our important settings!
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,18 +152,18 @@ void K_PlayerLoseLife(player_t *player);
|
|||
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_CanChangeRules(void);
|
||||
boolean K_CanChangeRules(boolean allowdemos);
|
||||
|
||||
Returns whenver or not the server is allowed
|
||||
to change the game rules.
|
||||
|
||||
Input Arguments:-
|
||||
None
|
||||
allowdemos - permits this behavior during demo playback
|
||||
|
||||
Return:-
|
||||
true if can change important gameplay rules, otherwise false.
|
||||
--------------------------------------------------*/
|
||||
|
||||
boolean K_CanChangeRules(void);
|
||||
boolean K_CanChangeRules(boolean allowdemos);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4400,7 +4400,7 @@ void M_InitOptions(INT32 choice)
|
|||
|
||||
// enable gameplay & server options under the right circumstances.
|
||||
if (gamestate == GS_MENU
|
||||
|| ((server || IsPlayerAdmin(consoleplayer)) && K_CanChangeRules()))
|
||||
|| ((server || IsPlayerAdmin(consoleplayer)) && K_CanChangeRules(false)))
|
||||
{
|
||||
OPTIONS_MainDef.menuitems[mopt_gameplay].status = IT_STRING | IT_SUBMENU;
|
||||
OPTIONS_MainDef.menuitems[mopt_server].status = IT_STRING | IT_SUBMENU;
|
||||
|
|
@ -5736,7 +5736,7 @@ void M_OpenPauseMenu(void)
|
|||
|
||||
Dummymenuplayer_OnChange(); // Make sure the consvar is within bounds of the amount of splitscreen players we have.
|
||||
|
||||
if (K_CanChangeRules())
|
||||
if (K_CanChangeRules(false))
|
||||
{
|
||||
PAUSE_Main[mpause_psetup].status = IT_STRING | IT_CALL;
|
||||
|
||||
|
|
|
|||
|
|
@ -726,7 +726,7 @@ void P_CheckPointLimit(void)
|
|||
if (exitcountdown)
|
||||
return;
|
||||
|
||||
if (!K_CanChangeRules())
|
||||
if (!K_CanChangeRules(true))
|
||||
return;
|
||||
|
||||
if (!cv_pointlimit.value)
|
||||
|
|
@ -898,7 +898,7 @@ boolean P_CheckRacers(void)
|
|||
{
|
||||
tic_t countdown = 30*TICRATE; // 30 seconds left to finish, get going!
|
||||
|
||||
if (K_CanChangeRules() == true)
|
||||
if (K_CanChangeRules(true) == true)
|
||||
{
|
||||
// Custom timer
|
||||
countdown = cv_countdowntime.value * TICRATE;
|
||||
|
|
|
|||
|
|
@ -3853,7 +3853,7 @@ static void P_InitGametype(void)
|
|||
|
||||
if (gametyperules & GTR_CIRCUIT)
|
||||
{
|
||||
if (K_CanChangeRules() && cv_numlaps.value
|
||||
if (K_CanChangeRules(true) && cv_numlaps.value
|
||||
&& (!(mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
|
||||
|| (mapheaderinfo[gamemap - 1]->numlaps > cv_numlaps.value)))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1288,7 +1288,8 @@ void P_DoPlayerExit(player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
if (!K_CanChangeRules() || cv_inttime.value > 0)
|
||||
// See Y_StartIntermission timer handling
|
||||
if (!K_CanChangeRules(false) || cv_inttime.value > 0)
|
||||
P_EndingMusic(player);
|
||||
|
||||
if (P_CheckRacers() && !exitcountdown)
|
||||
|
|
|
|||
|
|
@ -801,7 +801,8 @@ void Y_StartIntermission(void)
|
|||
powertype = K_UsingPowerLevels();
|
||||
|
||||
// determine the tic the intermission ends
|
||||
if (!K_CanChangeRules())
|
||||
// Technically cv_inttime is saved to demos... but this permits having extremely long timers for post-netgame chatting without stranding you on the intermission in netreplays.
|
||||
if (!K_CanChangeRules(false))
|
||||
{
|
||||
timer = 10*TICRATE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue