Beispiel #1
0
        public static void SV_Frame(Int64 msec)
        {
            Globals.time_before_game = Globals.time_after_game = 0;
            if (!SV_INIT.svs.initialized)
            {
                return;
            }
            SV_INIT.svs.realtime += ( Int32 )msec;
            Lib.Rand();
            SV_CheckTimeouts();
            SV_ReadPackets();
            if (0 == SV_MAIN.sv_timedemo.value && SV_INIT.svs.realtime < SV_INIT.sv.time)
            {
                if (SV_INIT.sv.time - SV_INIT.svs.realtime > 100)
                {
                    if (SV_MAIN.sv_showclamp.value != 0)
                    {
                        Com.Printf("sv lowclamp\\n");
                    }
                    SV_INIT.svs.realtime = SV_INIT.sv.time - 100;
                }

                NET.Sleep(SV_INIT.sv.time - SV_INIT.svs.realtime);
                return;
            }

            SV_CalcPings();
            SV_GiveMsec();
            SV_RunGameFrame();
            SV_SEND.SV_SendClientMessages();
            SV_ENTS.SV_RecordDemoMessage();
            Master_Heartbeat();
            SV_PrepWorldFrame();
        }
Beispiel #2
0
        public static void SV_Map(Boolean attractloop, String levelstring, Boolean loadgame)
        {
            Int32  l;
            String level, ch, spawnpoint;
            var    pos = 0;

            sv.loadgame    = loadgame;
            sv.attractloop = attractloop;
            if (sv.state == Defines.ss_dead && !sv.loadgame)
            {
                SV_InitGame();
            }
            level = levelstring;
            var c = level.IndexOf('+');

            if (c != -1)
            {
                Cvar.Set("nextserver", "gamemap \\\"" + level.Substring(c + 1) + "\\\"");
                level = level.Substring(0, c);
            }
            else
            {
                Cvar.Set("nextserver", "");
            }

            if (firstmap.Length == 0)
            {
                if (!levelstring.EndsWith(".cin") && !levelstring.EndsWith(".pcx") && !levelstring.EndsWith(".dm2"))
                {
                    pos      = levelstring.IndexOf('+');
                    firstmap = levelstring.Substring(pos + 1);
                }
            }

            if (Cvar.VariableValue("coop") != 0 && level.Equals("victory.pcx"))
            {
                Cvar.Set("nextserver", "gamemap \\\"*" + firstmap + "\\\"");
            }
            pos = level.IndexOf('$');
            if (pos != -1)
            {
                spawnpoint = level.Substring(pos + 1);
                level      = level.Substring(0, pos);
            }
            else
            {
                spawnpoint = "";
            }
            if (level[0] == '*')
            {
                level = level.Substring(1);
            }
            l = level.Length;
            if (l > 4 && level.EndsWith(".cin"))
            {
                SCR.BeginLoadingPlaque();
                SV_SEND.SV_BroadcastCommand("changing\\n");
                SV_SpawnServer(level, spawnpoint, Defines.ss_cinematic, attractloop, loadgame);
            }
            else if (l > 4 && level.EndsWith(".dm2"))
            {
                SCR.BeginLoadingPlaque();
                SV_SEND.SV_BroadcastCommand("changing\\n");
                SV_SpawnServer(level, spawnpoint, Defines.ss_demo, attractloop, loadgame);
            }
            else if (l > 4 && level.EndsWith(".pcx"))
            {
                SCR.BeginLoadingPlaque();
                SV_SEND.SV_BroadcastCommand("changing\\n");
                SV_SpawnServer(level, spawnpoint, Defines.ss_pic, attractloop, loadgame);
            }
            else
            {
                SCR.BeginLoadingPlaque();
                SV_SEND.SV_BroadcastCommand("changing\\n");
                SV_SEND.SV_SendClientMessages();
                SV_SpawnServer(level, spawnpoint, Defines.ss_game, attractloop, loadgame);
                Cbuf.CopyToDefer();
            }

            SV_SEND.SV_BroadcastCommand("reconnect\\n");
        }