StopPitchDrift() публичный статический Метод

public static StopPitchDrift ( ) : void
Результат void
Пример #1
0
        /// <summary>
        /// IN_MouseMove
        /// </summary>
        private static void MouseMove(usercmd_t cmd)
        {
            if (!_IsMouseActive)
            {
                return;
            }

            Point current_pos   = Cursor.Position;
            Point window_center = Input.WindowCenter;

            int mx = (int)(current_pos.X - window_center.X + _MouseAccum.X);
            int my = (int)(current_pos.Y - window_center.Y + _MouseAccum.Y);

            _MouseAccum.X = 0;
            _MouseAccum.Y = 0;

            if (_MouseFilter.Value != 0)
            {
                _Mouse.X = (mx + _OldMouse.X) * 0.5f;
                _Mouse.Y = (my + _OldMouse.Y) * 0.5f;
            }
            else
            {
                _Mouse.X = mx;
                _Mouse.Y = my;
            }

            _OldMouse.X = mx;
            _OldMouse.Y = my;

            _Mouse *= Client.Sensitivity;

            // add mouse X/Y movement to cmd
            if (ClientInput.StrafeBtn.IsDown || (Client.LookStrafe && ClientInput.MLookBtn.IsDown))
            {
                cmd.sidemove += Client.MSide * _Mouse.X;
            }
            else
            {
                Client.cl.viewangles.Y -= Client.MYaw * _Mouse.X;
            }

            View.StopPitchDrift();

            Client.cl.viewangles.X += Client.MPitch * _Mouse.Y;

            // modernized to always use mouse look
            Client.cl.viewangles.X = MathHelper.Clamp(Client.cl.viewangles.X, -70, 80);

            // if the mouse has moved, force it to the center, so there's room to move
            if (mx != 0 || my != 0)
            {
                Cursor.Position = window_center;
            }
        }
Пример #2
0
        // CL_AdjustAngles
        //
        // Moves the local angle positions
        static void AdjustAngles()
        {
            float speed = (float)Host.FrameTime;

            if (ClientInput.SpeedBtn.IsDown)
            {
                speed *= _AngleSpeedKey.Value;
            }

            if (!ClientInput.StrafeBtn.IsDown)
            {
                Cl.viewangles.Y -= speed * _YawSpeed.Value * KeyState(ref ClientInput.RightBtn);
                Cl.viewangles.Y += speed * _YawSpeed.Value * KeyState(ref ClientInput.LeftBtn);
                Cl.viewangles.Y  = Mathlib.AngleMod(Cl.viewangles.Y);
            }

            if (ClientInput.KLookBtn.IsDown)
            {
                View.StopPitchDrift();
                Cl.viewangles.X -= speed * _PitchSpeed.Value * KeyState(ref ClientInput.ForwardBtn);
                Cl.viewangles.X += speed * _PitchSpeed.Value * KeyState(ref ClientInput.BackBtn);
            }

            float up   = KeyState(ref ClientInput.LookUpBtn);
            float down = KeyState(ref ClientInput.LookDownBtn);

            Cl.viewangles.X -= speed * _PitchSpeed.Value * up;
            Cl.viewangles.X += speed * _PitchSpeed.Value * down;

            if (up != 0 || down != 0)
            {
                View.StopPitchDrift();
            }

            if (Cl.viewangles.X > 80)
            {
                Cl.viewangles.X = 80;
            }

            if (Cl.viewangles.X < -70)
            {
                Cl.viewangles.X = -70;
            }

            if (Cl.viewangles.Z > 50)
            {
                Cl.viewangles.Z = 50;
            }

            if (Cl.viewangles.Z < -50)
            {
                Cl.viewangles.Z = -50;
            }
        }
Пример #3
0
        /// <summary>
        /// IN_MouseMove
        /// </summary>
        static void MouseMove(usercmd_t cmd)
        {
            if (!_IsMouseActive)
            {
                return;
            }

            Rectangle bounds        = MainForm.Instance.Bounds;
            Point     current_pos   = Cursor.Position;
            Point     window_center = Input.WindowCenter;

            int mx = (int)(current_pos.X - window_center.X + _MouseAccum.X);
            int my = (int)(current_pos.Y - window_center.Y + _MouseAccum.Y);

            _MouseAccum.X = 0;
            _MouseAccum.Y = 0;


            if (_MouseFilter.Value != 0)
            {
                _Mouse.X = (mx + _OldMouse.X) * 0.5f;
                _Mouse.Y = (my + _OldMouse.Y) * 0.5f;
            }
            else
            {
                _Mouse.X = mx;
                _Mouse.Y = my;
            }

            _OldMouse.X = mx;
            _OldMouse.Y = my;

            _Mouse *= Client.Sensitivity;

            // add mouse X/Y movement to cmd
            if (ClientInput.StrafeBtn.IsDown || (Client.LookStrafe && ClientInput.MLookBtn.IsDown))
            {
                cmd.sidemove += Client.MSide * _Mouse.X;
            }
            else
            {
                Client.cl.viewangles.Y -= Client.MYaw * _Mouse.X;
            }

            if (ClientInput.MLookBtn.IsDown)
            {
                View.StopPitchDrift();
            }

            if (ClientInput.MLookBtn.IsDown && !ClientInput.StrafeBtn.IsDown)
            {
                Client.cl.viewangles.X += Client.MPitch * _Mouse.Y;
                if (Client.cl.viewangles.X > 80)
                {
                    Client.cl.viewangles.X = 80;
                }
                if (Client.cl.viewangles.X < -70)
                {
                    Client.cl.viewangles.X = -70;
                }
            }
            else
            {
                if (ClientInput.StrafeBtn.IsDown && Host.NoClipAngleHack)
                {
                    cmd.upmove -= Client.MForward * _Mouse.Y;
                }
                else
                {
                    cmd.forwardmove -= Client.MForward * _Mouse.Y;
                }
            }

            // if the mouse has moved, force it to the center, so there's room to move
            if (mx != 0 || my != 0)
            {
                Cursor.Position = window_center;
            }
        }