]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Antiwall works, need to modify triggers
authorPenguinum <penguinum@gmail.com>
Thu, 23 Apr 2015 12:03:15 +0000 (15:03 +0300)
committerPenguinum <penguinum@gmail.com>
Thu, 23 Apr 2015 12:03:15 +0000 (15:03 +0300)
qcsrc/client/antiwall.qc
qcsrc/client/main.qc
qcsrc/server/antiwall.qc [new file with mode: 0644]
qcsrc/server/defs.qh
qcsrc/server/progs.src

index 87300b75ce0cd3d6c640d8e743ba05e0d9b18eb6..e333eef6416eed7c6fb26092a8160af7ab5fffe1 100644 (file)
@@ -90,7 +90,7 @@ void Ent_Antiwall_Remove()
 
 void Ent_Antiwall()
 {
-       int f;
+       float f;
        var .vector fld;
 
        InterpolateOrigin_Undo();
@@ -148,7 +148,6 @@ void Ent_Antiwall()
                        self.loddistance1 = 0;
                        self.loddistance2 = 0;
                }
-               self.solid = ReadByte();
                self.scale = ReadShort() / 256.0;
                if(f & 0x20)
                {
@@ -187,14 +186,29 @@ void Ent_Antiwall()
                        self.movedir_z = ReadCoord();
                        self.lip = ReadByte() / 255.0;
                }
+
+        self.fade_start = ReadShort();
+        self.fade_end = ReadShort();
+        self.alpha_max = ReadShort();
+        self.inactive = ReadShort();
+        self.solid = ReadByte();
+        if (!self.fade_start) {
+            self.fade_start = 50;
+        }
+        if (!self.fade_end) {
+            self.fade_end = 150;
+        }
+        if (!self.alpha_max) {
+            self.alpha_max = 1;
+        }
                BGMScript_InitEntity(self);
        }
-
        InterpolateOrigin_Note();
 
        self.saved = self.fld;
 
        self.entremove = Ent_Antiwall_Remove;
        self.draw = Ent_Antiwall_Draw;
+    self.predraw = Ent_Antiwall_PreDraw;
 }
 
index 36ec4f7b8c2525c2712566410ae80be9977ab50f..b09724c80ae7948bd50c40dd10c704dd81069d5a 100644 (file)
@@ -7,6 +7,7 @@
 #include "tturrets.qh"
 #include "tuba.qh"
 #include "wall.qh"
+#include "antiwall.qh"
 #include "waypointsprites.qh"
 
 #include "vehicles/vehicles.qh"
@@ -822,6 +823,7 @@ 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;
diff --git a/qcsrc/server/antiwall.qc b/qcsrc/server/antiwall.qc
new file mode 100644 (file)
index 0000000..2153cf2
--- /dev/null
@@ -0,0 +1,129 @@
+#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.solid && (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.inactive) {
+        self.solid = SOLID_NOT;
+    } else {
+        self.solid = SOLID_BSP;
+    }
+
+       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);
+               }
+               WriteString(MSG_ENTITY, self.bgmscript);
+               if(self.bgmscript != "")
+               {
+                       WriteByte(MSG_ENTITY, floor(self.bgmscriptattack * 64));
+                       WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 64));
+                       WriteByte(MSG_ENTITY, floor(self.bgmscriptsustain * 255));
+                       WriteByte(MSG_ENTITY, floor(self.bgmscriptrelease * 64));
+                       WriteCoord(MSG_ENTITY, self.movedir_x);
+                       WriteCoord(MSG_ENTITY, self.movedir_y);
+                       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.inactive);
+        WriteByte(MSG_ENTITY, self.solid);
+        /*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
index 7c26399af795ea52da147dd675574140b1f186f9..2802a95697a136063a88b1e9d875981c83c1969a 100644 (file)
@@ -627,4 +627,7 @@ 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 85e75cda9e2fce18b2f2715b0bd1c10e8452b7bb..2f01d82e16d4a13d6bda8c706156deedad88aa67 100644 (file)
@@ -59,6 +59,7 @@ t_quake.qc
 t_swamp.qc
 t_teleporters.qc
 waypointsprites.qc
+antiwall.qc
 
 bot/bot.qc