]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Phase out miscfunctions.qc from the server codebase, preferring more fitting location...
authorMario <mario.mario@y7mail.com>
Fri, 25 Sep 2020 12:12:17 +0000 (22:12 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 25 Sep 2020 12:12:17 +0000 (22:12 +1000)
81 files changed:
qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh
qcsrc/common/gamemodes/gamemode/ctf/cl_ctf.qc
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh
qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc
qcsrc/common/gamemodes/gamemode/lms/cl_lms.qc
qcsrc/common/gamemodes/gamemode/nexball/cl_nexball.qc
qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh
qcsrc/common/gamemodes/gamemode/race/cl_race.qc
qcsrc/common/gamemodes/gamemode/tdm/sv_tdm.qc
qcsrc/common/gamemodes/gamemode/tdm/sv_tdm.qh
qcsrc/common/mapobjects/misc/dynlight.qc
qcsrc/common/mapobjects/models.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/mutators/mutator/nix/sv_nix.qc
qcsrc/common/physics/player.qc
qcsrc/common/turrets/sv_turrets.qh
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/server/_mod.inc
qcsrc/server/_mod.qh
qcsrc/server/anticheat.qc
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/havocbot/roles.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/bot/default/scripting.qc
qcsrc/server/bot/default/waypoints.qc
qcsrc/server/campaign.qc
qcsrc/server/chat.qc
qcsrc/server/cheats.qc
qcsrc/server/client.qc
qcsrc/server/clientkill.qc
qcsrc/server/command/banning.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/common.qc
qcsrc/server/command/getreplies.qc
qcsrc/server/command/vote.qc
qcsrc/server/compat/quake.qc
qcsrc/server/compat/quake3.qc
qcsrc/server/compat/wop.qc
qcsrc/server/damage.qc
qcsrc/server/damage.qh
qcsrc/server/hook.qc
qcsrc/server/impulse.qc
qcsrc/server/ipban.qc
qcsrc/server/main.qc
qcsrc/server/main.qh
qcsrc/server/mapvoting.qc
qcsrc/server/miscfunctions.qc [deleted file]
qcsrc/server/miscfunctions.qh [deleted file]
qcsrc/server/mutators/loader.qc
qcsrc/server/pathlib/main.qc
qcsrc/server/pathlib/movenode.qc
qcsrc/server/pathlib/utility.qc
qcsrc/server/player.qc
qcsrc/server/race.qc
qcsrc/server/race.qh
qcsrc/server/resources.qc
qcsrc/server/round_handler.qc
qcsrc/server/scores.qc
qcsrc/server/scores_rules.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/tests.qh
qcsrc/server/weapons/accuracy.qc
qcsrc/server/weapons/accuracy.qh
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/common.qh
qcsrc/server/weapons/csqcprojectile.qc
qcsrc/server/weapons/hitplot.qc
qcsrc/server/weapons/selection.qh
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/spawning.qh
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/throwing.qh
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/tracing.qh
qcsrc/server/weapons/weaponstats.qc
qcsrc/server/weapons/weaponsystem.qh
qcsrc/server/world.qc
qcsrc/server/world.qh

index 78526bc262b5dba7f885cb154ae63cbbac3f3321..869860f7dc258cec43c0e5d6b666aabb16f0323d 100644 (file)
@@ -3,7 +3,6 @@
 #include <common/mutators/base.qh>
 #include <server/elimination.qh>
 #include <server/round_handler.qh>
-#include <server/miscfunctions.qh>
 #include <server/command/sv_cmd.qh>
 
 int autocvar_g_ca_point_limit;
index 85f8e22ae66238441cfec0d6e24667f3b954082c..e2258c0c51ce50ce56e79953886012833aa14afc 100644 (file)
@@ -1,5 +1,6 @@
 #include "cl_ctf.qh"
 
+#include <common/mutators/base.qh>
 #include <client/hud/panel/modicons.qh>
 
 // CTF HUD modicon section
index d0e13c132b603660d7bf5c9d75f9b349019595ad..9fe2f0a543a210dbdcc3bed3f5c983139b6c538b 100644 (file)
@@ -2,6 +2,8 @@
 
 #include "ctf.qh"
 
+#include <common/items/item/pickup.qh>
+#include <common/mutators/base.qh>
 #include <common/gamemodes/sv_rules.qh>
 
 void ctf_Initialize();
index 27d6b868ef0d69c292881c1d6ba9d681ea22243a..950ebcf155637cc121b775a48a56a0aff3afab6b 100644 (file)
@@ -1,5 +1,7 @@
 #include "cl_cts.qh"
 
+#include <common/mutators/base.qh>
+
 REGISTER_MUTATOR(cl_cts, true);
 
 MUTATOR_HOOKFUNCTION(cl_cts, HUD_Physics_showoptional)
index 649f964f502bf9a28dfb5a0a717e4ed2e6c7fcb2..7be2d31bc6bd7286a57b411c01d1dfa4551c879f 100644 (file)
@@ -1,5 +1,7 @@
 #include "cl_lms.qh"
 
+#include <common/mutators/base.qh>
+
 REGISTER_MUTATOR(cl_lms, true);
 
 MUTATOR_HOOKFUNCTION(cl_lms, DrawInfoMessages)
index 19b7b63ce4912d424950877f576de9f64dd2ff8b..27699571675d1bd65ccb812d17df16b878425b77 100644 (file)
@@ -1,6 +1,7 @@
 #include "cl_nexball.qh"
 
 #include <client/hud/panel/modicons.qh>
+#include <common/mutators/base.qh>
 
 // Nexball HUD mod icon
 void HUD_Mod_NexBall(vector pos, vector mySize)
index 156719725e08774236f7c342435fd3a45a0db3ff..1959ac424a2dbdc7b05bb0badbd0aa3e90fa96c1 100644 (file)
@@ -6,6 +6,7 @@
 #include <server/world.qh>
 #include <common/ent_cs.qh>
 #include <common/mapobjects/triggers.qh>
+#include <common/mutators/base.qh>
 
 .entity ballcarried;
 
index f0a0046d8dfc6059ff700da0d73afcad96bce4b1..18c2cbf1f72c536e557cbc44a70b5c0a669ec76d 100644 (file)
@@ -1,5 +1,7 @@
 #include "onslaught.qh"
 
+#include <common/mutators/base.qh>
+
 #ifdef GAMEQC
 REGISTER_NET_LINKED(ENT_ONSCAMERA)
 #endif
index 0800ae10fd1623edd71da495808ae2e20ef0024c..363c0e39f885ee6eefbfd645a91b189f96e90414 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <common/mutators/base.qh>
+
 float autocvar_g_onslaught_point_limit;
 void ons_Initialize();
 
index c2346a4f2c84af163e5e38a5f241d5b54e2843db..b12564b1863b499a2a6da14fdc05a59750f81756 100644 (file)
@@ -1,5 +1,7 @@
 #include "cl_race.qh"
 
+#include <common/mutators/base.qh>
+
 // Race/CTS HUD mod icons
 float crecordtime_prev; // last remembered crecordtime
 float crecordtime_change_time; // time when crecordtime last changed
index 43a993844759db4caf390cabdf217b4b6a12a33f..1fba2215ff61d845e0409e943f02d62f1bf7eaa2 100644 (file)
@@ -51,6 +51,16 @@ void tdm_DelayedInit(entity this)
        }
 }
 
