+++ /dev/null
-#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;
-}
-
+++ /dev/null
-#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
-
#include "tturrets.qh"
#include "tuba.qh"
#include "wall.qh"
-#include "antiwall.qh"
#include "waypointsprites.qh"
#include "vehicles/vehicles.qh"
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;
view.qc
wall.qc
waypointsprites.qc
-antiwall.qc
command/cl_cmd.qc
#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;
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);
}
self.entremove = Ent_Wall_Remove;
self.draw = Ent_Wall_Draw;
+ self.predraw = Ent_Wall_PreDraw;
}
.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();
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;
+++ /dev/null
-#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);
-}
.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;
.float init_for_player_needed;
.void(entity) init_for_player;
-.float fade_start, fade_end;
-.float inactive, alpha_max;
-
#endif
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()
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;
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;
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
}
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)
{
}
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;
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
t_swamp.qc
t_teleporters.qc
waypointsprites.qc
-antiwall.qc
bot/bot.qc