From: Mario Date: Tue, 14 Jul 2020 16:39:30 +0000 (+1000) Subject: Make "music" and "noise" keys in worldspawn functional X-Git-Tag: xonotic-v0.8.6~328^2~33 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9f70e06e3f0ccf1ed85da11edf715a1553999168;p=xonotic%2Fxonotic-data.pk3dir.git Make "music" and "noise" keys in worldspawn functional --- 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;