From 127f9eba7fc1cabf4329f4cde93e3e6ec9b7ee14 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Thu, 3 Mar 2022 23:34:01 -0800 Subject: [PATCH] Handle 'frozen' state better. Planting C4 no longer doesn't freeze you. Now dying during freeze time will also call a round-end just like 1.5. --- src/server/defs.h | 10 ---------- src/server/gamerules_multiplayer.qc | 31 +++++++++++++++++++++-------- src/shared/animations.qc | 2 +- src/shared/defs.h | 10 ++++++++++ src/shared/player.h | 29 ++++++++++++++++++++------- src/shared/w_c4bomb.qc | 1 + 6 files changed, 57 insertions(+), 26 deletions(-) diff --git a/src/server/defs.h b/src/server/defs.h index 10b4ea6..8a514e8 100644 --- a/src/server/defs.h +++ b/src/server/defs.h @@ -77,13 +77,3 @@ var int autocvar_fcs_maxmoney = 16000; var int autocvar_fcs_fillweapons = FALSE; /* This will automatically get ammo for the weapon you buy */ var int autocvar_fcs_fix_bombtimer = TRUE; /* If true, the bomb-timer will dictate the round-end */ var int autocvar_fcs_bombaltthrow = TRUE; /* Randomize the bomb-throw every time ever so slightly */ - -enum -{ - GAME_INACTIVE, - GAME_COMMENCING, - GAME_FREEZE, - GAME_ACTIVE, - GAME_END, - GAME_OVER -}; diff --git a/src/server/gamerules_multiplayer.qc b/src/server/gamerules_multiplayer.qc index 8dc477c..c596c02 100644 --- a/src/server/gamerules_multiplayer.qc +++ b/src/server/gamerules_multiplayer.qc @@ -107,12 +107,6 @@ CSMultiplayerRules::PlayerPreFrame(base_player pl) { player pp = (player)pl; - if (pl.health <= 0) - return; - - if (g_cs_gamestate == GAME_FREEZE || pp.progress > 0.0f) { - pl.flags |= FL_FROZEN; - } } void @@ -237,6 +231,17 @@ CSMultiplayerRules::TimerBegin(float tleft, int mode) g_cs_gamestate = GAME_FREEZE; } else if (mode == GAME_ACTIVE) { g_cs_gamestate = GAME_ACTIVE; + CountPlayers(); + + /* if no players are present in the chosen team, force restart round */ + if ((g_cs_alive_t == 0)) { + RoundOver(TEAM_CT, 3600, FALSE); + return; + } else if (g_cs_alive_ct == 0) { + RoundOver(TEAM_T, 3600, FALSE); + return; + } + } else if (mode == GAME_END) { g_cs_gamestate = GAME_END; } else if (mode == GAME_COMMENCING) { @@ -506,7 +511,7 @@ This happens whenever an objective is complete or time is up void CSMultiplayerRules::RoundOver(int iTeamWon, int iMoneyReward, int fSilent) { - if (g_cs_gamestate != GAME_ACTIVE) { + if (g_cs_gamestate != GAME_ACTIVE && g_cs_gamestate != GAME_FREEZE) { return; } @@ -640,10 +645,19 @@ void CSMultiplayerRules::DeathCheck(base_player pl) { /* hack so that we can kill rounds */ - if ((g_cs_alive_t == 0) || (g_cs_alive_ct == 0)) { + if ((g_cs_alive_t == 0) && (g_cs_alive_ct == 0)) { g_cs_gamestate = GAME_ACTIVE; } + switch (g_cs_gamestate) { + case GAME_INACTIVE: + case GAME_COMMENCING: + case GAME_END: + case GAME_OVER: + return; + break; + } + if ((g_cs_alive_t == 0) && (g_cs_alive_ct == 0)) { if (g_cs_bombplanted == TRUE) { RoundOver(TEAM_T, 3600, FALSE); @@ -659,6 +673,7 @@ CSMultiplayerRules::DeathCheck(base_player pl) } else { return; } + if (g_cs_bombzones > 0) { /* In Bomb Defusal, the winning team receives $3250 * if they won by eliminating the enemy team. */ diff --git a/src/shared/animations.qc b/src/shared/animations.qc index 02b0395..b1e6058 100644 --- a/src/shared/animations.qc +++ b/src/shared/animations.qc @@ -67,7 +67,7 @@ depending on what the player is doing void Animation_PlayerUpdate(player pl) { - pl.basebone = 39; + pl.basebone = gettagindex(self, "-- R shoulder outside"); if (pl.anim_top_delay <= 0.0f) { pl.anim_top = Weapons_GetAim(pl.activeweapon); diff --git a/src/shared/defs.h b/src/shared/defs.h index 01ca698..070a294 100644 --- a/src/shared/defs.h +++ b/src/shared/defs.h @@ -46,3 +46,13 @@ HUD_GetChatColorHEX(float fTeam) return "^xCCC"; } } + +enum +{ + GAME_INACTIVE, + GAME_COMMENCING, + GAME_FREEZE, + GAME_ACTIVE, + GAME_END, + GAME_OVER +}; diff --git a/src/shared/player.h b/src/shared/player.h index c4e2f6e..f52d279 100644 --- a/src/shared/player.h +++ b/src/shared/player.h @@ -100,6 +100,8 @@ class player:base_player virtual void(float) Physics_Fall; virtual void(void) Physics_Jump; + virtual void(void) Physics_InputPostMove; + #ifdef CLIENT /* External model */ entity p_model; @@ -118,6 +120,7 @@ class player:base_player virtual void(float, float) ReceiveEntity; virtual void(void) PredictPreFrame; virtual void(void) PredictPostFrame; + virtual void(void) ClientRemove; #else virtual void(void) EvaluateEntity; virtual float(entity, float) SendEntity; @@ -128,8 +131,27 @@ class player:base_player #endif }; +void +player::Physics_InputPostMove(void) +{ + super::Physics_InputPostMove(); + +#ifdef SERVER + if (g_cs_gamestate == GAME_FREEZE) { +#else + if (getstati(STAT_GAMESTATE) == GAME_FREEZE) { +#endif + flags |= FL_FROZEN; + } +} + #ifdef CLIENT +void +player::ClientRemove(void) +{ + remove(p_model); +} void Weapons_AmmoUpdate(entity); void HUD_AmmoNotify_Check(player pl); /* @@ -496,13 +518,6 @@ player::EvaluateEntity(void) SAVE_STATE(anim_top_delay); SAVE_STATE(anim_bottom); SAVE_STATE(anim_bottom_time); - - if (g_cs_gamestate != GAME_FREEZE) { - if (progress <= 0.0f) { - flags &= ~FL_FROZEN; - SendFlags |= PLAYER_FLAGS; - } - } } /* diff --git a/src/shared/w_c4bomb.qc b/src/shared/w_c4bomb.qc index a1edcf6..e1e38ad 100644 --- a/src/shared/w_c4bomb.qc +++ b/src/shared/w_c4bomb.qc @@ -139,6 +139,7 @@ w_c4bomb_primary(void) } pl.flags |= FL_FROZEN; + input_movevalues = [0,0,0]; switch (pl.mode_temp) { case C4S_NONE: