From a3d5a1b1e21275e2ee233228561b8199d4332d45 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 15 Oct 2015 12:56:47 +1000 Subject: [PATCH] Hack: mute all target_music entities when the match ends (fixes overlapping with sv_intermission_cdtrack) --- qcsrc/common/triggers/target/music.qc | 11 +++++++++++ qcsrc/common/triggers/target/music.qh | 3 +++ qcsrc/server/g_world.qc | 5 +++++ qcsrc/server/t_items.qc | 7 ++++--- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/triggers/target/music.qc b/qcsrc/common/triggers/target/music.qc index 257de8be5..ebecb18e3 100644 --- a/qcsrc/common/triggers/target/music.qc +++ b/qcsrc/common/triggers/target/music.qc @@ -33,6 +33,17 @@ void target_music_reset() if(self.targetname == "") target_music_sendto(MSG_ALL, 1); } +void target_music_kill() +{ + for(self = world; (self = find(self, classname, "target_music")); ) + { + self.volume = 0; + if(self.targetname == "") + target_music_sendto(MSG_ALL, 1); + else + target_music_sendto(MSG_ALL, 0); + } +} void target_music_use() { if(!activator) diff --git a/qcsrc/common/triggers/target/music.qh b/qcsrc/common/triggers/target/music.qh index 712d412f6..d46c46055 100644 --- a/qcsrc/common/triggers/target/music.qh +++ b/qcsrc/common/triggers/target/music.qh @@ -23,6 +23,9 @@ void Ent_TriggerMusic_Think(); void Ent_TriggerMusic_Remove(); void Ent_ReadTriggerMusic(); + +#elif defined(SVQC) +void target_music_kill(); #endif #endif diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index fc3eed452..d570cad53 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -31,6 +31,7 @@ #include "../common/stats.qh" #include "../common/teams.qh" #include "../common/triggers/trigger/secret.qh" +#include "../common/triggers/target/music.qh" #include "../common/util.qh" #include "../common/items/all.qh" #include "../common/weapons/all.qh" @@ -1546,6 +1547,10 @@ void NextLevel() bprint(other.netname, " ^7wins.\n"); } + entity oldself = self; + target_music_kill(); + self = oldself; + if(autocvar_g_campaign) CampaignPreIntermission(); diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index a640cce10..568789c62 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -1070,12 +1070,12 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, // it's a level item if(self.spawnflags & 1) self.noalign = 1; - if (self.noalign) + if (self.noalign > 0) self.movetype = MOVETYPE_NONE; else self.movetype = MOVETYPE_TOSS; // do item filtering according to game mode and other things - if (!self.noalign) + if (self.noalign <= 0) { // first nudge it off the floor a little bit to avoid math errors setorigin(self, self.origin + '0 0 1'); @@ -1086,7 +1086,8 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, setsize (self, '-16 -16 0', '16 16 32'); self.SendFlags |= ISF_SIZE; // note droptofloor returns false if stuck/or would fall too far - droptofloor(); + if(!self.noalign) + droptofloor(); waypoint_spawnforitem(self); } -- 2.39.2