Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PIE.FrameRate = 500hz
- //Configuration
- var.SensitivityAxisX = 1/190
- var.SensitivityAxisY = 1/190
- var.SensitivityAxisZ = 1/10
- var.RecenteringSpeedXY = 30
- var.RecenteringSpeedZ = 8
- var.MaxRadiusRecentering = 0.7/1
- var.DeadZoneRecenteringSpeed = 1/1
- var.DeadZone = 0.01
- var.MouseCompensation = 860
- //Mouse Axis Mapping
- var.AxisX = delta(RealMouse.DirectInputX)*var.SensitivityAxisX
- var.AxisY = delta(RealMouse.DirectInputY)*var.SensitivityAxisY
- var.AxisZ = delta(RealMouse.DirectInputZ)
- //Joystick Axis Mapping
- if var.AxisZ < 0 then PPJoy1.Analog2 -= var.SensitivityAxisZ else
- if var.AxisZ > 0 then PPJoy1.Analog2 += var.SensitivityAxisZ
- PPJoy1.Analog0 += var.AxisX
- PPJoy1.Analog1 += var.AxisY
- //Coordinates
- var.JoyCoordinateX = PPJoy1.Analog0
- var.JoyCoordinateY = PPJoy1.Analog1
- var.JoyCoordinateZ = PPJoy1.Analog2
- var.AbsoluteJoyCoordinateZ = |PPJoy1.Analog2|
- //Absolute distance between Joystick center and (X,Y) coordinates
- var.JoyVector = sqrt(sqr(var.JoyCoordinateX) + sqr(var.JoyCoordinateY))
- //Recentering
- //Recentering speed (increases exponentially based on Mouse movement speed)
- var.RecenterSpeedXY = (0.999 - (var.JoyVector / var.RecenteringSpeedXY))
- var.RecenterSpeedZ = (0.994 - (var.AbsoluteJoyCoordinateZ / var.RecenteringSpeedZ))
- //AxisX Recentering
- //1st line: Rendering the Joystick coordinate field to a circle, thus reducing sensitivity to edges
- //2nd line: Regular Joystick Recentering
- //3rd line: Joystick DeadZone
- if var.JoyVector >= 1.00005 then PPJoy1.Analog0 *= var.MaxRadiusRecentering else
- if 1.00005 > var.JoyVector > var.DeadZone then PPJoy1.Analog0 *= var.RecenterSpeedXY else
- if var.DeadZone > var.JoyVector > 0.00 then PPJoy1.Analog0 *= var.DeadZoneRecenteringSpeed
- endif
- //AxisY Recentering
- if var.JoyVector >= 1.00005 then PPJoy1.Analog1 *= var.MaxRadiusRecentering else
- if 1.00005 > var.JoyVector > var.DeadZone then PPJoy1.Analog1 *= var.RecenterSpeedXY else
- if var.DeadZone > var.JoyVector > 0.00 then PPJoy1.Analog1 *= var.DeadZoneRecenteringSpeed
- endif
- //AxisZ Recentering
- if not var.AbsoluteJoyCoordinateZ = 0.00 then PPJoy1.Analog2 *= var.RecenterSpeedZ
- endif
- //Mouse Compensation
- //Failed attempt,(aside from obvious stuttering it hinders joystick movement as well)
- /*
- toggle(var.Toggle) = pressed(key.F2)
- if var.Toggle = true
- if Mouse.DirectInputX > 0 then FakeMouse.DirectInputX -= |Mouse.DirectInputX| else
- if Mouse.DirectInputX < 0 then FakeMouse.DirectInputX += |Mouse.DirectInputX|
- endif
- if var.Toggle = true
- if Mouse.DirectInputY > 0 then FakeMouse.DirectInputY -= |Mouse.DirectInputY| else
- if Mouse.DirectInputY < 0 then FakeMouse.DirectInputY += |Mouse.DirectInputY|
- endif
- */
- //---------------------
- /*
- if var.Toggle = true
- if RealMouse.DirectInputX > 0 then FakeMouse.DirectInputX -= delta(RealMouse.DirectInputX) else
- if RealMouse.DirectInputX < 0 then FakeMouse.DirectInputX += delta(RealMouse.DirectInputX)
- endif
- */
- //---------------------
- //An idea that didn't work out
- /*
- var.CompensationCoefficient = (|delta(Mouse.DirectInputX)| / var.MouseCompensation)
- if var.JoyCoordinateX > 0 then PPJoy1.Analog2 -= var.CompensationCoefficient else
- if var.JoyCoordinateX < 0 then PPJoy1.Analog2 += var.CompensationCoefficient
- endif
- */
- var.Debug = Mouse.DirectInputX
- if Pressed (Key.F1)
- Say var.Debug
- endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement