]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Antiwall is moved to clientwall and clientillusionary
authorPenguinum <penguinum@gmail.com>
Tue, 5 May 2015 17:10:31 +0000 (20:10 +0300)
committerPenguinum <penguinum@gmail.com>
Tue, 5 May 2015 17:10:31 +0000 (20:10 +0300)
13 files changed:
qcsrc/client/antiwall.qc [deleted file]
qcsrc/client/antiwall.qh [deleted file]
qcsrc/client/main.qc
qcsrc/client/progs.src
qcsrc/client/wall.qc
qcsrc/client/wall.qh
qcsrc/common/constants.qh
qcsrc/server/antiwall.qc [deleted file]
qcsrc/server/defs.qh
qcsrc/server/g_models.qc
qcsrc/server/g_triggers.qc
qcsrc/server/g_triggers.qh
qcsrc/server/progs.src

diff --git a/qcsrc/client/antiwall.qc b/qcsrc/client/antiwall.qc
deleted file mode 100644 (file)
index 71268b0..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-#include "antiwall.qh"
-
-void Ent_Antiwall_PreDraw()
-{
-    if (self.inactive) {
-        self.alpha = 0;
-    } else {
-        vector org;
-        org = getpropertyvec(VF_ORIGIN);
-        if(!checkpvs(org, self))
-            self.alpha = 0;
-        else if(self.fade_start) {
-            self.alpha = self.alpha_max / 100.0 * bound(0,
-                               (self.fade_end - vlen(org - self.origin - 0.5 * (self.mins + self.maxs)))
-                               / (self.fade_end - self.fade_start), 1);
-        } else {
-            self.alpha = 1;
-        }
-    }
-    if(self.alpha <= 0)
-        self.drawmask = 0;
-    else
-        self.drawmask = MASK_NORMAL;
-}
-
-void Ent_Antiwall_Draw()
-{
-       float f;
-
-       if(self.lodmodelindex1)
-       {
-               if(autocvar_cl_modeldetailreduction <= 0)
-               {
-                       if(self.lodmodelindex2 && autocvar_cl_modeldetailreduction <= -2)
-                               self.modelindex = self.lodmodelindex2;
-                       else if(autocvar_cl_modeldetailreduction <= -1)
-                               self.modelindex = self.lodmodelindex1;
-                       else
-                               self.modelindex = self.lodmodelindex0;
-               }
-               else
-               {
-                       float distance = vlen(NearestPointOnBox(self, view_origin) - view_origin);
-                       f = (distance * current_viewzoom + 100.0) * autocvar_cl_modeldetailreduction;
-                       f *= 1.0 / bound(0.01, view_quality, 1);
-                       if(self.lodmodelindex2 && f > self.loddistance2)
-                               self.modelindex = self.lodmodelindex2;
-                       else if(f > self.loddistance1)
-                               self.modelindex = self.lodmodelindex1;
-                       else
-                               self.modelindex = self.lodmodelindex0;
-               }
-       }
-
-       InterpolateOrigin_Do();
-}
-
-void Ent_Antiwall_Remove()
-{
-}
-
-void Ent_Antiwall()
-{
-       float f;
-
-       InterpolateOrigin_Undo();
-       self.iflags = IFLAG_ANGLES | IFLAG_ORIGIN;
-
-       f = ReadByte();
-
-       if(f & 1)
-       {
-               if(f & 0x40)
-                       self.colormap = ReadShort();
-               else
-                       self.colormap = 0;
-       }
-
-       if(f & 2)
-       {
-               self.origin_x = ReadCoord();
-               self.origin_y = ReadCoord();
-               self.origin_z = ReadCoord();
-               setorigin(self, self.origin);
-       }
-
-       if(f & 4)
-       {
-               if(f & 0x10)
-               {
-                       self.angles_x = ReadAngle();
-                       self.angles_y = ReadAngle();
-                       self.angles_z = ReadAngle();
-               }
-               else
-                       self.angles = '0 0 0';
-       }
-
-       if(f & 8)
-       {
-               if(f & 0x80)
-               {
-                       self.lodmodelindex0 = ReadShort();
-                       self.loddistance1 = ReadShort();
-                       self.lodmodelindex1 = ReadShort();
-                       self.loddistance2 = ReadShort();
-                       self.lodmodelindex2 = ReadShort();
-               }
-               else
-               {
-                       self.modelindex = ReadShort();
-                       self.loddistance1 = 0;
-                       self.loddistance2 = 0;
-               }
-               self.scale = ReadShort() / 256.0;
-               if(f & 0x20)
-               {
-                       self.mins_x = ReadCoord();
-                       self.mins_y = ReadCoord();
-                       self.mins_z = ReadCoord();
-                       self.maxs_x = ReadCoord();
-                       self.maxs_y = ReadCoord();
-                       self.maxs_z = ReadCoord();
-               }
-               else
-                       self.mins = self.maxs = '0 0 0';
-               setsize(self, self.mins, self.maxs);
-
-        self.fade_start = ReadShort();
-        self.fade_end = ReadShort();
-        self.alpha_max = ReadShort();
-        self.inactive = ReadShort();
-        self.solid = ReadByte();
-        self.illusion = ReadShort();
-        if (!self.fade_start) {
-            self.fade_start = 50;
-        }
-        if (!self.fade_end) {
-            self.fade_end = 150;
-        }
-        if (!self.alpha_max) {
-            self.alpha_max = 1;
-        }
-       }
-       InterpolateOrigin_Note();
-
-       self.entremove = Ent_Antiwall_Remove;
-       self.draw = Ent_Antiwall_Draw;
-    self.predraw = Ent_Antiwall_PreDraw;
-}
-
diff --git a/qcsrc/client/antiwall.qh b/qcsrc/client/antiwall.qh
deleted file mode 100644 (file)
index 5ae5641..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef ANTIWALL_H
-#define ANTIWALL_H
-
-.int lodmodelindex0, lodmodelindex1, lodmodelindex2;
-.float loddistance1, loddistance2;
-.float inactive, alpha_max;
-.float fade_start, fade_end;
-.float illusion;
-
-void Ent_Antiwall_Draw();
-
-void Ent_Antiwall_Remove();
-
-void Ent_Antiwall();
-#endif
-
index b09724c80ae7948bd50c40dd10c704dd81069d5a..36ec4f7b8c2525c2712566410ae80be9977ab50f 100644 (file)
@@ -7,7 +7,6 @@
 #include "tturrets.qh"
 #include "tuba.qh"
 #include "wall.qh"
