From: TimePath Date: Thu, 17 Mar 2016 07:47:19 +0000 (+1100) Subject: Teams: mark all uses X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=a11173a91c5da56cc4d3094095f59c40ab50df92;p=xonotic%2Fxonotic-data.pk3dir.git Teams: mark all uses --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index d0910e374..3f236fc73 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -254,7 +254,7 @@ void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer) // 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; } diff --git a/qcsrc/client/hud/panel/infomessages.qc b/qcsrc/client/hud/panel/infomessages.qc index 8199bd8dd..2213e5d19 100644 --- a/qcsrc/client/hud/panel/infomessages.qc +++ b/qcsrc/client/hud/panel/infomessages.qc @@ -153,7 +153,7 @@ void HUD_InfoMessages() { 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); @@ -165,7 +165,7 @@ void HUD_InfoMessages() 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); diff --git a/qcsrc/client/hud/panel/radar.qc b/qcsrc/client/hud/panel/radar.qc index a70e0416a..cb08790e4 100644 --- a/qcsrc/client/hud/panel/radar.qc +++ b/qcsrc/client/hud/panel/radar.qc @@ -340,12 +340,12 @@ void HUD_Radar() 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)) diff --git a/qcsrc/client/hud/panel/score.qc b/qcsrc/client/hud/panel/score.qc index 12114b4e3..61782b9c1 100644 --- a/qcsrc/client/hud/panel/score.qc +++ b/qcsrc/client/hud/panel/score.qc @@ -78,13 +78,13 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me) // 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; @@ -96,14 +96,14 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me) do for (pl = players.sort_next; pl && i= rows) { @@ -299,14 +299,14 @@ void HUD_Score() ++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; } } diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index ebfc3b161..b56504006 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -260,7 +260,7 @@ float SetTeam(entity o, int _team) { 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; @@ -270,17 +270,17 @@ float SetTeam(entity o, int _team) { 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; @@ -472,8 +472,8 @@ NET_HANDLE(ENT_CLIENT_TEAMSCORES, bool isnew) 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 diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index e876e3ea8..fcafca3fb 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -90,7 +90,7 @@ float RegisterTeam(entity _team) 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; @@ -112,7 +112,7 @@ void RemoveTeam(entity _team) 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(); } @@ -125,7 +125,7 @@ entity GetTeam(int _team, bool add) if (!add) return world; entity tm = new_pure(team); - tm.team = _team; + tm.__team = _team; teamslots[num] = tm; RegisterTeam(tm); return tm; diff --git a/qcsrc/client/quickmenu.qc b/qcsrc/client/quickmenu.qc index 0208fc182..00dd6b9a7 100644 --- a/qcsrc/client/quickmenu.qc +++ b/qcsrc/client/quickmenu.qc @@ -752,9 +752,9 @@ void HUD_Quickmenu_PlayerListEntries(string cmd, float teamplayers, float withou 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; diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index 53539e625..51c8196c3 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -207,9 +207,9 @@ float HUD_CompareTeamScores(entity left, entity right) { 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]); @@ -227,7 +227,7 @@ float HUD_CompareTeamScores(entity left, entity right) return r; } - if (left.team < right.team) + if (TMID(left.team) < TMID(right.team)) return true; return false; @@ -707,7 +707,7 @@ string HUD_FixScoreboardColumnWidth(int i, string str) 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; @@ -960,7 +960,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz 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; @@ -1312,13 +1312,13 @@ void HUD_DrawScoreboard() 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); @@ -1343,7 +1343,7 @@ void HUD_DrawScoreboard() 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; @@ -1386,7 +1386,7 @@ void HUD_DrawScoreboard() 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); diff --git a/qcsrc/client/teamradar.qc b/qcsrc/client/teamradar.qc index 96fd5ee97..c832a5866 100644 --- a/qcsrc/client/teamradar.qc +++ b/qcsrc/client/teamradar.qc @@ -220,7 +220,7 @@ NET_HANDLE(ENT_CLIENT_RADARLINK, bool isnew) if(sendflags & 4) { - this.team = ReadByte(); + this.__team = ReadByte(); } return = true; diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index c8e246a06..ae69b8f5a 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -270,7 +270,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) this.fade_rate = 0; } - this.team = ReadByte() - 1; + this.__team = ReadByte() - 1; } if (f & 2) @@ -323,7 +323,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) 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)) diff --git a/qcsrc/common/effects/qc/damageeffects.qc b/qcsrc/common/effects/qc/damageeffects.qc index ba60e51bd..4da72a00e 100644 --- a/qcsrc/common/effects/qc/damageeffects.qc +++ b/qcsrc/common/effects/qc/damageeffects.qc @@ -99,7 +99,7 @@ void DamageEffect_Think() // 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) @@ -182,7 +182,7 @@ void DamageEffect(vector hitorg, float thedamage, int type, 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; diff --git a/qcsrc/common/effects/qc/gibs.qc b/qcsrc/common/effects/qc/gibs.qc index 45a28a9b4..43afbf7e2 100644 --- a/qcsrc/common/effects/qc/gibs.qc +++ b/qcsrc/common/effects/qc/gibs.qc @@ -36,9 +36,9 @@ void Violence_GibSplash_At(vector org, vector dir, float type, float amount, ent // 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; diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index df062641a..ca299b9a8 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -50,9 +50,9 @@ float OtherTeam(float t) //works only if there are two teams on the map! { 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; @@ -92,7 +92,7 @@ void nexball_setstatus() { 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(); @@ -215,7 +215,7 @@ void DropBall(entity ball, vector org, vector vel) } 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; @@ -236,7 +236,7 @@ void InitBall() 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); @@ -247,7 +247,7 @@ void ResetBall() 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; @@ -360,13 +360,13 @@ void GoalTouch() 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; @@ -381,16 +381,16 @@ void GoalTouch() 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) @@ -401,8 +401,8 @@ void GoalTouch() } 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; } @@ -413,7 +413,7 @@ void GoalTouch() 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) { @@ -432,7 +432,7 @@ void GoalTouch() 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); } //=======================// @@ -445,7 +445,7 @@ spawnfunc(nexball_team) remove(self); return; } - self.team = self.cnt + 1; + self.__team = self.cnt + 1; } void nb_spawnteam(string teamname, float teamcolor) @@ -454,7 +454,7 @@ 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; } @@ -464,33 +464,33 @@ void nb_spawnteams() 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; @@ -612,10 +612,10 @@ void SpawnGoal() 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; } @@ -628,28 +628,28 @@ void SpawnGoal() 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(); @@ -657,7 +657,7 @@ spawnfunc(nexball_fault) spawnfunc(nexball_out) { - self.team = GOAL_OUT; + self.__team = GOAL_OUT; if(self.noise == "") self.noise = strzone(SND(TYPEHIT)); SpawnGoal(); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc b/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc index 28ac85d79..8e973198a 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc @@ -142,9 +142,9 @@ void cpicon_changeteam(entity 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 { @@ -169,7 +169,7 @@ NET_HANDLE(ENT_CLIENT_CONTROLPOINT_ICON, bool isnew) this.health = ReadByte(); this.max_health = ReadByte(); this.count = ReadByte(); - this.team = ReadByte(); + this.__team = ReadByte(); this.iscaptured = ReadByte(); if(!this.count) @@ -182,9 +182,9 @@ NET_HANDLE(ENT_CLIENT_CONTROLPOINT_ICON, bool isnew) 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); } diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc index 03e81f4bd..a4fdcff89 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc @@ -167,9 +167,9 @@ void generator_changeteam(entity 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 { @@ -194,7 +194,7 @@ NET_HANDLE(ENT_CLIENT_GENERATOR, bool isnew) this.health = ReadByte(); this.max_health = ReadByte(); this.count = ReadByte(); - this.team = ReadByte(); + this.__team = ReadByte(); if(!this.count) this.count = 40; @@ -207,9 +207,9 @@ NET_HANDLE(ENT_CLIENT_GENERATOR, bool isnew) { int _tmp; _tmp = ReadByte(); - if(_tmp != this.team) + if(_tmp != TMID(this.team)) { - this.team = _tmp; + this.__team = _tmp; generator_changeteam(this); } diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc index 0b030b251..c58577352 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc @@ -166,7 +166,7 @@ bool ons_CaptureShield_Customize() {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; @@ -174,7 +174,7 @@ bool ons_CaptureShield_Customize() 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; } @@ -243,7 +243,7 @@ void onslaught_updatelinks() 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; @@ -257,7 +257,7 @@ void onslaught_updatelinks() 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 @@ -300,9 +300,9 @@ void onslaught_updatelinks() 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) { @@ -312,9 +312,9 @@ void onslaught_updatelinks() 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 @@ -400,8 +400,8 @@ void ons_Link_CheckUpdate() // 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; @@ -458,7 +458,7 @@ int ons_ControlPoint_Attackable(entity cp, int teamnumber) 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? @@ -506,10 +506,10 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker } 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; @@ -530,7 +530,7 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker { 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); @@ -538,7 +538,7 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker 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); @@ -607,16 +607,16 @@ void ons_ControlPoint_Icon_Think() 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; } @@ -640,7 +640,7 @@ void ons_ControlPoint_Icon_BuildThink() 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; @@ -657,7 +657,7 @@ void ons_ControlPoint_Icon_BuildThink() 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); @@ -665,7 +665,7 @@ void ons_ControlPoint_Icon_BuildThink() 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); @@ -707,7 +707,7 @@ void ons_ControlPoint_Icon_Spawn(entity cp, entity player) 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); @@ -716,10 +716,10 @@ void ons_ControlPoint_Icon_Spawn(entity cp, entity player) 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); @@ -729,7 +729,7 @@ entity ons_ControlPoint_Waypoint(entity e) { 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 @@ -749,7 +749,7 @@ void ons_ControlPoint_UpdateSprite(entity e) 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! { @@ -766,20 +766,20 @@ void ons_ControlPoint_UpdateSprite(entity e) 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; } @@ -809,7 +809,7 @@ void ons_ControlPoint_Touch() 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, @@ -834,7 +834,7 @@ void ons_ControlPoint_Reset(entity this) remove(this.goalentity); this.goalentity = world; - this.team = 0; + this.__team = 0; this.colormap = 1024; this.iscaptured = false; this.islinked = false; @@ -845,7 +845,7 @@ void ons_ControlPoint_Reset(entity this) 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(); @@ -875,7 +875,7 @@ void ons_ControlPoint_Setup(entity cp) 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; @@ -909,7 +909,7 @@ void ons_ControlPoint_Setup(entity cp) // 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); } @@ -931,21 +931,21 @@ void ons_Generator_UpdateSprite(entity e) 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'); } @@ -992,10 +992,10 @@ void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float d 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; @@ -1050,7 +1050,7 @@ void ons_GeneratorThink() 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)); }); } } @@ -1058,7 +1058,7 @@ void ons_GeneratorThink() 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; @@ -1076,7 +1076,7 @@ void ons_GeneratorReset(entity this) 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(); } @@ -1110,7 +1110,7 @@ void onslaught_generator_touch() 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 @@ -1146,7 +1146,7 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o // 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); @@ -1166,10 +1166,10 @@ void Onslaught_count_generators() 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); } } @@ -1392,7 +1392,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale) 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 @@ -2023,7 +2023,7 @@ MUTATOR_HOOKFUNCTION(ons, GetTeamCount) // 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; @@ -2137,7 +2137,7 @@ MUTATOR_HOOKFUNCTION(ons, SendWaypoint) 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") { diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc index 492428718..718315250 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc @@ -15,13 +15,13 @@ bool cpicon_send(entity this, entity to, int sf) 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); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc index cf8d234a3..79a36725f 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc @@ -13,12 +13,12 @@ bool generator_send(entity this, entity to, int sf) 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); diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 447e7730e..1d3d21444 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -603,7 +603,7 @@ string _MapInfo_GetDefaultEx(float t) float _MapInfo_GetTeamPlayBool(float t) { - FOREACH(Gametypes, it.items == t, return it.team); + FOREACH(Gametypes, it.items == t, return it.__team); return false; } diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index ab7233ef2..7ed9e534c 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -19,7 +19,7 @@ CLASS(Gametype, Object) /** 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 */ @@ -40,7 +40,7 @@ CLASS(Gametype, Object) 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; diff --git a/qcsrc/common/minigames/cl_minigames.qc b/qcsrc/common/minigames/cl_minigames.qc index 6f7e7c3ae..d408b5f0f 100644 --- a/qcsrc/common/minigames/cl_minigames.qc +++ b/qcsrc/common/minigames/cl_minigames.qc @@ -220,7 +220,7 @@ NET_HANDLE(ENT_CLIENT_MINIGAME, bool isnew) minigame_ent = self.owner; if ( sf & MINIG_SF_UPDATE ) - self.team = ReadByte(); + self.__team = ReadByte(); if ( activate ) { diff --git a/qcsrc/common/minigames/minigame/all.qh b/qcsrc/common/minigames/minigame/all.qh index 74df391de..dfed3dce8 100644 --- a/qcsrc/common/minigames/minigame/all.qh +++ b/qcsrc/common/minigames/minigame/all.qh @@ -99,8 +99,8 @@ that .owner is set to the minigame session entity and .minigame_autoclean is tru * 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*/ diff --git a/qcsrc/common/minigames/minigame/bd.qc b/qcsrc/common/minigames/minigame/bd.qc index 84120e1b0..0f243b375 100644 --- a/qcsrc/common/minigames/minigame/bd.qc +++ b/qcsrc/common/minigames/minigame/bd.qc @@ -255,7 +255,7 @@ void bd_editor_place(entity minigame, entity player, string pos, int thetile, st } 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'; @@ -467,7 +467,7 @@ entity bd_load_piece(entity minigame, string s) 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; diff --git a/qcsrc/common/minigames/minigame/c4.qc b/qcsrc/common/minigames/minigame/c4.qc index 9b9d57085..a99f9f98d 100644 --- a/qcsrc/common/minigames/minigame/c4.qc +++ b/qcsrc/common/minigames/minigame/c4.qc @@ -157,7 +157,7 @@ void c4_move(entity minigame, entity player, string pos ) 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) ) @@ -168,10 +168,10 @@ void c4_move(entity minigame, entity player, string 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; @@ -214,7 +214,7 @@ int c4_server_event(entity minigame, string event, ...) // 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; @@ -257,13 +257,13 @@ void c4_hud_board(vector pos, vector mySize) 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 ); } @@ -290,7 +290,7 @@ void c4_hud_board(vector pos, vector mySize) } 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 ); } } @@ -301,7 +301,7 @@ void c4_hud_board(vector pos, vector mySize) 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; @@ -349,7 +349,7 @@ void c4_hud_status(vector pos, vector mySize) 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), @@ -357,7 +357,7 @@ void c4_hud_status(vector pos, vector mySize) 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; @@ -373,12 +373,12 @@ string c4_turn_to_string(int turnflags) 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 ) @@ -390,7 +390,7 @@ string c4_turn_to_string(int turnflags) // 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); } @@ -418,7 +418,7 @@ int c4_client_event(entity minigame, string event, ...) } 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) ) { @@ -473,7 +473,7 @@ int c4_client_event(entity minigame, string event, ...) 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))); } @@ -491,7 +491,7 @@ int c4_client_event(entity minigame, string event, ...) 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(); } } diff --git a/qcsrc/common/minigames/minigame/nmm.qc b/qcsrc/common/minigames/minigame/nmm.qc index e4e0dc638..dec04df79 100644 --- a/qcsrc/common/minigames/minigame/nmm.qc +++ b/qcsrc/common/minigames/minigame/nmm.qc @@ -83,7 +83,7 @@ void nmm_spawn_tile(string id, entity minig, int distance) 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)); @@ -196,7 +196,7 @@ entity nmm_find_piece(entity start, entity minigame, int teamn, int pieceflags) 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; } @@ -222,10 +222,10 @@ int nmm_server_event(entity minigame, string event, ...) 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; } @@ -243,7 +243,7 @@ int nmm_server_event(entity minigame, string event, ...) 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; } @@ -256,7 +256,7 @@ int nmm_server_event(entity minigame, string event, ...) 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 ) @@ -265,7 +265,7 @@ int nmm_server_event(entity minigame, string event, ...) } 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; @@ -323,24 +323,24 @@ int nmm_server_event(entity minigame, string event, ...) } } - 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; @@ -355,11 +355,11 @@ int nmm_server_event(entity minigame, string event, ...) 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; @@ -387,7 +387,7 @@ vector nmm_boardsize; // 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 @@ -416,7 +416,7 @@ bool nmm_valid_selection(entity tile) // 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; @@ -462,7 +462,7 @@ void nmm_hud_board(vector pos, vector mySize) 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 ); } @@ -476,7 +476,7 @@ void nmm_hud_board(vector pos, vector mySize) 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; @@ -528,7 +528,7 @@ void nmm_hud_status(vector pos, vector mySize) 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), @@ -538,7 +538,7 @@ void nmm_hud_status(vector pos, vector mySize) { mypos = pos; mypos_y += player_fontsize_y; - if ( e.team == 2 ) + if ( TMID(e.team) == 2 ) { mypos_x += player2x; player2x += piece_space; @@ -556,7 +556,7 @@ void nmm_hud_status(vector pos, vector mySize) 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 ); } } @@ -597,12 +597,12 @@ string nmm_turn_to_string(int turnflags) { 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"); @@ -630,7 +630,7 @@ int nmm_client_event(entity minigame, string event, ...) 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) ) { @@ -749,7 +749,7 @@ int nmm_client_event(entity minigame, string event, ...) 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(); } } diff --git a/qcsrc/common/minigames/minigame/pong.qc b/qcsrc/common/minigames/minigame/pong.qc index 87c75f48c..335523bd1 100644 --- a/qcsrc/common/minigames/minigame/pong.qc +++ b/qcsrc/common/minigames/minigame/pong.qc @@ -49,7 +49,7 @@ void pong_ball_throw(entity ball) 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; } @@ -65,7 +65,7 @@ void pong_ball_reset(entity ball) 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; @@ -136,7 +136,7 @@ bool pong_goal(entity ball, int pteam) 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; } @@ -159,7 +159,7 @@ void pong_ball_think() if ( pong_paddle_hit(self, i) ) { pong_paddle_bounce(self,i); - self.team = i; + self.__team = i; self.SendFlags |= PONG_SF_BALLTEAM; return; } @@ -227,7 +227,7 @@ void pong_ai_think() float self_pos; - if ( self.team <= 2 ) + if ( TMID(self.team) <= 2 ) { if ( ball ) target = ball.origin_y + ball.velocity_y*think_speed; @@ -280,7 +280,7 @@ void pong_paddle_think() 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); @@ -317,7 +317,7 @@ entity pong_paddle_spawn(entity minigame, int pl_team, entity real_player) 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); @@ -519,7 +519,7 @@ void pong_hud_board(vector pos, vector mySize) 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" ) @@ -527,11 +527,11 @@ void pong_hud_board(vector pos, vector mySize) 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 ); @@ -561,9 +561,9 @@ void pong_hud_status(vector pos, vector mySize) 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")), @@ -573,7 +573,7 @@ void pong_hud_status(vector pos, vector mySize) '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); } } } diff --git a/qcsrc/common/minigames/minigame/pp.qc b/qcsrc/common/minigames/minigame/pp.qc index a66a83967..f7980d3fe 100644 --- a/qcsrc/common/minigames/minigame/pp.qc +++ b/qcsrc/common/minigames/minigame/pp.qc @@ -53,14 +53,14 @@ bool pp_winning_piece(entity piece) 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; @@ -70,7 +70,7 @@ bool pp_valid_move(entity minigame, string pos) { 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; @@ -97,24 +97,24 @@ bool pp_valid_move(entity minigame, string pos) 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); } @@ -130,7 +130,7 @@ void pp_move(entity minigame, entity player, string pos ) 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) ) { @@ -157,7 +157,7 @@ void pp_setup_pieces(entity minigame) 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); @@ -174,11 +174,11 @@ void pp_next_match(entity minigame, entity player) // 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; @@ -228,7 +228,7 @@ int pp_server_event(entity minigame, string event, ...) // 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; @@ -303,15 +303,15 @@ void pp_hud_board(vector pos, vector mySize) 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) { @@ -329,7 +329,7 @@ void pp_hud_board(vector pos, vector mySize) } } - 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); @@ -353,7 +353,7 @@ void pp_hud_board(vector pos, vector mySize) 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; @@ -401,7 +401,7 @@ void pp_hud_status(vector pos, vector mySize) 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; @@ -409,7 +409,7 @@ void pp_hud_status(vector pos, vector mySize) } 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), @@ -417,13 +417,13 @@ void pp_hud_status(vector pos, vector mySize) 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); @@ -439,19 +439,19 @@ string pp_turn_to_string(int turnflags) 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 ) @@ -463,7 +463,7 @@ string pp_turn_to_string(int turnflags) // 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); } @@ -491,7 +491,7 @@ int pp_client_event(entity minigame, string event, ...) } 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) ) { @@ -546,7 +546,7 @@ int pp_client_event(entity minigame, string event, ...) 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(""); @@ -562,7 +562,7 @@ int pp_client_event(entity minigame, string event, ...) 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(); diff --git a/qcsrc/common/minigames/minigame/ps.qc b/qcsrc/common/minigames/minigame/ps.qc index 4eb0009b9..d39a74b1d 100644 --- a/qcsrc/common/minigames/minigame/ps.qc +++ b/qcsrc/common/minigames/minigame/ps.qc @@ -120,7 +120,7 @@ void ps_setup_pieces(entity minigame) 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); } @@ -607,7 +607,7 @@ int ps_client_event(entity minigame, string event, ...) 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(); } } diff --git a/qcsrc/common/minigames/minigame/snake.qc b/qcsrc/common/minigames/minigame/snake.qc index 33868ad57..56db93ae7 100644 --- a/qcsrc/common/minigames/minigame/snake.qc +++ b/qcsrc/common/minigames/minigame/snake.qc @@ -61,7 +61,7 @@ entity snake_find_cnt(entity minig, int steam, int tile) { 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; } @@ -80,7 +80,7 @@ entity snake_find_head(entity minig, int steam) { 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; } @@ -98,7 +98,7 @@ void snake_new_mouse(entity minigame) } 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); @@ -178,7 +178,7 @@ void minigame_setup_snake(entity minigame, int pteam) } 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; @@ -207,7 +207,7 @@ entity snake_get_player(entity minigame, int pteam) 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; } @@ -248,7 +248,7 @@ void snake_move_body(entity minigame, entity head, bool ate_mouse) 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; @@ -284,7 +284,7 @@ void snake_eat_team(entity minigame, int pteam) 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); @@ -328,8 +328,8 @@ void snake_move_head(entity minigame, entity head) } 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; @@ -347,8 +347,8 @@ void snake_move_head(entity minigame, entity head) // 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) @@ -369,7 +369,7 @@ void snake_move(entity minigame, entity player, string dxs, string dys ) //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 @@ -497,7 +497,7 @@ int snake_server_event(entity minigame, string event, ...) 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 ) ) { @@ -553,7 +553,7 @@ void snake_hud_board(vector pos, vector mySize) 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) @@ -599,7 +599,7 @@ void snake_hud_board(vector pos, vector mySize) { 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); @@ -640,7 +640,7 @@ void snake_hud_board(vector pos, vector mySize) } } - 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; @@ -650,9 +650,9 @@ void snake_hud_board(vector pos, vector mySize) 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; @@ -692,9 +692,9 @@ void snake_hud_status(vector pos, vector mySize) 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), @@ -702,11 +702,11 @@ void snake_hud_status(vector pos, vector mySize) 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); } } } @@ -719,15 +719,15 @@ string snake_turn_to_string(int turnflags) 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 ) @@ -825,7 +825,7 @@ int snake_client_event(entity minigame, string event, ...) 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; diff --git a/qcsrc/common/minigames/minigame/ttt.qc b/qcsrc/common/minigames/minigame/ttt.qc index cd9565abd..f6fef7867 100644 --- a/qcsrc/common/minigames/minigame/ttt.qc +++ b/qcsrc/common/minigames/minigame/ttt.qc @@ -77,7 +77,7 @@ bool ttt_valid_tile(string tile) 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) ) @@ -86,14 +86,14 @@ void ttt_move(entity minigame, entity player, string 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; @@ -110,11 +110,11 @@ void ttt_next_match(entity minigame, entity player) // 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; @@ -164,7 +164,7 @@ int ttt_server_event(entity minigame, string event, ...) // 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; @@ -182,7 +182,7 @@ int ttt_server_event(entity minigame, string event, ...) 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; @@ -229,13 +229,13 @@ void ttt_hud_board(vector pos, vector mySize) 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 ); } @@ -262,7 +262,7 @@ void ttt_hud_board(vector pos, vector mySize) } 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 ); } } @@ -292,7 +292,7 @@ void ttt_hud_status(vector pos, vector mySize) 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")), @@ -300,7 +300,7 @@ void ttt_hud_status(vector pos, vector mySize) 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; @@ -319,19 +319,19 @@ string ttt_turn_to_string(int turnflags) 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 ) @@ -525,7 +525,7 @@ void ttt_aimove(entity minigame) // 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 ) { @@ -559,7 +559,7 @@ int ttt_client_event(entity minigame, string event, ...) } 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) ) { @@ -614,7 +614,7 @@ int ttt_client_event(entity minigame, string event, ...) 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(""); @@ -630,7 +630,7 @@ int ttt_client_event(entity minigame, string event, ...) 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(); } @@ -644,7 +644,7 @@ int ttt_client_event(entity minigame, string event, ...) { 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); diff --git a/qcsrc/common/minigames/sv_minigames.qc b/qcsrc/common/minigames/sv_minigames.qc index 7c19c43dd..a4a496400 100644 --- a/qcsrc/common/minigames/sv_minigames.qc +++ b/qcsrc/common/minigames/sv_minigames.qc @@ -89,7 +89,7 @@ bool minigame_SendEntity(entity this, entity to, int sf) 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 @@ -136,7 +136,7 @@ int minigame_addplayer(entity minigame_session, entity player) { 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; diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 8f1d80276..0cc376018 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -155,7 +155,7 @@ void monster_setupcolors(entity mon) 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) @@ -177,7 +177,7 @@ void monster_changeteam(entity ent, float newteam) { if(!teamplay) { return; } - ent.team = newteam; + ent.__team = newteam; ent.monster_attack = true; // new team, activate attacking monster_setupcolors(ent); @@ -185,7 +185,7 @@ void monster_changeteam(entity ent, float newteam) { 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; } } @@ -1275,9 +1275,9 @@ bool Monster_Spawn_Setup(entity this) 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); @@ -1313,7 +1313,7 @@ bool Monster_Spawn(entity this, int mon_id) 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 diff --git a/qcsrc/common/mutators/mutator/buffs/all.qh b/qcsrc/common/mutators/mutator/buffs/all.qh index b45cb0621..b05aa3ae7 100644 --- a/qcsrc/common/mutators/mutator/buffs/all.qh +++ b/qcsrc/common/mutators/mutator/buffs/all.qh @@ -45,7 +45,7 @@ ENDCLASS(Buff) 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) \ diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index 30e19f0f5..f18fc5439 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -169,7 +169,7 @@ float buff_Waypoint_visible_for_player(entity plr) 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; @@ -412,7 +412,7 @@ void buff_Init(entity ent) {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); @@ -459,9 +459,9 @@ void buff_Init(entity ent) 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; diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 16a435dd1..e52ad32c9 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -53,7 +53,7 @@ MUTATOR_HOOKFUNCTION(cl_nades, Ent_Projectile) 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; } @@ -374,7 +374,7 @@ void nade_ice_think() { 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); @@ -616,7 +616,7 @@ void nade_boom() 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; @@ -632,7 +632,7 @@ void nade_boom() default: case NADE_TYPE_NORMAL: - expef = EFFECT_NADE_EXPLODE(self.realowner.team); + expef = EFFECT_NADE_EXPLODE(TMID(self.realowner.team)); break; } @@ -941,7 +941,7 @@ float nade_customize() { //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; } @@ -959,7 +959,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin //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; diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc b/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc index 23348f39d..16ec85c6f 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc @@ -55,7 +55,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn) 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; diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 1fb8fda3b..6a6e6257d 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -52,7 +52,7 @@ bool WaypointSprite_SendEntity(entity this, entity to, float sendflags) if (sendflags & 1) { - WriteByte(MSG_ENTITY, self.team); + WriteByte(MSG_ENTITY, TMID(self.team)); WriteByte(MSG_ENTITY, self.rule); } @@ -161,7 +161,7 @@ void Ent_WaypointSprite(entity this) if (sendflags & 1) { - this.team = ReadByte(); + this.__team = ReadByte(); this.rule = ReadByte(); } @@ -487,7 +487,7 @@ void Draw_WaypointSprite(entity this) case SPRITERULE_DEFAULT: if (this.team) { - if (this.team == t) + if (TMID(this.team) == t) spriteimage = this.netname; else spriteimage = ""; @@ -498,7 +498,7 @@ void Draw_WaypointSprite(entity this) 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; @@ -818,7 +818,7 @@ void WaypointSprite_UpdateRule(entity e, float t, float r) { // 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; } @@ -1008,7 +1008,7 @@ entity WaypointSprite_Spawn( else setorigin(wp, ofs); wp.enemy = showto; - wp.team = t; + wp.__team = t; wp.owner = own; wp.currentammo = hideable; if (own) @@ -1051,7 +1051,7 @@ entity WaypointSprite_DeployFixed( {SELFPARAM(); float t; if (teamplay) - t = self.team; + t = TMID(self.team); else t = 0; float maxdistance; @@ -1081,7 +1081,7 @@ entity WaypointSprite_Attach( 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; @@ -1099,7 +1099,7 @@ entity WaypointSprite_AttachCarrier( ) { 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); diff --git a/qcsrc/common/notifications/all.qh b/qcsrc/common/notifications/all.qh index 8f00087c0..d9bde09d3 100644 --- a/qcsrc/common/notifications/all.qh +++ b/qcsrc/common/notifications/all.qh @@ -77,7 +77,7 @@ typedef entity Notification; // 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) \ diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 253010c0c..74faeface 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -1304,7 +1304,7 @@ void PM_Main(entity this) 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; diff --git a/qcsrc/common/playerstats.qc b/qcsrc/common/playerstats.qc index 233762202..d852e7a93 100644 --- a/qcsrc/common/playerstats.qc +++ b/qcsrc/common/playerstats.qc @@ -135,7 +135,7 @@ void PlayerStats_GameReport_FinalizePlayer(entity p) 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); diff --git a/qcsrc/common/sounds/all.qc b/qcsrc/common/sounds/all.qc index 751462498..863197fae 100644 --- a/qcsrc/common/sounds/all.qc +++ b/qcsrc/common/sounds/all.qc @@ -125,7 +125,7 @@ float spamsound(entity e, int chan, string samp, float vol, float _atten) 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)); diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index e2bafb82f..33bc95af2 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -826,7 +826,7 @@ void Item_Touch() 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") @@ -870,10 +870,9 @@ void Item_FindTeam() 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); @@ -883,8 +882,7 @@ void Item_FindTeam() 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") { diff --git a/qcsrc/common/teams.qh b/qcsrc/common/teams.qh index 9342b4c00..5f49faac7 100644 --- a/qcsrc/common/teams.qh +++ b/qcsrc/common/teams.qh @@ -2,7 +2,6 @@ #define TEAMS_H REGISTRY(Teams, BITS(5)) -#define Teams_from(i) _Teams_from(i, TEAM_SPECTATOR) REGISTER_REGISTRY(Teams) REGISTRY_CHECK(Teams) @@ -12,12 +11,13 @@ CLASS(Team, Object) 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; @@ -66,7 +66,7 @@ float myteam; 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; } diff --git a/qcsrc/common/triggers/func/breakable.qc b/qcsrc/common/triggers/func/breakable.qc index e3c74b356..3e35edd7f 100644 --- a/qcsrc/common/triggers/func/breakable.qc +++ b/qcsrc/common/triggers/func/breakable.qc @@ -267,7 +267,7 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float 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(); @@ -334,7 +334,7 @@ spawnfunc(func_breakable) 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; diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 141fd458f..1873fe8f9 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -344,7 +344,7 @@ float trigger_push_send(entity this, entity to, float sf) { 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); @@ -442,7 +442,7 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew) 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(); diff --git a/qcsrc/common/triggers/trigger/multi.qc b/qcsrc/common/triggers/trigger/multi.qc index b9d3aeb96..08989688e 100644 --- a/qcsrc/common/triggers/trigger/multi.qc +++ b/qcsrc/common/triggers/trigger/multi.qc @@ -127,7 +127,7 @@ void multi_reset(entity this) } 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 @@ -164,7 +164,7 @@ spawnfunc(trigger_multiple) EXACTTRIGGER_INIT; - self.team_saved = self.team; + self.team_saved = TMID(self.team); if (self.health) { diff --git a/qcsrc/common/triggers/trigger/relay_teamcheck.qc b/qcsrc/common/triggers/trigger/relay_teamcheck.qc index 193dba368..91b487dfa 100644 --- a/qcsrc/common/triggers/trigger/relay_teamcheck.qc +++ b/qcsrc/common/triggers/trigger/relay_teamcheck.qc @@ -23,12 +23,12 @@ void trigger_relay_teamcheck_use() 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; } diff --git a/qcsrc/common/triggers/trigger/teleport.qc b/qcsrc/common/triggers/trigger/teleport.qc index be8040079..0860264dc 100644 --- a/qcsrc/common/triggers/trigger/teleport.qc +++ b/qcsrc/common/triggers/trigger/teleport.qc @@ -63,7 +63,7 @@ float trigger_teleport_send(entity this, entity to, float sf) { 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); @@ -106,7 +106,7 @@ spawnfunc(trigger_teleport) 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(); diff --git a/qcsrc/common/turrets/cl_turrets.qc b/qcsrc/common/turrets/cl_turrets.qc index 079d6b3f0..ae0e15b3c 100644 --- a/qcsrc/common/turrets/cl_turrets.qc +++ b/qcsrc/common/turrets/cl_turrets.qc @@ -8,11 +8,11 @@ void turret_remove(entity this) .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; @@ -71,7 +71,7 @@ void turret_draw2d(entity this) 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'); @@ -119,7 +119,7 @@ void turret_draw2d(entity this) 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) { @@ -424,9 +424,9 @@ NET_HANDLE(ENT_CLIENT_TURRET, bool isnew) { float _tmp; _tmp = ReadByte(); - if(_tmp != self.team) + if(_tmp != TMID(self.team)) { - self.team = _tmp; + self.__team = _tmp; turret_changeteam(); } diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index fec1e885f..c1b924048 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -349,7 +349,7 @@ bool turret_send(entity this, entity to, float sf) if(sf & TNSF_STATUS) { - WriteByte(MSG_ENTITY, self.team); + WriteByte(MSG_ENTITY, TMID(self.team)); if(self.health <= 0) WriteByte(MSG_ENTITY, 0); @@ -1184,7 +1184,7 @@ void turret_use() self.team = activator.team; - if(self.team == 0) + if(TMID(self.team) == 0) self.active = ACTIVE_NOT; else self.active = ACTIVE_ACTIVE; @@ -1271,7 +1271,7 @@ float turret_initialize(Turret tur) 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; } diff --git a/qcsrc/common/turrets/turret/plasma.qc b/qcsrc/common/turrets/turret/plasma.qc index 37bdd9329..92c923e32 100644 --- a/qcsrc/common/turrets/turret/plasma.qc +++ b/qcsrc/common/turrets/turret/plasma.qc @@ -37,7 +37,7 @@ METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this, entity it)) // 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 { diff --git a/qcsrc/common/turrets/turret/plasma_dual.qc b/qcsrc/common/turrets/turret/plasma_dual.qc index 183d4d965..e0ef0b33c 100644 --- a/qcsrc/common/turrets/turret/plasma_dual.qc +++ b/qcsrc/common/turrets/turret/plasma_dual.qc @@ -39,7 +39,7 @@ METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret this, entity it)) // 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); } diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 699c13f27..8ed633a4c 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -393,7 +393,7 @@ void vehicles_reset_colors() _effects |= EF_FULLBRIGHT; if(self.team) - _colormap = 1024 + (self.team - 1) * 17; + _colormap = 1024 + (TMID(self.team) - 1) * 17; else _colormap = 1024; @@ -507,14 +507,14 @@ void vehicles_showwp() } 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); @@ -556,7 +556,7 @@ void vehicle_use() 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; @@ -882,7 +882,7 @@ void vehicles_exit(bool eject) _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? @@ -1012,8 +1012,8 @@ void vehicles_enter(entity pl, entity veh) 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; @@ -1202,7 +1202,7 @@ bool vehicle_initialize(entity veh, bool nodrop) if(teamplay) { - if(self.vehicle_controller.team == 0) + if(TMID(self.vehicle_controller.team) == 0) self.active = ACTIVE_NOT; else self.active = ACTIVE_ACTIVE; @@ -1212,7 +1212,7 @@ bool vehicle_initialize(entity veh, bool nodrop) 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); diff --git a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc index db456825b..6894c5c7c 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc @@ -38,7 +38,7 @@ bool bumble_raygun_send(entity this, entity to, float sf) 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); } @@ -71,9 +71,9 @@ NET_HANDLE(ENT_CLIENT_BUMBLE_RAYGUN, bool isnew) 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'; diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 0760f79e3..50b231690 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -226,7 +226,7 @@ int W_Tuba_GetNote(entity pl, int hittype) // 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 diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 92c795421..a1e0c84eb 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -76,7 +76,7 @@ void SendCSQCVaporizerBeamParticle(entity player, int hit) { 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; @@ -148,11 +148,11 @@ NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew) 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); diff --git a/qcsrc/lib/_all.inc b/qcsrc/lib/_all.inc index 9aaf52449..b6375c067 100644 --- a/qcsrc/lib/_all.inc +++ b/qcsrc/lib/_all.inc @@ -25,6 +25,18 @@ #include #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" diff --git a/qcsrc/server/bot/aim.qc b/qcsrc/server/bot/aim.qc index 7202547fc..34797a56f 100644 --- a/qcsrc/server/bot/aim.qc +++ b/qcsrc/server/bot/aim.qc @@ -116,7 +116,7 @@ float bot_shouldattack(entity e) if (e == self) return false; if (teamplay) - if (e.team != 0) + if (TMID(e.team) != 0) return false; } @@ -125,7 +125,7 @@ float bot_shouldattack(entity e) if(teamplay) { - if(e.team==0) + if(TMID(e.team)==0) return false; } else if(bot_ignore_bots) diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc index 37079a33c..aba8ece03 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/bot.qc @@ -414,13 +414,13 @@ void bot_clientconnect(entity this) 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); @@ -441,13 +441,13 @@ void bot_removefromlargestteam() 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; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index d41cf563a..eeca8337d 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -215,7 +215,7 @@ void PutObserverInServer() 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 } @@ -314,7 +314,7 @@ void FixPlayermodel(entity player) { 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)); @@ -419,7 +419,7 @@ void PutClientInServer() PlayerState_attach(this); accuracy_resend(this); - if (this.team < 0) + if (TMID(this.team) < 0) JoinBestTeam(this, false, true); entity spot = SelectSpawnPoint(false); @@ -1047,13 +1047,13 @@ void ClientConnect() 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? @@ -1752,7 +1752,7 @@ void LeaveSpectatorMode() 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"); diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 979e6d860..849b40869 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -654,7 +654,7 @@ void MoveToTeam(entity client, int team_colour, int type) 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); } /** @@ -681,7 +681,7 @@ int Say(entity source, float teamsay, entity privatesay, string msgin, bool floo 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 = ""; diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 23c57ea6e..679b86030 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -181,7 +181,7 @@ void ClientCommand_join(float request) 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 @@ -373,7 +373,7 @@ void ClientCommand_selectteam(float request, float argc) 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"); } @@ -387,7 +387,7 @@ void ClientCommand_selectteam(float request, float argc) { 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; diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 2f1400245..7fc3068f9 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1052,10 +1052,10 @@ void GameCommand_moveplayer(float request, float argc) // 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 @@ -1387,7 +1387,7 @@ void GameCommand_shuffleteams(float request) 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; diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 4cf5b7dc5..8f8d1d89c 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -341,15 +341,15 @@ void reset_map(bool dorespawn) 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( diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 9570f359c..85c24b892 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -302,7 +302,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) { 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 { @@ -345,7 +345,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) 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... @@ -535,7 +535,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo 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; @@ -548,7 +548,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo // 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) diff --git a/qcsrc/server/g_models.qc b/qcsrc/server/g_models.qc index 6612b837c..6848e4b08 100644 --- a/qcsrc/server/g_models.qc +++ b/qcsrc/server/g_models.qc @@ -21,7 +21,7 @@ void g_model_setcolormaptoactivator () if(teamplay) { if(activator.team) - self.colormap = (activator.team - 1) * 0x11; + self.colormap = (TMID(activator.team) - 1) * 0x11; else self.colormap = 0x00; } diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 6398cbe93..c0151b9d7 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1411,11 +1411,11 @@ void DumpStats(float final) 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:"); @@ -1425,7 +1425,7 @@ void DumpStats(float final) GameLogEcho(strcat(s, ftos(it.playerid), ":", it.netname)); if(to_file) fputs(file, strcat(s, it.netname, "\n")); - )); + }); if(teamplay) { @@ -1680,7 +1680,7 @@ float WinningCondition_Scores(float limit, float leadlimit) if(WinningConditionHelper_winner) WinningConditionHelper_winner.winning = 1; if(WinningConditionHelper_winnerteam >= 0) - SetWinners(team, WinningConditionHelper_winnerteam); + SetWinners(__team, WinningConditionHelper_winnerteam); if(WinningConditionHelper_lowerisbetter) { @@ -1745,25 +1745,25 @@ float WinningCondition_RanOutOfSpawns() 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) @@ -1791,7 +1791,7 @@ float WinningCondition_RanOutOfSpawns() 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 diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index c59e8a4bf..72e0d48d8 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -455,7 +455,7 @@ string playername(entity p) 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 diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index 4a6829a74..9629f0e50 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -38,7 +38,7 @@ void write_recordmarker(entity pl, float tstart, float dt); 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); diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qc b/qcsrc/server/mutators/mutator/gamemode_assault.qc index e9c31f326..466450f92 100644 --- a/qcsrc/server/mutators/mutator/gamemode_assault.qc +++ b/qcsrc/server/mutators/mutator/gamemode_assault.qc @@ -104,7 +104,7 @@ void assault_objective_reset(entity this) // 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; @@ -231,16 +231,16 @@ void assault_roundstart_use() 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() @@ -307,11 +307,11 @@ int WinningCondition_Assault() // 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; @@ -321,7 +321,7 @@ int WinningCondition_Assault() 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)); @@ -344,7 +344,7 @@ spawnfunc(info_player_attacker) { 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); } @@ -352,7 +352,7 @@ spawnfunc(info_player_defender) { 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); } @@ -394,9 +394,9 @@ spawnfunc(func_assault_destructible) 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); } @@ -613,7 +613,7 @@ void havocbot_ast_reset_role(entity bot) 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); @@ -622,7 +622,7 @@ void havocbot_ast_reset_role(entity bot) // 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); @@ -632,8 +632,8 @@ MUTATOR_HOOKFUNCTION(as, PlayerSpawn) 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; } diff --git a/qcsrc/server/mutators/mutator/gamemode_ca.qc b/qcsrc/server/mutators/mutator/gamemode_ca.qc index c90f7d178..be7d52fa6 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ca.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ca.qc @@ -73,21 +73,21 @@ bool autocvar_g_ca_spectate_enemies; 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() @@ -246,7 +246,7 @@ MUTATOR_HOOKFUNCTION(ca, reset_map_players) it.killcount = 0; if (!it.caplayer && IS_BOT_CLIENT(it)) { - it.team = -1; + it.__team = -1; it.caplayer = 1; } if (it.caplayer) diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 8cdad3255..7178ffee2 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -154,7 +154,7 @@ void ctf_CaptureRecord(entity flag, entity player) 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)); @@ -339,7 +339,7 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype) // 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); @@ -347,8 +347,8 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype) // 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)) @@ -395,7 +395,7 @@ void ctf_Handle_Retrieve(entity flag, entity player) // 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) @@ -462,7 +462,7 @@ void ctf_Handle_Throw(entity player, entity receiver, int droptype) // 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; } @@ -543,8 +543,8 @@ void ctf_Handle_Capture(entity flag, entity toucher, int capturetype) 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; } @@ -589,7 +589,7 @@ void ctf_Handle_Return(entity flag, entity player) 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)) @@ -600,7 +600,7 @@ void ctf_Handle_Return(entity flag, entity 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) { @@ -656,21 +656,21 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype) 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); @@ -682,7 +682,7 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype) 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; } @@ -692,7 +692,7 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype) 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; } @@ -741,7 +741,7 @@ void ctf_CheckFlagReturn(entity flag, int returntype) { 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); } } @@ -780,7 +780,7 @@ void ctf_CheckStalemate() 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; @@ -813,7 +813,7 @@ void ctf_CheckStalemate() 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; } } @@ -1167,7 +1167,7 @@ void ctf_DelayedFlagSetup() // called after a flag is placed on a map by ctf_Fla // 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; @@ -1177,8 +1177,8 @@ void ctf_DelayedFlagSetup() // called after a flag is placed on a map by ctf_Fla } 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); @@ -1198,7 +1198,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e 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; @@ -1995,11 +1995,11 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerPreThink) // 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) { @@ -2219,7 +2219,7 @@ MUTATOR_HOOKFUNCTION(ctf, HelpMePing) } 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); } @@ -2374,15 +2374,15 @@ MUTATOR_HOOKFUNCTION(ctf, SV_ParseClientCommand) } } - 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); @@ -2507,7 +2507,7 @@ spawnfunc(ctf_team) if(!g_ctf) { remove(self); return; } self.classname = "ctf_team"; - self.team = self.cnt + 1; + self.__team = self.cnt + 1; } // compatibility for quake maps @@ -2560,9 +2560,9 @@ void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to 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); diff --git a/qcsrc/server/mutators/mutator/gamemode_domination.qc b/qcsrc/server/mutators/mutator/gamemode_domination.qc index 56111a34d..4313a472f 100644 --- a/qcsrc/server/mutators/mutator/gamemode_domination.qc +++ b/qcsrc/server/mutators/mutator/gamemode_domination.qc @@ -107,7 +107,7 @@ void dompoint_captured () 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; @@ -147,16 +147,16 @@ void dompoint_captured () // 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; @@ -168,7 +168,7 @@ void dompoint_captured () 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 @@ -177,7 +177,7 @@ void dompoint_captured () 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; @@ -185,9 +185,9 @@ void dompoint_captured () 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; @@ -238,8 +238,8 @@ void dompointthink() 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) @@ -277,7 +277,7 @@ void dompointtouch() 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; @@ -372,10 +372,10 @@ void Domination_count_controlpoints() 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); } } @@ -479,7 +479,7 @@ MUTATOR_HOOKFUNCTION(dom, GetTeamCount) { if(head.netname != "") { - switch(head.team) + switch(TMID(head.team)) { case NUM_TEAM_1: c1 = 0; break; case NUM_TEAM_2: c2 = 0; break; @@ -600,7 +600,7 @@ spawnfunc(dom_team) 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 @@ -649,7 +649,7 @@ void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float p 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); diff --git a/qcsrc/server/mutators/mutator/gamemode_freezetag.qc b/qcsrc/server/mutators/mutator/gamemode_freezetag.qc index a451cf88a..967c7cadb 100644 --- a/qcsrc/server/mutators/mutator/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/mutator/gamemode_freezetag.qc @@ -72,15 +72,15 @@ void freezetag_ScoreRules(float teams) 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; diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index 7b2972c84..29cfbd947 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -152,7 +152,7 @@ void invasion_SpawnChosenMonster(float mon) 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 { @@ -162,7 +162,7 @@ void invasion_SpawnChosenMonster(float mon) 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) @@ -171,9 +171,9 @@ void invasion_SpawnChosenMonster(float mon) 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; } } @@ -205,7 +205,7 @@ float Invasion_CheckWinner() 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) @@ -213,7 +213,7 @@ float Invasion_CheckWinner() ++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; @@ -221,7 +221,7 @@ float Invasion_CheckWinner() case NUM_TEAM_4: ++pink_alive; break; } } - )); + }); if((total_alive_monsters + inv_numkilled) < inv_maxspawned && inv_maxcurrent < inv_maxspawned) { @@ -335,7 +335,7 @@ MUTATOR_HOOKFUNCTION(inv, MonsterDies) { 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 @@ -344,7 +344,7 @@ MUTATOR_HOOKFUNCTION(inv, MonsterDies) { 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); } } diff --git a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc index 28270b885..c536048f2 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc @@ -106,7 +106,7 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated 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) @@ -216,7 +216,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los // 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); diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index 8e0bcd8ee..bc59c89be 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -187,7 +187,7 @@ void kh_update_state() FOR_EACH_KH_KEY(key) { if(key.owner) - f = key.team; + f = TMID(key.team); else f = 30; s |= pow(32, key.count) * f; @@ -414,16 +414,16 @@ void kh_Key_AssignTo(entity key, entity player) // runs every time a key is pic { // 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); @@ -441,7 +441,7 @@ void kh_Key_AssignTo(entity key, entity player) // runs every time a key is pic 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) @@ -494,7 +494,7 @@ void kh_Key_Collect(entity key, entity player) //a player picks up a dropped ke { 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); @@ -650,7 +650,7 @@ void kh_LoserTeam(float teem, entity lostkey) // runs when a player pushes a fl attacker = world; if(lostkey.pusher) - if(lostkey.pusher.team != teem) + if(TMID(lostkey.pusher.team) != teem) if(IS_PLAYER(lostkey.pusher)) attacker = lostkey.pusher; @@ -670,10 +670,10 @@ void kh_LoserTeam(float teem, entity lostkey) // runs when a player pushes a fl 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) @@ -686,7 +686,7 @@ void kh_LoserTeam(float teem, entity lostkey) // runs when a player pushes a fl 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); @@ -703,16 +703,16 @@ void kh_LoserTeam(float teem, entity lostkey) // runs when a player pushes a fl 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; } @@ -742,7 +742,7 @@ void kh_Key_Think() // runs all the time // 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) @@ -759,22 +759,22 @@ void kh_Key_Think() // runs all the time 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; @@ -805,10 +805,10 @@ void kh_Key_Spawn(entity initial_owner, float _angle, float i) // runs every ti 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"; @@ -831,9 +831,9 @@ void kh_Key_Spawn(entity initial_owner, float _angle, float i) // runs every ti 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); @@ -853,8 +853,8 @@ float kh_Key_AllOwnedByWhichTeam() // constantly called. check to see if all th 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; } @@ -881,7 +881,7 @@ void kh_Key_DropOne(entity key) 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); } @@ -907,7 +907,7 @@ void kh_Key_DropAll(entity player, float suicide) // runs whenever a player dies 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); } @@ -919,10 +919,10 @@ float kh_CheckPlayers(float num) { 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; } } @@ -1005,14 +1005,14 @@ void kh_StartRound() // runs at the start of each round 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); } @@ -1144,7 +1144,7 @@ void havocbot_role_kh_carrier() 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 @@ -1183,7 +1183,7 @@ void havocbot_role_kh_defense() 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 @@ -1225,7 +1225,7 @@ void havocbot_role_kh_offense() 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 @@ -1275,7 +1275,7 @@ void havocbot_role_kh_freelancer() 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 diff --git a/qcsrc/server/mutators/mutator/gamemode_tdm.qc b/qcsrc/server/mutators/mutator/gamemode_tdm.qc index 3167d603b..7f2075ca9 100644 --- a/qcsrc/server/mutators/mutator/gamemode_tdm.qc +++ b/qcsrc/server/mutators/mutator/gamemode_tdm.qc @@ -54,7 +54,7 @@ spawnfunc(tdm_team) 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 diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index b7c994598..abc88f4c6 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -59,7 +59,7 @@ bool TeamScore_SendEntity(entity this, entity to, float sendflags) 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); @@ -91,7 +91,7 @@ void TeamScore_Spawn(float t, string name) { 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; @@ -127,7 +127,7 @@ float TeamScore_AddToTeam(float t, float scorefield, float score) 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) @@ -144,7 +144,7 @@ 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; } @@ -682,8 +682,8 @@ float PlayerTeamScore_Compare(entity p1, entity p2, float teams, float strict) { 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; } @@ -891,10 +891,10 @@ void Score_NicePrint(entity to) 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; } diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 0692d9088..05c6ae7de 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -14,7 +14,7 @@ bool SpawnPoint_Send(entity this, entity to, int sf) { 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); @@ -104,14 +104,14 @@ void relocate_spawnpoint() 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) { @@ -130,20 +130,20 @@ void relocate_spawnpoint() !( ( // 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) ) ) ) @@ -174,7 +174,7 @@ Starting point for a player in team one (Red). 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); } @@ -184,7 +184,7 @@ Starting point for a player in team two (Blue). 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); } @@ -193,7 +193,7 @@ Starting point for a player in team three (Yellow). 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); } @@ -203,7 +203,7 @@ Starting point for a player in team four (Purple). 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); } @@ -219,7 +219,7 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck) // 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) @@ -345,7 +345,7 @@ entity SelectSpawnPoint (float anypoint) 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? @@ -357,7 +357,7 @@ entity SelectSpawnPoint (float anypoint) 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 diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 34ee3277a..d2f58d3b8 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -215,7 +215,7 @@ void SetPlayerTeam(entity pl, float t, float s, float noprint) 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"); @@ -253,7 +253,7 @@ void CheckAllowedTeams (entity for_whom) 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; @@ -314,10 +314,10 @@ void GetTeamCounts(entity ignore) // 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 @@ -362,7 +362,7 @@ void GetTeamCounts(entity ignore) } } } - )); + }); // if the player who has a forced team has not joined yet, reserve the spot if(autocvar_g_campaign) @@ -514,14 +514,14 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam) // 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; @@ -533,7 +533,7 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam) // 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; } @@ -566,7 +566,7 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam) 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'); @@ -716,7 +716,7 @@ void ShufflePlayerOutOfTeam (float source_team) 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) @@ -733,7 +733,7 @@ void ShufflePlayerOutOfTeam (float source_team) lowest_player_score = it.totalfrags; } } - )); + }); // prefers to move a bot... if(lowest_bot != world) diff --git a/qcsrc/server/weapons/csqcprojectile.qc b/qcsrc/server/weapons/csqcprojectile.qc index f3e9f22ef..39c204f9d 100644 --- a/qcsrc/server/weapons/csqcprojectile.qc +++ b/qcsrc/server/weapons/csqcprojectile.qc @@ -58,7 +58,7 @@ bool CSQCProjectile_SendEntity(entity this, entity to, int sf) WriteByte(MSG_ENTITY, fr); } - WriteByte(MSG_ENTITY, self.realowner.team); + WriteByte(MSG_ENTITY, TMID(self.realowner.team)); } if(sf & 2) diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index 579e6fdff..f84734bd4 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -46,7 +46,7 @@ void weapon_defaultspawnfunc(entity this, Weapon e) int t = tokenize_console(s); if (t >= 2) { - this.team = --internalteam; + this.__team = --internalteam; for (int i = 1; i < t; ++i) { s = argv(i);