From b0ee900422b43c28ab4213a74c8fec8e881765de Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 23 Aug 2023 18:24:45 +0100 Subject: [PATCH] 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 --- src/d_netcmd.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b5a987635..80eea8703 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -6833,14 +6833,11 @@ static void Skin_OnChange(const UINT8 p) 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. - && (gamestate != GS_WAITINGPLAYERS)) // allows command line -warp x +skin y - { - CV_StealthSet(&cv_skin[p], skins[players[g_localplayers[p]].skin].name); - return; - } + CV_StealthSet(&cv_skin[p], skins[players[g_localplayers[p]].skin].name); + return; } if (CanChangeSkin(g_localplayers[p])) @@ -6890,7 +6887,7 @@ static void Color_OnChange(const UINT8 p) UINT16 color = cv_playercolor[p].value; 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) {