-#include "antiwall.qh"
 #include "waypointsprites.qh"
 
 #include "vehicles/vehicles.qh"
@@ -823,7 +822,6 @@ void CSQC_Ent_Update(float bIsNewEntity)
                case ENT_CLIENT_CLIENTDATA: Ent_ClientData(); break;
                case ENT_CLIENT_RANDOMSEED: Ent_RandomSeed(); break;
                case ENT_CLIENT_WALL: Ent_Wall(); break;
-               case ENT_CLIENT_ANTIWALL: Ent_Antiwall(); break;
                case ENT_CLIENT_MODELEFFECT: Ent_ModelEffect(bIsNewEntity); break;
                case ENT_CLIENT_TUBANOTE: Ent_TubaNote(bIsNewEntity); break;
                case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;
index 535f5084c50d5d6d29d306d0227124ab5af289de..f80da18d67309ace7482be0dd4ac37ac784cd1c0 100644 (file)
@@ -35,7 +35,6 @@ vehicles/vehicles.qc
 view.qc
 wall.qc
 waypointsprites.qc
-antiwall.qc
 
 command/cl_cmd.qc
 
index 1ae8fa85a311dccebaecdce7af6fd1216521d0b3..8ff162faaa16fb21407881ab2ae86422cd120c75 100644 (file)
@@ -1,5 +1,28 @@
 #include "wall.qh"
 
+void Ent_Wall_PreDraw()
+{
+    if (self.inactive) {
+        self.alpha = 0;
+    } else {
+        vector org;
+        org = getpropertyvec(VF_ORIGIN);
+        if(!checkpvs(org, self))
+            self.alpha = 0;
+        else if(self.fade_start) {
+            self.alpha = self.alpha_max / 100.0 * bound(0,
+                               (self.fade_end - vlen(org - self.origin - 0.5 * (self.mins + self.maxs)))
+                               / (self.fade_end - self.fade_start), 1);
+        } else {
+            self.alpha = 1;
+        }
+    }
+    if(self.alpha <= 0)
+        self.drawmask = 0;
+    else
+        self.drawmask = MASK_NORMAL;
+}
+
 void Ent_Wall_Draw()
 {
        float f;
@@ -164,6 +187,11 @@ void Ent_Wall()
                        self.movedir_z = ReadCoord();
                        self.lip = ReadByte() / 255.0;
                }
