From 44d3fb06e530c783948c7f292b40f70330729fa9 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Jun 2018 02:23:57 +1000 Subject: [PATCH] Clean up mapobjects' includes a little bit, move some subs around --- qcsrc/client/main.qc | 2 +- qcsrc/common/_all.inc | 2 +- qcsrc/common/mapobjects/_mod.inc | 2 +- qcsrc/common/mapobjects/_mod.qh | 2 +- qcsrc/common/mapobjects/func/_mod.inc | 1 - qcsrc/common/mapobjects/func/_mod.qh | 1 - qcsrc/common/mapobjects/func/include.qc | 19 --- qcsrc/common/mapobjects/func/include.qh | 5 - qcsrc/common/mapobjects/include.qc | 20 --- qcsrc/common/mapobjects/include.qh | 19 --- qcsrc/common/mapobjects/misc/_mod.inc | 1 - qcsrc/common/mapobjects/misc/_mod.qh | 1 - qcsrc/common/mapobjects/misc/include.qc | 5 - .../mapobjects/models.qc} | 14 +- .../mapobjects/{misc/include.qh => models.qh} | 0 qcsrc/common/mapobjects/subs.qc | 140 +++++++++++++++++- qcsrc/common/mapobjects/subs.qh | 74 +++++++++ qcsrc/common/mapobjects/target/_mod.inc | 1 - qcsrc/common/mapobjects/target/_mod.qh | 1 - qcsrc/common/mapobjects/target/include.qc | 11 -- qcsrc/common/mapobjects/target/include.qh | 3 - qcsrc/common/mapobjects/trigger/_mod.inc | 1 - qcsrc/common/mapobjects/trigger/_mod.qh | 1 - qcsrc/common/mapobjects/trigger/include.qc | 25 ---- qcsrc/common/mapobjects/trigger/include.qh | 9 -- qcsrc/common/mapobjects/triggers.qc | 4 + qcsrc/common/physics/player.qc | 2 +- qcsrc/server/_mod.inc | 1 - qcsrc/server/_mod.qh | 1 - qcsrc/server/g_models.qh | 1 - qcsrc/server/g_subs.qc | 129 ---------------- qcsrc/server/g_subs.qh | 73 --------- qcsrc/server/player.qc | 2 +- 33 files changed, 226 insertions(+), 347 deletions(-) delete mode 100644 qcsrc/common/mapobjects/func/include.qc delete mode 100644 qcsrc/common/mapobjects/func/include.qh delete mode 100644 qcsrc/common/mapobjects/include.qc delete mode 100644 qcsrc/common/mapobjects/include.qh delete mode 100644 qcsrc/common/mapobjects/misc/include.qc rename qcsrc/{server/g_models.qc => common/mapobjects/models.qc} (96%) rename qcsrc/common/mapobjects/{misc/include.qh => models.qh} (100%) delete mode 100644 qcsrc/common/mapobjects/target/include.qc delete mode 100644 qcsrc/common/mapobjects/target/include.qh delete mode 100644 qcsrc/common/mapobjects/trigger/include.qc delete mode 100644 qcsrc/common/mapobjects/trigger/include.qh delete mode 100644 qcsrc/server/g_models.qh diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 8e0c76d42..c22112541 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/qcsrc/common/_all.inc b/qcsrc/common/_all.inc index 708b4e951..9d7c68a8e 100644 --- a/qcsrc/common/_all.inc +++ b/qcsrc/common/_all.inc @@ -22,7 +22,7 @@ noref float autocvar_net_connecttimeout = 30; #ifdef GAMEQC #include "physics/all.inc" -#include "mapobjects/include.qc" +#include "mapobjects/_mod.inc" #include "viewloc.qc" #endif diff --git a/qcsrc/common/mapobjects/_mod.inc b/qcsrc/common/mapobjects/_mod.inc index efc838487..1aab2b927 100644 --- a/qcsrc/common/mapobjects/_mod.inc +++ b/qcsrc/common/mapobjects/_mod.inc @@ -1,5 +1,5 @@ // generated file; do not modify -#include +#include #include #include #include diff --git a/qcsrc/common/mapobjects/_mod.qh b/qcsrc/common/mapobjects/_mod.qh index 11854c091..ebb7a4325 100644 --- a/qcsrc/common/mapobjects/_mod.qh +++ b/qcsrc/common/mapobjects/_mod.qh @@ -1,5 +1,5 @@ // generated file; do not modify -#include +#include #include #include #include diff --git a/qcsrc/common/mapobjects/func/_mod.inc b/qcsrc/common/mapobjects/func/_mod.inc index e3425e34a..0c82e979a 100644 --- a/qcsrc/common/mapobjects/func/_mod.inc +++ b/qcsrc/common/mapobjects/func/_mod.inc @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include diff --git a/qcsrc/common/mapobjects/func/_mod.qh b/qcsrc/common/mapobjects/func/_mod.qh index c0381a3f2..052edb954 100644 --- a/qcsrc/common/mapobjects/func/_mod.qh +++ b/qcsrc/common/mapobjects/func/_mod.qh @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include diff --git a/qcsrc/common/mapobjects/func/include.qc b/qcsrc/common/mapobjects/func/include.qc deleted file mode 100644 index 290c2e984..000000000 --- a/qcsrc/common/mapobjects/func/include.qc +++ /dev/null @@ -1,19 +0,0 @@ -#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" diff --git a/qcsrc/common/mapobjects/func/include.qh b/qcsrc/common/mapobjects/func/include.qh deleted file mode 100644 index 4e8b94cd1..000000000 --- a/qcsrc/common/mapobjects/func/include.qh +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include "door.qh" -#include "ladder.qh" -#include "train.qh" diff --git a/qcsrc/common/mapobjects/include.qc b/qcsrc/common/mapobjects/include.qc deleted file mode 100644 index 59da1f217..000000000 --- a/qcsrc/common/mapobjects/include.qc +++ /dev/null @@ -1,20 +0,0 @@ -#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" - diff --git a/qcsrc/common/mapobjects/include.qh b/qcsrc/common/mapobjects/include.qh deleted file mode 100644 index 87c07c14d..000000000 --- a/qcsrc/common/mapobjects/include.qh +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -// some required common stuff -#ifdef SVQC - #include -#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" diff --git a/qcsrc/common/mapobjects/misc/_mod.inc b/qcsrc/common/mapobjects/misc/_mod.inc index d8d5ea6a6..3698cf822 100644 --- a/qcsrc/common/mapobjects/misc/_mod.inc +++ b/qcsrc/common/mapobjects/misc/_mod.inc @@ -1,6 +1,5 @@ // generated file; do not modify #include #include -#include #include #include diff --git a/qcsrc/common/mapobjects/misc/_mod.qh b/qcsrc/common/mapobjects/misc/_mod.qh index 5fefbe41b..5b156176e 100644 --- a/qcsrc/common/mapobjects/misc/_mod.qh +++ b/qcsrc/common/mapobjects/misc/_mod.qh @@ -1,6 +1,5 @@ // generated file; do not modify #include #include -#include #include #include diff --git a/qcsrc/common/mapobjects/misc/include.qc b/qcsrc/common/mapobjects/misc/include.qc deleted file mode 100644 index bbe5ce03d..000000000 --- a/qcsrc/common/mapobjects/misc/include.qc +++ /dev/null @@ -1,5 +0,0 @@ -#include "include.qh" -#include "corner.qc" -#include "follow.qc" -#include "laser.qc" -#include "teleport_dest.qc" diff --git a/qcsrc/server/g_models.qc b/qcsrc/common/mapobjects/models.qc similarity index 96% rename from qcsrc/server/g_models.qc rename to qcsrc/common/mapobjects/models.qc index b7779368d..9b1f2f8a4 100644 --- a/qcsrc/server/g_models.qc +++ b/qcsrc/common/mapobjects/models.qc @@ -1,11 +1,12 @@ -#include "g_models.qh" +#include "models.qh" +#ifdef SVQC #include #include -#include "g_subs.qh" +#include #include -#include "../common/mapobjects/subs.qh" -#include "../common/mapobjects/triggers.qh" +#include "subs.qh" +#include "triggers.qh" entityclass(BGMScript); classfield(BGMScript) .string bgmscript; @@ -14,8 +15,8 @@ classfield(BGMScript) .float bgmscriptdecay; classfield(BGMScript) .float bgmscriptsustain; classfield(BGMScript) .float bgmscriptrelease; -#include "../common/constants.qh" -#include "../lib/csqcmodel/sv_model.qh" +#include +#include "../../lib/csqcmodel/sv_model.qh" .float modelscale; @@ -192,3 +193,4 @@ spawnfunc(func_static) { G_MODEL_INIT (this, SOLID_NOT) } // DEP // 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 diff --git a/qcsrc/common/mapobjects/misc/include.qh b/qcsrc/common/mapobjects/models.qh similarity index 100% rename from qcsrc/common/mapobjects/misc/include.qh rename to qcsrc/common/mapobjects/models.qh diff --git a/qcsrc/common/mapobjects/subs.qc b/qcsrc/common/mapobjects/subs.qc index 2a237fdcb..bc6998131 100644 --- a/qcsrc/common/mapobjects/subs.qc +++ b/qcsrc/common/mapobjects/subs.qc @@ -4,6 +4,14 @@ void SUB_NullThink(entity this) { } 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 @@ -180,12 +188,6 @@ void SUB_CalcMove_controller_setlinear (entity controller, vector org, vector de 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; @@ -367,3 +369,129 @@ void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float { 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 diff --git a/qcsrc/common/mapobjects/subs.qh b/qcsrc/common/mapobjects/subs.qh index 8d4e40650..3d265364c 100644 --- a/qcsrc/common/mapobjects/subs.qh +++ b/qcsrc/common/mapobjects/subs.qh @@ -44,6 +44,12 @@ void SUB_VanishOrRemove (entity ent); .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; @@ -55,3 +61,71 @@ const int DAMAGE_AIM = 2; .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 diff --git a/qcsrc/common/mapobjects/target/_mod.inc b/qcsrc/common/mapobjects/target/_mod.inc index 5ac26d9cf..f9cc536ed 100644 --- a/qcsrc/common/mapobjects/target/_mod.inc +++ b/qcsrc/common/mapobjects/target/_mod.inc @@ -1,6 +1,5 @@ // generated file; do not modify #include -#include #include #include #include diff --git a/qcsrc/common/mapobjects/target/_mod.qh b/qcsrc/common/mapobjects/target/_mod.qh index 80a1a7f0c..e3f4cede9 100644 --- a/qcsrc/common/mapobjects/target/_mod.qh +++ b/qcsrc/common/mapobjects/target/_mod.qh @@ -1,6 +1,5 @@ // generated file; do not modify #include -#include #include #include #include diff --git a/qcsrc/common/mapobjects/target/include.qc b/qcsrc/common/mapobjects/target/include.qc deleted file mode 100644 index a45c65ed0..000000000 --- a/qcsrc/common/mapobjects/target/include.qc +++ /dev/null @@ -1,11 +0,0 @@ -#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" diff --git a/qcsrc/common/mapobjects/target/include.qh b/qcsrc/common/mapobjects/target/include.qh deleted file mode 100644 index c0f7cad44..000000000 --- a/qcsrc/common/mapobjects/target/include.qh +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include "music.qh" diff --git a/qcsrc/common/mapobjects/trigger/_mod.inc b/qcsrc/common/mapobjects/trigger/_mod.inc index 82eb9f4a9..c2a663f05 100644 --- a/qcsrc/common/mapobjects/trigger/_mod.inc +++ b/qcsrc/common/mapobjects/trigger/_mod.inc @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include diff --git a/qcsrc/common/mapobjects/trigger/_mod.qh b/qcsrc/common/mapobjects/trigger/_mod.qh index 6250a76a7..08a6e5a06 100644 --- a/qcsrc/common/mapobjects/trigger/_mod.qh +++ b/qcsrc/common/mapobjects/trigger/_mod.qh @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include diff --git a/qcsrc/common/mapobjects/trigger/include.qc b/qcsrc/common/mapobjects/trigger/include.qc deleted file mode 100644 index 1c762fc35..000000000 --- a/qcsrc/common/mapobjects/trigger/include.qc +++ /dev/null @@ -1,25 +0,0 @@ -#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" diff --git a/qcsrc/common/mapobjects/trigger/include.qh b/qcsrc/common/mapobjects/trigger/include.qh deleted file mode 100644 index 8aa6b2b17..000000000 --- a/qcsrc/common/mapobjects/trigger/include.qh +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include "multi.qh" -#include "jumppads.qh" -#include "secret.qh" -#include "swamp.qh" -#include "keylock.qh" -#include "impulse.qh" -#include "viewloc.qh" diff --git a/qcsrc/common/mapobjects/triggers.qc b/qcsrc/common/mapobjects/triggers.qc index 9db38a10b..6968a6556 100644 --- a/qcsrc/common/mapobjects/triggers.qc +++ b/qcsrc/common/mapobjects/triggers.qc @@ -1,4 +1,8 @@ #include "triggers.qh" +#ifdef SVQC + #include +#endif + void SUB_DontUseTargets(entity this, entity actor, entity trigger) { } void SUB_UseTargets(entity this, entity actor, entity trigger); diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 04dc20770..2b9808a55 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -1,5 +1,5 @@ #include "player.qh" -#include "../mapobjects/include.qh" +#include "../mapobjects/_mod.qh" #include "../viewloc.qh" #ifdef SVQC diff --git a/qcsrc/server/_mod.inc b/qcsrc/server/_mod.inc index 569301c5d..cffc7f507 100644 --- a/qcsrc/server/_mod.inc +++ b/qcsrc/server/_mod.inc @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include diff --git a/qcsrc/server/_mod.qh b/qcsrc/server/_mod.qh index 2013fd6bb..cb66bc888 100644 --- a/qcsrc/server/_mod.qh +++ b/qcsrc/server/_mod.qh @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include diff --git a/qcsrc/server/g_models.qh b/qcsrc/server/g_models.qh deleted file mode 100644 index 6f70f09be..000000000 --- a/qcsrc/server/g_models.qh +++ /dev/null @@ -1 +0,0 @@ -#pragma once diff --git a/qcsrc/server/g_subs.qc b/qcsrc/server/g_subs.qc index 21c43ea10..dbbd6d2b4 100644 --- a/qcsrc/server/g_subs.qc +++ b/qcsrc/server/g_subs.qc @@ -8,11 +8,6 @@ #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. -} /* ================== @@ -313,127 +308,3 @@ void LODmodel_attach(entity this) 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; -} diff --git a/qcsrc/server/g_subs.qh b/qcsrc/server/g_subs.qh index 1f5537cea..2528786e7 100644 --- a/qcsrc/server/g_subs.qh +++ b/qcsrc/server/g_subs.qh @@ -2,11 +2,6 @@ void SUB_NullThink(entity this); -void SUB_CalcMoveDone(entity this); -void SUB_CalcAngleMoveDone(entity this); - -spawnfunc(info_null); - /* ================== SUB_Friction @@ -37,46 +32,6 @@ Fade 'ent' out when time >= 'when' */ 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 @@ -119,14 +74,6 @@ Ripped from DPMod */ vector findbetterlocation (vector org, float mindist); -/* -================== -Angc used for animations -================== -*/ - - -float angc (float a1, float a2); .string lodtarget1; .string lodtarget2; @@ -143,23 +90,3 @@ bool LOD_customize(entity this, entity client); 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); diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index fa2cd48da..fd7bad4f8 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -25,7 +25,7 @@ #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" -- 2.39.2