]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/world.qc
Clean up droptofloor() macro hacks and clarify naming
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / world.qc
index 90ddd1a9902f4d5a95b65ef640d04ae98244a622..4ce29a707f26338b3dd9f818362a04cf7b216318 100644 (file)
@@ -736,7 +736,9 @@ void InitGameplayMode()
 
        MapInfo_ClearTemps();
 
-       gamemode_name = MapInfo_Type_ToText(MapInfo_LoadedGametype);
+       strcpy(loaded_gametype_custom_string, autocvar__sv_vote_gametype_custom);
+       gametype_custom_enabled = (loaded_gametype_custom_string != "");
+       cvar_set("_sv_vote_gametype_custom", ""); // clear it immediately so it can't get stuck
 
        cache_mutatormsg = strzone("");
        cache_lastmutatormsg = strzone("");
@@ -928,18 +930,12 @@ spawnfunc(worldspawn)
        q3compat = BITSET(q3compat, Q3COMPAT_DEFI, _MapInfo_FindArenaFile(mapname, ".defi") != "");
 
        // quake 3 music support
-       if(world.music || world.noise)
-       {
+       // bones_was_here: Q3 doesn't support .noise but the Nexuiz _MapInfo_Generate() does.
+       // TODO: Q3 supports an optional intro file: "music/intro.wav music/loop.wav"
+       string music = GetField_fullspawndata(world, "music", true);
+       if (music || world.noise)
                // prefer .music over .noise
-               string chosen_music;
-               if(world.music)
-                       chosen_music = world.music;
-               else
-                       chosen_music = world.noise;
-
-               string newstuff = strcat(clientstuff, "cd loop \"", chosen_music, "\"\n");
-               strcpy(clientstuff, newstuff);
-       }
+               strcpy(clientstuff, strcat(clientstuff, "cd loop \"", (music ? music : world.noise), "\"\n"));
 
        if(whichpack(strcat("maps/", mapname, ".cfg")) != "")
        {
@@ -2418,7 +2414,7 @@ void DropToFloor_QC(entity this)
        setorigin(this, this.dropped_origin = this.origin);
 }
 
-void droptofloor(entity this)
+void DropToFloor_QC_DelayedInit(entity this)
 {
        InitializeEntity(this, DropToFloor_QC, INITPRIO_DROPTOFLOOR);
 }
@@ -2644,6 +2640,7 @@ void Shutdown()
                MapInfo_Shutdown();
 
                strfree(sv_termsofservice_url_escaped);
+               strfree(loaded_gametype_custom_string);
        }
        else if(world_initialized == 0)
        {