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.
This commit is contained in:
Marco Cawthorne 2022-03-03 23:34:01 -08:00
parent 69836864ee
commit 127f9eba7f
Signed by: eukara
GPG key ID: C196CD8BA993248A
6 changed files with 57 additions and 26 deletions

View file

@ -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
};

View file

@ -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. */

View file

@ -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);

View file

@ -46,3 +46,13 @@ HUD_GetChatColorHEX(float fTeam)
return "^xCCC";
}
}
enum
{
GAME_INACTIVE,
GAME_COMMENCING,
GAME_FREEZE,
GAME_ACTIVE,
GAME_END,
GAME_OVER
};

View file

@ -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;
}
}
}
/*

View file

@ -139,6 +139,7 @@ w_c4bomb_primary(void)
}
pl.flags |= FL_FROZEN;
input_movevalues = [0,0,0];
switch (pl.mode_temp) {
case C4S_NONE: