mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-14 19:25:16 -05:00
Fix Incorrect playerId use
This commit is contained in:
parent
34a6e16385
commit
8ca227c219
1 changed files with 5 additions and 24 deletions
|
@ -53,7 +53,8 @@ class Save
|
||||||
public function new(?data:RawSaveData)
|
public function new(?data:RawSaveData)
|
||||||
{
|
{
|
||||||
if (data == null) this.data = Save.getDefault();
|
if (data == null) this.data = Save.getDefault();
|
||||||
else this.data = data;
|
else
|
||||||
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDefault():RawSaveData
|
public static function getDefault():RawSaveData
|
||||||
|
@ -559,9 +560,9 @@ class Save
|
||||||
switch (inputType)
|
switch (inputType)
|
||||||
{
|
{
|
||||||
case Keys:
|
case Keys:
|
||||||
return (playerId == 0) ? data?.options?.controls?.p1.keyboard : data?.options?.controls?.p2.keyboard;
|
return (playerId == 1) ? data?.options?.controls?.p1.keyboard : data?.options?.controls?.p2.keyboard;
|
||||||
case Gamepad(_):
|
case Gamepad(_):
|
||||||
return (playerId == 0) ? data?.options?.controls?.p1.gamepad : data?.options?.controls?.p2.gamepad;
|
return (playerId == 1) ? data?.options?.controls?.p1.gamepad : data?.options?.controls?.p2.gamepad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,27 +577,7 @@ class Save
|
||||||
|
|
||||||
public function setControls(playerId:Int, inputType:Device, controls:SaveControlsData):Void
|
public function setControls(playerId:Int, inputType:Device, controls:SaveControlsData):Void
|
||||||
{
|
{
|
||||||
switch (inputType)
|
getControls(playerId, inputType) = controls;
|
||||||
{
|
|
||||||
case Keys:
|
|
||||||
if (playerId == 0)
|
|
||||||
{
|
|
||||||
data.options.controls.p1.keyboard = controls;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data.options.controls.p2.keyboard = controls;
|
|
||||||
}
|
|
||||||
case Gamepad(_):
|
|
||||||
if (playerId == 0)
|
|
||||||
{
|
|
||||||
data.options.controls.p1.gamepad = controls;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data.options.controls.p2.gamepad = controls;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue