From 67440b9e66fc88ee9d30a3781a86f21acbd23293 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 19 Mar 2018 16:45:26 +0100 Subject: [PATCH] Group some STATIC_INIT functions --- qcsrc/common/notifications/all.qh | 3 +- qcsrc/common/physics/player.qh | 23 ++----- qcsrc/server/defs.qh | 68 ++++++------------- .../mutators/mutator/gamemode_assault.qc | 10 +++ .../mutators/mutator/gamemode_invasion.qc | 11 +-- 5 files changed, 47 insertions(+), 68 deletions(-) diff --git a/qcsrc/common/notifications/all.qh b/qcsrc/common/notifications/all.qh index 1721303ab..12bd3b683 100644 --- a/qcsrc/common/notifications/all.qh +++ b/qcsrc/common/notifications/all.qh @@ -676,7 +676,8 @@ string notif_arg_spree_inf(float type, string input, string player, float spree) REGISTRY(Notifications, BITS(11)) REGISTER_REGISTRY(Notifications) -REGISTRY_SORT(Notifications); STATIC_INIT(Notifications) { FOREACH(Notifications, true, it.m_id = i); } +REGISTRY_SORT(Notifications); +STATIC_INIT(Notifications) { FOREACH(Notifications, true, it.m_id = i); } REGISTRY_CHECK(Notifications) const int NOTIF_CHOICE_MAX = 50; diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index 4b2ffc55f..02a0126ad 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -101,15 +101,6 @@ bool IsFlying(entity a); #define PHYS_INPUT_BUTTON_ZOOM(s) PHYS_INPUT_BUTTON_BUTTON4(s) #define PHYS_INPUT_BUTTON_CROUCH(s) PHYS_INPUT_BUTTON_BUTTON5(s) #define PHYS_INPUT_BUTTON_HOOK(s) PHYS_INPUT_BUTTON_BUTTON6(s) - -#ifdef CSQC -STATIC_INIT(PHYS_INPUT_BUTTON_HOOK) -{ - localcmd("alias +hook +button6\n"); - localcmd("alias -hook -button6\n"); -} -#endif - #define PHYS_INPUT_BUTTON_INFO(s) PHYS_INPUT_BUTTON_BUTTON7(s) #define PHYS_INPUT_BUTTON_DRAG(s) PHYS_INPUT_BUTTON_BUTTON8(s) #define PHYS_INPUT_BUTTON_USE(s) PHYS_INPUT_BUTTON_BUTTON_USE(s) @@ -120,16 +111,16 @@ STATIC_INIT(PHYS_INPUT_BUTTON_HOOK) #define PHYS_INPUT_BUTTON_DODGE(s) PHYS_INPUT_BUTTON_BUTTON11(s) #ifdef CSQC -STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK) +STATIC_INIT(PHYS_INPUT_BUTTON) { + localcmd("alias +hook +button6\n"); + localcmd("alias -hook -button6\n"); + localcmd("alias +jetpack +button10\n"); - localcmd("alias -jetpack -button10\n"); -} + localcmd("alias -jetpack -button10\n"); -STATIC_INIT(PHYS_INPUT_BUTTON_DODGE) -{ - localcmd("alias +dodge +button11\n"); - localcmd("alias -dodge -button11\n"); + localcmd("alias +dodge +button11\n"); + localcmd("alias -dodge -button11\n"); } #endif diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 4b600e3fc..61770f01a 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -408,67 +408,43 @@ const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI; .WepSet dual_weapons; IntrusiveList g_monsters; -STATIC_INIT(g_monsters) { g_monsters = IL_NEW(); } - IntrusiveList g_waypoints; -STATIC_INIT(g_waypoints) { g_waypoints = IL_NEW(); } - IntrusiveList g_vehicles; -STATIC_INIT(g_vehicles) { g_vehicles = IL_NEW(); } - IntrusiveList g_turrets; -STATIC_INIT(g_turrets) { g_turrets = IL_NEW(); } - IntrusiveList g_mines; -STATIC_INIT(g_mines) { g_mines = IL_NEW(); } - IntrusiveList g_projectiles; -STATIC_INIT(g_projectiles) { g_projectiles = IL_NEW(); } - IntrusiveList g_items; -STATIC_INIT(g_items) { g_items = IL_NEW(); } - IntrusiveList g_initforplayer; -STATIC_INIT(g_initforplayer) { g_initforplayer = IL_NEW(); } - IntrusiveList g_clones; -STATIC_INIT(g_clones) { g_clones = IL_NEW(); } - -IntrusiveList g_assault_destructibles; -STATIC_INIT(g_assault_destructibles) { g_assault_destructibles = IL_NEW(); } - -IntrusiveList g_assault_objectivedecreasers; -STATIC_INIT(g_assault_objectivedecreasers) { g_assault_objectivedecreasers = IL_NEW(); } - -IntrusiveList g_assault_objectives; -STATIC_INIT(g_assault_objectives) { g_assault_objectives = IL_NEW(); } - IntrusiveList g_spawnpoints; -STATIC_INIT(g_spawnpoints) { g_spawnpoints = IL_NEW(); } - IntrusiveList g_bot_targets; -STATIC_INIT(g_bot_targets) { g_bot_targets = IL_NEW(); } - IntrusiveList g_bot_dodge; -STATIC_INIT(g_bot_dodge) { g_bot_dodge = IL_NEW(); } - IntrusiveList g_damagedbycontents; -STATIC_INIT(g_damagedbycontents) { g_damagedbycontents = IL_NEW(); } - IntrusiveList g_railgunhit; -STATIC_INIT(g_railgunhit) { g_railgunhit = IL_NEW(); } - IntrusiveList g_ladders; -STATIC_INIT(g_ladders) { g_ladders = IL_NEW(); } - IntrusiveList g_locations; -STATIC_INIT(g_locations) { g_locations = IL_NEW(); } - IntrusiveList g_saved_team; -STATIC_INIT(g_saved_team) { g_saved_team = IL_NEW(); } - IntrusiveList g_monster_targets; -STATIC_INIT(g_monster_targets) { g_monster_targets = IL_NEW(); } - IntrusiveList g_pathlib_nodes; -STATIC_INIT(g_pathlib_nodes) { g_pathlib_nodes = IL_NEW(); } +STATIC_INIT(defs) +{ + g_monsters = IL_NEW(); + g_waypoints = IL_NEW(); + g_vehicles = IL_NEW(); + g_turrets = IL_NEW(); + g_mines = IL_NEW(); + g_projectiles = IL_NEW(); + g_items = IL_NEW(); + g_initforplayer = IL_NEW(); + g_clones = IL_NEW(); + g_spawnpoints = IL_NEW(); + g_bot_targets = IL_NEW(); + g_bot_dodge = IL_NEW(); + g_damagedbycontents = IL_NEW(); + g_railgunhit = IL_NEW(); + g_ladders = IL_NEW(); + g_locations = IL_NEW(); + g_saved_team = IL_NEW(); + g_monster_targets = IL_NEW(); + g_pathlib_nodes = IL_NEW(); +} diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qc b/qcsrc/server/mutators/mutator/gamemode_assault.qc index 70e266918..d43dc9999 100644 --- a/qcsrc/server/mutators/mutator/gamemode_assault.qc +++ b/qcsrc/server/mutators/mutator/gamemode_assault.qc @@ -5,6 +5,16 @@ .entity sprite; #define AS_ROUND_DELAY 5 +IntrusiveList g_assault_destructibles; +IntrusiveList g_assault_objectivedecreasers; +IntrusiveList g_assault_objectives; +STATIC_INIT(g_assault) +{ + g_assault_destructibles = IL_NEW(); + g_assault_objectivedecreasers = IL_NEW(); + g_assault_objectives = IL_NEW(); +} + // random functions void assault_objective_use(entity this, entity actor, entity trigger) { diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index 1b8b77ae0..777b1b1e9 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -6,13 +6,14 @@ #include IntrusiveList g_invasion_roundends; -STATIC_INIT(g_invasion_roundends) { g_invasion_roundends = IL_NEW(); } - IntrusiveList g_invasion_waves; -STATIC_INIT(g_invasion_waves) { g_invasion_waves = IL_NEW(); } - IntrusiveList g_invasion_spawns; -STATIC_INIT(g_invasion_spawns) { g_invasion_spawns = IL_NEW(); } +STATIC_INIT(g_invasion) +{ + g_invasion_roundends = IL_NEW(); + g_invasion_waves = IL_NEW(); + g_invasion_spawns = IL_NEW(); +} float autocvar_g_invasion_round_timelimit; float autocvar_g_invasion_spawnpoint_spawn_delay; -- 2.39.2