#define FREEZETAG_ALIVE_TEAMS() ((redalive > 0) + (bluealive > 0) + (yellowalive > 0) + (pinkalive > 0))
#define FREEZETAG_ALIVE_TEAMS_OK() (FREEZETAG_ALIVE_TEAMS() == freezetag_teams)
-float prev_total_players;
+float prev_missing_teams_mask;
float freezetag_CheckTeams()
{
if(FREEZETAG_ALIVE_TEAMS_OK())
{
- if(prev_total_players > 0)
+ if(prev_missing_teams_mask > 0)
Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_MISSING_TEAMS);
- prev_total_players = -1;
+ prev_missing_teams_mask = -1;
return 1;
}
- if(prev_total_players != total_players)
+ if(total_players == 0)
{
- float p1 = 0, p2 = 0, p3 = 0, p4 = 0;
- if(!redalive) p1 = NUM_TEAM_1;
- if(!bluealive) p2 = NUM_TEAM_2;
- if(freezetag_teams >= 3)
- if(!yellowalive) p3 = NUM_TEAM_3;
- if(freezetag_teams >= 4)
- if(!pinkalive) p4 = NUM_TEAM_4;
- Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_MISSING_TEAMS, p1, p2, p3, p4);
- prev_total_players = total_players;
+ if(prev_missing_teams_mask > 0)
+ Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_MISSING_TEAMS);
+ prev_missing_teams_mask = -1;
+ return 0;
+ }
+ float missing_teams_mask = (!redalive) + (!bluealive) * 2;
+ if(freezetag_teams >= 3) missing_teams_mask += (!yellowalive) * 4;
+ if(freezetag_teams >= 4) missing_teams_mask += (!pinkalive) * 8;
+ if(prev_missing_teams_mask != missing_teams_mask)
+ {
+ Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_MISSING_TEAMS, missing_teams_mask);
+ prev_missing_teams_mask = missing_teams_mask;
}
return 0;
}
return 1;
}
+entity freezetag_LastPlayerForTeam()
+{
+ entity pl, last_pl = world;
+ FOR_EACH_PLAYER(pl)
+ {
+ if(pl.health >= 1)
+ if(!pl.freezetag_frozen)
+ if(pl != self)
+ if(pl.team == self.team)
+ if(!last_pl)
+ last_pl = pl;
+ else
+ return world;
+ }
+ return last_pl;
+}
+
+void freezetag_LastPlayerForTeam_Notify()
+{
+ if(round_handler_IsActive())
+ if(round_handler_IsRoundStarted())
+ {
+ entity pl = freezetag_LastPlayerForTeam();
+ if(pl)
+ Send_Notification(NOTIF_ONE, pl, MSG_CENTER, CENTER_ALONE);
+ }
+}
+
// this is needed to allow the player to turn his view around (fixangle can't
// be used to freeze his view, as that also changes the angles), while not
// turning that ice object with the player
MUTATOR_HOOKFUNCTION(freezetag_RemovePlayer)
{
self.health = 0; // neccessary to update correctly alive stats
+ if(!self.freezetag_frozen)
+ freezetag_LastPlayerForTeam_Notify();
freezetag_Unfreeze(world);
freezetag_count_alive_players();
return 1;
{
freezetag_Add_Score(frag_attacker);
freezetag_count_alive_players();
+ freezetag_LastPlayerForTeam_Notify();
}
else
freezetag_Unfreeze(world); // remove ice
return 1;
freezetag_Freeze(frag_attacker);
+ freezetag_LastPlayerForTeam_Notify();
if(frag_attacker == frag_target || frag_attacker == world)
{
}
else
self.movement = '0 0 0';
-
+
self.disableclientprediction = 1;
}
return 1;
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVED_FALL, frag_target.netname);
Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_REVIVE_FALL);
}
-
+
frag_damage = 0;
frag_force = frag_force * autocvar_g_freezetag_frozen_force;
}
{
if(self.freezetag_frozen)
return TRUE; // no jumping in freezetag when frozen
-
+
return FALSE;
}
MUTATOR_HOOKFUNCTION(freezetag_BotRoles)
{
- if not(self.deadflag)
+ if (!self.deadflag)
{
if (random() < 0.5)
self.havocbot_role = havocbot_role_ft_freeing;
{
if(other.freezetag_frozen)
return TRUE;
-
+
return FALSE;
}
MUTATOR_HOOK(PlayerJump, freezetag_PlayerJump, CBC_ORDER_ANY);
MUTATOR_HOOK(ForbidThrowCurrentWeapon, freezetag_ForbidThrowCurrentWeapon, CBC_ORDER_ANY);
MUTATOR_HOOK(ItemTouch, freezetag_ItemTouch, CBC_ORDER_ANY);
- MUTATOR_HOOK(HavocBot_ChooseRule, freezetag_BotRoles, CBC_ORDER_ANY);
+ MUTATOR_HOOK(HavocBot_ChooseRole, freezetag_BotRoles, CBC_ORDER_ANY);
MUTATOR_HOOK(SpectateCopy, freezetag_SpectateCopy, CBC_ORDER_ANY);
MUTATOR_HOOK(GetTeamCount, freezetag_GetTeamCount, CBC_ORDER_EXCLUSIVE);
MUTATOR_HOOK(VehicleTouch, freezetag_VehicleTouch, CBC_ORDER_ANY);