From f52e83c02639f3b2e95245c30a6affd0a7bedf7e Mon Sep 17 00:00:00 2001 From: div0 Date: Tue, 16 Dec 2008 13:34:27 +0000 Subject: [PATCH] fix hook again git-svn-id: svn://svn.icculus.org/nexuiz/trunk@5240 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/client/hook.qc | 44 ++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/data/qcsrc/client/hook.qc b/data/qcsrc/client/hook.qc index c50458e5d..15f0dff9e 100644 --- a/data/qcsrc/client/hook.qc +++ b/data/qcsrc/client/hook.qc @@ -34,6 +34,7 @@ void Draw_GrapplingHook() vector a, b; string tex; vector rgb; + float t; if(time >= self.HookKillTime) return; @@ -42,22 +43,25 @@ void Draw_GrapplingHook() else a = self.HookStart; b = self.HookEnd; - if(self.team == COLOR_TEAM1) + + t = GetPlayerColorForce(self.sv_entnum); + + if(t == COLOR_TEAM1) { tex = "particles/hook_red"; rgb = '1 .3 .3'; } - else if(self.team == COLOR_TEAM2) + else if(t == COLOR_TEAM2) { tex = "particles/hook_blue"; rgb = '.3 .3 1'; } - else if(self.team == COLOR_TEAM3) + else if(t == COLOR_TEAM3) { tex = "particles/hook_yellow"; rgb = '1 1 .3'; } - else if(self.team == COLOR_TEAM4) + else if(t == COLOR_TEAM4) { tex = "particles/hook_pink"; rgb = '1 .3 1'; @@ -75,16 +79,28 @@ void Draw_GrapplingHook() void Net_GrapplingHook() { - self.sv_entnum = ReadShort(); - self.HookEnd_x = ReadCoord(); - self.HookEnd_y = ReadCoord(); - self.HookEnd_z = ReadCoord(); - self.HookStart_x = ReadCoord(); - self.HookStart_y = ReadCoord(); - self.HookStart_z = ReadCoord(); + float i; + vector start, end; + entity p; + + i = ReadShort(); + end_x = ReadCoord(); + end_y = ReadCoord(); + end_z = ReadCoord(); + start_x = ReadCoord(); + start_y = ReadCoord(); + start_z = ReadCoord(); - self.HookKillTime = time + 0.1; - self.draw = Draw_GrapplingHook; + if(i <= 0 || i >= 256) // not owned by a client + return; + --i; + + p = playerslots[i]; + if(!p) + return; - self.team = GetPlayerColorForce(self.sv_entnum); + p.HookKillTime = time + 0.1; + p.HookStart = start; + p.HookEnd = end; + p.draw = Draw_GrapplingHook; } -- 2.39.2