From 4413eca79f9b2e29481b37ba3df488239e8ae938 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 29 Jul 2019 00:16:29 +0200 Subject: [PATCH] Don't spawn by default some useless entities of game modes and mutators --- .../common/gamemodes/gamemode/assault/sv_assault.qc | 10 ---------- .../common/gamemodes/gamemode/assault/sv_assault.qh | 7 +++++++ qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh | 12 ++++++------ .../gamemodes/gamemode/domination/sv_domination.qh | 6 +++--- .../gamemodes/gamemode/invasion/sv_invasion.qc | 10 ---------- .../gamemodes/gamemode/invasion/sv_invasion.qh | 6 ++++++ .../common/gamemodes/gamemode/onslaught/onslaught.qh | 5 ----- .../gamemodes/gamemode/onslaught/sv_onslaught.qh | 2 ++ .../common/mutators/mutator/instagib/sv_instagib.qc | 10 ---------- .../common/mutators/mutator/instagib/sv_instagib.qh | 7 +++++++ qcsrc/common/mutators/mutator/nades/nades.qc | 11 ++++++++--- .../common/mutators/mutator/overkill/sv_overkill.qc | 11 ----------- .../common/mutators/mutator/overkill/sv_overkill.qh | 7 +++++++ qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc | 2 ++ qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh | 3 --- 15 files changed, 48 insertions(+), 61 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc index 835073d07d..a9de7fbc76 100644 --- a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc +++ b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc @@ -3,16 +3,6 @@ .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/common/gamemodes/gamemode/assault/sv_assault.qh b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh index fcfc78917f..3709bdff93 100644 --- a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh +++ b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh @@ -7,11 +7,18 @@ const int ASSAULT_VALUE_INACTIVE = 1000; const int ST_ASSAULT_OBJECTIVES = 1; +IntrusiveList g_assault_destructibles; +IntrusiveList g_assault_objectivedecreasers; +IntrusiveList g_assault_objectives; + REGISTER_MUTATOR(as, false) { MUTATOR_STATIC(); MUTATOR_ONADD { + g_assault_destructibles = IL_NEW(); + g_assault_objectivedecreasers = IL_NEW(); + g_assault_objectives = IL_NEW(); GameRules_teams(true); int teams = BITS(2); // always red vs blue GameRules_scoring(teams, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, { diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh index b1518bd4fc..492da41b14 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh @@ -2,6 +2,11 @@ #include "ctf.qh" +CLASS(Flag, Pickup) + ATTRIB(Flag, m_mins, vector, (PL_MIN_CONST + '0 0 -13') * 1.4); // scaling be damned + ATTRIB(Flag, m_maxs, vector, (PL_MAX_CONST + '0 0 -13') * 1.4); +ENDCLASS(Flag) +Flag CTF_FLAG; void ctf_Initialize(); REGISTER_MUTATOR(ctf, false) @@ -9,6 +14,7 @@ REGISTER_MUTATOR(ctf, false) MUTATOR_STATIC(); MUTATOR_ONADD { + CTF_FLAG = NEW(Flag); GameRules_teams(true); GameRules_limit_score(autocvar_capturelimit_override); GameRules_limit_lead(autocvar_captureleadlimit_override); @@ -24,12 +30,6 @@ void ctf_RespawnFlag(entity flag); // score rule declarations const int ST_CTF_CAPS = 1; -CLASS(Flag, Pickup) - ATTRIB(Flag, m_mins, vector, (PL_MIN_CONST + '0 0 -13') * 1.4); // scaling be damned - ATTRIB(Flag, m_maxs, vector, (PL_MAX_CONST + '0 0 -13') * 1.4); -ENDCLASS(Flag) -Flag CTF_FLAG; -STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); } void ctf_FlagTouch(entity this, entity toucher) { ITEM_HANDLE(Pickup, CTF_FLAG, this, toucher); } // flag constants // for most of these, there is just one question to be asked: WHYYYYY? diff --git a/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qh b/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qh index 67e00082c3..e937a958ed 100644 --- a/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qh +++ b/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qh @@ -6,6 +6,7 @@ bool autocvar_g_domination_roundbased; int autocvar_g_domination_roundbased_point_limit; int autocvar_g_domination_point_leadlimit; +IntrusiveList g_dompoints; void dom_Initialize(); REGISTER_MUTATOR(dom, false) @@ -13,6 +14,8 @@ REGISTER_MUTATOR(dom, false) MUTATOR_STATIC(); MUTATOR_ONADD { + g_dompoints = IL_NEW(); + int fraglimit_override = autocvar_g_domination_point_limit; if (autocvar_g_domination_roundbased && autocvar_g_domination_roundbased_point_limit) fraglimit_override = autocvar_g_domination_roundbased_point_limit; @@ -47,6 +50,3 @@ float domination_roundbased; float domination_teams; void AnimateDomPoint(entity this); - -IntrusiveList g_dompoints; -STATIC_INIT(g_dompoints) { g_dompoints = IL_NEW(); } diff --git a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc index 31c5711424..bb1c9aee94 100644 --- a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc +++ b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc @@ -6,16 +6,6 @@ #include -IntrusiveList g_invasion_roundends; -IntrusiveList g_invasion_waves; -IntrusiveList g_invasion_spawns; -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; float autocvar_g_invasion_warmup; diff --git a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh index 167380eeb2..3c16e34e18 100644 --- a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh +++ b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh @@ -6,6 +6,9 @@ int autocvar_g_invasion_teams; int autocvar_g_invasion_type; bool autocvar_g_invasion_team_spawns; bool g_invasion; +IntrusiveList g_invasion_roundends; +IntrusiveList g_invasion_waves; +IntrusiveList g_invasion_spawns; void invasion_Initialize(); REGISTER_MUTATOR(inv, false) @@ -13,6 +16,9 @@ REGISTER_MUTATOR(inv, false) MUTATOR_STATIC(); MUTATOR_ONADD { + g_invasion_roundends = IL_NEW(); + g_invasion_waves = IL_NEW(); + g_invasion_spawns = IL_NEW(); if (autocvar_g_invasion_teams >= 2) { GameRules_teams(true); GameRules_spawning_teams(autocvar_g_invasion_team_spawns); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh index add678d7b3..4ee4534001 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh @@ -5,11 +5,6 @@ REGISTER_NET_LINKED(ENT_CLIENT_GENERATOR) REGISTER_NET_LINKED(ENT_CLIENT_CONTROLPOINT_ICON) #endif -#ifdef SVQC -IntrusiveList g_onsshields; -STATIC_INIT(g_onsshields) { g_onsshields = IL_NEW(); } -#endif - #ifdef CSQC IntrusiveList g_onsgenerators; STATIC_INIT(g_onsgenerators) { g_onsgenerators = IL_NEW(); } diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh index 7a9b192a5a..52eec4abcc 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh @@ -1,6 +1,7 @@ #pragma once float autocvar_g_onslaught_point_limit; +IntrusiveList g_onsshields; void ons_Initialize(); REGISTER_MUTATOR(ons, false) @@ -8,6 +9,7 @@ REGISTER_MUTATOR(ons, false) MUTATOR_STATIC(); MUTATOR_ONADD { + g_onsshields = IL_NEW(); GameRules_teams(true); GameRules_limit_score(autocvar_g_onslaught_point_limit); diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 63f3182ea6..a9eac24232 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -17,16 +17,6 @@ bool autocvar_g_instagib_ammo_convert_bullets; int autocvar_g_instagib_extralives; float autocvar_g_instagib_speed_highspeed; -IntrusiveList g_instagib_items; -STATIC_INIT(instagib) -{ - g_instagib_items = IL_NEW(); - IL_PUSH(g_instagib_items, ITEM_VaporizerCells); - IL_PUSH(g_instagib_items, ITEM_ExtraLife); - IL_PUSH(g_instagib_items, ITEM_Invisibility); - IL_PUSH(g_instagib_items, ITEM_Speed); -} - void instagib_invisibility(entity this) { this.strength_finished = autocvar_g_instagib_invisibility_time; diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh index 56f4ac7daa..d01abd080e 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh @@ -7,11 +7,18 @@ float autocvar_g_instagib_invis_alpha; void instagib_invisibility(entity this); void instagib_extralife(entity this); void instagib_speed(entity this); +IntrusiveList g_instagib_items; REGISTER_MUTATOR(mutator_instagib, autocvar_g_instagib && !g_nexball) { MUTATOR_ONADD { + g_instagib_items = IL_NEW(); + IL_PUSH(g_instagib_items, ITEM_VaporizerCells); + IL_PUSH(g_instagib_items, ITEM_ExtraLife); + IL_PUSH(g_instagib_items, ITEM_Invisibility); + IL_PUSH(g_instagib_items, ITEM_Speed); + ITEM_VaporizerCells.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED; ITEM_Invisibility.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED; ITEM_Speed.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED; diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index c6a853d0e1..6418f2a01a 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -159,8 +159,6 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan #include #include -REGISTER_MUTATOR(nades, autocvar_g_nades); - .float nade_time_primed; .float nade_lifetime; @@ -1251,7 +1249,14 @@ CLASS(NadeOffhand, OffhandWeapon) } ENDCLASS(NadeOffhand) NadeOffhand OFFHAND_NADE; -STATIC_INIT(OFFHAND_NADE) { OFFHAND_NADE = NEW(NadeOffhand); } +REGISTER_MUTATOR(nades, autocvar_g_nades) +{ + MUTATOR_ONADD + { + OFFHAND_NADE = NEW(NadeOffhand); + } + return 0; +} MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST) { diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index 41ba2da62b..993afcdd4d 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@ -10,17 +10,6 @@ bool autocvar_g_overkill_itemwaypoints = true; .Weapon ok_lastwep[MAX_WEAPONSLOTS]; -IntrusiveList g_overkill_items; -STATIC_INIT(overkill) -{ - g_overkill_items = IL_NEW(); - IL_PUSH(g_overkill_items, ITEM_HealthMega); - IL_PUSH(g_overkill_items, ITEM_ArmorSmall); - IL_PUSH(g_overkill_items, ITEM_ArmorMedium); - IL_PUSH(g_overkill_items, ITEM_ArmorBig); - IL_PUSH(g_overkill_items, ITEM_ArmorMega); -} - /// \brief Returns a random classname of the overkill item. /// \param[in] prefix Prefix of the cvars that hold probabilities. /// \return Random classname of the overkill item. diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh index 79e5dd3c5b..9ee809df65 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh @@ -7,6 +7,7 @@ bool autocvar_g_overkill_filter_armorbig; bool autocvar_g_overkill_filter_armormega; .float ok_item; +IntrusiveList g_overkill_items; REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !MUTATOR_IS_ENABLED(mutator_instagib) && !g_nexball && cvar_string("g_mod_balance") == "Overkill") { @@ -30,6 +31,12 @@ REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !MUTATOR_IS_ENABLED(m { ITEM_ArmorMega.spawnflags |= ITEM_FLAG_MUTATORBLOCKED; } + g_overkill_items = IL_NEW(); + IL_PUSH(g_overkill_items, ITEM_HealthMega); + IL_PUSH(g_overkill_items, ITEM_ArmorSmall); + IL_PUSH(g_overkill_items, ITEM_ArmorMedium); + IL_PUSH(g_overkill_items, ITEM_ArmorBig); + IL_PUSH(g_overkill_items, ITEM_ArmorMega); } MUTATOR_ONREMOVE diff --git a/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc index 9458189fd0..35f58e89a6 100644 --- a/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc +++ b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc @@ -16,6 +16,7 @@ float autocvar_g_sandbox_object_scale_max; float autocvar_g_sandbox_object_material_velocity_min; float autocvar_g_sandbox_object_material_velocity_factor; +IntrusiveList g_sandbox_objects; float autosave_time; void sandbox_Database_Load(); @@ -23,6 +24,7 @@ REGISTER_MUTATOR(sandbox, expr_evaluate(autocvar_g_sandbox)) { MUTATOR_ONADD { + g_sandbox_objects = IL_NEW(); autosave_time = time + autocvar_g_sandbox_storage_autosave; // don't save the first server frame if(autocvar_g_sandbox_storage_autoload) sandbox_Database_Load(); diff --git a/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh index f6a0afdf40..6f70f09bee 100644 --- a/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh +++ b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh @@ -1,4 +1 @@ #pragma once - -IntrusiveList g_sandbox_objects; -STATIC_INIT(g_sandbox_objects) { g_sandbox_objects = IL_NEW(); } -- 2.39.2