d_netcmd.c: Fix errors with multiple _OnChange functions

- Skin_OnChange
    - Now always checks for cheats for any machine-local player skin change in non-netgame, non-K_CanChangeRules contexts
    - Previously applied only to consoleplayer in Time Trial
- Color_OnChange
    - Fixes straight up incorrect condition that prevented honest players from changing color mid-game via the developer console
This commit is contained in:
toaster 2023-08-23 18:24:45 +01:00
parent e7dc2cda0c
commit b0ee900422

View file

@ -6833,14 +6833,11 @@ static void Skin_OnChange(const UINT8 p)
return; return;
} }
if (p == 0) if (!CV_CheatsEnabled() && !(netgame || K_CanChangeRules(false))
&& (gamestate != GS_WAITINGPLAYERS)) // allows command line -warp x +skin y
{ {
if (!CV_CheatsEnabled() && !(multiplayer || netgame) // In single player. CV_StealthSet(&cv_skin[p], skins[players[g_localplayers[p]].skin].name);
&& (gamestate != GS_WAITINGPLAYERS)) // allows command line -warp x +skin y return;
{
CV_StealthSet(&cv_skin[p], skins[players[g_localplayers[p]].skin].name);
return;
}
} }
if (CanChangeSkin(g_localplayers[p])) if (CanChangeSkin(g_localplayers[p]))
@ -6890,7 +6887,7 @@ static void Color_OnChange(const UINT8 p)
UINT16 color = cv_playercolor[p].value; UINT16 color = cv_playercolor[p].value;
boolean colorisgood = (color == SKINCOLOR_NONE || K_ColorUsable(color, false, true) == true); boolean colorisgood = (color == SKINCOLOR_NONE || K_ColorUsable(color, false, true) == true);
if (Playing() && splitscreen < p) if (Playing() && p <= splitscreen)
{ {
if (P_PlayerMoving(g_localplayers[p]) == true) if (P_PlayerMoving(g_localplayers[p]) == true)
{ {