From f40d50ebdbbfc5c65f0e75cdfa3bd176501e8d4a Mon Sep 17 00:00:00 2001
From: TimePath <andrew.hardaker1995@gmail.com>
Date: Sat, 10 Oct 2015 13:06:58 +1100
Subject: [PATCH] #includes: cleanup client

---
 qcsrc/client/_all.qh                          |  9 ++--
 qcsrc/client/announcer.qc                     |  2 -
 qcsrc/client/announcer.qh                     |  4 +-
 qcsrc/client/bgmscript.qc                     |  3 --
 qcsrc/client/bgmscript.qh                     |  4 +-
 qcsrc/client/{command => commands}/all.qc     |  0
 qcsrc/client/{command => commands}/all.qh     |  2 +-
 qcsrc/client/{command => commands}/cl_cmd.qc  | 10 +++++
 qcsrc/client/{command => commands}/cl_cmd.qh  |  4 +-
 qcsrc/client/controlpoint.qc                  |  3 +-
 qcsrc/client/controlpoint.qh                  |  4 +-
 qcsrc/client/csqc_constants.qh                |  4 +-
 qcsrc/client/csqcmodel_hooks.qc               | 15 +------
 qcsrc/client/damage.qc                        |  9 +---
 qcsrc/client/damage.qh                        |  4 +-
 qcsrc/client/effects.qc                       |  1 -
 qcsrc/client/effects.qh                       |  4 +-
 qcsrc/client/generator.qc                     |  5 +++
 qcsrc/client/generator.qh                     |  4 +-
 qcsrc/client/gibs.qc                          |  4 --
 qcsrc/client/gibs.qh                          |  4 +-
 qcsrc/client/hook.qc                          |  6 ---
 qcsrc/client/hook.qh                          |  4 +-
 qcsrc/client/hud.qc                           | 16 +-------
 qcsrc/client/hud.qh                           | 14 ++++++-
 qcsrc/client/hud_config.qc                    |  4 --
 qcsrc/client/hud_config.qh                    |  4 +-
 qcsrc/client/laser.qc                         |  6 ---
 qcsrc/client/laser.qh                         |  4 +-
 qcsrc/client/main.qc                          | 35 ++++------------
 qcsrc/client/main.qh                          |  4 +-
 qcsrc/client/mapvoting.qc                     |  2 -
 qcsrc/client/mapvoting.qh                     |  4 +-
 qcsrc/client/miscfunctions.qc                 |  2 -
 qcsrc/client/miscfunctions.qh                 |  4 +-
 qcsrc/client/modeleffects.qc                  |  1 -
 qcsrc/client/modeleffects.qh                  |  4 +-
 qcsrc/client/particles.qc                     |  2 -
 qcsrc/client/particles.qh                     |  4 +-
 qcsrc/client/player_skeleton.qc               |  6 ++-
 qcsrc/client/player_skeleton.qh               |  6 +--
 qcsrc/client/progs.inc                        |  5 ++-
 qcsrc/client/quickmenu.qc                     |  4 +-
 qcsrc/client/quickmenu.qh                     |  8 ++++
 qcsrc/client/rubble.qh                        |  4 +-
 qcsrc/client/scoreboard.qc                    |  3 +-
 qcsrc/client/scoreboard.qh                    |  4 +-
 qcsrc/client/shownames.qc                     |  2 -
 qcsrc/client/shownames.qh                     |  4 +-
 qcsrc/client/t_items.qc                       |  2 -
 qcsrc/client/teamradar.qc                     |  3 +-
 qcsrc/client/teamradar.qh                     |  4 +-
 qcsrc/client/tuba.qc                          |  2 -
 qcsrc/client/tuba.qh                          |  4 +-
 qcsrc/client/view.qc                          |  7 +++-
 qcsrc/client/wall.qc                          |  2 -
 qcsrc/client/wall.qh                          |  4 +-
 qcsrc/client/weapons/projectile.qc            |  2 +-
 qcsrc/client/weapons/projectile.qh            |  4 +-
 qcsrc/common/animdecide.qc                    |  3 ++
 qcsrc/common/command/generic.qc               |  2 +-
 qcsrc/common/effects/{effects.inc => all.inc} |  2 +
 qcsrc/common/effects/{effects.qc => all.qc}   |  2 +
 qcsrc/common/effects/{effects.qh => all.qh}   | 26 +++---------
 qcsrc/common/effects/effect.qh                | 22 ++++++++++
 qcsrc/common/minigames/cl_minigames_hud.qc    |  2 +-
 qcsrc/common/minigames/cl_minigames_hud.qh    |  7 ++++
 qcsrc/common/minigames/minigame/pp.qc         |  2 +
 qcsrc/common/models/all.qh                    | 21 +---------
 qcsrc/common/models/model.qh                  | 25 +++++++++++
 qcsrc/common/notifications.qh                 |  2 +
 qcsrc/common/sounds/all.inc                   |  1 +
 qcsrc/common/sounds/all.qh                    | 41 +++----------------
 qcsrc/common/sounds/sound.qh                  | 36 ++++++++++++++++
 qcsrc/common/triggers/subs.qh                 |  2 +
 qcsrc/common/util.qc                          | 34 ---------------
 qcsrc/common/util.qh                          |  2 -
 qcsrc/common/vehicles/sv_vehicles.qc          |  1 -
 qcsrc/common/vehicles/vehicle/racer.qc        |  1 -
 qcsrc/lib/_all.inc                            |  1 +
 qcsrc/lib/color.qh                            | 38 +++++++++++++++++
 qcsrc/server/_all.qh                          |  1 +
 qcsrc/server/cheats.qc                        |  1 -
 qcsrc/server/g_world.qc                       |  3 --
 qcsrc/server/progs.inc                        |  3 +-
 qcsrc/test/compilationunit.sh                 |  2 +-
 86 files changed, 285 insertions(+), 297 deletions(-)
 rename qcsrc/client/{command => commands}/all.qc (100%)
 rename qcsrc/client/{command => commands}/all.qh (69%)
 rename qcsrc/client/{command => commands}/cl_cmd.qc (98%)
 rename qcsrc/client/{command => commands}/cl_cmd.qh (85%)
 create mode 100644 qcsrc/client/quickmenu.qh
 rename qcsrc/common/effects/{effects.inc => all.inc} (99%)
 rename qcsrc/common/effects/{effects.qc => all.qc} (99%)
 rename qcsrc/common/effects/{effects.qh => all.qh} (68%)
 create mode 100644 qcsrc/common/effects/effect.qh
 create mode 100644 qcsrc/common/minigames/cl_minigames_hud.qh
 create mode 100644 qcsrc/common/models/model.qh
 create mode 100644 qcsrc/common/sounds/sound.qh
 create mode 100644 qcsrc/lib/color.qh

diff --git a/qcsrc/client/_all.qh b/qcsrc/client/_all.qh
index 7ae1430d41..adff5ccff4 100644
--- a/qcsrc/client/_all.qh
+++ b/qcsrc/client/_all.qh
@@ -1,12 +1,15 @@
 #ifndef CLIENT_ALL_H
 #define CLIENT_ALL_H
 
+#include "../common/util.qh"
+
+#include "../common/effects/all.qh"
+#include "../common/models/all.qh"
+#include "../common/sounds/all.qh"
+
 #include "autocvars.qh"
 #include "defs.qh"
 #include "main.qh"
 #include "miscfunctions.qh"
 
-#include "../common/models/all.qh"
-#include "../common/sounds/all.qh"
-
 #endif
diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc
index b7b7bb5c6e..e20557fa74 100644
--- a/qcsrc/client/announcer.qc
+++ b/qcsrc/client/announcer.qc
@@ -1,9 +1,7 @@
 #include "announcer.qh"
-#include "_all.qh"
 
 #include "../common/notifications.qh"
 #include "../common/stats.qh"
-#include "../common/util.qh"
 
 bool announcer_1min;
 bool announcer_5min;
diff --git a/qcsrc/client/announcer.qh b/qcsrc/client/announcer.qh
index 620b84544e..64be1433af 100644
--- a/qcsrc/client/announcer.qh
+++ b/qcsrc/client/announcer.qh
@@ -1,5 +1,5 @@
-#ifndef ANNOUNCER_H
-#define ANNOUNCER_H
+#ifndef CLIENT_ANNOUNCER_H
+#define CLIENT_ANNOUNCER_H
 
 void Announcer();
 