+void tdm_Initialize()
+{
+       GameRules_teams(true);
+       GameRules_spawning_teams(autocvar_g_tdm_team_spawns);
+       GameRules_limit_score(autocvar_g_tdm_point_limit);
+       GameRules_limit_lead(autocvar_g_tdm_point_leadlimit);
+
+       InitializeEntity(NULL, tdm_DelayedInit, INITPRIO_GAMETYPE);
+}
+
 MUTATOR_HOOKFUNCTION(tdm, TeamBalance_CheckAllowedTeams, CBC_ORDER_EXCLUSIVE)
 {
        M_ARGV(1, string) = "tdm_team";
index adc6a3d6c0248a9ad8c99a25e65d63a66970d8a9..783655bba517eef177c965a3d607571c0d59b1f1 100644 (file)
@@ -4,19 +4,14 @@
 int autocvar_g_tdm_point_limit;
 int autocvar_g_tdm_point_leadlimit;
 bool autocvar_g_tdm_team_spawns;
-void tdm_DelayedInit(entity this);
+void tdm_Initialize();
 
 REGISTER_MUTATOR(tdm, false)
 {
     MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               GameRules_teams(true);
-        GameRules_spawning_teams(autocvar_g_tdm_team_spawns);
-               GameRules_limit_score(autocvar_g_tdm_point_limit);
-        GameRules_limit_lead(autocvar_g_tdm_point_leadlimit);
-
-               InitializeEntity(NULL, tdm_DelayedInit, INITPRIO_GAMETYPE);
+               tdm_Initialize();
        }
        return 0;
 }
index 96d99b592dab099dc4de76a696ed1a71738d155d..6395500d29528b7ecc6a9f686376898b9f29f126 100644 (file)
@@ -3,7 +3,6 @@
 #ifdef SVQC
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 
 const float LOOP = 1;
 
index 6b272d1b1671f2afc7515d2b48a6ca978a1237aa..9ba1dcdf66943dffddf543d055357ab97aa0f685 100644 (file)
@@ -3,7 +3,6 @@
 #ifdef SVQC
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include <common/net_linked.qh>
 #include "subs.qh"
 #include "triggers.qh"
index d965448820e4018d869e89ae9bbe70c35a225e35..73518c1f9f2fe841fb1ac5b43454d57eb0a1c5e2 100644 (file)
@@ -1,5 +1,9 @@
 #include "spider.qh"
 
+#if defined(SVQC)
+       #include <common/mutators/base.qh>
+#endif
+
 #ifdef SVQC
 
 .float spider_slowness; // effect time of slowness inflicted by spiders
index 867da41d4ea840597c7b81b692e272740d6e3fa7..0ec051a8cbfc7e7acbb4c54ff64798f3b3d7a2c6 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_nix.qh"
 
 #include <server/weapons/selection.qh>
+#include <server/world.qh>
 
 //string autocvar_g_nix;
 int autocvar_g_balance_nix_ammo_cells;
index 5e9460c83109e4aa399c7199792a63c2cc0a32b8..319a6bf641ec06a7eb50d18bc0a64d58fd287c4a 100644 (file)
@@ -5,7 +5,6 @@
 #ifdef SVQC
 
 #include <server/client.qh>
-#include <server/miscfunctions.qh>
 #include <common/mapobjects/defs.qh>
 #include "../mapobjects/trigger/viewloc.qh"
 #include <server/main.qh>
index 5191940b1cc49e7244d312588bdfe42375124c58..aec6045ae8218ebf27dc09b12c5a08c2a6407f80 100644 (file)
@@ -1,6 +1,6 @@
 #pragma once
 
-#include <server/miscfunctions.qh>
+#include "all.qh"
 
 entity turret_projectile(entity actor, Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
 void turret_projectile_explode(entity this);
index 4ad1d105dcd52c15f8647de71ea8fd6f18512974..b0acbee74a984d0093eeaf8448bb9faaf046e934 100644 (file)
@@ -2023,4 +2023,53 @@ string playername(string thename, int teamid, bool team_colorize)
     else
         return thename;
 }
+
+float trace_hits_box_a0, trace_hits_box_a1;
+
+float trace_hits_box_1d(float end, float thmi, float thma)
+{
+    if (end == 0)
+    {
+        // just check if x is in range
+        if (0 < thmi)
+            return false;
+        if (0 > thma)
+            return false;
+    }
+    else
+    {
+        // do the trace with respect to x
+        // 0 -> end has to stay in thmi -> thma
+        trace_hits_box_a0 = max(trace_hits_box_a0, min(thmi / end, thma / end));
+        trace_hits_box_a1 = min(trace_hits_box_a1, max(thmi / end, thma / end));
+        if (trace_hits_box_a0 > trace_hits_box_a1)
+            return false;
+    }
+    return true;
+}
+
+float trace_hits_box(vector start, vector end, vector thmi, vector thma)
+{
+    end -= start;
+    thmi -= start;
+    thma -= start;
+    // now it is a trace from 0 to end
+
+    trace_hits_box_a0 = 0;
+    trace_hits_box_a1 = 1;
+
+    if (!trace_hits_box_1d(end.x, thmi.x, thma.x))
+        return false;
+    if (!trace_hits_box_1d(end.y, thmi.y, thma.y))
+        return false;
+    if (!trace_hits_box_1d(end.z, thmi.z, thma.z))
+        return false;
+
+    return true;
+}
+
+float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma)
+{
+    return trace_hits_box(start, end, thmi - ma, thma - mi);
+}
 #endif
index 82a0f01c66d252f11646d17a1c881e386393b3b9..b5a4ee6dfa825089b21c5119f3375630a34e851f 100644 (file)
@@ -244,4 +244,12 @@ float LostMovetypeFollow(entity ent);
 
 #ifdef GAMEQC
 string playername(string thename, int teamid, bool team_colorize);
+
+float trace_hits_box_1d(float end, float thmi, float thma);
+
+float trace_hits_box(vector start, vector end, vector thmi, vector thma);
+
+float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma);
+
+float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma);
 #endif
index d6bc0528b834b40f4d5c91722bf3468c408a597c..34ca1e2c85d664ee07c2ce53177c03945a39f22e 100644 (file)
@@ -17,7 +17,6 @@
 #include <server/main.qc>
 #include <server/mapvoting.qc>
 #include <server/matrix.qc>
-#include <server/miscfunctions.qc>
 #include <server/player.qc>
 #include <server/portals.qc>
 #include <server/race.qc>
index e881b403d7e9b0648860b11126655940a93c5900..c997538266a8c1be093b43556118d63baa601311 100644 (file)
@@ -17,7 +17,6 @@
 #include <server/main.qh>
 #include <server/mapvoting.qh>
 #include <server/matrix.qh>
-#include <server/miscfunctions.qh>
 #include <server/player.qh>
 #include <server/portals.qh>
 #include <server/race.qh>
