/* ================== Host_Changelevel_f Goes to a new map, taking all clients along ================== */ void Host_Changelevel_f (void) { char level[MAX_QPATH]; if (Cmd_Argc() != 2) { Con_Printf ("changelevel <levelname> : continue game on a new level\n"); return; } if (!sv.active || cls.demoplayback) { Con_Printf ("Only the server may changelevel\n"); return; } //johnfitz -- check for client having map before anything else q_snprintf (level, sizeof(level), "maps/%s.bsp", Cmd_Argv(1)); if (!COM_FileExists(level, NULL)) Host_Error ("cannot find map %s", level); //johnfitz if (cls.state != ca_dedicated) IN_Activate(); // -- S.A. key_dest = key_game; // remove console or menu SV_SaveSpawnparms (); q_strlcpy (level, Cmd_Argv(1), sizeof(level)); SV_SpawnServer (level); // also issue an error if spawn failed -- O.S. if (!sv.active) Host_Error ("cannot run map %s", level); }
void BGM_PlayCDtrack (byte track, qboolean looping) { /* instead of searching by the order of music_handlers, do so by * the order of searchpath priority: the file from the searchpath * with the highest path_id is most likely from our own gamedir * itself. This way, if a mod has track02 as a *.mp3 file, which * is below *.ogg in the music_handler order, the mp3 will still * have priority over track02.ogg from, say, id1. */ char tmp[MAX_QPATH]; const char *ext; unsigned int path_id, prev_id, type; music_handler_t *handler; BGM_Stop(); if (CDAudio_Play(track, looping) == 0) return; /* success */ if (music_handlers == NULL) return; if (no_extmusic || !bgm_extmusic.value) return; prev_id = 0; type = 0; ext = NULL; handler = music_handlers; while (handler) { if (! handler->is_available) goto _next; if (! CDRIPTYPE(handler->type)) goto _next; q_snprintf(tmp, sizeof(tmp), "%s/track%02d.%s", MUSIC_DIRNAME, (int)track, handler->ext); if (! COM_FileExists(tmp, &path_id)) goto _next; if (path_id > prev_id) { prev_id = path_id; type = handler->type; ext = handler->ext; } _next: handler = handler->next; } if (ext == NULL) Con_Printf("Couldn't find a cdrip for track %d\n", (int)track); else { q_snprintf(tmp, sizeof(tmp), "%s/track%02d.%s", MUSIC_DIRNAME, (int)track, ext); bgmstream = S_CodecOpenStreamType(tmp, type); if (! bgmstream) Con_Printf("Couldn't handle music file %s\n", tmp); } }