public static void Init() // done { Global.HostInit = false; InitArgs(); if (COM.CheckParam("-dev") > 0) { Global.developer.data = "1"; Global.developer.value = 1; } InitClock(); CheckOSVersion(); SetStartTime(); Memory.Init(); FileSystem.Init(); Host.Init(); if (Global.HostInit) { NET.Config(true); Host.InitializeGameDLL(); } }
public static void ReadPackets() { while (NET.GetPacket(NetSrc.NS_SERVER)) { if (SV.FilterPacket()) { SV.SendBan(); } else { // if PInt32(NetMessage.Data) ^ = OUTOFBAND_TAG then // SV.ConnectionlessPacket() // else for (int i = 0; i < Global.SVS.MaxClients; i++) { Client C = null; //C := @SVS.Clients[I]; if ((C.Active || C.Spawned || C.Connected) && NET.CompareAdr(Global.NetFrom, C.netchan.Addr)) { if (Netchan.Process(ref C.netchan)) { if ((Global.SVS.MaxClients == 1) || !C.Active || !C.Spawned || !C.SendInfo) { C.NeedUpdate = true; } SV.ExecuteClientMessage(ref C); Global.GlobalVars.FrameTime = (float)Global.HostFrameTime; } if (Netchan.IncomingReady(C.netchan)) { if (Netchan.CopyNormalFragments(ref C.netchan)) { MSG.BeginReading(); SV.ExecuteClientMessage(ref C); } if (Netchan.CopyFileFragments(ref C.netchan)) { // Global.HostClient = C; SV.ProcessFile(ref C, C.netchan.FileName); } } break; } } } } }
public static void Shutdown() { if (Global.InHostShutdown) { Sys.DebugOutStraight("Host_Shutdown: Recursive shutdown."); } else { Global.InHostShutdown = true; Global.HostInit = false; SV.ServerDeactivate(); Mod.ClearAll(); SV.ClearAllEntities(); CM.FreePAS(); SV.FreePMSimulator(); SV.Shutdown(); ReleaseEntityDLLs(); Delta.Shutdown(); NET.Shutdown(); // if WADPath != nil then // Mem.FreeAndNil(WADPath); Draw.DecalShutdown(); W.Shutdown(); HPAK.FlushHostQueue(); Con.Shutdown(); Cmd.RemoveGameCmds(); Cmd.Shutdown(); CVar.Shutdown(); LPrint("Server shutdown\n"); Log.Close(); Global.RealTime = 0.0; SV.Time = 0.0; } }
public static void Init() { Global.RealTime = 0.0; Trash.Rand_Init(); CBuf.Init(); Cmd.Init(); CVar.Init(); InitLocal(); ClearSaveDirectory(); Con.Init(); HPAK.Init(); SV.SetMaxClients(); W.LoadWADFile(); Decal.Init(); Mod.Init(); R.Init(); NET.Init(); Netchan.Init(); Delta.Init(); SV.Init(); string buf = "asdasd"; // TODO CVar.DirectSet(ref Global.sv_version, buf); HPAK.CheckIntegrity("custom.hpk"); CBuf.InsertText("exec valve.rc\n"); Hunk.AllocName(0, "-HOST_HUNKLEVEL-"); Global.HostHunkLevel = Hunk.LowMark; Global.HostActive = 1; Global.HostNumFrames = 0; Global.HostTimes.Prev = Sys.FloatTime(); Global.HostInit = true; }