From: Mario Date: Wed, 28 Sep 2022 05:29:16 +0000 (+1000) Subject: Clean up Q3 music checks X-Git-Tag: xonotic-v0.8.6~328^2~10 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f5aad4d21bcc00d58c1cf4e2ebbf376ddc0524c1;p=xonotic%2Fxonotic-data.pk3dir.git Clean up Q3 music checks --- diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index e893e3b66..2aada5085 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -1038,12 +1038,8 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, Gamet fputs(fh, strcat("author ", MapInfo_Map_author, "\n")); if(_MapInfo_Map_worldspawn_music != "") { - if( - substring(_MapInfo_Map_worldspawn_music, strlen(_MapInfo_Map_worldspawn_music) - 4, 4) == ".wav" - || - substring(_MapInfo_Map_worldspawn_music, strlen(_MapInfo_Map_worldspawn_music) - 4, 4) == ".ogg" - ) - fputs(fh, strcat("cdtrack ", substring(_MapInfo_Map_worldspawn_music, 0, strlen(_MapInfo_Map_worldspawn_music) - 4), "\n")); + if(strcasecmp(substring(_MapInfo_Map_worldspawn_music, -4, 4), ".wav") == 0 || strcasecmp(substring(_MapInfo_Map_worldspawn_music, -4, 4), ".ogg") == 0) + fputs(fh, strcat("cdtrack ", substring(_MapInfo_Map_worldspawn_music, 0, -4), "\n")); else fputs(fh, strcat("cdtrack ", _MapInfo_Map_worldspawn_music, "\n")); } diff --git a/qcsrc/lib/spawnfunc.qh b/qcsrc/lib/spawnfunc.qh index e29939909..c9bfebabd 100644 --- a/qcsrc/lib/spawnfunc.qh +++ b/qcsrc/lib/spawnfunc.qh @@ -173,6 +173,7 @@ noref string __fullspawndata; FIELD_SCALAR(fld, monster_name) \ FIELD_SCALAR(fld, movetype) \ FIELD_SCALAR(fld, move_movetype) \ + FIELD_SCALAR(fld, music) \ FIELD_SCALAR(fld, netname) \ FIELD_SCALAR(fld, nextthink) \ FIELD_SCALAR(fld, noalign) \ diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 2733ce216..fbdf72e96 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -895,21 +895,13 @@ spawnfunc(worldspawn) { // 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); + string newstuff = strcat(clientstuff, "cd loop \"", chosen_music, "\"\n"); + strcpy(clientstuff, newstuff); } if(whichpack(strcat("maps/", mapname, ".cfg")) != "")