From b1c3d1b2e7e3db62a2a720e6f4714702e7976f0d Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 2 Apr 2023 05:20:36 -0700 Subject: [PATCH] noclip command: toggle MF_NOCLIPHEIGHT in spectator --- src/d_netcmd.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1101172a2..1287aa99d 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5606,12 +5606,22 @@ static void Got_Cheat(UINT8 **cp, INT32 playernum) if (!P_MobjWasRemoved(player->mo)) { - player->mo->flags ^= MF_NOCLIP; + UINT32 noclipFlags = MF_NOCLIP; - if (!(player->mo->flags & MF_NOCLIP)) + if (player->spectator) { + noclipFlags |= MF_NOCLIPHEIGHT; + } + + if (player->mo->flags & MF_NOCLIP) + { + player->mo->flags &= ~(noclipFlags); status = "off"; } + else + { + player->mo->flags |= noclipFlags; + } } CV_CheaterWarning(targetPlayer, va("noclip %s", status));