From a9a7db34cf93f756ae42925c302cec84f9f9b7d2 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Sat, 18 Aug 2012 19:42:56 -0400 Subject: [PATCH] Blaster now uses the real color of the player firing the shot --- qcsrc/client/miscfunctions.qc | 14 ++++++++++++++ qcsrc/client/particles.qc | 34 +++++++++++++++++++--------------- qcsrc/server/w_laser.qc | 1 + 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index 72bb9c5c4..29ae55941 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -596,6 +596,20 @@ vector getplayerorigin(float pl) return GETPLAYERORIGIN_ERROR; } +vector getcsqcplayercolor(float pl) +{ + entity e; + + e = CSQCModel_server2csqc(pl + 1); + if(e) + { + if(e.colormap > 0) + return colormapPaletteColor(((e.colormap >= 1024) ? e.colormap : stof(getplayerkeyvalue(e.colormap - 1, "colors"))) & 0x0F, TRUE); + } + + return '1 1 1'; +} + float getplayerisdead(float pl) { entity e; diff --git a/qcsrc/client/particles.qc b/qcsrc/client/particles.qc index 0150bb283..ac2f9fdea 100644 --- a/qcsrc/client/particles.qc +++ b/qcsrc/client/particles.qc @@ -316,6 +316,8 @@ void Draw_Shockwave() vector deviation, angle; + vector sw_color = getcsqcplayercolor(self.sv_entnum - 1); // GetTeamRGB(GetPlayerColor(self.sv_entnum)); + vector first_min_end, prev_min_end, new_min_end; vector first_max_end, prev_max_end, new_max_end; @@ -325,7 +327,7 @@ void Draw_Shockwave() vectorvectors(shotdir); vector right = v_right; vector up = v_up; - + float counter, dist_before_normal = 200, shots = 20; vector min_end = ((self.sw_shotorg + (shotdir * dist_before_normal)) + (up * self.sw_spread_min)); @@ -366,16 +368,16 @@ void Draw_Shockwave() if(counter >= 1) { R_BeginPolygon("", DRAWFLAG_NORMAL); - R_PolygonVertex(prev_min_end, '0 0 0', '1 0 0', a); - R_PolygonVertex(new_min_end, '0 0 0', '1 0 0', a); - R_PolygonVertex(self.sw_shotorg, '0 0 0', '1 0 0', a); + R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a); + R_PolygonVertex(new_min_end, '0 0 0', sw_color, a); + R_PolygonVertex(self.sw_shotorg, '0 0 0', sw_color, a); R_EndPolygon(); R_BeginPolygon("", DRAWFLAG_NORMAL); - R_PolygonVertex(new_min_end, '0 0 0', '1 0 0', a); - R_PolygonVertex(prev_min_end, '0 0 0', '1 0 0', a); - R_PolygonVertex(prev_max_end, '0 0 0', '1 0 0', a); - R_PolygonVertex(new_max_end, '0 0 0', '1 0 0', a); + R_PolygonVertex(new_min_end, '0 0 0', sw_color, a); + R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a); + R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a); + R_PolygonVertex(new_max_end, '0 0 0', sw_color, a); R_EndPolygon(); } @@ -385,16 +387,16 @@ void Draw_Shockwave() if((counter + 1) == shots) { R_BeginPolygon("", DRAWFLAG_NORMAL); - R_PolygonVertex(prev_min_end, '0 0 0', '1 0 0', a); - R_PolygonVertex(first_min_end, '0 0 0', '1 0 0', a); - R_PolygonVertex(self.sw_shotorg, '0 0 0', '1 0 0', a); + R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a); + R_PolygonVertex(first_min_end, '0 0 0', sw_color, a); + R_PolygonVertex(self.sw_shotorg, '0 0 0', sw_color, a); R_EndPolygon(); R_BeginPolygon("", DRAWFLAG_NORMAL); - R_PolygonVertex(first_min_end, '0 0 0', '1 0 0', a); - R_PolygonVertex(prev_min_end, '0 0 0', '1 0 0', a); - R_PolygonVertex(prev_max_end, '0 0 0', '1 0 0', a); - R_PolygonVertex(first_max_end, '0 0 0', '1 0 0', a); + R_PolygonVertex(first_min_end, '0 0 0', sw_color, a); + R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a); + R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a); + R_PolygonVertex(first_max_end, '0 0 0', sw_color, a); R_EndPolygon(); } } @@ -412,6 +414,8 @@ void Net_ReadShockwaveParticle() shockwave.sw_spread_max = ReadByte(); shockwave.sw_spread_min = ReadByte(); + shockwave.sv_entnum = ReadByte(); + shockwave.sw_time = time; } diff --git a/qcsrc/server/w_laser.qc b/qcsrc/server/w_laser.qc index beaebf8a4..25e240357 100644 --- a/qcsrc/server/w_laser.qc +++ b/qcsrc/server/w_laser.qc @@ -21,6 +21,7 @@ void SendCSQCShockwaveParticle(vector endpos) WriteCoord(MSG_BROADCAST, endpos_z); WriteByte(MSG_BROADCAST, bound(0, autocvar_g_balance_laser_shockwave_spread_max, 255)); WriteByte(MSG_BROADCAST, bound(0, autocvar_g_balance_laser_shockwave_spread_min, 255)); + WriteByte(MSG_BROADCAST, num_for_edict(self)); } void W_Laser_Touch() -- 2.39.2