]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Looks like everything works now
authorPenguinum <penguinum@gmail.com>
Fri, 24 Apr 2015 13:36:42 +0000 (16:36 +0300)
committerPenguinum <penguinum@gmail.com>
Fri, 24 Apr 2015 13:36:42 +0000 (16:36 +0300)
qcsrc/client/antiwall.qc
qcsrc/client/antiwall.qh
qcsrc/server/antiwall.qc
qcsrc/server/g_triggers.qc
qcsrc/server/g_triggers.qh

index e333eef6416eed7c6fb26092a8160af7ab5fffe1..1005cdeeed09e0e9d8a0336f4bcb0f2c79846f6a 100644 (file)
@@ -26,13 +26,6 @@ void Ent_Antiwall_PreDraw()
 void Ent_Antiwall_Draw()
 {
        float f;
-       var .vector fld;
-
-       if(self.bgmscriptangular)
-               fld = angles;
-       else
-               fld = origin;
-       self.fld = self.saved;
 
        if(self.lodmodelindex1)
        {
@@ -60,25 +53,6 @@ void Ent_Antiwall_Draw()
        }
 
        InterpolateOrigin_Do();
-
-       self.saved = self.fld;
-
-       f = BGMScript(self);
-       if(f >= 0)
-       {
-               if(self.lip < 0) // < 0: alpha goes from 1 to 1-|lip| when toggled (toggling subtracts lip)
-                       self.alpha = 1 + self.lip * f;
-               else // > 0: alpha goes from 1-|lip| to 1 when toggled (toggling adds lip)
-                       self.alpha = 1 - self.lip * (1 - f);
-               self.fld = self.fld + self.movedir * f;
-       }
-       else
-               self.alpha = 1;
-
-       if(self.alpha >= ALPHA_MIN_VISIBLE)
-               self.drawmask = MASK_NORMAL;
-       else
-               self.drawmask = 0;
 }
 
 void Ent_Antiwall_Remove()
@@ -192,6 +166,7 @@ void Ent_Antiwall()
         self.alpha_max = ReadShort();
         self.inactive = ReadShort();
         self.solid = ReadByte();
+        self.illusion = ReadShort();
         if (!self.fade_start) {
             self.fade_start = 50;
         }
index 9d96c70dd06adee0a7f1918de559fe2b094d0973..25e380d32afe03e80697117c1fd191595f5c0e73 100644 (file)
@@ -8,6 +8,7 @@
 .vector saved;
 .float inactive, alpha_max;
 .float fade_start, fade_end;
+.float illusion;
 
 void Ent_Antiwall_Draw();
 
index 2153cf2f4ac556587f009eff76a12edbf20bf20e..05f0a1d8ffb56bd55da3c287fd9edc813aae3742 100644 (file)
@@ -30,7 +30,7 @@ float antiwall_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;
@@ -40,10 +40,14 @@ float antiwall_genericsendentity (entity to, float sf)
        WriteByte(MSG_ENTITY, ENT_CLIENT_ANTIWALL);
        WriteByte(MSG_ENTITY, sf);
 
-    if (self.inactive) {
-        self.solid = SOLID_NOT;
+    if (!self.illusion) {
+        if (self.inactive) {
+            self.solid = SOLID_NOT;
+        } else {
+            self.solid = SOLID_BSP;
+        }
     } else {
-        self.solid = SOLID_BSP;
+        self.solid = SOLID_NOT;
     }
 
        if(sf & 1)
@@ -108,22 +112,27 @@ float antiwall_genericsendentity (entity to, float sf)
         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;
 }
 
-#define ANTIWALL_INIT(sol) \
-       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.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, antiwall_genericsendentity);
-
-void spawnfunc_func_antiwall() { ANTIWALL_INIT(SOLID_BSP) } // Solid dynamic entity
-void spawnfunc_func_antiillusion() { ANTIWALL_INIT(SOLID_NOT) } // Non-solid dynamic entity
-void spawnfunc_aw() { ANTIWALL_INIT(SOLID_BSP) } // Solid dynamic entity
+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 e0df85042c1bf9a9619d171a222deda9216eb3c9..101e1767752daa9befd04ff53480f64e17fe95a2 100644 (file)
@@ -103,6 +103,9 @@ void SUB_UseTargets()
                }
                if (s != "")
                {
+            // Flag to set antiwall state
+            // 1 == deactivate, 2 == activate, 0 == do nothing
+            float aw_inactive = self.antiwall_flag;
                        for(t = world; (t = find(t, targetname, s)); )
                        if(t.use)
                        {
@@ -112,6 +115,21 @@ void SUB_UseTargets()
                                }
                                else
                                {
+                    if (t.classname == "func_antiwall") {
+                        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;
+                            }
+                        }
+                    }
                                        self = t;
                                        other = stemp;
                                        activator = act;
index 68bf1575b1edf08428e5ccd259b9e3c1ac9de61b..300a87a81c889933f6d14327276fa1300419f7b4 100644 (file)
@@ -385,4 +385,10 @@ void spawnfunc_relay_activatetoggle();
 void spawnfunc_target_changelevel_use();
 
 void spawnfunc_target_changelevel();
+
+.float antiwall_flag; // Variable to define what to do with func_antiwall
+// 0 == do nothing, 1 == deactivate, 2 == activate
+
+.float illusion; // If not 0, func_antiwall will be non-solid
+
 #endif