+        self.fade_start = ReadShort();
+        self.fade_end = ReadShort();
+        self.alpha_max = ReadShort();
+        self.alpha_min = ReadShort();
+        self.inactive = ReadShort();
                BGMScript_InitEntity(self);
        }
 
@@ -173,4 +201,5 @@ void Ent_Wall()
 
        self.entremove = Ent_Wall_Remove;
        self.draw = Ent_Wall_Draw;
+    self.predraw = Ent_Wall_PreDraw;
 }
index 984b54c88423d848bdc3356951f91d536aa0829a..85d025f81b4ce9328bfe31b806ffcc017eef2993 100644 (file)
@@ -7,6 +7,12 @@
 .float loddistance1, loddistance2;
 .vector saved;
 
+// Needed for dynamic clientwalls
+.float inactive; // Clientwall disappears when inactive
+.float alpha_max, alpha_min;
+.float fade_start, fade_end;
+.float default_solid; // Variable to store default self.solid for clientwalls
+
 void Ent_Wall_Draw();
 
 void Ent_Wall_Remove();
index d83e6262a48502293e4ea49acfff21a1665ff3af..45a65abbe96bd904bae1c3e93007637ba5d8b581 100644 (file)
@@ -78,7 +78,6 @@ const int ENT_CLIENT_ELIMINATEDPLAYERS = 39;
 const int ENT_CLIENT_TURRET = 40;
 const int ENT_CLIENT_AUXILIARYXHAIR = 50;
 const int ENT_CLIENT_VEHICLE = 60;
-const int ENT_CLIENT_ANTIWALL = 61;
 
 const int ENT_CLIENT_HEALING_ORB = 80;
 
