mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-18 19:01:45 +02:00
#15 fix touch screen A/B buttons in the inventory; fix single/two players mode switching
This commit is contained in:
@@ -1156,11 +1156,13 @@ struct Inventory {
|
|||||||
|
|
||||||
#ifdef _OS_NX
|
#ifdef _OS_NX
|
||||||
// swap A/B keys for Nintendo (Japanese) UX style
|
// swap A/B keys for Nintendo (Japanese) UX style
|
||||||
|
if (Input::touchTimerVis == 0.0f) {
|
||||||
if (key == cAction) {
|
if (key == cAction) {
|
||||||
key = cInventory;
|
key = cInventory;
|
||||||
} else if (key == cInventory) {
|
} else if (key == cInventory) {
|
||||||
key = cAction;
|
key = cAction;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Input::lastState[playerIndex] == cInventory)
|
if (Input::lastState[playerIndex] == cInventory)
|
||||||
|
@@ -221,13 +221,12 @@ void joyUpdate() {
|
|||||||
|
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
|
|
||||||
u64 mDown = 0;
|
bool waitForSplit = false;
|
||||||
|
|
||||||
for (int i = 0; i < (joyIsSplit ? 2 : 1); i++) {
|
for (int i = 0; i < (joyIsSplit ? 2 : 1); i++) {
|
||||||
HidControllerID ctrl = (i == 0 ? CONTROLLER_P1_AUTO : CONTROLLER_PLAYER_2);
|
HidControllerID ctrl = (i == 0 ? CONTROLLER_P1_AUTO : CONTROLLER_PLAYER_2);
|
||||||
|
|
||||||
u64 mask = hidKeysDown(ctrl) | hidKeysHeld(ctrl);
|
u64 mask = hidKeysDown(ctrl) | hidKeysHeld(ctrl);
|
||||||
mDown |= mask;
|
|
||||||
|
|
||||||
for (int j = 1; j < jkMAX; j++) {
|
for (int j = 1; j < jkMAX; j++) {
|
||||||
if (j != jkSelect && j != jkStart) {
|
if (j != jkSelect && j != jkStart) {
|
||||||
@@ -244,13 +243,16 @@ void joyUpdate() {
|
|||||||
hidJoystickRead(&sR, ctrl, JOYSTICK_RIGHT);
|
hidJoystickRead(&sR, ctrl, JOYSTICK_RIGHT);
|
||||||
Input::setJoyPos(i, jkL, vec2(float(sL.dx), float(-sL.dy)) / 32767.0f);
|
Input::setJoyPos(i, jkL, vec2(float(sL.dx), float(-sL.dy)) / 32767.0f);
|
||||||
Input::setJoyPos(i, jkR, vec2(float(sR.dx), float(-sR.dy)) / 32767.0f);
|
Input::setJoyPos(i, jkR, vec2(float(sR.dx), float(-sR.dy)) / 32767.0f);
|
||||||
}
|
|
||||||
|
|
||||||
if ((mDown & (KEY_L | KEY_R)) == (KEY_L | KEY_R)) { // hold L and R to split/merge joy-con's
|
if ((mask & (KEY_L | KEY_R)) == (KEY_L | KEY_R)) { // hold L and R to split/merge joy-con's
|
||||||
if (joySplitTime + 1000 < osGetTime()) { // 1 sec timer
|
if (joySplitTime + 1000 < osGetTime()) { // 1 sec timer
|
||||||
joySplit(!joyIsSplit);
|
joySplit(!joyIsSplit);
|
||||||
}
|
}
|
||||||
} else {
|
waitForSplit = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!waitForSplit) {
|
||||||
joySplitTime = osGetTime();
|
joySplitTime = osGetTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user