// if we rejected because we matched our OWN team color,
// this is not bad; we then simply keep our color as is
// anyway.
- if(forcecolor_friend == 1024 + 17 * tm.team)
+ if(forcecolor_friend == 1024 + 17 * TMID(tm.team))
forcecolor_friend = 0;
}
{
for (; tm.sort_next; tm = tm.sort_next)
{
- if(!tm.team_size || tm.team == NUM_SPECTATOR)
+ if(!tm.team_size || TMID(tm.team) == NUM_SPECTATOR)
continue;
if(!ts_min) ts_min = tm.team_size;
else ts_min = min(ts_min, tm.team_size);
s = strcat(blinkcolor, _("Teamnumbers are unbalanced!"));
tm = GetTeam(myteam, false);
if (tm)
- if (tm.team != NUM_SPECTATOR)
+ if (TMID(tm.team) != NUM_SPECTATOR)
if (tm.team_size == ts_max)
s = strcat(s, sprintf(_(" Press ^3%s%s to adjust"), getcommandkey("team menu", "menu_showteamselect"), blinkcolor));
drawInfoMessage(s);
draw_teamradar_background(hud_panel_radar_foreground_alpha);
- FOREACH_ENTITY_CLASS("radarlink", true, draw_teamradar_link(it.origin, it.velocity, it.team));
+ FOREACH_ENTITY_CLASS("radarlink", true, draw_teamradar_link(it.origin, it.velocity, TMID(it.team)));
FOREACH_ENTITY_FLAGS(teamradar_icon, 0xFFFFFF, {
if ( hud_panel_radar_mouse )
if ( it.health > 0 )
- if ( it.team == myteam+1 || gametype == MAPINFO_TYPE_RACE )
+ if ( TMID(it.team) == myteam+1 || gametype == MAPINFO_TYPE_RACE )
{
vector coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(it.origin));
if(vdist((mousepos - coord), <, 8))
// show team scores in the first line
float score_size = mySize.x / team_count;
for(tm = teams.sort_next; tm; tm = tm.sort_next) {
- if(tm.team == NUM_SPECTATOR)
+ if(TMID(tm.team) == NUM_SPECTATOR)
continue;
if(!tm.team && teamplay)
continue;
- if (tm.team == myteam)
+ if (TMID(tm.team) == myteam)
drawfill(pos + eX * score_size * i, eX * score_size + eY * fontsize.y, '1 1 1', highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(pos + eX * score_size * i, ftos(tm.(teamscores[ts_primary])), eX * score_size + eY * fontsize.y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + eX * score_size * i, ftos(tm.(teamscores[ts_primary])), eX * score_size + eY * fontsize.y, Team_ColorRGB(TMID(tm.team)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
++i;
}
first_pl = 1;
do
for (pl = players.sort_next; pl && i<entries; pl = pl.sort_next)
{
- if ((team_count && pl.team != tm.team) || pl.team == NUM_SPECTATOR)
+ if ((team_count && pl.team != tm.team) || TMID(pl.team) == NUM_SPECTATOR)
continue;
if (i == entries-1 && !me_printed && pl != me)
if (autocvar_hud_panel_score_rankings == 1 && spectatee_status != -1)
{
for (pl = me.sort_next; pl; pl = pl.sort_next)
- if (pl.team != NUM_SPECTATOR)
+ if (TMID(pl.team) != NUM_SPECTATOR)
break;
if (pl)
drawfill(pos, eX * mySize.x + eY * fontsize.y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
if (team_count)
- score_color = Team_ColorRGB(pl.team) * 0.8;
+ score_color = Team_ColorRGB(TMID(pl.team)) * 0.8;
s = textShortenToWidth(entcs_GetName(pl.sv_entnum), name_size, fontsize, stringwidth_colors);
drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, true, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
drawstring(pos + eX * (name_size + spacing_size), ftos(pl.(scores[ps_primary])), fontsize, score_color, panel_fg_alpha, DRAWFLAG_NORMAL);
pos.y += fontsize.y;
++i;
}
- while (i<entries && team_count && (tm = tm.sort_next) && (tm.team != NUM_SPECTATOR || (tm = tm.sort_next)));
+ while (i<entries && team_count && (tm = tm.sort_next) && (TMID(tm.team) != NUM_SPECTATOR || (tm = tm.sort_next)));
}
void HUD_Score()
draw_beginBoldFont();
row = column = 0;
for(tm = teams.sort_next; tm; tm = tm.sort_next) {
- if(tm.team == NUM_SPECTATOR)
+ if(TMID(tm.team) == NUM_SPECTATOR)
continue;
if(!tm.team && teamplay)
continue;
score_pos = pos + eX * column * (score_size.x + offset.x) + eY * row * (score_size.y + offset.y);
if (max_fragcount == score)
HUD_Panel_DrawHighlight(score_pos, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(score_pos, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(score_pos, ftos(score), score_size, Team_ColorRGB(TMID(tm.team)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
++row;
if(row >= rows)
{
++column;
}
}
- else if(tm.team == myteam) {
+ else if(TMID(tm.team) == myteam) {
if (max_fragcount == score)
HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize.x + eY * mySize.y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize.x + eY * mySize.y, Team_ColorRGB(TMID(tm.team)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
} else {
if (max_fragcount == score)
HUD_Panel_DrawHighlight(pos + eX * 0.75 * mySize.x + eY * (1/3) * rows * mySize.y, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(pos + eX * 0.75 * mySize.x + eY * (1/3) * rows * mySize.y, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + eX * 0.75 * mySize.x + eY * (1/3) * rows * mySize.y, ftos(score), score_size, Team_ColorRGB(TMID(tm.team)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
++rows;
}
}
{
if(o.has_team)
{
- tm = GetTeam(o.team, false);
+ tm = GetTeam(TMID(o.team), false);
tm.team_size -= 1;
o.has_team = 0;
return true;
{
if (!o.has_team)
{
- o.team = _team;
+ o.__team = _team;
tm = GetTeam(_team, true);
tm.team_size += 1;
o.has_team = 1;
return true;
}
- else if(_team != o.team)
+ else if(_team != TMID(o.team))
{
- tm = GetTeam(o.team, false);
+ tm = GetTeam(TMID(o.team), false);
tm.team_size -= 1;
- o.team = _team;
+ o.__team = _team;
tm = GetTeam(_team, true);
tm.team_size += 1;
return true;
int i;
entity o;
- this.team = ReadByte();
- o = this.owner = GetTeam(this.team, true); // these team numbers can always be trusted
+ this.__team = ReadByte();
+ o = this.owner = GetTeam(TMID(this.team), true); // these team numbers can always be trusted
int sf, lf;
#if MAX_TEAMSCORE <= 8
if(teams.sort_next)
teams.sort_next.sort_prev = _team;
teams.sort_next = _team;
- if(_team.team && _team.team != NUM_SPECTATOR)
+ if(TMID(_team.team) && TMID(_team.team) != NUM_SPECTATOR)
++team_count;
AuditLists();
return true;
parent.sort_next = _team.sort_next;
if(_team.sort_next)
_team.sort_next.sort_prev = parent;
- if(_team.team && _team.team != NUM_SPECTATOR)
+ if(TMID(_team.team) && TMID(_team.team) != NUM_SPECTATOR)
--team_count;
AuditLists();
}
if (!add)
return world;
entity tm = new_pure(team);
- tm.team = _team;
+ tm.__team = _team;
teamslots[num] = tm;
RegisterTeam(tm);
return tm;
for(pl = players.sort_next; pl; pl = pl.sort_next)
{
- if(teamplayers == 1 && (pl.team != myteam || pl.team == NUM_SPECTATOR)) // only own team players
+ if(teamplayers == 1 && (TMID(pl.team) != myteam || TMID(pl.team) == NUM_SPECTATOR)) // only own team players
continue;
- if(teamplayers == 2 && (pl.team == myteam || pl.team == NUM_SPECTATOR)) // only enemy team players
+ if(teamplayers == 2 && (TMID(pl.team) == myteam || TMID(pl.team) == NUM_SPECTATOR)) // only enemy team players
continue;
if(without_me && pl.sv_entnum == player_localnum)
continue;
{
int i, r;
- if(left.team == NUM_SPECTATOR)
+ if(TMID(left.team) == NUM_SPECTATOR)
return 1;
- if(right.team == NUM_SPECTATOR)
+ if(TMID(right.team) == NUM_SPECTATOR)
return 0;
r = HUD_CompareScore(left.teamscores[ts_primary], right.teamscores[ts_primary], teamscores_flags[ts_primary]);
return r;
}
- if (left.team < right.team)
+ if (TMID(left.team) < TMID(right.team))
return true;
return false;
void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_self, int pl_number)
{
vector tmp, rgb;
- rgb = Team_ColorRGB(pl.team);
+ rgb = Team_ColorRGB(TMID(pl.team));
string str;
int field;
float is_spec;
else
for(pl = players.sort_next; pl; pl = pl.sort_next)
{
- if(pl.team == NUM_SPECTATOR)
+ if(TMID(pl.team) == NUM_SPECTATOR)
continue;
HUD_PrintScoreboardItem(pos, tmp, pl, (pl.sv_entnum == player_localnum), i);
pos.y += 1.25 * hud_fontsize.y;
team_score_baseoffset = eY * (2 * autocvar_scoreboard_border_thickness + hud_fontsize.y) - eX * (autocvar_scoreboard_border_thickness + hud_fontsize.x * 0.25);
for(tm = teams.sort_next; tm; tm = tm.sort_next)
{
- if(tm.team == NUM_SPECTATOR)
+ if(TMID(tm.team) == NUM_SPECTATOR)
continue;
if(!tm.team && teamplay)
continue;
draw_beginBoldFont();
- rgb = Team_ColorRGB(tm.team);
+ rgb = Team_ColorRGB(TMID(tm.team));
str = ftos(tm.(teamscores[ts_primary]));
drawstring(pos + team_score_baseoffset - eX * stringwidth(str, false, hud_fontsize * 1.5), str, hud_fontsize * 1.5, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
for(tm = teams.sort_next; tm; tm = tm.sort_next)
{
- if(tm.team == NUM_SPECTATOR)
+ if(TMID(tm.team) == NUM_SPECTATOR)
continue;
if(!tm.team && teamplay)
continue;
item_size.z = 0;
for(pl = players.sort_next; pl; pl = pl.sort_next)
{
- if(pl.team != NUM_SPECTATOR)
+ if(TMID(pl.team) != NUM_SPECTATOR)
continue;
pos.y += 1.25 * hud_fontsize.y;
HUD_PrintScoreboardItem(pos, item_size, pl, (pl.sv_entnum == player_localnum), specs);
if(sendflags & 4)
{
- this.team = ReadByte();
+ this.__team = ReadByte();
}
return = true;
this.fade_rate = 0;
}
- this.team = ReadByte() - 1;
+ this.__team = ReadByte() - 1;
}
if (f & 2)
HANDLE(RPC) this.traileffect = EFFECT_TR_ROCKET.m_id; break;
- HANDLE(ROCKETMINSTA_LASER) this.traileffect = EFFECT_ROCKETMINSTA_LASER(this.team).m_id; break;
+ HANDLE(ROCKETMINSTA_LASER) this.traileffect = EFFECT_ROCKETMINSTA_LASER(TMID(this.team)).m_id; break;
#undef HANDLE
default:
if (MUTATOR_CALLHOOK(Ent_Projectile, this))
// now generate the particles
vector org;
org = gettaginfo(self, 0); // origin at attached location
- __pointparticles(self.team, org, '0 0 0', 1);
+ __pointparticles(TMID(self.team), org, '0 0 0', 1);
}
string species_prefix(int specnum)
setattachment(e, self, gettaginfo_name); // attach to the given bone
e.owner = self;
e.cnt = time + life;
- e.team = _particleeffectnum(effectname);
+ e.__team = _particleeffectnum(effectname);
e.think = DamageEffect_Think;
e.nextthink = time;
self.total_damages += 1;
// if this is a copied dead body, send the num of its player instead
// TODO: remove this field, read from model txt files
if(gibowner.classname == "body")
- e.team = etof(gibowner.enemy);
+ e.__team = etof(gibowner.enemy);
else
- e.team = etof(gibowner);
+ e.__team = etof(gibowner);
setorigin(e, org);
e.velocity = dir;
{
entity e;
e = find(world, classname, "nexball_team");
- if(e.team == t)
+ if(TMID(e.team) == t)
e = find(e, classname, "nexball_team");
- return e.team;
+ return TMID(e.team);
}
const float ST_NEXBALL_GOALS = 1;
{
if(self.ballcarried.teamtime && (self.ballcarried.teamtime < time))
{
- bprint("The ", Team_ColoredFullName(self.team), " held the ball for too long.\n");
+ bprint("The ", Team_ColoredFullName(TMID(self.team)), " held the ball for too long.\n");
setself(self.ballcarried);
DropBall(self, self.owner.origin, '0 0 0');
ResetBall();
}
WaypointSprite_Kill(ball.owner.waypointsprite_attachedforcarrier);
- WaypointSprite_Spawn(WP_NbBall, 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); // no health bar please
+ WaypointSprite_Spawn(WP_NbBall, 0, 0, ball, '0 0 64', world, TMID(ball.team), ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); // no health bar please
WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
ball.owner.ballcarried = world;
self.nextthink = time + autocvar_g_nexball_delay_idle + 3;
self.teamtime = 0;
self.pusher = world;
- self.team = false;
+ self.__team = 0;
_sound(self, CH_TRIGGER, self.noise1, VOL_BASE, ATTEN_NORM);
WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
LogNB("init", world);
if(self.cnt < 2) // step 1
{
if(time == self.teamtime)
- bprint("The ", Team_ColoredFullName(self.team), " held the ball for too long.\n");
+ bprint("The ", Team_ColoredFullName(TMID(self.team)), " held the ball for too long.\n");
self.touch = func_null;
self.movetype = MOVETYPE_NOCLIP;
if(ball.classname != "nexball_basketball")
if(ball.classname != "nexball_football")
return;
- if((!ball.pusher && self.team != GOAL_OUT) || ball.cnt)
+ if((!ball.pusher && TMID(self.team) != GOAL_OUT) || ball.cnt)
return;
EXACTTRIGGER_TOUCH;
if(nb_teams == 2)
- otherteam = OtherTeam(ball.team);
+ otherteam = OtherTeam(TMID(ball.team));
else
otherteam = 0;
bprint("Boo! ", pname, "^7 scored a goal against their own team!\n");
pscore = -1;
}
- else if(self.team == GOAL_FAULT)
+ else if(TMID(self.team) == GOAL_FAULT)
{
LogNB("fault", ball.pusher);
if(nb_teams == 2)
bprint(Team_ColoredFullName(otherteam), " gets a point due to ", pname, "^7's silliness.\n");
else
- bprint(Team_ColoredFullName(ball.team), " loses a point due to ", pname, "^7's silliness.\n");
+ bprint(Team_ColoredFullName(TMID(ball.team)), " loses a point due to ", pname, "^7's silliness.\n");
pscore = -1;
}
- else if(self.team == GOAL_OUT)
+ else if(TMID(self.team) == GOAL_OUT)
{
LogNB("out", ball.pusher);
if((self.spawnflags & GOAL_TOUCHPLAYER) && ball.owner)
}
else //score
{
- LogNB(strcat("goal:", ftos(self.team)), ball.pusher);
- bprint("Goaaaaal! ", pname, "^7 scored a point for the ", Team_ColoredFullName(ball.team), ".\n");
+ LogNB(strcat("goal:", ftos(TMID(self.team))), ball.pusher);
+ bprint("Goaaaaal! ", pname, "^7 scored a point for the ", Team_ColoredFullName(TMID(ball.team)), ".\n");
pscore = 1;
}
if(nb_teams == 2 && pscore < 0)
TeamScore_AddToTeam(otherteam, ST_NEXBALL_GOALS, -pscore);
else
- TeamScore_AddToTeam(ball.team, ST_NEXBALL_GOALS, pscore);
+ TeamScore_AddToTeam(TMID(ball.team), ST_NEXBALL_GOALS, pscore);
}
if(isclient)
{
ball.think = ResetBall;
if(ball.classname == "nexball_basketball")
ball.touch = football_touch; // better than func_null: football control until the ball gets reset
- ball.nextthink = time + autocvar_g_nexball_delay_goal * (self.team != GOAL_OUT);
+ ball.nextthink = time + autocvar_g_nexball_delay_goal * (TMID(self.team) != GOAL_OUT);
}
//=======================//
remove(self);
return;
}
- self.team = self.cnt + 1;
+ self.__team = self.cnt + 1;
}
void nb_spawnteam(string teamname, float teamcolor)
entity e = new(nexball_team);
e.netname = teamname;
e.cnt = teamcolor;
- e.team = e.cnt + 1;
+ e.__team = e.cnt + 1;
nb_teams += 1;
}
entity e;
for(e = world; (e = find(e, classname, "nexball_goal"));)
{
- switch(e.team)
+ switch(TMID(e.team))
{
case NUM_TEAM_1:
if(!t_red)
{
- nb_spawnteam("Red", e.team-1) ;
+ nb_spawnteam("Red", TMID(e.team)-1) ;
t_red = true;
}
break;
case NUM_TEAM_2:
if(!t_blue)
{
- nb_spawnteam("Blue", e.team-1) ;
+ nb_spawnteam("Blue", TMID(e.team)-1) ;
t_blue = true;
}
break;
case NUM_TEAM_3:
if(!t_yellow)
{
- nb_spawnteam("Yellow", e.team-1);
+ nb_spawnteam("Yellow", TMID(e.team)-1);
t_yellow = true;
}
break;
case NUM_TEAM_4:
if(!t_pink)
{
- nb_spawnteam("Pink", e.team-1) ;
+ nb_spawnteam("Pink", TMID(e.team)-1) ;
t_pink = true;
}
break;
EXACTTRIGGER_INIT;
- if(self.team != GOAL_OUT && Team_TeamToNumber(self.team) != -1)
+ if(TMID(self.team) != GOAL_OUT && Team_TeamToNumber(TMID(self.team)) != -1)
{
entity wp = WaypointSprite_SpawnFixed(WP_NbGoal, (self.absmin + self.absmax) * 0.5, self, sprite, RADARICON_NONE);
- wp.colormod = ((self.team) ? Team_ColorRGB(self.team) : '1 0.5 0');
+ wp.colormod = ((self.team) ? Team_ColorRGB(TMID(self.team)) : '1 0.5 0');
self.sprite.customizeentityforclient = nb_Goal_Customize;
}
spawnfunc(nexball_redgoal)
{
- self.team = NUM_TEAM_1;
+ self.__team = NUM_TEAM_1;
SpawnGoal();
}
spawnfunc(nexball_bluegoal)
{
- self.team = NUM_TEAM_2;
+ self.__team = NUM_TEAM_2;
SpawnGoal();
}
spawnfunc(nexball_yellowgoal)
{
- self.team = NUM_TEAM_3;
+ self.__team = NUM_TEAM_3;
SpawnGoal();
}
spawnfunc(nexball_pinkgoal)
{
- self.team = NUM_TEAM_4;
+ self.__team = NUM_TEAM_4;
SpawnGoal();
}
spawnfunc(nexball_fault)
{
- self.team = GOAL_FAULT;
+ self.__team = GOAL_FAULT;
if(self.noise == "")
self.noise = strzone(SND(TYPEHIT));
SpawnGoal();
spawnfunc(nexball_out)
{
- self.team = GOAL_OUT;
+ self.__team = GOAL_OUT;
if(self.noise == "")
self.noise = strzone(SND(TYPEHIT));
SpawnGoal();
{
if(this.team)
{
- this.glowmod = Team_ColorRGB(this.team - 1);
- this.teamradar_color = Team_ColorRGB(this.team - 1);
- this.colormap = 1024 + (this.team - 1) * 17;
+ this.glowmod = Team_ColorRGB(TMID(this.team) - 1);
+ this.teamradar_color = Team_ColorRGB(TMID(this.team) - 1);
+ this.colormap = 1024 + (TMID(this.team) - 1) * 17;
}
else
{
this.health = ReadByte();
this.max_health = ReadByte();
this.count = ReadByte();
- this.team = ReadByte();
+ this.__team = ReadByte();
this.iscaptured = ReadByte();
if(!this.count)
if(sf & CPSF_STATUS)
{
int _tmp = ReadByte();
- if(_tmp != this.team)
+ if(_tmp != TMID(this.team))
{
- this.team = _tmp;
+ this.__team = _tmp;
cpicon_changeteam(this);
}
{
if(this.team)
{
- this.glowmod = Team_ColorRGB(this.team - 1);
- this.teamradar_color = Team_ColorRGB(this.team - 1);
- this.colormap = 1024 + (this.team - 1) * 17;
+ this.glowmod = Team_ColorRGB(TMID(this.team) - 1);
+ this.teamradar_color = Team_ColorRGB(TMID(this.team) - 1);
+ this.colormap = 1024 + (TMID(this.team) - 1) * 17;
}
else
{
this.health = ReadByte();
this.max_health = ReadByte();
this.count = ReadByte();
- this.team = ReadByte();
+ this.__team = ReadByte();
if(!this.count)
this.count = 40;
{
int _tmp;
_tmp = ReadByte();
- if(_tmp != this.team)
+ if(_tmp != TMID(this.team))
{
- this.team = _tmp;
+ this.__team = _tmp;
generator_changeteam(this);
}
{SELFPARAM();
entity e = WaypointSprite_getviewentity(other);
- if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, e.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return false; }
+ if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, TMID(e.team)) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return false; }
if(SAME_TEAM(self, e)) { return false; }
return true;
void ons_CaptureShield_Touch()
{SELFPARAM();
- if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, other.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return; }
+ if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, TMID(other.team)) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return; }
if(!IS_PLAYER(other)) { return; }
if(SAME_TEAM(other, self)) { return; }
for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
{
if (l.iscaptured)
- LOG_DEBUG(strcat(etos(l), " (generator) belongs to team ", ftos(l.team), "\n"));
+ LOG_DEBUG(strcat(etos(l), " (generator) belongs to team ", ftos(TMID(l.team)), "\n"));
else
LOG_DEBUG(strcat(etos(l), " (generator) is destroyed\n"));
l.islinked = l.iscaptured;
l.isshielded = true;
int i;
for(i = 0; i < 17; ++i) { l.isgenneighbor[i] = false; l.iscpneighbor[i] = false; }
- LOG_DEBUG(strcat(etos(l), " (point) belongs to team ", ftos(l.team), "\n"));
+ LOG_DEBUG(strcat(etos(l), " (point) belongs to team ", ftos(TMID(l.team)), "\n"));
l.sprite.SendFlags |= 16;
}
// flow power outward from the generators through the network
l.enemy.isshielded = false;
}
if(l.goalentity.classname == "onslaught_generator")
- l.enemy.isgenneighbor[l.goalentity.team] = true;
+ l.enemy.isgenneighbor[TMID(l.goalentity.team)] = true;
else
- l.enemy.iscpneighbor[l.goalentity.team] = true;
+ l.enemy.iscpneighbor[TMID(l.goalentity.team)] = true;
}
if (l.enemy.islinked)
{
l.goalentity.isshielded = false;
}
if(l.enemy.classname == "onslaught_generator")
- l.goalentity.isgenneighbor[l.enemy.team] = true;
+ l.goalentity.isgenneighbor[TMID(l.enemy.team)] = true;
else
- l.goalentity.iscpneighbor[l.enemy.team] = true;
+ l.goalentity.iscpneighbor[TMID(l.enemy.team)] = true;
}
}
// now update the generators
// TODO check if the two sides have moved (currently they won't move anyway)
float cc = 0, cc1 = 0, cc2 = 0;
- if(self.goalentity.islinked || self.goalentity.iscaptured) { cc1 = (self.goalentity.team - 1) * 0x01; }
- if(self.enemy.islinked || self.enemy.iscaptured) { cc2 = (self.enemy.team - 1) * 0x10; }
+ if(self.goalentity.islinked || self.goalentity.iscaptured) { cc1 = (TMID(self.goalentity.team) - 1) * 0x01; }
+ if(self.enemy.islinked || self.enemy.iscaptured) { cc2 = (TMID(self.enemy.team) - 1) * 0x10; }
cc = cc1 + cc2;
else if(cp.goalentity)
{
// if there's already an icon built, nothing happens
- if(cp.team == teamnumber)
+ if(TMID(cp.team) == teamnumber)
{
a = ons_ControlPoint_CanBeLinked(cp, teamnumber);
if(a) // attackable by enemy?
}
if(IS_PLAYER(attacker))
- if(time - ons_notification_time[this.team] > 10)
+ if(time - ons_notification_time[TMID(this.team)] > 10)
{
play2team(this.team, SND(ONS_CONTROLPOINT_UNDERATTACK));
- ons_notification_time[this.team] = time;
+ ons_notification_time[TMID(this.team)] = time;
}
this.health = this.health - damage;
{
sound(this, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_CPDESTROYED), this.owner.message, attacker.netname);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(TMID(this.team), INFO_ONSLAUGHT_CPDESTROYED), this.owner.message, attacker.netname);
PlayerScore_Add(attacker, SP_ONS_TAKES, 1);
PlayerScore_Add(attacker, SP_SCORE, 10);
this.owner.goalentity = world;
this.owner.islinked = false;
this.owner.iscaptured = false;
- this.owner.team = 0;
+ this.owner.__team = 0;
this.owner.colormap = 1024;
WaypointSprite_UpdateMaxHealth(this.owner.sprite, 0);
if(self.owner.islinked != self.owner.waslinked)
{
// unteam the spawnpoint if needed
- int t = self.owner.team;
+ int t = TMID(self.owner.team);
if(!self.owner.islinked)
- self.owner.team = 0;
+ self.owner.__team = 0;
setself(self.owner);
activator = self;
SUB_UseTargets ();
setself(this);
- self.owner.team = t;
+ self.owner.__team = t;
self.owner.waslinked = self.owner.islinked;
}
self.nextthink = time + ONS_CP_THINKRATE;
// only do this if there is power
- a = ons_ControlPoint_CanBeLinked(self.owner, self.owner.team);
+ a = ons_ControlPoint_CanBeLinked(self.owner, TMID(self.owner.team));
if(!a)
return;
self.owner.iscaptured = true;
self.solid = SOLID_BBOX;
- Send_Effect(EFFECT_CAP(self.owner.team), self.owner.origin, '0 0 0', 1);
+ Send_Effect(EFFECT_CAP(TMID(self.owner.team)), self.owner.origin, '0 0 0', 1);
WaypointSprite_UpdateMaxHealth(self.owner.sprite, self.max_health);
WaypointSprite_UpdateHealth(self.owner.sprite, self.health);
if(IS_PLAYER(self.owner.ons_toucher))
{
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ONSLAUGHT_CAPTURE, self.owner.ons_toucher.netname, self.owner.message);
- Send_Notification(NOTIF_ALL_EXCEPT, self.owner.ons_toucher, MSG_CENTER, APP_TEAM_NUM(self.owner.ons_toucher.team, CENTER_ONS_CAPTURE), self.owner.message);
+ Send_Notification(NOTIF_ALL_EXCEPT, self.owner.ons_toucher, MSG_CENTER, APP_TEAM_NUM(TMID(self.owner.ons_toucher.team), CENTER_ONS_CAPTURE), self.owner.message);
Send_Notification(NOTIF_ONE, self.owner.ons_toucher, MSG_CENTER, CENTER_ONS_CAPTURE, self.owner.message);
PlayerScore_Add(self.owner.ons_toucher, SP_ONS_CAPS, 1);
PlayerTeamScore_AddScore(self.owner.ons_toucher, 10);
e.bot_attack = true;
e.event_damage = ons_ControlPoint_Icon_Damage;
e.team = player.team;
- e.colormap = 1024 + (e.team - 1) * 17;
+ e.colormap = 1024 + (TMID(e.team) - 1) * 17;
e.count = (e.max_health - e.health) * ONS_CP_THINKRATE / autocvar_g_onslaught_cp_buildtime; // how long it takes to build
sound(e, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILD, VOL_BASE, ATTEN_NORM);
cp.team = e.team;
cp.colormap = e.colormap;
- Send_Effect(EFFECT_FLAG_TOUCH(player.team), e.origin, '0 0 0', 1);
+ Send_Effect(EFFECT_FLAG_TOUCH(TMID(player.team)), e.origin, '0 0 0', 1);
WaypointSprite_UpdateBuildFinished(cp.sprite, time + (e.max_health - e.health) / (e.count / ONS_CP_THINKRATE));
- WaypointSprite_UpdateRule(cp.sprite,cp.team,SPRITERULE_TEAMPLAY);
+ WaypointSprite_UpdateRule(cp.sprite, TMID(cp.team), SPRITERULE_TEAMPLAY);
cp.sprite.SendFlags |= 16;
onslaught_controlpoint_icon_link(e, ons_ControlPoint_Icon_BuildThink);
{
if(e.team)
{
- int a = ons_ControlPoint_Attackable(e, e.team);
+ int a = ons_ControlPoint_Attackable(e, TMID(e.team));
if(a == -2) { return WP_OnsCPDefend; } // defend now
if(a == -1 || a == 1 || a == 2) { return WP_OnsCP; } // touch
bool sh;
sh = !(ons_ControlPoint_CanBeLinked(e, NUM_TEAM_1) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_2) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_3) || ons_ControlPoint_CanBeLinked(e, NUM_TEAM_4));
- if(e.lastteam != e.team + 2 || e.lastshielded != sh || e.iscaptured != e.lastcaptured)
+ if(e.lastteam != TMID(e.team) + 2 || e.lastshielded != sh || e.iscaptured != e.lastcaptured)
{
if(e.iscaptured) // don't mess up build bars!
{
if(e.lastshielded)
{
if(e.team)
- WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, false));
+ WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(TMID(e.team) - 1, false));
else
WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5');
}
else
{
if(e.team)
- WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, false));
+ WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(TMID(e.team) - 1, false));
else
WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75');
}
WaypointSprite_Ping(e.sprite);
- e.lastteam = e.team + 2;
+ e.lastteam = TMID(e.team) + 2;
e.lastshielded = sh;
e.lastcaptured = e.iscaptured;
}
Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT);
}
- attackable = ons_ControlPoint_Attackable(self, toucher.team);
+ attackable = ons_ControlPoint_Attackable(self, TMID(toucher.team));
if(attackable != 2 && attackable != 4)
return;
// we've verified that this player has a legitimate claim to this point,
remove(this.goalentity);
this.goalentity = world;
- this.team = 0;
+ this.__team = 0;
this.colormap = 1024;
this.iscaptured = false;
this.islinked = false;
setmodel_fixsize(this, MDL_ONS_CP_PAD1);
WaypointSprite_UpdateMaxHealth(this.sprite, 0);
- WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY);
+ WaypointSprite_UpdateRule(this.sprite, TMID(this.team), SPRITERULE_TEAMPLAY);
onslaught_updatelinks();
ons_worldcplist = cp;
cp.netname = "Control point";
- cp.team = 0;
+ cp.__team = 0;
cp.solid = SOLID_BBOX;
cp.movetype = MOVETYPE_NONE;
cp.touch = ons_ControlPoint_Touch;
// waypointsprites
WaypointSprite_SpawnFixed(WP_Null, self.origin + CPGEN_WAYPOINT_OFFSET, self, sprite, RADARICON_NONE);
- WaypointSprite_UpdateRule(self.sprite, self.team, SPRITERULE_TEAMPLAY);
+ WaypointSprite_UpdateRule(self.sprite, TMID(self.team), SPRITERULE_TEAMPLAY);
InitializeEntity(cp, ons_DelayedControlPoint_Setup, INITPRIO_SETLOCATION);
}
entity s1 = ons_Generator_Waypoint(e);
WaypointSprite_UpdateSprites(e.sprite, s1, s1, s1);
- if(e.lastteam != e.team + 2 || e.lastshielded != e.isshielded)
+ if(e.lastteam != TMID(e.team) + 2 || e.lastshielded != e.isshielded)
{
- e.lastteam = e.team + 2;
+ e.lastteam = TMID(e.team) + 2;
e.lastshielded = e.isshielded;
if(e.lastshielded)
{
if(e.team)
- WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, false));
+ WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(TMID(e.team) - 1, false));
else
WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5');
}
else
{
if(e.team)
- WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, false));
+ WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(TMID(e.team) - 1, false));
else
WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75');
}
else
{
if (attacker == this)
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME));
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(TMID(this.team), INFO_ONSLAUGHT_GENDESTROYED_OVERTIME));
else
{
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED));
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(TMID(this.team), INFO_ONSLAUGHT_GENDESTROYED));
PlayerScore_Add(attacker, SP_SCORE, 100);
}
this.iscaptured = false;
soundto(MSG_ONE, it, CHAN_AUTO, SND(KH_ALARM), VOL_BASE, ATTEN_NONE); // FIXME: unique sound?
}
else
- Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(self.team, CENTER_ONS_NOTSHIELDED));
+ Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(TMID(self.team), CENTER_ONS_NOTSHIELDED));
});
}
}
void ons_GeneratorReset(entity this)
{
- this.team = this.team_saved;
+ this.__team = this.team_saved;
this.lasthealth = this.max_health = this.health = autocvar_g_onslaught_gen_health;
this.takedamage = DAMAGE_AIM;
this.bot_attack = true;
WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);
WaypointSprite_UpdateHealth(this.sprite, this.health);
- WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY);
+ WaypointSprite_UpdateRule(this.sprite, TMID(this.team), SPRITERULE_TEAMPLAY);
onslaught_updatelinks();
}
void ons_GeneratorSetup(entity gen) // called when spawning a generator entity on the map as a spawnfunc
{SELFPARAM();
// declarations
- int teamnumber = gen.team;
+ int teamnumber = TMID(gen.team);
setself(gen); // for later usage with droptofloor()
// main setup
// waypointsprites
WaypointSprite_SpawnFixed(WP_Null, self.origin + CPGEN_WAYPOINT_OFFSET, self, sprite, RADARICON_NONE);
- WaypointSprite_UpdateRule(self.sprite, self.team, SPRITERULE_TEAMPLAY);
+ WaypointSprite_UpdateRule(self.sprite, TMID(self.team), SPRITERULE_TEAMPLAY);
WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health);
WaypointSprite_UpdateHealth(self.sprite, self.health);
for(e = ons_worldgeneratorlist; e; e = e.ons_worldgeneratornext)
{
++total_generators;
- redowned += (e.team == NUM_TEAM_1 && e.health > 0);
- blueowned += (e.team == NUM_TEAM_2 && e.health > 0);
- yellowowned += (e.team == NUM_TEAM_3 && e.health > 0);
- pinkowned += (e.team == NUM_TEAM_4 && e.health > 0);
+ redowned += (TMID(e.team) == NUM_TEAM_1 && e.health > 0);
+ blueowned += (TMID(e.team) == NUM_TEAM_2 && e.health > 0);
+ yellowowned += (TMID(e.team) == NUM_TEAM_3 && e.health > 0);
+ pinkowned += (TMID(e.team) == NUM_TEAM_4 && e.health > 0);
}
}
continue;
// Ignore owned controlpoints
- if(!(cp2.isgenneighbor[self.team] || cp2.iscpneighbor[self.team]))
+ if(!(cp2.isgenneighbor[TMID(self.team)] || cp2.iscpneighbor[TMID(self.team)]))
continue;
// Count team mates interested in this control point
// onslaught is special
for(entity tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext)
{
- switch(tmp_entity.team)
+ switch(TMID(tmp_entity.team))
{
case NUM_TEAM_1: c1 = 0; break;
case NUM_TEAM_2: c2 = 0; break;
entity wp_owner = self.owner;
entity e = WaypointSprite_getviewentity(wp_sendto);
if(SAME_TEAM(e, wp_owner) && wp_owner.goalentity.health >= wp_owner.goalentity.max_health) { wp_flag |= 2; }
- if(!ons_ControlPoint_Attackable(wp_owner, e.team)) { wp_flag |= 2; }
+ if(!ons_ControlPoint_Attackable(wp_owner, TMID(e.team))) { wp_flag |= 2; }
}
if(self.owner.classname == "onslaught_generator")
{
WriteByte(MSG_ENTITY, self.health);
WriteByte(MSG_ENTITY, self.max_health);
WriteByte(MSG_ENTITY, self.count);
- WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, TMID(self.team));
WriteByte(MSG_ENTITY, self.owner.iscaptured);
}
if(sf & CPSF_STATUS)
{
- WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, TMID(self.team));
if(self.health <= 0)
WriteByte(MSG_ENTITY, 0);
WriteByte(MSG_ENTITY, self.health);
WriteByte(MSG_ENTITY, self.max_health);
WriteByte(MSG_ENTITY, self.count);
- WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, TMID(self.team));
}
if(sf & GSF_STATUS)
{
- WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, TMID(self.team));
if(self.health <= 0)
WriteByte(MSG_ENTITY, 0);
float _MapInfo_GetTeamPlayBool(float t)
{
- FOREACH(Gametypes, it.items == t, return it.team);
+ FOREACH(Gametypes, it.items == t, return it.__team);
return false;
}
/** human readable name */
ATTRIB(Gametype, message, string, string_null)
/** does this gametype support teamplay? */
- ATTRIB(Gametype, team, bool, false)
+ ATTRIB(Gametype, __team, bool, false)
/** game type defaults */
ATTRIB(Gametype, model2, string, string_null)
/** game type description */
this.netname = g_name;
this.mdl = sname;
this.message = hname;
- this.team = gteamplay;
+ this.__team = gteamplay;
this.m_mutators = mutators;
this.model2 = defaults;
this.gametype_description = gdescription;
minigame_ent = self.owner;
if ( sf & MINIG_SF_UPDATE )
- self.team = ReadByte();
+ self.__team = ReadByte();
if ( activate )
{
* MSLE stands for Minigame Simple Linked Entity
*/
#define MINIGAME_SIMPLELINKED_ENTITIES \
- MSLE(minigame_board_piece,FIELD(MINIG_SF_CREATE,Byte,team) FIELD(MINIG_SF_UPDATE, Short, minigame_flags) FIELD(MINIG_SF_UPDATE, Vector2D,origin)) \
- MSLE(pong_paddle,FIELD(MINIG_SF_CREATE,Byte,team) FIELD(MINIG_SF_CREATE,Float,pong_length) FIELD(MINIG_SF_UPDATE,Vector2D,origin)) \
- MSLE(pong_ball,FIELD(MINIG_SF_CREATE,Float,pong_length) FIELD(PONG_SF_BALLTEAM,Byte,team) FIELD(MINIG_SF_UPDATE, Vector2D, velocity) FIELD(MINIG_SF_UPDATE, Vector2D, origin)) \
- MSLE(pong_ai, FIELD(MINIG_SF_CREATE,Byte,team) FIELD(PONG_SF_PLAYERSCORE, Long, pong_score)) \
+ MSLE(minigame_board_piece,FIELD(MINIG_SF_CREATE,Byte,__team) FIELD(MINIG_SF_UPDATE, Short, minigame_flags) FIELD(MINIG_SF_UPDATE, Vector2D,origin)) \
+ MSLE(pong_paddle,FIELD(MINIG_SF_CREATE,Byte,__team) FIELD(MINIG_SF_CREATE,Float,pong_length) FIELD(MINIG_SF_UPDATE,Vector2D,origin)) \
+ MSLE(pong_ball,FIELD(MINIG_SF_CREATE,Float,pong_length) FIELD(PONG_SF_BALLTEAM,Byte,__team) FIELD(MINIG_SF_UPDATE, Vector2D, velocity) FIELD(MINIG_SF_UPDATE, Vector2D, origin)) \
+ MSLE(pong_ai, FIELD(MINIG_SF_CREATE,Byte,__team) FIELD(PONG_SF_PLAYERSCORE, Long, pong_score)) \
/*empty line*/
}
entity piece = msle_spawn(minigame,"minigame_board_piece");
- piece.team = 1;
+ piece.__team = 1;
piece.netname = strzone(pos);
piece.bd_tiletype = thetile;
piece.bd_dir = '0 -1 0';
tokenize_console(bd_string);
entity e = msle_spawn(minigame,"minigame_board_piece");
- e.team = 1;
+ e.__team = 1;
e.bd_dir = '0 -1 0';
int argv_num = 0;
pos = c4_get_lowest_tile(minigame, pos);
if ( minigame.minigame_flags & C4_TURN_PLACE )
- if ( pos && player.team == (minigame.minigame_flags & C4_TURN_TEAM) )
+ if ( pos && TMID(player.team) == (minigame.minigame_flags & C4_TURN_TEAM) )
{
if ( c4_valid_tile(pos) )
if ( !c4_find_piece(minigame,pos) )
minigame_server_sendflags(piece,MINIG_SF_ALL);
minigame_server_sendflags(minigame,MINIG_SF_UPDATE);
minigame.c4_npieces++;
- minigame.c4_nexteam = minigame_next_team(player.team,C4_TEAMS);
+ minigame.c4_nexteam = minigame_next_team(TMID(player.team),C4_TEAMS);
if ( c4_winning_piece(piece) )
{
- minigame.minigame_flags = C4_TURN_WIN | player.team;
+ minigame.minigame_flags = C4_TURN_WIN | TMID(player.team);
}
else if ( minigame.c4_npieces >= C4_MAX_TILES )
minigame.minigame_flags = C4_TURN_DRAW;
// Get the right team
if(minigame.minigame_players)
- return minigame_next_team(minigame.minigame_players.team, C4_TEAMS);
+ return minigame_next_team(TMID(minigame.minigame_players.team), C4_TEAMS);
// Team 1 by default
return 1;
vector tile_size = minigame_hud_denormalize_size('1 1 0' / C4_TILE_SIZE,pos,mySize);
vector tile_pos;
- if ( (active_minigame.minigame_flags & C4_TURN_TEAM) == minigame_self.team )
+ if ( (active_minigame.minigame_flags & C4_TURN_TEAM) == TMID(minigame_self.team) )
if ( c4_valid_tile(c4_curr_pos) )
{
tile_pos = minigame_tile_pos(c4_curr_pos,C4_NUM_CNT,C4_LET_CNT);
tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize);
minigame_drawpic_centered( tile_pos,
- minigame_texture(strcat("c4/piece",ftos(minigame_self.team))),
+ minigame_texture(strcat("c4/piece",ftos(TMID(minigame_self.team)))),
tile_size, '1 1 1', panel_fg_alpha/2, DRAWFLAG_NORMAL );
}
}
minigame_drawpic_centered( tile_pos,
- minigame_texture(strcat("c4/piece",ftos(e.team))),
+ minigame_texture(strcat("c4/piece",ftos(TMID(e.team)))),
tile_size, '1 1 1'*icon_color, panel_fg_alpha, DRAWFLAG_NORMAL );
}
}
string playername = "";
FOREACH_MINIGAME_ENTITY(e)
if ( e.classname == "minigame_player" &&
- e.team == (active_minigame.minigame_flags & C4_TURN_TEAM) )
+ TMID(e.team) == (active_minigame.minigame_flags & C4_TURN_TEAM) )
playername = entcs_GetName(e.minigame_playerslot-1);
vector win_pos = pos+eY*(mySize_y-winfs_y)/2;
if ( e.classname == "minigame_player" )
{
mypos = pos;
- if ( e.team == 2 )
+ if ( TMID(e.team) == 2 )
mypos_y += player_fontsize_y + ts_y;
minigame_drawcolorcodedstring_trunc(mySize_x,mypos,
entcs_GetName(e.minigame_playerslot-1),
mypos_y += player_fontsize_y;
drawpic( mypos,
- minigame_texture(strcat("c4/piece",ftos(e.team))),
+ minigame_texture(strcat("c4/piece",ftos(TMID(e.team)))),
tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL );
mypos_x += tile_size_x;
if ( turnflags & C4_TURN_WIN )
{
- if ( (turnflags&C4_TURN_TEAM) != minigame_self.team )
+ if ( (turnflags&C4_TURN_TEAM) != TMID(minigame_self.team) )
return _("You lost the game!");
return _("You win!");
}
- if ( (turnflags & C4_TURN_TEAM) != minigame_self.team )
+ if ( (turnflags & C4_TURN_TEAM) != TMID(minigame_self.team) )
return _("Wait for your opponent to make their move");
if ( turnflags & C4_TURN_PLACE )
// Make the correct move
void c4_make_move(entity minigame)
{
- if ( minigame.minigame_flags == (C4_TURN_PLACE|minigame_self.team) )
+ if ( minigame.minigame_flags == (C4_TURN_PLACE|TMID(minigame_self.team)) )
{
minigame_cmd("move ",c4_curr_pos);
}
}
case "key_pressed":
{
- if((minigame.minigame_flags & C4_TURN_TEAM) == minigame_self.team)
+ if((minigame.minigame_flags & C4_TURN_TEAM) == TMID(minigame_self.team))
{
switch ( ...(0,int) )
{
case "mouse_moved":
{
vector mouse_pos = minigame_hud_normalize(mousepos,c4_boardpos,c4_boardsize);
- if ( minigame.minigame_flags == (C4_TURN_PLACE|minigame_self.team) )
+ if ( minigame.minigame_flags == (C4_TURN_PLACE|TMID(minigame_self.team)) )
{
c4_set_curr_pos(c4_get_lowest_tile(minigame, minigame_tile_name(mouse_pos,C4_NUM_CNT,C4_LET_CNT)));
}
if ( sf & MINIG_SF_UPDATE )
{
sent.message = c4_turn_to_string(sent.minigame_flags);
- if ( sent.minigame_flags & minigame_self.team )
+ if ( sent.minigame_flags & TMID(minigame_self.team) )
minigame_prompt();
}
}
e.origin = minigame_tile_pos(id,7,7);
e.netname = id;
e.owner = minig;
- e.team = 0;
+ e.__team = 0;
e.nmm_tile_distance = distance;
e.nmm_tile_hmill = strzone(nmm_tile_build_hmill(e));
e.nmm_tile_vmill = strzone(nmm_tile_build_vmill(e));
entity e = start;
while ( ( e = findentity(e,owner,minigame) ) )
if ( e.classname == "minigame_board_piece" &&
- (e.minigame_flags & pieceflags) && e.team == teamn )
+ (e.minigame_flags & pieceflags) && TMID(e.team) == teamn )
return e;
return world;
}
for ( int i = 0; i < 7; i++ )
{
e = msle_spawn(minigame,"minigame_board_piece");
- e.team = 1;
+ e.__team = 1;
e.minigame_flags = NMM_PIECE_HOME;
e = msle_spawn(minigame,"minigame_board_piece");
- e.team = 2;
+ e.__team = 2;
e.minigame_flags = NMM_PIECE_HOME;
}
n++;
if ( n >= 2 )
return 0;
- if ( minigame.minigame_players && minigame.minigame_players.team == 1 )
+ if ( minigame.minigame_players && TMID(minigame.minigame_players.team) == 1 )
return 2;
return 1;
}
bool move_ok = false;
if ( e && argc >= 2 && argv(0) == "move" &&
- ( minigame.minigame_flags & NMM_TURN_TEAM ) == e.team )
+ ( minigame.minigame_flags & NMM_TURN_TEAM ) == TMID(e.team) )
{
tile = nmm_find_tile(minigame,argv(1));
if ( !tile )
}
else if ( minigame.minigame_flags & NMM_TURN_PLACE )
{
- piece = nmm_find_piece(world,minigame,e.team,NMM_PIECE_HOME);
+ piece = nmm_find_piece(world,minigame,TMID(e.team),NMM_PIECE_HOME);
if ( !tile.nmm_tile_piece && piece )
{
tile.nmm_tile_piece = piece;
}
}
- int nextteam = e.team % 2 + 1;
+ int nextteam = TMID(e.team) % 2 + 1;
int npieces = nmm_count_pieces(minigame,nextteam,NMM_PIECE_HOME|NMM_PIECE_BOARD);
if ( npieces < 3 )
{
- minigame.minigame_flags = NMM_TURN_WIN | e.team;
+ minigame.minigame_flags = NMM_TURN_WIN | TMID(e.team);
minigame.SendFlags |= MINIG_SF_UPDATE;
}
else if ( move_ok)
{
if ( !(minigame.minigame_flags & NMM_TURN_TAKE) && nmm_in_mill(tile) )
{
- minigame.minigame_flags = NMM_TURN_TAKE|e.team;
+ minigame.minigame_flags = NMM_TURN_TAKE|TMID(e.team);
int takemill = NMM_TURN_TAKEANY;
entity f = world;
while ( ( f = findentity(f,owner,minigame) ) )
if ( f.classname == "minigame_nmm_tile" && f.nmm_tile_piece &&
- f.nmm_tile_piece.team == nextteam && !nmm_in_mill(f) )
+ TMID(f.nmm_tile_piece.team) == nextteam && !nmm_in_mill(f) )
{
takemill = 0;
break;
minigame.minigame_flags = NMM_TURN_FLY|nextteam;
else
{
- minigame.minigame_flags = NMM_TURN_WIN|e.team;
+ minigame.minigame_flags = NMM_TURN_WIN|TMID(e.team);
entity f = world;
while ( ( f = findentity(f,owner,minigame) ) )
if ( f.classname == "minigame_nmm_tile" && f.nmm_tile_piece &&
- f.nmm_tile_piece.team == nextteam && nmm_tile_canmove(f) )
+ TMID(f.nmm_tile_piece.team) == nextteam && nmm_tile_canmove(f) )
{
minigame.minigame_flags = NMM_TURN_MOVE|nextteam;
break;
// whether the given tile is a valid selection
bool nmm_valid_selection(entity tile)
{
- if ( ( tile.owner.minigame_flags & NMM_TURN_TEAM ) != minigame_self.team )
+ if ( ( tile.owner.minigame_flags & NMM_TURN_TEAM ) != TMID(minigame_self.team) )
return false; // not our turn
if ( tile.owner.minigame_flags & NMM_TURN_PLACE )
return !tile.nmm_tile_piece; // need to put a piece on an empty spot
// whether it should highlight valid tile selections
bool nmm_draw_avaliable(entity tile)
{
- if ( ( tile.owner.minigame_flags & NMM_TURN_TEAM ) != minigame_self.team )
+ if ( ( tile.owner.minigame_flags & NMM_TURN_TEAM ) != TMID(minigame_self.team) )
return false;
if ( (tile.owner.minigame_flags & NMM_TURN_TAKE) )
return true;
if ( e.nmm_tile_piece )
{
minigame_drawpic_centered( tile_pos,
- minigame_texture(strcat("nmm/piece",ftos(e.nmm_tile_piece.team))),
+ minigame_texture(strcat("nmm/piece",ftos(TMID(e.nmm_tile_piece.team)))),
tile_size*0.8, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL );
}
string playername = "";
FOREACH_MINIGAME_ENTITY(e)
if ( e.classname == "minigame_player" &&
- e.team == (active_minigame.minigame_flags & NMM_TURN_TEAM) )
+ TMID(e.team) == (active_minigame.minigame_flags & NMM_TURN_TEAM) )
playername = entcs_GetName(e.minigame_playerslot-1);
vector win_pos = pos+eY*(mySize_y-winfs_y)/2;
if ( e.classname == "minigame_player" )
{
mypos = pos;
- if ( e.team == 2 )
+ if ( TMID(e.team) == 2 )
mypos_y += player_fontsize_y + ts_y;
minigame_drawcolorcodedstring_trunc(mySize_x,mypos,
entcs_GetName(e.minigame_playerslot-1),
{
mypos = pos;
mypos_y += player_fontsize_y;
- if ( e.team == 2 )
+ if ( TMID(e.team) == 2 )
{
mypos_x += player2x;
player2x += piece_space;
else
piece_light = 0.15;
- drawpic(mypos, minigame_texture(strcat("nmm/piece",ftos(e.team))), piece_sz,
+ drawpic(mypos, minigame_texture(strcat("nmm/piece",ftos(TMID(e.team)))), piece_sz,
'1 1 1'*piece_light, panel_fg_alpha, DRAWFLAG_NORMAL );
}
}
{
if ( turnflags & NMM_TURN_WIN )
{
- if ( (turnflags&NMM_TURN_TEAM) != minigame_self.team )
+ if ( (turnflags&NMM_TURN_TEAM) != TMID(minigame_self.team) )
return _("You lost the game!");
return _("You win!");
}
- if ( (turnflags&NMM_TURN_TEAM) != minigame_self.team )
+ if ( (turnflags&NMM_TURN_TEAM) != TMID(minigame_self.team) )
return _("Wait for your opponent to make their move");
if ( turnflags & NMM_TURN_PLACE )
return _("Click on the game board to place your piece");
nmm_fromtile = world;
nmm_kill_tiles(minigame);
}
- else if ( event == "key_pressed" && (minigame.minigame_flags&NMM_TURN_TEAM) == minigame_self.team )
+ else if ( event == "key_pressed" && (minigame.minigame_flags&NMM_TURN_TEAM) == TMID(minigame_self.team) )
{
switch ( ...(0,int) )
{
else if ( self.classname == "minigame" && ( ...(1,int) & MINIG_SF_UPDATE ) )
{
self.message = nmm_turn_to_string(self.minigame_flags);
- if ( self.minigame_flags & minigame_self.team )
+ if ( self.minigame_flags & TMID(minigame_self.team) )
minigame_prompt();
}
}
ball.velocity_y = sin(angle)*autocvar_sv_minigames_pong_ball_speed;
ball.think = pong_ball_think;
ball.nextthink = time;
- ball.team = 0;
+ ball.__team = 0;
ball.SendFlags |= MINIG_SF_UPDATE|PONG_SF_BALLTEAM;
}
ball.velocity = '0 0 0';
ball.origin = '0.5 0.5 0';
ball.think = SUB_NullThink;
- ball.team = 0;
+ ball.__team = 0;
ball.SendFlags |= MINIG_SF_UPDATE|PONG_SF_BALLTEAM;
ball.think = pong_ball_throwthink;
ball.nextthink = time + autocvar_sv_minigames_pong_ball_wait;
if ( !pong_paddle_hit(ball, pteam) )
{
- pong_add_score(ball.owner ,ball.team, pteam, 1);
+ pong_add_score(ball.owner ,TMID(ball.team), pteam, 1);
pong_ball_reset(ball);
return true;
}
if ( pong_paddle_hit(self, i) )
{
pong_paddle_bounce(self,i);
- self.team = i;
+ self.__team = i;
self.SendFlags |= PONG_SF_BALLTEAM;
return;
}
float self_pos;
- if ( self.team <= 2 )
+ if ( TMID(self.team) <= 2 )
{
if ( ball )
target = ball.origin_y + ball.velocity_y*think_speed;
if ( self.realowner.minigame_players.pong_keys == PONG_KEY_DECREASE )
movement *= -1;
- if ( self.team > 2 )
+ if ( TMID(self.team) > 2 )
self.origin_x = bound(halflen, self.origin_x+movement, 1-halflen);
else
self.origin_y = bound(halflen, self.origin_y+movement, 1-halflen);
paddle.origin = pong_team_to_paddlepos(pl_team);
paddle.think = pong_paddle_think;
paddle.nextthink = time;
- paddle.team = pl_team;
+ paddle.__team = pl_team;
paddle.mins = pong_team_to_box_halfsize(pl_team,-paddle.pong_length,-1/16);
paddle.maxs = pong_team_to_box_halfsize(pl_team,paddle.pong_length,1/16);
obj_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL );
minigame_drawpic_centered( obj_pos, minigame_texture("pong/ball-glow"),
- obj_size, pong_team_to_color(e.team),
+ obj_size, pong_team_to_color(TMID(e.team)),
panel_fg_alpha, DRAWFLAG_ADDITIVE );
}
else if ( e.classname == "pong_paddle" )
obj_pos = minigame_hud_denormalize(e.origin,pos,mySize);
obj_size = minigame_hud_denormalize_size(eX / 16 + eY*e.pong_length,pos,mySize);
- drawrotpic(obj_pos, pong_team_to_angle(e.team), minigame_texture("pong/paddle-glow"),
- obj_size, obj_size/2, pong_team_to_color(e.team),
+ drawrotpic(obj_pos, pong_team_to_angle(TMID(e.team)), minigame_texture("pong/paddle-glow"),
+ obj_size, obj_size/2, pong_team_to_color(TMID(e.team)),
panel_fg_alpha, DRAWFLAG_ADDITIVE );
- drawrotpic(obj_pos, pong_team_to_angle(e.team), minigame_texture("pong/paddle"),
+ drawrotpic(obj_pos, pong_team_to_angle(TMID(e.team)), minigame_texture("pong/paddle"),
obj_size, obj_size/2, '1 1 1',
panel_fg_alpha, DRAWFLAG_NORMAL );
if ( e.classname == "minigame_player" || e.classname == "pong_ai" )
{
mypos = pos;
- mypos_y += (e.team-1) * (player_fontsize_y + ts_y);
+ mypos_y += (TMID(e.team)-1) * (player_fontsize_y + ts_y);
- drawfill(mypos, ts, pong_team_to_color(e.team), 0.25, DRAWFLAG_ADDITIVE);
+ drawfill(mypos, ts, pong_team_to_color(TMID(e.team)), 0.25, DRAWFLAG_ADDITIVE);
minigame_drawcolorcodedstring_trunc(mySize_x,mypos,
(e.minigame_playerslot ? entcs_GetName(e.minigame_playerslot-1) : _("AI")),
'0.7 0.84 1', panel_fg_alpha, DRAWFLAG_NORMAL);
if ( e == minigame_self )
- drawborderlines(1, mypos, ts, pong_team_to_color(e.team), 1, DRAWFLAG_NORMAL);
+ drawborderlines(1, mypos, ts, pong_team_to_color(TMID(e.team)), 1, DRAWFLAG_NORMAL);
}
}
}
int letter = minigame_tile_letter(piece.netname);
// here goes
- if(!pp_valid_tile(minigame_tile_buildname(letter-1,number)) || pp_find_piece(piece.owner,minigame_tile_buildname(letter-1,number)).team == 5)
- if(!pp_valid_tile(minigame_tile_buildname(letter+1,number)) || pp_find_piece(piece.owner,minigame_tile_buildname(letter+1,number)).team == 5)
- if(!pp_valid_tile(minigame_tile_buildname(letter,number-1)) || pp_find_piece(piece.owner,minigame_tile_buildname(letter,number-1)).team == 5)
- if(!pp_valid_tile(minigame_tile_buildname(letter,number+1)) || pp_find_piece(piece.owner,minigame_tile_buildname(letter,number+1)).team == 5)
- if(!pp_valid_tile(minigame_tile_buildname(letter+1,number+1)) || pp_find_piece(piece.owner,minigame_tile_buildname(letter+1,number+1)).team == 5)
- if(!pp_valid_tile(minigame_tile_buildname(letter-1,number-1)) || pp_find_piece(piece.owner,minigame_tile_buildname(letter-1,number-1)).team == 5)
- if(!pp_valid_tile(minigame_tile_buildname(letter+1,number-1)) || pp_find_piece(piece.owner,minigame_tile_buildname(letter+1,number-1)).team == 5)
- if(!pp_valid_tile(minigame_tile_buildname(letter-1,number+1)) || pp_find_piece(piece.owner,minigame_tile_buildname(letter-1,number+1)).team == 5)
+ if(!pp_valid_tile(minigame_tile_buildname(letter-1,number )) || TMID(pp_find_piece(piece.owner,minigame_tile_buildname(letter-1,number )).team) == 5)
+ if(!pp_valid_tile(minigame_tile_buildname(letter+1,number )) || TMID(pp_find_piece(piece.owner,minigame_tile_buildname(letter+1,number )).team) == 5)
+ if(!pp_valid_tile(minigame_tile_buildname(letter ,number-1)) || TMID(pp_find_piece(piece.owner,minigame_tile_buildname(letter, number-1)).team) == 5)
+ if(!pp_valid_tile(minigame_tile_buildname(letter ,number+1)) || TMID(pp_find_piece(piece.owner,minigame_tile_buildname(letter, number+1)).team) == 5)
+ if(!pp_valid_tile(minigame_tile_buildname(letter+1,number+1)) || TMID(pp_find_piece(piece.owner,minigame_tile_buildname(letter+1,number+1)).team) == 5)
+ if(!pp_valid_tile(minigame_tile_buildname(letter-1,number-1)) || TMID(pp_find_piece(piece.owner,minigame_tile_buildname(letter-1,number-1)).team) == 5)
+ if(!pp_valid_tile(minigame_tile_buildname(letter+1,number-1)) || TMID(pp_find_piece(piece.owner,minigame_tile_buildname(letter+1,number-1)).team) == 5)
+ if(!pp_valid_tile(minigame_tile_buildname(letter-1,number+1)) || TMID(pp_find_piece(piece.owner,minigame_tile_buildname(letter-1,number+1)).team) == 5)
return true;
return false;
{
if(!pp_valid_tile(pos))
return false;
- if(pp_find_piece(minigame,pos).team == 5)
+ if(TMID(pp_find_piece(minigame,pos).team) == 5)
return false;
entity current = minigame.pp_curr_piece;
void pp_move(entity minigame, entity player, string pos )
{
if ( minigame.minigame_flags & PP_TURN_PLACE )
- if ( pos && player.team == (minigame.minigame_flags & PP_TURN_TEAM) )
+ if ( pos && TMID(player.team) == (minigame.minigame_flags & PP_TURN_TEAM) )
{
if ( pp_valid_move(minigame,pos))
{
entity existing = pp_find_piece(minigame,pos);
- if(existing && existing.team != 5)
+ if(existing && TMID(existing.team) != 5)
{
- if(existing.team == 1)
+ if(TMID(existing.team) == 1)
minigame.pp_team1_score++;
- if(existing.team == 2)
+ if(TMID(existing.team) == 2)
minigame.pp_team2_score++;
}
if(minigame.pp_curr_piece)
{
minigame.pp_curr_piece.cnt = 0;
- minigame.pp_curr_piece.team = 5;
+ minigame.pp_curr_piece.__team = 5;
minigame_server_sendflags(minigame.pp_curr_piece,MINIG_SF_ALL);
}
piece.netname = strzone(pos);
minigame_server_sendflags(piece,MINIG_SF_ALL);
minigame_server_sendflags(minigame,MINIG_SF_UPDATE);
- minigame.pp_nexteam = minigame_next_team(player.team,2);
+ minigame.pp_nexteam = minigame_next_team(TMID(player.team),2);
minigame.pp_curr_piece = piece;
if ( pp_winning_piece(piece) )
{
if(t1_true || t2_true)
{
entity piece = msle_spawn(minigame,"minigame_board_piece");
- piece.team = ((t1_true) ? 1 : 2);
+ piece.__team = ((t1_true) ? 1 : 2);
piece.netname = strzone(minigame_tile_buildname(i,t));
minigame_server_sendflags(piece,MINIG_SF_ALL);
minigame_server_sendflags(minigame,MINIG_SF_UPDATE);
// on multiplayer matches, wait for both players to agree
if ( minigame.minigame_flags & (PP_TURN_WIN|PP_TURN_DRAW) )
{
- minigame.minigame_flags = PP_TURN_NEXT | player.team;
+ minigame.minigame_flags = PP_TURN_NEXT | TMID(player.team);
minigame.SendFlags |= MINIG_SF_UPDATE;
}
else if ( (minigame.minigame_flags & PP_TURN_NEXT) &&
- !( minigame.minigame_flags & player.team ) )
+ !( minigame.minigame_flags & TMID(player.team) ) )
#endif
{
minigame.minigame_flags = PP_TURN_PLACE | minigame.pp_nexteam;
// Get the right team
if(minigame.minigame_players)
- return minigame_next_team(minigame.minigame_players.team, 2);
+ return minigame_next_team(TMID(minigame.minigame_players.team), 2);
// Team 1 by default
return 1;
tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize);
vector tile_color = '1 1 1';
- switch(e.team)
+ switch(TMID(e.team))
{
case 1: tile_color = '1 0.3 0.3'; break;
case 2: tile_color = '0.3 0.3 1'; break;
// 3, 4 coming later?
}
- string tile_name = strcat("pp/piece",ftos(e.team));
- if(e.team == 5) { tile_name = "pp/piece_taken"; }
+ string tile_name = strcat("pp/piece",ftos(TMID(e.team)));
+ if(TMID(e.team) == 5) { tile_name = "pp/piece_taken"; }
if(e == active_minigame.pp_curr_piece)
{
}
}
- if ( (active_minigame.minigame_flags & PP_TURN_TEAM) == minigame_self.team )
+ if ( (active_minigame.minigame_flags & PP_TURN_TEAM) == TMID(minigame_self.team) )
if ( pp_valid_move(active_minigame, pp_curr_pos) )
{
tile_pos = minigame_tile_pos(pp_curr_pos,PP_LET_CNT,PP_NUM_CNT);
string playername = "";
FOREACH_MINIGAME_ENTITY(e)
if ( e.classname == "minigame_player" &&
- e.team == (active_minigame.minigame_flags & PP_TURN_TEAM) )
+ TMID(e.team) == (active_minigame.minigame_flags & PP_TURN_TEAM) )
playername = entcs_GetName(e.minigame_playerslot-1);
vector win_pos = pos+eY*(mySize_y-winfs_y)/2;
if ( e.classname == "minigame_player" )
{
vector tile_color = '1 1 1';
- switch(e.team)
+ switch(TMID(e.team))
{
case 1: tile_color = '1 0.3 0.3'; break;
case 2: tile_color = '0.3 0.3 1'; break;
}
mypos = pos;
- if ( e.team == 2 )
+ if ( TMID(e.team) == 2 )
mypos_y += player_fontsize_y + ts_y;
minigame_drawcolorcodedstring_trunc(mySize_x,mypos,
entcs_GetName(e.minigame_playerslot-1),
mypos_y += player_fontsize_y;
drawpic( mypos,
- minigame_texture(strcat("pp/piece",ftos(e.team))),
+ minigame_texture(strcat("pp/piece",ftos(TMID(e.team)))),
tile_size, tile_color, panel_fg_alpha, DRAWFLAG_NORMAL );
mypos_x += tile_size_x;
int myscore = 0;
- if(e.team == 1) { myscore = active_minigame.pp_team1_score; }
- if(e.team == 2) { myscore = active_minigame.pp_team2_score; }
+ if(TMID(e.team) == 1) { myscore = active_minigame.pp_team1_score; }
+ if(TMID(e.team) == 2) { myscore = active_minigame.pp_team2_score; }
drawstring(mypos,ftos(myscore),tile_size,
'0.7 0.84 1', panel_fg_alpha, DRAWFLAG_NORMAL);
if ( turnflags & PP_TURN_WIN )
{
- if ( (turnflags&PP_TURN_TEAM) != minigame_self.team )
+ if ( (turnflags&PP_TURN_TEAM) != TMID(minigame_self.team) )
return _("You lost the game!\nSelect \"^1Next Match^7\" on the menu for a rematch!");
return _("You win!\nSelect \"^1Next Match^7\" on the menu to start a new match!");
}
if ( turnflags & PP_TURN_NEXT )
{
- if ( (turnflags&PP_TURN_TEAM) != minigame_self.team )
+ if ( (turnflags&PP_TURN_TEAM) != TMID(minigame_self.team) )
return _("Select \"^1Next Match^7\" on the menu to start a new match!");
return _("Wait for your opponent to confirm the rematch");
}
- if ( (turnflags & PP_TURN_TEAM) != minigame_self.team )
+ if ( (turnflags & PP_TURN_TEAM) != TMID(minigame_self.team) )
return _("Wait for your opponent to make their move");
if ( turnflags & PP_TURN_PLACE )
// Make the correct move
void pp_make_move(entity minigame)
{
- if ( minigame.minigame_flags == (PP_TURN_PLACE|minigame_self.team) )
+ if ( minigame.minigame_flags == (PP_TURN_PLACE|TMID(minigame_self.team)) )
{
minigame_cmd("move ",pp_curr_pos);
}
}
case "key_pressed":
{
- if((minigame.minigame_flags & PP_TURN_TEAM) == minigame_self.team)
+ if((minigame.minigame_flags & PP_TURN_TEAM) == TMID(minigame_self.team))
{
switch ( ...(0,int) )
{
case "mouse_moved":
{
vector mouse_pos = minigame_hud_normalize(mousepos,pp_boardpos,pp_boardsize);
- if ( minigame.minigame_flags == (PP_TURN_PLACE|minigame_self.team) )
+ if ( minigame.minigame_flags == (PP_TURN_PLACE|TMID(minigame_self.team)) )
pp_set_curr_pos(minigame_tile_name(mouse_pos,PP_LET_CNT,PP_NUM_CNT));
if ( ! pp_valid_tile(pp_curr_pos) )
pp_set_curr_pos("");
if ( sf & MINIG_SF_UPDATE )
{
sent.message = pp_turn_to_string(sent.minigame_flags);
- if ( sent.minigame_flags & minigame_self.team )
+ if ( sent.minigame_flags & TMID(minigame_self.team) )
minigame_prompt();
sent.pp_team1_score = ReadByte();
sent.pp_team2_score = ReadByte();
if(i == floor(PS_NUM_CNT * 0.5) && t == floor(PS_LET_CNT * 0.5))
continue; // middle piece is empty
entity piece = msle_spawn(minigame,"minigame_board_piece");
- piece.team = 1; // init default team?
+ piece.__team = 1; // init default team?
piece.netname = strzone(minigame_tile_buildname(t,i));
minigame_server_sendflags(piece,MINIG_SF_ALL);
}
if ( sf & MINIG_SF_UPDATE )
{
sent.message = ps_turn_to_string(sent.minigame_flags);
- if ( sent.minigame_flags & minigame_self.team )
+ if ( sent.minigame_flags & TMID(minigame_self.team) )
minigame_prompt();
}
}
{
entity e = world;
while ( ( e = findentity(e,owner,minig) ) )
- if ( e.classname == "minigame_board_piece" && e.cnt == tile && e.team == steam )
+ if ( e.classname == "minigame_board_piece" && e.cnt == tile && TMID(e.team) == steam )
return e;
return world;
}
{
entity e = world;
while ( ( e = findentity(e,owner,minig) ) )
- if ( e.classname == "minigame_board_piece" && e.cnt == 1 && e.team == steam )
+ if ( e.classname == "minigame_board_piece" && e.cnt == 1 && TMID(e.team) == steam )
return e;
return world;
}
}
entity piece = msle_spawn(minigame,"minigame_board_piece");
- piece.team = 0;
+ piece.__team = 0;
piece.netname = strzone(RandomSelection_chosen_string);
minigame_server_sendflags(piece,MINIG_SF_ALL);
}
entity piece = msle_spawn(minigame,"minigame_board_piece");
- piece.team = pteam;
+ piece.__team = pteam;
piece.netname = strzone(RandomSelection_chosen_string);
piece.cnt = 1;
piece.snake_next = world;
while( (e = findentity(e,owner,minigame)) )
if ( e.classname == "minigame_player" )
#endif
- if(e.team == pteam)
+ if(TMID(e.team) == pteam)
return e;
return world;
}
int newcnt = tail.cnt + 1;
head.snake_delay = max(autocvar_sv_minigames_snake_delay_min, autocvar_sv_minigames_snake_delay_initial - (newcnt / autocvar_sv_minigames_snake_delay_multiplier));
- snake_add_score(minigame, head.team, 1);
+ snake_add_score(minigame, TMID(head.team), 1);
entity piece = msle_spawn(minigame,"minigame_board_piece");
piece.cnt = newcnt;
entity e = world;
while ( ( e = findentity(e,owner,minigame) ) )
- if ( e.classname == "minigame_board_piece" && e.cnt && e.team == pteam )
+ if ( e.classname == "minigame_board_piece" && e.cnt && TMID(e.team) == pteam )
{
if(e.netname) { strunzone(e.netname); }
remove(e);
}
else
{
- snake_add_score(minigame, head.team, -1);
- snake_eat_team(minigame, head.team);
+ snake_add_score(minigame, TMID(head.team), -1);
+ snake_eat_team(minigame, TMID(head.team));
}
return;
// above check makes sure it's not our team
if(hit.cnt)
{
- snake_eat_team(minigame, hit.team);
- snake_add_score(minigame, head.team, 1);
+ snake_eat_team(minigame, TMID(hit.team));
+ snake_add_score(minigame, TMID(head.team), 1);
}
if(ate_mouse)
//if ( snake_valid_tile(pos) )
//if ( snake_find_piece(minigame, pos) )
{
- entity head = snake_find_head(minigame, player.team);
+ entity head = snake_find_head(minigame, TMID(player.team));
if(!head)
return; // their head is already dead
else if ( sent.classname == "minigame_player" && (sf & SNAKE_SF_PLAYERSCORE ) )
{
WriteLong(MSG_ENTITY,sent.snake_score);
- WriteByte(MSG_ENTITY,max(0, minigame.snake_lives[sent.team]));
+ WriteByte(MSG_ENTITY,max(0, minigame.snake_lives[TMID(sent.team)]));
}
else if ( sent.classname == "minigame" && (sf & MINIG_SF_UPDATE ) )
{
tile_pos = minigame_tile_pos(e.netname,SNAKE_NUM_CNT,SNAKE_LET_CNT);
tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize);
- vector tile_color = snake_teamcolor(e.team);
+ vector tile_color = snake_teamcolor(TMID(e.team));
string thepiece = "snake/mouse";
if(e.cnt)
{
int thex = minigame_tile_letter(e.netname);
int they = minigame_tile_number(e.netname);
- entity t = snake_find_cnt(active_minigame, e.team, e.cnt - 1);
+ entity t = snake_find_cnt(active_minigame, TMID(e.team), e.cnt - 1);
int tx = minigame_tile_letter(t.netname);
int ty = minigame_tile_number(t.netname);
}
}
- if ( (active_minigame.minigame_flags & SNAKE_TURN_LOSS) || (active_minigame.minigame_flags & SNAKE_TURN_WIN) || (active_minigame.snake_lives[minigame_self.team] <= 0) )
+ if ( (active_minigame.minigame_flags & SNAKE_TURN_LOSS) || (active_minigame.minigame_flags & SNAKE_TURN_WIN) || (active_minigame.snake_lives[TMID(minigame_self.team)] <= 0) )
{
int scores = minigame_self.snake_score;
scores_text = strcat("Score: ", ftos(scores));
if(active_minigame.minigame_flags & SNAKE_TURN_WIN)
- if((active_minigame.minigame_flags & SNAKE_TURN_TEAM) == minigame_self.team)
+ if((active_minigame.minigame_flags & SNAKE_TURN_TEAM) == TMID(minigame_self.team))
victory_text = "You win!";
- if(active_minigame.snake_lives[minigame_self.team] <= 0)
+ if(active_minigame.snake_lives[TMID(minigame_self.team)] <= 0)
victory_text = "You ran out of lives!";
vector win_pos = pos+eY*(mySize_y-winfs_y)/2;
if ( e.classname == "minigame_player" )
{
mypos = pos;
- mypos_y += (e.team-1) * (player_fontsize_y + ts_y);
+ mypos_y += (TMID(e.team)-1) * (player_fontsize_y + ts_y);
- drawfill(mypos, ts, snake_teamcolor(e.team), 0.25, DRAWFLAG_ADDITIVE);
+ drawfill(mypos, ts, snake_teamcolor(TMID(e.team)), 0.25, DRAWFLAG_ADDITIVE);
minigame_drawcolorcodedstring_trunc(mySize_x,mypos,
entcs_GetName(e.minigame_playerslot-1),
drawstring(mypos+eY*player_fontsize_y,ftos(e.snake_score),'48 48 0' * (SNAKE_TEAMS * 0.1),
'0.7 0.84 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring(mypos+(eY*player_fontsize_y) + (eX*player_fontsize_x),strcat("1UP: ", ftos(active_minigame.snake_lives[e.team])),'48 48 0' * (SNAKE_TEAMS * 0.1),
+ drawstring(mypos+(eY*player_fontsize_y) + (eX*player_fontsize_x),strcat("1UP: ", ftos(active_minigame.snake_lives[TMID(e.team)])),'48 48 0' * (SNAKE_TEAMS * 0.1),
'1 0.44 0.54', panel_fg_alpha, DRAWFLAG_NORMAL);
if ( e == minigame_self )
- drawborderlines(1, mypos, ts, snake_teamcolor(e.team), 1, DRAWFLAG_NORMAL);
+ drawborderlines(1, mypos, ts, snake_teamcolor(TMID(e.team)), 1, DRAWFLAG_NORMAL);
}
}
}
if ( turnflags & SNAKE_TURN_WIN )
{
- if ( (turnflags&SNAKE_TURN_TEAM) != minigame_self.team )
+ if ( (turnflags&SNAKE_TURN_TEAM) != TMID(minigame_self.team) )
return _("You ran out of lives!");
return _("You win!");
}
- if(active_minigame.snake_lives[minigame_self.team] <= 0)
+ if(active_minigame.snake_lives[TMID(minigame_self.team)] <= 0)
return _("You ran out of lives!");
- if ( (snake_find_head(active_minigame, minigame_self.team)).snake_dir == '0 0 0' )
+ if ( (snake_find_head(active_minigame, TMID(minigame_self.team))).snake_dir == '0 0 0' )
return _("Press an arrow key to begin the game");
if ( turnflags & SNAKE_TURN_MOVE )
else if ( sent.classname == "minigame_player" && (sf & SNAKE_SF_PLAYERSCORE ) )
{
sent.snake_score = ReadLong();
- minigame.snake_lives[sent.team] = ReadByte();
+ minigame.snake_lives[TMID(sent.team)] = ReadByte();
}
return false;
void ttt_move(entity minigame, entity player, string pos )
{
if ( minigame.minigame_flags & TTT_TURN_PLACE )
- if ( pos && player.team == (minigame.minigame_flags & TTT_TURN_TEAM) )
+ if ( pos && TMID(player.team) == (minigame.minigame_flags & TTT_TURN_TEAM) )
{
if ( ttt_valid_tile(pos) )
if ( !ttt_find_piece(minigame,pos) )
piece.team = player.team;
piece.netname = strzone(pos);
minigame_server_sendflags(piece,MINIG_SF_ALL);
- minigame_server_sendflags(minigame,MINIG_SF_UPDATE);
+ minigame_server_sendflags(minigame, MINIG_SF_UPDATE);
minigame.ttt_npieces++;
- minigame.ttt_nexteam = minigame_next_team(player.team,2);
+ minigame.ttt_nexteam = minigame_next_team(TMID(player.team), 2);
if ( ttt_winning_piece(piece) )
{
player.minigame_flags++;
minigame_server_sendflags(player, TTT_SF_PLAYERSCORE);
- minigame.minigame_flags = TTT_TURN_WIN | player.team;
+ minigame.minigame_flags = TTT_TURN_WIN | TMID(player.team);
}
else if ( minigame.ttt_npieces >= (TTT_LET_CNT * TTT_NUM_CNT) )
minigame.minigame_flags = TTT_TURN_DRAW;
// on multiplayer matches, wait for both players to agree
if ( minigame.minigame_flags & (TTT_TURN_WIN|TTT_TURN_DRAW) )
{
- minigame.minigame_flags = TTT_TURN_NEXT | player.team;
+ minigame.minigame_flags = TTT_TURN_NEXT | TMID(player.team);
minigame.SendFlags |= MINIG_SF_UPDATE;
}
else if ( (minigame.minigame_flags & TTT_TURN_NEXT) &&
- !( minigame.minigame_flags & player.team ) )
+ !( minigame.minigame_flags & TMID(player.team) ) )
#endif
{
minigame.minigame_flags = TTT_TURN_PLACE | minigame.ttt_nexteam;
// Get the right team
if(minigame.minigame_players)
- return minigame_next_team(minigame.minigame_players.team, 2);
+ return minigame_next_team(TMID(minigame.minigame_players.team), 2);
// Team 1 by default
return 1;
case "singleplayer":
if ( minigame_count_players(minigame) == 1 )
{
- minigame.ttt_ai = minigame_next_team(minigame.minigame_players.team, 2);
+ minigame.ttt_ai = minigame_next_team(TMID(minigame.minigame_players.team), 2);
minigame.SendFlags = TTT_SF_SINGLEPLAYER;
}
return true;
vector tile_size = minigame_hud_denormalize_size('1 1 0'/TTT_TILE_SIZE,pos,mySize);
vector tile_pos;
- if ( (active_minigame.minigame_flags & TTT_TURN_TEAM) == minigame_self.team )
+ if ( (active_minigame.minigame_flags & TTT_TURN_TEAM) == TMID(minigame_self.team) )
if ( ttt_valid_tile(ttt_curr_pos) )
{
tile_pos = minigame_tile_pos(ttt_curr_pos,TTT_LET_CNT,TTT_NUM_CNT);
tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize);
minigame_drawpic_centered( tile_pos,
- minigame_texture(strcat("ttt/piece",ftos(minigame_self.team))),
+ minigame_texture(strcat("ttt/piece",ftos(TMID(minigame_self.team)))),
tile_size, '1 1 1', panel_fg_alpha/2, DRAWFLAG_NORMAL );
}
}
minigame_drawpic_centered( tile_pos,
- minigame_texture(strcat("ttt/piece",ftos(e.team))),
+ minigame_texture(strcat("ttt/piece",ftos(TMID(e.team)))),
tile_size, '1 1 1'*icon_color, panel_fg_alpha, DRAWFLAG_NORMAL );
}
}
if ( e.classname == "minigame_player" )
{
mypos = pos;
- if ( e.team == 2 )
+ if ( TMID(e.team) == 2 )
mypos_y += player_fontsize_y + ts_y;
minigame_drawcolorcodedstring_trunc(mySize_x,mypos,
(e.minigame_playerslot ? entcs_GetName(e.minigame_playerslot-1) : _("AI")),
mypos_y += player_fontsize_y;
drawpic( mypos,
- minigame_texture(strcat("ttt/piece",ftos(e.team))),
+ minigame_texture(strcat("ttt/piece",ftos(TMID(e.team)))),
tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL );
mypos_x += tile_size_x;
if ( turnflags & TTT_TURN_WIN )
{
- if ( (turnflags&TTT_TURN_TEAM) != minigame_self.team )
+ if ( (turnflags&TTT_TURN_TEAM) != TMID(minigame_self.team) )
return _("You lost the game!\nSelect \"^1Next Match^7\" on the menu for a rematch!");
return _("You win!\nSelect \"^1Next Match^7\" on the menu to start a new match!");
}
if ( turnflags & TTT_TURN_NEXT )
{
- if ( (turnflags&TTT_TURN_TEAM) != minigame_self.team )
+ if ( (turnflags&TTT_TURN_TEAM) != TMID(minigame_self.team) )
return _("Select \"^1Next Match^7\" on the menu to start a new match!");
return _("Wait for your opponent to confirm the rematch");
}
- if ( (turnflags & TTT_TURN_TEAM) != minigame_self.team )
+ if ( (turnflags & TTT_TURN_TEAM) != TMID(minigame_self.team) )
return _("Wait for your opponent to make their move");
if ( turnflags & TTT_TURN_PLACE )
// Make the correct move
void ttt_make_move(entity minigame)
{
- if ( minigame.minigame_flags == (TTT_TURN_PLACE|minigame_self.team) )
+ if ( minigame.minigame_flags == (TTT_TURN_PLACE|TMID(minigame_self.team)) )
{
if ( minigame.ttt_ai )
{
}
case "key_pressed":
{
- if((minigame.minigame_flags & TTT_TURN_TEAM) == minigame_self.team)
+ if((minigame.minigame_flags & TTT_TURN_TEAM) == TMID(minigame_self.team))
{
switch ( ...(0,int) )
{
case "mouse_moved":
{
vector mouse_pos = minigame_hud_normalize(mousepos,ttt_boardpos,ttt_boardsize);
- if ( minigame.minigame_flags == (TTT_TURN_PLACE|minigame_self.team) )
+ if ( minigame.minigame_flags == (TTT_TURN_PLACE|TMID(minigame_self.team)) )
ttt_set_curr_pos(minigame_tile_name(mouse_pos,TTT_LET_CNT,TTT_NUM_CNT));
if ( ! ttt_valid_tile(ttt_curr_pos) )
ttt_set_curr_pos("");
if ( sf & MINIG_SF_UPDATE )
{
sent.message = ttt_turn_to_string(sent.minigame_flags);
- if ( sent.minigame_flags & minigame_self.team )
+ if ( sent.minigame_flags & TMID(minigame_self.team) )
minigame_prompt();
}
{
entity aiplayer = new(minigame_player);
aiplayer.owner = minigame;
- aiplayer.team = ai;
+ aiplayer.__team = ai;
aiplayer.minigame_playerslot = 0;
aiplayer.minigame_autoclean = 1;
ttt_aimove(minigame);
WriteLong(MSG_ENTITY,etof(self.minigame_players));
}
if ( sf & MINIG_SF_UPDATE )
- WriteByte(MSG_ENTITY,self.team);
+ WriteByte(MSG_ENTITY, TMID(self.team));
}
MINIGAME_SIMPLELINKED_ENTITIES
{
player_pointer.owner = minigame_session;
player_pointer.minigame_players = player;
- player_pointer.team = mgteam;
+ player_pointer.__team = mgteam;
player_pointer.list_next = minigame_session.minigame_players;
minigame_session.minigame_players = player_pointer;
player.active_minigame = minigame_session;
if(IS_PLAYER(mon.realowner))
mon.colormap = mon.realowner.colormap;
else if(teamplay && mon.team)
- mon.colormap = 1024 + (mon.team - 1) * 17;
+ mon.colormap = 1024 + (TMID(mon.team) - 1) * 17;
else
{
if(mon.monster_skill <= MONSTER_SKILL_EASY)
{
if(!teamplay) { return; }
- ent.team = newteam;
+ ent.__team = newteam;
ent.monster_attack = true; // new team, activate attacking
monster_setupcolors(ent);
{
WaypointSprite_UpdateTeamRadar(ent.sprite, RADARICON_DANGER, ((newteam) ? Team_ColorRGB(newteam) : '1 0 0'));
- ent.sprite.team = newteam;
+ ent.sprite.__team = newteam;
ent.sprite.SendFlags |= 1;
}
}
if(autocvar_g_monsters_healthbars)
{
- entity wp = WaypointSprite_Spawn(WP_Monster, 0, 1024, this, '0 0 1' * (this.maxs.z + 15), world, this.team, this, sprite, true, RADARICON_DANGER);
+ entity wp = WaypointSprite_Spawn(WP_Monster, 0, 1024, this, '0 0 1' * (this.maxs.z + 15), world, TMID(this.team), this, sprite, true, RADARICON_DANGER);
wp.wp_extra = this.monsterid;
- wp.colormod = ((this.team) ? Team_ColorRGB(this.team) : '1 0 0');
+ wp.colormod = ((TMID(this.team)) ? Team_ColorRGB(TMID(this.team)) : '1 0 0');
if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE))
{
WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);
if(this.monster_skill == MONSTER_SKILL_HARD) if(this.spawnflags & MONSTERSKILL_NOTHARD) { Monster_Remove(this); return false; }
if(this.team && !teamplay)
- this.team = 0;
+ this.__team = 0;
if(!(this.spawnflags & MONSTERFLAG_SPAWNED)) // naturally spawned monster
if(!(this.spawnflags & MONSTERFLAG_RESPAWNED)) // don't count re-spawning monsters either
void buff_Init_Compat(entity ent, entity replacement);
#define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \
self.buffs = b.m_itemid; \
- self.team = t; \
+ self.__team = t; \
buff_Init(self); \
}
#define BUFF_SPAWNFUNCS(e, b) \
void buff_Waypoint_Spawn(entity e)
{
entity buff = buff_FirstFromFlags(e.buffs);
- entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, world, e.team, e, buff_waypoint, true, RADARICON_Buff);
+ entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, world, TMID(e.team), e, buff_waypoint, true, RADARICON_Buff);
wp.wp_extra = buff.m_id;
WaypointSprite_UpdateTeamRadar(e.buff_waypoint, RADARICON_Buff, e.glowmod);
e.buff_waypoint.waypointsprite_visible_for_player = buff_Waypoint_visible_for_player;
{SELFPARAM();
if(!cvar("g_buffs")) { remove(ent); return; }
- if(!teamplay && ent.team) { ent.team = 0; }
+ if(!teamplay && ent.team) { ent.__team = 0; }
entity buff = buff_FirstFromFlags(self.buffs);
void buff_Init_Compat(entity ent, entity replacement)
{
if (ent.spawnflags & 2)
- ent.team = NUM_TEAM_1;
+ ent.__team = NUM_TEAM_1;
else if (ent.spawnflags & 4)
- ent.team = NUM_TEAM_2;
+ ent.__team = NUM_TEAM_2;
ent.buffs = replacement.m_itemid;
if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null)
{
setmodel(self, MDL_PROJECTILE_NADE);
- entity trail = Nade_TrailEffect(self.cnt, self.team);
+ entity trail = Nade_TrailEffect(self.cnt, TMID(self.team));
if (trail.eent_eff_name) self.traileffect = trail.m_id;
return true;
}
{
if ( autocvar_g_nades_ice_explode )
{
- entity expef = EFFECT_NADE_EXPLODE(self.realowner.team);
+ entity expef = EFFECT_NADE_EXPLODE(TMID(self.realowner.team));
Send_Effect(expef, self.origin + '0 0 1', '0 0 0', 1);
sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
case NADE_TYPE_MONSTER:
case NADE_TYPE_SPAWN:
nade_blast = false;
- switch(self.realowner.team)
+ switch(TMID(self.realowner.team))
{
case NUM_TEAM_1: expef = EFFECT_SPAWN_RED; break;
case NUM_TEAM_2: expef = EFFECT_SPAWN_BLUE; break;
default:
case NADE_TYPE_NORMAL:
- expef = EFFECT_NADE_EXPLODE(self.realowner.team);
+ expef = EFFECT_NADE_EXPLODE(TMID(self.realowner.team));
break;
}
{
//self.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
if(!self.traileffectnum)
- self.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(self.nade_type).m_projectile[false], self.team).eent_eff_name);
+ self.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(self.nade_type).m_projectile[false], TMID(self.team)).eent_eff_name);
self.alpha = 1;
}
//setattachment(n, player, "bip01 l hand");
n.exteriormodeltoclient = player;
n.customizeentityforclient = nade_customize;
- n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], player.team).eent_eff_name);
+ n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], TMID(player.team)).eent_eff_name);
n.colormod = Nades_from(n.nade_type).m_color;
n.realowner = nowner;
n.colormap = player.colormap;
int num_red = 0, num_blue = 0, num_yellow = 0, num_pink = 0;
FOREACH_CLIENT(IS_PLAYER(it),
{
- switch(it.team)
+ switch(TMID(it.team))
{
case NUM_TEAM_1: ++num_red; break;
case NUM_TEAM_2: ++num_blue; break;
if (sendflags & 1)
{
- WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, TMID(self.team));
WriteByte(MSG_ENTITY, self.rule);
}
if (sendflags & 1)
{
- this.team = ReadByte();
+ this.__team = ReadByte();
this.rule = ReadByte();
}
case SPRITERULE_DEFAULT:
if (this.team)
{
- if (this.team == t)
+ if (TMID(this.team) == t)
spriteimage = this.netname;
else
spriteimage = "";
case SPRITERULE_TEAMPLAY:
if (t == NUM_SPECTATOR + 1)
spriteimage = this.netname3;
- else if (this.team == t)
+ else if (TMID(this.team) == t)
spriteimage = this.netname2;
else
spriteimage = this.netname;
{
// no check, as this is never called without doing an actual change (usually only once)
e.rule = r;
- e.team = t;
+ e.__team = t;
e.SendFlags |= 1;
}
else
setorigin(wp, ofs);
wp.enemy = showto;
- wp.team = t;
+ wp.__team = t;
wp.owner = own;
wp.currentammo = hideable;
if (own)
{SELFPARAM();
float t;
if (teamplay)
- t = self.team;
+ t = TMID(self.team);
else
t = 0;
float maxdistance;
if (self.waypointsprite_attachedforcarrier)
return world; // can't attach to FC
if (teamplay)
- t = self.team;
+ t = TMID(self.team);
else
t = 0;
float maxdistance;
)
{
WaypointSprite_Kill(carrier.waypointsprite_attached); // FC overrides attached
- entity e = WaypointSprite_Spawn(spr, 0, 0, carrier, '0 0 64', world, carrier.team, carrier, waypointsprite_attachedforcarrier, false, icon);
+ entity e = WaypointSprite_Spawn(spr, 0, 0, carrier, '0 0 64', world, TMID(carrier.team), carrier, waypointsprite_attachedforcarrier, false, icon);
if (e)
{
WaypointSprite_UpdateMaxHealth(e, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id) * 2);
// used for notification system multi-team identifiers
#define APP_TEAM_NUM(num, prefix) ((num == NUM_TEAM_1) ? prefix##_RED : ((num == NUM_TEAM_2) ? prefix##_BLUE : ((num == NUM_TEAM_3) ? prefix##_YELLOW : prefix##_PINK)))
/** @deprecated use APP_TEAM_NUM */
-#define APP_TEAM_ENT(ent, prefix) APP_TEAM_NUM(ent.team, prefix)
+#define APP_TEAM_ENT(ent, prefix) APP_TEAM_NUM(TMID(ent.team), prefix)
#define EIGHT_VARS_TO_VARARGS_VARLIST \
VARITEM(1, 0, s1) \
this.v_angle = PHYS_INPUT_ANGLES(this);
this.angles = PHYS_WORLD_ANGLES(this);
- this.team = myteam + 1; // is this correct?
+ this.__team = myteam + 1; // is this correct?
if (!(PHYS_INPUT_BUTTON_JUMP(this))) // !jump
UNSET_JUMP_HELD(this); // canjump = true
pmove_waterjumptime -= PHYS_INPUT_TIMELENGTH;
db_put(PS_GR_OUT_DB, sprintf("%s:_netname", p.playerstats_id), p.netname);
if(teamplay)
- db_put(PS_GR_OUT_DB, sprintf("%s:_team", p.playerstats_id), ftos(p.team));
+ db_put(PS_GR_OUT_DB, sprintf("%s:_team", p.playerstats_id), ftos(TMID(p.team)));
if(stof(db_get(PS_GR_OUT_DB, sprintf("%s:%s", p.playerstats_id, PLAYERSTATS_ALIVETIME))) > 0)
PS_GR_P_ADDVAL(p, PLAYERSTATS_JOINS, 1);
return false;
}
-void play2team(float t, string filename)
+void play2team(team_t t, string filename)
{
if (autocvar_bot_sound_monopoly) return;
FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.team == t, play2(it, filename));
if(this.team)
{
RandomSelection_Init();
- for(entity head = world; (head = findfloat(head, team, this.team)); )
+ for(entity head = world; (head = findfloat(head, __team, TMID(this.team))); )
{
if(head.flags & FL_ITEM)
if(head.classname != "item_flag_team" && head.classname != "item_key_team")
if(self.effects & EF_NODRAW)
{
// marker for item team search
- LOG_TRACE("Initializing item team ", ftos(self.team), "\n");
+ LOG_TRACE("Initializing item team ", ftos(TMID(self.team)), "\n");
RandomSelection_Init();
- FOREACH_ENTITY_FLOAT(team, self.team,
- {
+ FOREACH_ENTITY_FLOAT(__team, TMID(self.team), {
if(it.flags & FL_ITEM)
if(it.classname != "item_flag_team" && it.classname != "item_key_team")
RandomSelection_Add(it, 0, string_null, it.cnt, 0);
e.state = 0;
Item_Show(e, 1);
- FOREACH_ENTITY_FLOAT(team, self.team,
- {
+ FOREACH_ENTITY_FLOAT(__team, TMID(self.team), {
if(it.flags & FL_ITEM)
if(it.classname != "item_flag_team" && it.classname != "item_key_team")
{
#define TEAMS_H
REGISTRY(Teams, BITS(5))
-#define Teams_from(i) _Teams_from(i, TEAM_SPECTATOR)
REGISTER_REGISTRY(Teams)
REGISTRY_CHECK(Teams)
ATTRIB(Team, m_playercolor, int, 0)
ATTRIB(Team, m_colorstr, string, string_null)
ATTRIB(Team, m_color, vector, '0 0 0')
+ .int Team_id;
CONSTRUCTOR(Team, string _name, string _name_nonls, int _playercolor, string _colorstr, vector _color) {
CONSTRUCT(Team);
#ifndef CSQC
_playercolor++;
#endif
- this.team = _playercolor; // for team numbers that aren't stupid, use `this.m_id`
+ this.Team_id = _playercolor; // for team numbers that aren't stupid, use `this.m_id`
this.m_name = _name;
this.m_name_nonls = _name_nonls;
Team TM(int teamid) {
if (teamid == 0) return NULL;
- FOREACH(Teams, it.team == teamid, return it);
+ FOREACH(Teams, it.Team_id == teamid, return it);
LOG_SEVEREF("Unknown team: %d", teamid);
return NULL;
}
void func_breakable_reset(entity this)
{
- this.team = this.team_saved;
+ this.__team = this.team_saved;
func_breakable_look_restore();
if(this.spawnflags & 1)
func_breakable_behave_destroyed();
if(this.noise1)
precache_sound(this.noise1);
- this.team_saved = this.team;
+ this.team_saved = TMID(this.team);
this.dropped_origin = this.origin;
this.reset = func_breakable_reset;
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH);
- WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, TMID(self.team));
WriteInt24_t(MSG_ENTITY, self.spawnflags);
WriteByte(MSG_ENTITY, self.active);
WriteCoord(MSG_ENTITY, self.height);
make_pure(this);
self.classname = "jumppad";
- int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
+ int mytm = ReadByte(); if(mytm) { self.__team = mytm - 1; }
self.spawnflags = ReadInt24_t();
self.active = ReadByte();
self.height = ReadCoord();
}
this.think = func_null;
this.nextthink = 0;
- this.team = this.team_saved;
+ this.__team = this.team_saved;
}
/*QUAKED spawnfunc_trigger_multiple (.5 .5 .5) ? notouch
EXACTTRIGGER_INIT;
- self.team_saved = self.team;
+ self.team_saved = TMID(self.team);
if (self.health)
{
void trigger_relay_teamcheck_reset(entity this)
{
- this.team = this.team_saved;
+ this.__team = this.team_saved;
}
spawnfunc(trigger_relay_teamcheck)
{
- this.team_saved = this.team;
+ this.team_saved = TMID(this.team);
this.use = trigger_relay_teamcheck_use;
this.reset = trigger_relay_teamcheck_reset;
}
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_TELEPORT);
- WriteByte(MSG_ENTITY, this.team);
+ WriteByte(MSG_ENTITY, TMID(this.team));
WriteInt24_t(MSG_ENTITY, this.spawnflags);
WriteByte(MSG_ENTITY, this.active);
WriteCoord(MSG_ENTITY, this.speed);
NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew)
{
self.classname = "trigger_teleport";
- int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
+ int mytm = ReadByte(); if(mytm) { self.__team = mytm - 1; }
self.spawnflags = ReadInt24_t();
self.active = ReadByte();
self.speed = ReadCoord();
.vector glowmod;
void turret_changeteam()
{SELFPARAM();
- self.glowmod = Team_ColorRGB(self.team - 1) * 2;
- self.teamradar_color = Team_ColorRGB(self.team - 1);
+ self.glowmod = Team_ColorRGB(TMID(self.team) - 1) * 2;
+ self.teamradar_color = Team_ColorRGB(TMID(self.team) - 1);
if(self.team)
- self.colormap = 1024 + (self.team - 1) * 17;
+ self.colormap = 1024 + (TMID(self.team) - 1) * 17;
self.tur_head.colormap = self.colormap;
self.tur_head.glowmod = self.glowmod;
string txt;
if(autocvar_cl_vehicles_hud_tactical)
- if(dist < 10240 && t != this.team)
+ if(dist < 10240 && t != TMID(this.team))
{
// TODO: Vehicle tactical hud
o = project_3d_to_2d(this.origin + '0 0 32');
else
txt = spritelookuptext(this, spriteimage);
- if(time - floor(time) > 0.5 && t == this.team)
+ if(time - floor(time) > 0.5 && t == TMID(this.team))
{
if(this.helpme && time < this.helpme)
{
{
float _tmp;
_tmp = ReadByte();
- if(_tmp != self.team)
+ if(_tmp != TMID(self.team))
{
- self.team = _tmp;
+ self.__team = _tmp;
turret_changeteam();
}
if(sf & TNSF_STATUS)
{
- WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, TMID(self.team));
if(self.health <= 0)
WriteByte(MSG_ENTITY, 0);
self.team = activator.team;
- if(self.team == 0)
+ if(TMID(self.team) == 0)
self.active = ACTIVE_NOT;
else
self.active = ACTIVE_ACTIVE;
self.netname = tur.netname;
load_unit_settings(self, 0);
- if(!self.team || !teamplay) { self.team = MAX_SHOT_DISTANCE; }
+ if(!self.team || !teamplay) { self.__team = MAX_SHOT_DISTANCE; }
if(!self.ticrate) { self.ticrate = ((self.turret_flags & TUR_FLAG_SUPPORT) ? 0.2 : 0.1); }
if(!self.health) { self.health = 1000; }
if(!self.shot_refire) { self.shot_refire = 1; }
// teamcolor / hit beam effect
vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
- WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(self.team)), self.tur_shotorg, v);
+ WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(TMID(self.team))), self.tur_shotorg, v);
}
else
{
// teamcolor / hit beam effect
vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
- WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(self.team)), self.tur_shotorg, v);
+ WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(TMID(self.team))), self.tur_shotorg, v);
} else {
SUPER(PlasmaTurret).tr_attack(this, it);
}
_effects |= EF_FULLBRIGHT;
if(self.team)
- _colormap = 1024 + (self.team - 1) * 17;
+ _colormap = 1024 + (TMID(self.team) - 1) * 17;
else
_colormap = 1024;
}
if(teamplay && self.team)
- rgb = Team_ColorRGB(self.team);
+ rgb = Team_ColorRGB(TMID(self.team));
else
rgb = '1 1 1';
entity wp = WaypointSprite_Spawn(WP_Vehicle, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Vehicle);
wp.colormod = rgb;
if(self.waypointsprite_attached)
{
- WaypointSprite_UpdateRule(self.waypointsprite_attached, self.wp00.team, SPRITERULE_DEFAULT);
+ WaypointSprite_UpdateRule(self.waypointsprite_attached, TMID(self.wp00.team), SPRITERULE_DEFAULT);
if(this == NULL)
WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, self.nextthink);
WaypointSprite_Ping(self.waypointsprite_attached);
self.tur_head.team = activator.team;
- if(self.tur_head.team == 0)
+ if(TMID(self.tur_head.team) == 0)
self.active = ACTIVE_NOT;
else
self.active = ACTIVE_ACTIVE;
_vehicle.tur_head.nodrawtoclient = world;
if(!teamplay)
- _vehicle.team = 0;
+ _vehicle.__team = 0;
Kill_Notification(NOTIF_ONE, _player, MSG_CENTER, CPID_VEHICLES);
Kill_Notification(NOTIF_ONE, _player, MSG_CENTER, CPID_VEHICLES_OTHER); // kill all vehicle notifications when exiting a vehicle?
Send_Notification(NOTIF_ONE, pl, MSG_CENTER, CENTER_VEHICLE_STEAL_SELF);
if (autocvar_g_vehicles_steal_show_waypoint) {
- entity wp = WaypointSprite_Spawn(WP_VehicleIntruder, 0, 0, pl, '0 0 68', world, veh.team, veh, wps_intruder, true, RADARICON_DANGER);
- wp.colormod = Team_ColorRGB(pl.team);
+ entity wp = WaypointSprite_Spawn(WP_VehicleIntruder, 0, 0, pl, '0 0 68', world, TMID(veh.team), veh, wps_intruder, true, RADARICON_DANGER);
+ wp.colormod = Team_ColorRGB(TMID(pl.team));
}
}
else return;
if(teamplay)
{
- if(self.vehicle_controller.team == 0)
+ if(TMID(self.vehicle_controller.team) == 0)
self.active = ACTIVE_NOT;
else
self.active = ACTIVE_ACTIVE;
else { self.active = ACTIVE_ACTIVE; }
if(self.team && (!teamplay || !autocvar_g_vehicles_teams))
- self.team = 0;
+ self.__team = 0;
if(self.mdl == "" || !self.mdl)
_setmodel(self, veh.model);
if(sf & BRG_SETUP)
{
WriteByte(MSG_ENTITY, etof(self.realowner));
- WriteByte(MSG_ENTITY, self.realowner.team);
+ WriteByte(MSG_ENTITY, TMID(self.realowner.team));
WriteByte(MSG_ENTITY, self.cnt);
}
if(sf & BRG_SETUP)
{
- self.cnt = ReadByte();
- self.team = ReadByte();
- self.cnt = ReadByte();
+ self.cnt = ReadByte();
+ self.__team = ReadByte();
+ self.cnt = ReadByte();
if(self.cnt)
self.colormod = '1 0 0';
// that way, holes in the range of notes are "plugged"
if(teamplay)
{
- if(pl.team == NUM_TEAM_2 || pl.team == NUM_TEAM_4)
+ if(TMID(pl.team) == NUM_TEAM_2 || TMID(pl.team) == NUM_TEAM_4)
note += 3;
}
else
WriteCoord(MSG_BROADCAST, v.z);
WriteByte(MSG_BROADCAST, hit);
WriteByte(MSG_BROADCAST, etof(player));
- WriteByte(MSG_BROADCAST, player.team);
+ WriteByte(MSG_BROADCAST, TMID(player.team));
}
#elif defined(CSQC)
bool autocvar_cl_vaporizerbeam_particle = false;
int myowner = ReadByte();
this.owner = playerslots[myowner - 1];
this.sv_entnum = myowner;
- this.team = ReadByte() - 1;
+ this.__team = ReadByte() - 1;
if(autocvar_cl_vaporizerbeam_particle)
{
- WarpZone_TrailParticles(world, particleeffectnum(((this.cnt) ? EFFECT_VAPORIZER_HIT(this.team) : EFFECT_VAPORIZER(this.team))), this.vorg1, this.vorg2);
+ WarpZone_TrailParticles(world, particleeffectnum(((this.cnt) ? EFFECT_VAPORIZER_HIT(TMID(this.team)) : EFFECT_VAPORIZER(TMID(this.team)))), this.vorg1, this.vorg2);
this.draw = func_null;
this.drawmask = MASK_NORMAL;
remove(this);
#include <dpdefs/keycodes.qh>
#endif
+.int team;
+.int __team = team;
+.entity m_team;
+#if 1
+#define team_t int
+#define TMID(t) (t)
+#else
+#define team_t Team
+#define TMID(t) (t.Team_id)
+#define team m_team
+#endif
+
#include "macro.qh"
#include "warpzone/mathlib.qc"
if (e == self)
return false;
if (teamplay)
- if (e.team != 0)
+ if (TMID(e.team) != 0)
return false;
}
if(teamplay)
{
- if(e.team==0)
+ if(TMID(e.team)==0)
return false;
}
else if(bot_ignore_bots)
bot_setnameandstuff();
if(self.bot_forced_team==1)
- self.team = NUM_TEAM_1;
+ self.__team = NUM_TEAM_1;
else if(self.bot_forced_team==2)
- self.team = NUM_TEAM_2;
+ self.__team = NUM_TEAM_2;
else if(self.bot_forced_team==3)
- self.team = NUM_TEAM_3;
+ self.__team = NUM_TEAM_3;
else if(self.bot_forced_team==4)
- self.team = NUM_TEAM_4;
+ self.__team = NUM_TEAM_4;
else
JoinBestTeam(self, false, true);
bestcount = 0;
while (head)
{
- if(head.team == NUM_TEAM_1)
+ if(TMID(head.team) == NUM_TEAM_1)
thiscount = c1;
- else if(head.team == NUM_TEAM_2)
+ else if(TMID(head.team) == NUM_TEAM_2)
thiscount = c2;
- else if(head.team == NUM_TEAM_3)
+ else if(TMID(head.team) == NUM_TEAM_3)
thiscount = c3;
- else if(head.team == NUM_TEAM_4)
+ else if(TMID(head.team) == NUM_TEAM_4)
thiscount = c4;
else
thiscount = 0;
if (mutator_returnvalue) {
// mutator prevents resetting teams+score
} else {
- this.team = -1; // move this as it is needed to log the player spectating in eventlog
+ this.__team = -1; // move this as it is needed to log the player spectating in eventlog
this.frags = FRAGS_SPECTATOR;
PlayerScore_Clear(this); // clear scores when needed
}
{
if(teamplay)
{
- string s = Static_Team_ColorName_Lower(player.team);
+ string s = Static_Team_ColorName_Lower(TMID(player.team));
if (s != "neutral")
{
defaultmodel = cvar_string(strcat("sv_defaultplayermodel_", s));
PlayerState_attach(this);
accuracy_resend(this);
- if (this.team < 0)
+ if (TMID(this.team) < 0)
JoinBestTeam(this, false, true);
entity spot = SelectSpawnPoint(false);
if (autocvar_sv_eventlog)
GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot"), ":", this.netname));
- LogTeamchange(this.playerid, this.team, 1);
+ LogTeamchange(this.playerid, TMID(this.team), 1);
this.just_joined = true; // stop spamming the eventlog with additional lines when the client connects
this.netname_previous = strzone(this.netname);
- Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && IS_PLAYER(this)) ? APP_TEAM_ENT(this, INFO_JOIN_CONNECT_TEAM) : INFO_JOIN_CONNECT), this.netname);
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && IS_PLAYER(this)) ? APP_TEAM_NUM(TMID(this.team), INFO_JOIN_CONNECT_TEAM) : INFO_JOIN_CONNECT), this.netname);
stuffcmd(this, clientstuff, "\n");
stuffcmd(this, "cl_particles_reloadeffects\n"); // TODO do we still need this?
PutClientInServer();
- if(IS_PLAYER(self)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname); }
+ if(IS_PLAYER(self)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && TMID(this.team) != -1) ? APP_TEAM_NUM(TMID(this.team), INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname); }
}
else
stuffcmd(self, "menu_showteamselect\n");
SetPlayerColors(client, team_colour - 1); // set the players colour
Damage(client, client, client, 100000, DEATH_AUTOTEAMCHANGE.m_id, client.origin, '0 0 0'); // kill the player
lockteams = lockteams_backup; // restore the team lock
- LogTeamchange(client.playerid, client.team, type);
+ LogTeamchange(client.playerid, TMID(client.team), type);
}
/**
if (!IS_PLAYER(source))
colorstr = "^0"; // black for spectators
else if(teamplay)
- colorstr = Team_ColorCode(source.team);
+ colorstr = Team_ColorCode(TMID(source.team));
else
{
colorstr = "";
self.classname = STR_PLAYER;
PlayerScore_Clear(self);
Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_PREVENT_JOIN);
- Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && self.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && TMID(self.team) != -1) ? APP_TEAM_NUM(TMID(this.team), INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname);
PutClientInServer();
}
else
if (selection)
{
- if (self.team == selection && !IS_DEAD(self))
+ if (TMID(self.team) == selection && !IS_DEAD(self))
{
sprint(self, "^7You already are on that team.\n");
}
{
CheckAllowedTeams(self);
GetTeamCounts(self);
- if (!TeamSmallerEqThanTeam(Team_TeamToNumber(selection), Team_TeamToNumber(self.team), self))
+ if (!TeamSmallerEqThanTeam(Team_TeamToNumber(selection), Team_TeamToNumber(TMID(self.team)), self))
{
Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_TEAMCHANGE_LARGERTEAM);
return;
// find the team to move the player to
team_id = Team_ColorToTeam(destination);
- if (team_id == client.team) // already on the destination team
+ if (team_id == TMID(client.team)) // already on the destination team
{
// keep the forcing undone
- LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7.\n"));
+ LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already on the ", Team_ColoredFullName(TMID(client.team)), (targets ? "^7, skipping to next player.\n" : "^7.\n"));
continue;
}
else if (team_id == 0) // auto team
if (VerifyClientNumber(shuffleteams_players[z])) setself(edict_num(shuffleteams_players[z]));
- if (self.team != team_color) MoveToTeam(self, team_color, 6);
+ if (TMID(self.team) != team_color) MoveToTeam(self, team_color, 6);
shuffleteams_players[z] = 0;
shuffleteams_teams[i] = shuffleteams_teams[i] + 1;
MUTATOR_CALLHOOK(reset_map_global);
- FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), LAMBDA(
+ FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
if (it.reset)
{
WITH(entity, self, it, it.reset(it));
continue;
}
- if (it.team_saved) it.team = it.team_saved;
+ if (it.team_saved) it.__team = it.team_saved;
if (it.flags & FL_PROJECTILE) remove(it); // remove any projectiles left
- ));
+ });
// Waypoints and assault start come LAST
FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), LAMBDA(
{
if(deathtype == DEATH_TEAMCHANGE.m_id || deathtype == DEATH_AUTOTEAMCHANGE.m_id)
{
- Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", targ.team, 0, 0);
+ Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", TMID(targ.team), 0, 0);
}
else
{
Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_TEAMKILL_FRAG, targ.netname);
Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_TEAMKILL_FRAGGED, attacker.netname);
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(targ.team, INFO_DEATH_TEAMKILL), targ.netname, attacker.netname, deathlocation, targ.killcount);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(TMID(targ.team), INFO_DEATH_TEAMKILL), targ.netname, attacker.netname, deathlocation, targ.killcount);
// In this case, the death message will ALWAYS be "foo was betrayed by bar"
// No need for specific death/weapon messages...
ice.frame = floor(random() * 21); // ice model has 20 different looking frames
setmodel(ice, MDL_ICE);
ice.alpha = 1;
- ice.colormod = Team_ColorRGB(targ.team);
+ ice.colormod = Team_ColorRGB(TMID(targ.team));
ice.glowmod = ice.colormod;
targ.iceblock = ice;
targ.revival_time = 0;
// add waypoint
if(show_waypoint)
- WaypointSprite_Spawn(WP_Frozen, 0, 0, targ, '0 0 64', world, targ.team, targ, waypointsprite_attached, true, RADARICON_WAYPOINT);
+ WaypointSprite_Spawn(WP_Frozen, 0, 0, targ, '0 0 64', world, TMID(targ.team), targ, waypointsprite_attached, true, RADARICON_WAYPOINT);
}
void Unfreeze (entity targ)
if(teamplay)
{
if(activator.team)
- self.colormap = (activator.team - 1) * 0x11;
+ self.colormap = (TMID(activator.team) - 1) * 0x11;
else
self.colormap = 0x00;
}
if(to_file)
fputs(file, strcat(s, "\n"));
- FOREACH_CLIENT(IS_REAL_CLIENT(it) || (IS_BOT_CLIENT(it) && autocvar_sv_logscores_bots), LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) || (IS_BOT_CLIENT(it) && autocvar_sv_logscores_bots), {
s = strcat(":player:see-labels:", GetPlayerScoreString(it, 0), ":");
s = strcat(s, ftos(rint(time - it.jointime)), ":");
if(IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it, s))
- s = strcat(s, ftos(it.team), ":");
+ s = strcat(s, ftos(TMID(it.team)), ":");
else
s = strcat(s, "spectator:");
GameLogEcho(strcat(s, ftos(it.playerid), ":", it.netname));
if(to_file)
fputs(file, strcat(s, it.netname, "\n"));
- ));
+ });
if(teamplay)
{
if(WinningConditionHelper_winner)
WinningConditionHelper_winner.winning = 1;
if(WinningConditionHelper_winnerteam >= 0)
- SetWinners(team, WinningConditionHelper_winnerteam);
+ SetWinners(__team, WinningConditionHelper_winnerteam);
if(WinningConditionHelper_lowerisbetter)
{
team1_score = team2_score = team3_score = team4_score = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), LAMBDA(
- switch(it.team)
+ FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
+ switch(TMID(it.team))
{
case NUM_TEAM_1: team1_score = 1; break;
case NUM_TEAM_2: team2_score = 1; break;
case NUM_TEAM_3: team3_score = 1; break;
case NUM_TEAM_4: team4_score = 1; break;
}
- ));
+ });
- FOREACH_ENTITY_CLASS("info_player_deathmatch", true, LAMBDA(
- switch(it.team)
+ FOREACH_ENTITY_CLASS("info_player_deathmatch", true, {
+ switch(TMID(it.team))
{
case NUM_TEAM_1: team1_score = 1; break;
case NUM_TEAM_2: team2_score = 1; break;
case NUM_TEAM_3: team3_score = 1; break;
case NUM_TEAM_4: team4_score = 1; break;
}
- ));
+ });
ClearWinners();
if(team1_score + team2_score + team3_score + team4_score == 0)
if(t != NUM_TEAM_4) if(c4 >= 0) TeamScore_AddToTeam(NUM_TEAM_4, i, -1000);
}
- AddWinners(team, t);
+ AddWinners(__team, t);
return WINNING_YES;
}
else
string t;
if (teamplay && !intermission_running && IS_PLAYER(p))
{
- t = Team_ColorCode(p.team);
+ t = Team_ColorCode(TMID(p.team));
return strcat(t, strdecolorize(p.netname));
}
else
void play2all(string samp);
-void play2team(float t, string filename);
+void play2team(team_t t, string filename);
void GetCvars_handleFloat(string thisname, float f, .float field, string name);
// decrease the health of targeted objectives
void assault_objective_decrease_use()
{SELFPARAM();
- if(activator.team != assault_attacker_team)
+ if(TMID(activator.team) != assault_attacker_team)
{
// wrong team triggered decrease
return;
SUB_UseTargets();
//(Re)spawn all turrets
- FOREACH_ENTITY_CLASS("turret_main", true, LAMBDA(
+ FOREACH_ENTITY_CLASS("turret_main", true, {
// Swap turret teams
- if(it.team == NUM_TEAM_1)
- it.team = NUM_TEAM_2;
+ if(TMID(it.team) == NUM_TEAM_1)
+ it.__team = NUM_TEAM_2;
else
- it.team = NUM_TEAM_1;
+ it.__team = NUM_TEAM_1;
- // Dubbles as teamchange
+ // Doubles as teamchange
WITH(entity, self, it, turret_respawn());
- ));
+ });
}
void assault_wall_think()
// as the timelimit has not yet passed just assume the defending team will win
if(assault_attacker_team == NUM_TEAM_1)
{
- SetWinners(team, NUM_TEAM_2);
+ SetWinners(__team, NUM_TEAM_2);
}
else
{
- SetWinners(team, NUM_TEAM_1);
+ SetWinners(__team, NUM_TEAM_1);
}
entity ent;
if(ent.winning) // round end has been triggered by attacking team
{
bprint("ASSAULT: round completed...\n");
- SetWinners(team, assault_attacker_team);
+ SetWinners(__team, assault_attacker_team);
TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 666 - TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 0));
{
if (!g_assault) { remove(self); return; }
- self.team = NUM_TEAM_1; // red, gets swapped every round
+ self.__team = NUM_TEAM_1; // red, gets swapped every round
spawnfunc_info_player_deathmatch(this);
}
{
if (!g_assault) { remove(self); return; }
- self.team = NUM_TEAM_2; // blue, gets swapped every round
+ self.__team = NUM_TEAM_2; // blue, gets swapped every round
spawnfunc_info_player_deathmatch(this);
}
self.classname = "func_assault_destructible";
if(assault_attacker_team == NUM_TEAM_1)
- self.team = NUM_TEAM_2;
+ self.__team = NUM_TEAM_2;
else
- self.team = NUM_TEAM_1;
+ self.__team = NUM_TEAM_1;
spawnfunc_func_breakable(this);
}
if(IS_DEAD(self))
return;
- if(bot.team == assault_attacker_team)
+ if(TMID(bot.team) == assault_attacker_team)
havocbot_role_ast_setrole(bot, HAVOCBOT_AST_ROLE_OFFENSE);
else
havocbot_role_ast_setrole(bot, HAVOCBOT_AST_ROLE_DEFENSE);
// mutator hooks
MUTATOR_HOOKFUNCTION(as, PlayerSpawn)
{SELFPARAM();
- if(self.team == assault_attacker_team)
+ if(TMID(self.team) == assault_attacker_team)
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_ATTACKING);
else
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_DEFENDING);
MUTATOR_HOOKFUNCTION(as, TurretSpawn)
{SELFPARAM();
- if(!self.team || self.team == MAX_SHOT_DISTANCE)
- self.team = 5; // this gets reversed when match starts?
+ if(!self.team || TMID(self.team) == MAX_SHOT_DISTANCE)
+ self.__team = 5; // this gets reversed when match starts?
return false;
}
void CA_count_alive_players()
{
total_players = redalive = bluealive = yellowalive = pinkalive = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
- switch(it.team)
+ FOREACH_CLIENT(IS_PLAYER(it), {
+ switch(TMID(it.team))
{
case NUM_TEAM_1: ++total_players; if(!IS_DEAD(it)) ++redalive; break;
case NUM_TEAM_2: ++total_players; if(!IS_DEAD(it)) ++bluealive; break;
case NUM_TEAM_3: ++total_players; if(!IS_DEAD(it)) ++yellowalive; break;
case NUM_TEAM_4: ++total_players; if(!IS_DEAD(it)) ++pinkalive; break;
}
- ));
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ });
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), {
it.redalive_stat = redalive;
it.bluealive_stat = bluealive;
it.yellowalive_stat = yellowalive;
it.pinkalive_stat = pinkalive;
- ));
+ });
}
float CA_GetWinnerTeam()
it.killcount = 0;
if (!it.caplayer && IS_BOT_CLIENT(it))
{
- it.team = -1;
+ it.__team = -1;
it.caplayer = 1;
}
if (it.caplayer)
void ctf_FlagcarrierWaypoints(entity player)
{
- WaypointSprite_Spawn(WP_FlagCarrier, 0, 0, player, FLAG_WAYPOINT_OFFSET, world, player.team, player, wps_flagcarrier, true, RADARICON_FLAG);
+ WaypointSprite_Spawn(WP_FlagCarrier, 0, 0, player, FLAG_WAYPOINT_OFFSET, world, TMID(player.team), player, wps_flagcarrier, true, RADARICON_FLAG);
WaypointSprite_UpdateMaxHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id) * 2);
WaypointSprite_UpdateHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(player.health, player.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id));
WaypointSprite_UpdateTeamRadar(player.wps_flagcarrier, RADARICON_FLAGCARRIER, WPCOLOR_FLAGCARRIER(player.team));
// messages and sounds
Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_LOST) : INFO_CTF_LOST_NEUTRAL), player.netname);
_sound(flag, CH_TRIGGER, flag.snd_flag_dropped, VOL_BASE, ATTEN_NONE);
- ctf_EventLog("dropped", player.team, player);
+ ctf_EventLog("dropped", TMID(player.team), player);
// scoring
PlayerTeamScore_AddScore(player, -autocvar_g_ctf_score_penalty_drop);
// waypoints
if(autocvar_g_ctf_flag_dropped_waypoint) {
- entity wp = WaypointSprite_Spawn(WP_FlagDropped, 0, 0, flag, FLAG_WAYPOINT_OFFSET, world, ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : player.team), flag, wps_flagdropped, true, RADARICON_FLAG);
- wp.colormod = WPCOLOR_DROPPEDFLAG(flag.team);
+ entity wp = WaypointSprite_Spawn(WP_FlagDropped, 0, 0, flag, FLAG_WAYPOINT_OFFSET, world, ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : TMID(player.team)), flag, wps_flagdropped, true, RADARICON_FLAG);
+ wp.colormod = WPCOLOR_DROPPEDFLAG(TMID(flag.team));
}
if(autocvar_g_ctf_flag_return_time || (autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health))
// messages and sounds
_sound(player, CH_TRIGGER, flag.snd_flag_pass, VOL_BASE, ATTEN_NORM);
- ctf_EventLog("receive", flag.team, player);
+ ctf_EventLog("receive", TMID(flag.team), player);
FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
if(it == sender)
// other
_sound(player, CH_TRIGGER, flag.snd_flag_touch, VOL_BASE, ATTEN_NORM);
WarpZone_TrailParticles(world, _particleeffectnum(flag.passeffect), player.origin, targ_origin);
- ctf_EventLog("pass", flag.team, player);
+ ctf_EventLog("pass", TMID(flag.team), player);
break;
}
switch(capturetype)
{
- case CAPTURE_NORMAL: ctf_EventLog("capture", enemy_flag.team, player); break;
- case CAPTURE_DROPPED: ctf_EventLog("droppedcapture", enemy_flag.team, player); break;
+ case CAPTURE_NORMAL: ctf_EventLog("capture", TMID(enemy_flag.team), player); break;
+ case CAPTURE_DROPPED: ctf_EventLog("droppedcapture", TMID(enemy_flag.team), player); break;
default: break;
}
Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT(flag, INFO_CTF_RETURN), player.netname);
}
_sound(player, CH_TRIGGER, flag.snd_flag_returned, VOL_BASE, ATTEN_NONE);
- ctf_EventLog("return", flag.team, player);
+ ctf_EventLog("return", TMID(flag.team), player);
// scoring
if(IS_PLAYER(player))
nades_GiveBonus(player,autocvar_g_nades_bonus_score_medium);
}
- TeamScore_AddToTeam(flag.team, ST_SCORE, -autocvar_g_ctf_score_penalty_returned); // punish the team who was last carrying it
+ TeamScore_AddToTeam(TMID(flag.team), ST_SCORE, -autocvar_g_ctf_score_penalty_returned); // punish the team who was last carrying it
if(flag.ctf_dropper)
{
if(ctf_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER); }
if(!flag.team) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PICKUP_NEUTRAL); }
else if(CTF_DIFFTEAM(player, flag)) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT(flag, CENTER_CTF_PICKUP)); }
- else { Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((SAME_TEAM(player, flag)) ? CENTER_CTF_PICKUP_TEAM : CENTER_CTF_PICKUP_TEAM_ENEMY), Team_ColorCode(flag.team)); }
+ else { Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((SAME_TEAM(player, flag)) ? CENTER_CTF_PICKUP_TEAM : CENTER_CTF_PICKUP_TEAM_ENEMY), Team_ColorCode(TMID(flag.team))); }
- Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, ((flag.team) ? APP_TEAM_ENT(flag, CHOICE_CTF_PICKUP_TEAM) : CHOICE_CTF_PICKUP_TEAM_NEUTRAL), Team_ColorCode(player.team), player.netname);
+ Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, ((flag.team) ? APP_TEAM_ENT(flag, CHOICE_CTF_PICKUP_TEAM) : CHOICE_CTF_PICKUP_TEAM_NEUTRAL), Team_ColorCode(TMID(player.team)), player.netname);
if(!flag.team)
- FOREACH_CLIENT(IS_PLAYER(it) && it != player && DIFF_TEAM(it, player), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(player.team), player.netname)));
+ FOREACH_CLIENT(IS_PLAYER(it) && it != player && DIFF_TEAM(it, player), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(TMID(player.team)), player.netname)));
if(flag.team)
- FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
if(CTF_SAMETEAM(flag, it))
if(SAME_TEAM(player, it))
- Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_TEAM_ENT(flag, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
+ Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_TEAM_ENT(flag, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(TMID(player.team)), player.netname);
else
- Send_Notification(NOTIF_ONE, it, MSG_CHOICE, ((SAME_TEAM(flag, player)) ? CHOICE_CTF_PICKUP_ENEMY_TEAM : CHOICE_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), player.netname);
- ));
+ Send_Notification(NOTIF_ONE, it, MSG_CHOICE, ((SAME_TEAM(flag, player)) ? CHOICE_CTF_PICKUP_ENEMY_TEAM : CHOICE_CTF_PICKUP_ENEMY), Team_ColorCode(TMID(player.team)), player.netname);
+ });
_sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTEN_NONE);
case PICKUP_BASE:
{
PlayerTeamScore_AddScore(player, autocvar_g_ctf_score_pickup_base);
- ctf_EventLog("steal", flag.team, player);
+ ctf_EventLog("steal", TMID(flag.team), player);
break;
}
pickup_dropped_score = floor((autocvar_g_ctf_score_pickup_dropped_late * (1 - pickup_dropped_score) + autocvar_g_ctf_score_pickup_dropped_early * pickup_dropped_score) + 0.5);
LOG_TRACE("pickup_dropped_score is ", ftos(pickup_dropped_score), "\n");
PlayerTeamScore_AddScore(player, pickup_dropped_score);
- ctf_EventLog("pickup", flag.team, player);
+ ctf_EventLog("pickup", TMID(flag.team), player);
break;
}
{ Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT(flag, INFO_CTF_FLAGRETURN_TIMEOUT) : INFO_CTF_FLAGRETURN_TIMEOUT_NEUTRAL)); break; }
}
_sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTEN_NONE);
- ctf_EventLog("returned", flag.team, world);
+ ctf_EventLog("returned", TMID(flag.team), world);
ctf_RespawnFlag(flag);
}
}
tmp_entity.ctf_staleflagnext = ctf_staleflaglist; // link flag into staleflaglist
ctf_staleflaglist = tmp_entity;
- switch(tmp_entity.team)
+ switch(TMID(tmp_entity.team))
{
case NUM_TEAM_1: ++stale_red_flags; break;
case NUM_TEAM_2: ++stale_blue_flags; break;
if((tmp_entity.owner) && (!tmp_entity.owner.wps_enemyflagcarrier))
{
entity wp = WaypointSprite_Spawn(((ctf_oneflag) ? WP_FlagCarrier : WP_FlagCarrierEnemy), 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, 0, tmp_entity.owner, wps_enemyflagcarrier, true, RADARICON_FLAG);
- wp.colormod = WPCOLOR_ENEMYFC(tmp_entity.owner.team);
+ wp.colormod = WPCOLOR_ENEMYFC(TMID(tmp_entity.owner.team));
tmp_entity.owner.wps_enemyflagcarrier.customizeentityforclient = ctf_Stalemate_Customize;
}
}
// waypointsprites
entity basename;
- switch (self.team)
+ switch (TMID(self.team))
{
case NUM_TEAM_1: basename = WP_FlagBaseRed; break;
case NUM_TEAM_2: basename = WP_FlagBaseBlue; break;
}
entity wp = WaypointSprite_SpawnFixed(basename, self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG);
- wp.colormod = ((self.team) ? Team_ColorRGB(self.team) : '1 1 1');
- WaypointSprite_UpdateTeamRadar(self.wps_flagbase, RADARICON_FLAG, ((self.team) ? colormapPaletteColor(self.team - 1, false) : '1 1 1'));
+ wp.colormod = ((TMID(self.team)) ? Team_ColorRGB(TMID(self.team)) : '1 1 1');
+ WaypointSprite_UpdateTeamRadar(self.wps_flagbase, RADARICON_FLAG, ((TMID(self.team)) ? colormapPaletteColor(TMID(self.team) - 1, false) : '1 1 1'));
// captureshield setup
ctf_CaptureShield_Spawn(self);
setattachment(flag, world, "");
flag.netname = strzone(sprintf("%s%s^7 flag", Team_ColorCode(teamnumber), Team_ColorName_Upper(teamnumber)));
- flag.team = teamnumber;
+ flag.__team = teamnumber;
flag.classname = "item_flag_team";
flag.target = "###item###"; // wut?
flag.flags = FL_ITEM | FL_NOTARGET;
// scan through all the flags and notify the client about them
for(flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext)
{
- if(flag.team == NUM_TEAM_1) { t = CTF_RED_FLAG_CARRYING; t2 = CTF_RED_FLAG_TAKEN; t3 = CTF_RED_FLAG_LOST; }
- if(flag.team == NUM_TEAM_2) { t = CTF_BLUE_FLAG_CARRYING; t2 = CTF_BLUE_FLAG_TAKEN; t3 = CTF_BLUE_FLAG_LOST; }
- if(flag.team == NUM_TEAM_3) { t = CTF_YELLOW_FLAG_CARRYING; t2 = CTF_YELLOW_FLAG_TAKEN; t3 = CTF_YELLOW_FLAG_LOST; }
- if(flag.team == NUM_TEAM_4) { t = CTF_PINK_FLAG_CARRYING; t2 = CTF_PINK_FLAG_TAKEN; t3 = CTF_PINK_FLAG_LOST; }
- if(flag.team == 0) { t = CTF_NEUTRAL_FLAG_CARRYING; t2 = CTF_NEUTRAL_FLAG_TAKEN; t3 = CTF_NEUTRAL_FLAG_LOST; self.ctf_flagstatus |= CTF_FLAG_NEUTRAL; }
+ if(TMID(flag.team) == NUM_TEAM_1) { t = CTF_RED_FLAG_CARRYING; t2 = CTF_RED_FLAG_TAKEN; t3 = CTF_RED_FLAG_LOST; }
+ if(TMID(flag.team) == NUM_TEAM_2) { t = CTF_BLUE_FLAG_CARRYING; t2 = CTF_BLUE_FLAG_TAKEN; t3 = CTF_BLUE_FLAG_LOST; }
+ if(TMID(flag.team) == NUM_TEAM_3) { t = CTF_YELLOW_FLAG_CARRYING; t2 = CTF_YELLOW_FLAG_TAKEN; t3 = CTF_YELLOW_FLAG_LOST; }
+ if(TMID(flag.team) == NUM_TEAM_4) { t = CTF_PINK_FLAG_CARRYING; t2 = CTF_PINK_FLAG_TAKEN; t3 = CTF_PINK_FLAG_LOST; }
+ if(TMID(flag.team) == 0) { t = CTF_NEUTRAL_FLAG_CARRYING; t2 = CTF_NEUTRAL_FLAG_TAKEN; t3 = CTF_NEUTRAL_FLAG_LOST; self.ctf_flagstatus |= CTF_FLAG_NEUTRAL; }
switch(flag.ctf_status)
{
}
else // create a normal help me waypointsprite
{
- WaypointSprite_Spawn(WP_Helpme, waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, self.team, self, wps_helpme, false, RADARICON_HELPME);
+ WaypointSprite_Spawn(WP_Helpme, waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, TMID(self.team), self, wps_helpme, false, RADARICON_HELPME);
WaypointSprite_Ping(self.wps_helpme);
}
}
}
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
- if(it.flagcarried && (it.team == _team || _team == 0))
+ FOREACH_CLIENT(IS_PLAYER(it), {
+ if(it.flagcarried && (TMID(it.team) == _team || _team == 0))
{
found = true;
if(_team == 0 && IS_SPEC(self) && self.enemy == it)
continue; // already spectating this fc, try another
return superspec_Spectate(it);
}
- ));
+ });
if(!found)
superspec_msg("", "", self, "No active flag carrier\n", 1);
if(!g_ctf) { remove(self); return; }
self.classname = "ctf_team";
- self.team = self.cnt + 1;
+ self.__team = self.cnt + 1;
}
// compatibility for quake maps
entity tmp_entity;
for(tmp_entity = ctf_worldflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_worldflagnext)
{
- if(tmp_entity.team == NUM_TEAM_3) { ctf_teams = max(3, ctf_teams); }
- if(tmp_entity.team == NUM_TEAM_4) { ctf_teams = max(4, ctf_teams); }
- if(tmp_entity.team == 0) { ctf_oneflag = true; }
+ if (TMID(tmp_entity.team) == NUM_TEAM_3) { ctf_teams = max(3, ctf_teams); }
+ if (TMID(tmp_entity.team) == NUM_TEAM_4) { ctf_teams = max(4, ctf_teams); }
+ if (TMID(tmp_entity.team) == 0) { ctf_oneflag = true; }
}
ctf_teams = bound(2, ctf_teams, 4);
real_team = self.cnt;
self.cnt = -1;
- dom_EventLog("taken", self.team, self.dmg_inflictor);
+ dom_EventLog("taken", TMID(self.team), self.dmg_inflictor);
self.dmg_inflictor = world;
self.goalentity = head;
// do trigger work
old_delay = self.delay;
- old_team = self.team;
- self.team = real_team;
+ old_team = TMID(self.team);
+ self.__team = real_team;
self.delay = 0;
activator = self;
SUB_UseTargets ();
self.delay = old_delay;
- self.team = old_team;
+ self.__team = old_team;
entity msg = WP_DomNeut;
- switch(self.team)
+ switch(TMID(self.team))
{
case NUM_TEAM_1: msg = WP_DomRed; break;
case NUM_TEAM_2: msg = WP_DomBlue; break;
total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
for(head = world; (head = find(head, classname, "dom_controlpoint")) != world; )
- FOREACH_ENTITY_CLASS("dom_controlpoint", true, LAMBDA(
+ FOREACH_ENTITY_CLASS("dom_controlpoint", true, {
if (autocvar_g_domination_point_amt)
points = autocvar_g_domination_point_amt;
else
wait_time = autocvar_g_domination_point_rate;
else
wait_time = it.wait;
- switch(it.goalentity.team)
+ switch(TMID(it.goalentity.team))
{
case NUM_TEAM_1: pps_red += points/wait_time; break;
case NUM_TEAM_2: pps_blue += points/wait_time; break;
case NUM_TEAM_4: pps_pink += points/wait_time; break;
}
total_pps += points/wait_time;
- ));
+ });
- WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_DOMPOINT, colormapPaletteColor(self.goalentity.team - 1, 0));
+ WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_DOMPOINT, colormapPaletteColor(TMID(self.goalentity.team) - 1, 0));
WaypointSprite_Ping(self.sprite);
self.captime = time;
fragamt = autocvar_g_domination_point_amt;
else
fragamt = self.frags;
- TeamScore_AddToTeam(self.goalentity.team, ST_SCORE, fragamt);
- TeamScore_AddToTeam(self.goalentity.team, ST_DOM_TICKS, fragamt);
+ TeamScore_AddToTeam(TMID(self.goalentity.team), ST_SCORE, fragamt);
+ TeamScore_AddToTeam(TMID(self.goalentity.team), ST_DOM_TICKS, fragamt);
// give credit to the individual player, if he is still there
if (self.enemy.playerid == self.enemy_playerid)
self.team = self.goalentity.team; // this stores the PREVIOUS team!
- self.cnt = other.team;
+ self.cnt = TMID(other.team);
self.owner = head; // team to switch to after the delay
self.dmg_inflictor = other;
for(e = world; (e = find(e, classname, "dom_controlpoint")) != world; )
{
++total_controlpoints;
- redowned += (e.goalentity.team == NUM_TEAM_1);
- blueowned += (e.goalentity.team == NUM_TEAM_2);
- yellowowned += (e.goalentity.team == NUM_TEAM_3);
- pinkowned += (e.goalentity.team == NUM_TEAM_4);
+ redowned += (TMID(e.goalentity.team) == NUM_TEAM_1);
+ blueowned += (TMID(e.goalentity.team) == NUM_TEAM_2);
+ yellowowned += (TMID(e.goalentity.team) == NUM_TEAM_3);
+ pinkowned += (TMID(e.goalentity.team) == NUM_TEAM_4);
}
}
{
if(head.netname != "")
{
- switch(head.team)
+ switch(TMID(head.team))
{
case NUM_TEAM_1: c1 = 0; break;
case NUM_TEAM_2: c2 = 0; break;
self.modelindex = 0;
// this would have to be changed if used in quakeworld
if(self.cnt)
- self.team = self.cnt + 1; // WHY are these different anyway?
+ self.__team = self.cnt + 1; // WHY are these different anyway?
}
// scoreboard setup
self.model = "";
self.modelindex = 0;
// this would have to be changed if used in quakeworld
- self.team = self.cnt + 1;
+ self.__team = self.cnt + 1;
//eprint(self);
setself(this);
void freezetag_count_alive_players()
{
total_players = redalive = bluealive = yellowalive = pinkalive = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
- switch(it.team)
+ FOREACH_CLIENT(IS_PLAYER(it), {
+ switch(TMID(it.team))
{
case NUM_TEAM_1: ++total_players; if(it.health >= 1 && STAT(FROZEN, it) != 1) ++redalive; break;
case NUM_TEAM_2: ++total_players; if(it.health >= 1 && STAT(FROZEN, it) != 1) ++bluealive; break;
case NUM_TEAM_3: ++total_players; if(it.health >= 1 && STAT(FROZEN, it) != 1) ++yellowalive; break;
case NUM_TEAM_4: ++total_players; if(it.health >= 1 && STAT(FROZEN, it) != 1) ++pinkalive; break;
}
- ));
+ });
FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
it.redalive_stat = redalive;
it.bluealive_stat = bluealive;
if(spawn_point && spawn_point.target_range) monster.target_range = spawn_point.target_range;
if(teamplay)
- if(spawn_point && spawn_point.team && inv_monsters_perteam[spawn_point.team] > 0)
+ if(spawn_point && spawn_point.team && inv_monsters_perteam[TMID(spawn_point.team)] > 0)
monster.team = spawn_point.team;
else
{
if(invasion_teams >= 3) if(inv_monsters_perteam[NUM_TEAM_3] > 0) { RandomSelection_Add(world, NUM_TEAM_3, string_null, 1, 1); }
if(invasion_teams >= 4) if(inv_monsters_perteam[NUM_TEAM_4] > 0) { RandomSelection_Add(world, NUM_TEAM_4, string_null, 1, 1); }
- monster.team = RandomSelection_chosen_float;
+ monster.__team = RandomSelection_chosen_float;
}
if(teamplay)
if(monster.sprite)
{
- WaypointSprite_UpdateTeamRadar(monster.sprite, RADARICON_DANGER, ((monster.team) ? Team_ColorRGB(monster.team) : '1 0 0'));
+ WaypointSprite_UpdateTeamRadar(monster.sprite, RADARICON_DANGER, ((monster.team) ? Team_ColorRGB(TMID(monster.team)) : '1 0 0'));
- monster.sprite.team = 0;
+ monster.sprite.__team = 0;
monster.sprite.SendFlags |= 1;
}
}
float total_alive_monsters = 0, supermonster_count = 0, red_alive = 0, blue_alive = 0, yellow_alive = 0, pink_alive = 0;
- FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
+ FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
if(it.health > 0)
{
if((get_monsterinfo(it.monsterid)).spawnflags & MON_FLAG_SUPERMONSTER)
++total_alive_monsters;
if(teamplay)
- switch(it.team)
+ switch(TMID(it.team))
{
case NUM_TEAM_1: ++red_alive; break;
case NUM_TEAM_2: ++blue_alive; break;
case NUM_TEAM_4: ++pink_alive; break;
}
}
- ));
+ });
if((total_alive_monsters + inv_numkilled) < inv_maxspawned && inv_maxcurrent < inv_maxspawned)
{
{
inv_numkilled += 1;
inv_maxcurrent -= 1;
- if(teamplay) { inv_monsters_perteam[frag_target.team] -= 1; }
+ if(teamplay) { inv_monsters_perteam[TMID(frag_target.team)] -= 1; }
if(IS_PLAYER(frag_attacker))
if(SAME_TEAM(frag_attacker, frag_target)) // in non-teamplay modes, same team = same player, so this works
{
PlayerScore_Add(frag_attacker, SP_KILLS, +1);
if(teamplay)
- TeamScore_AddToTeam(frag_attacker.team, ST_INV_KILLS, +1);
+ TeamScore_AddToTeam(TMID(frag_attacker.team), ST_INV_KILLS, +1);
}
}
Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1);
Send_Effect(EFFECT_ELECTRO_COMBO, self.origin, '0 0 0', 1);
- WaypointSprite_Spawn(WP_KaBall, 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
+ WaypointSprite_Spawn(WP_KaBall, 0, 0, self, '0 0 64', world, TMID(self.team), self, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
sound(self, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
// PlayerScore_Add(plyr, SP_KEEPAWAY_DROPS, 1); Not anymore, this is 100% the same as pickups and is useless.
// waypoints
- WaypointSprite_Spawn(WP_KaBall, 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
+ WaypointSprite_Spawn(WP_KaBall, 0, 0, ball, '0 0 64', world, TMID(ball.team), ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
WaypointSprite_Kill(plyr.waypointsprite_attachedforcarrier);
FOR_EACH_KH_KEY(key)
{
if(key.owner)
- f = key.team;
+ f = TMID(key.team);
else
f = 30;
s |= pow(32, key.count) * f;
{
// player is now a key carrier
entity wp = WaypointSprite_AttachCarrier(WP_Null, player, RADARICON_FLAGCARRIER);
- wp.colormod = colormapPaletteColor(player.team - 1, 0);
+ wp.colormod = colormapPaletteColor(TMID(player.team) - 1, 0);
player.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_KeyCarrier_waypointsprite_visible_for_player;
- WaypointSprite_UpdateRule(player.waypointsprite_attachedforcarrier, player.team, SPRITERULE_TEAMPLAY);
- if(player.team == NUM_TEAM_1)
+ WaypointSprite_UpdateRule(player.waypointsprite_attachedforcarrier, TMID(player.team), SPRITERULE_TEAMPLAY);
+ if (TMID(player.team) == NUM_TEAM_1)
WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierRed, WP_KeyCarrierFriend, WP_KeyCarrierRed);
- else if(player.team == NUM_TEAM_2)
+ else if (TMID(player.team) == NUM_TEAM_2)
WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierBlue, WP_KeyCarrierFriend, WP_KeyCarrierBlue);
- else if(player.team == NUM_TEAM_3)
+ else if (TMID(player.team) == NUM_TEAM_3)
WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierYellow, WP_KeyCarrierFriend, WP_KeyCarrierYellow);
- else if(player.team == NUM_TEAM_4)
+ else if (TMID(player.team) == NUM_TEAM_4)
WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierPink, WP_KeyCarrierFriend, WP_KeyCarrierPink);
if(!kh_no_radar_circles)
WaypointSprite_Ping(player.waypointsprite_attachedforcarrier);
if(ownerteam != -1)
{
kh_interferemsg_time = time + 0.2;
- kh_interferemsg_team = player.team;
+ kh_interferemsg_team = TMID(player.team);
// audit all key carrier sprites, update them to RUN HERE
FOR_EACH_KH_KEY(k)
{
sound(player, CH_TRIGGER, SND_KH_COLLECT, VOL_BASE, ATTEN_NORM);
- if(key.kh_dropperteam != player.team)
+ if(key.kh_dropperteam != TMID(player.team))
{
kh_Scores_Event(player, key, "collect", autocvar_g_balance_keyhunt_score_collect, 0);
PlayerScore_Add(player, SP_KH_PICKUPS, 1);
attacker = world;
if(lostkey.pusher)
- if(lostkey.pusher.team != teem)
+ if(TMID(lostkey.pusher.team) != teem)
if(IS_PLAYER(lostkey.pusher))
attacker = lostkey.pusher;
float of, fragsleft, i, j, thisteam;
of = autocvar_g_balance_keyhunt_score_destroyed_ownfactor;
- FOREACH_CLIENT(IS_PLAYER(it) && it.team != teem, LAMBDA(++players));
+ FOREACH_CLIENT(IS_PLAYER(it) && TMID(it.team) != teem, ++players);
FOR_EACH_KH_KEY(key)
- if(key.owner && key.team != teem)
+ if(key.owner && TMID(key.team) != teem)
++keys;
if(lostkey.kh_previous_owner)
DistributeEvenly_Init(autocvar_g_balance_keyhunt_score_destroyed, keys * of + players);
FOR_EACH_KH_KEY(key)
- if(key.owner && key.team != teem)
+ if(key.owner && TMID(key.team) != teem)
{
f = DistributeEvenly_Get(of);
kh_Scores_Event(key.owner, world, "destroyed_holdingkey", f, 0);
continue;
players = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, LAMBDA(++players));
+ FOREACH_CLIENT(IS_PLAYER(it) && TMID(it.team) == thisteam, ++players);
DistributeEvenly_Init(fragsleft, j);
fragsleft = DistributeEvenly_Get(j - 1);
DistributeEvenly_Init(DistributeEvenly_Get(1), players);
- FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && TMID(it.team) == thisteam, {
f = DistributeEvenly_Get(1);
kh_Scores_Event(it, world, "destroyed", f, 0);
- ));
+ });
--j;
}
// if in nodrop or time over, end the round
if(!self.owner)
if(time > self.pain_finished)
- kh_LoserTeam(self.team, self);
+ kh_LoserTeam(TMID(self.team), self);
if(self.owner)
if(kh_Key_AllOwnedByWhichTeam() != -1)
FOR_EACH_KH_KEY(key)
if(vlen(key.owner.origin - p) > autocvar_g_balance_keyhunt_maxdist)
goto not_winning;
- kh_WinnerTeam(self.team);
+ kh_WinnerTeam(TMID(self.team));
:not_winning
}
if(kh_interferemsg_time && time > kh_interferemsg_time)
{
kh_interferemsg_time = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
- if(it.team == kh_interferemsg_team)
+ FOREACH_CLIENT(IS_PLAYER(it), {
+ if (TMID(it.team) == kh_interferemsg_team)
if(it.kh_next)
Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_MEET);
else
Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_HELP);
else
Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(kh_interferemsg_team, CENTER_KEYHUNT_INTERFERE));
- ));
+ });
}
self.nextthink = time + 0.05;
key.kh_dropperteam = 0;
key.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
setsize(key, KH_KEY_MIN, KH_KEY_MAX);
- key.colormod = Team_ColorRGB(initial_owner.team) * KH_KEY_BRIGHTNESS;
+ key.colormod = Team_ColorRGB(TMID(initial_owner.team)) * KH_KEY_BRIGHTNESS;
key.reset = key_reset;
- switch(initial_owner.team)
+ switch(TMID(initial_owner.team))
{
case NUM_TEAM_1:
key.netname = "^1red key";
key.kh_worldkeynext = kh_worldkeylist;
kh_worldkeylist = key;
- Send_Notification(NOTIF_ONE, initial_owner, MSG_CENTER, APP_TEAM_NUM(initial_owner.team, CENTER_KEYHUNT_START));
+ Send_Notification(NOTIF_ONE, initial_owner, MSG_CENTER, APP_TEAM_NUM(TMID(initial_owner.team), CENTER_KEYHUNT_START));
- WaypointSprite_Spawn(WP_KeyDropped, 0, 0, key, '0 0 1' * KH_KEY_WP_ZSHIFT, world, key.team, key, waypointsprite_attachedforcarrier, false, RADARICON_FLAG);
+ WaypointSprite_Spawn(WP_KeyDropped, 0, 0, key, '0 0 1' * KH_KEY_WP_ZSHIFT, world, TMID(key.team), key, waypointsprite_attachedforcarrier, false, RADARICON_FLAG);
key.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_Key_waypointsprite_visible_for_player;
kh_Key_AssignTo(key, initial_owner);
if(!key.owner)
return -1;
if(teem == -1)
- teem = key.team;
- else if(teem != key.team)
+ teem = TMID(key.team);
+ else if(teem != TMID(key.team))
return -1;
--keys;
}
key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_throwvelocity * v_forward, false);
key.pusher = world;
key.pushltime = time + autocvar_g_balance_keyhunt_protecttime;
- key.kh_dropperteam = key.team;
+ key.kh_dropperteam = TMID(key.team);
sound(player, CH_TRIGGER, SND_KH_DROP, VOL_BASE, ATTEN_NORM);
}
key.pusher = mypusher;
key.pushltime = time + autocvar_g_balance_keyhunt_protecttime;
if(suicide)
- key.kh_dropperteam = player.team;
+ key.kh_dropperteam = TMID(player.team);
}
sound(player, CH_TRIGGER, SND_KH_DROP, VOL_BASE, ATTEN_NORM);
}
{
float t_team = kh_Team_ByID(num);
float players = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
- if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == t_team)
+ FOREACH_CLIENT(IS_PLAYER(it), {
+ if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && TMID(it.team) == t_team)
++players;
- ));
+ });
if (!players) { return t_team; }
}
teem = kh_Team_ByID(i);
players = 0;
entity my_player = world;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
- if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem)
+ FOREACH_CLIENT(IS_PLAYER(it), {
+ if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && TMID(it.team) == teem)
{
++players;
if(random() * players <= 1)
my_player = it;
}
- ));
+ });
kh_Key_Spawn(my_player, 360 * i / kh_teams, i);
}
self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
navigation_goalrating_start();
- if(kh_Key_AllOwnedByWhichTeam() == self.team)
+ if(kh_Key_AllOwnedByWhichTeam() == TMID(self.team))
havocbot_goalrating_kh(10, 0.1, 0.1); // bring home
else
havocbot_goalrating_kh(4, 4, 1); // play defensively
navigation_goalrating_start();
key_owner_team = kh_Key_AllOwnedByWhichTeam();
- if(key_owner_team == self.team)
+ if(key_owner_team == TMID(self.team))
havocbot_goalrating_kh(10, 0.1, 0.1); // defend key carriers
else if(key_owner_team == -1)
havocbot_goalrating_kh(4, 1, 0.1); // play defensively
navigation_goalrating_start();
key_owner_team = kh_Key_AllOwnedByWhichTeam();
- if(key_owner_team == self.team)
+ if(key_owner_team == TMID(self.team))
havocbot_goalrating_kh(10, 0.1, 0.1); // defend anyway
else if(key_owner_team == -1)
havocbot_goalrating_kh(0.1, 1, 4); // play offensively
navigation_goalrating_start();
key_owner_team = kh_Key_AllOwnedByWhichTeam();
- if(key_owner_team == self.team)
+ if(key_owner_team == TMID(self.team))
havocbot_goalrating_kh(10, 0.1, 0.1); // defend anyway
else if(key_owner_team == -1)
havocbot_goalrating_kh(1, 10, 4); // prefer dropped keys
if(!g_tdm || !self.cnt) { remove(self); return; }
self.classname = "tdm_team";
- self.team = self.cnt + 1;
+ self.__team = self.cnt + 1;
}
// code from here on is just to support maps that don't have team entities
float i, p, longflags;
WriteHeader(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
- int t = this.team - 1;
+ int t = TMID(this.team) - 1;
assert(t, eprint(this));
WriteByte(MSG_ENTITY, t);
{
entity ts = new_pure(csqc_score_team);
ts.netname = name; // not used yet, FIXME
- ts.team = t;
+ ts.__team = t;
Net_LinkEntity(ts, false, 0, TeamScore_SendEntity);
teamscorekeepers[t - 1] = ts;
++teamscores_entities_count;
float TeamScore_Add(entity player, float scorefield, float score)
{
- return TeamScore_AddToTeam(player.team, scorefield, score);
+ return TeamScore_AddToTeam(TMID(player.team), scorefield, score);
}
float TeamScore_Compare(entity t1, entity t2, float strict)
}
if (result.x == 0 && strict)
- result.x = t1.team - t2.team;
+ result.x = TMID(t1.team) - TMID(t2.team);
return result.x;
}
{
entity t1, t2;
float r;
- t1 = teamscorekeepers[p1.team - 1];
- t2 = teamscorekeepers[p2.team - 1];
+ t1 = teamscorekeepers[TMID(p1.team) - 1];
+ t2 = teamscorekeepers[TMID(p2.team) - 1];
r = TeamScore_Compare(t1, t2, ((teams >= 0) ? 1 : strict));
return r;
}
while(p)
{
if(teamscores_entities_count)
- if(t != p.team)
- Score_NicePrint_Team(to, p.team, w);
+ if(t != TMID(p.team))
+ Score_NicePrint_Team(to, TMID(p.team), w);
Score_NicePrint_Player(to, p, w);
- t = p.team;
+ t = TMID(p.team);
p = p.chain;
}
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT);
- WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, TMID(self.team));
WriteCoord(MSG_ENTITY, self.origin.x);
WriteCoord(MSG_ENTITY, self.origin.y);
WriteCoord(MSG_ENTITY, self.origin.z);
self.use = spawnpoint_use;
self.think = spawnpoint_think;
self.nextthink = time + 0.5 + random() * 2; // shouldn't need it for a little second
- self.team_saved = self.team;
+ self.team_saved = TMID(self.team);
if (!self.cnt)
self.cnt = 1;
if (have_team_spawns != 0)
if (self.team)
have_team_spawns = 1;
- have_team_spawns_forteam[self.team] = 1;
+ have_team_spawns_forteam[TMID(self.team)] = 1;
if (autocvar_r_showbboxes)
{
!(
( // if this passes, there is a DM spawn on a team match
teamplay
- && (self.team != NUM_TEAM_1)
- && (self.team != NUM_TEAM_2)
- && (self.team != NUM_TEAM_3)
- && (self.team != NUM_TEAM_4)
+ && (TMID(self.team) != NUM_TEAM_1)
+ && (TMID(self.team) != NUM_TEAM_2)
+ && (TMID(self.team) != NUM_TEAM_3)
+ && (TMID(self.team) != NUM_TEAM_4)
)
||
( // if this passes, there is a team spawn on a DM match
!teamplay
&&
(
- (self.team == NUM_TEAM_1)
- || (self.team == NUM_TEAM_2)
- || (self.team == NUM_TEAM_3)
- || (self.team == NUM_TEAM_4)
+ (TMID(self.team) == NUM_TEAM_1)
+ || (TMID(self.team) == NUM_TEAM_2)
+ || (TMID(self.team) == NUM_TEAM_3)
+ || (TMID(self.team) == NUM_TEAM_4)
)
)
)
Keys: "angle" viewing angle when spawning. */
spawnfunc(info_player_team1)
{
- this.team = NUM_TEAM_1; // red
+ this.__team = NUM_TEAM_1; // red
spawnfunc_info_player_deathmatch(this);
}
Keys: "angle" viewing angle when spawning. */
spawnfunc(info_player_team2)
{
- this.team = NUM_TEAM_2; // blue
+ this.__team = NUM_TEAM_2; // blue
spawnfunc_info_player_deathmatch(this);
}
Keys: "angle" viewing angle when spawning. */
spawnfunc(info_player_team3)
{
- this.team = NUM_TEAM_3; // yellow
+ this.__team = NUM_TEAM_3; // yellow
spawnfunc_info_player_deathmatch(this);
}
Keys: "angle" viewing angle when spawning. */
spawnfunc(info_player_team4)
{
- this.team = NUM_TEAM_4; // purple
+ this.__team = NUM_TEAM_4; // purple
spawnfunc_info_player_deathmatch(this);
}
// filter out spots for the wrong team
if(teamcheck >= 0)
- if(spot.team != teamcheck)
+ if(TMID(spot.team) != teamcheck)
return '-1 0 0';
if(race_spawns)
teamcheck = -1;
else if(have_team_spawns > 0)
{
- if(have_team_spawns_forteam[self.team] == 0)
+ if(have_team_spawns_forteam[TMID(self.team)] == 0)
{
// we request a spawn for a team, and we have team
// spawns, but that team has no spawns?
teamcheck = -1;
}
else
- teamcheck = self.team; // MUST be team
+ teamcheck = TMID(self.team); // MUST be team
}
else if(have_team_spawns == 0 && have_team_spawns_forteam[0])
teamcheck = 0; // MUST be noteam
SetPlayerColors(pl,_color);
if(t != s) {
- LogTeamchange(pl.playerid, pl.team, 3); // log manual team join
+ LogTeamchange(pl.playerid, TMID(pl.team), 3); // log manual team join
if(!noprint)
bprint(pl.netname, "^7 has changed from ", Team_NumberToColoredFullName(s), "^7 to ", Team_NumberToColoredFullName(t), "\n");
entity head = find(world, classname, teament_name);
while(head)
{
- switch(head.team)
+ switch(TMID(head.team))
{
case NUM_TEAM_1: c1 = 0; break;
case NUM_TEAM_2: c2 = 0; break;
// FIXME: also find and memorize the lowest-scoring bot on each team (in case players must be shuffled around)
// also remember the lowest-scoring player
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
float t;
if(IS_PLAYER(it) || it.caplayer)
- t = it.team;
+ t = TMID(it.team);
else if(it.team_forced > 0)
t = it.team_forced; // reserve the spot
else
}
}
}
- ));
+ });
// if the player who has a forced team has not joined yet, reserve the spot
if(autocvar_g_campaign)
// if he's not on a valid team, then let other code put him on the smallest team
if(!forcebestteam)
{
- if( c1 >= 0 && pl.team == NUM_TEAM_1)
- selectedteam = pl.team;
- else if(c2 >= 0 && pl.team == NUM_TEAM_2)
- selectedteam = pl.team;
- else if(c3 >= 0 && pl.team == NUM_TEAM_3)
- selectedteam = pl.team;
- else if(c4 >= 0 && pl.team == NUM_TEAM_4)
- selectedteam = pl.team;
+ if( c1 >= 0 && TMID(pl.team) == NUM_TEAM_1)
+ selectedteam = TMID(pl.team);
+ else if(c2 >= 0 && TMID(pl.team) == NUM_TEAM_2)
+ selectedteam = TMID(pl.team);
+ else if(c3 >= 0 && TMID(pl.team) == NUM_TEAM_3)
+ selectedteam = TMID(pl.team);
+ else if(c4 >= 0 && TMID(pl.team) == NUM_TEAM_4)
+ selectedteam = TMID(pl.team);
else
selectedteam = -1;
// when JoinBestTeam is called by client.qc/ClientKill_Now_TeamChange the players team is -1 and thus skipped
// when JoinBestTeam is called by cl_client.qc/ClientConnect the player_id is 0 the log attempt is rejected
- LogTeamchange(pl.playerid, pl.team, 99);
+ LogTeamchange(pl.playerid, TMID(pl.team), 99);
}
return selectedteam;
}
error("smallest team: invalid team\n");
}
- LogTeamchange(pl.playerid, pl.team, 2); // log auto join
+ LogTeamchange(pl.playerid, TMID(pl.team), 2); // log auto join
if(!IS_DEAD(pl))
Damage(pl, pl, pl, 100000, DEATH_TEAMCHANGE.m_id, pl.origin, '0 0 0');
lowest_player_score = 999999999;
// find the lowest-scoring player & bot of that team
- FOREACH_CLIENT(IS_PLAYER(it) && it.team == steam, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && TMID(it.team) == steam, {
if(it.isbot)
{
if(it.totalfrags < lowest_bot_score)
lowest_player_score = it.totalfrags;
}
}
- ));
+ });
// prefers to move a bot...
if(lowest_bot != world)
WriteByte(MSG_ENTITY, fr);
}
- WriteByte(MSG_ENTITY, self.realowner.team);
+ WriteByte(MSG_ENTITY, TMID(self.realowner.team));
}
if(sf & 2)
int t = tokenize_console(s);
if (t >= 2)
{
- this.team = --internalteam;
+ this.__team = --internalteam;
for (int i = 1; i < t; ++i)
{
s = argv(i);