From d9713669f1d9d62717bc99c8a02137039105b8ca Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 22 Jan 2012 00:31:42 +0000 Subject: [PATCH] - Fixed: Totally freezing a player did not ignore crouch toggling. SVN r3341 (trunk) --- src/d_net.cpp | 5 +++-- src/d_player.h | 2 ++ src/p_user.cpp | 11 ++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index 3ee20b8b64..0af22bf7b0 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -2353,9 +2353,10 @@ void Net_DoCommand (int type, BYTE **stream, int player) case DEM_CROUCH: if (gamestate == GS_LEVEL && players[player].mo != NULL && - players[player].health > 0 && !(players[player].oldbuttons & BT_JUMP)) + players[player].health > 0 && !(players[player].oldbuttons & BT_JUMP) && + !P_IsPlayerTotallyFrozen(&players[player])) { - players[player].crouching = players[player].crouchdir<0? 1 : -1; + players[player].crouching = players[player].crouchdir < 0 ? 1 : -1; } break; diff --git a/src/d_player.h b/src/d_player.h index abd4635906..2b9c7b2f23 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -426,6 +426,8 @@ void P_CheckPlayerSprites(); #define CROUCHSPEED (FRACUNIT/12) +bool P_IsPlayerTotallyFrozen(const player_t *player); + // [GRB] Custom player classes enum { diff --git a/src/p_user.cpp b/src/p_user.cpp index 49495c19fe..28250f9ddc 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2126,9 +2126,7 @@ void P_PlayerThink (player_t *player) player->mo->flags &= ~MF_JUSTATTACKED; } - bool totallyfrozen = (player->cheats & CF_TOTALLYFROZEN || gamestate == GS_TITLELEVEL || - (( level.flags2 & LEVEL2_FROZEN ) && ( player == NULL || !( player->cheats & CF_TIMEFREEZE ))) - ); + bool totallyfrozen = P_IsPlayerTotallyFrozen(player); // [RH] Being totally frozen zeros out most input parameters. if (totallyfrozen) @@ -2723,3 +2721,10 @@ void P_EnumPlayerColorSets(FName classname, TArray *out) } } +bool P_IsPlayerTotallyFrozen(const player_t *player) +{ + return + gamestate == GS_TITLELEVEL || + player->cheats & CF_TOTALLYFROZEN || + ((level.flags2 & LEVEL2_FROZEN) && !(player->cheats & CF_TIMEFREEZE)); +}