diff --git a/qcsrc/client/bgmscript.qc b/qcsrc/client/bgmscript.qc
index 894bf6955a..a984a19a32 100644
--- a/qcsrc/client/bgmscript.qc
+++ b/qcsrc/client/bgmscript.qc
@@ -1,7 +1,4 @@
 #include "bgmscript.qh"
-#include "_all.qh"
-
-#include "../common/util.qh"
 
 #define CONSTANT_SPEED_DECAY
 
diff --git a/qcsrc/client/bgmscript.qh b/qcsrc/client/bgmscript.qh
index 5921bb4bc7..d979e79d07 100644
--- a/qcsrc/client/bgmscript.qh
+++ b/qcsrc/client/bgmscript.qh
@@ -1,5 +1,5 @@
-#ifndef BGMSCRIPT_H
-#define BGMSCRIPT_H
+#ifndef CLIENT_BGMSCRIPT_H
+#define CLIENT_BGMSCRIPT_H
 
 entityclass(BGMScript);
 class(BGMScript) .string bgmscript;
diff --git a/qcsrc/client/command/all.qc b/qcsrc/client/commands/all.qc
similarity index 100%
rename from qcsrc/client/command/all.qc
rename to qcsrc/client/commands/all.qc
diff --git a/qcsrc/client/command/all.qh b/qcsrc/client/commands/all.qh
similarity index 69%
rename from qcsrc/client/command/all.qh
rename to qcsrc/client/commands/all.qh
index 34fc423a40..eb092c12b6 100644
--- a/qcsrc/client/command/all.qh
+++ b/qcsrc/client/commands/all.qh
@@ -1,7 +1,7 @@
 #ifndef CLIENT_COMMANDS_ALL_H
 #define CLIENT_COMMANDS_ALL_H
 
-#include "../../common/command/all.qh"
+#include "../../common/commands/all.qh"
 
 #include "cl_cmd.qh"
 
diff --git a/qcsrc/client/command/cl_cmd.qc b/qcsrc/client/commands/cl_cmd.qc
similarity index 98%
rename from qcsrc/client/command/cl_cmd.qc
rename to qcsrc/client/commands/cl_cmd.qc
index 88cd246ff1..bed70f57fc 100644
--- a/qcsrc/client/command/cl_cmd.qc
+++ b/qcsrc/client/commands/cl_cmd.qc
@@ -240,6 +240,16 @@ void LocalCommand_handlevote(int request, int argc)
 	}
 }
 
+bool QuickMenu_IsOpened();
+void QuickMenu_Close();
+bool QuickMenu_Open(string mode, string submenu);
+
+bool HUD_MinigameMenu_IsOpened();
+void HUD_MinigameMenu_Close();
+void HUD_MinigameMenu_Open();
+
+void HUD_Radar_Show_Maximized(bool doshow, bool clickable);
+
 void LocalCommand_hud(int request, int argc)
 {
 	switch(request)
diff --git a/qcsrc/client/command/cl_cmd.qh b/qcsrc/client/commands/cl_cmd.qh
similarity index 85%
rename from qcsrc/client/command/cl_cmd.qh
rename to qcsrc/client/commands/cl_cmd.qh
index da34310e3c..ba3151c43c 100644
--- a/qcsrc/client/command/cl_cmd.qh
+++ b/qcsrc/client/commands/cl_cmd.qh
@@ -1,5 +1,5 @@
-#ifndef CL_CMD_H
-#define CL_CMD_H
+#ifndef CLIENT_COMMANDS_CL_CMD_H
+#define CLIENT_COMMANDS_CL_CMD_H
 // ==============================================
 //  CSQC client commands code, written by Samual
 //  Last updated: December 17th, 2011
diff --git a/qcsrc/client/controlpoint.qc b/qcsrc/client/controlpoint.qc
index 34301d8063..575bce513c 100644
--- a/qcsrc/client/controlpoint.qc
+++ b/qcsrc/client/controlpoint.qc
@@ -1,8 +1,9 @@
 #include "controlpoint.qh"
-#include "gibs.qh"
+
 #include "teamradar.qh"
 #include "../common/movetypes/movetypes.qh"
 
+.vector colormod;
 .float alpha;
 .int count;
 .float pain_finished;
diff --git a/qcsrc/client/controlpoint.qh b/qcsrc/client/controlpoint.qh
index 31485519d4..5f2e89b4d7 100644
--- a/qcsrc/client/controlpoint.qh
+++ b/qcsrc/client/controlpoint.qh
@@ -1,5 +1,5 @@
-#ifndef CONTROLPOINT_H
-#define CONTROLPOINT_H
+#ifndef CLIENT_CONTROLPOINT_H
+#define CLIENT_CONTROLPOINT_H
 
 const vector CPICON_MIN = '-32 -32 -9';
 const vector CPICON_MAX = '32 32 25';
diff --git a/qcsrc/client/csqc_constants.qh b/qcsrc/client/csqc_constants.qh
index 09d217bc2c..1df447283c 100644
--- a/qcsrc/client/csqc_constants.qh
+++ b/qcsrc/client/csqc_constants.qh
@@ -1,5 +1,5 @@
-#ifndef CSQC_CONSTANTS
-#define CSQC_CONSTANTS
+#ifndef CLIENT_CSQC_CONSTANTS
+#define CLIENT_CSQC_CONSTANTS
 
 // MenuQC redefines world, change define it here to be safe
 #define world world
diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc
index 8d1f7e76fb..708e305fab 100644
--- a/qcsrc/client/csqcmodel_hooks.qc
+++ b/qcsrc/client/csqcmodel_hooks.qc
@@ -1,24 +1,13 @@
-#include "_all.qh"
-
-#include "gibs.qh"
+#include "mutators/events.qh"
 #include "player_skeleton.qh"
-
 #include "weapons/projectile.qh"
-
 #include "../common/animdecide.qh"
-#include "../common/csqcmodel_settings.qh"
-#include "../common/effects/effects.qh"
-#include "../common/teams.qh"
-#include "../common/triggers/trigger/viewloc.qh"
+#include "../common/movetypes/movetypes.qh"
 #include "../common/viewloc.qh"
-
-#include "mutators/events.qh"
-
 #include "../csqcmodellib/cl_model.qh"
 #include "../csqcmodellib/cl_player.qh"
 #include "../csqcmodellib/interpolate.qh"
 
-
 .float death_time;
 .int modelflags;
 
diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc
index 7ef7f996bd..48612ba48c 100644
--- a/qcsrc/client/damage.qc
+++ b/qcsrc/client/damage.qc
@@ -1,16 +1,9 @@
 #include "damage.qh"
-#include "_all.qh"
 
 #include "gibs.qh"
-
-#include "../common/vehicles/all.qh"
-
-#include "../common/constants.qh"
 #include "../common/deathtypes.qh"
-#include "../common/effects/effects.qh"
 #include "../common/movetypes/movetypes.qh"
-#include "../common/util.qh"
-
+#include "../common/vehicles/all.qh"
 #include "../common/weapons/all.qh"
 
 .entity tag_entity;
diff --git a/qcsrc/client/damage.qh b/qcsrc/client/damage.qh
index 0de69a02d8..3f11b9a49e 100644
--- a/qcsrc/client/damage.qh
+++ b/qcsrc/client/damage.qh
@@ -1,5 +1,5 @@
-#ifndef DAMAGE_H
-#define DAMAGE_H
+#ifndef CLIENT_DAMAGE_H
+#define CLIENT_DAMAGE_H
 
 .float total_damages; // number of effects which currently are attached to a player
 
diff --git a/qcsrc/client/effects.qc b/qcsrc/client/effects.qc
index c0c378fd1a..21fa1ce037 100644
--- a/qcsrc/client/effects.qc
+++ b/qcsrc/client/effects.qc
@@ -1,5 +1,4 @@
 #include "effects.qh"
-#include "_all.qh"
 
 /*
 .vector fx_start;
diff --git a/qcsrc/client/effects.qh b/qcsrc/client/effects.qh
index 0bebdb95de..2d93f41d71 100644
--- a/qcsrc/client/effects.qh
+++ b/qcsrc/client/effects.qh
@@ -1,5 +1,5 @@
-#ifndef EFFECTS_H
-#define EFFECTS_H
+#ifndef CLIENT_EFFECTS_H
+#define CLIENT_EFFECTS_H
 
 void Net_ReadArc();
 
diff --git a/qcsrc/client/generator.qc b/qcsrc/client/generator.qc
index eed682785e..d7114d1bf4 100644
--- a/qcsrc/client/generator.qc
+++ b/qcsrc/client/generator.qc
@@ -1,5 +1,10 @@
 #include "generator.qh"
 
+#include "teamradar.qh"
+#include "../common/movetypes/movetypes.qh"
+
+.float alpha;
+.float scale;
 .int count;
 .float max_health;
 
diff --git a/qcsrc/client/generator.qh b/qcsrc/client/generator.qh
index 744bc5589f..c60aff4009 100644
--- a/qcsrc/client/generator.qh
+++ b/qcsrc/client/generator.qh
@@ -1,5 +1,5 @@
-#ifndef GENERATOR_H
-#define GENERATOR_H
+#ifndef CLIENT_GENERATOR_H
+#define CLIENT_GENERATOR_H
 const vector GENERATOR_MIN = '-52 -52 -14';
 const vector GENERATOR_MAX = '52 52 75';
 
diff --git a/qcsrc/client/gibs.qc b/qcsrc/client/gibs.qc
index 360f7b5c36..4afa5eb88a 100644
--- a/qcsrc/client/gibs.qc
+++ b/qcsrc/client/gibs.qc
@@ -1,11 +1,7 @@
 #include "gibs.qh"
-#include "_all.qh"
 
 #include "rubble.qh"
-
-#include "../common/constants.qh"
 #include "../common/movetypes/movetypes.qh"
-#include "../common/util.qh"
 
 .float scale;
 .float alpha;
diff --git a/qcsrc/client/gibs.qh b/qcsrc/client/gibs.qh
index f4b60948af..eb63aa1fe5 100644
--- a/qcsrc/client/gibs.qh
+++ b/qcsrc/client/gibs.qh
@@ -1,5 +1,5 @@
-#ifndef GIBS_H
-#define GIBS_H
+#ifndef CLIENT_GIBS_H
+#define CLIENT_GIBS_H
 
 .vector colormod;
 
diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc
index 07123f06b5..6143874e66 100644
--- a/qcsrc/client/hook.qc
+++ b/qcsrc/client/hook.qc
@@ -1,12 +1,6 @@
 #include "hook.qh"
-#include "_all.qh"
-
-#include "hud.qh"
-
-#include "../common/teams.qh"
 
 #include "../csqcmodellib/interpolate.qh"
-
 #include "../warpzonelib/common.qh"
 
 entityclass(Hook);
diff --git a/qcsrc/client/hook.qh b/qcsrc/client/hook.qh
index e513ed6afa..9e6ee548cf 100644
--- a/qcsrc/client/hook.qh
+++ b/qcsrc/client/hook.qh
@@ -1,5 +1,5 @@
-#ifndef HOOK_H
-#define HOOK_H
+#ifndef CLIENT_HOOK_H
+#define CLIENT_HOOK_H
 
 void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg);
 
diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc
index 81fa575527..4e83ac31e7 100644
--- a/qcsrc/client/hud.qc
+++ b/qcsrc/client/hud.qc
@@ -1,25 +1,19 @@
 #include "hud.qh"
-#include "_all.qh"
 
 #include "hud_config.qh"
 #include "mapvoting.qh"
 #include "scoreboard.qh"
 #include "teamradar.qh"
 #include "t_items.qh"
-
 #include "../common/buffs/all.qh"
-#include "../common/constants.qh"
 #include "../common/deathtypes.qh"
 #include "../common/items/all.qc"
 #include "../common/mapinfo.qh"
-#include "../common/nades/all.qh"
-
 #include "../common/mutators/mutator/waypoints/all.qh"
-#include "../server/mutators/gamemode_ctf.qh"
-
+#include "../common/nades/all.qh"
 #include "../common/stats.qh"
-
 #include "../csqcmodellib/cl_player.qh"
+#include "../server/mutators/gamemode_ctf.qh"
 
 
 /*
@@ -204,12 +198,6 @@ HUD panels
 ==================
 */
 
-// draw the background/borders
-#define HUD_Panel_DrawBg(theAlpha) do {																				\
-	if(panel.current_panel_bg != "0" && panel.current_panel_bg != "")												\
-		draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel.current_panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * theAlpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER));\
-} while(0)
-
 //basically the same code of draw_ButtonPicture and draw_VertButtonPicture for the menu
 void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag)
 {
diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh
index 224b3fbe09..517fd8c07b 100644
--- a/qcsrc/client/hud.qh
+++ b/qcsrc/client/hud.qh
@@ -1,8 +1,11 @@
-#ifndef HUD_H
-#define HUD_H
+#ifndef CLIENT_HUD_H
+#define CLIENT_HUD_H
 
 #include "../common/weapons/all.qh"
 
+bool HUD_Radar_Clickable();
+void HUD_Radar_Mouse();
+
 REGISTRY(hud_panels, 24)
 REGISTER_REGISTRY(Registerhud_panels)
 
@@ -17,6 +20,12 @@ REGISTER_REGISTRY(Registerhud_panels)
 
 #define HUD_PANEL(NAME) HUD_PANEL_##NAME
 
+// draw the background/borders
+#define HUD_Panel_DrawBg(theAlpha) do {																				\
+	if(panel.current_panel_bg != "0" && panel.current_panel_bg != "")												\
+		draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel.current_panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * theAlpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER));\
+} while(0)
+
 int panel_order[hud_panels_MAX];
 string hud_panelorder_prev;
 
