From 70b84d37e2cf1d5336c327cb43593024de2a2c6c Mon Sep 17 00:00:00 2001 From: TimePath Date: Fri, 9 Oct 2015 20:32:33 +1100 Subject: [PATCH] #includes: cleanup --- qcsrc/client/_all.qh | 2 - qcsrc/client/hud.qc | 2 - qcsrc/client/hud_config.qc | 2 - qcsrc/client/mapvoting.qc | 2 - qcsrc/client/progs.inc | 4 - qcsrc/client/quickmenu.qc | 2 - qcsrc/common/animdecide.qc | 10 +- qcsrc/common/buffs/all.qc | 3 - qcsrc/common/campaign_file.qc | 2 - qcsrc/common/campaign_setup.qc | 1 - qcsrc/common/items/item.qh | 41 ++++++++ qcsrc/common/items/item/powerup.qc | 1 - qcsrc/common/mapinfo.qc | 3 - qcsrc/common/minigames/cl_minigames.qh | 2 - qcsrc/common/monsters/spawn.qc | 1 - qcsrc/common/monsters/sv_monsters.qc | 2 - qcsrc/common/movetypes/movetypes.qc | 1 - qcsrc/common/nades/all.qc | 2 - qcsrc/common/notifications.qc | 2 - qcsrc/common/playerstats.qc | 2 - qcsrc/common/triggers/trigger/viewloc.qc | 1 - qcsrc/common/util-pre.qh | 116 --------------------- qcsrc/common/util.qc | 3 - qcsrc/common/viewloc.qc | 1 - qcsrc/common/weapons/all.qc | 3 - qcsrc/common/weapons/config.qc | 2 - qcsrc/csqcmodellib/cl_model.qc | 1 - qcsrc/csqcmodellib/cl_player.qc | 1 - qcsrc/csqcmodellib/interpolate.qc | 1 - qcsrc/csqcmodellib/sv_model.qc | 2 - qcsrc/lib/_all.inc | 35 ++++++- qcsrc/lib/bool.qh | 2 - qcsrc/lib/compiler.qh | 16 +++ qcsrc/lib/defer.qh | 2 + qcsrc/lib/functional.qh | 45 ++++++++ qcsrc/lib/int.qh | 14 +++ qcsrc/lib/iter.qh | 20 ++++ qcsrc/lib/misc.qh | 39 +++++++ qcsrc/lib/nil.qh | 2 +- qcsrc/lib/oo.qh | 2 + qcsrc/{common/util-post.qh => lib/self.qh} | 18 +--- qcsrc/lib/test.qh | 2 - qcsrc/lib/urllib.qh | 2 - qcsrc/menu/_all.qh | 3 - qcsrc/menu/anim/animation.qc | 1 - qcsrc/menu/anim/animhost.qc | 1 - qcsrc/menu/item.qc | 1 - qcsrc/menu/menu.qh | 2 - qcsrc/menu/oo/base.qh | 9 -- qcsrc/menu/oo/classes.qc | 1 - qcsrc/menu/progs.inc | 7 +- qcsrc/menu/xonotic/util.qc | 1 - qcsrc/server/_all.qh | 2 - qcsrc/server/anticheat.qc | 2 - qcsrc/server/antilag.qc | 2 - qcsrc/server/bot/_all.inc | 7 ++ qcsrc/server/bot/bot.qc | 3 - qcsrc/server/bot/havocbot/_all.inc | 3 + qcsrc/server/csqceffects.qc | 1 - qcsrc/server/g_damage.qh | 2 - qcsrc/server/g_models.qc | 7 +- qcsrc/server/ipban.qc | 2 - qcsrc/server/mutators/mutators.qc | 1 - qcsrc/server/mutators/mutators_include.qc | 2 - qcsrc/server/pathlib/_all.inc | 6 ++ qcsrc/server/playerdemo.qc | 2 - qcsrc/server/progs.inc | 24 +---- qcsrc/server/steerlib.qc | 2 - qcsrc/server/t_items.qh | 41 -------- qcsrc/test/compilationunit.sh | 39 ++++--- qcsrc/warpzonelib/anglestransform.qc | 3 - qcsrc/warpzonelib/client.qc | 1 - qcsrc/warpzonelib/common.qc | 3 - qcsrc/warpzonelib/mathlib.qc | 3 - qcsrc/warpzonelib/server.qc | 2 - qcsrc/warpzonelib/util_server.qc | 2 - 76 files changed, 267 insertions(+), 338 deletions(-) delete mode 100644 qcsrc/common/util-pre.qh create mode 100644 qcsrc/lib/compiler.qh create mode 100644 qcsrc/lib/functional.qh create mode 100644 qcsrc/lib/int.qh create mode 100644 qcsrc/lib/iter.qh create mode 100644 qcsrc/lib/misc.qh rename qcsrc/{common/util-post.qh => lib/self.qh} (72%) delete mode 100644 qcsrc/menu/oo/base.qh create mode 100644 qcsrc/server/bot/_all.inc create mode 100644 qcsrc/server/bot/havocbot/_all.inc create mode 100644 qcsrc/server/pathlib/_all.inc diff --git a/qcsrc/client/_all.qh b/qcsrc/client/_all.qh index 0fe1c616f..7ae1430d4 100644 --- a/qcsrc/client/_all.qh +++ b/qcsrc/client/_all.qh @@ -6,8 +6,6 @@ #include "main.qh" #include "miscfunctions.qh" -#include "../dpdefs/csprogsdefs.qh" - #include "../common/models/all.qh" #include "../common/sounds/all.qh" diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index dbae62cbd..81fa57552 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -7,8 +7,6 @@ #include "teamradar.qh" #include "t_items.qh" -#include "../dpdefs/keycodes.qh" - #include "../common/buffs/all.qh" #include "../common/constants.qh" #include "../common/deathtypes.qh" diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index 2cdb9fcf4..55c6c061e 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -5,8 +5,6 @@ #include "../common/constants.qh" -#include "../dpdefs/keycodes.qh" - #define HUD_Write(s) fputs(fh, s) // q: quoted, n: not quoted diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 945f312ab..010f424f1 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -7,8 +7,6 @@ #include "../common/mapinfo.qh" #include "../common/util.qh" -#include "../dpdefs/keycodes.qh" - int mv_num_maps; diff --git a/qcsrc/client/progs.inc b/qcsrc/client/progs.inc index ec5c31844..e1e96ef13 100644 --- a/qcsrc/client/progs.inc +++ b/qcsrc/client/progs.inc @@ -1,7 +1,3 @@ -#include "../common/util-pre.qh" -#include "../dpdefs/csprogsdefs.qh" -#include "../common/util-post.qh" - #include "../lib/_all.inc" #include "announcer.qc" diff --git a/qcsrc/client/quickmenu.qc b/qcsrc/client/quickmenu.qc index 5f896beea..dd2ba0315 100644 --- a/qcsrc/client/quickmenu.qc +++ b/qcsrc/client/quickmenu.qc @@ -2,8 +2,6 @@ #include "hud_config.qh" -#include "../dpdefs/keycodes.qh" - // QUICKMENU_MAXLINES must be <= 10 const int QUICKMENU_MAXLINES = 10; // visible entries are loaded from QuickMenu_Buffer into QuickMenu_Page_* arrays diff --git a/qcsrc/common/animdecide.qc b/qcsrc/common/animdecide.qc index 0db1a6afd..e2bda23a0 100644 --- a/qcsrc/common/animdecide.qc +++ b/qcsrc/common/animdecide.qc @@ -1,12 +1,6 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "animdecide.qh" -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" +#include "animdecide.qh" +#if defined(SVQC) #include "util.qh" - #include "animdecide.qh" #include "../server/defs.qh" #endif diff --git a/qcsrc/common/buffs/all.qc b/qcsrc/common/buffs/all.qc index 190c627ce..c6a6f49f0 100644 --- a/qcsrc/common/buffs/all.qc +++ b/qcsrc/common/buffs/all.qc @@ -1,10 +1,7 @@ #if defined(CSQC) - #include "../../dpdefs/csprogsdefs.qh" #include "../../client/defs.qh" #elif defined(MENUQC) #elif defined(SVQC) - #include "../../dpdefs/progsdefs.qh" - #include "../../dpdefs/dpextensions.qh" #endif #include "all.qh" diff --git a/qcsrc/common/campaign_file.qc b/qcsrc/common/campaign_file.qc index 69dbb0b1d..a8bbe8e85 100644 --- a/qcsrc/common/campaign_file.qc +++ b/qcsrc/common/campaign_file.qc @@ -1,8 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "util.qh" #include "campaign_common.qh" #endif diff --git a/qcsrc/common/campaign_setup.qc b/qcsrc/common/campaign_setup.qc index b822c3494..8c20c755c 100644 --- a/qcsrc/common/campaign_setup.qc +++ b/qcsrc/common/campaign_setup.qc @@ -1,7 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" #include "campaign_common.qh" #include "mapinfo.qh" #endif diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index ceb9a0aa4..7a12b3050 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -1,5 +1,46 @@ #ifndef GAMEITEM_H #define GAMEITEM_H + +const int IT_UNLIMITED_WEAPON_AMMO = 1; // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup. +const int IT_UNLIMITED_SUPERWEAPONS = 2; // when this bit is set, superweapons don't expire. Checkpoints can give this powerup. +const int IT_CTF_SHIELDED = 4; // set for the flag shield +const int IT_USING_JETPACK = 8; // confirmation that button is pressed +const int IT_JETPACK = 16; // actual item +const int IT_FUEL_REGEN = 32; // fuel regeneration trigger +// where is 64... ? +const int IT_FUEL = 128; +// -Wdouble-declaration +#define IT_SHELLS 256 +// -Wdouble-declaration +#define IT_NAILS 512 +// -Wdouble-declaration +#define IT_ROCKETS 1024 +// -Wdouble-declaration +#define IT_CELLS 2048 +const int IT_SUPERWEAPON = 4096; +const int IT_STRENGTH = 8192; +const int IT_INVINCIBLE = 16384; +const int IT_HEALTH = 32768; +const int IT_PLASMA = 65536; + +// shared value space (union): + // for items: + // -Wdouble-declaration + #define IT_KEY1 131072 + // -Wdouble-declaration + #define IT_KEY2 262144 +// end + +const int IT_5HP = 524288; +const int IT_25HP = 1048576; +const int IT_ARMOR_SHARD = 2097152; +const int IT_ARMOR = 4194304; + +// item masks +const int IT_AMMO = 3968; // IT_FUEL | IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_PLASMA; +const int IT_PICKUPMASK = 51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately +const int IT_UNLIMITED_AMMO = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO; + #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__) /** If you register a new item, make sure to add it to all.inc */ CLASS(GameItem, Object) diff --git a/qcsrc/common/items/item/powerup.qc b/qcsrc/common/items/item/powerup.qc index f411d748a..a1b2f1403 100644 --- a/qcsrc/common/items/item/powerup.qc +++ b/qcsrc/common/items/item/powerup.qc @@ -1,5 +1,4 @@ #include "powerup.qh" -#include "../../../server/t_items.qh" #ifndef SVQC .int m_itemid; diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index ba21ff43d..1daf862b6 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -1,5 +1,4 @@ #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" #include "../client/defs.qh" #include "util.qh" #include "buffs/all.qh" @@ -7,8 +6,6 @@ #include "mapinfo.qh" #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "util.qh" #include "buffs/all.qh" #include "monsters/all.qh" diff --git a/qcsrc/common/minigames/cl_minigames.qh b/qcsrc/common/minigames/cl_minigames.qh index a073af897..016e8a3ed 100644 --- a/qcsrc/common/minigames/cl_minigames.qh +++ b/qcsrc/common/minigames/cl_minigames.qh @@ -1,8 +1,6 @@ #ifndef CL_MINIGAMES_H #define CL_MINIGAMES_H -#include "../../dpdefs/keycodes.qh" - // Get a square in the center of the avaliable area // \note macro to pass by reference pos and mySize #define minigame_hud_fitsqare(pos, mySize) \ diff --git a/qcsrc/common/monsters/spawn.qc b/qcsrc/common/monsters/spawn.qc index cf23639e0..f7e2e292f 100644 --- a/qcsrc/common/monsters/spawn.qc +++ b/qcsrc/common/monsters/spawn.qc @@ -1,7 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../../dpdefs/progsdefs.qh" #include "../util.qh" #include "all.qh" #include "sv_monsters.qh" diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 8b05f781d..b8bff0201 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -1,8 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../../dpdefs/progsdefs.qh" - #include "../../dpdefs/dpextensions.qh" #include "../../warpzonelib/common.qh" #include "../constants.qh" #include "../teams.qh" diff --git a/qcsrc/common/movetypes/movetypes.qc b/qcsrc/common/movetypes/movetypes.qc index cfa6346dc..0fed28f15 100644 --- a/qcsrc/common/movetypes/movetypes.qc +++ b/qcsrc/common/movetypes/movetypes.qc @@ -2,7 +2,6 @@ #include "../physics.qh" #if defined(CSQC) - #include "../../dpdefs/csprogsdefs.qh" #include "../../client/defs.qh" #include "../stats.qh" #include "../util.qh" diff --git a/qcsrc/common/nades/all.qc b/qcsrc/common/nades/all.qc index 90d7ca3ce..724837b25 100644 --- a/qcsrc/common/nades/all.qc +++ b/qcsrc/common/nades/all.qc @@ -1,5 +1,4 @@ #if defined(CSQC) - #include "../../dpdefs/csprogsdefs.qh" #include "../../client/defs.qh" #include "all.qh" #include "../buffs/all.qh" @@ -8,7 +7,6 @@ #include "../../csqcmodellib/cl_model.qh" #elif defined(MENUQC) #elif defined(SVQC) - #include "../../dpdefs/progsdefs.qh" #include "../constants.qh" #include "../../server/constants.qh" #include "../turrets/sv_turrets.qh" diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 13097a425..600ddaa1b 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -1,8 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "constants.qh" #include "teams.qh" #include "../server/autocvars.qh" diff --git a/qcsrc/common/playerstats.qc b/qcsrc/common/playerstats.qc index 3a44d7190..0fcbd4259 100644 --- a/qcsrc/common/playerstats.qc +++ b/qcsrc/common/playerstats.qc @@ -1,8 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "constants.qh" #include "util.qh" #include "weapons/all.qh" diff --git a/qcsrc/common/triggers/trigger/viewloc.qc b/qcsrc/common/triggers/trigger/viewloc.qc index 65deb3963..00695cfa3 100644 --- a/qcsrc/common/triggers/trigger/viewloc.qc +++ b/qcsrc/common/triggers/trigger/viewloc.qc @@ -1,7 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../../../dpdefs/progsdefs.qh" #include "../../../warpzonelib/util_server.qh" #include "../../../server/defs.qh" #endif diff --git a/qcsrc/common/util-pre.qh b/qcsrc/common/util-pre.qh deleted file mode 100644 index dfb407160..000000000 --- a/qcsrc/common/util-pre.qh +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef UTIL_PRE_H -#define UTIL_PRE_H - -#ifndef NOCOMPAT - #define COMPAT_NO_MOD_IS_XONOTIC -#endif - -#ifndef QCC_SUPPORT_ACCUMULATE - #ifdef GMQCC - #define QCC_SUPPORT_ACCUMULATE - #endif -#endif - -#ifndef QCC_SUPPORT_NIL - #ifdef GMQCC - #define QCC_SUPPORT_NIL 1 - #endif -#endif - -#ifndef QCC_SUPPORT_INT - #define int float - - #define stoi(s) stof(s) - #define stob(s) stof(s) - #define itos(i) ftos(i) -#else - #define stoi(s) ((int) stof(s)) - #define stob(s) ((bool) stof(s)) - #define itos(i) ftos(i) -#endif - -#define FOREACH_ARRAY(arr, start, end, cond, body) do { \ - for (int i = start; i < end; ++i) { \ - const noref entity it = arr[i]; \ - if (cond) { body } \ - } \ -} while(0) - -#define FOREACH_LIST(list, next, cond, body) do { \ - noref int i = 0; \ - for (entity it = list##_first; it; (it = it.next, ++i)) { \ - if (cond) { body } \ - } \ -} while(0) - -#define FOREACH(list, cond, body) FOREACH_LIST(list, enemy, cond, body) - -#ifdef GMQCC - #define EVAL(...) __VA_ARGS__ - - #define OVERLOAD_(F, ...) F##_##__VA_COUNT__(__VA_ARGS__) - #define OVERLOAD(F, ...) F##_##__VA_COUNT__(__VA_ARGS__) -#else - #define EMPTY() - #define DEFER(id) id EMPTY() - - #define EVAL(...) EVAL1(EVAL1(EVAL1(__VA_ARGS__))) - #define EVAL1(...) EVAL2(EVAL2(EVAL2(__VA_ARGS__))) - #define EVAL2(...) EVAL3(EVAL3(EVAL3(__VA_ARGS__))) - #define EVAL3(...) EVAL4(EVAL4(EVAL4(__VA_ARGS__))) - #define EVAL4(...) EVAL5(EVAL5(EVAL5(__VA_ARGS__))) - #define EVAL5(...) __VA_ARGS__ - - #define OVERLOAD___(F,_16,_15,_14,_13,_12,_11,_10,_9,_8,_7,_6,_5,_4,_3,_2,_1,n,...) F##_##n - #define OVERLOAD__(F, ...) OVERLOAD___(F,##__VA_ARGS__,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0) - #define OVERLOAD_(...) DEFER(OVERLOAD__(__VA_ARGS__)) - #define OVERLOAD(F, ...) OVERLOAD_(F,##__VA_ARGS__)(__VA_ARGS__) -#endif - -#define LAMBDA(...) { __VA_ARGS__ ; } - -#define MAP(f, ...) EVAL(OVERLOAD(MAP, f, __VA_ARGS__)) -#define MAP_2(f, it) f(it) -#define MAP_3(f, it, ...) f(it)MAP_2(f, __VA_ARGS__) -#define MAP_4(f, it, ...) f(it)MAP_3(f, __VA_ARGS__) -#define MAP_5(f, it, ...) f(it)MAP_4(f, __VA_ARGS__) -#define MAP_6(f, it, ...) f(it)MAP_5(f, __VA_ARGS__) -#define MAP_7(f, it, ...) f(it)MAP_6(f, __VA_ARGS__) -#define MAP_8(f, it, ...) f(it)MAP_7(f, __VA_ARGS__) -#define MAP_9(f, it, ...) f(it)MAP_8(f, __VA_ARGS__) -#define MAP_10(f, it, ...) f(it)MAP_9(f, __VA_ARGS__) -#define MAP_11(f, it, ...) f(it)MAP_10(f, __VA_ARGS__) -#define MAP_12(f, it, ...) f(it)MAP_11(f, __VA_ARGS__) -#define MAP_13(f, it, ...) f(it)MAP_12(f, __VA_ARGS__) -#define MAP_14(f, it, ...) f(it)MAP_13(f, __VA_ARGS__) -#define MAP_15(f, it, ...) f(it)MAP_14(f, __VA_ARGS__) -#define MAP_16(f, it, ...) f(it)MAP_15(f, __VA_ARGS__) -#define MAP_17(f, it, ...) f(it)MAP_16(f, __VA_ARGS__) -#define MAP_18(f, it, ...) f(it)MAP_17(f, __VA_ARGS__) -#define MAP_19(f, it, ...) f(it)MAP_18(f, __VA_ARGS__) -#define MAP_20(f, it, ...) f(it)MAP_19(f, __VA_ARGS__) - -#define IDENTITY(it) it - -#define UNWORDS(...) MAP(IDENTITY, __VA_ARGS__) - -#define APPLY(f, ...) f(__VA_ARGS__) - -#ifdef SVQC - #define SV(f, ...) f(__VA_ARGS__) -#else - #define SV(f, ...) -#endif - -#ifdef CSQC - #define CL(f, ...) f(__VA_ARGS__) -#else - #define CL(f, ...) -#endif - -#define IF(cond, f, ...) cond(f, __VA_ARGS__) - -#define GET(name) name##get -#define GETTER(type, name) type GET(name)() { return name; } - -#endif diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index c304ed88d..9c794c0eb 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -1,7 +1,6 @@ #include "util.qh" #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" #include "../client/defs.qh" #include "constants.qh" #include "../client/mutators/events.qh" @@ -10,8 +9,6 @@ #include "deathtypes.qh" #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "constants.qh" #include "../server/autocvars.qh" #include "../server/defs.qh" diff --git a/qcsrc/common/viewloc.qc b/qcsrc/common/viewloc.qc index ce89bde34..e992c4dda 100644 --- a/qcsrc/common/viewloc.qc +++ b/qcsrc/common/viewloc.qc @@ -1,7 +1,6 @@ #include "util.qh" #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" #include "../client/defs.qh" #include "constants.qh" #elif defined(MENUQC) diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index 2c72d380f..01214331c 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -4,7 +4,6 @@ #include "all.qh" #if defined(CSQC) - #include "../../dpdefs/csprogsdefs.qh" #include "../../client/defs.qh" #include "../constants.qh" #include "../stats.qh" @@ -21,8 +20,6 @@ #include "../../csqcmodellib/cl_model.qh" #elif defined(MENUQC) #elif defined(SVQC) - #include "../../dpdefs/progsdefs.qh" - #include "../../dpdefs/dpextensions.qh" #include "../../warpzonelib/anglestransform.qh" #include "../../warpzonelib/common.qh" #include "../../warpzonelib/util_server.qh" diff --git a/qcsrc/common/weapons/config.qc b/qcsrc/common/weapons/config.qc index d932224e3..7d1b4e3d2 100644 --- a/qcsrc/common/weapons/config.qc +++ b/qcsrc/common/weapons/config.qc @@ -1,8 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../../dpdefs/progsdefs.qh" - #include "../../dpdefs/dpextensions.qh" #include "../util.qh" #include "config.qh" #include "all.qh" diff --git a/qcsrc/csqcmodellib/cl_model.qc b/qcsrc/csqcmodellib/cl_model.qc index ab93b0172..b42f5c4c5 100644 --- a/qcsrc/csqcmodellib/cl_model.qc +++ b/qcsrc/csqcmodellib/cl_model.qc @@ -20,7 +20,6 @@ * IN THE SOFTWARE. */ #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" #include "../client/defs.qh" #include "../common/util.qh" #include "../common/animdecide.qh" diff --git a/qcsrc/csqcmodellib/cl_player.qc b/qcsrc/csqcmodellib/cl_player.qc index 1a96e23dd..7aedd52e6 100644 --- a/qcsrc/csqcmodellib/cl_player.qc +++ b/qcsrc/csqcmodellib/cl_player.qc @@ -21,7 +21,6 @@ * IN THE SOFTWARE. */ #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" #include "../client/defs.qh" #include "../common/constants.qh" #include "../common/stats.qh" diff --git a/qcsrc/csqcmodellib/interpolate.qc b/qcsrc/csqcmodellib/interpolate.qc index 78fb051f7..fb1094f72 100644 --- a/qcsrc/csqcmodellib/interpolate.qc +++ b/qcsrc/csqcmodellib/interpolate.qc @@ -20,7 +20,6 @@ * IN THE SOFTWARE. */ #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" #include "../client/defs.qh" #include "../warpzonelib/anglestransform.qh" #include "../client/autocvars.qh" diff --git a/qcsrc/csqcmodellib/sv_model.qc b/qcsrc/csqcmodellib/sv_model.qc index ebe0b6e87..0fc2ad8b6 100644 --- a/qcsrc/csqcmodellib/sv_model.qc +++ b/qcsrc/csqcmodellib/sv_model.qc @@ -23,8 +23,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "../common/constants.qh" #include "../common/util.qh" #include "../common/animdecide.qh" diff --git a/qcsrc/lib/_all.inc b/qcsrc/lib/_all.inc index c00c5a12a..5addff39f 100644 --- a/qcsrc/lib/_all.inc +++ b/qcsrc/lib/_all.inc @@ -1,18 +1,48 @@ -#include "bool.qh" +#ifndef NOCOMPAT + #define COMPAT_NO_MOD_IS_XONOTIC +#endif + +#include "compiler.qh" + +#ifndef QCC_SUPPORT_INT + #define int float +#endif + +#ifndef QCC_SUPPORT_BOOL + #define bool float +#endif + +#if defined(CSQC) + #include "../dpdefs/csprogsdefs.qh" + #include "../dpdefs/keycodes.qh" +#elif defined(SVQC) + #include "../server/sys-pre.qh" + #include "../dpdefs/progsdefs.qh" + #include "../dpdefs/dpextensions.qh" + #include "../server/sys-post.qh" +#elif defined(MENUQC) + #include "../dpdefs/menudefs.qh" + #include "../dpdefs/keycodes.qh" +#endif #include "../warpzonelib/mathlib.qc" #include "accumulate.qh" #include "bits.qh" +#include "bool.qh" #include "counting.qh" #include "cvar.qh" #include "defer.qh" #include "draw.qh" #include "file.qh" +#include "functional.qh" #include "i18n.qh" +#include "int.qh" +#include "iter.qh" #include "lazy.qh" #include "log.qh" #include "math.qh" +#include "misc.qh" #include "net.qh" #include "nil.qh" #include "noise.qc" @@ -23,8 +53,9 @@ #include "random.qc" #include "registry.qh" #include "replicate.qh" -#include "sort.qh" +#include "self.qh" #include "sortlist.qc" +#include "sort.qh" #include "spawnfunc.qh" #include "static.qh" #include "string.qh" diff --git a/qcsrc/lib/bool.qh b/qcsrc/lib/bool.qh index 26169cd19..7a719af40 100644 --- a/qcsrc/lib/bool.qh +++ b/qcsrc/lib/bool.qh @@ -2,8 +2,6 @@ #define BOOL_H #ifndef QCC_SUPPORT_BOOL - #define bool float - // Boolean Constants const int true = 1; const int false = 0; diff --git a/qcsrc/lib/compiler.qh b/qcsrc/lib/compiler.qh new file mode 100644 index 000000000..69aad5c54 --- /dev/null +++ b/qcsrc/lib/compiler.qh @@ -0,0 +1,16 @@ +#ifndef COMPILER_H +#define COMPILER_H + +#ifndef QCC_SUPPORT_ACCUMULATE + #ifdef GMQCC + #define QCC_SUPPORT_ACCUMULATE + #endif +#endif + +#ifndef QCC_SUPPORT_NIL + #ifdef GMQCC + #define QCC_SUPPORT_NIL + #endif +#endif + +#endif diff --git a/qcsrc/lib/defer.qh b/qcsrc/lib/defer.qh index 2a1361116..6c4956634 100644 --- a/qcsrc/lib/defer.qh +++ b/qcsrc/lib/defer.qh @@ -1,7 +1,9 @@ #ifndef MENUQC #ifndef DEFER_H #define DEFER_H + #include "oo.qh" +#include "self.qh" entityclass(Defer); class(Defer) .entity owner; diff --git a/qcsrc/lib/functional.qh b/qcsrc/lib/functional.qh new file mode 100644 index 000000000..2bbe7d59d --- /dev/null +++ b/qcsrc/lib/functional.qh @@ -0,0 +1,45 @@ +#ifndef FUNCTIONAL_H +#define FUNCTIONAL_H + +#define MAP(f, ...) EVAL(OVERLOAD(MAP, f, __VA_ARGS__)) +#define MAP_2(f, it) f(it) +#define MAP_3(f, it, ...) f(it)MAP_2(f, __VA_ARGS__) +#define MAP_4(f, it, ...) f(it)MAP_3(f, __VA_ARGS__) +#define MAP_5(f, it, ...) f(it)MAP_4(f, __VA_ARGS__) +#define MAP_6(f, it, ...) f(it)MAP_5(f, __VA_ARGS__) +#define MAP_7(f, it, ...) f(it)MAP_6(f, __VA_ARGS__) +#define MAP_8(f, it, ...) f(it)MAP_7(f, __VA_ARGS__) +#define MAP_9(f, it, ...) f(it)MAP_8(f, __VA_ARGS__) +#define MAP_10(f, it, ...) f(it)MAP_9(f, __VA_ARGS__) +#define MAP_11(f, it, ...) f(it)MAP_10(f, __VA_ARGS__) +#define MAP_12(f, it, ...) f(it)MAP_11(f, __VA_ARGS__) +#define MAP_13(f, it, ...) f(it)MAP_12(f, __VA_ARGS__) +#define MAP_14(f, it, ...) f(it)MAP_13(f, __VA_ARGS__) +#define MAP_15(f, it, ...) f(it)MAP_14(f, __VA_ARGS__) +#define MAP_16(f, it, ...) f(it)MAP_15(f, __VA_ARGS__) +#define MAP_17(f, it, ...) f(it)MAP_16(f, __VA_ARGS__) +#define MAP_18(f, it, ...) f(it)MAP_17(f, __VA_ARGS__) +#define MAP_19(f, it, ...) f(it)MAP_18(f, __VA_ARGS__) +#define MAP_20(f, it, ...) f(it)MAP_19(f, __VA_ARGS__) + +#define IDENTITY(it) it + +#define UNWORDS(...) MAP(IDENTITY, __VA_ARGS__) + +#define APPLY(f, ...) f(__VA_ARGS__) + +#ifdef SVQC + #define SV(f, ...) f(__VA_ARGS__) +#else + #define SV(f, ...) +#endif + +#ifdef CSQC + #define CL(f, ...) f(__VA_ARGS__) +#else + #define CL(f, ...) +#endif + +#define IF(cond, f, ...) cond(f, __VA_ARGS__) + +#endif diff --git a/qcsrc/lib/int.qh b/qcsrc/lib/int.qh new file mode 100644 index 000000000..d9ea61f0c --- /dev/null +++ b/qcsrc/lib/int.qh @@ -0,0 +1,14 @@ +#ifndef INT_H +#define INT_H + +#ifndef QCC_SUPPORT_INT + #define stoi(s) stof(s) + #define stob(s) stof(s) + #define itos(i) ftos(i) +#else + #define stoi(s) ((int) stof(s)) + #define stob(s) ((bool) stof(s)) + #define itos(i) ftos(i) +#endif + +#endif diff --git a/qcsrc/lib/iter.qh b/qcsrc/lib/iter.qh new file mode 100644 index 000000000..53b3d6629 --- /dev/null +++ b/qcsrc/lib/iter.qh @@ -0,0 +1,20 @@ +#ifndef ITER_H +#define ITER_H + +#define FOREACH_ARRAY(arr, start, end, cond, body) do { \ + for (int i = start; i < end; ++i) { \ + const noref entity it = arr[i]; \ + if (cond) { body } \ + } \ +} while(0) + +#define FOREACH_LIST(list, next, cond, body) do { \ + noref int i = 0; \ + for (entity it = list##_first; it; (it = it.next, ++i)) { \ + if (cond) { body } \ + } \ +} while(0) + +#define FOREACH(list, cond, body) FOREACH_LIST(list, enemy, cond, body) + +#endif diff --git a/qcsrc/lib/misc.qh b/qcsrc/lib/misc.qh new file mode 100644 index 000000000..8a6e117a7 --- /dev/null +++ b/qcsrc/lib/misc.qh @@ -0,0 +1,39 @@ +#ifndef MISC_H +#define MISC_H + +#ifdef GMQCC + #define EVAL(...) __VA_ARGS__ + + #define OVERLOAD_(F, ...) F##_##__VA_COUNT__(__VA_ARGS__) + #define OVERLOAD(F, ...) F##_##__VA_COUNT__(__VA_ARGS__) +#else + #define EMPTY() + #define DEFER(id) id EMPTY() + + #define EVAL(...) EVAL1(EVAL1(EVAL1(__VA_ARGS__))) + #define EVAL1(...) EVAL2(EVAL2(EVAL2(__VA_ARGS__))) + #define EVAL2(...) EVAL3(EVAL3(EVAL3(__VA_ARGS__))) + #define EVAL3(...) EVAL4(EVAL4(EVAL4(__VA_ARGS__))) + #define EVAL4(...) EVAL5(EVAL5(EVAL5(__VA_ARGS__))) + #define EVAL5(...) __VA_ARGS__ + + #define OVERLOAD___(F,_16,_15,_14,_13,_12,_11,_10,_9,_8,_7,_6,_5,_4,_3,_2,_1,n,...) F##_##n + #define OVERLOAD__(F, ...) OVERLOAD___(F,##__VA_ARGS__,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0) + #define OVERLOAD_(...) DEFER(OVERLOAD__(__VA_ARGS__)) + #define OVERLOAD(F, ...) OVERLOAD_(F,##__VA_ARGS__)(__VA_ARGS__) +#endif + +#define GET(name) name##get +#define GETTER(type, name) type GET(name)() { return name; } + +#define LAMBDA(...) { __VA_ARGS__ ; } + +// Can't wrap with do-while as block may contain continue or break +#define WITH(type, name, value, block) { \ + type __with_save = (name); \ + name = (value); \ + LAMBDA(block) \ + name = __with_save; \ +} do { } while (0) + +#endif diff --git a/qcsrc/lib/nil.qh b/qcsrc/lib/nil.qh index 789b1f9c0..87e3aea5e 100644 --- a/qcsrc/lib/nil.qh +++ b/qcsrc/lib/nil.qh @@ -1,7 +1,7 @@ #ifndef NIL_H #define NIL_H -#if QCC_SUPPORT_NIL +#ifdef QCC_SUPPORT_NIL #define func_null nil #define string_null nil #else diff --git a/qcsrc/lib/oo.qh b/qcsrc/lib/oo.qh index fce18cbfd..0615282c3 100644 --- a/qcsrc/lib/oo.qh +++ b/qcsrc/lib/oo.qh @@ -1,6 +1,7 @@ #ifndef OO_H #define OO_H +#include "misc.qh" #include "nil.qh" #ifdef MENUQC @@ -35,6 +36,7 @@ entity __spawn(string _classname, string _sourceFile, int _sourceLine) { #define class(name) [[class(name)]] #define new(class) ((class) __spawn(#class, __FILE__, __LINE__)) #endif +#define spawn() new(entity) // Classes have a `spawn##cname(entity)` constructor // The parameter is used across [[accumulate]] functions diff --git a/qcsrc/common/util-post.qh b/qcsrc/lib/self.qh similarity index 72% rename from qcsrc/common/util-post.qh rename to qcsrc/lib/self.qh index f796b6ebd..eac0c644a 100644 --- a/qcsrc/common/util-post.qh +++ b/qcsrc/lib/self.qh @@ -1,18 +1,10 @@ -#ifndef UTIL_POST_H -#define UTIL_POST_H - -[[alias("self")]] entity __self; - -// Can't wrap with do-while as block may contain continue or break -#define WITH(type, name, value, block) { \ - type __with_save = (name); \ - name = (value); \ - LAMBDA(block) \ - name = __with_save; \ -} do { } while (0) +#ifndef SELF_H +#define SELF_H // Transition from global 'self' to local 'this' +[[alias("self")]] entity __self; + // Step 1: auto oldself #if 1 #define SELFPARAM() noref entity this = __self @@ -42,6 +34,4 @@ entity getself() { return self; } #define self this #endif -#define spawn() new(entity) - #endif diff --git a/qcsrc/lib/test.qh b/qcsrc/lib/test.qh index d1f5357a5..edc2f5bf3 100644 --- a/qcsrc/lib/test.qh +++ b/qcsrc/lib/test.qh @@ -1,8 +1,6 @@ #ifndef TEST_H #define TEST_H -#include "../common/util.qh" - #define TEST_Check(cond) do { if(!(cond)) TEST_Fail(#cond); } while(0) void TEST_OK(); diff --git a/qcsrc/lib/urllib.qh b/qcsrc/lib/urllib.qh index 6f1967851..e4b8a8f27 100644 --- a/qcsrc/lib/urllib.qh +++ b/qcsrc/lib/urllib.qh @@ -1,8 +1,6 @@ #ifndef URLLIB_H #define URLLIB_H -#include "../common/util.qh" - // URI handles const int URI_GET_DISCARD = 0; const int URI_GET_IPBAN = 1; diff --git a/qcsrc/menu/_all.qh b/qcsrc/menu/_all.qh index a6903ae3d..7834cdb84 100644 --- a/qcsrc/menu/_all.qh +++ b/qcsrc/menu/_all.qh @@ -1,7 +1,4 @@ #ifndef CLIENT_ALL_H #define CLIENT_ALL_H -#include "../dpdefs/menudefs.qh" -#include "../dpdefs/keycodes.qh" - #endif diff --git a/qcsrc/menu/anim/animation.qc b/qcsrc/menu/anim/animation.qc index 5563b969d..d24220fef 100644 --- a/qcsrc/menu/anim/animation.qc +++ b/qcsrc/menu/anim/animation.qc @@ -1,6 +1,5 @@ #ifndef ANIM_ANIMATION_H #define ANIM_ANIMATION_H -#include "../oo/base.qh" void setterDummy(entity, float); CLASS(Animation, Object) METHOD(Animation, configureAnimation, void(entity, entity, void(entity, float), float, float, float, float)); diff --git a/qcsrc/menu/anim/animhost.qc b/qcsrc/menu/anim/animhost.qc index 4489de3d5..55ca901dc 100644 --- a/qcsrc/menu/anim/animhost.qc +++ b/qcsrc/menu/anim/animhost.qc @@ -2,7 +2,6 @@ #ifndef ANIM_ANIMHOST_H #define ANIM_ANIMHOST_H -#include "../oo/base.qh" CLASS(AnimHost, Object) METHOD(AnimHost, addAnim, void(entity, entity)); METHOD(AnimHost, removeAnim, void(entity, entity)); diff --git a/qcsrc/menu/item.qc b/qcsrc/menu/item.qc index 8788f2e84..fa6161a97 100644 --- a/qcsrc/menu/item.qc +++ b/qcsrc/menu/item.qc @@ -1,7 +1,6 @@ #ifndef ITEM_H #define ITEM_H #include "skin.qh" -#include "oo/base.qh" CLASS(Item, Object) METHOD(Item, draw, void(entity)); METHOD(Item, keyDown, float(entity, float, float, float)); diff --git a/qcsrc/menu/menu.qh b/qcsrc/menu/menu.qh index 0ece40c88..6d45ca82f 100644 --- a/qcsrc/menu/menu.qh +++ b/qcsrc/menu/menu.qh @@ -4,8 +4,6 @@ #include "draw.qh" #include "skin.qh" -#include "oo/base.qh" - #include "xonotic/util.qh" #include "../common/constants.qh" diff --git a/qcsrc/menu/oo/base.qh b/qcsrc/menu/oo/base.qh deleted file mode 100644 index 894b4b928..000000000 --- a/qcsrc/menu/oo/base.qh +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef BASE_H -#define BASE_H - -#include "../../common/util.qh" -#include "../../dpdefs/keycodes.qh" - -#define world NULL - -#endif diff --git a/qcsrc/menu/oo/classes.qc b/qcsrc/menu/oo/classes.qc index 4a14eea7b..16a830da0 100644 --- a/qcsrc/menu/oo/classes.qc +++ b/qcsrc/menu/oo/classes.qc @@ -1,6 +1,5 @@ #ifndef CLASSES_H #define CLASSES_H -#include "base.qh" #include "../classes.inc" #define IMPLEMENTATION diff --git a/qcsrc/menu/progs.inc b/qcsrc/menu/progs.inc index ba7411bb6..ae221de27 100644 --- a/qcsrc/menu/progs.inc +++ b/qcsrc/menu/progs.inc @@ -1,10 +1,7 @@ -#include "../common/util-pre.qh" -#include "../dpdefs/menudefs.qh" -#include "../dpdefs/keycodes.qh" -#include "../common/util-post.qh" - #include "../lib/_all.inc" +#define world NULL + #include "oo/classes.qc" #include "draw.qc" diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index f4faea62b..3ef021396 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -1,6 +1,5 @@ #include "util.qh" #include "../menu.qh" -#include "../oo/base.qh" #include "../../common/campaign_common.qh" #include "../../common/constants.qh" #include "../../common/mapinfo.qh" diff --git a/qcsrc/server/_all.qh b/qcsrc/server/_all.qh index 3e99cabeb..dd3b1aaaf 100644 --- a/qcsrc/server/_all.qh +++ b/qcsrc/server/_all.qh @@ -6,8 +6,6 @@ #include "defs.qh" #include "miscfunctions.qh" -#include "../dpdefs/progsdefs.qh" -#include "../dpdefs/dpextensions.qh" #include "../common/models/all.qh" #include "../common/sounds/all.qh" diff --git a/qcsrc/server/anticheat.qc b/qcsrc/server/anticheat.qc index 32742d82d..61bb611fd 100644 --- a/qcsrc/server/anticheat.qc +++ b/qcsrc/server/anticheat.qc @@ -5,8 +5,6 @@ #include "defs.qh" #include "miscfunctions.qh" -#include "../dpdefs/progsdefs.qh" -#include "../dpdefs/dpextensions.qh" #include "command/common.qh" diff --git a/qcsrc/server/antilag.qc b/qcsrc/server/antilag.qc index f152c8216..64db8da8f 100644 --- a/qcsrc/server/antilag.qc +++ b/qcsrc/server/antilag.qc @@ -1,8 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "../common/vehicles/all.qh" #include "antilag.qh" #endif diff --git a/qcsrc/server/bot/_all.inc b/qcsrc/server/bot/_all.inc new file mode 100644 index 000000000..2965baab7 --- /dev/null +++ b/qcsrc/server/bot/_all.inc @@ -0,0 +1,7 @@ +#include "aim.qc" +#include "bot.qc" +#include "navigation.qc" +#include "scripting.qc" +#include "waypoints.qc" + +#include "havocbot/_all.inc" diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc index 00051cadb..c033daeec 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/bot.qc @@ -31,9 +31,6 @@ #include "../../csqcmodellib/sv_model.qh" -#include "../../dpdefs/dpextensions.qh" -#include "../../dpdefs/progsdefs.qh" - #include "../../warpzonelib/common.qh" #include "../../warpzonelib/util_server.qh" diff --git a/qcsrc/server/bot/havocbot/_all.inc b/qcsrc/server/bot/havocbot/_all.inc new file mode 100644 index 000000000..fb73954a1 --- /dev/null +++ b/qcsrc/server/bot/havocbot/_all.inc @@ -0,0 +1,3 @@ +#include "havocbot.qc" +#include "role_keyhunt.qc" +#include "roles.qc" diff --git a/qcsrc/server/csqceffects.qc b/qcsrc/server/csqceffects.qc index 4ebe76b40..a26fa97aa 100644 --- a/qcsrc/server/csqceffects.qc +++ b/qcsrc/server/csqceffects.qc @@ -1,7 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" #include "../common/constants.qh" #endif diff --git a/qcsrc/server/g_damage.qh b/qcsrc/server/g_damage.qh index e7430690e..6e0f5b579 100644 --- a/qcsrc/server/g_damage.qh +++ b/qcsrc/server/g_damage.qh @@ -4,8 +4,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "../warpzonelib/common.qh" #include "../common/constants.qh" #include "../common/teams.qh" diff --git a/qcsrc/server/g_models.qc b/qcsrc/server/g_models.qc index 781ecc612..20020261c 100644 --- a/qcsrc/server/g_models.qc +++ b/qcsrc/server/g_models.qc @@ -2,7 +2,12 @@ #include "../common/triggers/subs.qh" -#include "../client/bgmscript.qh" +entityclass(BGMScript); +class(BGMScript) .string bgmscript; +class(BGMScript) .float bgmscriptattack; +class(BGMScript) .float bgmscriptdecay; +class(BGMScript) .float bgmscriptsustain; +class(BGMScript) .float bgmscriptrelease; #include "../common/constants.qh" #include "../csqcmodellib/sv_model.qh" diff --git a/qcsrc/server/ipban.qc b/qcsrc/server/ipban.qc index 5bf648a0b..f185d4aef 100644 --- a/qcsrc/server/ipban.qc +++ b/qcsrc/server/ipban.qc @@ -6,8 +6,6 @@ #include "defs.qh" #include "../common/constants.qh" #include "../common/util.qh" -#include "../dpdefs/dpextensions.qh" -#include "../dpdefs/progsdefs.qh" /* * Protocol of online ban list: diff --git a/qcsrc/server/mutators/mutators.qc b/qcsrc/server/mutators/mutators.qc index 0c6301532..de32a174e 100644 --- a/qcsrc/server/mutators/mutators.qc +++ b/qcsrc/server/mutators/mutators.qc @@ -1,7 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../../dpdefs/progsdefs.qh" #include "mutators_include.qh" #include "../../common/mapinfo.qh" #endif diff --git a/qcsrc/server/mutators/mutators_include.qc b/qcsrc/server/mutators/mutators_include.qc index 8564d34c5..e948ab688 100644 --- a/qcsrc/server/mutators/mutators_include.qc +++ b/qcsrc/server/mutators/mutators_include.qc @@ -1,8 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../../dpdefs/progsdefs.qh" - #include "../../dpdefs/dpextensions.qh" #include "../../warpzonelib/anglestransform.qh" #include "../../warpzonelib/common.qh" #include "../../warpzonelib/util_server.qh" diff --git a/qcsrc/server/pathlib/_all.inc b/qcsrc/server/pathlib/_all.inc new file mode 100644 index 000000000..8622734d0 --- /dev/null +++ b/qcsrc/server/pathlib/_all.inc @@ -0,0 +1,6 @@ +#include "costs.qc" +#include "expandnode.qc" +#include "main.qc" +#include "movenode.qc" +#include "path_waypoint.qc" +#include "utility.qc" diff --git a/qcsrc/server/playerdemo.qc b/qcsrc/server/playerdemo.qc index b21ed2ea3..082356ae2 100644 --- a/qcsrc/server/playerdemo.qc +++ b/qcsrc/server/playerdemo.qc @@ -1,8 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "defs.qh" #include "playerdemo.qh" #endif diff --git a/qcsrc/server/progs.inc b/qcsrc/server/progs.inc index adb8cf632..d8eda4986 100644 --- a/qcsrc/server/progs.inc +++ b/qcsrc/server/progs.inc @@ -1,10 +1,3 @@ -#include "../common/util-pre.qh" -#include "sys-pre.qh" -#include "../dpdefs/progsdefs.qh" -#include "../dpdefs/dpextensions.qh" -#include "sys-post.qh" -#include "../common/util-post.qh" - #include "../lib/_all.inc" #include "anticheat.qc" @@ -45,27 +38,14 @@ #include "t_quake3.qc" #include "t_quake.qc" -#include "bot/aim.qc" -#include "bot/bot.qc" -#include "bot/navigation.qc" -#include "bot/scripting.qc" -#include "bot/waypoints.qc" - -#include "bot/havocbot/havocbot.qc" -#include "bot/havocbot/role_keyhunt.qc" -#include "bot/havocbot/roles.qc" +#include "bot/_all.inc" #include "command/all.qc" #include "mutators/mutators_include.qc" #include "mutators/mutators.qc" -#include "pathlib/costs.qc" -#include "pathlib/expandnode.qc" -#include "pathlib/main.qc" -#include "pathlib/movenode.qc" -#include "pathlib/path_waypoint.qc" -#include "pathlib/utility.qc" +#include "pathlib/_all.inc" #include "weapons/accuracy.qc" #include "weapons/common.qc" diff --git a/qcsrc/server/steerlib.qc b/qcsrc/server/steerlib.qc index fbf84da32..4941b5521 100644 --- a/qcsrc/server/steerlib.qc +++ b/qcsrc/server/steerlib.qc @@ -1,8 +1,6 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #endif /** diff --git a/qcsrc/server/t_items.qh b/qcsrc/server/t_items.qh index dd79b1788..81554c4c2 100644 --- a/qcsrc/server/t_items.qh +++ b/qcsrc/server/t_items.qh @@ -1,47 +1,6 @@ #ifndef T_ITEMS_H #define T_ITEMS_H -// constants -const int IT_UNLIMITED_WEAPON_AMMO = 1; // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup. -const int IT_UNLIMITED_SUPERWEAPONS = 2; // when this bit is set, superweapons don't expire. Checkpoints can give this powerup. -const int IT_CTF_SHIELDED = 4; // set for the flag shield -const int IT_USING_JETPACK = 8; // confirmation that button is pressed -const int IT_JETPACK = 16; // actual item -const int IT_FUEL_REGEN = 32; // fuel regeneration trigger -// where is 64... ? -const int IT_FUEL = 128; -// -Wdouble-declaration -#define IT_SHELLS 256 -// -Wdouble-declaration -#define IT_NAILS 512 -// -Wdouble-declaration -#define IT_ROCKETS 1024 -// -Wdouble-declaration -#define IT_CELLS 2048 -const int IT_SUPERWEAPON = 4096; -const int IT_STRENGTH = 8192; -const int IT_INVINCIBLE = 16384; -const int IT_HEALTH = 32768; -const int IT_PLASMA = 65536; - -// shared value space (union): - // for items: - // -Wdouble-declaration - #define IT_KEY1 131072 - // -Wdouble-declaration - #define IT_KEY2 262144 -// end - -const int IT_5HP = 524288; -const int IT_25HP = 1048576; -const int IT_ARMOR_SHARD = 2097152; -const int IT_ARMOR = 4194304; - -// item masks -const int IT_AMMO = 3968; // IT_FUEL | IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_PLASMA; -const int IT_PICKUPMASK = 51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately -const int IT_UNLIMITED_AMMO = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO; - const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel // item networking diff --git a/qcsrc/test/compilationunit.sh b/qcsrc/test/compilationunit.sh index e4f387861..e31476f52 100755 --- a/qcsrc/test/compilationunit.sh +++ b/qcsrc/test/compilationunit.sh @@ -4,30 +4,35 @@ cd "$(dirname "$0")" cd .. declare -a NOWARN=( - '-Wno-field-redeclared' - '-Wno-unused-variable' - '-Wno-implicit-function-pointer' + -Wno-field-redeclared + -Wno-unused-variable + -Wno-implicit-function-pointer ) declare -a FEATURES=( - '-DVEHICLES_ENABLED=1' - '-DVEHICLES_USE_ODE=0' + -DVEHICLES_ENABLED=1 + -DVEHICLES_USE_ODE=0 ) declare QCC=../../../gmqcc/gmqcc +declare -a QCC_FLAGS=( + -std=gmqcc + -Wall -Werror + -fftepp -fftepp-predefs -Wcpp + -futf8 + -freturn-assignments + -frelaxed-switch + -O3 +) + function check() { - declare -l base="$1" - declare -la predefs=("${!2}") - find "$base" -type f -name '*.qc' -print0 | sort -z | while IFS= read -r -d '' file; do + declare -l base="${1}" + declare -la predefs=("-D${2}" "lib/_all.inc") + find "$base" -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do echo "$file" - ${QCC} -std=gmqcc -fftepp -fftepp-predefs -Werror -Wall "${NOWARN[@]}" "${FEATURES[@]}" -futf8 -O3 "${predefs[@]}" "$file" >/dev/null + ${QCC} "${QCC_FLAGS[@]}" "${NOWARN[@]}" "${FEATURES[@]}" "${predefs[@]}" "$file" >/dev/null done } -clientdefs=("-DCSQC" "common/util-pre.qh" "dpdefs/csprogsdefs.qh") -check "client" clientdefs[@] - -serverdefs=("-DSVQC" "common/util-pre.qh" "server/sys-pre.qh" "dpdefs/progsdefs.qh" "dpdefs/dpextensions.qh" "server/sys-post.qh" "server/defs.qh" "server/autocvars.qh") -check "server" serverdefs[@] - -menudefs=("-DMENUQC" "common/util-pre.qh" "dpdefs/menudefs.qh") -check "menu" menudefs[@] +check client CSQC +check server SVQC +check menu MENUQC diff --git a/qcsrc/warpzonelib/anglestransform.qc b/qcsrc/warpzonelib/anglestransform.qc index 079ceaa7d..f92947f5b 100644 --- a/qcsrc/warpzonelib/anglestransform.qc +++ b/qcsrc/warpzonelib/anglestransform.qc @@ -1,11 +1,8 @@ #include "anglestransform.qh" #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #endif #ifdef POSITIVE_PITCH_IS_DOWN diff --git a/qcsrc/warpzonelib/client.qc b/qcsrc/warpzonelib/client.qc index 85fbdd933..68c2984db 100644 --- a/qcsrc/warpzonelib/client.qc +++ b/qcsrc/warpzonelib/client.qc @@ -4,7 +4,6 @@ #if defined(CSQC) #include "../client/autocvars.qh" #include "../csqcmodellib/cl_model.qh" - #include "../dpdefs/csprogsdefs.qh" #elif defined(MENUQC) #elif defined(SVQC) #endif diff --git a/qcsrc/warpzonelib/common.qc b/qcsrc/warpzonelib/common.qc index 0eaaac980..044b4d864 100644 --- a/qcsrc/warpzonelib/common.qc +++ b/qcsrc/warpzonelib/common.qc @@ -1,13 +1,10 @@ #include "common.qh" #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" #include "../server/t_items.qh" #elif defined(MENUQC) #elif defined(SVQC) #include "../common/weapons/all.qh" - #include "../dpdefs/dpextensions.qh" - #include "../dpdefs/progsdefs.qh" #endif void WarpZone_Accumulator_Clear(entity acc) diff --git a/qcsrc/warpzonelib/mathlib.qc b/qcsrc/warpzonelib/mathlib.qc index f61712d23..92b7ee14d 100644 --- a/qcsrc/warpzonelib/mathlib.qc +++ b/qcsrc/warpzonelib/mathlib.qc @@ -1,10 +1,7 @@ #include "mathlib.qh" #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/dpextensions.qh" - #include "../dpdefs/progsdefs.qh" #endif int fpclassify(float x) diff --git a/qcsrc/warpzonelib/server.qc b/qcsrc/warpzonelib/server.qc index d34870ec0..033594d2e 100644 --- a/qcsrc/warpzonelib/server.qc +++ b/qcsrc/warpzonelib/server.qc @@ -7,8 +7,6 @@ #include "../common/constants.qh" #include "../common/triggers/subs.qh" #include "../common/util.qh" - #include "../dpdefs/dpextensions.qh" - #include "../dpdefs/progsdefs.qh" #include "../server/command/common.qh" #include "../server/constants.qh" #include "../server/defs.qh" diff --git a/qcsrc/warpzonelib/util_server.qc b/qcsrc/warpzonelib/util_server.qc index 0b983c299..61c063667 100644 --- a/qcsrc/warpzonelib/util_server.qc +++ b/qcsrc/warpzonelib/util_server.qc @@ -6,8 +6,6 @@ #elif defined(MENUQC) #elif defined(SVQC) #include "../csqcmodellib/sv_model.qh" - #include "../dpdefs/dpextensions.qh" - #include "../dpdefs/progsdefs.qh" #endif #include "common.qh" -- 2.39.2