]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Effects: create qc effects folder
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 5 Nov 2015 11:15:22 +0000 (22:15 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 5 Nov 2015 11:15:22 +0000 (22:15 +1100)
13 files changed:
qcsrc/client/effects.qc [deleted file]
qcsrc/client/effects.qh [deleted file]
qcsrc/client/main.qc
qcsrc/client/progs.inc
qcsrc/common/constants.qh
qcsrc/common/effects/qc/all.inc [new file with mode: 0644]
qcsrc/common/effects/qc/all.qc [new file with mode: 0644]
qcsrc/common/effects/qc/all.qh [new file with mode: 0644]
qcsrc/common/effects/qc/lightningarc.qc [new file with mode: 0644]
qcsrc/common/monsters/monster/shambler.qc
qcsrc/server/csqceffects.qc [deleted file]
qcsrc/server/csqceffects.qh [deleted file]
qcsrc/server/progs.inc

diff --git a/qcsrc/client/effects.qc b/qcsrc/client/effects.qc
deleted file mode 100644 (file)
index 348c62c..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#include "effects.qh"
-
-/*
-.vector fx_start;
-.vector fx_end;
-.float  fx_with;
-.string fx_texture;
-.float  fx_lifetime;
-
-void b_draw()
-{
-    //Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, 0, time * 3, '1 1 1', 0.7, DRAWFLAG_ADDITIVE, view_origin);
-    Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, (self.fx_with/256), 0, '1 1 1', 1, DRAWFLAG_ADDITIVE, view_origin);
-
-}
-void b_make(vector s,vector e, string t,float l,float z)
-{
-    entity b;
-    b = spawn();
-    b.fx_texture = t;
-    b.fx_start = s;
-    b.fx_end = e;
-    b.fx_with = z;
-    b.think = SUB_Remove;
-    b.nextthink = time + l;
-       b.draw = b_draw;
-
-       //b.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;
-}
-*/
-
-void cl_effects_lightningarc(vector from, vector to,float seglength,float drifts,float drifte,float branchfactor,float branchfactor_add)
-{
-    vector direction,dirnew, pos, pos_l;
-    float length, steps, steplength, i,drift;
-
-    length     = vlen(from - to);
-    if(length < 1)
-        return;
-
-    // Use at most 16 te_lightning1 segments, as these eat up beam list segments.
-    // TODO: Change this to R_BeginPolygon code, then we no longer have this limit.
-    steps      = min(16, floor(length / seglength));
-    if(steps < 1)
-    {
-        te_lightning1(world,from,to);
-        return;
-    }
-
-    steplength = length / steps;
-    direction  = normalize(to - from);
-    pos_l = from;
-    if(length > seglength)
-    {
-        for(i = 1; i < steps; i += 1)
-        {
-            drift = drifts * (1 - (i / steps)) + drifte * (i / steps);
-            dirnew = normalize(direction * (1 - drift) + randomvec() * drift);
-            pos = pos_l +  dirnew * steplength;
-            te_lightning1(world,pos_l,pos);
-            // WTF endless recursion if branchfactor is 1.0 (possibly due to adding branchfactor_add). FIXME
-            // if(random() < branchfactor)
-            //     cl_effects_lightningarc(pos, pos + (dirnew * length * 0.25),seglength,drifts,drifte,min(branchfactor + branchfactor_add,1),branchfactor_add);
-
-            pos_l = pos;
-        }
-        te_lightning1(world,pos_l,to);
-
-    }
-    else
-        te_lightning1(world,from,to);
-
-}
-
-void Net_ReadLightningarc()
-{
-       vector from, to;
-
-    from.x = ReadCoord(); from.y = ReadCoord(); from.z = ReadCoord();
-    to.x = ReadCoord(); to.y = ReadCoord(); to.z = ReadCoord();
-
-    if(autocvar_cl_effects_lightningarc_simple)
-    {
-        te_lightning1(world,from,to);
-    }
-    else
-    {
-        float seglength, drifts, drifte, branchfactor, branchfactor_add;
-
-        seglength        = autocvar_cl_effects_lightningarc_segmentlength;
-        drifts           = autocvar_cl_effects_lightningarc_drift_start;
-        drifte           = autocvar_cl_effects_lightningarc_drift_end;
-        branchfactor     = autocvar_cl_effects_lightningarc_branchfactor_start;
-        branchfactor_add = autocvar_cl_effects_lightningarc_branchfactor_add;
-
-        cl_effects_lightningarc(from,to,seglength,drifts,drifte,branchfactor,branchfactor_add);
-    }
-
-}
-void Net_ReadArc() { Net_ReadLightningarc(); }
-NET_HANDLE(TE_CSQC_ARC, bool isNew)
-{
-       Net_ReadArc();
-       return true;
-}
diff --git a/qcsrc/client/effects.qh b/qcsrc/client/effects.qh
deleted file mode 100644 (file)
index 2d93f41..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef CLIENT_EFFECTS_H
-#define CLIENT_EFFECTS_H
-
-void Net_ReadArc();
-
-#endif
index af1da5c2109aa7df8ed48dbce07acffb481897f4..bb522b4adc166b2399a7e3722b9dc7253aa5eae5 100644 (file)
@@ -1,7 +1,7 @@
 #include "main.qh"
 
 #include "damage.qh"
-#include "effects.qh"
+#include "../common/effects/qc/all.qh"
 #include "gibs.qh"
 #include "hook.qh"
 #include "hud/all.qh"
index 17cde57b874de67b50925897eaeadc66dc0f6c0d..476bbf5d75b317d40dae803c50ef814861aa1681 100644 (file)
@@ -5,7 +5,7 @@
 #include "bgmscript.qc"
 #include "csqcmodel_hooks.qc"
 #include "damage.qc"
-#include "effects.qc"
+#include "../common/effects/qc/all.qc"
 #include "gibs.qc"
 #include "hook.qc"
 #include "hud/all.qc"
index 21f095d97495f3c57a9e904a7800712597a90e12..703b271aa02f50de60a4e474d03ac86175adaf23 100644 (file)
@@ -34,7 +34,6 @@ const int AS_FLOAT = 8;
 REGISTER_NET_TEMP(TE_CSQC_PICTURE)
 REGISTER_NET_TEMP(TE_CSQC_RACE)
 REGISTER_NET_TEMP(TE_CSQC_VORTEXBEAMPARTICLE)
-REGISTER_NET_TEMP(TE_CSQC_ARC)
 REGISTER_NET_TEMP(TE_CSQC_TEAMNAGGER)
 REGISTER_NET_TEMP(TE_CSQC_PINGPLREPORT)
 REGISTER_NET_TEMP(TE_CSQC_TARGET_MUSIC)
diff --git a/qcsrc/common/effects/qc/all.inc b/qcsrc/common/effects/qc/all.inc
new file mode 100644 (file)
index 0000000..2e5bfef
--- /dev/null
@@ -0,0 +1 @@
+#include "lightningarc.qc"
diff --git a/qcsrc/common/effects/qc/all.qc b/qcsrc/common/effects/qc/all.qc
new file mode 100644 (file)
index 0000000..f0fc719
--- /dev/null
@@ -0,0 +1,5 @@
+#include "all.qh"
+
+#define IMPLEMENTATION
+#include "all.inc"
+#undef IMPLEMENTATION
diff --git a/qcsrc/common/effects/qc/all.qh b/qcsrc/common/effects/qc/all.qh
new file mode 100644 (file)
index 0000000..5b9b364
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef EFFECTS_QC
+#define EFFECTS_QC
+#include "all.inc"
+#endif
diff --git a/qcsrc/common/effects/qc/lightningarc.qc b/qcsrc/common/effects/qc/lightningarc.qc
new file mode 100644 (file)
index 0000000..5c6b60e
--- /dev/null
@@ -0,0 +1,119 @@
+#ifdef IMPLEMENTATION
+REGISTER_NET_TEMP(TE_CSQC_ARC)
+
+#if defined(SVQC)
+
+       void te_csqc_lightningarc(vector from, vector to)
+       {
+               WriteHeader(MSG_BROADCAST, TE_CSQC_ARC);
+
+               WriteCoord(MSG_BROADCAST, from.x);
+               WriteCoord(MSG_BROADCAST, from.y);
+               WriteCoord(MSG_BROADCAST, from.z);
+               WriteCoord(MSG_BROADCAST, to.x);
+               WriteCoord(MSG_BROADCAST, to.y);
+               WriteCoord(MSG_BROADCAST, to.z);
+       }
+
+#elif defined(CSQC)
+
+/*
+.vector fx_start;
+.vector fx_end;
+.float  fx_with;
+.string fx_texture;
+.float  fx_lifetime;
+
+void b_draw()
+{
+    //Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, 0, time * 3, '1 1 1', 0.7, DRAWFLAG_ADDITIVE, view_origin);
+    Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, (self.fx_with/256), 0, '1 1 1', 1, DRAWFLAG_ADDITIVE, view_origin);
+
+}
+void b_make(vector s,vector e, string t,float l,float z)
+{
+    entity b;
+    b = spawn();
+    b.fx_texture = t;
+    b.fx_start = s;
+    b.fx_end = e;
+    b.fx_with = z;
+    b.think = SUB_Remove;
+    b.nextthink = time + l;
+    b.draw = b_draw;
+
+    //b.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;
+}
+*/
+
+       void cl_effects_lightningarc(vector from, vector to, float seglength, float drifts, float drifte,
+       float branchfactor, float branchfactor_add)
+       {
+               float length = vlen(from - to);
+               if (length < 1) return;
+
+               // Use at most 16 te_lightning1 segments, as these eat up beam list segments.
+               // TODO: Change this to R_BeginPolygon code, then we no longer have this limit.
+               int steps = min(16, floor(length / seglength));
+               if (steps < 1)
+               {
+                       te_lightning1(world, from, to);
+                       return;
+               }
+
+               float steplength = length / steps;
+               vector direction  = normalize(to - from);
+               vector pos_l = from;
+               if (length > seglength)
+               {
+                       for (int i = 1; i < steps; i += 1)
+                       {
+                               float drift = drifts * (1 - (i / steps)) + drifte * (i / steps);
+                               vector dirnew = normalize(direction * (1 - drift) + randomvec() * drift);
+                               vector pos = pos_l +  dirnew * steplength;
+                               te_lightning1(world, pos_l, pos);
+                               // WTF endless recursion if branchfactor is 1.0 (possibly due to adding branchfactor_add). FIXME
+                               // if(random() < branchfactor)
+                               //     cl_effects_lightningarc(pos, pos + (dirnew * length * 0.25),seglength,drifts,drifte,min(branchfactor + branchfactor_add,1),branchfactor_add);
+
+                               pos_l = pos;
+                       }
+                       te_lightning1(world, pos_l, to);
+               }
+               else
+               {
+                       te_lightning1(world, from, to);
+               }
+       }
+
+       NET_HANDLE(TE_CSQC_ARC, bool isNew)
+       {
+               vector from;
+               from.x = ReadCoord();
+               from.y = ReadCoord();
+               from.z = ReadCoord();
+               vector to;
+               to.x = ReadCoord();
+               to.y = ReadCoord();
+               to.z = ReadCoord();
+               return = true;
+
+               if (autocvar_cl_effects_lightningarc_simple)
+               {
+                       te_lightning1(world, from, to);
+               }
+               else
+               {
+                       float seglength        = autocvar_cl_effects_lightningarc_segmentlength;
+                       float drifts           = autocvar_cl_effects_lightningarc_drift_start;
+                       float drifte           = autocvar_cl_effects_lightningarc_drift_end;
+                       float branchfactor     = autocvar_cl_effects_lightningarc_branchfactor_start;
+                       float branchfactor_add = autocvar_cl_effects_lightningarc_branchfactor_add;
+
+                       cl_effects_lightningarc(from, to, seglength, drifts, drifte, branchfactor, branchfactor_add);
+               }
+       }
+
+#endif
+
+#endif
index bb7577de88b8ac887eaca08decdeebbf02d5e711..67b6808cc7b23346d517f310435cba7ab09d00ae 100644 (file)
@@ -82,7 +82,7 @@ void M_Shambler_Attack_Swing()
        }
 }
 
