Beispiel #1
0
        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;
            }
        }
Beispiel #2
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;
        }