diff --git a/qcsrc/server/antiwall.qc b/qcsrc/server/antiwall.qc
deleted file mode 100644 (file)
index f0d9641..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-#if defined(CSQC)
-#elif defined(MENUQC)
-#elif defined(SVQC)
-       #include "../dpdefs/progsdefs.qh"
-    #include "../dpdefs/dpextensions.qh"
-    #include "../common/constants.qh"
-    #include "autocvars.qh"
-    #include "constants.qh"
-    #include "defs.qh"
-    #include "../csqcmodellib/sv_model.qh"
-#endif
-
-void antiwall_setcolormaptoactivator (void)
-{
-       g_model_setcolormaptoactivator();
-       self.SendFlags |= 9;
-}
-
-void antiwall_dropbyspawnflags()
-{
-       vector o0;
-       o0 = self.origin;
-       g_model_dropbyspawnflags();
-       if(self.origin != o0)
-               self.SendFlags |= 2;
-}
-
-float antiwall_genericsendentity (entity to, float sf)
-{
-       sf = sf & 0x0F;
-       if(self.angles != '0 0 0')
-               sf |= 0x10;
-       if(self.mins != '0 0 0' || self.maxs != '0 0 0')
-               sf |= 0x20;
-       if(self.colormap != 0)
-               sf |= 0x40;
-       if(self.lodmodelindex1)
-               sf |= 0x80;
-
-       WriteByte(MSG_ENTITY, ENT_CLIENT_ANTIWALL);
-       WriteByte(MSG_ENTITY, sf);
-
-    if (!self.illusion) {
-        if (self.inactive) {
-            self.solid = SOLID_NOT;
-        } else {
-            self.solid = SOLID_BSP;
-        }
-    } else {
-        self.solid = SOLID_NOT;
-    }
-
-       if(sf & 1)
-       {
-               if(sf & 0x40)
-                       WriteShort(MSG_ENTITY, self.colormap);
-       }
-
-       if(sf & 2)
-       {
-               WriteCoord(MSG_ENTITY, self.origin_x);
-               WriteCoord(MSG_ENTITY, self.origin_y);
-               WriteCoord(MSG_ENTITY, self.origin_z);
-       }
-
-       if(sf & 4)
-       {
-               if(sf & 0x10)
-               {
-                       WriteAngle(MSG_ENTITY, self.angles_x);
-                       WriteAngle(MSG_ENTITY, self.angles_y);
-                       WriteAngle(MSG_ENTITY, self.angles_z);
-               }
-       }
-
-       if(sf & 8)
-       {
-               if(sf & 0x80)
-               {
-                       WriteShort(MSG_ENTITY, self.lodmodelindex0);
-                       WriteShort(MSG_ENTITY, bound(0, self.loddistance1, 65535));
-                       WriteShort(MSG_ENTITY, self.lodmodelindex1);
-                       WriteShort(MSG_ENTITY, bound(0, self.loddistance2, 65535));
-                       WriteShort(MSG_ENTITY, self.lodmodelindex2);
-               } else {
-                       WriteShort(MSG_ENTITY, self.modelindex);
-        }
-               WriteShort(MSG_ENTITY, floor(self.scale * 256));
-               if(sf & 0x20)
-               {
-                       WriteCoord(MSG_ENTITY, self.mins_x);
-                       WriteCoord(MSG_ENTITY, self.mins_y);
-                       WriteCoord(MSG_ENTITY, self.mins_z);
-                       WriteCoord(MSG_ENTITY, self.maxs_x);
-                       WriteCoord(MSG_ENTITY, self.maxs_y);
-                       WriteCoord(MSG_ENTITY, self.maxs_z);
-               }
-        WriteShort(MSG_ENTITY, self.fade_start);
-        WriteShort(MSG_ENTITY, self.fade_end);
-        WriteShort(MSG_ENTITY, self.alpha_max);
-        WriteShort(MSG_ENTITY, self.inactive);
-        WriteByte(MSG_ENTITY, self.solid);
-        WriteShort(MSG_ENTITY, self.illusion);
-        /*printf("called\n");*/
-       }
-
-       return TRUE;
-}
-
-void spawnfunc_func_antiwall() {
-    if (self.geomtype) {
-        if (autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) {
-            self.movetype = MOVETYPE_PHYSICS;
-        }
-    }
-    if (!self.scale) { self.scale = self.modelscale; }
-    SetBrushEntityModel();
-    self.use = antiwall_setcolormaptoactivator;
-    InitializeEntity(self, antiwall_dropbyspawnflags, INITPRIO_DROPTOFLOOR);
-    if (self.illusion) {
-        self.solid = SOLID_NOT;
-    } else {
-        self.solid = SOLID_BSP;
-    }
-    Net_LinkEntity(self, TRUE, 0, antiwall_genericsendentity);
-}
index 2802a95697a136063a88b1e9d875981c83c1969a..f0a9d2f4e8b5e978ba3ec7885243ab228b782277 100644 (file)
@@ -81,6 +81,13 @@ float server_is_dedicated;
 .string  platmovetype;
 .float platmovetype_start, platmovetype_end;
 
+
+// Needed for dynamic clientwalls
+.float inactive; // Clientwall disappears when inactive
+.float alpha_max, alpha_min;
+.float fade_start, fade_end;
+.float default_solid; // Variable to store default self.solid for clientwalls
+
 .string killtarget;
 
 .vector        pos1, pos2;
@@ -627,7 +634,4 @@ const int MIF_GUIDED_TAG = 128;
 .float init_for_player_needed;
 .void(entity) init_for_player;
 
-.float fade_start, fade_end;
-.float inactive, alpha_max;
-
 #endif
index 6e1c06d056f2eb5bf3306240042ad3b933af56bc..cd25c53ef444cc925e52f0e03568b6a8dc2a4935 100644 (file)
@@ -29,7 +29,12 @@ void g_model_setcolormaptoactivator (void)
 void g_clientmodel_setcolormaptoactivator (void)
 {
        g_model_setcolormaptoactivator();
-       self.SendFlags |= 1;
+       self.SendFlags |= 9;
+}
+
+void g_clientmodel_use(void)
+{
+    g_clientmodel_setcolormaptoactivator();
 }
 
 void g_model_dropbyspawnflags()
@@ -65,7 +70,7 @@ float g_clientmodel_genericsendentity (entity to, float sf)
        sf = sf & 0x0F;
        if(self.angles != '0 0 0')
                sf |= 0x10;
