From 9f70e06e3f0ccf1ed85da11edf715a1553999168 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 15 Jul 2020 02:39:30 +1000 Subject: [PATCH] Make "music" and "noise" keys in worldspawn functional --- qcsrc/server/g_world.qc | 22 ++++++++++++++++++++++ qcsrc/server/g_world.qh | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index f6a535580..cc2b5e871 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -888,6 +888,28 @@ spawnfunc(worldspawn) if(fexists(strcat("scripts/", mapname, ".defi"))) cvar_settemp("sv_q3defragcompat", "1"); + // quake 3 music support + if(world.music || world.noise) + { + // prefer .music over .noise + string chosen_music; + string oldstuff; + if(world.music) + chosen_music = world.music; + else + chosen_music = world.noise; + if( + substring(chosen_music, strlen(chosen_music) - 4, 4) == ".wav" + || + substring(chosen_music, strlen(chosen_music) - 4, 4) == ".ogg" + ) + oldstuff = strcat(clientstuff, "cd loop \"", chosen_music, "\"\n"); + else + oldstuff = strcat(clientstuff, "cd loop \"", chosen_music, "\"\n"); + + strcpy(clientstuff, oldstuff); + } + if(whichpack(strcat("maps/", mapname, ".cfg")) != "") { int fd = fopen(strcat("maps/", mapname, ".cfg"), FILE_READ); diff --git a/qcsrc/server/g_world.qh b/qcsrc/server/g_world.qh index da950f185..35808f2d1 100644 --- a/qcsrc/server/g_world.qh +++ b/qcsrc/server/g_world.qh @@ -31,3 +31,7 @@ void Map_MarkAsRecent(string m); float DoNextMapOverride(float reinit); void CheckRules_World(); float RedirectionThink(); + +// quake 3 music compatibility +.string music; +.string noise; -- 2.39.2