]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/less_entities
authorterencehill <piuntn@gmail.com>
Wed, 10 Mar 2021 22:52:25 +0000 (23:52 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 10 Mar 2021 22:52:25 +0000 (23:52 +0100)
19 files changed:
qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc
qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh
qcsrc/common/gamemodes/gamemode/domination/sv_domination.qh
qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc
qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh
qcsrc/common/gamemodes/sv_rules.qc
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/common/mutators/mutator/instagib/sv_instagib.qh
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/mutators/mutator/overkill/sv_overkill.qh
qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc
qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh
qcsrc/common/sounds/all.inc
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh

index 477cfb0d0a873bf6ccc50c66303b2877f3ef4c6c..f5683051c4694151c9923d4e738cbacbacfd0006 100644 (file)
 .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)
 {
index fcfc78917f8239f64f2d72c3eee62ee5ed8511a3..3709bdff9386541b042fd1693249e59b521e3ca6 100644 (file)
@@ -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, {
index 58954905c2106af96bccee9c7c201724e1f846f9..5c55350cb397fc32b36a402b4c43cc8e6e9d43c8 100644 (file)
@@ -1,11 +1,15 @@
 #pragma once
 
 #include "ctf.qh"
-
 #include <common/items/item/pickup.qh>
 #include <common/mutators/base.qh>
 #include <common/gamemodes/sv_rules.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();
 
 int autocvar_captureleadlimit_override;
@@ -16,6 +20,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);
@@ -31,12 +36,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?
index 67e00082c3d9c4f530819de9bce682ab83b810d1..e937a958edfc6d657fc1e0bf68aa06ec80ba730c 100644 (file)
@@ -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(); }
index 993eb936f4a0622d5fe7019dfda644484b33c201..1d872bb7fe49afee17410713e72802873d6f64f2 100644 (file)
@@ -9,16 +9,6 @@
 #include <server/world.qh>
 #include <server/teamplay.qh>
 
-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;
index 167380eeb2a73a947c38ffbf3267b2d984d66f62..3c16e34e18dea1b1179760cadb65aea08c3a0ce9 100644 (file)
@@ -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);
index 0c375494bca1ea501f5fa1d51383fc0a32cee30a..3e7dece709b3b2e35bb665c34360bfa3bc0327a0 100644 (file)
@@ -26,11 +26,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(); }
index 363c0e39f885ee6eefbfd645a91b189f96e90414..d472dd99956600fcd64202812a06b1fb2a3bfac4 100644 (file)
@@ -3,6 +3,7 @@
 #include <common/mutators/base.qh>
 
 float autocvar_g_onslaught_point_limit;
+IntrusiveList g_onsshields;
 void ons_Initialize();
 
 REGISTER_MUTATOR(ons, false)
@@ -10,6 +11,7 @@ REGISTER_MUTATOR(ons, false)
     MUTATOR_STATIC();
        MUTATOR_ONADD
        {
+               g_onsshields = IL_NEW();
                GameRules_teams(true);
                GameRules_limit_score(autocvar_g_onslaught_point_limit);
 
index c6048b808a21510bccf0f438a4f4afa3cbb618a3..898ef3a4f581f0811828192b313495db0c8423e4 100644 (file)
@@ -9,6 +9,7 @@ void GameRules_teams(bool value)
         serverflags |= SERVERFLAG_TEAMPLAY;
         teamplay = 1;
         cvar_set("teamplay", "2");  // DP needs this for sending proper getstatus replies.
+        Team_InitTeams();
         GameRules_spawning_teams(true);
     } else {
        serverflags &= ~SERVERFLAG_TEAMPLAY;
index 13403b9e35a96d71004db020336fadcdbd9e41b7..34a16b8a7aefba01b7e994f9b035085015386dee 100644 (file)
@@ -16,16 +16,6 @@ bool autocvar_g_instagib_ammo_convert_shells;
 bool autocvar_g_instagib_ammo_convert_bullets;
 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;
index f50f0f947c521f7a436c27758bae5d66624b3ddf..5467a44ee48e2c94dce945d7d5f90fea4c897954 100644 (file)
@@ -30,11 +30,18 @@ int autocvar_g_instagib_extralives;
 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 && !MapInfo_LoadedGametype.m_weaponarena)
 {
        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;
index a8d9f7936f6548b36f0cd36f63c4e0afbb35fe45..c94c92c13432523237ca2258db4660e428b1b4e0 100644 (file)
@@ -163,8 +163,6 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan
 #include <common/monsters/sv_spawn.qh>
 #include <common/monsters/sv_monsters.qh>
 
-REGISTER_MUTATOR(nades, autocvar_g_nades);
-
 .float nade_time_primed;
 .float nade_lifetime;
 
@@ -1241,7 +1239,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)
 {
index 26cd9c23c863c0edd4732ab0227177ba3fefdaf4..1ab45eb284cc8e2256fb41f7ceb1efad5cf23741 100644 (file)
@@ -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.
index 4712ec2fadf1016e574e24628eeaf921ec588f5c..32f48ea15e292ae6f725c2114d52f02ce4e7a95a 100644 (file)
@@ -7,6 +7,7 @@ bool autocvar_g_overkill_filter_armorbig = true;
 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) && !MapInfo_LoadedGametype.m_weaponarena && 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
