forked from Ports/perfect_dark
port: fix #204; allow players 2-4 to use lstick in radial menu
This commit is contained in:
1 parent
c8db5fa106
commit
50b74e4280
1 file changed
+12
-4
@@ -50,8 +50,14 @@ void amTick(void)
|
||||
s8 csticky = joyGetStickYOnSample(j, contpadnum);
|
||||
s8 crstickx = joyGetRStickXOnSample(j, contpadnum);
|
||||
s8 crsticky = joyGetRStickYOnSample(j, contpadnum);
|
||||
#ifdef AVOID_UB
|
||||
// if cstickx is -128, it will get negated and stored into absstickx, negating it again if it's 8 bit
|
||||
s32 absstickx;
|
||||
s32 abssticky;
|
||||
#else
|
||||
s8 absstickx;
|
||||
s8 abssticky;
|
||||
#endif
|
||||
u32 buttonsstate = joyGetButtonsOnSample(j, contpadnum, 0xffffffff);
|
||||
u32 buttonspressed = joyGetButtonsPressedOnSample(j, contpadnum, 0xffffffff);
|
||||
bool stickpushed = false;
|
||||
@@ -69,6 +75,8 @@ void amTick(void)
|
||||
g_AmMenus[g_AmIndex].allbots = false;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
s32 newstickx = (s32)cstickx + (s32)crstickx;
|
||||
s32 newsticky = (s32)csticky + (s32)crsticky;
|
||||
if (j == 0 && g_Vars.currentplayernum == 0 && inputMouseIsLocked()) {
|
||||
f32 mdx, mdy;
|
||||
struct activemenu *am = &g_AmMenus[g_AmIndex];
|
||||
@@ -79,11 +87,11 @@ void amTick(void)
|
||||
am->mousex = (am->mousex > 127.f) ? 127.f : (am->mousex < -128.f) ? -128.f : am->mousex;
|
||||
am->mousey = (am->mousey > 127.f) ? 127.f : (am->mousey < -128.f) ? -128.f : am->mousey;
|
||||
}
|
||||
const s32 newstickx = (s32)cstickx + (s32)crstickx + (s32)am->mousex;
|
||||
const s32 newsticky = (s32)csticky + (s32)crsticky - (s32)am->mousey;
|
||||
cstickx = (newstickx < -128) ? -128 : (newstickx > 127) ? 127 : newstickx;
|
||||
csticky = (newsticky < -128) ? -128 : (newsticky > 127) ? 127 : newsticky;
|
||||
newstickx += (s32)am->mousex;
|
||||
newsticky -= (s32)am->mousey;
|
||||
}
|
||||
cstickx = (newstickx < -128) ? -128 : (newstickx > 127) ? 127 : newstickx;
|
||||
csticky = (newsticky < -128) ? -128 : (newsticky > 127) ? 127 : newsticky;
|
||||
#endif
|
||||
|
||||
if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) {
|
||||
|
||||
Reference in new issue
Block a user