index 7e8e5066020e19df88acccd737838c93184a6b63..536a3b6235ee1328d584468e1c2c8fc5f009f811 100644 (file)
@@ -7,7 +7,6 @@
 #include <server/client.qh>
 #include <server/gamelog.qh>
 #include <server/main.qh>
-#include "miscfunctions.qh"
 
 #include "command/common.qh"
 #include <common/playerstats.qh>
index 40a07a44c43c1d23422b88edcfd438bf95ec00d5..c5a955749476b71fc0a330f1bf3870d9f6c202f5 100644 (file)
@@ -8,9 +8,10 @@
 #include <common/stats.qh>
 #include <server/damage.qh>
 #include <server/items/items.qh>
-#include <server/miscfunctions.qh>
+#include <server/mutators/_mod.qh>
 #include <server/weapons/selection.qh>
 #include <server/weapons/weaponsystem.qh>
+#include <server/world.qh>
 #include "../cvars.qh"
 
 #include "../aim.qh"
index 9c95fb87ba8d955fa6a2af70115f465b5ec1ca2d..dbc55a90c3583f98c85008a92275d9651abea331 100644 (file)
@@ -2,9 +2,9 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include <server/items/items.qh>
 #include <server/items/spawning.qh>
+#include <server/mutators/_mod.qh>
 #include <server/resources.qh>
 #include "havocbot.qh"
 
index ff361388b297b988548dffa4c1c125817f79eb91..8a48efb0e0375e1b7b522a84cb9f7b9bdc317165 100644 (file)
@@ -3,7 +3,6 @@
 #include <server/bot/api.qh>
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include "cvars.qh"
 
 #include "bot.qh"
index 94c849650f9bbc47b73cfdee073a1a668ae25366..bad63baa8afe82209567330ae34c31a451fcdde1 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include <server/weapons/selection.qh>
 #include <server/weapons/weaponsystem.qh>
 #include "cvars.qh"
index a9069a0b158ac58cdf394339c28ac171781bf285..65da3b94c5eac95d7a1c6fcf275cf3cf314798c8 100644 (file)
@@ -3,8 +3,8 @@
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
 #include <server/items/items.qh>
-#include <server/miscfunctions.qh>
 #include <server/spawnpoints.qh>
+#include <server/weapons/tracing.qh>
 #include "cvars.qh"
 
 #include "bot.qh"
index 3153ff111fab853de015b24c90a3b0da9b0dcf23..cda65308d721ef3e45564dc6d90f48b4e1f43bf5 100644 (file)
@@ -1,11 +1,11 @@
 #include "campaign.qh"
 
+#include <common/mapinfo.qh>
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
 
 #include "cheats.qh"
 #include <server/intermission.qh>
-#include "miscfunctions.qh"
 #include "world.qh"
 
 #include "../common/campaign_common.qh"
index 3362ab53962f98c5626c7d8f37301cdca5e21e98..204ed13410defe587a59a540b5bc207a8787e295 100644 (file)
@@ -11,7 +11,9 @@
 #include <server/gamelog.qh>
 #include <server/main.qh>
 #include <server/mapvoting.qh>
