#include <common/net_linked.qh>
#include <common/net_notice.qh>
#include <common/scores.qh>
-#include <common/mapobjects/include.qh>
+#include <common/mapobjects/_mod.qh>
#include <common/vehicles/all.qh>
#include <lib/csqcmodel/cl_model.qh>
#include <lib/csqcmodel/interpolate.qh>
#ifdef GAMEQC
#include "physics/all.inc"
-#include "mapobjects/include.qc"
+#include "mapobjects/_mod.inc"
#include "viewloc.qc"
#endif
// generated file; do not modify
-#include <common/mapobjects/include.qc>
+#include <common/mapobjects/models.qc>
#include <common/mapobjects/platforms.qc>
#include <common/mapobjects/subs.qc>
#include <common/mapobjects/teleporters.qc>
// generated file; do not modify
-#include <common/mapobjects/include.qh>
+#include <common/mapobjects/models.qh>
#include <common/mapobjects/platforms.qh>
#include <common/mapobjects/subs.qh>
#include <common/mapobjects/teleporters.qh>
#include <common/mapobjects/func/door_rotating.qc>
#include <common/mapobjects/func/door_secret.qc>
#include <common/mapobjects/func/fourier.qc>
-#include <common/mapobjects/func/include.qc>
#include <common/mapobjects/func/ladder.qc>
#include <common/mapobjects/func/pendulum.qc>
#include <common/mapobjects/func/plat.qc>
#include <common/mapobjects/func/door_rotating.qh>
#include <common/mapobjects/func/door_secret.qh>
#include <common/mapobjects/func/fourier.qh>
-#include <common/mapobjects/func/include.qh>
#include <common/mapobjects/func/ladder.qh>
#include <common/mapobjects/func/pendulum.qh>
#include <common/mapobjects/func/plat.qh>
+++ /dev/null
-#include "include.qh"
-
-#include "bobbing.qc"
-#include "breakable.qc"
-#include "button.qc"
-#include "conveyor.qc"
-#include "door.qc"
-#include "door_rotating.qc"
-#include "door_secret.qc"
-#include "fourier.qc"
-#include "ladder.qc"
-#include "pendulum.qc"
-#include "plat.qc"
-#include "pointparticles.qc"
-#include "rainsnow.qc"
-#include "rotating.qc"
-#include "stardust.qc"
-#include "train.qc"
-#include "vectormamamam.qc"
+++ /dev/null
-#pragma once
-
-#include "door.qh"
-#include "ladder.qh"
-#include "train.qh"
+++ /dev/null
-#include "include.qh"
-
-// some required common stuff
-#include "subs.qc"
-#include "triggers.qc"
-#include "platforms.qc"
-#include "teleporters.qc"
-
-// func
-#include "func/include.qc"
-
-// misc
-#include "misc/include.qc"
-
-// target
-#include "target/include.qc"
-
-// trigger
-#include "trigger/include.qc"
-
+++ /dev/null
-#pragma once
-
-// some required common stuff
-#ifdef SVQC
- #include <server/item_key.qh>
-#endif
-#include "triggers.qh"
-#include "subs.qh"
-#include "platforms.qh"
-#include "teleporters.qh"
-
-// func
-#include "func/include.qh"
-
-// target
-#include "target/include.qh"
-
-// trigger
-#include "trigger/include.qh"
// generated file; do not modify
#include <common/mapobjects/misc/corner.qc>
#include <common/mapobjects/misc/follow.qc>
-#include <common/mapobjects/misc/include.qc>
#include <common/mapobjects/misc/laser.qc>
#include <common/mapobjects/misc/teleport_dest.qc>
// generated file; do not modify
#include <common/mapobjects/misc/corner.qh>
#include <common/mapobjects/misc/follow.qh>
-#include <common/mapobjects/misc/include.qh>
#include <common/mapobjects/misc/laser.qh>
#include <common/mapobjects/misc/teleport_dest.qh>
+++ /dev/null
-#include "include.qh"
-#include "corner.qc"
-#include "follow.qc"
-#include "laser.qc"
-#include "teleport_dest.qc"
+++ /dev/null
-#pragma once
--- /dev/null
+#include "models.qh"
+
+#ifdef SVQC
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <server/g_subs.qh>
+#include <common/net_linked.qh>
+#include "subs.qh"
+#include "triggers.qh"
+
+entityclass(BGMScript);
+classfield(BGMScript) .string bgmscript;
+classfield(BGMScript) .float bgmscriptattack;
+classfield(BGMScript) .float bgmscriptdecay;
+classfield(BGMScript) .float bgmscriptsustain;
+classfield(BGMScript) .float bgmscriptrelease;
+
+#include <common/constants.qh>
+#include "../../lib/csqcmodel/sv_model.qh"
+
+.float modelscale;
+
+void g_model_setcolormaptoactivator(entity this, entity actor, entity trigger)
+{
+ if(teamplay)
+ {
+ if(actor.team)
+ this.colormap = (actor.team - 1) * 0x11;
+ else
+ this.colormap = 0x00;
+ }
+ else
+ this.colormap = floor(random() * 256);
+ this.colormap |= BIT(10); // RENDER_COLORMAPPED
+}
+
+void g_clientmodel_setcolormaptoactivator(entity this, entity actor, entity trigger)
+{
+ g_model_setcolormaptoactivator(this, actor, trigger);
+ this.SendFlags |= (BIT(3) | BIT(0));
+}
+
+void g_clientmodel_use(entity this, entity actor, entity trigger)
+{
+ if (this.antiwall_flag == 1)
+ {
+ this.inactive = 1;
+ this.solid = SOLID_NOT;
+ }
+ else if (this.antiwall_flag == 2)
+ {
+ this.inactive = 0;
+ this.solid = this.default_solid;
+ }
+ g_clientmodel_setcolormaptoactivator(this, actor, trigger);
+}
+
+void g_model_dropbyspawnflags(entity this)
+{
+ if((this.spawnflags & 3) == 1) // ALIGN_ORIGIN
+ {
+ traceline(this.origin, this.origin - '0 0 4096', MOVE_NOMONSTERS, this);
+ setorigin(this, trace_endpos);
+ }
+ else if((this.spawnflags & 3) == 2) // ALIGN_BOTTOM
+ {
+ tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 4096', MOVE_NOMONSTERS, this);
+ setorigin(this, trace_endpos);
+ }
+ else if((this.spawnflags & 3) == 3) // ALIGN_ORIGIN | ALIGN_BOTTOM
+ {
+ traceline(this.origin, this.origin - '0 0 4096', MOVE_NOMONSTERS, this);
+ setorigin(this, trace_endpos - '0 0 1' * this.mins.z);
+ }
+}
+
+void g_clientmodel_dropbyspawnflags(entity this)
+{
+ vector o0;
+ o0 = this.origin;
+ g_model_dropbyspawnflags(this);
+ if(this.origin != o0)
+ this.SendFlags |= 2;
+}
+
+bool g_clientmodel_genericsendentity(entity this, entity to, int sf)
+{
+ sf = sf & 0x0F;
+ if(this.angles != '0 0 0')
+ sf |= 0x10;
+ if(this.mins != '0 0 0' || this.maxs != '0 0 0')
+ sf |= 0x20;
+ if(this.colormap != 0)
+ sf |= 0x40;
+ if(this.lodmodelindex1)
+ sf |= 0x80;
+
+ WriteHeader(MSG_ENTITY, ENT_CLIENT_WALL);
+ WriteByte(MSG_ENTITY, sf);
+
+ if(sf & BIT(0))
+ {
+ if(sf & 0x40)
+ WriteShort(MSG_ENTITY, this.colormap);
+ WriteByte(MSG_ENTITY, this.skin);
+ }
+
+ if(sf & BIT(1))
+ {
+ WriteVector(MSG_ENTITY, this.origin);
+ }
+
+ if(sf & BIT(2))
+ {
+ if(sf & 0x10)
+ {
+ WriteAngle(MSG_ENTITY, this.angles.x);
+ WriteAngle(MSG_ENTITY, this.angles.y);
+ WriteAngle(MSG_ENTITY, this.angles.z);
+ }
+ }
+
+ if(sf & BIT(3))
+ {
+ if(sf & 0x80)
+ {
+ WriteShort(MSG_ENTITY, this.lodmodelindex0);
+ WriteShort(MSG_ENTITY, bound(0, this.loddistance1, 65535));
+ WriteShort(MSG_ENTITY, this.lodmodelindex1);
+ WriteShort(MSG_ENTITY, bound(0, this.loddistance2, 65535));
+ WriteShort(MSG_ENTITY, this.lodmodelindex2);
+ }
+ else
+ WriteShort(MSG_ENTITY, this.modelindex);
+ WriteByte(MSG_ENTITY, this.solid);
+ WriteShort(MSG_ENTITY, floor(this.scale * 256));
+ if(sf & 0x20)
+ {
+ WriteVector(MSG_ENTITY, this.mins);
+ WriteVector(MSG_ENTITY, this.maxs);
+ }
+ WriteString(MSG_ENTITY, this.bgmscript);
+ if(this.bgmscript != "")
+ {
+ WriteByte(MSG_ENTITY, floor(this.bgmscriptattack * 64));
+ WriteByte(MSG_ENTITY, floor(this.bgmscriptdecay * 64));
+ WriteByte(MSG_ENTITY, floor(this.bgmscriptsustain * 255));
+ WriteByte(MSG_ENTITY, floor(this.bgmscriptrelease * 64));
+ WriteVector(MSG_ENTITY, this.movedir);
+ WriteByte(MSG_ENTITY, floor(this.lip * 255));
+ }
+ WriteByte(MSG_ENTITY, this.fade_start);
+ WriteByte(MSG_ENTITY, this.fade_end);
+ WriteByte(MSG_ENTITY, this.alpha_max);
+ WriteByte(MSG_ENTITY, this.alpha_min);
+ WriteByte(MSG_ENTITY, this.inactive);
+ WriteShort(MSG_ENTITY, this.fade_vertical_offset);
+ }
+
+ return true;
+}
+
+
+#define G_MODEL_INIT(ent,sol) \
+ if(ent.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
+ if(!ent.scale) ent.scale = ent.modelscale; \
+ SetBrushEntityModel(ent); \
+ ent.use = g_model_setcolormaptoactivator; \
+ InitializeEntity(ent, g_model_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
+ if(!ent.solid) ent.solid = (sol); else if(ent.solid < 0) ent.solid = SOLID_NOT;
+
+#define G_CLIENTMODEL_INIT(ent,sol) \
+ if(ent.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
+ if(!ent.scale) ent.scale = ent.modelscale; \
+ SetBrushEntityModel(ent); \
+ ent.use = g_clientmodel_use; \
+ InitializeEntity(ent, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
+ if(!ent.solid) ent.solid = (sol); else if(ent.solid < 0) ent.solid = SOLID_NOT; \
+ if(!ent.bgmscriptsustain) ent.bgmscriptsustain = 1; else if(ent.bgmscriptsustain < 0) ent.bgmscriptsustain = 0; \
+ Net_LinkEntity(ent, true, 0, g_clientmodel_genericsendentity); \
+ ent.default_solid = sol;
+
+// non-solid model entities:
+spawnfunc(misc_gamemodel) { this.angles_x = -this.angles.x; G_MODEL_INIT (this, SOLID_NOT) } // model entity
+spawnfunc(misc_clientmodel) { this.angles_x = -this.angles.x; G_CLIENTMODEL_INIT(this, SOLID_NOT) } // model entity
+spawnfunc(misc_models) { this.angles_x = -this.angles.x; G_MODEL_INIT (this, SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use
+
+// non-solid brush entities:
+spawnfunc(func_illusionary) { G_MODEL_INIT (this, SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED)
+spawnfunc(func_clientillusionary) { G_CLIENTMODEL_INIT(this, SOLID_NOT) } // brush entity
+spawnfunc(func_static) { G_MODEL_INIT (this, SOLID_NOT) } // DEPRECATED old alias name from some other game
+
+// solid brush entities
+spawnfunc(func_wall) { G_MODEL_INIT (this, SOLID_BSP) } // Q1 name
+spawnfunc(func_clientwall) { G_CLIENTMODEL_INIT(this, SOLID_BSP) } // brush entity (WARNING: MISPREDICTED)
+#endif
--- /dev/null
+#pragma once
void SUB_CalcMoveDone(entity this);
void SUB_CalcAngleMoveDone(entity this);
+#ifdef SVQC
+spawnfunc(info_null)
+{
+ delete(this);
+ // if anything breaks, tell the mapper to fix his map! info_null is meant to remove itself immediately.
+}
+#endif
+
/*
==================
SUB_Friction
controller.destvec2 = '0 0 0';
}
-float TSPEED_TIME = -1;
-float TSPEED_LINEAR = 0;
-float TSPEED_START = 1;
-float TSPEED_END = 2;
-// TODO average too?
-
void SUB_CalcMove_Bezier (entity this, vector tcontrol, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
{
float traveltime;
{
SUB_CalcAngleMove (ent, destangle, tspeedtype, tspeed, func);
}
+
+#ifdef SVQC
+void ApplyMinMaxScaleAngles(entity e)
+{
+ if(e.angles.x != 0 || e.angles.z != 0 || e.avelocity.x != 0 || e.avelocity.z != 0) // "weird" rotation
+ {
+ e.maxs = '1 1 1' * vlen(
+ '1 0 0' * max(-e.mins.x, e.maxs.x) +
+ '0 1 0' * max(-e.mins.y, e.maxs.y) +
+ '0 0 1' * max(-e.mins.z, e.maxs.z)
+ );
+ e.mins = -e.maxs;
+ }
+ else if(e.angles.y != 0 || e.avelocity.y != 0) // yaw only is a bit better
+ {
+ e.maxs_x = vlen(
+ '1 0 0' * max(-e.mins.x, e.maxs.x) +
+ '0 1 0' * max(-e.mins.y, e.maxs.y)
+ );
+ e.maxs_y = e.maxs.x;
+ e.mins_x = -e.maxs.x;
+ e.mins_y = -e.maxs.x;
+ }
+ if(e.scale)
+ setsize(e, e.mins * e.scale, e.maxs * e.scale);
+ else
+ setsize(e, e.mins, e.maxs);
+}
+
+void SetBrushEntityModel(entity this)
+{
+ if(this.model != "")
+ {
+ precache_model(this.model);
+ if(this.mins != '0 0 0' || this.maxs != '0 0 0')
+ {
+ vector mi = this.mins;
+ vector ma = this.maxs;
+ _setmodel(this, this.model); // no precision needed
+ setsize(this, mi, ma);
+ }
+ else
+ _setmodel(this, this.model); // no precision needed
+ InitializeEntity(this, LODmodel_attach, INITPRIO_FINDTARGET);
+ }
+ setorigin(this, this.origin);
+ ApplyMinMaxScaleAngles(this);
+}
+
+void SetBrushEntityModelNoLOD(entity this)
+{
+ if(this.model != "")
+ {
+ precache_model(this.model);
+ if(this.mins != '0 0 0' || this.maxs != '0 0 0')
+ {
+ vector mi = this.mins;
+ vector ma = this.maxs;
+ _setmodel(this, this.model); // no precision needed
+ setsize(this, mi, ma);
+ }
+ else
+ _setmodel(this, this.model); // no precision needed
+ }
+ setorigin(this, this.origin);
+ ApplyMinMaxScaleAngles(this);
+}
+
+/*
+================
+InitTrigger
+================
+*/
+
+void SetMovedir(entity this)
+{
+ if(this.movedir != '0 0 0')
+ this.movedir = normalize(this.movedir);
+ else
+ {
+ makevectors(this.angles);
+ this.movedir = v_forward;
+ }
+
+ this.angles = '0 0 0';
+}
+
+void InitTrigger(entity this)
+{
+// trigger angles are used for one-way touches. An angle of 0 is assumed
+// to mean no restrictions, so use a yaw of 360 instead.
+ SetMovedir(this);
+ this.solid = SOLID_TRIGGER;
+ SetBrushEntityModel(this);
+ set_movetype(this, MOVETYPE_NONE);
+ this.modelindex = 0;
+ this.model = "";
+}
+
+void InitSolidBSPTrigger(entity this)
+{
+// trigger angles are used for one-way touches. An angle of 0 is assumed
+// to mean no restrictions, so use a yaw of 360 instead.
+ SetMovedir(this);
+ this.solid = SOLID_BSP;
+ SetBrushEntityModel(this);
+ set_movetype(this, MOVETYPE_NONE); // why was this PUSH? -div0
+// this.modelindex = 0;
+ this.model = "";
+}
+
+bool InitMovingBrushTrigger(entity this)
+{
+// trigger angles are used for one-way touches. An angle of 0 is assumed
+// to mean no restrictions, so use a yaw of 360 instead.
+ this.solid = SOLID_BSP;
+ SetBrushEntityModel(this);
+ set_movetype(this, MOVETYPE_PUSH);
+ if(this.modelindex == 0)
+ {
+ objerror(this, "InitMovingBrushTrigger: no brushes found!");
+ return false;
+ }
+ return true;
+}
+#endif
.entity move_controller;
+const int TSPEED_TIME = -1;
+const int TSPEED_LINEAR = 0;
+const int TSPEED_START = 1;
+const int TSPEED_END = 2;
+// TODO average too?
+
#ifdef CSQC
// this stuff is defined in the server side engine VM, so we must define it separately here
.float takedamage;
.float max_health; // players maximum health is stored here
#endif
+
+#ifdef SVQC
+spawnfunc(info_null);
+#endif
+
+/*
+=============
+SUB_CalcMove
+
+calculate this.velocity and this.nextthink to reach dest from
+this.origin traveling at speed
+===============
+*/
+void SUB_CalcMoveDone(entity this);
+
+.float platmovetype_turn;
+void SUB_CalcMove_controller_think (entity this);
+
+void SUB_CalcMove_controller_setbezier (entity controller, vector org, vector control, vector dest);
+
+void SUB_CalcMove_controller_setlinear (entity controller, vector org, vector dest);
+
+void SUB_CalcMove_Bezier (entity this, vector tcontrol, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
+
+void SUB_CalcMove (entity this, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
+
+void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
+
+#ifdef SVQC
+void ApplyMinMaxScaleAngles(entity e);
+
+void SetBrushEntityModel(entity this);
+
+void SetBrushEntityModelNoLOD(entity this);
+#endif
+
+/*
+=============
+SUB_CalcAngleMove
+
+calculate this.avelocity and this.nextthink to reach destangle from
+this.angles rotating
+
+The calling function should make sure this.think is valid
+===============
+*/
+void SUB_CalcAngleMoveDone (entity this);
+
+// FIXME: I fixed this function only for rotation around the main axes
+void SUB_CalcAngleMove (entity this, vector destangle, float tspeedtype, float tspeed, void(entity this) func);
+
+void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void(entity this) func);
+
+/*
+================
+InitTrigger
+================
+*/
+
+#ifdef SVQC
+void SetMovedir(entity this);
+
+void InitTrigger(entity this);
+
+void InitSolidBSPTrigger(entity this);
+
+bool InitMovingBrushTrigger(entity this);
+#endif
// generated file; do not modify
#include <common/mapobjects/target/changelevel.qc>
-#include <common/mapobjects/target/include.qc>
#include <common/mapobjects/target/kill.qc>
#include <common/mapobjects/target/levelwarp.qc>
#include <common/mapobjects/target/location.qc>
// generated file; do not modify
#include <common/mapobjects/target/changelevel.qh>
-#include <common/mapobjects/target/include.qh>
#include <common/mapobjects/target/kill.qh>
#include <common/mapobjects/target/levelwarp.qh>
#include <common/mapobjects/target/location.qh>
+++ /dev/null
-#include "include.qh"
-
-#include "changelevel.qc"
-#include "kill.qc"
-#include "levelwarp.qc"
-#include "location.qc"
-#include "music.qc"
-#include "spawn.qc"
-#include "spawnpoint.qc"
-#include "speaker.qc"
-#include "voicescript.qc"
+++ /dev/null
-#pragma once
-
-#include "music.qh"
#include <common/mapobjects/trigger/heal.qc>
#include <common/mapobjects/trigger/hurt.qc>
#include <common/mapobjects/trigger/impulse.qc>
-#include <common/mapobjects/trigger/include.qc>
#include <common/mapobjects/trigger/jumppads.qc>
#include <common/mapobjects/trigger/keylock.qc>
#include <common/mapobjects/trigger/magicear.qc>
#include <common/mapobjects/trigger/heal.qh>
#include <common/mapobjects/trigger/hurt.qh>
#include <common/mapobjects/trigger/impulse.qh>
-#include <common/mapobjects/trigger/include.qh>
#include <common/mapobjects/trigger/jumppads.qh>
#include <common/mapobjects/trigger/keylock.qh>
#include <common/mapobjects/trigger/magicear.qh>
+++ /dev/null
-#include "include.qh"
-
-#include "counter.qc"
-#include "delay.qc"
-#include "disablerelay.qc"
-#include "flipflop.qc"
-#include "gamestart.qc"
-#include "gravity.qc"
-#include "heal.qc"
-#include "hurt.qc"
-#include "impulse.qc"
-#include "jumppads.qc"
-#include "keylock.qc"
-#include "magicear.qc"
-#include "monoflop.qc"
-#include "multi.qc"
-#include "multivibrator.qc"
-#include "relay.qc"
-#include "relay_activators.qc"
-#include "relay_if.qc"
-#include "relay_teamcheck.qc"
-#include "secret.qc"
-#include "swamp.qc"
-#include "teleport.qc"
-#include "viewloc.qc"
+++ /dev/null
-#pragma once
-
-#include "multi.qh"
-#include "jumppads.qh"
-#include "secret.qh"
-#include "swamp.qh"
-#include "keylock.qh"
-#include "impulse.qh"
-#include "viewloc.qh"
#include "triggers.qh"
+#ifdef SVQC
+ #include <server/item_key.qh>
+#endif
+
void SUB_DontUseTargets(entity this, entity actor, entity trigger) { }
void SUB_UseTargets(entity this, entity actor, entity trigger);
#include "player.qh"
-#include "../mapobjects/include.qh"
+#include "../mapobjects/_mod.qh"
#include "../viewloc.qh"
#ifdef SVQC
#include <server/g_damage.qc>
#include <server/g_hook.qc>
#include <server/g_lights.qc>
-#include <server/g_models.qc>
#include <server/g_subs.qc>
#include <server/g_world.qc>
#include <server/handicap.qc>
#include <server/g_damage.qh>
#include <server/g_hook.qh>
#include <server/g_lights.qh>
-#include <server/g_models.qh>
#include <server/g_subs.qh>
#include <server/g_world.qh>
#include <server/handicap.qh>
+++ /dev/null
-#include "g_models.qh"
-
-#include <server/defs.qh>
-#include <server/miscfunctions.qh>
-#include "g_subs.qh"
-#include <common/net_linked.qh>
-#include "../common/mapobjects/subs.qh"
-#include "../common/mapobjects/triggers.qh"
-
-entityclass(BGMScript);
-classfield(BGMScript) .string bgmscript;
-classfield(BGMScript) .float bgmscriptattack;
-classfield(BGMScript) .float bgmscriptdecay;
-classfield(BGMScript) .float bgmscriptsustain;
-classfield(BGMScript) .float bgmscriptrelease;
-
-#include "../common/constants.qh"
-#include "../lib/csqcmodel/sv_model.qh"
-
-.float modelscale;
-
-void g_model_setcolormaptoactivator(entity this, entity actor, entity trigger)
-{
- if(teamplay)
- {
- if(actor.team)
- this.colormap = (actor.team - 1) * 0x11;
- else
- this.colormap = 0x00;
- }
- else
- this.colormap = floor(random() * 256);
- this.colormap |= BIT(10); // RENDER_COLORMAPPED
-}
-
-void g_clientmodel_setcolormaptoactivator(entity this, entity actor, entity trigger)
-{
- g_model_setcolormaptoactivator(this, actor, trigger);
- this.SendFlags |= (BIT(3) | BIT(0));
-}
-
-void g_clientmodel_use(entity this, entity actor, entity trigger)
-{
- if (this.antiwall_flag == 1)
- {
- this.inactive = 1;
- this.solid = SOLID_NOT;
- }
- else if (this.antiwall_flag == 2)
- {
- this.inactive = 0;
- this.solid = this.default_solid;
- }
- g_clientmodel_setcolormaptoactivator(this, actor, trigger);
-}
-
-void g_model_dropbyspawnflags(entity this)
-{
- if((this.spawnflags & 3) == 1) // ALIGN_ORIGIN
- {
- traceline(this.origin, this.origin - '0 0 4096', MOVE_NOMONSTERS, this);
- setorigin(this, trace_endpos);
- }
- else if((this.spawnflags & 3) == 2) // ALIGN_BOTTOM
- {
- tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 4096', MOVE_NOMONSTERS, this);
- setorigin(this, trace_endpos);
- }
- else if((this.spawnflags & 3) == 3) // ALIGN_ORIGIN | ALIGN_BOTTOM
- {
- traceline(this.origin, this.origin - '0 0 4096', MOVE_NOMONSTERS, this);
- setorigin(this, trace_endpos - '0 0 1' * this.mins.z);
- }
-}
-
-void g_clientmodel_dropbyspawnflags(entity this)
-{
- vector o0;
- o0 = this.origin;
- g_model_dropbyspawnflags(this);
- if(this.origin != o0)
- this.SendFlags |= 2;
-}
-
-bool g_clientmodel_genericsendentity(entity this, entity to, int sf)
-{
- sf = sf & 0x0F;
- if(this.angles != '0 0 0')
- sf |= 0x10;
- if(this.mins != '0 0 0' || this.maxs != '0 0 0')
- sf |= 0x20;
- if(this.colormap != 0)
- sf |= 0x40;
- if(this.lodmodelindex1)
- sf |= 0x80;
-
- WriteHeader(MSG_ENTITY, ENT_CLIENT_WALL);
- WriteByte(MSG_ENTITY, sf);
-
- if(sf & BIT(0))
- {
- if(sf & 0x40)
- WriteShort(MSG_ENTITY, this.colormap);
- WriteByte(MSG_ENTITY, this.skin);
- }
-
- if(sf & BIT(1))
- {
- WriteVector(MSG_ENTITY, this.origin);
- }
-
- if(sf & BIT(2))
- {
- if(sf & 0x10)
- {
- WriteAngle(MSG_ENTITY, this.angles.x);
- WriteAngle(MSG_ENTITY, this.angles.y);
- WriteAngle(MSG_ENTITY, this.angles.z);
- }
- }
-
- if(sf & BIT(3))
- {
- if(sf & 0x80)
- {
- WriteShort(MSG_ENTITY, this.lodmodelindex0);
- WriteShort(MSG_ENTITY, bound(0, this.loddistance1, 65535));
- WriteShort(MSG_ENTITY, this.lodmodelindex1);
- WriteShort(MSG_ENTITY, bound(0, this.loddistance2, 65535));
- WriteShort(MSG_ENTITY, this.lodmodelindex2);
- }
- else
- WriteShort(MSG_ENTITY, this.modelindex);
- WriteByte(MSG_ENTITY, this.solid);
- WriteShort(MSG_ENTITY, floor(this.scale * 256));
- if(sf & 0x20)
- {
- WriteVector(MSG_ENTITY, this.mins);
- WriteVector(MSG_ENTITY, this.maxs);
- }
- WriteString(MSG_ENTITY, this.bgmscript);
- if(this.bgmscript != "")
- {
- WriteByte(MSG_ENTITY, floor(this.bgmscriptattack * 64));
- WriteByte(MSG_ENTITY, floor(this.bgmscriptdecay * 64));
- WriteByte(MSG_ENTITY, floor(this.bgmscriptsustain * 255));
- WriteByte(MSG_ENTITY, floor(this.bgmscriptrelease * 64));
- WriteVector(MSG_ENTITY, this.movedir);
- WriteByte(MSG_ENTITY, floor(this.lip * 255));
- }
- WriteByte(MSG_ENTITY, this.fade_start);
- WriteByte(MSG_ENTITY, this.fade_end);
- WriteByte(MSG_ENTITY, this.alpha_max);
- WriteByte(MSG_ENTITY, this.alpha_min);
- WriteByte(MSG_ENTITY, this.inactive);
- WriteShort(MSG_ENTITY, this.fade_vertical_offset);
- }
-
- return true;
-}
-
-
-#define G_MODEL_INIT(ent,sol) \
- if(ent.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
- if(!ent.scale) ent.scale = ent.modelscale; \
- SetBrushEntityModel(ent); \
- ent.use = g_model_setcolormaptoactivator; \
- InitializeEntity(ent, g_model_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
- if(!ent.solid) ent.solid = (sol); else if(ent.solid < 0) ent.solid = SOLID_NOT;
-
-#define G_CLIENTMODEL_INIT(ent,sol) \
- if(ent.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
- if(!ent.scale) ent.scale = ent.modelscale; \
- SetBrushEntityModel(ent); \
- ent.use = g_clientmodel_use; \
- InitializeEntity(ent, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
- if(!ent.solid) ent.solid = (sol); else if(ent.solid < 0) ent.solid = SOLID_NOT; \
- if(!ent.bgmscriptsustain) ent.bgmscriptsustain = 1; else if(ent.bgmscriptsustain < 0) ent.bgmscriptsustain = 0; \
- Net_LinkEntity(ent, true, 0, g_clientmodel_genericsendentity); \
- ent.default_solid = sol;
-
-// non-solid model entities:
-spawnfunc(misc_gamemodel) { this.angles_x = -this.angles.x; G_MODEL_INIT (this, SOLID_NOT) } // model entity
-spawnfunc(misc_clientmodel) { this.angles_x = -this.angles.x; G_CLIENTMODEL_INIT(this, SOLID_NOT) } // model entity
-spawnfunc(misc_models) { this.angles_x = -this.angles.x; G_MODEL_INIT (this, SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use
-
-// non-solid brush entities:
-spawnfunc(func_illusionary) { G_MODEL_INIT (this, SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED)
-spawnfunc(func_clientillusionary) { G_CLIENTMODEL_INIT(this, SOLID_NOT) } // brush entity
-spawnfunc(func_static) { G_MODEL_INIT (this, SOLID_NOT) } // DEPRECATED old alias name from some other game
-
-// solid brush entities
-spawnfunc(func_wall) { G_MODEL_INIT (this, SOLID_BSP) } // Q1 name
-spawnfunc(func_clientwall) { G_CLIENTMODEL_INIT(this, SOLID_BSP) } // brush entity (WARNING: MISPREDICTED)
+++ /dev/null
-#pragma once
#include "../lib/warpzone/common.qh"
#include "../common/mapobjects/subs.qh"
-spawnfunc(info_null)
-{
- delete(this);
- // if anything breaks, tell the mapper to fix his map! info_null is meant to remove itself immediately.
-}
/*
==================
if (!getSendEntity(this))
SetCustomizer(this, LOD_customize, LOD_uncustomize);
}
-
-void ApplyMinMaxScaleAngles(entity e)
-{
- if(e.angles.x != 0 || e.angles.z != 0 || e.avelocity.x != 0 || e.avelocity.z != 0) // "weird" rotation
- {
- e.maxs = '1 1 1' * vlen(
- '1 0 0' * max(-e.mins.x, e.maxs.x) +
- '0 1 0' * max(-e.mins.y, e.maxs.y) +
- '0 0 1' * max(-e.mins.z, e.maxs.z)
- );
- e.mins = -e.maxs;
- }
- else if(e.angles.y != 0 || e.avelocity.y != 0) // yaw only is a bit better
- {
- e.maxs_x = vlen(
- '1 0 0' * max(-e.mins.x, e.maxs.x) +
- '0 1 0' * max(-e.mins.y, e.maxs.y)
- );
- e.maxs_y = e.maxs.x;
- e.mins_x = -e.maxs.x;
- e.mins_y = -e.maxs.x;
- }
- if(e.scale)
- setsize(e, e.mins * e.scale, e.maxs * e.scale);
- else
- setsize(e, e.mins, e.maxs);
-}
-
-void SetBrushEntityModel(entity this)
-{
- if(this.model != "")
- {
- precache_model(this.model);
- if(this.mins != '0 0 0' || this.maxs != '0 0 0')
- {
- vector mi = this.mins;
- vector ma = this.maxs;
- _setmodel(this, this.model); // no precision needed
- setsize(this, mi, ma);
- }
- else
- _setmodel(this, this.model); // no precision needed
- InitializeEntity(this, LODmodel_attach, INITPRIO_FINDTARGET);
- }
- setorigin(this, this.origin);
- ApplyMinMaxScaleAngles(this);
-}
-
-void SetBrushEntityModelNoLOD(entity this)
-{
- if(this.model != "")
- {
- precache_model(this.model);
- if(this.mins != '0 0 0' || this.maxs != '0 0 0')
- {
- vector mi = this.mins;
- vector ma = this.maxs;
- _setmodel(this, this.model); // no precision needed
- setsize(this, mi, ma);
- }
- else
- _setmodel(this, this.model); // no precision needed
- }
- setorigin(this, this.origin);
- ApplyMinMaxScaleAngles(this);
-}
-
-/*
-================
-InitTrigger
-================
-*/
-
-void SetMovedir(entity this)
-{
- if(this.movedir != '0 0 0')
- this.movedir = normalize(this.movedir);
- else
- {
- makevectors(this.angles);
- this.movedir = v_forward;
- }
-
- this.angles = '0 0 0';
-}
-
-void InitTrigger(entity this)
-{
-// trigger angles are used for one-way touches. An angle of 0 is assumed
-// to mean no restrictions, so use a yaw of 360 instead.
- SetMovedir(this);
- this.solid = SOLID_TRIGGER;
- SetBrushEntityModel(this);
- set_movetype(this, MOVETYPE_NONE);
- this.modelindex = 0;
- this.model = "";
-}
-
-void InitSolidBSPTrigger(entity this)
-{
-// trigger angles are used for one-way touches. An angle of 0 is assumed
-// to mean no restrictions, so use a yaw of 360 instead.
- SetMovedir(this);
- this.solid = SOLID_BSP;
- SetBrushEntityModel(this);
- set_movetype(this, MOVETYPE_NONE); // why was this PUSH? -div0
-// this.modelindex = 0;
- this.model = "";
-}
-
-bool InitMovingBrushTrigger(entity this)
-{
-// trigger angles are used for one-way touches. An angle of 0 is assumed
-// to mean no restrictions, so use a yaw of 360 instead.
- this.solid = SOLID_BSP;
- SetBrushEntityModel(this);
- set_movetype(this, MOVETYPE_PUSH);
- if(this.modelindex == 0)
- {
- objerror(this, "InitMovingBrushTrigger: no brushes found!");
- return false;
- }
- return true;
-}
void SUB_NullThink(entity this);
-void SUB_CalcMoveDone(entity this);
-void SUB_CalcAngleMoveDone(entity this);
-
-spawnfunc(info_null);
-
/*
==================
SUB_Friction
*/
void SUB_SetFade (entity ent, float when, float fadetime);
-/*
-=============
-SUB_CalcMove
-
-calculate this.velocity and this.nextthink to reach dest from
-this.origin traveling at speed
-===============
-*/
-void SUB_CalcMoveDone(entity this);
-
-.float platmovetype_turn;
-void SUB_CalcMove_controller_think (entity this);
-
-void SUB_CalcMove_controller_setbezier (entity controller, vector org, vector control, vector dest);
-
-void SUB_CalcMove_controller_setlinear (entity controller, vector org, vector dest);
-
-void SUB_CalcMove_Bezier (entity this, vector tcontrol, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
-
-void SUB_CalcMove (entity this, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
-
-void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
-
-/*
-=============
-SUB_CalcAngleMove
-
-calculate this.avelocity and this.nextthink to reach destangle from
-this.angles rotating
-
-The calling function should make sure this.think is valid
-===============
-*/
-void SUB_CalcAngleMoveDone (entity this);
-
-// FIXME: I fixed this function only for rotation around the main axes
-void SUB_CalcAngleMove (entity this, vector destangle, float tspeedtype, float tspeed, void(entity this) func);
-
-void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void(entity this) func);
-
/*
==================
main
*/
vector findbetterlocation (vector org, float mindist);
-/*
-==================
-Angc used for animations
-==================
-*/
-
-
-float angc (float a1, float a2);
.string lodtarget1;
.string lodtarget2;
void LOD_uncustomize(entity this);
void LODmodel_attach(entity this);
-
-void ApplyMinMaxScaleAngles(entity e);
-
-void SetBrushEntityModel(entity this);
-
-void SetBrushEntityModelNoLOD(entity this);
-
-/*
-================
-InitTrigger
-================
-*/
-
-void SetMovedir(entity this);
-
-void InitTrigger(entity this);
-
-void InitSolidBSPTrigger(entity this);
-
-bool InitMovingBrushTrigger(entity this);
#include "../common/physics/player.qh"
#include "../common/effects/qc/_mod.qh"
#include "../common/mutators/mutator/waypoints/waypointsprites.qh"
-#include "../common/mapobjects/include.qh"
+#include "../common/mapobjects/_mod.qh"
#include "../common/wepent.qh"
#include "weapons/weaponstats.qh"