]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hook.qc
Merge remote-tracking branch 'origin/master' into samual/weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hook.qc
index 3c71447a163831846ecb90290489b61dc5f9d9b2..8beacac88befc88132a24d36e4f3fa3b0b0967c3 100644 (file)
@@ -8,7 +8,7 @@ void Draw_CylindricLine(vector from, vector to, float thickness, string texture,
 {
        // I want to draw a quad...
        // from and to are MIDPOINTS.
-       
+
        vector axis, thickdir, A, B, C, D;
        float length_tex;
 
@@ -59,7 +59,7 @@ void Draw_GrapplingHook()
        if(self.teleport_time)
        if(time > self.teleport_time)
        {
-               sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTN_NORM); // safeguard
+               sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM); // safeguard
                self.teleport_time = 0;
        }
 
@@ -75,9 +75,12 @@ void Draw_GrapplingHook()
                case ENT_CLIENT_HOOK:
                        vs = hook_shotorigin[s];
                        break;
-               case ENT_CLIENT_LGBEAM:
+               case ENT_CLIENT_ELECTRO_BEAM:
                        vs = electro_shotorigin[s];
                        break;
+               case ENT_CLIENT_ARC_BEAM:
+                       vs = lightning_shotorigin[s];
+                       break;
        }
 
        if((self.owner.sv_entnum == player_localentnum - 1))
@@ -89,7 +92,8 @@ void Draw_GrapplingHook()
                                a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z;
                                b = self.origin;
                                break;
-                       case ENT_CLIENT_LGBEAM:
+                       case ENT_CLIENT_ELECTRO_BEAM:
+                       case ENT_CLIENT_ARC_BEAM:
                                if(self.HookRange)
                                        b = view_origin + view_forward * self.HookRange;
                                else
@@ -109,7 +113,8 @@ void Draw_GrapplingHook()
                                a = self.velocity;
                                b = self.origin;
                                break;
-                       case ENT_CLIENT_LGBEAM:
+                       case ENT_CLIENT_ELECTRO_BEAM:
+                       case ENT_CLIENT_ARC_BEAM:
                                a = self.origin;
                                b = self.velocity;
                                break;
@@ -124,22 +129,22 @@ void Draw_GrapplingHook()
                case ENT_CLIENT_HOOK:
                        intensity = 1;
                        offset = 0;
-                       if(t == COLOR_TEAM1)
+                       if(t == NUM_TEAM_1)
                        {
                                tex = "particles/hook_red";
                                rgb = '1 .3 .3';
                        }
-                       else if(t == COLOR_TEAM2)
+                       else if(t == NUM_TEAM_2)
                        {
                                tex = "particles/hook_blue";
                                rgb = '.3 .3 1';
                        }
-                       else if(t == COLOR_TEAM3)
+                       else if(t == NUM_TEAM_3)
                        {
                                tex = "particles/hook_yellow";
                                rgb = '1 1 .3';
                        }
-                       else if(t == COLOR_TEAM4)
+                       else if(t == NUM_TEAM_4)
                        {
                                tex = "particles/hook_pink";
                                rgb = '1 .3 1';
@@ -150,7 +155,13 @@ void Draw_GrapplingHook()
                                rgb = '.3 1 .3';
                        }
                        break;
-               case ENT_CLIENT_LGBEAM:
+               case ENT_CLIENT_ELECTRO_BEAM:
+                       intensity = bound(0.2, 1 + Noise_Pink(self, frametime) * 1 + Noise_Burst(self, frametime, 0.03) * 0.3, 2);
+                       offset = Noise_Brown(self, frametime) * 10;
+                       tex = "particles/lgbeam";
+                       rgb = '1 1 1';
+                       break;
+               case ENT_CLIENT_ARC_BEAM: // todo
                        intensity = bound(0.2, 1 + Noise_Pink(self, frametime) * 1 + Noise_Burst(self, frametime, 0.03) * 0.3, 2);
                        offset = Noise_Brown(self, frametime) * 10;
                        tex = "particles/lgbeam";
@@ -182,7 +193,8 @@ void Draw_GrapplingHook()
                                self.drawmask = 0;
                        }
                        break;
-               case ENT_CLIENT_LGBEAM:
+               case ENT_CLIENT_ELECTRO_BEAM:
+               case ENT_CLIENT_ARC_BEAM:
                        setorigin(self, a); // beam origin!
                        break;
        }
@@ -192,15 +204,18 @@ void Draw_GrapplingHook()
                default:
                case ENT_CLIENT_HOOK:
                        break;
-               case ENT_CLIENT_LGBEAM:
-                       pointparticles(particleeffectnum("electro_lightning"), trace_endpos, normalize(atrans - trace_endpos), frametime * intensity);
+               case ENT_CLIENT_ELECTRO_BEAM:
+                       pointparticles(particleeffectnum("electro_lightning"), trace_endpos, normalize(atrans - trace_endpos), frametime * intensity); // todo: new effect
+                       break;
+               case ENT_CLIENT_ARC_BEAM:
+                       pointparticles(particleeffectnum("electro_lightning"), trace_endpos, normalize(atrans - trace_endpos), frametime * intensity); // todo: new effect
                        break;
        }
 }
 
 void Remove_GrapplingHook()
 {
-       sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTN_NORM);
+       sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM);
 }
 
 void Ent_ReadHook(float bIsNew, float type)
@@ -211,7 +226,7 @@ void Ent_ReadHook(float bIsNew, float type)
        sf = ReadByte();
 
        self.HookSilent = (sf & 0x80);
-       self.iflags = IFLAG_VELOCITY;
+       self.iflags = IFLAG_VELOCITY | IFLAG_ORIGIN;
 
        InterpolateOrigin_Undo();
 
@@ -224,7 +239,8 @@ void Ent_ReadHook(float bIsNew, float type)
                        case ENT_CLIENT_HOOK:
                                self.HookRange = 0;
                                break;
-                       case ENT_CLIENT_LGBEAM:
+                       case ENT_CLIENT_ELECTRO_BEAM:
+                       case ENT_CLIENT_ARC_BEAM:
                                self.HookRange = ReadCoord();
                                break;
                }
@@ -258,8 +274,11 @@ void Ent_ReadHook(float bIsNew, float type)
                                setmodel(self, "models/hook.md3");
                                self.drawmask = MASK_NORMAL;
                                break;
-                       case ENT_CLIENT_LGBEAM:
-                               sound (self, CH_SHOTS_SINGLE, "weapons/lgbeam_fly.wav", VOL_BASE, ATTN_NORM);
+                       case ENT_CLIENT_ELECTRO_BEAM:
+                               sound (self, CH_SHOTS_SINGLE, "weapons/lgbeam_fly.wav", VOL_BASE, ATTEN_NORM);
+                               break;
+                       case ENT_CLIENT_ARC_BEAM:
+                               sound (self, CH_SHOTS_SINGLE, "weapons/lgbeam_fly.wav", VOL_BASE, ATTEN_NORM);
                                break;
                }
        }