REGISTRY(Items, BITS(7))
#define Items_from(i) _Items_from(i, NULL)
+#ifdef GAMEQC
+REGISTRY_DEPENDS(Items, Models)
+#endif
REGISTER_REGISTRY(Items)
#define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class))
#include "all.qh"
#ifdef SVQC
+#include <server/utils.qh>
+
bool autocvar_bot_sound_monopoly;
.entity realowner;
#pragma once
#ifdef SVQC
+#include <server/autocvars.qh>
#include <server/client.qh>
#endif
#pragma once
+#ifdef SVQC
+#include <server/defs.qh>
+#endif
+
const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel
// item networking
#pragma once
+#include <server/miscfunctions.qh>
+
entity turret_projectile(entity actor, Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
void turret_projectile_explode(entity this);
float turret_validate_target(entity e_turret, entity e_target, float validate_flags);
*/
#define REGISTRY(id, max) \
void Register##id(); \
+ [[accumulate]] void REGISTRY_DEPENDS_(id) {} \
[[accumulate]] REGISTRY_BEGIN(id) {} \
[[accumulate]] REGISTRY_END(id) {} \
void _Register##id() {} \
- void Register##id() { REGISTRY_BEGIN_(id); _Register##id(); REGISTRY_END_(id); } \
+ int id##_state = 0; \
+ void Register##id() { if (id##_state) return; id##_state = 1; REGISTRY_DEPENDS_(id); REGISTRY_BEGIN_(id); _Register##id(); id##_state = 2; REGISTRY_END_(id); } \
const int id##_MAX = max; \
int id##_COUNT; \
noref entity id##_first, id##_last; \
SHUTDOWN(id) { _R_DEL(_##id); } \
entity _##id##_from(int i, entity null) { if (i >= 0 && i < id##_COUNT) { entity e = _R_GET(_##id, i); if (e) return e; } return null; }
+/** Add registry dependencies to a registry */
+#define REGISTRY_DEPENDS(id, dep) void Register##dep(); void REGISTRY_DEPENDS_(id) { Register##dep(); }
+#define REGISTRY_DEPENDS_(id) Register##id##_Depends()
+
/** Called before initializing a registry. */
#define REGISTRY_BEGIN(id) [[accumulate]] void REGISTRY_BEGIN_(id) { noref void() f = Register##id; } void REGISTRY_BEGIN_(id)
#define REGISTRY_BEGIN_(id) Register##id##_First()
ENDCLASS(id##Registry) \
REGISTER(Registries, REGISTRY, id, m_id, NEW(id##Registry)); \
METHOD(id##Registry, m_reload, void()) { \
+ id##_state = 0; \
Register##id(); \
}
+++ /dev/null
-#include <server/_all.qh>
-#include "_mod.inc"
-
-#include "bot/_mod.inc"
-#include "command/_mod.inc"
-#include "compat/_mod.inc"
-#include "mutators/_mod.inc"
-#include "pathlib/_mod.inc"
-#include "weapons/_mod.inc"
-
-#include <common/_all.inc>
-#include <common/effects/qc/all.qc>
-
-#include <lib/csqcmodel/sv_model.qc>
-
-#include <lib/warpzone/anglestransform.qc>
-#include <lib/warpzone/common.qc>
-#include <lib/warpzone/server.qc>
-#include <lib/warpzone/util_server.qc>
+++ /dev/null
-#pragma once
-
-int maxclients;
-
-const string STR_PLAYER = "player";
-const string STR_SPECTATOR = "spectator";
-const string STR_OBSERVER = "observer";
-
-#define IS_PLAYER(v) ((v).classname == STR_PLAYER)
-#define IS_SPEC(v) ((v).classname == STR_SPECTATOR)
-#define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
-
-#define IS_CLIENT(v) (v.flags & FL_CLIENT)
-/** want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v)) */
-#define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
-#define IS_FAKE_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
-#define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
-/** was: (clienttype(v) == CLIENTTYPE_NOTACLIENT) */
-#define IS_NOT_A_CLIENT(v) (!IS_CLIENT(v))
-
-#define IS_MONSTER(v) (v.flags & FL_MONSTER)
-#define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
-#define IS_TURRET(v) (v.turret_flags & TUR_FLAG_ISTURRET)
-
-// NOTE: FOR_EACH_CLIENTSLOT deprecated! Use the following instead: FOREACH_CLIENTSLOT(true, { code; });
-// NOTE: FOR_EACH_CLIENT deprecated! Use the following instead: FOREACH_CLIENT(true, { code; });
-// NOTE: FOR_EACH_REALCLIENT deprecated! Use the following instead: FOREACH_CLIENT(IS_REAL_CLIENT(it), { code; });
-
-// NOTE: FOR_EACH_PLAYER deprecated! Use the following instead: FOREACH_CLIENT(IS_PLAYER(it), { code; });
-// NOTE: FOR_EACH_SPEC deprecated! Use the following instead: FOREACH_CLIENT(IS_SPEC(it), { code; });
-// NOTE: FOR_EACH_OBSERVER deprecated! Use the following instead: FOREACH_CLIENT(IS_OBSERVER(it), { code; });
-// NOTE: FOR_EACH_REALPLAYER deprecated! Use the following instead: FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { code; });
-
-#define FOREACH_CLIENTSLOT(cond, body) \
- MACRO_BEGIN { \
- for(int _i = 1; _i <= maxclients; ++_i) \
- { \
- const noref int i = _i; \
- ITER_CONST noref entity it = ftoe(i); \
- if(cond) { LAMBDA(body) } \
- } \
- } MACRO_END
-
-#define FOREACH_CLIENT(cond, body) FOREACH_CLIENTSLOT(IS_CLIENT(it) && (cond), body)
-
-// using the "inside out" version of knuth-fisher-yates shuffle
-// https://en.wikipedia.org/wiki/Fisher–Yates_shuffle
-entity _FCR_clients[255];
-bool _FCR_entered = false;
-#define FOREACH_CLIENT_RANDOM(cond, body) \
- MACRO_BEGIN { \
- if (_FCR_entered) LOG_FATAL("FOREACH_CLIENT_RANDOM must not be nested"); \
- _FCR_entered = true; \
- int _cnt = 0; \
- FOREACH_CLIENT(cond, { \
- int _j = floor(random() * (_cnt + 1)); \
- if (_j == _cnt) \
- { \
- _FCR_clients[_cnt] = it; \
- } \
- else \
- { \
- _FCR_clients[_cnt] = _FCR_clients[_j]; \
- _FCR_clients[_j] = it; \
- } \
- _cnt++; \
- }); \
- for (int _i = 0; _i < _cnt; ++_i) \
- { \
- const noref int i = _i; \
- ITER_CONST noref entity it = _FCR_clients[i]; \
- if (cond) { LAMBDA(body) } \
- } \
- _FCR_entered = false; \
- } MACRO_END
-
-// NOTE: FOR_EACH_MONSTER deprecated! Use the following instead: IL_EACH(g_monsters, true, { code; });
-
-#include <common/effects/all.qh>
-#include <common/models/all.qh>
-#include <common/sounds/all.qh>
-
-#include "autocvars.qh"
-#include "constants.qh"
-#include "defs.qh"
-#include "miscfunctions.qh"
#endif
#include <server/teamplay.qc>
#include <server/tests.qc>
+
+#include <server/bot/_mod.inc>
+#include <server/command/_mod.inc>
+#include <server/compat/_mod.inc>
+#include <server/mutators/_mod.inc>
+#include <server/pathlib/_mod.inc>
+#include <server/weapons/_mod.inc>
#endif
#include <server/teamplay.qh>
#include <server/tests.qh>
+
+#include <server/bot/_mod.qh>
+#include <server/command/_mod.qh>
+#include <server/compat/_mod.qh>
+#include <server/mutators/_mod.qh>
+#include <server/pathlib/_mod.qh>
+#include <server/weapons/_mod.qh>
#if defined(CSQC)
#elif defined(MENUQC)
#elif defined(SVQC)
+ #include <server/defs.qh>
#include <common/state.qh>
#include <common/vehicles/all.qh>
#include "antilag.qh"
#pragma once
+#include <server/defs.qh>
#include <common/weapons/_all.qh>
const int WAYPOINTFLAG_GENERATED = BIT(23);
#include "aim.qh"
+#include <server/defs.qh>
+
#include "cvars.qh"
#include "bot.qh"
#include "havocbot.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "../cvars.qh"
#include "../aim.qh"
#include "roles.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "havocbot.qh"
#include "../cvars.qh"
#include "navigation.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "cvars.qh"
#include "bot.qh"
#include "scripting.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "cvars.qh"
#include <common/state.qh>
#include "waypoints.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "cvars.qh"
#include "bot.qh"
#include "campaign.qh"
+
+#include "defs.qh"
+
#include "cheats.qh"
#include "miscfunctions.qh"
#include "g_world.qh"
#include "cheats.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
+
#include "g_damage.qh"
#include "race.qh"
#include "../common/triggers/teleporters.qh"
#include "client.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
#include "anticheat.qh"
#include "impulse.qh"
#include "player.qh"
#pragma once
+#include "utils.qh"
+#include <common/sounds/all.qh>
+
void ClientState_attach(entity this);
IntrusiveList g_players;
#include "banning.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include <common/state.qh>
#include <common/command/_mod.qh>
#include "banning.qh"
#include "cmd.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
#include <common/command/_mod.qh>
#include "common.qh"
#include "common.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
#include <common/command/_mod.qh>
#include "common.qh"
#include "getreplies.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
#include <common/command/_mod.qh>
#include "getreplies.qh"
#include "sv_cmd.qh"
#include "_mod.qh"
+#include <common/effects/all.qh>
+
#include "banning.qh"
#include "cmd.qh"
#include "common.qh"
#include "vote.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
#include <common/command/_mod.qh>
#include "vote.qh"
#include "quake.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include <common/weapons/_all.qh>
spawnfunc(weapon_electro);
#include "quake3.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include <common/weapons/_all.qh>
spawnfunc(weapon_crylink);
#include "wop.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include <common/weapons/_all.qh>
// #include <server/mutators/gamemode.qh>
#include "g_damage.qh"
+#include <common/effects/all.qh>
#include "bot/api.qh"
#include "g_hook.qh"
#include "mutators/_mod.qh"
#if defined(CSQC)
#elif defined(MENUQC)
#elif defined(SVQC)
+ #include <server/defs.qh>
+ #include <server/miscfunctions.qh>
#include <lib/warpzone/common.qh>
#include <common/constants.qh>
#include <common/teams.qh>
#include "g_hook.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
#include "weapons/common.qh"
#include "weapons/csqcprojectile.qh"
#include "weapons/weaponsystem.qh"
#include "g_lights.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
void train_next(entity this);
const float LOOP = 1;
#include "g_models.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "g_subs.qh"
#include <common/net_linked.qh>
#include "../common/triggers/subs.qh"
#include "g_subs.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "antilag.qh"
#include "command/common.qh"
#include "../common/state.qh"
#include "ipban.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "autocvars.qh"
#include "command/banning.qh"
#include "defs.qh"
#include "mapvoting.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "g_world.qh"
#include "command/cmd.qh"
#include "command/getreplies.qh"
#include "miscfunctions.qh"
+
#include "antilag.qh"
#include "command/common.qh"
#include "constants.qh"
#pragma once
+#include <server/defs.qh>
+
#include <common/t_items.qh>
#include "mutators/events.qh"
#pragma once
+#include <server/miscfunctions.qh>
#include <server/g_world.qh>
#include <server/round_handler.qh>
#include <server/scores.qh>
#include "loader.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
STATIC_INIT_LATE(Gametype) {
Gametype g = MapInfo_CurrentGametype();
if (g) {
#include "gamemode_ctf.qh"
#ifndef CSQC
+#include <common/effects/all.qh>
void ctf_Initialize();
REGISTER_MUTATOR(ctf, false)
#include "gamemode_keepaway.qh"
+#include <common/effects/all.qh>
+
int autocvar_g_keepaway_ballcarrier_effects;
float autocvar_g_keepaway_ballcarrier_damage;
float autocvar_g_keepaway_ballcarrier_force;
#include "main.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "pathlib.qh"
#include "utility.qh"
#include "../command/common.qh"
#include "movenode.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "pathlib.qh"
#include "utility.qh"
#include "utility.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "pathlib.qh"
bool location_isok(vector point, bool waterok, bool air_isok)
#include "player.qh"
+#include <common/effects/all.qh>
#include "bot/api.qh"
#include "cheats.qh"
#include "g_damage.qh"
#include "portals.qh"
+#include <common/effects/all.qh>
#include "g_hook.qh"
#include "mutators/_mod.qh"
#include "../common/constants.qh"
#include <lib/_all.inc>
#if XONOTIC
-#include <server/_all.inc>
+
+#include <server/_mod.inc>
+
+#include <common/_all.inc>
+#include <common/effects/qc/all.qc>
+
+#include <lib/csqcmodel/sv_model.qc>
+
+#include <lib/warpzone/anglestransform.qc>
+#include <lib/warpzone/common.qc>
+#include <lib/warpzone/server.qc>
+#include <lib/warpzone/util_server.qc>
#include <ecs/_mod.inc>
#endif
#include "race.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "client.qh"
#include "portals.qh"
#include "scores.qh"
#include "round_handler.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "campaign.qh"
#include "command/vote.qh"
#include "../common/util.qh"
#include "scores_rules.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "client.qh"
#include "scores.qh"
#pragma once
+#include "defs.qh"
+#include "miscfunctions.qh"
#include "autocvars.qh"
#include "client.qh"
#include "command/_mod.qh"
--- /dev/null
+#pragma once
+
+int maxclients;
+
+const string STR_PLAYER = "player";
+const string STR_SPECTATOR = "spectator";
+const string STR_OBSERVER = "observer";
+
+#define IS_PLAYER(v) ((v).classname == STR_PLAYER)
+#define IS_SPEC(v) ((v).classname == STR_SPECTATOR)
+#define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
+
+#define IS_CLIENT(v) (v.flags & FL_CLIENT)
+/** want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v)) */
+#define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
+#define IS_FAKE_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
+#define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
+/** was: (clienttype(v) == CLIENTTYPE_NOTACLIENT) */
+#define IS_NOT_A_CLIENT(v) (!IS_CLIENT(v))
+
+#define IS_MONSTER(v) (v.flags & FL_MONSTER)
+#define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
+#define IS_TURRET(v) (v.turret_flags & TUR_FLAG_ISTURRET)
+
+// NOTE: FOR_EACH_CLIENTSLOT deprecated! Use the following instead: FOREACH_CLIENTSLOT(true, { code; });
+// NOTE: FOR_EACH_CLIENT deprecated! Use the following instead: FOREACH_CLIENT(true, { code; });
+// NOTE: FOR_EACH_REALCLIENT deprecated! Use the following instead: FOREACH_CLIENT(IS_REAL_CLIENT(it), { code; });
+
+// NOTE: FOR_EACH_PLAYER deprecated! Use the following instead: FOREACH_CLIENT(IS_PLAYER(it), { code; });
+// NOTE: FOR_EACH_SPEC deprecated! Use the following instead: FOREACH_CLIENT(IS_SPEC(it), { code; });
+// NOTE: FOR_EACH_OBSERVER deprecated! Use the following instead: FOREACH_CLIENT(IS_OBSERVER(it), { code; });
+// NOTE: FOR_EACH_REALPLAYER deprecated! Use the following instead: FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { code; });
+
+#define FOREACH_CLIENTSLOT(cond, body) \
+ MACRO_BEGIN { \
+ for(int _i = 1; _i <= maxclients; ++_i) \
+ { \
+ const noref int i = _i; \
+ ITER_CONST noref entity it = ftoe(i); \
+ if(cond) { LAMBDA(body) } \
+ } \
+ } MACRO_END
+
+#define FOREACH_CLIENT(cond, body) FOREACH_CLIENTSLOT(IS_CLIENT(it) && (cond), body)
+
+// using the "inside out" version of knuth-fisher-yates shuffle
+// https://en.wikipedia.org/wiki/Fisher–Yates_shuffle
+entity _FCR_clients[255];
+bool _FCR_entered = false;
+#define FOREACH_CLIENT_RANDOM(cond, body) \
+ MACRO_BEGIN { \
+ if (_FCR_entered) LOG_FATAL("FOREACH_CLIENT_RANDOM must not be nested"); \
+ _FCR_entered = true; \
+ int _cnt = 0; \
+ FOREACH_CLIENT(cond, { \
+ int _j = floor(random() * (_cnt + 1)); \
+ if (_j == _cnt) \
+ { \
+ _FCR_clients[_cnt] = it; \
+ } \
+ else \
+ { \
+ _FCR_clients[_cnt] = _FCR_clients[_j]; \
+ _FCR_clients[_j] = it; \
+ } \
+ _cnt++; \
+ }); \
+ for (int _i = 0; _i < _cnt; ++_i) \
+ { \
+ const noref int i = _i; \
+ ITER_CONST noref entity it = _FCR_clients[i]; \
+ if (cond) { LAMBDA(body) } \
+ } \
+ _FCR_entered = false; \
+ } MACRO_END
+
+// NOTE: FOR_EACH_MONSTER deprecated! Use the following instead: IL_EACH(g_monsters, true, { code; });
#pragma once
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
.bool cvar_cl_accuracy_data_share;
REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share");
.bool cvar_cl_accuracy_data_receive;
#include "common.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include <common/t_items.qh>
#include <common/constants.qh>
#include <common/net_linked.qh>
#include "csqcprojectile.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include <common/t_items.qh>
#include "../command/common.qh"
#include "hitplot.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "../antilag.qh"
#include "../g_subs.qh"
#include <common/weapons/_all.qh>
#pragma once
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
// switch between weapons
void Send_WeaponComplain(entity e, float wpn, float type);
#pragma once
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
string W_Apply_Weaponreplace(string in);
void weapon_defaultspawnfunc(entity this, Weapon e);
#pragma once
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
.float savenextthink;
void thrown_wep_think(entity this);
#include "tracing.qh"
+#include <common/effects/all.qh>
+
#include "accuracy.qh"
#include "common.qh"
#include "hitplot.qh"
#pragma once
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
vector w_shotorg;
vector w_shotdir;
vector w_shotend;
#include "weaponstats.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "../g_world.qh"
#include <common/weapons/_all.qh>
#pragma once
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
float internalteam;
float weaponswapping;
entity weapon_dropevent_item;