forked from Ports/perfect_dark
Address multiple extended input nits
- Q for radial menu - mapped remaining xbla buttons, but the menus follow switch controller handfeel - based on @Phnod's switch-weapons PR: https://github.com/fgsfdsfgs/perfect_dark/pull/57
This commit is contained in:
1 parent
3f6f0b3f9c
commit
f88493870a
8 files changed
+142
-75
No files matched your search
@@ -171,6 +171,36 @@ typedef struct {
|
||||
#define CONT_ERR_VOICE_NO_RESPONSE 15
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
|
||||
#define BUTTON_ACCEPT_WPNFORWARD CONT_A
|
||||
#define BUTTON_CANCEL_USE CONT_B
|
||||
|
||||
#define BUTTON_USE BUTTON_CANCEL_USE
|
||||
#define BUTTON_CANCEL BUTTON_CANCEL_USE
|
||||
#define BUTTON_RELOAD BUTTON_USE
|
||||
#define BUTTON_ACCEPT BUTTON_ACCEPT_WPNFORWARD
|
||||
#define BUTTON_WPNFORWARD BUTTON_ACCEPT_WPNFORWARD
|
||||
|
||||
#else
|
||||
|
||||
// xbla behavior
|
||||
#define BUTTON_ACCEPT_USE A_BUTTON
|
||||
// 1964 behavior
|
||||
#define BUTTON_CANCEL_USE B_BUTTON
|
||||
|
||||
#define BUTTON_RELOAD X_BUTTON
|
||||
// dedicated button for mousewheel / xbla parity
|
||||
#define BUTTON_WPNBACK L_JPAD
|
||||
// dedicated button for mousewheel / xbla parity
|
||||
#define BUTTON_WPNFORWARD Y_BUTTON
|
||||
#define BUTTON_RADIAL D_JPAD
|
||||
#define BUTTON_ALTMODE L_TRIG
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
+6
-9
@@ -57,18 +57,16 @@ void inputSetDefaultKeyBinds(void)
|
||||
{
|
||||
// TODO: make VK constants for all these
|
||||
static const u32 kbbinds[][3] = {
|
||||
{ CK_A, SDL_SCANCODE_Q, 0 },
|
||||
{ CK_B, SDL_SCANCODE_E, 0 },
|
||||
{ CK_X, SDL_SCANCODE_R, 0 },
|
||||
{ CK_Y, SDL_SCANCODE_R, 0 },
|
||||
{ CK_RTRIG, VK_MOUSE_RIGHT, SDL_SCANCODE_Z },
|
||||
{ CK_LTRIG, SDL_SCANCODE_F, SDL_SCANCODE_X },
|
||||
{ CK_ZTRIG, VK_MOUSE_LEFT, SDL_SCANCODE_SPACE },
|
||||
{ CK_START, SDL_SCANCODE_RETURN, SDL_SCANCODE_TAB },
|
||||
{ CK_DPAD_D, SDL_SCANCODE_G, VK_MOUSE_MIDDLE },
|
||||
{ CK_DPAD_D, SDL_SCANCODE_Q, VK_MOUSE_MIDDLE },
|
||||
{ CK_DPAD_U, 0, 0 },
|
||||
{ CK_DPAD_R, VK_MOUSE_WHEEL_UP, 0 },
|
||||
{ CK_DPAD_L, VK_MOUSE_WHEEL_DN, 0 },
|
||||
{ CK_Y, VK_MOUSE_WHEEL_DN, 0 },
|
||||
{ CK_DPAD_L, VK_MOUSE_WHEEL_UP, 0 },
|
||||
{ CK_C_D, SDL_SCANCODE_S, 0 },
|
||||
{ CK_C_U, SDL_SCANCODE_W, 0 },
|
||||
{ CK_C_R, SDL_SCANCODE_D, 0 },
|
||||
@@ -80,12 +78,11 @@ void inputSetDefaultKeyBinds(void)
|
||||
};
|
||||
|
||||
static const u32 joybinds[][2] = {
|
||||
// { CK_A, SDL_CONTROLLER_BUTTON_A },
|
||||
{ CK_B, SDL_CONTROLLER_BUTTON_A },
|
||||
{ CK_A, SDL_CONTROLLER_BUTTON_B },
|
||||
{ CK_X, SDL_CONTROLLER_BUTTON_X },
|
||||
{ CK_Y, SDL_CONTROLLER_BUTTON_BACK },
|
||||
{ CK_DPAD_L, SDL_CONTROLLER_BUTTON_Y, },
|
||||
{ CK_DPAD_R, SDL_CONTROLLER_BUTTON_B, },
|
||||
{ CK_Y, SDL_CONTROLLER_BUTTON_Y },
|
||||
{ CK_DPAD_L, SDL_CONTROLLER_BUTTON_B, },
|
||||
{ CK_DPAD_D, SDL_CONTROLLER_BUTTON_LEFTSHOULDER },
|
||||
{ CK_LTRIG, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER },
|
||||
{ CK_RTRIG, VK_JOY1_LTRIG - VK_JOY1_BEGIN },
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ void bbikeHandleActivate(void)
|
||||
bmoveSetMode(MOVEMODE_WALK);
|
||||
}
|
||||
|
||||
g_Vars.currentplayer->bondactivateorreload = 0;
|
||||
// g_Vars.currentplayer->bondactivateorreload = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -752,8 +752,13 @@ void eyespyProcessInput(bool allowbuttons)
|
||||
shootpressed = c1buttons & Z_TRIG;
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
exitpressed = (c1buttons | c2buttons) & A_BUTTON;
|
||||
activatepressed = (c1buttons | c2buttons) & B_BUTTON;
|
||||
#else
|
||||
exitpressed = (c1buttons | c2buttons) & BUTTON_ACCEPT_USE;
|
||||
activatepressed = (c1buttons | c2buttons) & BUTTON_CANCEL_USE;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Apply safe zone for c1stickx
|
||||
|
||||
+2
-2
@@ -891,9 +891,9 @@ void bgrabUpdateVertical(void)
|
||||
void bgrabHandleActivate(void)
|
||||
{
|
||||
if (currentPlayerTryMountHoverbike(g_Vars.currentplayer->grabbedprop)) {
|
||||
g_Vars.currentplayer->bondactivateorreload = 0;
|
||||
// g_Vars.currentplayer->bondactivateorreload = 0;
|
||||
} else {
|
||||
g_Vars.currentplayer->bondactivateorreload = 0;
|
||||
// g_Vars.currentplayer->bondactivateorreload = 0;
|
||||
bmoveSetMode(MOVEMODE_WALK);
|
||||
}
|
||||
}
|
||||
|
||||
+86
-62
@@ -903,14 +903,15 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & L_JPAD)) {
|
||||
#ifndef PLATFORM_N64
|
||||
if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_WPNFORWARD)) {
|
||||
movedata.weaponforwardoffset++;
|
||||
g_Vars.currentplayer->invdowntime = -1;
|
||||
} else
|
||||
if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & R_JPAD)) {
|
||||
} else if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_WPNBACK)) {
|
||||
movedata.weaponbackoffset++;
|
||||
g_Vars.currentplayer->invdowntime = -1;
|
||||
}
|
||||
#else
|
||||
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & A_BUTTON)
|
||||
|| joyGetButtonsOnSample(i, contpad2, c2allowedbuttons & A_BUTTON)) {
|
||||
if (g_Vars.currentplayer->invdowntime > -2) {
|
||||
@@ -937,10 +938,12 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
|
||||
g_Vars.currentplayer->invdowntime = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
// Handle B button activation
|
||||
if (allowc1buttons) {
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
@@ -982,6 +985,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Handle manual zoom in and out (sniper, farsight and horizon scanner)
|
||||
if (canmanualzoom && g_Vars.currentplayer->insightaimmode) {
|
||||
@@ -1283,14 +1287,15 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & L_JPAD)) {
|
||||
#ifndef PLATFORM_N64
|
||||
if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_WPNFORWARD)) {
|
||||
movedata.weaponforwardoffset++;
|
||||
g_Vars.currentplayer->invdowntime = -1;
|
||||
} else
|
||||
if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & R_JPAD)) {
|
||||
} else if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_WPNBACK)) {
|
||||
movedata.weaponbackoffset++;
|
||||
g_Vars.currentplayer->invdowntime = -1;
|
||||
}
|
||||
#else
|
||||
if (joyGetButtonsOnSample(i, contpad1, invbuttons & c1allowedbuttons)) {
|
||||
if (g_Vars.currentplayer->invdowntime > -2) {
|
||||
if (joyGetButtonsPressedOnSample(i, contpad1, shootbuttons & c1allowedbuttons)) {
|
||||
@@ -1318,10 +1323,12 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
|
||||
g_Vars.currentplayer->invdowntime = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
// Handle B button
|
||||
if (allowc1buttons) {
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
@@ -1364,75 +1371,92 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// handle L button
|
||||
for (i = 0; i< numsamples; i++) {
|
||||
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & L_TRIG)) {
|
||||
if (g_Vars.currentplayer->altdowntime >= -1) {
|
||||
if (joyGetButtonsPressedOnSample(i, contpad1, shootbuttons & c1allowedbuttons)
|
||||
&& g_Vars.currentplayer->altdowntime >= 0
|
||||
&& bgunConsiderToggleGunFunction(g_Vars.currentplayer->altdowntime, true, false, true) != USETIMER_CONTINUE) {
|
||||
g_Vars.currentplayer->altdowntime = -3;
|
||||
#ifndef PLATFORM_N64
|
||||
if (allowc1buttons) {
|
||||
// handle B / A: cancel_use
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & (BUTTON_CANCEL_USE | BUTTON_ACCEPT_USE))) {
|
||||
g_Vars.currentplayer->usedowntime++;
|
||||
} else {
|
||||
if (g_Vars.currentplayer->usedowntime > 0) {
|
||||
movedata.btapcount++;
|
||||
g_Vars.currentplayer->usedowntime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Vars.currentplayer->altdowntime != -4) {
|
||||
if (g_Vars.currentplayer->altdowntime <= 0) {
|
||||
g_Vars.currentplayer->altdowntime++;
|
||||
}
|
||||
// handle L button : alt switching
|
||||
for (i = 0; i< numsamples; i++) {
|
||||
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & BUTTON_ALTMODE)) {
|
||||
if (g_Vars.currentplayer->altdowntime >= -1) {
|
||||
if (joyGetButtonsPressedOnSample(i, contpad1, shootbuttons & c1allowedbuttons)
|
||||
&& g_Vars.currentplayer->altdowntime >= 0
|
||||
&& bgunConsiderToggleGunFunction(g_Vars.currentplayer->altdowntime, true, false, true) != USETIMER_CONTINUE) {
|
||||
g_Vars.currentplayer->altdowntime = -3;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (g_Vars.currentplayer->altdowntime == -2) {
|
||||
bgunConsiderToggleGunFunction(g_Vars.currentplayer->altdowntime, false, false, true);
|
||||
g_Vars.currentplayer->altdowntime = -4;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Released L
|
||||
if (g_Vars.currentplayer->altdowntime != 0) {
|
||||
s32 result = bgunConsiderToggleGunFunction(g_Vars.currentplayer->altdowntime, (g_Vars.currentplayer->altdowntime == -3 ? true: false), false, true);
|
||||
|
||||
if (result == USETIMER_STOP) {
|
||||
g_Vars.currentplayer->altdowntime = -1;
|
||||
} else if (result == USETIMER_REPEAT) {
|
||||
g_Vars.currentplayer->altdowntime = -2;
|
||||
}
|
||||
}
|
||||
g_Vars.currentplayer->altdowntime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle ALT1 / MI Reload Hack
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & X_BUTTON)) {
|
||||
movedata.alt1tapcount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Handle radial menu (D-Down)
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & D_JPAD)) {
|
||||
if (g_Vars.currentplayer->amdowntime < -2) {
|
||||
g_Vars.currentplayer->amdowntime += numsamples;
|
||||
|
||||
if (g_Vars.currentplayer->amdowntime > -3) {
|
||||
g_Vars.currentplayer->amdowntime = 0;
|
||||
if (g_Vars.currentplayer->altdowntime != -4) {
|
||||
if (g_Vars.currentplayer->altdowntime <= 0) {
|
||||
g_Vars.currentplayer->altdowntime++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (g_Vars.currentplayer->altdowntime == -2) {
|
||||
bgunConsiderToggleGunFunction(g_Vars.currentplayer->altdowntime, false, false, true);
|
||||
g_Vars.currentplayer->altdowntime = -4;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (g_Vars.currentplayer->amdowntime >= 0) {
|
||||
if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & D_JPAD)) {
|
||||
amOpen();
|
||||
g_Vars.currentplayer->amdowntime = -1;
|
||||
} else {
|
||||
g_Vars.currentplayer->amdowntime++;
|
||||
// Released L
|
||||
if (g_Vars.currentplayer->altdowntime != 0) {
|
||||
s32 result = bgunConsiderToggleGunFunction(g_Vars.currentplayer->altdowntime, (g_Vars.currentplayer->altdowntime == -3 ? true: false), false, true);
|
||||
|
||||
if (result == USETIMER_STOP) {
|
||||
g_Vars.currentplayer->altdowntime = -1;
|
||||
} else if (result == USETIMER_REPEAT) {
|
||||
g_Vars.currentplayer->altdowntime = -2;
|
||||
}
|
||||
}
|
||||
g_Vars.currentplayer->altdowntime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle ALT1 / MI Reload Hack
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & BUTTON_RELOAD)) {
|
||||
movedata.alt1tapcount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Handle radial menu (D-Down)
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & BUTTON_RADIAL)) {
|
||||
if (g_Vars.currentplayer->amdowntime < -2) {
|
||||
g_Vars.currentplayer->amdowntime += numsamples;
|
||||
|
||||
if (g_Vars.currentplayer->amdowntime > -3) {
|
||||
g_Vars.currentplayer->amdowntime = 0;
|
||||
}
|
||||
} else {
|
||||
if (g_Vars.currentplayer->amdowntime >= 0) {
|
||||
if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_RADIAL)) {
|
||||
amOpen();
|
||||
g_Vars.currentplayer->amdowntime = -1;
|
||||
} else {
|
||||
g_Vars.currentplayer->amdowntime++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
g_Vars.currentplayer->amdowntime = 0;
|
||||
}
|
||||
} else {
|
||||
g_Vars.currentplayer->amdowntime = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Handle manual zoom in and out (sniper, farsight and horizon scanner)
|
||||
if (canmanualzoom && g_Vars.currentplayer->insightaimmode) {
|
||||
|
||||
+1
-1
@@ -1280,7 +1280,7 @@ void bwalkUpdatePrevPos(void)
|
||||
void bwalkHandleActivate(void)
|
||||
{
|
||||
if (g_Vars.currentplayer->walkinitmove) {
|
||||
g_Vars.currentplayer->bondactivateorreload = 0;
|
||||
// g_Vars.currentplayer->bondactivateorreload = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4607,6 +4607,17 @@ void menuProcessInput(void)
|
||||
inputs.select = 1;
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
// this seems sensible to achieve 1964 parity
|
||||
if (buttonsnow & BUTTON_RADIAL) {
|
||||
inputs.select = 1;
|
||||
}
|
||||
// this will naturally feel nice w/ a switch layout
|
||||
// with the default mapping for weapon-back
|
||||
if (buttonsnow & BUTTON_WPNBACK) {
|
||||
inputs.select = 1;
|
||||
}
|
||||
#endif
|
||||
if (buttonsnow & B_BUTTON) {
|
||||
inputs.back = 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user