SendCmd() public static méthode

public static SendCmd ( ) : void
Résultat void
        // _Host_Frame
        //
        //Runs all active servers
        private void InternalFrame(Double time)
        {
            // keep the random time dependent
            MathLib.Random( );

            // decide the simulation time
            if (!FilterTime(time))
            {
                return;         // don't run too fast, or packets will flood out
            }
            // get new key events
            MainWindow.SendKeyEvents( );

            // allow mice or other external controllers to add commands
            MainWindow.Input.Commands( );

            // process console commands
            Commands.Buffer.Execute( );

            Network.Poll( );

            // if running the server locally, make intentions now
            if (Server.sv.active)
            {
                Client.SendCmd( );
            }

            //-------------------
            //
            // server operations
            //
            //-------------------

            // check for commands typed to the host
            GetConsoleCommands( );

            if (Server.sv.active)
            {
                ServerFrame( );
            }

            //-------------------
            //
            // client operations
            //
            //-------------------

            // if running the server remotely, send intentions now after
            // the incoming messages have been read
            if (!Server.sv.active)
            {
                Client.SendCmd( );
            }

            Time += FrameTime;

            // fetch results from server
            if (Client.cls.state == cactive_t.ca_connected)
            {
                Client.ReadFromServer( );
            }

            // update video
            if (Cvars.HostSpeeds.Get <Boolean>( ))
            {
                _Time1 = Timer.GetFloatTime( );
            }

            Screen.UpdateScreen( );

            if (Cvars.HostSpeeds.Get <Boolean>( ))
            {
                _Time2 = Timer.GetFloatTime( );
            }

            // update audio
            if (Client.cls.signon == ClientDef.SIGNONS)
            {
                Sound.Update(ref RenderContext.Origin, ref RenderContext.ViewPn, ref RenderContext.ViewRight, ref RenderContext.ViewUp);
                Client.DecayLights( );
            }
            else
            {
                Sound.Update(ref Utilities.ZeroVector, ref Utilities.ZeroVector, ref Utilities.ZeroVector, ref Utilities.ZeroVector);
            }

            CDAudio.Update( );

            if (Cvars.HostSpeeds.Get <Boolean>( ))
            {
                var pass1 = ( Int32 )((_Time1 - _Time3) * 1000);
                _Time3 = Timer.GetFloatTime( );
                var pass2 = ( Int32 )((_Time2 - _Time1) * 1000);
                var pass3 = ( Int32 )((_Time3 - _Time2) * 1000);
                Console.Print("{0,3} tot {1,3} server {2,3} gfx {3,3} snd\n", pass1 + pass2 + pass3, pass1, pass2, pass3);
            }

            FrameCount++;
        }
Exemple #2
0
        // _Host_Frame
        //
        //Runs all active servers
        static void InternalFrame(double time)
        {
            // keep the random time dependent
            Sys.Random();

            // decide the simulation time
            if (!FilterTime(time))
            {
                return;         // don't run too fast, or packets will flood out
            }

            // get new key events
            Sys.SendKeyEvents();

            // allow mice or other external controllers to add commands
            Input.Commands();

            // process console commands
            Cbuf.Execute();

            Net.Poll();

            // if running the server locally, make intentions now
            if (Server.sv.active)
            {
                Client.SendCmd();
            }

            //-------------------
            //
            // server operations
            //
            //-------------------

            // check for commands typed to the host
            GetConsoleCommands();

            if (Server.sv.active)
            {
                ServerFrame();
            }

            //-------------------
            //
            // client operations
            //
            //-------------------

            // if running the server remotely, send intentions now after
            // the incoming messages have been read
            if (!Server.sv.active)
            {
                Client.SendCmd();
            }

            _Time += FrameTime;

            // fetch results from server
            if (Client.Cls.state == ClientActivityState.Connected)
            {
                Client.ReadFromServer();
            }

            // update video
            if (_Speeds.Value != 0)
            {
                _Time1 = Sys.GetFloatTime();
            }

            Scr.UpdateScreen();

            if (_Speeds.Value != 0)
            {
                _Time2 = Sys.GetFloatTime();
            }

            // update audio
            if (Client.Cls.signon == Client.SIGNONS)
            {
                Sound.Update(ref Render.Origin, ref Render.ViewPn, ref Render.ViewRight, ref Render.ViewUp);
                Client.DecayLights();
            }
            else
            {
                Sound.Update(ref Common.ZeroVector, ref Common.ZeroVector, ref Common.ZeroVector, ref Common.ZeroVector);
            }

            CDAudio.Update();

            if (_Speeds.Value != 0)
            {
                int pass1 = (int)((_Time1 - _Time3) * 1000);
                _Time3 = Sys.GetFloatTime();
                int pass2 = (int)((_Time2 - _Time1) * 1000);
                int pass3 = (int)((_Time3 - _Time2) * 1000);
                Con.Print("{0,3} tot {1,3} server {2,3} gfx {3,3} snd\n", pass1 + pass2 + pass3, pass1, pass2, pass3);
            }

            _FrameCount++;
        }