Reset player cheat effects when disabling cheats cvar

This commit is contained in:
James R 2022-09-29 02:39:19 -07:00
parent 6426358377
commit 57a3c4109c
3 changed files with 28 additions and 0 deletions

View file

@ -1900,6 +1900,8 @@ void CV_CheatsChanged(void)
// Reset any other cheat command effects here, as well.
cv_debug = 0;
P_ResetPlayerCheats();
}
}

View file

@ -195,6 +195,8 @@ void P_PlayerAfterThink(player_t *player);
void P_DoPlayerExit(player_t *player);
void P_DoTimeOver(player_t *player);
void P_ResetPlayerCheats(void);
void P_InstaThrust(mobj_t *mo, angle_t angle, fixed_t move);
fixed_t P_ReturnThrustX(mobj_t *mo, angle_t angle, fixed_t move);
fixed_t P_ReturnThrustY(mobj_t *mo, angle_t angle, fixed_t move);

View file

@ -4452,3 +4452,27 @@ boolean P_PlayerFullbright(player_t *player)
{
return (player->invincibilitytimer > 0);
}
void P_ResetPlayerCheats(void)
{
INT32 i;
for (i = 0; i < MAXPLAYERS; i++)
{
player_t *player = &players[i];
mobj_t *thing = player->mo;
if (!playeringame[i])
continue;
player->pflags &= ~(PF_GODMODE);
if (P_MobjWasRemoved(thing))
continue;
thing->flags &= ~(MF_NOCLIP);
thing->destscale = mapobjectscale;
P_SetScale(thing, thing->destscale);
}
}