/** * SV_Map * * the full syntax is: * * map [*] <map>$ <startspot>+ <nextserver> * * command from the console or progs. Map can also be a.cin, .pcx, or .dm2 file. * * Nextserver is used to allow a cinematic to play, then proceed to * another level: * * map tram.cin+jail_e3 */ public static void SV_Map(bool attractloop, string levelstring, bool loadgame) { int l; string level, spawnpoint; SV_INIT.sv.loadgame = loadgame; SV_INIT.sv.attractloop = attractloop; if (SV_INIT.sv.state == Defines.ss_dead && !SV_INIT.sv.loadgame) { SV_INIT.SV_InitGame(); // the game is just starting } level = levelstring; // bis hier her ok. // if there is a + in the map, set nextserver to the remainder var c = level.IndexOf('+'); if (c != -1) { Cvar.Set("nextserver", "gamemap \"" + level[(c + 1)..] + "\"");
/** * PF_setmodel * * Also sets mins and maxs for inline bmodels. */ public static void PF_setmodel(edict_t ent, string name) { int i; cmodel_t mod; if (name == null) { Com.Error(Defines.ERR_DROP, "PF_setmodel: NULL"); } i = SV_INIT.SV_ModelIndex(name); ent.s.modelindex = i; // if it is an inline model, get the size information for it if (name.StartsWith("*")) { mod = CM.InlineModel(name); Math3D.VectorCopy(mod.mins, ent.mins); Math3D.VectorCopy(mod.maxs, ent.maxs); SV_WORLD.SV_LinkEdict(ent); } }
public static int SV_ImageIndex(string name) { return(SV_INIT.SV_FindIndex(name, Defines.CS_IMAGES, Defines.MAX_IMAGES, true)); }
public static int SV_SoundIndex(string name) { return(SV_INIT.SV_FindIndex(name, Defines.CS_SOUNDS, Defines.MAX_SOUNDS, true)); }
public static int SV_ModelIndex(string name) { return(SV_INIT.SV_FindIndex(name, Defines.CS_MODELS, Defines.MAX_MODELS, true)); }
/** * SV_SpawnServer. * * Change the server to a new map, taking all connected clients along with * it. */ public static void SV_SpawnServer(string server, string spawnpoint, int serverstate, bool attractloop, bool loadgame) { int i; var checksum = 0; if (attractloop) { Cvar.Set("paused", "0"); } Com.Printf("------- Server Initialization -------\n"); Com.DPrintf("SpawnServer: " + server + "\n"); if (SV_INIT.sv.demofile != null) { try { SV_INIT.sv.demofile.Close(); } catch (Exception) { } } // any partially connected client will be restarted SV_INIT.svs.spawncount++; SV_INIT.sv.state = Defines.ss_dead; Globals.server_state = SV_INIT.sv.state; // wipe the entire per-level structure SV_INIT.sv = new(); SV_INIT.svs.realtime = 0; SV_INIT.sv.loadgame = loadgame; SV_INIT.sv.attractloop = attractloop; // save name for levels that don't set message SV_INIT.sv.configstrings[Defines.CS_NAME] = server; if (Cvar.VariableValue("deathmatch") != 0) { SV_INIT.sv.configstrings[Defines.CS_AIRACCEL] = "" + SV_MAIN.sv_airaccelerate.value; PMove.pm_airaccelerate = SV_MAIN.sv_airaccelerate.value; } else { SV_INIT.sv.configstrings[Defines.CS_AIRACCEL] = "0"; PMove.pm_airaccelerate = 0; } SZ.Init(SV_INIT.sv.multicast, SV_INIT.sv.multicast_buf, SV_INIT.sv.multicast_buf.Length); SV_INIT.sv.name = server; // leave slots at start for clients only for (i = 0; i < SV_MAIN.maxclients.value; i++) { // needs to reconnect if (SV_INIT.svs.clients[i].state > Defines.cs_connected) { SV_INIT.svs.clients[i].state = Defines.cs_connected; } SV_INIT.svs.clients[i].lastframe = -1; } SV_INIT.sv.time = 1000; SV_INIT.sv.name = server; SV_INIT.sv.configstrings[Defines.CS_NAME] = server; int[] iw = { checksum }; if (serverstate != Defines.ss_game) { SV_INIT.sv.models[1] = CM.CM_LoadMap("", false, iw); // no real map } else { SV_INIT.sv.configstrings[Defines.CS_MODELS + 1] = "maps/" + server + ".bsp"; SV_INIT.sv.models[1] = CM.CM_LoadMap(SV_INIT.sv.configstrings[Defines.CS_MODELS + 1], false, iw); } checksum = iw[0]; SV_INIT.sv.configstrings[Defines.CS_MAPCHECKSUM] = "" + checksum; // clear physics interaction links SV_WORLD.SV_ClearWorld(); for (i = 1; i < CM.CM_NumInlineModels(); i++) { SV_INIT.sv.configstrings[Defines.CS_MODELS + 1 + i] = "*" + i; // copy references SV_INIT.sv.models[i + 1] = CM.InlineModel(SV_INIT.sv.configstrings[Defines.CS_MODELS + 1 + i]); } // spawn the rest of the entities on the map // precache and static commands can be issued during // map initialization SV_INIT.sv.state = Defines.ss_loading; Globals.server_state = SV_INIT.sv.state; // load and spawn all other entities GameSpawn.SpawnEntities(SV_INIT.sv.name, CM.CM_EntityString(), spawnpoint); // run two frames to allow everything to settle GameBase.G_RunFrame(); GameBase.G_RunFrame(); // all precaches are complete SV_INIT.sv.state = serverstate; Globals.server_state = SV_INIT.sv.state; // create a baseline for more efficient communications SV_INIT.SV_CreateBaseline(); // check for a savegame SV_INIT.SV_CheckForSavegame(); // set serverinfo variable Cvar.FullSet("mapname", SV_INIT.sv.name, Defines.CVAR_SERVERINFO | Defines.CVAR_NOSET); }