Пример #1
0
 public override void CalcOutputDelta(Vector2 angVelocity, ref Vector2 outputDelta)
 {
     Vector2 delta = new Vector2(angVelocity);
     delta.Pow(this.exponent);
     delta.Scale(this.coeff);
     delta.Scale(this.accel.GetAccelCoeff(this.TimeInOrAboveTrans));
     outputDelta = delta;
 }
Пример #2
0
        public void CalcAngularVelocity(Vector2 delta, out Vector2 angularVelocity)
        {
            double speed, accel, yaw, pitch, mouseDpi;

            GetUserSettings(out speed, out accel, out mouseDpi, out pitch, out yaw);

            double delay = (1000 / (1000 / (double)m_rate.Value));
            double revolutionsperinch = speed / 15;

            double userScale = revolutionsperinch * delay / mouseDpi;

            angularVelocity = new Vector2(delta.X, delta.Y);

            // Short circuit if we know we have no movement;
            if (angularVelocity.X != 0 || angularVelocity.Y != 0)
            {
                // Transform mouseDelta into Angular Velocity ( revolutions / time ) = delta^accel * sens * delay
                angularVelocity.Pow(accel);
                angularVelocity.Scale(userScale);

                // Factor in user Y:X ratio
                angularVelocity.X = angularVelocity.X * yaw;
                angularVelocity.Y = angularVelocity.Y * pitch;
            }

            InfoTextManager.Instance.WriteLine(highEndCarry.X.ToString());
            angularVelocity.Add(highEndCarry);
            highEndCarry.X = highEndCarry.Y = 0;

            angularVelocity.Add(lowEndCarry);
            lowEndCarry.X = lowEndCarry.Y = 0;
        }
Пример #3
0
 public override double CalcOutputDelta(double inputDelta,double otherAxis)
 {
     Vector2 delta = new Vector2(inputDelta, otherAxis);
     delta.Pow(this.Exp);
     delta.Scale(this.Speed);
     return delta.X;
 }
Пример #4
0
        public void XSoftMouseMovement(ref Xim.Input input, ref Xim.Input startState)
        {
            GamesManager.GameSettings gameSettings = gamesManager.GetGameSettings((GamesManager.Games)m_currentGame.Value);

            // User Values
            double speed, accel, yaw, pitch, mouseDpi;

            GetUserSettings(out speed, out accel, out mouseDpi, out pitch, out yaw);

            double delay = (1000 / (1000 / (double)m_rate.Value));
            double revolutionsperinch = speed / 15;

            double userScale = revolutionsperinch * delay / mouseDpi;

            Vector2 delta;
            GetMouseDelta(out delta);

            if (delta.X == 0 && delta.Y == 0)
                return;

            Vector2 mouseDelta = new Vector2(delta.X, delta.Y);

            // Transform mouseDelta into Angular Velocity ( revolutions / time ) = delta^accel * sens * delay
            mouseDelta.Pow(accel);
            mouseDelta.Scale(userScale);

            // Factor in game Y:X ratio
            mouseDelta.X = mouseDelta.X * yaw;
            mouseDelta.Y = mouseDelta.Y * pitch;

            CalcDelta(mouseDelta, gameSettings);

            CalcDiag(mouseDelta, gameSettings);

            CalcAveraging(mouseDelta, gameSettings);

            // Add deadzone
            Vector2 deadzoneVec = CalcDeadzone(mouseDelta, gameSettings);

            mouseDelta.Add(deadzoneVec);

            // pixelCap is the number of pixels per frame that can be processed by the current angular velocity formula.
            // Anything above this value is useless to translate but we can carry the leftover value to the next frame.

            if (gameSettings.XAxis.Cap != -1)
            {
                double pixelCapX = Math.Pow((gameSettings.XAxis.GetPixelCapValue(gameSettings.Deadzone) / (userScale * yaw)), (double)1 / accel);
                if (Math.Abs(delta.X) > pixelCapX)
                {
                    int sign = Math.Sign(delta.X);

                    highEndCarry.X = (Math.Abs(delta.X) - pixelCapX) * sign;
                    mouseDelta.X = (short)(gameSettings.XAxis.Cap * sign);
                }
            }

            if (gameSettings.YAxis.Cap != -1)
            {
                double pixelCapY = Math.Pow((gameSettings.YAxis.GetPixelCapValue(gameSettings.Deadzone) / (userScale * pitch)), (double)1 / accel);
                if (Math.Abs(delta.Y) > pixelCapY)
                {
                    int sign = Math.Sign(mouseDelta.Y);

                    highEndCarry.Y = (Math.Abs(delta.Y) - pixelCapY) * sign;
                    mouseDelta.Y = (short)(gameSettings.YAxis.Cap * sign);
                }
            }

            // pixelsAtMax is the number of pixels we can process when moving at Xim.Stick.Max, if we have moved more than
            // this number of pixels then we should carry the leftover and use Xim.Stick.Max for our output.
            if (gameSettings.XAxis.MaxSpeed != -1)
            {
                double pixelsAtMaxX = Math.Pow((gameSettings.XAxis.MaxSpeed) / (userScale * pitch), 1 / accel);

                if (Math.Abs(delta.X) > pixelsAtMaxX)
                {
                    InfoTextManager.Instance.WriteLineDebug("CarryX!" + delta.X);
                    int sign = Math.Sign(delta.X);
                    highEndCarry.X = (Math.Abs(delta.X) - pixelsAtMaxX) * sign;
                    mouseDelta.X = ((short)Xim.Stick.Max * sign);
                }
            }

            if (gameSettings.YAxis.MaxSpeed != -1)
            {
                double pixelsAtMaxY = Math.Pow((gameSettings.YAxis.MaxSpeed) / (userScale * yaw), 1 / accel);
                if (Math.Abs(delta.Y) > pixelsAtMaxY)
                {
                    InfoTextManager.Instance.WriteLineDebug("CarryY!" + delta.Y);
                    int sign = Math.Sign(delta.Y);
                    highEndCarry.Y = (Math.Abs(delta.Y) - pixelsAtMaxY) * sign;
                    mouseDelta.Y = ((short)Xim.Stick.Max * sign);
                }
            }

            // Some games ( like UT3 ) have a strange Y step function going on, account for that.
            if (gameSettings.XAxis.CarryZone != -1)
            {
                if (Math.Abs(mouseDelta.X) < gameSettings.XAxis.CarryZone)
                {
                    lowEndCarry.X = delta.X;
                    mouseDelta.X = 0;
                }
            }

            if (gameSettings.YAxis.CarryZone != -1)
            {
                if (Math.Abs(mouseDelta.Y) < gameSettings.YAxis.CarryZone)
                {
                    lowEndCarry.Y = delta.Y;
                    mouseDelta.Y = 0;
                }
            }

            mouseDelta.Cap(-(double)Xim.Stick.Max, (double)Xim.Stick.Max);

            SaveDrivingModeData(mouseDelta, delta);

            SetXboxInput(ref input, mouseDelta);
        }
Пример #5
0
 public override double CalcOutputDelta(double inputDelta, double otherAxis)
 {
     Vector2 xsquared = new Vector2(inputDelta, otherAxis);
     xsquared.Pow(2);
     xsquared.Scale(this.x2Factor);
     return Math.Sign(inputDelta) * ( xsquared.X + this.xFactor * Math.Abs(inputDelta) + yIntercept ) ;
 }