From d5fdcf33ed6bf561a90134526bc2d4c1814d35a8 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 26 Sep 2015 21:59:35 +1000 Subject: [PATCH] Remove uses of Static_Team_ColorName --- qcsrc/client/weapons/projectile.qc | 5 +- qcsrc/common/effects/effects.inc | 102 ++++++++++++++++++-- qcsrc/common/nades.qh | 4 +- qcsrc/common/sounds/sounds.inc | 56 +++++------ qcsrc/common/sounds/sounds.qh | 2 + qcsrc/common/turrets/unit/plasma.qc | 9 +- qcsrc/common/turrets/unit/plasma_dual.qc | 9 +- qcsrc/server/cl_client.qc | 5 +- qcsrc/server/mutators/gamemode_ctf.qc | 10 +- qcsrc/server/mutators/gamemode_onslaught.qc | 6 +- 10 files changed, 140 insertions(+), 68 deletions(-) diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index a943f75b3..07228885d 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -270,9 +270,6 @@ void Ent_Projectile() if(f & 2) { - string rm_suffix = strcat("rocketminsta_laser_", Static_Team_ColorName_Lower(self.team)); - if(_particleeffectnum(rm_suffix) < 0 || Team_TeamToNumber(self.team) == -1) { rm_suffix = "TR_NEXUIZPLASMA"; } - self.cnt = ReadByte(); self.silent = (self.cnt & 0x80); @@ -320,7 +317,7 @@ void Ent_Projectile() CASE(RPC) self.traileffect = particleeffectnum(EFFECT_TR_ROCKET); break; - CASE(ROCKETMINSTA_LASER) self.traileffect = _particleeffectnum(rm_suffix); break; + CASE(ROCKETMINSTA_LASER) self.traileffect = particleeffectnum(EFFECT_ROCKETMINSTA_LASER(self.team)); break; #undef CASE default: if(MUTATOR_CALLHOOK(Ent_Projectile, self)) diff --git a/qcsrc/common/effects/effects.inc b/qcsrc/common/effects/effects.inc index cbd3a44ab..663d090a8 100644 --- a/qcsrc/common/effects/effects.inc +++ b/qcsrc/common/effects/effects.inc @@ -55,6 +55,16 @@ EFFECT(1, VAPORIZER_PINK, "TE_TEI_G3PINK") EFFECT(1, VAPORIZER_PINK_HIT, "TE_TEI_G3PINK_HIT") EFFECT(1, VAPORIZER_NEUTRAL, "TE_TEI_G3") EFFECT(1, VAPORIZER_NEUTRAL_HIT, "TE_TEI_G3_HIT") +entity EFFECT_VAPORIZER(int teamid) +{ + switch (teamid) { + case NUM_TEAM_1: return EFFECT_VAPORIZER_RED; + case NUM_TEAM_2: return EFFECT_VAPORIZER_BLUE; + case NUM_TEAM_3: return EFFECT_VAPORIZER_YELLOW; + case NUM_TEAM_4: return EFFECT_VAPORIZER_PINK; + default: return EFFECT_VAPORIZER_NEUTRAL; + } +} EFFECT(0, RIFLE_IMPACT, "machinegun_impact") EFFECT(0, RIFLE_MUZZLEFLASH, "rifle_muzzleflash") @@ -130,6 +140,38 @@ EFFECT(0, NADE_YELLOW_EXPLODE, "nade_yellow_explode") EFFECT(0, NADE_PINK_EXPLODE, "nade_pink_explode") EFFECT(0, NADE_NEUTRAL_EXPLODE, "nade_neutral_explode") +EFFECT(1, NADE_TRAIL_RED, "nade_red") +EFFECT(1, NADE_TRAIL_BLUE, "nade_blue") +EFFECT(1, NADE_TRAIL_YELLOW, "nade_yellow") +EFFECT(1, NADE_TRAIL_PINK, "nade_pink") +EFFECT(1, NADE_TRAIL_NEUTRAL, "nade_neutral") +entity EFFECT_NADE_TRAIL(int teamid) +{ + switch (teamid) { + case NUM_TEAM_1: return EFFECT_NADE_TRAIL_RED; + case NUM_TEAM_2: return EFFECT_NADE_TRAIL_BLUE; + case NUM_TEAM_3: return EFFECT_NADE_TRAIL_YELLOW; + case NUM_TEAM_4: return EFFECT_NADE_TRAIL_PINK; + default: return EFFECT_NADE_TRAIL_NEUTRAL; + } +} + +EFFECT(1, NADE_TRAIL_BURN_RED, "nade_red_burn") +EFFECT(1, NADE_TRAIL_BURN_BLUE, "nade_blue_burn") +EFFECT(1, NADE_TRAIL_BURN_YELLOW, "nade_yellow_burn") +EFFECT(1, NADE_TRAIL_BURN_PINK, "nade_pink_burn") +EFFECT(1, NADE_TRAIL_BURN_NEUTRAL, "nade_neutral_burn") +entity EFFECT_NADE_TRAIL_BURN(int teamid) +{ + switch (teamid) { + case NUM_TEAM_1: return EFFECT_NADE_TRAIL_BURN_RED; + case NUM_TEAM_2: return EFFECT_NADE_TRAIL_BURN_BLUE; + case NUM_TEAM_3: return EFFECT_NADE_TRAIL_BURN_YELLOW; + case NUM_TEAM_4: return EFFECT_NADE_TRAIL_BURN_PINK; + default: return EFFECT_NADE_TRAIL_BURN_NEUTRAL; + } +} + EFFECT(0, ICEORGLASS, "iceorglass") EFFECT(0, ICEFIELD, "icefield") EFFECT(0, FIREFIELD, "firefield") @@ -137,20 +179,43 @@ EFFECT(0, HEALING, "healing_fx") EFFECT(1, LASER_BEAM_FAST, "nex242_misc_laser_beam_fast") EFFECT(0, RESPAWN_GHOST, "respawn_ghost") -EFFECT(0, FLAG_RED_TOUCH, "redflag_touch") -EFFECT(0, FLAG_BLUE_TOUCH, "blueflag_touch") -EFFECT(0, FLAG_YELLOW_TOUCH, "yellowflag_touch") -EFFECT(0, FLAG_PINK_TOUCH, "pinkflag_touch") -EFFECT(0, FLAG_NEUTRAL_TOUCH, "neutralflag_touch") +EFFECT(0, FLAG_TOUCH_RED, "redflag_touch") +EFFECT(0, FLAG_TOUCH_BLUE, "blueflag_touch") +EFFECT(0, FLAG_TOUCH_YELLOW, "yellowflag_touch") +EFFECT(0, FLAG_TOUCH_PINK, "pinkflag_touch") +EFFECT(0, FLAG_TOUCH_NEUTRAL, "neutralflag_touch") +entity EFFECT_FLAG_TOUCH(int teamid) +{ + switch (teamid) { + case NUM_TEAM_1: return EFFECT_FLAG_TOUCH_RED; + case NUM_TEAM_2: return EFFECT_FLAG_TOUCH_BLUE; + case NUM_TEAM_3: return EFFECT_FLAG_TOUCH_YELLOW; + case NUM_TEAM_4: return EFFECT_FLAG_TOUCH_PINK; + default: return EFFECT_FLAG_TOUCH_NEUTRAL; + } +} + EFFECT(1, RED_PASS, "red_pass") EFFECT(1, BLUE_PASS, "blue_pass") EFFECT(1, YELLOW_PASS, "yellow_pass") EFFECT(1, PINK_PASS, "pink_pass") EFFECT(1, NEUTRAL_PASS, "neutral_pass") -EFFECT(0, RED_CAP, "red_cap") -EFFECT(0, BLUE_CAP, "blue_cap") -EFFECT(0, YELLOW_CAP, "yellow_cap") -EFFECT(0, PINK_CAP, "pink_cap") + +EFFECT(0, CAP_RED, "red_cap") +EFFECT(0, CAP_BLUE, "blue_cap") +EFFECT(0, CAP_YELLOW, "yellow_cap") +EFFECT(0, CAP_PINK, "pink_cap") +EFFECT(0, CAP_NEUTRAL, "neutral_cap") +entity EFFECT_CAP(int teamid) +{ + switch (teamid) { + case NUM_TEAM_1: return EFFECT_CAP_RED; + case NUM_TEAM_2: return EFFECT_CAP_BLUE; + case NUM_TEAM_3: return EFFECT_CAP_YELLOW; + case NUM_TEAM_4: return EFFECT_CAP_PINK; + default: return EFFECT_CAP_NEUTRAL; + } +} EFFECT(0, ITEM_PICKUP, "item_pickup") EFFECT(0, ITEM_RESPAWN, "item_respawn") @@ -187,3 +252,22 @@ EFFECT(1, TR_SLIGHTBLOOD, "TR_SLIGHTBLOOD") EFFECT(1, TR_KNIGHTSPIKE, "TR_KNIGHTSPIKE") EFFECT(1, TR_VORESPIKE, "TR_VORESPIKE") EFFECT(0, TE_SPARK, "TE_SPARK") + +EFFECT(1, ROCKETMINSTA_LASER_RED, "rocketminsta_laser_red") +EFFECT(1, ROCKETMINSTA_LASER_BLUE, "rocketminsta_laser_blue") +EFFECT(1, ROCKETMINSTA_LASER_YELLOW, "rocketminsta_laser_yellow") +EFFECT(1, ROCKETMINSTA_LASER_PINK, "rocketminsta_laser_pink") +EFFECT(1, ROCKETMINSTA_LASER_NEUTRAL, "rocketminsta_laser_neutral") +entity EFFECT_ROCKETMINSTA_LASER(int teamid) +{ + entity e; + switch (teamid) { + case NUM_TEAM_1: e = EFFECT_ROCKETMINSTA_LASER_RED; break; + case NUM_TEAM_2: e = EFFECT_ROCKETMINSTA_LASER_BLUE; break; + case NUM_TEAM_3: e = EFFECT_ROCKETMINSTA_LASER_YELLOW; break; + case NUM_TEAM_4: e = EFFECT_ROCKETMINSTA_LASER_PINK; break; + default: e = EFFECT_ROCKETMINSTA_LASER_NEUTRAL; break; + } + if (particleeffectnum(e) < 0 || Team_TeamToNumber(teamid) == -1) { e = EFFECT_TR_NEXUIZPLASMA; } + return e; +} diff --git a/qcsrc/common/nades.qh b/qcsrc/common/nades.qh index 9ec6c2914..ba189c9bf 100644 --- a/qcsrc/common/nades.qh +++ b/qcsrc/common/nades.qh @@ -127,8 +127,8 @@ string Nade_TrailEffect(float proj, float nade_team) )); switch (proj) { - case PROJECTILE_NADE: return strcat("nade_", Static_Team_ColorName_Lower(nade_team)); - case PROJECTILE_NADE_BURN: return strcat("nade_", Static_Team_ColorName_Lower(nade_team), "_burn"); + case PROJECTILE_NADE: return EFFECT_NADE_TRAIL(nade_team).eent_eff_name; + case PROJECTILE_NADE_BURN: return EFFECT_NADE_TRAIL_BURN(nade_team).eent_eff_name; } return ""; } diff --git a/qcsrc/common/sounds/sounds.inc b/qcsrc/common/sounds/sounds.inc index 0e17504c2..7993450ab 100644 --- a/qcsrc/common/sounds/sounds.inc +++ b/qcsrc/common/sounds/sounds.inc @@ -110,14 +110,14 @@ SOUND(CTF_CAPTURE_RED, "ctf/red_capture.wav"); SOUND(CTF_CAPTURE_BLUE, "ctf/blue_capture.wav"); SOUND(CTF_CAPTURE_YELLOW, "ctf/yellow_capture.ogg"); SOUND(CTF_CAPTURE_PINK, "ctf/pink_capture.ogg"); -Sound SND_CTF_CAPTURE(string teamname) { - switch (teamname) { - case "red": return SND_CTF_CAPTURE_RED; - case "blue": return SND_CTF_CAPTURE_BLUE; - case "yellow": return SND_CTF_CAPTURE_YELLOW; - case "pink": return SND_CTF_CAPTURE_PINK; +Sound SND_CTF_CAPTURE(int teamid) { + switch (teamid) { + case NUM_TEAM_1: return SND_CTF_CAPTURE_RED; + case NUM_TEAM_2: return SND_CTF_CAPTURE_BLUE; + case NUM_TEAM_3: return SND_CTF_CAPTURE_YELLOW; + case NUM_TEAM_4: return SND_CTF_CAPTURE_PINK; + default: return SND_CTF_CAPTURE_NEUTRAL; } - return SND_CTF_CAPTURE_NEUTRAL; } SOUND(CTF_DROPPED_NEUTRAL, "ctf/neutral_dropped.wav"); @@ -125,13 +125,13 @@ SOUND(CTF_DROPPED_RED, "ctf/red_dropped.wav"); SOUND(CTF_DROPPED_BLUE, "ctf/blue_dropped.wav"); SOUND(CTF_DROPPED_YELLOW, "ctf/yellow_dropped.wav"); SOUND(CTF_DROPPED_PINK, "ctf/pink_dropped.wav"); -Sound SND_CTF_DROPPED(string teamname) { - switch (teamname) { - case "red": return SND_CTF_DROPPED_RED; - case "blue": return SND_CTF_DROPPED_BLUE; - case "yellow": return SND_CTF_DROPPED_YELLOW; - case "pink": return SND_CTF_DROPPED_PINK; - default: return SND_CTF_DROPPED_NEUTRAL; +Sound SND_CTF_DROPPED(int teamid) { + switch (teamid) { + case NUM_TEAM_1: return SND_CTF_DROPPED_RED; + case NUM_TEAM_2: return SND_CTF_DROPPED_BLUE; + case NUM_TEAM_3: return SND_CTF_DROPPED_YELLOW; + case NUM_TEAM_4: return SND_CTF_DROPPED_PINK; + default: return SND_CTF_DROPPED_NEUTRAL; } } @@ -143,13 +143,13 @@ SOUND(CTF_RETURNED_RED, "ctf/red_returned.wav"); SOUND(CTF_RETURNED_BLUE, "ctf/blue_returned.wav"); SOUND(CTF_RETURNED_YELLOW, "ctf/yellow_returned.wav"); SOUND(CTF_RETURNED_PINK, "ctf/pink_returned.wav"); -Sound SND_CTF_RETURNED(string teamname) { - switch (teamname) { - case "red": return SND_CTF_RETURNED_RED; - case "blue": return SND_CTF_RETURNED_BLUE; - case "yellow": return SND_CTF_RETURNED_YELLOW; - case "pink": return SND_CTF_RETURNED_PINK; - default: return SND_CTF_RETURNED_NEUTRAL; +Sound SND_CTF_RETURNED(int teamid) { + switch (teamid) { + case NUM_TEAM_1: return SND_CTF_RETURNED_RED; + case NUM_TEAM_2: return SND_CTF_RETURNED_BLUE; + case NUM_TEAM_3: return SND_CTF_RETURNED_YELLOW; + case NUM_TEAM_4: return SND_CTF_RETURNED_PINK; + default: return SND_CTF_RETURNED_NEUTRAL; } } @@ -158,13 +158,13 @@ SOUND(CTF_TAKEN_RED, "ctf/red_taken.wav"); SOUND(CTF_TAKEN_BLUE, "ctf/blue_taken.wav"); SOUND(CTF_TAKEN_YELLOW, "ctf/yellow_taken.wav"); SOUND(CTF_TAKEN_PINK, "ctf/pink_taken.wav"); -Sound SND_CTF_TAKEN(string teamname) { - switch (teamname) { - case "red": return SND_CTF_TAKEN_RED; - case "blue": return SND_CTF_TAKEN_BLUE; - case "yellow": return SND_CTF_TAKEN_YELLOW; - case "pink": return SND_CTF_TAKEN_PINK; - default: return SND_CTF_TAKEN_NEUTRAL; +Sound SND_CTF_TAKEN(int teamid) { + switch (teamid) { + case NUM_TEAM_1: return SND_CTF_TAKEN_RED; + case NUM_TEAM_2: return SND_CTF_TAKEN_BLUE; + case NUM_TEAM_3: return SND_CTF_TAKEN_YELLOW; + case NUM_TEAM_4: return SND_CTF_TAKEN_PINK; + default: return SND_CTF_TAKEN_NEUTRAL; } } diff --git a/qcsrc/common/sounds/sounds.qh b/qcsrc/common/sounds/sounds.qh index e01a1300d..c9838b2f6 100644 --- a/qcsrc/common/sounds/sounds.qh +++ b/qcsrc/common/sounds/sounds.qh @@ -1,6 +1,8 @@ #ifndef SOUNDS_H #define SOUNDS_H +#include "../teams.qh" + // Play all sounds via sound7, for access to the extra channels. // Otherwise, channels 8 to 15 would be blocked for a weird QW feature. #ifdef SVQC diff --git a/qcsrc/common/turrets/unit/plasma.qc b/qcsrc/common/turrets/unit/plasma.qc index 38a7eeacb..ed8cf6d19 100644 --- a/qcsrc/common/turrets/unit/plasma.qc +++ b/qcsrc/common/turrets/unit/plasma.qc @@ -30,13 +30,8 @@ float t_plasma(float req) Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1); // teamcolor / hit beam effect - vector v; - string s; - v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); - s = strcat("TE_TEI_G3", ((self.team) ? Static_Team_ColorName_Upper(self.team) : "")); - - WarpZone_TrailParticles(world, _particleeffectnum(s), self.tur_shotorg, v); - + vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); + WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(self.team)), self.tur_shotorg, v); if (self.tur_head.frame == 0) self.tur_head.frame = 1; } diff --git a/qcsrc/common/turrets/unit/plasma_dual.qc b/qcsrc/common/turrets/unit/plasma_dual.qc index 3bf87db22..fed077ba2 100644 --- a/qcsrc/common/turrets/unit/plasma_dual.qc +++ b/qcsrc/common/turrets/unit/plasma_dual.qc @@ -31,13 +31,8 @@ float t_plasma_dual(float req) Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1); // teamcolor / hit beam effect - vector v; - string s; - v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); - s = strcat(EFFECT_VAPORIZER_NEUTRAL.eent_eff_name, ((self.team) ? Static_Team_ColorName_Upper(self.team) : "")); - - WarpZone_TrailParticles(world, _particleeffectnum(s), self.tur_shotorg, v); - + vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); + WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(self.team)), self.tur_shotorg, v); self.tur_head.frame += 1; } else diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index c46da27f7..b31d4d556 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -329,9 +329,8 @@ void FixPlayermodel() { if(teamplay) { - string s; - s = Static_Team_ColorName_Lower(self.team); - if(s != "neutral") + string s = Static_Team_ColorName_Lower(self.team); + if (s != "neutral") { defaultmodel = cvar_string(strcat("sv_defaultplayermodel_", s)); defaultskin = cvar(strcat("sv_defaultplayerskin_", s)); diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 988534e2b..c0dd9b84e 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -1091,7 +1091,6 @@ void set_flag_string(entity flag, .string field, string value, string teamname) void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc {SELFPARAM(); // declarations - string teamname = Static_Team_ColorName_Lower(teamnumber); setself(flag); // for later usage with droptofloor() // main setup @@ -1124,6 +1123,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e flag.nextthink = time + FLAG_THINKRATE; flag.ctf_status = FLAG_BASE; + string teamname = Static_Team_ColorName_Lower(teamnumber); // appearence if(!flag.scale) { flag.scale = FLAG_SCALE; } if(flag.skin == 0) { flag.skin = cvar(sprintf("g_ctf_flag_%s_skin", teamname)); } @@ -1133,10 +1133,10 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e set_flag_string(flag, capeffect, "%s_cap", teamname); // sounds - flag.snd_flag_taken = SND(CTF_TAKEN(teamname)); - flag.snd_flag_returned = SND(CTF_RETURNED(teamname)); - flag.snd_flag_capture = SND(CTF_CAPTURE(teamname)); - flag.snd_flag_dropped = SND(CTF_DROPPED(teamname)); + flag.snd_flag_taken = SND(CTF_TAKEN(teamnumber)); + flag.snd_flag_returned = SND(CTF_RETURNED(teamnumber)); + flag.snd_flag_capture = SND(CTF_CAPTURE(teamnumber)); + flag.snd_flag_dropped = SND(CTF_DROPPED(teamnumber)); if (flag.snd_flag_respawn == "") flag.snd_flag_respawn = SND(CTF_RESPAWN); // if there is ever a team-based sound for this, update the code to match. precache_sound(flag.snd_flag_respawn); if (flag.snd_flag_touch == "") flag.snd_flag_touch = SND(CTF_TOUCH); // again has no team-based sound diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index 3fccbe34c..32dcaf556 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -520,7 +520,7 @@ void ons_ControlPoint_Icon_BuildThink() self.owner.iscaptured = true; self.solid = SOLID_BBOX; - Send_Effect_(sprintf("%s_cap", Static_Team_ColorName_Lower(self.owner.team)), self.owner.origin, '0 0 0', 1); + Send_Effect(EFFECT_CAP(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); @@ -578,7 +578,7 @@ void ons_ControlPoint_Icon_Spawn(entity cp, entity player) cp.team = e.team; cp.colormap = e.colormap; - Send_Effect_(sprintf("%sflag_touch", Static_Team_ColorName_Lower(player.team)), e.origin, '0 0 0', 1); + Send_Effect(EFFECT_FLAG_TOUCH(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); @@ -1130,7 +1130,7 @@ bool Onslaught_CheckWinner() ons_stalemate = false; - play2all(SND(CTF_CAPTURE(Static_Team_ColorName_Lower(winner_team)))); + play2all(SND(CTF_CAPTURE(winner_team))); round_handler_Init(7, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit); -- 2.39.2