/* ====================== SV_Map_f handle a map <mapname> command from the console or progs. ====================== */ void SV_Map_f (void) { char expanded[MAX_QPATH]; qfile_t *f; if (Cmd_Argc() != 2) { Com_Printf ("map <mapname> : continue game on a new map\n"); return; } // check to make sure the level exists Q_snprintf (expanded, sizeof(expanded), "maps/%s.bsp", Cmd_Argv(1)); f = FS_Open (expanded, "rb", false, true); if (!f) return; FS_Close (f); if (sv.mvdrecording) SV_MVDStop_f(); NET_ServerConfig (true); if (!dedicated) CL_BeginLocalConnection (); SV_BroadcastCommand ("changing\n"); SV_SendMessagesToAll (); SV_SpawnServer (Cmd_Argv(1), !Q_stricmp(Cmd_Argv(0), "devmap")); SV_BroadcastCommand ("reconnect\n"); }
/* ====================== SV_Map_f handle a map <mapname> command from the console or progs. ====================== */ void SV_Map_f (void) { char level[MAX_QPATH]; char expanded[MAX_QPATH]; FILE *f; char _startspot[MAX_QPATH]; char *startspot; if (Cmd_Argc() < 2) { Con_Printf ("map <levelname> : continue game on a new level\n"); return; } strcpy (level, Cmd_Argv(1)); if (Cmd_Argc() == 2) { startspot = NULL; } else { strcpy (_startspot, Cmd_Argv(2)); startspot = _startspot; } #if 0 if (!strcmp (level, "e1m8")) { // QuakeWorld can't go to e1m8 SV_BroadcastPrintf (PRINT_HIGH, "can't go to low grav level in HexenWorld...\n"); strcpy (level, "e1m5"); } #endif // check to make sure the level exists sprintf (expanded, "maps/%s.bsp", level); COM_FOpenFile (expanded, &f, false); if (!f) { Con_Printf ("Can't find %s\n", expanded); return; } fclose (f); SV_BroadcastCommand ("changing\n"); SV_SendMessagesToAll (); SV_SpawnServer (level, startspot); SV_BroadcastCommand ("reconnect\n"); }
/* SV_Map_f handle a map <mapname> command from the console or progs. */ static void SV_Map_f (void) { const char *level; char *expanded; QFile *f; if (!curlevel) curlevel = dstring_newstr (); if (Cmd_Argc () > 2) { SV_Printf ("map <levelname> : continue game on a new level\n"); return; } if (Cmd_Argc () == 1) { SV_Printf ("map is %s \"%s\" (%s)\n", curlevel->str, PR_GetString (&sv_pr_state, SVstring (sv.edicts, message)), nice_time (sv.time)); return; } level = Cmd_Argv (1); // check to make sure the level exists expanded = nva ("maps/%s.bsp", level); f = QFS_FOpenFile (expanded); if (!f) { SV_Printf ("Can't find %s\n", expanded); free (expanded); return; } Qclose (f); free (expanded); if (sv.recording_demo) SV_Stop (0); SV_qtvChanging (); SV_BroadcastCommand ("changing\n"); SV_SendMessagesToAll (); dstring_copystr (curlevel, level); SV_SpawnServer (level); SV_qtvReconnect (); SV_BroadcastCommand ("reconnect\n"); }
//handle a map <mapname> command from the console or progs. void SV_Map_f (void) { char level[MAX_QPATH], expanded[MAX_QPATH]; #ifndef WITH_FTE_VFS FILE *f; #else vfsfile_t *f; #endif qbool devmap; if (Cmd_Argc() != 2) { Com_Printf ("%s <levelname> : continue game on a new level\n", Cmd_Argv(0)); return; } devmap = !strcasecmp (Cmd_Argv(0), "devmap"); strlcpy (level, Cmd_Argv(1), sizeof(level)); // check to make sure the level exists snprintf (expanded, sizeof(expanded), "maps/%s.bsp", level); #ifndef WITH_FTE_VFS if (FS_FOpenFile (expanded, &f) == -1) { Com_Printf ("Can't find %s\n", expanded); return; } fclose (f); #else if (!(f = FS_OpenVFS(expanded, "rb", FS_ANY))) { Com_Printf ("Can't find %s\n", expanded); return; } VFS_CLOSE(f); #endif // WITH_FTE_VFS #ifndef SERVERONLY if (!dedicated) CL_BeginLocalConnection (); #endif SV_BroadcastCommand ("changing\n"); SV_SendMessagesToAll (); SV_SpawnServer (level, devmap); SV_BroadcastCommand ("reconnect\n"); }