From 589042ca38ae9b43b6dcb3ceb8fc147a2aa79289 Mon Sep 17 00:00:00 2001 From: Alessandro Proto Date: Fri, 28 Apr 2023 22:10:11 +0200 Subject: [PATCH] Revert "Add 2 new args to machine.vibrate" This reverts commit 86c433e966f2f020cc7b8171c25bab933a6ec9fa. --- Capy64/Runtime/Libraries/MachineLib.cs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Capy64/Runtime/Libraries/MachineLib.cs b/Capy64/Runtime/Libraries/MachineLib.cs index 7b08d6f..3eb55d5 100644 --- a/Capy64/Runtime/Libraries/MachineLib.cs +++ b/Capy64/Runtime/Libraries/MachineLib.cs @@ -189,20 +189,13 @@ public class MachineLib : IComponent { var L = Lua.FromIntPtr(state); - var lMotor = (float)L.CheckNumber(1); - var rMotor = (float)L.OptNumber(2, lMotor); + var left = (float)L.CheckNumber(1); + var right = (float)L.OptNumber(2, left); - var lTrigger = (float)L.OptNumber(3, 0); - var rTrigger = (float)L.OptNumber(4, lTrigger); - + left = Math.Clamp(left, 0, 1); + right = Math.Clamp(right, 0, 1); - lMotor = Math.Clamp(lMotor, 0, 1); - rMotor = Math.Clamp(rMotor, 0, 1); - - lTrigger = Math.Clamp(lTrigger, 0, 1); - rTrigger = Math.Clamp(rTrigger, 0, 1); - - GamePad.SetVibration(PlayerIndex.One, lMotor, rMotor, lTrigger, rTrigger); + GamePad.SetVibration(PlayerIndex.One, left, right); return 0; }