@@ -28,6 +37,7 @@ bool hud_panel_radar_temp_hidden;
 bool chat_panel_modified;
 bool radar_panel_modified;
 
+float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary);
 void HUD_Radar_Hide_Maximized();
 
 void HUD_Reset (void);
diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc
index 55c6c061ea..148c0ec8e0 100644
--- a/qcsrc/client/hud_config.qc
+++ b/qcsrc/client/hud_config.qc
@@ -1,11 +1,7 @@
 #include "hud_config.qh"
-#include "_all.qh"
 
 #include "hud.qh"
 
-#include "../common/constants.qh"
-
-
 #define HUD_Write(s) fputs(fh, s)
 // q: quoted, n: not quoted
 #define HUD_Write_Cvar_n(cvar) HUD_Write(strcat("seta ", cvar, " ", cvar_string(cvar), "\n"))
diff --git a/qcsrc/client/hud_config.qh b/qcsrc/client/hud_config.qh
index bac199750e..05792286da 100644
--- a/qcsrc/client/hud_config.qh
+++ b/qcsrc/client/hud_config.qh
@@ -1,5 +1,5 @@
-#ifndef HUD_CONFIG_H
-#define HUD_CONFIG_H
+#ifndef CLIENT_HUD_CONFIG_H
+#define CLIENT_HUD_CONFIG_H
 
 const int S_MOUSE1 = 1;
 const int S_MOUSE2 = 2;
diff --git a/qcsrc/client/laser.qc b/qcsrc/client/laser.qc
index 93c4103a9c..4d52c8eee1 100644
--- a/qcsrc/client/laser.qc
+++ b/qcsrc/client/laser.qc
@@ -1,11 +1,5 @@
 #include "laser.qh"
-#include "_all.qh"
 
-#include "hook.qh"
-
-#include "../common/buffs/all.qh"
-
-#include "../csqcmodellib/cl_model.qh"
 #include "../csqcmodellib/interpolate.qh"
 
 // a laser goes from origin in direction angles
diff --git a/qcsrc/client/laser.qh b/qcsrc/client/laser.qh
index 86210eee1d..32c6cd81e4 100644
--- a/qcsrc/client/laser.qh
+++ b/qcsrc/client/laser.qh
@@ -1,5 +1,5 @@
-#ifndef LASER_H
-#define LASER_H
+#ifndef CLIENT_LASER_H
+#define CLIENT_LASER_H
 
 void Ent_Laser();
 
diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc
index ff9fe0f7f9..8571d43a3b 100644
--- a/qcsrc/client/main.qc
+++ b/qcsrc/client/main.qc
@@ -1,5 +1,4 @@
 #include "main.qh"
-#include "_all.qh"
 
 #include "controlpoint.qh"
 #include "damage.qh"
@@ -12,43 +11,26 @@
 #include "laser.qh"
 #include "mapvoting.qh"
 #include "modeleffects.qh"
+#include "mutators/events.qh"
 #include "particles.qh"
+#include "quickmenu.qh"
 #include "scoreboard.qh"
 #include "shownames.qh"
 #include "tuba.qh"
 #include "t_items.qh"
 #include "wall.qh"
-
-#include "../common/vehicles/all.qh"
-
-#include "mutators/events.qh"
-
 #include "weapons/projectile.qh"
-
-#include "../common/buffs/all.qh"
 #include "../common/deathtypes.qh"
-#include "../common/effects/effects.qh"
+#include "../common/items/all.qh"
 #include "../common/mapinfo.qh"
-#include "../common/monsters/all.qh"
-#include "../common/nades/all.qh"
+#include "../common/minigames/cl_minigames.qh"
+#include "../common/minigames/cl_minigames_hud.qh"
 #include "../common/net_notice.qh"
-#include "../common/notifications.qh"
-#include "../common/stats.qh"
-#include "../common/teams.qh"
-
-#include "../common/items/all.qh"
-
-#include "../common/mutators/base.qh"
-
-#include "../common/weapons/all.qh"
-
-#include "../csqcmodellib/cl_model.qh"
-#include "../csqcmodellib/interpolate.qh"
-
 #include "../common/triggers/include.qh"
-
 #include "../common/turrets/cl_turrets.qh"
-
+#include "../common/vehicles/all.qh"
+#include "../csqcmodellib/cl_model.qh"
+#include "../csqcmodellib/interpolate.qh"
 #include "../warpzonelib/client.qh"
 
 // --------------------------------------------------------------------------
@@ -148,7 +130,6 @@ void CSQC_Init(void)
 
 	// needs to be done so early because of the constants they create
 	static_init();
-	CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
 	CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
 
 	// precaches
diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh
index d403984d38..acd0bcb1ef 100644
--- a/qcsrc/client/main.qh
+++ b/qcsrc/client/main.qh
@@ -1,5 +1,5 @@
-#ifndef MAIN_H
-#define MAIN_H
+#ifndef CLIENT_MAIN_H
+#define CLIENT_MAIN_H
 
 #include "../common/constants.qh"
 
diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc
index 010f424f1a..21bb421a96 100644
--- a/qcsrc/client/mapvoting.qc
+++ b/qcsrc/client/mapvoting.qc
@@ -1,11 +1,9 @@
 #include "mapvoting.qh"
-#include "_all.qh"
 
 #include "hud.qh"
 #include "scoreboard.qh"
 
 #include "../common/mapinfo.qh"
-#include "../common/util.qh"
 
 
 int mv_num_maps;
diff --git a/qcsrc/client/mapvoting.qh b/qcsrc/client/mapvoting.qh
index 7a9a511a2b..c1c27ad5b1 100644
--- a/qcsrc/client/mapvoting.qh
+++ b/qcsrc/client/mapvoting.qh
@@ -1,5 +1,5 @@
-#ifndef MAPVOTING_H
-#define MAPVOTING_H
+#ifndef CLIENT_MAPVOTING_H
+#define CLIENT_MAPVOTING_H
 
 #include "../common/constants.qh"
 void MapVote_Draw();
diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc
index 9bf0a855fa..8a5b707045 100644
--- a/qcsrc/client/miscfunctions.qc
+++ b/qcsrc/client/miscfunctions.qc
@@ -1,12 +1,10 @@
 #include "miscfunctions.qh"
-#include "_all.qh"
 
 #include "hud.qh"
 
 #include "../common/command/generic.qh"
 
 #include "../common/teams.qh"
-#include "../common/util.qh"
 
 #include "../csqcmodellib/cl_model.qh"
 
diff --git a/qcsrc/client/miscfunctions.qh b/qcsrc/client/miscfunctions.qh
index 9ac46340dd..b223d88b9e 100644
--- a/qcsrc/client/miscfunctions.qh
+++ b/qcsrc/client/miscfunctions.qh
@@ -1,5 +1,5 @@
-#ifndef MISCFUNCTIONS_H
-#define MISCFUNCTIONS_H
+#ifndef CLIENT_MISCFUNCTIONS_H
+#define CLIENT_MISCFUNCTIONS_H
 
 entity players;
 entity teams;
diff --git a/qcsrc/client/modeleffects.qc b/qcsrc/client/modeleffects.qc
index a10062a9f7..d870d81e98 100644
--- a/qcsrc/client/modeleffects.qc
+++ b/qcsrc/client/modeleffects.qc
@@ -1,5 +1,4 @@
 #include "modeleffects.qh"
-#include "_all.qh"
 
 .float cnt;
 .float scale;
diff --git a/qcsrc/client/modeleffects.qh b/qcsrc/client/modeleffects.qh
index d4b98e0a59..32641f394e 100644
--- a/qcsrc/client/modeleffects.qh
+++ b/qcsrc/client/modeleffects.qh
@@ -1,5 +1,5 @@
-#ifndef MODELEFFECTS_H
-#define MODELEFFECTS_H
+#ifndef CLIENT_MODELEFFECTS_H
+#define CLIENT_MODELEFFECTS_H
 
 entityclass(ModelEffect);
 class(ModelEffect) .float frame1time;
diff --git a/qcsrc/client/particles.qc b/qcsrc/client/particles.qc
index 6d73e24b0b..75f293feb0 100644
--- a/qcsrc/client/particles.qc
+++ b/qcsrc/client/particles.qc
@@ -1,8 +1,6 @@
 #include "particles.qh"
-#include "_all.qh"
 
 #include "../common/stats.qh"
-#include "../common/util.qh"
 
 #include "../warpzonelib/common.qh"
 
diff --git a/qcsrc/client/particles.qh b/qcsrc/client/particles.qh
index 06cd72523d..3735641afa 100644
--- a/qcsrc/client/particles.qh
+++ b/qcsrc/client/particles.qh
@@ -1,5 +1,5 @@
-#ifndef PARTICLES_H
-#define PARTICLES_H
+#ifndef CLIENT_PARTICLES_H
+#define CLIENT_PARTICLES_H
 .int dphitcontentsmask;
 
 entityclass(PointParticles);
diff --git a/qcsrc/client/player_skeleton.qc b/qcsrc/client/player_skeleton.qc
index 584a197801..cdb1fdf74d 100644
--- a/qcsrc/client/player_skeleton.qc
+++ b/qcsrc/client/player_skeleton.qc
@@ -1,9 +1,11 @@
 #include "player_skeleton.qh"
 
-#include "../common/csqcmodel_settings.qh"
-
+#include "mutators/events.qh"
+#include "../csqcmodellib/cl_player.qh"
 #include "../warpzonelib/anglestransform.qh"
 
+.vector v_angle;
+
 class(Skeleton) .float skeleton_info_modelindex;
 class(Skeleton) .float skeleton_info_skin;
 const int BONETYPE_LOWER = 0;
diff --git a/qcsrc/client/player_skeleton.qh b/qcsrc/client/player_skeleton.qh
index 4a37df5e45..48a3111d32 100644
--- a/qcsrc/client/player_skeleton.qh
+++ b/qcsrc/client/player_skeleton.qh
@@ -1,7 +1,5 @@
-#ifndef PLAYER_SKELETON
-#define PLAYER_SKELETON
-
-#include "../common/util.qh"
+#ifndef CLIENT_PLAYER_SKELETON
+#define CLIENT_PLAYER_SKELETON
 
 void free_skeleton_from_frames(entity e);
 void skeleton_from_frames(entity e, float is_dead);
diff --git a/qcsrc/client/progs.inc b/qcsrc/client/progs.inc
index e1e96ef135..367e5ffd54 100644
--- a/qcsrc/client/progs.inc
+++ b/qcsrc/client/progs.inc
@@ -1,4 +1,5 @@
 #include "../lib/_all.inc"
+#include "_all.qh"
 
 #include "announcer.qc"
 #include "bgmscript.qc"
@@ -27,12 +28,11 @@
 #include "view.qc"
 #include "wall.qc"
 
-#include "command/all.qc"
+#include "commands/all.qc"
 
 #include "weapons/projectile.qc" // TODO
 
 #include "../common/animdecide.qc"
-#include "../common/effects/effects.qc"
 #include "../common/effects/effectinfo.qc"
 #include "../common/mapinfo.qc"
 #include "../common/movetypes/include.qc"
@@ -48,6 +48,7 @@
 #include "../common/minigames/cl_minigames.qc"
 
 #include "../common/buffs/all.qc"
+#include "../common/effects/all.qc"
 #include "../common/items/all.qc"
 #include "../common/monsters/all.qc"
 #include "../common/mutators/all.qc"
diff --git a/qcsrc/client/quickmenu.qc b/qcsrc/client/quickmenu.qc
index dd2ba03154..1f7be0c500 100644
--- a/qcsrc/client/quickmenu.qc
+++ b/qcsrc/client/quickmenu.qc
@@ -1,6 +1,8 @@
-#include "_all.qh"
+#include "quickmenu.qh"
 
+#include "hud.qh"
 #include "hud_config.qh"
+#include "mapvoting.qh"
 
 // QUICKMENU_MAXLINES must be <= 10
 const int QUICKMENU_MAXLINES = 10;
diff --git a/qcsrc/client/quickmenu.qh b/qcsrc/client/quickmenu.qh
new file mode 100644
index 0000000000..cf5f66649c
--- /dev/null
+++ b/qcsrc/client/quickmenu.qh
@@ -0,0 +1,8 @@
+#ifndef CLIENT_QUICKMENU_H
+#define CLIENT_QUICKMENU_H
+
+bool QuickMenu_InputEvent(float bInputType, float nPrimary, float nSecondary);
+bool QuickMenu_IsOpened();
+void QuickMenu_Mouse();
+
+#endif
diff --git a/qcsrc/client/rubble.qh b/qcsrc/client/rubble.qh
index b19406c77e..9441168025 100644
--- a/qcsrc/client/rubble.qh
+++ b/qcsrc/client/rubble.qh
@@ -1,5 +1,5 @@
-#ifndef RUBBLE_H
-#define RUBBLE_H
+#ifndef CLIENT_RUBBLE_H
+#define CLIENT_RUBBLE_H
 entityclass(Rubble);
 class(Rubble) .float creationtime;
 void RubbleLimit(string cname, float limit, void() deleteproc);
diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc
index a1d9a50dcd..adbac93c8f 100644
--- a/qcsrc/client/scoreboard.qc
+++ b/qcsrc/client/scoreboard.qc
@@ -1,6 +1,6 @@
 #include "scoreboard.qh"
-#include "_all.qh"
 
+#include "quickmenu.qh"
 #include "hud.qh"
 
 #include "../common/constants.qh"
@@ -8,7 +8,6 @@
 #include "../common/minigames/cl_minigames.qh"
 #include "../common/stats.qh"
 #include "../common/teams.qh"
-#include "../common/util.qh"
 
 float scoreboard_alpha_bg;
 float scoreboard_alpha_fg;
diff --git a/qcsrc/client/scoreboard.qh b/qcsrc/client/scoreboard.qh
index e1c5addb49..5b5f812a0a 100644
--- a/qcsrc/client/scoreboard.qh
+++ b/qcsrc/client/scoreboard.qh
@@ -1,5 +1,5 @@
-#ifndef SCOREBOARD_H
-#define SCOREBOARD_H
+#ifndef CLIENT_SCOREBOARD_H
+#define CLIENT_SCOREBOARD_H
 
 float xmin, xmax, ymin, ymax, sbwidth;
 
diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc
index fc4649537a..994a1ae303 100644
--- a/qcsrc/client/shownames.qc
+++ b/qcsrc/client/shownames.qc
@@ -1,12 +1,10 @@
 #include "shownames.qh"
-#include "_all.qh"
 
 #include "hud.qh"
 
 #include "../common/constants.qh"
 #include "../common/mapinfo.qh"
 #include "../common/teams.qh"
-#include "../common/util.qh"
 
 #include "../csqcmodellib/cl_model.qh"
 
diff --git a/qcsrc/client/shownames.qh b/qcsrc/client/shownames.qh
index 63fd92e041..1304c53705 100644
--- a/qcsrc/client/shownames.qh
+++ b/qcsrc/client/shownames.qh
@@ -1,5 +1,5 @@
-#ifndef SHOWNAMES_H
-#define SHOWNAMES_H
+#ifndef CLIENT_SHOWNAMES_H
+#define CLIENT_SHOWNAMES_H
 
 entityclass(ShowNames);
 class(ShowNames) .float healthvalue;
diff --git a/qcsrc/client/t_items.qc b/qcsrc/client/t_items.qc
index 4e43a96624..9bb99f41de 100644
--- a/qcsrc/client/t_items.qc
+++ b/qcsrc/client/t_items.qc
@@ -1,8 +1,6 @@
-#include "_all.qh"
 
 #include "../common/buffs/all.qh"
 #include "../common/movetypes/movetypes.qh"
-#include "../common/util.qh"
 #include "../common/weapons/all.qh"
 #include "../csqcmodellib/cl_model.qh"
 #include "../csqcmodellib/common.qh"
diff --git a/qcsrc/client/teamradar.qc b/qcsrc/client/teamradar.qc
index 7623e9df86..d429d20052 100644
--- a/qcsrc/client/teamradar.qc
+++ b/qcsrc/client/teamradar.qc
@@ -1,9 +1,8 @@
 #include "teamradar.qh"
-#include "_all.qh"
 
 #include "hud.qh"
 
-#include "../common/util.qh"
+#include "../common/mutators/mutator/waypoints/all.qh"
 
 #include "../csqcmodellib/interpolate.qh"
 
diff --git a/qcsrc/client/teamradar.qh b/qcsrc/client/teamradar.qh
index 78ef5ee714..b882f39fbd 100644
--- a/qcsrc/client/teamradar.qh
+++ b/qcsrc/client/teamradar.qh
@@ -1,5 +1,5 @@
-#ifndef TEAMRADAR_H
-#define TEAMRADAR_H
+#ifndef CLIENT_TEAMRADAR_H
+#define CLIENT_TEAMRADAR_H
 
 const int MAX_TEAMRADAR_TIMES = 32;
 
diff --git a/qcsrc/client/tuba.qc b/qcsrc/client/tuba.qc
index 91ccbba5c8..ed2964936a 100644
--- a/qcsrc/client/tuba.qc
+++ b/qcsrc/client/tuba.qc
@@ -1,8 +1,6 @@
 #include "tuba.qh"
-#include "_all.qh"
 
 #include "../common/constants.qh"
-#include "../common/util.qh"
 
 
 #define TUBA_STARTNOTE(i, n) W_Sound(strcat("tuba", (i ? ftos(i) : ""), "_loopnote", ftos(n)))
diff --git a/qcsrc/client/tuba.qh b/qcsrc/client/tuba.qh
index 6fe103f706..e936dcd6ec 100644
--- a/qcsrc/client/tuba.qh
+++ b/qcsrc/client/tuba.qh
@@ -1,5 +1,5 @@
-#ifndef TUBA_H
-#define TUBA_H
+#ifndef CLIENT_TUBA_H
+#define CLIENT_TUBA_H
 void Ent_TubaNote(bool isNew);
 void Tuba_Precache();
 
diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc
index 3bb5585f35..6fcc79b241 100644
--- a/qcsrc/client/view.qc
+++ b/qcsrc/client/view.qc
@@ -1,4 +1,3 @@
-#include "_all.qh"
 
 #include "announcer.qh"
 #include "hook.qh"
@@ -7,6 +6,7 @@
 #include "mapvoting.qh"
 #include "scoreboard.qh"
 #include "shownames.qh"
+#include "quickmenu.qh"
 
 #include "mutators/events.qh"
 
@@ -16,9 +16,12 @@
 #include "../common/stats.qh"
 #include "../common/triggers/target/music.qh"
 #include "../common/teams.qh"
-#include "../common/util.qh"
 
+#include "../common/vehicles/all.qh"
 #include "../common/weapons/all.qh"
+#include "../common/viewloc.qh"
+#include "../common/minigames/cl_minigames.qh"
+#include "../common/minigames/cl_minigames_hud.qh"
 
 #include "../csqcmodellib/cl_player.qh"
 
diff --git a/qcsrc/client/wall.qc b/qcsrc/client/wall.qc
index f17b54a5ca..b97f757a77 100644
--- a/qcsrc/client/wall.qc
+++ b/qcsrc/client/wall.qc
@@ -1,9 +1,7 @@
 #include "wall.qh"
-#include "_all.qh"
 
 #include "bgmscript.qh"
 
-#include "../common/util.qh"
 
 #include "../csqcmodellib/interpolate.qh"
 
diff --git a/qcsrc/client/wall.qh b/qcsrc/client/wall.qh
index f44355fc28..e05bb615ed 100644
--- a/qcsrc/client/wall.qh
+++ b/qcsrc/client/wall.qh
@@ -1,5 +1,5 @@
-#ifndef WALL_H
-#define WALL_H
+#ifndef CLIENT_WALL_H
+#define CLIENT_WALL_H
 
 entityclass(Wall);
 class(Wall) .float lip;
diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc
index 22443043d2..b52a3fac16 100644
--- a/qcsrc/client/weapons/projectile.qc
+++ b/qcsrc/client/weapons/projectile.qc
@@ -3,11 +3,11 @@
 #include "../autocvars.qh"
 #include "../defs.qh"
 #include "../main.qh"
