FOREACH_CLIENT(IS_PLAYER(it) && Entity_HasValidTeam(it),
{
++total_players;
- if (GetResource(it, RES_HEALTH) < 1 || STAT(FROZEN, it) == FROZEN_NORMAL)
+ if (GetResource(it, RES_HEALTH) < 1 || STAT(FROZEN, it))
{
continue;
}
{
entity last_pl = NULL;
FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), {
- if (STAT(FROZEN, it) != FROZEN_NORMAL && GetResource(it, RES_HEALTH) >= 1)
+ if (!STAT(FROZEN, it) && GetResource(it, RES_HEALTH) >= 1)
{
if (!last_pl)
last_pl = it;
if (autocvar_g_freezetag_revive_auto && autocvar_g_freezetag_frozen_maxtime > 0)
targ.freezetag_frozen_timeout = time + autocvar_g_freezetag_frozen_maxtime;
- STAT(FROZEN, targ) = FROZEN_NORMAL;
+ STAT(FROZEN, targ) = true;
STAT(REVIVE_PROGRESS, targ) = 0;
SetResource(targ, RES_HEALTH, 1);
targ.revive_speed = 0;
if(!STAT(FROZEN, targ))
return;
- if (reset_health && STAT(FROZEN, targ) != FROZEN_TEMP_DYING)
+ if (reset_health)
SetResource(targ, RES_HEALTH, ((IS_PLAYER(targ)) ? start_health : targ.max_health));
targ.pauseregen_finished = time + autocvar_g_balance_pause_health_regen;
bool freezetag_isEliminated(entity e)
{
- if(IS_PLAYER(e) && (STAT(FROZEN, e) == FROZEN_NORMAL || IS_DEAD(e)))
+ if(IS_PLAYER(e) && (STAT(FROZEN, e) || IS_DEAD(e)))
return true;
return false;
}
entity best_pl = NULL;
float best_dist2 = FLOAT_MAX;
FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), {
- if (STAT(FROZEN, it) == FROZEN_NORMAL)
+ if (STAT(FROZEN, it))
{
if(vdist(it.origin - org, >, sradius))
continue;
// Count how many players on team are unfrozen.
int unfrozen = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this) && STAT(FROZEN, it) != FROZEN_NORMAL, {
+ FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this) && !STAT(FROZEN, it), {
unfrozen++;
});
// If only one left on team or if role has timed out then start trying to free players.
- if ((!unfrozen && STAT(FROZEN, this) != FROZEN_NORMAL) || time > this.havocbot_role_timeout)
+ if ((!unfrozen && !STAT(FROZEN, this)) || time > this.havocbot_role_timeout)
{
LOG_TRACE("changing role to freeing");
this.havocbot_role = havocbot_role_ft_freeing;
void ft_RemovePlayer(entity this)
{
- if (STAT(FROZEN, this) != FROZEN_NORMAL)
+ if (!STAT(FROZEN, this))
freezetag_LastPlayerForTeam_Notify(this);
freezetag_Unfreeze(this, false);
if(round_handler_IsActive())
if(round_handler_CountdownRunning())
{
- if (STAT(FROZEN, frag_target) == FROZEN_NORMAL)
+ if (STAT(FROZEN, frag_target))
freezetag_Unfreeze(frag_target, true);
freezetag_count_alive_players();
frag_target.respawn_time = time;
{
// can't use freezetag_Add_Score here since it doesn't assign any points
// if the attacker is not a player (e.g. triggerhurt) by design
- if ((STAT(FROZEN, frag_target) != FROZEN_NORMAL) && !IS_PLAYER(frag_attacker))
+ if (!STAT(FROZEN, frag_target) && !IS_PLAYER(frag_attacker))
GameRules_scoring_add(frag_target, SCORE, -1);
// by restoring some health right after player death (soft-kill)
frag_target.punchvector = '0 0 0';
}
- if (STAT(FROZEN, frag_target) == FROZEN_NORMAL)
+ if (STAT(FROZEN, frag_target))
return true;
freezetag_Freeze(frag_target, frag_attacker);
frag_target.freezetag_frozen_armor = GetResource(frag_target, RES_ARMOR);
- if (STAT(FROZEN, frag_target) == FROZEN_NORMAL && autocvar_g_freezetag_revive_auto_reducible
+ if (STAT(FROZEN, frag_target) && autocvar_g_freezetag_revive_auto_reducible
&& autocvar_g_freezetag_frozen_maxtime > 0 && autocvar_g_freezetag_revive_auto)
{
float t = 0;
#undef IN_REVIVING_RANGE
#endif
-void freezetag_PlayerFrame(entity this)
-{
- if (IS_PLAYER(this) && time >= game_starttime)
- {
- if (STAT(FROZEN, this) == FROZEN_TEMP_REVIVING)
- {
- STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + frametime * this.revive_speed, 1);
- SetResourceExplicit(this, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * start_health));
- if (this.iceblock)
- this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1);
-
- if (STAT(REVIVE_PROGRESS, this) >= 1)
- freezetag_Unfreeze(this, false);
- }
- else if (STAT(FROZEN, this) == FROZEN_TEMP_DYING)
- {
- STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) - frametime * this.revive_speed, 1);
- SetResourceExplicit(this, RES_HEALTH, max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this)));
-
- if (GetResource(this, RES_HEALTH) < 1)
- {
- if (this.vehicle)
- vehicles_exit(this.vehicle, VHEF_RELEASE);
- if(this.event_damage)
- this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, DMG_NOWEP, this.origin, '0 0 0');
- }
- else if (STAT(REVIVE_PROGRESS, this) <= 0)
- freezetag_Unfreeze(this, false);
- }
- }
-}
-
#define IN_REVIVING_RANGE(player, it, revive_extra_size) \
(it != player && !IS_DEAD(it) && SAME_TEAM(it, player) \
&& boxesoverlap(player.absmin - revive_extra_size, player.absmax + revive_extra_size, it.absmin, it.absmax))
return true;
entity player = M_ARGV(0, entity);
- //if (STAT(FROZEN, player) == FROZEN_NORMAL)
+ //if (STAT(FROZEN, player))
//if(player.freezetag_frozen_timeout > 0 && time < player.freezetag_frozen_timeout)
//player.iceblock.alpha = ICE_MIN_ALPHA + (ICE_MAX_ALPHA - ICE_MIN_ALPHA) * (player.freezetag_frozen_timeout - time) / (player.freezetag_frozen_timeout - player.freezetag_frozen_time);
vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
FOREACH_CLIENT(IS_PLAYER(it), {
// check if player is reviving anyone
- if (STAT(FROZEN, it) == FROZEN_NORMAL)
+ if (STAT(FROZEN, it))
{
- if ((STAT(FROZEN, player) == FROZEN_NORMAL))
+ if ((STAT(FROZEN, player)))
continue;
if (!IN_REVIVING_RANGE(player, it, revive_extra_size))
continue;
break;
}
- if (!(STAT(FROZEN, player) == FROZEN_NORMAL))
+ if (!(STAT(FROZEN, player)))
continue; // both player and it are NOT frozen
if (!IN_REVIVING_RANGE(player, it, revive_extra_size))
continue;
// found a teammate that is reviving player
- if (autocvar_g_freezetag_revive_time_to_score > 0 && STAT(FROZEN, player) == FROZEN_NORMAL)
+ if (autocvar_g_freezetag_revive_time_to_score > 0 && STAT(FROZEN, player))
{
it.freezetag_revive_time += frametime / autocvar_g_freezetag_revive_time_to_score;
while (it.freezetag_revive_time > 1)
// allow normal revival during automatic revival
// (if we wouldn't allow it then freezetag_frozen_timeout should be checked too in the previous loop)
- //if (STAT(FROZEN, player) == FROZEN_NORMAL) // redundant check
+ //if (STAT(FROZEN, player)) // redundant check
if (!n && player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
n = -1;
float base_progress = 0;
- if (STAT(FROZEN, player) == FROZEN_NORMAL && autocvar_g_freezetag_revive_auto
+ if (STAT(FROZEN, player) && autocvar_g_freezetag_revive_auto
&& autocvar_g_freezetag_frozen_maxtime > 0 && autocvar_g_freezetag_revive_auto_progress)
{
// NOTE if auto-revival is in progress, manual revive speed is reduced so that it always takes the same amount of time
if (!n) // no teammate nearby
{
float clearspeed = autocvar_g_freezetag_revive_clearspeed;
- if (STAT(FROZEN, player) == FROZEN_NORMAL)
+ if (STAT(FROZEN, player))
{
if (autocvar_g_freezetag_revive_time_to_score > 0)
{
else if (!STAT(FROZEN, player) && !player_is_reviving)
STAT(REVIVE_PROGRESS, player) = base_progress; // thawing nobody
}
- else if (STAT(FROZEN, player) == FROZEN_NORMAL) // OK, there is at least one teammate reviving us
+ else if (STAT(FROZEN, player)) // OK, there is at least one teammate reviving us
{
float spd = autocvar_g_freezetag_revive_speed_t2s;
if (autocvar_g_freezetag_revive_time_to_score <= 0)
STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player);
}
- if (STAT(FROZEN, player) == FROZEN_NORMAL)
+ if (STAT(FROZEN, player))
{
entity player_wp = player.waypointsprite_attached;
if (n > 0 || (n == 0 && STAT(REVIVE_PROGRESS, player) > 0.95))
WaypointSprite_UpdateHealth(player_wp, STAT(REVIVE_PROGRESS, player));
}
- freezetag_PlayerFrame(player);
-
return true;
}
int kill_count_to_attacker = M_ARGV(3, int);
int kill_count_to_target = M_ARGV(4, int);
- if(STAT(FROZEN, frag_target) == FROZEN_NORMAL)
+ if(STAT(FROZEN, frag_target))
return; // target was already frozen, so this is just pushing them off the cliff
Send_Notification(NOTIF_ONE, frag_attacker, MSG_CHOICE, CHOICE_FRAG_FREEZE, frag_target.netname, kill_count_to_attacker, (IS_BOT_CLIENT(frag_target) ? -1 : CS(frag_target).ping));