From f73fc0d4352750bf97ff7810419130f0c83daa45 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 26 Sep 2015 22:13:19 +1000 Subject: [PATCH] Effects: prefer team suffixes --- qcsrc/common/effects/effects.inc | 50 +++++++++++++++++------- qcsrc/common/weapons/weapon/vaporizer.qc | 37 +----------------- qcsrc/server/mutators/mutator_nades.qc | 20 ++-------- 3 files changed, 40 insertions(+), 67 deletions(-) diff --git a/qcsrc/common/effects/effects.inc b/qcsrc/common/effects/effects.inc index 663d090a8..4d82087e0 100644 --- a/qcsrc/common/effects/effects.inc +++ b/qcsrc/common/effects/effects.inc @@ -46,15 +46,15 @@ EFFECT(0, VORTEX_IMPACT, "nex_impact") EFFECT(0, VORTEX_MUZZLEFLASH, "nex_muzzleflash") EFFECT(1, VAPORIZER_RED, "TE_TEI_G3RED") -EFFECT(1, VAPORIZER_RED_HIT, "TE_TEI_G3RED_HIT") +EFFECT(1, VAPORIZER_HIT_RED, "TE_TEI_G3RED_HIT") EFFECT(1, VAPORIZER_BLUE, "TE_TEI_G3BLUE") -EFFECT(1, VAPORIZER_BLUE_HIT, "TE_TEI_G3BLUE_HIT") +EFFECT(1, VAPORIZER_HIT_BLUE, "TE_TEI_G3BLUE_HIT") EFFECT(1, VAPORIZER_YELLOW, "TE_TEI_G3YELLOW") -EFFECT(1, VAPORIZER_YELLOW_HIT, "TE_TEI_G3YELLOW_HIT") +EFFECT(1, VAPORIZER_HIT_YELLOW, "TE_TEI_G3YELLOW_HIT") EFFECT(1, VAPORIZER_PINK, "TE_TEI_G3PINK") -EFFECT(1, VAPORIZER_PINK_HIT, "TE_TEI_G3PINK_HIT") +EFFECT(1, VAPORIZER_HIT_PINK, "TE_TEI_G3PINK_HIT") EFFECT(1, VAPORIZER_NEUTRAL, "TE_TEI_G3") -EFFECT(1, VAPORIZER_NEUTRAL_HIT, "TE_TEI_G3_HIT") +EFFECT(1, VAPORIZER_HIT_NEUTRAL, "TE_TEI_G3_HIT") entity EFFECT_VAPORIZER(int teamid) { switch (teamid) { @@ -65,6 +65,16 @@ entity EFFECT_VAPORIZER(int teamid) default: return EFFECT_VAPORIZER_NEUTRAL; } } +entity EFFECT_VAPORIZER_HIT(int teamid) +{ + switch (teamid) { + case NUM_TEAM_1: return EFFECT_VAPORIZER_HIT_RED; + case NUM_TEAM_2: return EFFECT_VAPORIZER_HIT_BLUE; + case NUM_TEAM_3: return EFFECT_VAPORIZER_HIT_YELLOW; + case NUM_TEAM_4: return EFFECT_VAPORIZER_HIT_PINK; + default: return EFFECT_VAPORIZER_HIT_NEUTRAL; + } +} EFFECT(0, RIFLE_IMPACT, "machinegun_impact") EFFECT(0, RIFLE_MUZZLEFLASH, "rifle_muzzleflash") @@ -134,11 +144,21 @@ EFFECT(0, SPAWN_PINK, "spawn_event_pink") EFFECT(0, SPAWNPOINT_NEUTRAL, "spawn_point_neutral") EFFECT(0, SPAWN_NEUTRAL, "spawn_event_neutral") -EFFECT(0, NADE_RED_EXPLODE, "nade_red_explode") -EFFECT(0, NADE_BLUE_EXPLODE, "nade_blue_explode") -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(0, NADE_EXPLODE_RED, "nade_red_explode") +EFFECT(0, NADE_EXPLODE_BLUE, "nade_blue_explode") +EFFECT(0, NADE_EXPLODE_YELLOW, "nade_yellow_explode") +EFFECT(0, NADE_EXPLODE_PINK, "nade_pink_explode") +EFFECT(0, NADE_EXPLODE_NEUTRAL, "nade_neutral_explode") +entity EFFECT_NADE_EXPLODE(int teamid) +{ + switch (teamid) { + case NUM_TEAM_1: return EFFECT_NADE_EXPLODE_RED; + case NUM_TEAM_2: return EFFECT_NADE_EXPLODE_BLUE; + case NUM_TEAM_3: return EFFECT_NADE_EXPLODE_YELLOW; + case NUM_TEAM_4: return EFFECT_NADE_EXPLODE_PINK; + default: return EFFECT_NADE_EXPLODE_NEUTRAL; + } +} EFFECT(1, NADE_TRAIL_RED, "nade_red") EFFECT(1, NADE_TRAIL_BLUE, "nade_blue") @@ -195,11 +215,11 @@ entity EFFECT_FLAG_TOUCH(int teamid) } } -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(1, PASS_RED, "red_pass") +EFFECT(1, PASS_BLUE, "blue_pass") +EFFECT(1, PASS_YELLOW, "yellow_pass") +EFFECT(1, PASS_PINK, "pink_pass") +EFFECT(1, PASS_NEUTRAL, "neutral_pass") EFFECT(0, CAP_RED, "red_cap") EFFECT(0, CAP_BLUE, "blue_cap") diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 2abddeace..d27f99180 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -96,41 +96,8 @@ void W_Vaporizer_Attack(void) Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); // teamcolor / hit beam effect - vector v; - v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); - switch(self.team) - { - case NUM_TEAM_1: // Red - if(damage_goodhits) - Send_Effect(EFFECT_VAPORIZER_RED_HIT, w_shotorg, v, 1); - else - Send_Effect(EFFECT_VAPORIZER_RED, w_shotorg, v, 1); - break; - case NUM_TEAM_2: // Blue - if(damage_goodhits) - Send_Effect(EFFECT_VAPORIZER_BLUE_HIT, w_shotorg, v, 1); - else - Send_Effect(EFFECT_VAPORIZER_BLUE, w_shotorg, v, 1); - break; - case NUM_TEAM_3: // Yellow - if(damage_goodhits) - Send_Effect(EFFECT_VAPORIZER_YELLOW_HIT, w_shotorg, v, 1); - else - Send_Effect(EFFECT_VAPORIZER_YELLOW, w_shotorg, v, 1); - break; - case NUM_TEAM_4: // Pink - if(damage_goodhits) - Send_Effect(EFFECT_VAPORIZER_PINK_HIT, w_shotorg, v, 1); - else - Send_Effect(EFFECT_VAPORIZER_PINK, w_shotorg, v, 1); - break; - default: - if(damage_goodhits) - Send_Effect_("TE_TEI_G3_HIT", w_shotorg, v, 1); - else - Send_Effect_("TE_TEI_G3", w_shotorg, v, 1); - break; - } + vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); + Send_Effect((damage_goodhits ? EFFECT_VAPORIZER_HIT(self.team) : EFFECT_VAPORIZER(self.team)), w_shotorg, v, 1); if(autocvar_g_rm) if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))) diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index 99941a100..19a0aa462 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -250,15 +250,7 @@ void nade_ice_think() { if ( autocvar_g_nades_ice_explode ) { - entity expef = NULL; - switch(self.realowner.team) - { - case NUM_TEAM_1: expef = EFFECT_NADE_RED_EXPLODE; break; - case NUM_TEAM_2: expef = EFFECT_NADE_BLUE_EXPLODE; break; - case NUM_TEAM_3: expef = EFFECT_NADE_YELLOW_EXPLODE; break; - case NUM_TEAM_4: expef = EFFECT_NADE_PINK_EXPLODE; break; - default: expef = EFFECT_NADE_NEUTRAL_EXPLODE; break; - } + entity expef = EFFECT_NADE_EXPLODE(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); @@ -517,14 +509,8 @@ void nade_boom() default: case NADE_TYPE_NORMAL: - switch(self.realowner.team) - { - case NUM_TEAM_1: expef = EFFECT_NADE_RED_EXPLODE; break; - case NUM_TEAM_2: expef = EFFECT_NADE_BLUE_EXPLODE; break; - case NUM_TEAM_3: expef = EFFECT_NADE_YELLOW_EXPLODE; break; - case NUM_TEAM_4: expef = EFFECT_NADE_PINK_EXPLODE; break; - default: expef = EFFECT_NADE_NEUTRAL_EXPLODE; break; - } + expef = EFFECT_NADE_EXPLODE(self.realowner.team); + break; } if(expef) -- 2.39.2