+#include "../mutators/events.qh"
 
 #include "../../common/constants.qh"
 #include "../../common/nades/all.qh"
 #include "../../common/movetypes/movetypes.qh"
-#include "../../common/util.qh"
 
 #include "../../csqcmodellib/interpolate.qh"
 
diff --git a/qcsrc/client/weapons/projectile.qh b/qcsrc/client/weapons/projectile.qh
index dd289817ec..5a0deb4990 100644
--- a/qcsrc/client/weapons/projectile.qh
+++ b/qcsrc/client/weapons/projectile.qh
@@ -1,5 +1,5 @@
-#ifndef PROJECTILE_H
-#define PROJECTILE_H
+#ifndef CLIENT_WEAPONS_PROJECTILE_H
+#define CLIENT_WEAPONS_PROJECTILE_H
 
 entityclass(Projectile);
 class(Projectile) .int traileffect;
diff --git a/qcsrc/common/animdecide.qc b/qcsrc/common/animdecide.qc
index e2bda23a02..23f43b9e94 100644
--- a/qcsrc/common/animdecide.qc
+++ b/qcsrc/common/animdecide.qc
@@ -1,4 +1,7 @@
 #include "animdecide.qh"
+
+#include "monsters/all.qh"
+
 #if defined(SVQC)
     #include "util.qh"
     #include "../server/defs.qh"
diff --git a/qcsrc/common/command/generic.qc b/qcsrc/common/command/generic.qc
index 6649950dde..5412c22b4b 100644
--- a/qcsrc/common/command/generic.qc
+++ b/qcsrc/common/command/generic.qc
@@ -10,7 +10,7 @@
 #endif
 
 #ifdef CSQC
-	#include "../../client/command/cl_cmd.qh"
+	#include "../../client/commands/cl_cmd.qh"
 #endif
 
 #ifdef SVQC
diff --git a/qcsrc/common/effects/effects.inc b/qcsrc/common/effects/all.inc
similarity index 99%
rename from qcsrc/common/effects/effects.inc
rename to qcsrc/common/effects/all.inc
index 4d82087e05..d53ded907a 100644
--- a/qcsrc/common/effects/effects.inc
+++ b/qcsrc/common/effects/all.inc
@@ -1,6 +1,8 @@
 // Global list of effects, networked to CSQC by ID to save bandwidth and to use client particle numbers (allows mismatching effectinfos to some degree)
 // Not too concerned about the order of this list, just keep the weapon effects together!
 
+#include "../teams.qh"
+
 // EFFECT(istrail, EFFECT_NAME,     "effectinfo_string")
 EFFECT(0, EXPLOSION_SMALL,          "explosion_small")
 EFFECT(0, EXPLOSION_MEDIUM,         "explosion_medium")
diff --git a/qcsrc/common/effects/effects.qc b/qcsrc/common/effects/all.qc
similarity index 99%
rename from qcsrc/common/effects/effects.qc
rename to qcsrc/common/effects/all.qc
index 78bb6755a9..e90f3c615b 100644
--- a/qcsrc/common/effects/effects.qc
+++ b/qcsrc/common/effects/all.qc
@@ -1,3 +1,5 @@
+#include "all.qh"
+
 #ifdef CSQC
 void Read_Effect(bool is_new)
 {
diff --git a/qcsrc/common/effects/effects.qh b/qcsrc/common/effects/all.qh
similarity index 68%
rename from qcsrc/common/effects/effects.qh
rename to qcsrc/common/effects/all.qh
index 21821758c3..7046af11bc 100644
--- a/qcsrc/common/effects/effects.qh
+++ b/qcsrc/common/effects/all.qh
@@ -1,5 +1,7 @@
-#ifndef P_EFFECTS_H
-#define P_EFFECTS_H
+#ifndef EFFECTS_ALL_H
+#define EFFECTS_ALL_H
+
+#include "effect.qh"
 
 #ifdef CSQC
 void Read_Effect(bool is_new);
@@ -8,29 +10,11 @@ void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt);
 void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt);
 #endif
 
-#define particleeffectnum(e) _particleeffectnum(e.eent_eff_name)
-
 REGISTRY(Effects, BIT(8))
 REGISTER_REGISTRY(RegisterEffects)
 #define EFFECT(istrail, name, realname) \
     REGISTER(RegisterEffects, EFFECT, Effects, name, m_id, Create_Effect_Entity(realname, istrail));
 
-.int m_id;
-.string eent_eff_name;
-.int eent_eff_trail;
-
-.vector eent_net_location;
-.vector eent_net_velocity;
-.int eent_net_count;
-
-entity Create_Effect_Entity(string eff_name, bool eff_trail)
-{
-	entity this = new(effect_entity);
-	this.eent_eff_name = eff_name;
-	this.eent_eff_trail = eff_trail;
-	return this;
-}
-
 void RegisterEffects_First()
 {
     #ifdef SVQC
@@ -51,7 +35,7 @@ void RegisterEffects_Done()
 // NOW we actually activate the declarations
 ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_First)
 EFFECT(0, Null, string_null)
-#include "effects.inc"
+#include "all.inc"
 ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_Done)
 
 #endif
diff --git a/qcsrc/common/effects/effect.qh b/qcsrc/common/effects/effect.qh
new file mode 100644
index 0000000000..bd9cd99e56
--- /dev/null
+++ b/qcsrc/common/effects/effect.qh
@@ -0,0 +1,22 @@
+#ifndef EFFECT_H
+#define EFFECT_H
+
+#define particleeffectnum(e) _particleeffectnum(e.eent_eff_name)
+
+.int m_id;
+.string eent_eff_name;
+.int eent_eff_trail;
+
+.vector eent_net_location;
+.vector eent_net_velocity;
+.int eent_net_count;
+
+entity Create_Effect_Entity(string eff_name, bool eff_trail)
+{
+	entity this = new(effect_entity);
+	this.eent_eff_name = eff_name;
+	this.eent_eff_trail = eff_trail;
+	return this;
+}
+
+#endif
diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc
index 2a0b036205..f1ee4f675c 100644
--- a/qcsrc/common/minigames/cl_minigames_hud.qc
+++ b/qcsrc/common/minigames/cl_minigames_hud.qc
@@ -1,5 +1,5 @@
+#include "cl_minigames_hud.qh"
 #include "minigames.qh"
-#include "../../client/mapvoting.qh"
 
 // whether the mouse is over the given panel
 bool HUD_mouse_over(entity somepanel)
diff --git a/qcsrc/common/minigames/cl_minigames_hud.qh b/qcsrc/common/minigames/cl_minigames_hud.qh
new file mode 100644
index 0000000000..f170c590de
--- /dev/null
+++ b/qcsrc/common/minigames/cl_minigames_hud.qh
@@ -0,0 +1,7 @@
+#ifndef CL_MINIGAMES_HUD_H
+#define CL_MINIGAMES_HUD_H
+
+float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary);
+void HUD_Minigame_Mouse();
+
+#endif
diff --git a/qcsrc/common/minigames/minigame/pp.qc b/qcsrc/common/minigames/minigame/pp.qc
index efce0e66b6..3ef2124dca 100644
--- a/qcsrc/common/minigames/minigame/pp.qc
+++ b/qcsrc/common/minigames/minigame/pp.qc
@@ -17,6 +17,8 @@ const int PP_NUM_CNT = 7;
 
 const int PP_TILE_SIZE = 7;
 
+.int cnt;
+
 .int pp_team1_score;
 .int pp_team2_score;
 
diff --git a/qcsrc/common/models/all.qh b/qcsrc/common/models/all.qh
index 38c5334498..a7ab908807 100644
--- a/qcsrc/common/models/all.qh
+++ b/qcsrc/common/models/all.qh
@@ -1,30 +1,11 @@
 #ifndef MODELS_ALL_H
 #define MODELS_ALL_H
 
-#define setmodel(e, m) _setmodel((e), (m).model_str())
+#include "model.qh"
 
 REGISTRY(Models, BIT(9))
 REGISTER_REGISTRY(RegisterModels)
 