-#include <server/miscfunctions.qh>
+#include <server/mutators/_mod.qh>
+#include <server/weapons/tracing.qh>
+#include <server/world.qh>
 
 /**
  * message "": do not say, just test flood control
index fe1d1130a40091c09b0024ee07481ff43dc2f8f2..2306abd693ec02aad534192dc95b7f84710ddefe 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include <common/effects/all.qh>
 #include <server/resources.qh>
 #include <server/main.qh>
index f2c2614105f907bf6169c2d343ea44b1a45e9eba..d67cd46aee5441a8a4dc0315299c25fa730574b0 100644 (file)
@@ -3,13 +3,11 @@
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
 #include <server/chat.qh>
-#include <server/miscfunctions.qh>
 #include <common/effects/all.qh>
 #include "anticheat.qh"
 #include "impulse.qh"
 #include "player.qh"
 #include "ipban.qh"
-#include "miscfunctions.qh"
 #include "portals.qh"
 #include "teamplay.qh"
 #include "spawnpoints.qh"
@@ -26,6 +24,7 @@
 #include <server/gamelog.qh>
 #include "race.qh"
 #include <server/main.qh>
+#include <server/mutators/_mod.qh>
 #include "antilag.qh"
 #include "campaign.qh"
 #include "command/common.qh"
index 73ccb383d40fe3f2c355b325c3eb3846f15e8541..96adde60f3d70baa5cca7ebd79b3831f78662743 100644 (file)
@@ -4,6 +4,7 @@
 #include <common/stats.qh>
 #include <server/client.qh>
 #include <server/player.qh>
+#include <server/mutators/_mod.qh>
 
 #include "damage.qh"
 #include "teamplay.qh"
index 962a8a1a8c203551e5af591a87f27ca6c3ec54f1..1822f1a818d9437ef3c57a584fd4a626edebf6b0 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include <common/state.qh>
 #include <common/command/_mod.qh>
 #include "banning.qh"
index 8ffc52b24aa5dc0a7855f46894de47c6d5bc2001..6426ce1a29ec217e0d2bf72084fb9a09fabbbf81 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <server/chat.qh>
 #include <server/world.qh>
-#include <server/miscfunctions.qh>
 
 #include <common/command/_mod.qh>
 
index d679272821c589e1c4ca81dba9c1ed101afaa5fd..710c3889f345f744ed461c334d3cf3e44a9e54ad 100644 (file)
@@ -2,10 +2,10 @@
 
 #include <server/chat.qh>
 #include <server/client.qh>
+#include <server/mutators/_mod.qh>
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
 #include <server/world.qh>
-#include <server/miscfunctions.qh>
 
 #include <common/command/_mod.qh>
 #include "common.qh"
index 95ee35a36f52348480366a6a7e257c113f7f023a..17fcc2d3502c6186eaed644fd711763dfa4efa69 100644 (file)
@@ -4,13 +4,14 @@
 #include <common/wepent.qh>
 #include <common/stats.qh>
 #include <server/intermission.qh>
+#include <server/main.qh>
+#include <server/mutators/_mod.qh>
 #include <server/world.qh>
-#include <server/miscfunctions.qh>
 
 #include <common/command/_mod.qh>
 #include "getreplies.qh"
 
-#include "../race.qh"
+#include <server/race.qh>
 
 #include <common/constants.qh>
 #include <common/gamemodes/_mod.qh>
index 0f85507fd48f09b4754be4044bb4eba5ae49b11a..16b636c85158ebac30f50159f4d9b1141f7c0119 100644 (file)
@@ -4,7 +4,6 @@
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
 #include <server/gamelog.qh>
-#include <server/miscfunctions.qh>
 
 #include <common/command/_mod.qh>
 #include "vote.qh"
@@ -13,7 +12,7 @@
 
 #include "../damage.qh"
 #include <server/intermission.qh>
-#include "../world.qh"
+#include <server/world.qh>
 #include "../teamplay.qh"
 #include "../race.qh"
 #include "../round_handler.qh"
index d2eb785b584fec3a810ad6d6405aff25413bdd96..23ae923b0a61c1213f2d4289ebfdbe8dc47e58e1 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include <common/weapons/_all.qh>
 
 //***********************
index 4bb22b13eef8eddc968d4f41a1cdc30a017da7ad..bda38dcf2ce1bc2d395c103ace263919aee92ed8 100644 (file)
@@ -3,7 +3,6 @@
 #include <server/client.qh>
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include <server/items/items.qh>
 #include <server/items/spawning.qh>
 #include <server/resources.qh>
index 4b7a6d31b30ee480b6f0a1054d729216b2730547..784303010162df1cbdb5874ad404aead5c9fa008 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include <server/items/spawning.qh>
 #include <common/weapons/_all.qh>
 
index 02a795bba4c3d0e328ad025af3e0259e13163b91..f0655a9f895d2b746281632a6cfeb1b6a03a8e43 100644 (file)
@@ -8,6 +8,7 @@
 #include <server/items/items.qh>
 #include <server/mutators/_mod.qh>
 #include <server/main.qh>
+#include <server/world.qh>
 #include "teamplay.qh"
 #include "scores.qh"
 #include "spawnpoints.qh"
index 02a637ca005aea0f233fc22145286ba1cfa92c7a..60e4f0a657b27562ad17ab302c08e0256f3b34f3 100644 (file)
@@ -6,7 +6,6 @@
     #include <common/weapons/_all.qh>
     #include <common/stats.qh>
     #include <server/items/items.qh>
-    #include <server/miscfunctions.qh>
     #include <lib/warpzone/common.qh>
     #include <common/constants.qh>
     #include <common/teams.qh>
index a84a37fc3d894cb7fe61b7af88341271365f6ce5..596b542e76a0453e380e7f23b46acd8608d60088 100644 (file)
@@ -4,7 +4,8 @@
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
 #include <server/damage.qh>
-#include <server/miscfunctions.qh>
+#include <server/mutators/_mod.qh>
+#include <server/world.qh>
 #include <common/effects/all.qh>
 #include "weapons/common.qh"
 #include "weapons/csqcprojectile.qh"
index 779384d70c08747fe6e29c13fa6c4ccec2644721..2d30b4c7aed825b830ccb38530ee34afdf336b27 100644 (file)
@@ -7,6 +7,7 @@
 #include "client.qh"
 #include "clientkill.qh"
 #include "damage.qh"
+#include <server/mutators/_mod.qh>
 #include "weapons/selection.qh"
 #include "weapons/tracing.qh"
 #include "weapons/weaponsystem.qh"
index bb19b0c701bca4273b1a7cf5f70fd4035761a3eb..4c386b8f30d65dde70277c6f60080e7b6beacf67 100644 (file)
@@ -2,8 +2,8 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include "autocvars.qh"
+#include <server/main.qh>
 #include "command/banning.qh"
 #include "../common/constants.qh"
 #include "../common/util.qh"
index 0983d4621fad6365d74865f7b070607658efa9c3..2546362af83ee9a1e03cd7a9a46b7097e14c2222 100644 (file)
@@ -5,6 +5,7 @@
 #include "damage.qh"
 #include "world.qh"
 #include "spawnpoints.qh"
+#include <server/ipban.qh>
 #include <server/gamelog.qh>
 
 #include "bot/api.qh"
@@ -17,6 +18,7 @@
 #include <server/compat/quake3.qh>
 
 #include "../common/constants.qh"
+#include <common/command/generic.qh>
 #include "../common/deathtypes/all.qh"
 #include "../common/debug.qh"
 #include "../common/mapinfo.qh"
@@ -380,6 +382,37 @@ void WarpZone_PostInitialize_Callback()
        delete(tracetest_ent);
 }
 
+/** engine callback */
+void URI_Get_Callback(float id, float status, string data)
+{
+       if(url_URI_Get_Callback(id, status, data))
+       {
+               // handled
+       }
+       else if (id == URI_GET_DISCARD)
+       {
+               // discard
+       }
+       else if (id >= URI_GET_CURL && id <= URI_GET_CURL_END)
+       {
+               // sv_cmd curl
+               Curl_URI_Get_Callback(id, status, data);
+       }
+       else if (id >= URI_GET_IPBAN && id <= URI_GET_IPBAN_END)
+       {
+               // online ban list
+               OnlineBanList_URI_Get_Callback(id, status, data);
+       }
+       else if (MUTATOR_CALLHOOK(URI_GetCallback, id, status, data))
+       {
+               // handled by a mutator
+       }
+       else
+       {
+               LOG_INFO("Received HTTP request data for an invalid id ", ftos(id), ".");
+       }
+}
+
 /*
 ==================
 main
index a8c86fe2f2f304c5b4fe0c9ac4c42cea17232244..2fde70481f6839c5199a9ba53565025b56e786b6 100644 (file)
@@ -10,7 +10,8 @@ void remove_safely(entity e);
 
 void remove_unsafely(entity e);
 
-bool expr_evaluate(string s);
+// copies a string to a tempstring (so one can strunzone it)
+string strcat1(string s) = #115; // FRIK_FILE
 
 #ifdef PROFILING
 float client_cefc_accumulator;
index bdd563b81c99156f632a47ce1be21e9087e1d418..d0ade66c593f3b14c5162ad9114aa8296057ae01 100644 (file)
@@ -5,7 +5,6 @@
 #include <common/stats.qh>
 #include <server/gamelog.qh>
 #include <server/intermission.qh>
-#include <server/miscfunctions.qh>
 #include "world.qh"
 #include "command/cmd.qh"
 #include "command/getreplies.qh"
diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc
deleted file mode 100644 (file)
index d451318..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-// NOTE: Please do NOT add new functions to this file! It is a dumping ground that is in the process of being cleaned up, please find a proper home for your code!
-
-#include "miscfunctions.qh"
-
-#include "antilag.qh"
-#include "command/common.qh"
-#include "client.qh"
-#include "damage.qh"
-#include "hook.qh"
-#include "world.qh"
-#include <server/gamelog.qh>
-#include "ipban.qh"
-#include <server/intermission.qh>
-#include <server/items/items.qh>
-#include <server/mutators/_mod.qh>
-#include <server/spawnpoints.qh>
-#include <server/main.qh>
-#include "mapvoting.qh"
-#include "resources.qh"
-#include <server/items/spawning.qh>
-#include "player.qh"
-#include "weapons/accuracy.qh"
-#include "weapons/common.qh"
-#include "weapons/csqcprojectile.qh"
-#include "weapons/selection.qh"
-#include "../common/command/_mod.qh"
-#include "../common/constants.qh"
-#include <common/net_linked.qh>
-#include <common/weapons/weapon/crylink.qh>
-#include "../common/deathtypes/all.qh"
-#include "../common/mapinfo.qh"
-#include "../common/notifications/all.qh"
-#include "../common/playerstats.qh"
-#include "../common/teams.qh"
-#include "../common/mapobjects/subs.qh"
-#include <common/mapobjects/trigger/hurt.qh>
-#include <common/mapobjects/target/location.qh>
-#include "../common/util.qh"
-#include "../common/turrets/sv_turrets.qh"
-#include <common/weapons/_all.qh>
-#include "../common/vehicles/sv_vehicles.qh"
-#include "../common/vehicles/vehicle.qh"
-#include "../common/items/_mod.qh"
-#include "../common/state.qh"
-#include "../common/effects/qc/globalsound.qh"
-#include "../common/wepent.qh"
-#include <common/weapons/weapon.qh>
-#include "../lib/csqcmodel/sv_model.qh"
-#include "../lib/warpzone/anglestransform.qh"
-#include "../lib/warpzone/server.qh"
-
-void crosshair_trace(entity pl)
-{
-       traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
-}
-
-void crosshair_trace_plusvisibletriggers(entity pl)
-{
-       crosshair_trace_plusvisibletriggers__is_wz(pl, false);
-}
-
-void WarpZone_crosshair_trace_plusvisibletriggers(entity pl)
-{
-       crosshair_trace_plusvisibletriggers__is_wz(pl, true);
-}
-
-void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz)
-{
-       FOREACH_ENTITY_FLOAT(solid, SOLID_TRIGGER,
-       {
-               if(it.model != "")
-               {
-                       it.solid = SOLID_BSP;
-                       IL_PUSH(g_ctrace_changed, it);
-               }
-       });
-
-       if (is_wz)
-               WarpZone_crosshair_trace(pl);
-       else
-               crosshair_trace(pl);
-
-       IL_EACH(g_ctrace_changed, true, { it.solid = SOLID_TRIGGER; });
-
-       IL_CLEAR(g_ctrace_changed);
-}
-
-void WarpZone_crosshair_trace(entity pl)
-{
-       WarpZone_traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
-}
-
-float trace_hits_box_a0, trace_hits_box_a1;
-
-float trace_hits_box_1d(float end, float thmi, float thma)
-{
-    if (end == 0)
-    {
-        // just check if x is in range
-        if (0 < thmi)
-            return false;
-        if (0 > thma)
-            return false;
-    }
-    else
-    {
-        // do the trace with respect to x
-        // 0 -> end has to stay in thmi -> thma
-        trace_hits_box_a0 = max(trace_hits_box_a0, min(thmi / end, thma / end));
-        trace_hits_box_a1 = min(trace_hits_box_a1, max(thmi / end, thma / end));
-        if (trace_hits_box_a0 > trace_hits_box_a1)
-            return false;
-    }
-    return true;
-}
-
-float trace_hits_box(vector start, vector end, vector thmi, vector thma)
-{
-    end -= start;
-    thmi -= start;
-    thma -= start;
-    // now it is a trace from 0 to end
-
-    trace_hits_box_a0 = 0;
-    trace_hits_box_a1 = 1;
-
-    if (!trace_hits_box_1d(end.x, thmi.x, thma.x))
-        return false;
-    if (!trace_hits_box_1d(end.y, thmi.y, thma.y))
-        return false;
-    if (!trace_hits_box_1d(end.z, thmi.z, thma.z))
-        return false;
-
-    return true;
-}
-
-float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma)
-{
-    return trace_hits_box(start, end, thmi - ma, thma - mi);
-}
-
-/** engine callback */
-void URI_Get_Callback(float id, float status, string data)
-{
-       if(url_URI_Get_Callback(id, status, data))
-       {
-               // handled
-       }
-       else if (id == URI_GET_DISCARD)
-       {
-               // discard
-       }
-       else if (id >= URI_GET_CURL && id <= URI_GET_CURL_END)
-       {
-               // sv_cmd curl
-               Curl_URI_Get_Callback(id, status, data);
-       }
-       else if (id >= URI_GET_IPBAN && id <= URI_GET_IPBAN_END)
-       {
-               // online ban list
-               OnlineBanList_URI_Get_Callback(id, status, data);
-       }
-       else if (MUTATOR_CALLHOOK(URI_GetCallback, id, status, data))
-       {
-               // handled by a mutator
-       }
-       else
-       {
-               LOG_INFO("Received HTTP request data for an invalid id ", ftos(id), ".");
-       }
-}
-
-string uid2name(string myuid)
-{
-       string s = db_get(ServerProgsDB, strcat("/uid2name/", myuid));
-
-       // FIXME remove this later after 0.6 release
-       // convert old style broken records to correct style
-       if(s == "")
-       {
-               s = db_get(ServerProgsDB, strcat("uid2name", myuid));
-               if(s != "")
-               {
-                       db_put(ServerProgsDB, strcat("/uid2name/", myuid), s);
-                       db_remove(ServerProgsDB, strcat("uid2name", myuid));
-               }
-       }
-
-       if(s == "")
-               s = "^1Unregistered Player";
-       return s;
-}
-
-bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance)
-{
-    float m = e.dphitcontentsmask;
-    e.dphitcontentsmask = goodcontents | badcontents;
-
-    vector org = boundmin;
-    vector delta = boundmax - boundmin;
-
-    vector start, end;
-    start = end = org;
-    int j; // used after the loop
-    for(j = 0; j < attempts; ++j)
-    {
-        start.x = org.x + random() * delta.x;
-        start.y = org.y + random() * delta.y;
-        start.z = org.z + random() * delta.z;
-
-        // rule 1: start inside world bounds, and outside
-        // solid, and don't start from somewhere where you can
-        // fall down to evil
-        tracebox(start, e.mins, e.maxs, start - '0 0 1' * delta.z, MOVE_NORMAL, e);
-        if (trace_fraction >= 1)
-            continue;
-        if (trace_startsolid)
-            continue;
-        if (trace_dphitcontents & badcontents)
-            continue;
-        if (trace_dphitq3surfaceflags & badsurfaceflags)
-            continue;
-
-        // rule 2: if we are too high, lower the point
-        if (trace_fraction * delta.z > maxaboveground)
-            start = trace_endpos + '0 0 1' * maxaboveground;
-        vector enddown = trace_endpos;
-
-        // rule 3: make sure we aren't outside the map. This only works
-        // for somewhat well formed maps. A good rule of thumb is that
-        // the map should have a convex outside hull.
-        // these can be traceLINES as we already verified the starting box
-        vector mstart = start + 0.5 * (e.mins + e.maxs);
-        traceline(mstart, mstart + '1 0 0' * delta.x, MOVE_NORMAL, e);
-        if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
-            continue;
-        traceline(mstart, mstart - '1 0 0' * delta.x, MOVE_NORMAL, e);
-        if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
-            continue;
-        traceline(mstart, mstart + '0 1 0' * delta.y, MOVE_NORMAL, e);
-        if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
-            continue;
-        traceline(mstart, mstart - '0 1 0' * delta.y, MOVE_NORMAL, e);
-        if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
-            continue;
-        traceline(mstart, mstart + '0 0 1' * delta.z, MOVE_NORMAL, e);
-        if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
-            continue;
-
-               // rule 4: we must "see" some spawnpoint or item
-           entity sp = NULL;
-           IL_EACH(g_spawnpoints, checkpvs(mstart, it),
-           {
-               if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
-               {
-                       sp = it;
-                       break;
-               }
-           });
-               if(!sp)
-               {
-                       int items_checked = 0;
-                       IL_EACH(g_items, checkpvs(mstart, it),
-                       {
-                               if((traceline(mstart, it.origin + (it.mins + it.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1)
-                               {
-                                       sp = it;
-                                       break;
-                               }
-
-                               ++items_checked;
-                               if(items_checked >= attempts)
-                                       break; // sanity
-                       });
-
-                       if(!sp)
-                               continue;
-               }
-
-        // find a random vector to "look at"
-        end.x = org.x + random() * delta.x;
-        end.y = org.y + random() * delta.y;
-        end.z = org.z + random() * delta.z;
-        end = start + normalize(end - start) * vlen(delta);
-
-        // rule 4: start TO end must not be too short
-        tracebox(start, e.mins, e.maxs, end, MOVE_NORMAL, e);
-        if(trace_startsolid)
-            continue;
-        if(trace_fraction < minviewdistance / vlen(delta))
-            continue;
-
-        // rule 5: don't want to look at sky
-        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
-            continue;
-
-        // rule 6: we must not end up in trigger_hurt
-        if(tracebox_hits_trigger_hurt(start, e.mins, e.maxs, enddown))
-            continue;
-
-        break;
-    }
-
-    e.dphitcontentsmask = m;
-
-    if(j < attempts)
-    {
-        setorigin(e, start);
-        e.angles = vectoangles(end - start);
-        LOG_DEBUG("Needed ", ftos(j + 1), " attempts");
-        return true;
-    }
-    return false;
-}
-
-float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
-{
-       return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance);
-}
diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh
deleted file mode 100644 (file)
index ffed5b2..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#pragma once
-
-#include <common/weapons/_all.qh>
-#include <common/stats.qh>
-#include <server/client.qh>
-#include <server/world.qh>
-
-#include <server/intermission.qh>
-#include <server/items/items.qh>
-
-#include <server/mutators/_mod.qh>
-
-#include <common/constants.qh>
-#include <common/mapinfo.qh>
-#include <common/turrets/all.qh>
-
-float trace_hits_box_1d(float end, float thmi, float thma);
-
-float trace_hits_box(vector start, vector end, vector thmi, vector thma);
-
-float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma);
-
-void crosshair_trace(entity pl);
-
-void crosshair_trace_plusvisibletriggers(entity pl);
-void WarpZone_crosshair_trace_plusvisibletriggers(entity pl);
-void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz);
-
-string uid2name(string myuid);
-
-bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance);
-
-float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance);
-
-float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma);
-
-void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
-
-void WarpZone_crosshair_trace(entity pl);
-
-void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
-
-#define PROJECTILE_TOUCH(e,t) MACRO_BEGIN if (WarpZone_Projectile_Touch(e,t)) return; MACRO_END
-
-// copies a string to a tempstring (so one can strunzone it)
-string strcat1(string s) = #115; // FRIK_FILE
-
-IntrusiveList g_ctrace_changed;
-STATIC_INIT(g_ctrace_changed) { g_ctrace_changed = IL_NEW(); }
index f15098766fe069e8b26db3edcb3328508e23d96f..0830fb686d1ccdf8a5d6e04f73bd06ed08b9b5af 100644 (file)
@@ -1,8 +1,9 @@
 #include "loader.qh"
 
+#include <common/mutators/base.qh>
+#include <common/mapinfo.qh>
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 
 STATIC_INIT_LATE(Gametype) {
     Gametype g = MapInfo_CurrentGametype();
index b42e5ef688ec39f2e1879adc8966b0819e61102d..16090e31ba151b4ceaec4e20553da119cd0fb6e1 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include "pathlib.qh"
 #include "utility.qh"
 #include <common/turrets/util.qh>
index 06568ae0d3d99f3a3dbdde94e956262ec219bbdf..65e4923ea77f46502f49c53a6ab2a457b7435da6 100644 (file)
@@ -3,7 +3,6 @@
 #include <common/mapobjects/triggers.qh>
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include "pathlib.qh"
 #include "utility.qh"
 
index 51d3f65c9e8f3e8b2dcf7d9789727c9a1573f486..799cd43589447968ccc67bba4d481a0aee977870 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include "pathlib.qh"
 
 bool location_isok(vector point, bool waterok, bool air_isok)
index bd73d34947f5f6bc8b3720ad3b673997ffa5912e..a632aab01c7625452f5ff887bd21fb578cf43f43 100644 (file)
@@ -6,9 +6,9 @@
 #include "client.qh"
 #include "clientkill.qh"
 #include "damage.qh"
+#include <server/mutators/_mod.qh>
 #include "world.qh"
 #include "handicap.qh"
-#include "miscfunctions.qh"
 #include "portals.qh"
 #include "teamplay.qh"
 #include <server/main.qh>
index 7c04ea1da88dda0542b2daf328fdd1af5a4a75b3..bc07efd5878f4e462b6ba6ba7248191efc4bc569 100644 (file)
@@ -5,8 +5,9 @@
 #include <server/damage.qh>
 #include <server/gamelog.qh>
 #include <server/intermission.qh>
+#include <server/main.qh>
+#include <server/mutators/_mod.qh>
 #include <server/world.qh>
-#include <server/miscfunctions.qh>
 #include <server/weapons/common.qh>
 #include "client.qh"
 #include "cheats.qh"
 #include <common/vehicles/sv_vehicles.qh>
 #include "../common/mutators/mutator/waypoints/waypointsprites.qh"
 
+string uid2name(string myuid)
+{
+       string s = db_get(ServerProgsDB, strcat("/uid2name/", myuid));
+
+       // FIXME remove this later after 0.6 release
+       // convert old style broken records to correct style
+       if(s == "")
+       {
+               s = db_get(ServerProgsDB, strcat("uid2name", myuid));
+               if(s != "")
+               {
+                       db_put(ServerProgsDB, strcat("/uid2name/", myuid), s);
+                       db_remove(ServerProgsDB, strcat("uid2name", myuid));
+               }
+       }
+
+       if(s == "")
+               s = "^1Unregistered Player";
+       return s;
+}
+
 void write_recordmarker(entity pl, float tstart, float dt)
 {
     GameLogEcho(strcat(":recordset:", ftos(pl.playerid), ":", ftos(dt)));
index 496fd3874b76a226933fc2b8fe8bd4511f0b0739..9dd37a89e1f8f9daa7eb53c93507987fab61f9f9 100644 (file)
@@ -72,4 +72,6 @@ void race_RetractPlayer(entity this);
 
 void race_InitSpectator();
 
+string uid2name(string myuid);
+
 spawnfunc(target_checkpoint);
index e36eb57508680f7d4b9fd8e980aaa3c9d59b9864..ef3dea1bf122de78f37575a350ac07e04a275ba3 100644 (file)
@@ -6,7 +6,8 @@
 /// \copyright GNU GPLv2 or any later version.
 
 #include "autocvars.qh"
-#include "miscfunctions.qh"
+#include <server/mutators/_mod.qh>
+#include <server/world.qh>
 
 float GetResourceLimit(entity e, int res_type)
 {
index 66da6c37c1fb154ec39cac5381e57be04e9978a3..fa970f955e0d9fddf7f4af0b11c92dc46bd7047b 100644 (file)
@@ -1,7 +1,6 @@
 #include "round_handler.qh"
 
 #include <server/world.qh>
-#include <server/miscfunctions.qh>
 #include "campaign.qh"
 #include "command/vote.qh"
 #include <common/mapobjects/triggers.qh>
index de298e220c5b34e0e8b6fa1fcb59eb569475bb0c..73d03ae785783edff94e790774314b69d9c59baf 100644 (file)
@@ -5,7 +5,6 @@
 #include "client.qh"
 #include <server/intermission.qh>
 #include <server/world.qh>
-#include <server/miscfunctions.qh>
 #include <server/mutators/_mod.qh>
 #include <server/round_handler.qh>
 #include <common/net_linked.qh>
index 7511162aa57748ab2f3385185c3bd26f541b814f..1ad2640ad63cbb73ad89c1d6e48a31acb143c13a 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include "client.qh"
 #include "scores.qh"
 #include <common/gamemodes/rules.qh>
index dec632f6b2a5dabc580444057aab672201ec3323..4bcffe68a4c2b5a0a762edbafa7eb75eff3cd506 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <server/mutators/_mod.qh>
 #include <server/world.qh>
-#include "miscfunctions.qh"
 #include "race.qh"
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
index 7124b1895f5c8082cd3992ef00ca0b34de214a26..de9b3579f1d49c00c36d37b085d2b265a8289ea7 100644 (file)
@@ -1,6 +1,5 @@
 #pragma once
 
-#include "miscfunctions.qh"
 #include "autocvars.qh"
 #include "client.qh"
 #include "command/_mod.qh"
index 2ec4fc710433bfbd3785dc698b9785af8ba8013f..e8f59f53ef523930d007c1b464ebf39bb7a5902e 100644 (file)
@@ -9,6 +9,7 @@
 #include <common/teams.qh>
 #include <common/util.qh>
 #include <common/weapons/_all.qh>
+#include <server/world.qh>
 
 int accuracy_byte(float n, float d)
 {
index d1665b2bd1dadc5f5de95bd925a2c828d5789646..396de1bdb36be71b066c106dac689d75e8bcb321 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 
 .bool cvar_cl_accuracy_data_share;
 REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share");
index a1a5ad964a7937e32807a44b5e877c5fb166c47e..2539b7d3bc1613544ae7db3b07e2e7529153d6ca 100644 (file)
@@ -5,7 +5,7 @@
 #include <common/stats.qh>
 #include <server/damage.qh>
 #include <server/items/items.qh>
-#include <server/miscfunctions.qh>
+#include <server/mutators/_mod.qh>
 #include <common/constants.qh>
 #include <common/net_linked.qh>
 #include <common/deathtypes/all.qh>
index c8e3eb533b836a99ce46eeb7e547d815ff7cea86..77f707d0ac233c4533017cc6d98bba74b701356d 100644 (file)
@@ -21,6 +21,8 @@ bool WarpZone_Projectile_Touch_ImpactFilter_Callback(entity this, entity toucher
 
 .entity realowner;
 
+#define PROJECTILE_TOUCH(e,t) MACRO_BEGIN if (WarpZone_Projectile_Touch(e,t)) return; MACRO_END
+
 #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE
 // when doing this, hagar can go through clones
 // #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_BBOX
index 758cd51ab33163d8c1265810218a316c24285235..27a376ec707136fd2f7b05f2b79e1215a6d3cab6 100644 (file)
@@ -3,7 +3,6 @@
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
 #include <server/items/items.qh>
-#include <server/miscfunctions.qh>
 
 #include "../command/common.qh"
 
index 2d56b783f232616e4dc0a67ae4926f5a3f8ad18e..45642f2985b574fdca7a569fe7f73478e6d716c0 100644 (file)
@@ -4,7 +4,6 @@
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
 #include <server/world.qh>
-#include <server/miscfunctions.qh>
 #include "../antilag.qh"
 #include <common/weapons/_all.qh>
 #include <common/state.qh>
index 03c203f4e3e20d16454a28eac0ba9278e87e5ab1..01c05d3fb945ca1bdc835c0a512f42ee510e2cad 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 
 .int selectweapon; // last selected weapon of the player
 
index 63bc865e29dc47bf7404474dc9234365f08999bd..f555a6ea7bdb69278479171a6e71146e2a54f389 100644 (file)
@@ -5,6 +5,7 @@
 #include <server/mutators/_mod.qh>
 #include <server/items/items.qh>
 #include <server/items/spawning.qh>
+#include <server/world.qh>
 #include <common/weapons/_all.qh>
 
 .bool m_isreplaced; ///< Holds whether the weapon has been replaced.
index eb40bfc40f24a432b94536cc16862959239dd192..e0f1a61a9aa08def978a619c730e8f6810b37605 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 
 string W_Apply_Weaponreplace(string in);
 
index 2408adbf140ef1f75458129a9c72441725fcdad5..1a92f39919f18a31d5754a53f1196df8a7007666 100644 (file)
@@ -6,6 +6,7 @@
 #include <server/mutators/_mod.qh>
 #include <server/items/items.qh>
 #include "../damage.qh"
+#include <server/world.qh>
 #include <common/items/item.qh>
 #include <common/mapinfo.qh>
 #include <common/notifications/all.qh>
index 8ebd4080ca172b6edbac7676eafa268a52bc0e24..22adc649b2e2504300d1d8bf3f388fb7e9c0a521 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 
 .float savenextthink;
 void thrown_wep_think(entity this);
index 3e838265266dd4d44e0fdd4fbdc294587eeb1365..b82095a69971beaa49e6be3a86e07f2e760dc71a 100644 (file)
@@ -9,7 +9,8 @@
 
 #include "../damage.qh"
 #include <server/main.qh>
-#include "../antilag.qh"
+#include <server/mutators/_mod.qh>
+#include <server/antilag.qh>
 
 #include <common/constants.qh>
 #include <common/net_linked.qh>
@@ -499,3 +500,44 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo
 {
        fireBullet_antilag(this, weaponentity, start, dir, spread, max_solid_penetration, damage, headshot_multiplier, force, dtype, tracer_effect, true);
 }
+
+void crosshair_trace(entity pl)
+{
+       traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
+}
+
+void crosshair_trace_plusvisibletriggers(entity pl)
+{
+       crosshair_trace_plusvisibletriggers__is_wz(pl, false);
+}
+
+void WarpZone_crosshair_trace_plusvisibletriggers(entity pl)
+{
+       crosshair_trace_plusvisibletriggers__is_wz(pl, true);
+}
+
+void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz)
+{
+       FOREACH_ENTITY_FLOAT(solid, SOLID_TRIGGER,
+       {
+               if(it.model != "")
+               {
+                       it.solid = SOLID_BSP;
+                       IL_PUSH(g_ctrace_changed, it);
+               }
+       });
+
+       if (is_wz)
+               WarpZone_crosshair_trace(pl);
+       else
+               crosshair_trace(pl);
+
+       IL_EACH(g_ctrace_changed, true, { it.solid = SOLID_TRIGGER; });
+
+       IL_CLEAR(g_ctrace_changed);
+}
+
+void WarpZone_crosshair_trace(entity pl)
+{
+       WarpZone_traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
+}
index 67246859c0bb043063991ef6da145e37289b9dbf..9c5a77c8d5b31d14e1f7e4471c9d4cbf8b50b245 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 
 vector w_shotorg;
 vector w_shotdir;
@@ -82,3 +81,18 @@ entity fireBullet_last_hit;
 void fireBullet_trace_callback(vector start, vector hit, vector end);
 void fireBullet_antilag(entity this, .entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float headshot_multiplier, float force, float dtype, entity tracer_effect, bool do_antilag);
 void fireBullet(entity this, .entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float headshot_multiplier, float force, float dtype, entity tracer_effect);
+
+void crosshair_trace(entity pl);
+
+void crosshair_trace_plusvisibletriggers(entity pl);
+void WarpZone_crosshair_trace_plusvisibletriggers(entity pl);
+void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz);
+
+void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
+
+void WarpZone_crosshair_trace(entity pl);
+
+void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
+
+IntrusiveList g_ctrace_changed;
+STATIC_INIT(g_ctrace_changed) { g_ctrace_changed = IL_NEW(); }
index 02ba234ea990f9a4844473c6f2830a5b5f5dc738..f774cb05637957d728565817fe76ae42827a32dc 100644 (file)
@@ -3,7 +3,6 @@
 #include <server/intermission.qh>
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
-#include <server/miscfunctions.qh>
 #include "../world.qh"
 
 #include <common/weapons/_all.qh>
index d1223c6d575eff72083363b2666dec77667fbcbf..284c1efc62443bbc1db8e3dab0791edcf0a956df 100644 (file)
@@ -1,6 +1,6 @@
 #pragma once
 
-#include <server/miscfunctions.qh>
+#include <common/weapons/all.qh>
 
 #define INDEPENDENT_ATTACK_FINISHED 1
 
index 4c51fe0647dff64802ec8d36a113cdfdb6d04888..88890fc2f9ad4d315f2856a1dd040a6beffea99a 100644 (file)
@@ -40,6 +40,7 @@
 #include "../common/stats.qh"
 #include "../common/teams.qh"
 #include <common/mapobjects/triggers.qh>
+#include <common/mapobjects/trigger/hurt.qh>
 #include "../common/mapobjects/trigger/secret.qh"
 #include "../common/mapobjects/target/music.qh"
 #include "../common/util.qh"
@@ -1019,6 +1020,133 @@ spawnfunc(light)
        delete(this);
 }
 
+bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance)
+{
+    float m = e.dphitcontentsmask;
+    e.dphitcontentsmask = goodcontents | badcontents;
+
+    vector org = boundmin;
+    vector delta = boundmax - boundmin;
+
+    vector start, end;
+    start = end = org;
+    int j; // used after the loop
+    for(j = 0; j < attempts; ++j)
+    {
+        start.x = org.x + random() * delta.x;
+        start.y = org.y + random() * delta.y;
+        start.z = org.z + random() * delta.z;
+
+        // rule 1: start inside world bounds, and outside
+        // solid, and don't start from somewhere where you can
+        // fall down to evil
+        tracebox(start, e.mins, e.maxs, start - '0 0 1' * delta.z, MOVE_NORMAL, e);
+        if (trace_fraction >= 1)
+            continue;
+        if (trace_startsolid)
+            continue;
+        if (trace_dphitcontents & badcontents)
+            continue;
+        if (trace_dphitq3surfaceflags & badsurfaceflags)
+            continue;
+
+        // rule 2: if we are too high, lower the point
+        if (trace_fraction * delta.z > maxaboveground)
+            start = trace_endpos + '0 0 1' * maxaboveground;
+        vector enddown = trace_endpos;
+
+        // rule 3: make sure we aren't outside the map. This only works
+        // for somewhat well formed maps. A good rule of thumb is that
+        // the map should have a convex outside hull.
+        // these can be traceLINES as we already verified the starting box
+        vector mstart = start + 0.5 * (e.mins + e.maxs);
+        traceline(mstart, mstart + '1 0 0' * delta.x, MOVE_NORMAL, e);
+        if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
+            continue;
+        traceline(mstart, mstart - '1 0 0' * delta.x, MOVE_NORMAL, e);
+        if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
+            continue;
+        traceline(mstart, mstart + '0 1 0' * delta.y, MOVE_NORMAL, e);
+        if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
+            continue;
+        traceline(mstart, mstart - '0 1 0' * delta.y, MOVE_NORMAL, e);
+        if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
+            continue;
+        traceline(mstart, mstart + '0 0 1' * delta.z, MOVE_NORMAL, e);
+        if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
+            continue;
+
+               // rule 4: we must "see" some spawnpoint or item
+           entity sp = NULL;
+           IL_EACH(g_spawnpoints, checkpvs(mstart, it),
+           {
+               if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
+               {
+                       sp = it;
+                       break;
+               }
+           });
+               if(!sp)
+               {
+                       int items_checked = 0;
+                       IL_EACH(g_items, checkpvs(mstart, it),
+                       {
+                               if((traceline(mstart, it.origin + (it.mins + it.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1)
+                               {
+                                       sp = it;
+                                       break;
+                               }
+
+                               ++items_checked;
+                               if(items_checked >= attempts)
+                                       break; // sanity
+                       });
+
+                       if(!sp)
+                               continue;
+               }
+
+        // find a random vector to "look at"
+        end.x = org.x + random() * delta.x;
+        end.y = org.y + random() * delta.y;
+        end.z = org.z + random() * delta.z;
+        end = start + normalize(end - start) * vlen(delta);
+
+        // rule 4: start TO end must not be too short
+        tracebox(start, e.mins, e.maxs, end, MOVE_NORMAL, e);
+        if(trace_startsolid)
+            continue;
+        if(trace_fraction < minviewdistance / vlen(delta))
+            continue;
+
+        // rule 5: don't want to look at sky
+        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
+            continue;
+
+        // rule 6: we must not end up in trigger_hurt
+        if(tracebox_hits_trigger_hurt(start, e.mins, e.maxs, enddown))
+            continue;
+
+        break;
+    }
+
+    e.dphitcontentsmask = m;
+
+    if(j < attempts)
+    {
+        setorigin(e, start);
+        e.angles = vectoangles(end - start);
+        LOG_DEBUG("Needed ", ftos(j + 1), " attempts");
+        return true;
+    }
+    return false;
+}
+
+float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
+{
+       return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance);
+}
+
 /*
 ===============================================================================
 
index 706c931c83c9897f41fba8b874bd3b529d93536f..f89d645c4220c1695f2313ab5f5a31a9b5cffad4 100644 (file)
@@ -117,6 +117,11 @@ void SetWinners(.float field, float value);
 void ReadyRestart();
 
 void DumpStats(float final);
+
+bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance);
+
+float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance);
+
 void CheckRules_World();
 float RedirectionThink();