-       if(self.solid && (self.mins != '0 0 0' || self.maxs != '0 0 0'))
+       if(self.mins != '0 0 0' || self.maxs != '0 0 0')
                sf |= 0x20;
        if(self.colormap != 0)
                sf |= 0x40;
@@ -133,6 +138,11 @@ float g_clientmodel_genericsendentity (entity to, float sf)
                        WriteCoord(MSG_ENTITY, self.movedir.z);
                        WriteByte(MSG_ENTITY, floor(self.lip * 255));
                }
+        WriteShort(MSG_ENTITY, self.fade_start);
+        WriteShort(MSG_ENTITY, self.fade_end);
+        WriteShort(MSG_ENTITY, self.alpha_max);
+        WriteShort(MSG_ENTITY, self.alpha_min);
+        WriteShort(MSG_ENTITY, self.inactive);
        }
 
        return true;
@@ -151,11 +161,12 @@ float g_clientmodel_genericsendentity (entity to, float sf)
        if(self.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) self.movetype = MOVETYPE_PHYSICS; \
        if(!self.scale) self.scale = self.modelscale; \
        SetBrushEntityModel(); \
-       self.use = g_clientmodel_setcolormaptoactivator; \
+       self.use = g_clientmodel_use; \
        InitializeEntity(self, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
        if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT; \
        if(!self.bgmscriptsustain) self.bgmscriptsustain = 1; else if(self.bgmscriptsustain < 0) self.bgmscriptsustain = 0; \
-       Net_LinkEntity(self, true, 0, g_clientmodel_genericsendentity);
+       Net_LinkEntity(self, true, 0, g_clientmodel_genericsendentity); \
+    self.default_solid = sol;
 
 // non-solid model entities:
 void spawnfunc_misc_gamemodel()         { self.angles_x = -self.angles.x; G_MODEL_INIT      (SOLID_NOT) } // model entity
index 101e1767752daa9befd04ff53480f64e17fe95a2..6851f2942b0ab56717a77eb59d47d887363a2d8d 100644 (file)
@@ -103,9 +103,9 @@ void SUB_UseTargets()
                }
                if (s != "")
                {
-            // Flag to set antiwall state
+            // Flag to set func_clientwall state
             // 1 == deactivate, 2 == activate, 0 == do nothing
-            float aw_inactive = self.antiwall_flag;
+            float aw_inactive = self.clientwall_flag;
                        for(t = world; (t = find(t, targetname, s)); )
                        if(t.use)
                        {
@@ -115,19 +115,16 @@ void SUB_UseTargets()
                                }
                                else
                                {
-                    if (t.classname == "func_antiwall") {
+                    if (t.classname == "func_clientwall" || t.classname == "func_clientillusionary") {
                         if (aw_inactive == 1) {
                             t.inactive = 1;
-                            if (!t.illusion) {
-                                t.solid = SOLID_BSP;
-                            }
                         } else if (aw_inactive == 2) {
                             t.inactive = 0;
-                            if (t.illusion) {
-                                t.solid = SOLID_NOT;
-                            } else {
-                                t.solid = SOLID_BSP;
-                            }
+                        }
+                        if (t.inactive) {
+                            t.solid = SOLID_NOT;
+                        } else {
+                            t.solid = t.default_solid;
                         }
                     }
                                        self = t;
index 300a87a81c889933f6d14327276fa1300419f7b4..12b57cbf433447f933d4068228f77078f6639416 100644 (file)
@@ -386,9 +386,7 @@ void spawnfunc_target_changelevel_use();
 
 void spawnfunc_target_changelevel();
 
-.float antiwall_flag; // Variable to define what to do with func_antiwall
+.float clientwall_flag; // Variable to define what to do with func_clientwall
 // 0 == do nothing, 1 == deactivate, 2 == activate
 
-.float illusion; // If not 0, func_antiwall will be non-solid
-
 #endif
index 2f01d82e16d4a13d6bda8c706156deedad88aa67..85e75cda9e2fce18b2f2715b0bd1c10e8452b7bb 100644 (file)
@@ -59,7 +59,6 @@ t_quake.qc
 t_swamp.qc
 t_teleporters.qc
 waypointsprites.qc
-antiwall.qc
 
 bot/bot.qc