-CLASS(Model, Object)
-    ATTRIB(Model, m_id, int, 0)
-    ATTRIB(Model, model_str, string(), func_null)
-    CONSTRUCTOR(Model, string() path)
-    {
-        CONSTRUCT(Model);
-        this.model_str = path;
-    }
-    METHOD(Model, model_precache, void(entity this)) {
-        string s = this.model_str();
-        if (s != "" && s != "null" && !fexists(s)) {
-            LOG_WARNINGF("Missing model: \"%s\"\n", s);
-            return;
-        }
-        LOG_TRACEF("precache_model(\"%s\")\n", s);
-        precache_model(s);
-    }
-ENDCLASS(Model)
-
 #define MODEL(name, path) \
     string MDL_##name##_get() { return path; } \
     REGISTER(RegisterModels, MDL, Models, name, m_id, NEW(Model, MDL_##name##_get))
diff --git a/qcsrc/common/models/model.qh b/qcsrc/common/models/model.qh
new file mode 100644
index 0000000000..b4005b7777
--- /dev/null
+++ b/qcsrc/common/models/model.qh
@@ -0,0 +1,25 @@
+#ifndef MODEL_H
+#define MODEL_H
+
+#define setmodel(e, m) _setmodel((e), (m).model_str())
+
+CLASS(Model, Object)
+    ATTRIB(Model, m_id, int, 0)
+    ATTRIB(Model, model_str, string(), func_null)
+    CONSTRUCTOR(Model, string() path)
+    {
+        CONSTRUCT(Model);
+        this.model_str = path;
+    }
+    METHOD(Model, model_precache, void(entity this)) {
+        string s = this.model_str();
+        if (s != "" && s != "null" && !fexists(s)) {
+            LOG_WARNINGF("Missing model: \"%s\"\n", s);
+            return;
+        }
+        LOG_TRACEF("precache_model(\"%s\")\n", s);
+        precache_model(s);
+    }
+ENDCLASS(Model)
+
+#endif
diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh
index 043ec38b92..6c6aa0f824 100644
--- a/qcsrc/common/notifications.qh
+++ b/qcsrc/common/notifications.qh
@@ -939,4 +939,6 @@ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_First)
 #include "notifications.inc"
 ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_Done)
 
+STATIC_INIT(RegisterNotifications) { CALL_ACCUMULATED_FUNCTION(RegisterNotifications); }
+
 #endif
diff --git a/qcsrc/common/sounds/all.inc b/qcsrc/common/sounds/all.inc
index 0e5bd7ffb3..8a7dbbca37 100644
--- a/qcsrc/common/sounds/all.inc
+++ b/qcsrc/common/sounds/all.inc
@@ -1,6 +1,7 @@
 // Global list of sounds
 // TODO: remove uses of _sound
 
+#include "../teams.qh"
 string W_Sound(string w_snd);
 
 SOUND(ARC_FIRE, W_Sound("arc_fire"));
diff --git a/qcsrc/common/sounds/all.qh b/qcsrc/common/sounds/all.qh
index 90858f39d7..d39c701d7f 100644
--- a/qcsrc/common/sounds/all.qh
+++ b/qcsrc/common/sounds/all.qh
@@ -1,49 +1,18 @@
 #ifndef SOUNDS_ALL_H
 #define SOUNDS_ALL_H
 
-#include "../teams.qh"
+#include "sound.qh"
 
-// Play all sounds via sound7, for access to the extra channels.
-// Otherwise, channels 8 to 15 would be blocked for a weird QW feature.
-#ifdef SVQC
-    #define _sound(e, c, s, v, a) do { \
-        entity __e = e; \
-        if (!sound_allowed(MSG_BROADCAST, __e)) break; \
-        sound7(__e, c, s, v, a, 0, 0); \
-    } while (0)
-#else
-    #define _sound(e, c, s, v, a) sound7(e, c, s, v, a, 0, 0)
-#endif
-#define sound(e, c, s, v, a) _sound(e, c, s.sound_str(), v, a)
-// Used in places where a string is required
-#define SND(id) (SND_##id.sound_str())
-
-REGISTRY(Sounds, BIT(8))
+REGISTRY(Sounds, BITS(8))
 REGISTER_REGISTRY(RegisterSounds)
 