-#include "../../../server/csqceffects.qh"
+#include "../../effects/qc/all.qh"
 
 void M_Shambler_Attack_Lightning_Explode()
 {SELFPARAM();
diff --git a/qcsrc/server/csqceffects.qc b/qcsrc/server/csqceffects.qc
deleted file mode 100644 (file)
index 248d885..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#if defined(CSQC)
-#elif defined(MENUQC)
-#elif defined(SVQC)
-    #include "../common/constants.qh"
-#endif
-
-void te_csqc_lightningarc(vector from,vector to)
-{
-       WriteHeader(MSG_BROADCAST, TE_CSQC_ARC);
-
-       WriteCoord(MSG_BROADCAST, from.x);
-       WriteCoord(MSG_BROADCAST, from.y);
-       WriteCoord(MSG_BROADCAST, from.z);
-       WriteCoord(MSG_BROADCAST, to.x);
-       WriteCoord(MSG_BROADCAST, to.y);
-       WriteCoord(MSG_BROADCAST, to.z);
-}
-
diff --git a/qcsrc/server/csqceffects.qh b/qcsrc/server/csqceffects.qh
deleted file mode 100644 (file)
index 9fd0c38..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef CSQCEFFECTS_H
-#define CSQCEFFECTS_H
-void te_csqc_lightningarc(vector from,vector to);
-#endif
index 2a1be62574fc352fb74855cea745e39fa7086cf4..561a1d17b17eab868a172e3d89377e8b9d922d5f 100644 (file)
@@ -8,7 +8,7 @@
 #include "cl_client.qc"
 #include "cl_impulse.qc"
 #include "cl_player.qc"
-#include "csqceffects.qc"
+#include "../common/effects/qc/all.qc"
 #include "ent_cs.qc"
 #include "g_damage.qc"
 #include "g_hook.qc"