From a2bf39708c6e91aac45471af56c07942ac12646c Mon Sep 17 00:00:00 2001 From: Penguinum Date: Fri, 24 Apr 2015 16:36:42 +0300 Subject: [PATCH] Looks like everything works now --- qcsrc/client/antiwall.qc | 27 +----------------------- qcsrc/client/antiwall.qh | 1 + qcsrc/server/antiwall.qc | 43 +++++++++++++++++++++++--------------- qcsrc/server/g_triggers.qc | 18 ++++++++++++++++ qcsrc/server/g_triggers.qh | 6 ++++++ 5 files changed, 52 insertions(+), 43 deletions(-) diff --git a/qcsrc/client/antiwall.qc b/qcsrc/client/antiwall.qc index e333eef64..1005cdeee 100644 --- a/qcsrc/client/antiwall.qc +++ b/qcsrc/client/antiwall.qc @@ -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; } diff --git a/qcsrc/client/antiwall.qh b/qcsrc/client/antiwall.qh index 9d96c70dd..25e380d32 100644 --- a/qcsrc/client/antiwall.qh +++ b/qcsrc/client/antiwall.qh @@ -8,6 +8,7 @@ .vector saved; .float inactive, alpha_max; .float fade_start, fade_end; +.float illusion; void Ent_Antiwall_Draw(); diff --git a/qcsrc/server/antiwall.qc b/qcsrc/server/antiwall.qc index 2153cf2f4..05f0a1d8f 100644 --- a/qcsrc/server/antiwall.qc +++ b/qcsrc/server/antiwall.qc @@ -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); +} diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index e0df85042..101e17677 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -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; diff --git a/qcsrc/server/g_triggers.qh b/qcsrc/server/g_triggers.qh index 68bf1575b..300a87a81 100644 --- a/qcsrc/server/g_triggers.qh +++ b/qcsrc/server/g_triggers.qh @@ -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 -- 2.39.2