electro lightning: paint with decals
authorRudolf Polzer <divverent@alientrap.org>
Tue, 27 Jul 2010 06:18:36 +0000 (08:18 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 27 Jul 2010 06:18:36 +0000 (08:18 +0200)
effectinfo.txt
qcsrc/client/hook.qc
qcsrc/server/w_electro.qc

index a9fdc33e0600c26b30d4eaee0129d873e01d42ba..dddf34c8883ee105c6117a7550224eb86af4ad7f 100644 (file)
@@ -4976,15 +4976,25 @@ velocityjitter 156 156 156
 // used in qcsrc/server/w_electro.qc:  pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1)
 // used in qcsrc/server/w_electro.qc:  pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1)
 effect electro_lightning
+countabsolute 1
+type decal
+tex 59 59
+size 16 16
+alpha 256 256 0
+originjitter 2 2 2
+lightradius 50
+lightradiusfade 200
+lightcolor 3.125 4.375 10
+effect electro_lightning
 count 300
 type spark
 color 0x283880 0x283880 // 0x202020 0x404040
 tex 65 65
-size 5 5
+size 3 3
 alpha 256 256 1024
 originjitter 1.5 1.5 1.5
 velocityjitter 6 6 6
-sizeincrease 20
+sizeincrease 15
 velocitymultiplier 2000
 effect electro_lightning
 count 30
index efa16533d584fe4a2ec253e1a01059322df9d00b..e53cd0026fd6b3b46e21ac5f4737ee18d793ef22 100644 (file)
@@ -3,6 +3,7 @@
 .vector velocity;
 .float HookSound;
 .float HookSilent;
+.float HookRange;
 
 void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float alpha, float drawflag)
 {
@@ -48,7 +49,7 @@ void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end)
 
 void Draw_GrapplingHook()
 {
-       vector a, b;
+       vector a, b, atrans;
        string tex, snd;
        vector rgb;
        float t;
@@ -86,7 +87,10 @@ void Draw_GrapplingHook()
                                break;
                        case ENT_CLIENT_LGBEAM:
                        case ENT_CLIENT_GAUNTLET:
-                               b = view_origin + view_forward * vlen(self.velocity - self.origin); // honor original length of beam!
+                               if(self.HookRange)
+                                       b = view_origin + view_forward * self.HookRange;
+                               else
+                                       b = view_origin + view_forward * vlen(self.velocity - self.origin); // honor original length of beam!
                                WarpZone_TraceLine(view_origin, b, MOVE_NORMAL, world);
                                b = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
                                a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z;
@@ -157,12 +161,14 @@ void Draw_GrapplingHook()
        WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, ((self.HookType == ENT_CLIENT_HOOK) ? MOVE_NOTHING : MOVE_NORMAL), world, world, Draw_GrapplingHook_trace_callback);
        Draw_GrapplingHook_trace_callback_tex = string_null;
 
+       atrans = WarpZone_TransformOrigin(WarpZone_trace_transform, a);
+
        switch(self.HookType)
        {
                default:
                case ENT_CLIENT_HOOK:
                        setorigin(self, trace_endpos); // hook endpoint!
-                       self.angles = vectoangles(trace_endpos - WarpZone_TransformOrigin(WarpZone_trace_transform, a));
+                       self.angles = vectoangles(trace_endpos - atrans);
                        break;
                case ENT_CLIENT_LGBEAM:
                case ENT_CLIENT_GAUNTLET:
@@ -176,7 +182,7 @@ void Draw_GrapplingHook()
                case ENT_CLIENT_HOOK:
                        break;
                case ENT_CLIENT_LGBEAM:
-                       pointparticles(particleeffectnum("electro_lightning"), b, normalize(a - b), frametime);
+                       pointparticles(particleeffectnum("electro_lightning"), trace_endpos, normalize(atrans - trace_endpos), frametime);
                        break;
                case ENT_CLIENT_GAUNTLET:
                        break;
@@ -203,6 +209,17 @@ void Ent_ReadHook(float bIsNew, float type)
        if(sf & 1)
        {
                self.owner = playerslots[ReadByte() - 1];
+               switch(self.HookType)
+               {
+                       default:
+                       case ENT_CLIENT_HOOK:
+                       case ENT_CLIENT_GAUNTLET:
+                               self.HookRange = 0;
+                               break;
+                       case ENT_CLIENT_LGBEAM:
+                               self.HookRange = ReadCoord();
+                               break;
+               }
        }
        if(sf & 2)
        {
index 92ed5e75a94888f6414aba480ee475986483533e..25011c541759031b3981c1a5d123adf9b9bac7ce 100644 (file)
@@ -195,6 +195,7 @@ float lgbeam_send(entity to, float sf)
        if(sf & 1)
        {
                WriteByte(MSG_ENTITY, num_for_edict(self.owner));
+               WriteCoord(MSG_ENTITY, cvar("g_balance_electro_primary_range"));
        }
        if(sf & 2)
        {