index a9c2d3ef0a69df95e0122727080c39027d1bde1c..7188ae3297cca37ac9ff8d568d424d8be2c75c13 100644 (file)
@@ -18,6 +18,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();
 
@@ -25,6 +26,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();
index f6a0afdf404c1fdb173299f20d86dee76a25e65c..6f70f09beec2219624baeca92e2cd7deaa104fb4 100644 (file)
@@ -1,4 +1 @@
 #pragma once
-
-IntrusiveList g_sandbox_objects;
-STATIC_INIT(g_sandbox_objects) { g_sandbox_objects = IL_NEW(); }
index 58b145a4c2cd647e28372fdb7488fc204de6d02d..b7228d454caf822f1ee50be47441fd34f8818f51 100644 (file)
@@ -198,7 +198,8 @@ SOUND(ONS_CONTROLPOINT_BUILT, "onslaught/controlpoint_built");
 SOUND(ONS_CONTROLPOINT_UNDERATTACK, "onslaught/controlpoint_underattack");
 SOUND(ONS_DAMAGEBLOCKEDBYSHIELD, "onslaught/damageblockedbyshield");
 SOUND(ONS_ELECTRICITY_EXPLODE, "onslaught/electricity_explode");
-SOUND(ONS_GENERATOR_ALARM, "kh/alarm"); // FIXME: unique sound
+#define SND_ONS_GENERATOR_ALARM SND_KH_ALARM
+//SOUND(ONS_GENERATOR_ALARM, "kh/alarm"); // FIXME: unique sound
 SOUND(ONS_GENERATOR_DECAY, "onslaught/generator_decay");
 SOUND(ONS_GENERATOR_UNDERATTACK, "onslaught/generator_underattack");
 SOUND(ONS_HIT1, "onslaught/ons_hit1");
@@ -237,7 +238,8 @@ SOUND(VEH_SPIDERBOT_STRAFE, "vehicles/spiderbot_strafe");
 SOUND(VEH_SPIDERBOT_WALK, "vehicles/spiderbot_walk");
 
 SOUND(NADE_BEEP, "overkill/grenadebip");
-SOUND(NADE_BONUS, "kh/alarm"); // FIXME: unique sound
+#define SND_NADE_BONUS SND_KH_ALARM
+//SOUND(NADE_BONUS, "kh/alarm"); // FIXME: unique sound
 
 SOUND(BUFF_LOST, "relics/relic_effect");
 
index 7b2027589cca326d0a13f53561678e0fba770e39..6c45ab431417d644ecd9f3caeaeb28cb01f38e4f 100644 (file)
@@ -46,8 +46,10 @@ string autocvar_g_forced_team_pink;
 
 entity g_team_entities[NUM_TEAMS]; ///< Holds global team entities.
 
-STATIC_INIT(g_team_entities)
+void Team_InitTeams()
 {
+       if (g_team_entities[0])
+               return;
        for (int i = 0; i < NUM_TEAMS; ++i)
        {
                g_team_entities[i] = new_pure();
index 279df06fc303a8e766fa182d6eb90f2313b81cc6..5cce9758dfb63dc44e0c798033ffa5aaf51ad965 100644 (file)
@@ -14,6 +14,8 @@ bool lockteams;
 
 // ========================== Global teams API ================================
 
+void Team_InitTeams();
+
 /// \brief Returns the global team entity at the given index.
 /// \param[in] index Index of the team.
 /// \return Global team entity at the given index.