-CLASS(Sound, Object)
-    ATTRIB(Sound, m_id, int, 0)
-    ATTRIB(Sound, sound_str, string(), func_null)
-    CONSTRUCTOR(Sound, string() path)
-    {
-        CONSTRUCT(Sound);
-        this.sound_str = path;
-    }
-    METHOD(Sound, sound_precache, void(entity this)) {
-        string s = this.sound_str();
-        if (s && s != "" && !fexists(strcat("sound/", s))) {
-            LOG_WARNINGF("Missing sound: \"%s\"\n", s);
-            return;
-        }
-        LOG_TRACEF("precache_sound(\"%s\")\n", s);
-        precache_sound(s);
-    }
-ENDCLASS(Sound)
-
 #define SOUND(name, path) \
     string SND_##name##_get() { return path; } \
     REGISTER(RegisterSounds, SND, Sounds, name, m_id, NEW(Sound, SND_##name##_get))
 
+// Used in places where a string is required
+#define SND(id) (SND_##id.sound_str())
+
 STATIC_INIT(RegisterSounds_precache) {
     FOREACH(Sounds, true, LAMBDA({
         it.sound_precache(it);
diff --git a/qcsrc/common/sounds/sound.qh b/qcsrc/common/sounds/sound.qh
new file mode 100644
index 0000000000..bc393dda3d
--- /dev/null
+++ b/qcsrc/common/sounds/sound.qh
@@ -0,0 +1,36 @@
+#ifndef SOUND_H
+#define SOUND_H
+
+// Play all sounds via sound7, for access to the extra channels.
+// Otherwise, channels 8 to 15 would be blocked for a weird QW feature.
+#ifdef SVQC
+    #define _sound(e, c, s, v, a) do { \
+        entity __e = e; \
+        if (!sound_allowed(MSG_BROADCAST, __e)) break; \
+        sound7(__e, c, s, v, a, 0, 0); \
+    } while (0)
+#else
+    #define _sound(e, c, s, v, a) sound7(e, c, s, v, a, 0, 0)
+#endif
+#define sound(e, c, s, v, a) _sound(e, c, s.sound_str(), v, a)
+
+CLASS(Sound, Object)
+    ATTRIB(Sound, m_id, int, 0)
+    ATTRIB(Sound, sound_str, string(), func_null)
+    CONSTRUCTOR(Sound, string() path)
+    {
+        CONSTRUCT(Sound);
+        this.sound_str = path;
+    }
+    METHOD(Sound, sound_precache, void(entity this)) {
+        string s = this.sound_str();
+        if (s && s != "" && !fexists(strcat("sound/", s))) {
+            LOG_WARNINGF("Missing sound: \"%s\"\n", s);
+            return;
+        }
+        LOG_TRACEF("precache_sound(\"%s\")\n", s);
+        precache_sound(s);
+    }
+ENDCLASS(Sound)
+
+#endif
diff --git a/qcsrc/common/triggers/subs.qh b/qcsrc/common/triggers/subs.qh
index 98491820f2..95cc59904a 100644
--- a/qcsrc/common/triggers/subs.qh
+++ b/qcsrc/common/triggers/subs.qh
@@ -26,6 +26,8 @@
 	#define SUB_LTIME		move_ltime
 	#define SUB_FLAGS		move_flags
 
+.vector move_origin;
+
 	void SUB_SETORIGIN(entity s, vector v)
 	{SELFPARAM();
 		s.move_origin = v;
diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc
index 9c794c0eb3..b687086ba9 100644
--- a/qcsrc/common/util.qc
+++ b/qcsrc/common/util.qc
@@ -174,40 +174,6 @@ string ftos_decimals(float number, float decimals)
 	return sprintf("%.*f", decimals, number);
 }
 
-vector colormapPaletteColor(float c, bool isPants)
-{
-	switch (c)
-	{
-		case  0: return '1.000000 1.000000 1.000000';
-		case  1: return '1.000000 0.333333 0.000000';
-		case  2: return '0.000000 1.000000 0.501961';
-		case  3: return '0.000000 1.000000 0.000000';
-		case  4: return '1.000000 0.000000 0.000000';
-		case  5: return '0.000000 0.666667 1.000000';
-		case  6: return '0.000000 1.000000 1.000000';
-		case  7: return '0.501961 1.000000 0.000000';
-		case  8: return '0.501961 0.000000 1.000000';
-		case  9: return '1.000000 0.000000 1.000000';
-		case 10: return '1.000000 0.000000 0.501961';
-		case 11: return '0.000000 0.000000 1.000000';
-		case 12: return '1.000000 1.000000 0.000000';
-		case 13: return '0.000000 0.333333 1.000000';
-		case 14: return '1.000000 0.666667 0.000000';
-		case 15:
-			if (isPants)
-				return
-					  '1 0 0' * (0.502 + 0.498 * sin(time / 2.7182818285 + 0.0000000000))
-					+ '0 1 0' * (0.502 + 0.498 * sin(time / 2.7182818285 + 2.0943951024))
-					+ '0 0 1' * (0.502 + 0.498 * sin(time / 2.7182818285 + 4.1887902048));
-			else
-				return
-					  '1 0 0' * (0.502 + 0.498 * sin(time / 3.1415926536 + 5.2359877560))
-					+ '0 1 0' * (0.502 + 0.498 * sin(time / 3.1415926536 + 3.1415926536))
-					+ '0 0 1' * (0.502 + 0.498 * sin(time / 3.1415926536 + 1.0471975512));
-		default: return '0.000 0.000 0.000';
-	}
-}
-
 // Databases (hash tables)
 const float DB_BUCKETS = 8192;
 void db_save(float db, string pFilename)
diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh
index a2774aa509..8bedccf0ae 100644
--- a/qcsrc/common/util.qh
+++ b/qcsrc/common/util.qh
@@ -28,8 +28,6 @@ string ftos_decimals(float number, float decimals);
 
 bool fexists(string f);
 
-vector colormapPaletteColor(float c, float isPants);
-
 // unzone the string, and return it as tempstring. Safe to be called on string_null
 string fstrunzone(string s);
 
diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc
index 7108e80770..500bc60c8c 100644
--- a/qcsrc/common/vehicles/sv_vehicles.qc
+++ b/qcsrc/common/vehicles/sv_vehicles.qc
@@ -1,5 +1,4 @@
 #include "sv_vehicles.qh"
-#include "../effects/effects.qh"
 
 #if 0
 bool vehicle_send(entity to, int sf)
diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc
index 2b5950a259..7bc45c0d51 100644
--- a/qcsrc/common/vehicles/vehicle/racer.qc
+++ b/qcsrc/common/vehicles/vehicle/racer.qc
@@ -27,7 +27,6 @@ REGISTER_VEHICLE(RACER, NEW(Racer));
 #include "racer_weapon.qc"
 
 #ifdef SVQC
-#include "../../effects/effects.qh"
 #include "../../triggers/trigger/impulse.qh"
 
 bool autocvar_g_vehicle_racer;
diff --git a/qcsrc/lib/_all.inc b/qcsrc/lib/_all.inc
index 5addff39ff..66a79c83c4 100644
--- a/qcsrc/lib/_all.inc
+++ b/qcsrc/lib/_all.inc
@@ -30,6 +30,7 @@
 #include "accumulate.qh"
 #include "bits.qh"
 #include "bool.qh"
+#include "color.qh"
 #include "counting.qh"
 #include "cvar.qh"
 #include "defer.qh"
diff --git a/qcsrc/lib/color.qh b/qcsrc/lib/color.qh
new file mode 100644
index 0000000000..d21dab84ea
--- /dev/null
+++ b/qcsrc/lib/color.qh
@@ -0,0 +1,38 @@
+#ifndef COLOR_H
+#define COLOR_H
+
+#define colormapPaletteColor(c, isPants) colormapPaletteColor_(c, isPants, time)
+vector colormapPaletteColor_(int c, bool isPants, float t)
+{
+    switch (c) {
+        case  0: return '1.000000 1.000000 1.000000';
+        case  1: return '1.000000 0.333333 0.000000';
+        case  2: return '0.000000 1.000000 0.501961';
+        case  3: return '0.000000 1.000000 0.000000';
+        case  4: return '1.000000 0.000000 0.000000';
+        case  5: return '0.000000 0.666667 1.000000';
+        case  6: return '0.000000 1.000000 1.000000';
+        case  7: return '0.501961 1.000000 0.000000';
+        case  8: return '0.501961 0.000000 1.000000';
+        case  9: return '1.000000 0.000000 1.000000';
+        case 10: return '1.000000 0.000000 0.501961';
+        case 11: return '0.000000 0.000000 1.000000';
+        case 12: return '1.000000 1.000000 0.000000';
+        case 13: return '0.000000 0.333333 1.000000';
+        case 14: return '1.000000 0.666667 0.000000';
+        case 15:
+            if (isPants)
+                return
+                      '1 0 0' * (0.502 + 0.498 * sin(t / 2.7182818285 + 0.0000000000))
+                    + '0 1 0' * (0.502 + 0.498 * sin(t / 2.7182818285 + 2.0943951024))
+                    + '0 0 1' * (0.502 + 0.498 * sin(t / 2.7182818285 + 4.1887902048));
+            else
+                return
+                      '1 0 0' * (0.502 + 0.498 * sin(t / 3.1415926536 + 5.2359877560))
+                    + '0 1 0' * (0.502 + 0.498 * sin(t / 3.1415926536 + 3.1415926536))
+                    + '0 0 1' * (0.502 + 0.498 * sin(t / 3.1415926536 + 1.0471975512));
+        default: return '0.000 0.000 0.000';
+    }
+}
+
+#endif
diff --git a/qcsrc/server/_all.qh b/qcsrc/server/_all.qh
index dd3b1aaafb..eeb06e7a69 100644
--- a/qcsrc/server/_all.qh
+++ b/qcsrc/server/_all.qh
@@ -7,6 +7,7 @@
 #include "miscfunctions.qh"
 
 
+#include "../common/effects/all.qh"
 #include "../common/models/all.qh"
 #include "../common/sounds/all.qh"
 
diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc
index 9912174dd8..aa87763ca3 100644
--- a/qcsrc/server/cheats.qc
+++ b/qcsrc/server/cheats.qc
@@ -11,7 +11,6 @@
 
 #include "../common/constants.qh"
 #include "../common/deathtypes.qh"
-#include "../common/effects/effects.qh"
 #include "../common/util.qh"
 
 #include "../common/monsters/all.qh"
diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc
index a0f9a3f131..75c61d2eef 100644
--- a/qcsrc/server/g_world.qc
+++ b/qcsrc/server/g_world.qc
@@ -22,7 +22,6 @@
 #include "../common/buffs/all.qh"
 #include "../common/constants.qh"
 #include "../common/deathtypes.qh"
-#include "../common/effects/effects.qh"
 #include "../common/mapinfo.qh"
 #include "../common/monsters/all.qh"
 #include "../common/monsters/sv_monsters.qh"
@@ -557,7 +556,6 @@ spawnfunc(__init_dedicated_server)
 
 	// needs to be done so early because of the constants they create
 	static_init();
-	CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
 	CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
 
 	MapInfo_Enumerate();
@@ -603,7 +601,6 @@ spawnfunc(worldspawn)
 
 	// needs to be done so early because of the constants they create
 	static_init();
-	CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
 	CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
 
 	ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid));
diff --git a/qcsrc/server/progs.inc b/qcsrc/server/progs.inc
index d8eda4986e..ee891aa4d2 100644
--- a/qcsrc/server/progs.inc
+++ b/qcsrc/server/progs.inc
@@ -1,4 +1,5 @@
 #include "../lib/_all.inc"
+#include "_all.qh"
 
 #include "anticheat.qc"
 #include "antilag.qc"
@@ -61,7 +62,6 @@
 #include "../common/animdecide.qc"
 #include "../common/campaign_file.qc"
 #include "../common/campaign_setup.qc"
-#include "../common/effects/effects.qc"
 #include "../common/effects/effectinfo.qc"
 #include "../common/mapinfo.qc"
 #include "../common/monsters/spawn.qc"
@@ -78,6 +78,7 @@
 #include "../common/util.qc"
 
 #include "../common/buffs/all.qc"
+#include "../common/effects/all.qc"
 #include "../common/items/all.qc"
 #include "../common/monsters/all.qc"
 #include "../common/mutators/all.qc"
diff --git a/qcsrc/test/compilationunit.sh b/qcsrc/test/compilationunit.sh
index e31476f522..66cf5c5766 100755
--- a/qcsrc/test/compilationunit.sh
+++ b/qcsrc/test/compilationunit.sh
@@ -26,7 +26,7 @@ declare -a QCC_FLAGS=(
 
 function check() {
   declare -l base="${1}"
-  declare -la predefs=("-D${2}" "lib/_all.inc")
+  declare -la predefs=("-D${2}" "lib/_all.inc" "${base}/_all.qh")
   find "$base" -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
     echo "$file"
     ${QCC} "${QCC_FLAGS[@]}" "${NOWARN[@]}" "${FEATURES[@]}" "${predefs[@]}" "$file" >/dev/null
-- 
2.39.5