forked from Ports/perfect_dark
Merge pull request #196 from NeonNyan/1.2_analog
1.2 + 1 Analog Controls
This commit is contained in:
24 files changed
+543
-173
No files matched your search
@@ -48,10 +48,12 @@ void amTick(void)
|
||||
s8 gotonextscreen = false;
|
||||
s8 cstickx = joyGetStickXOnSample(j, contpadnum);
|
||||
s8 csticky = joyGetStickYOnSample(j, contpadnum);
|
||||
s8 crstickx = joyGetRStickXOnSample(j, contpadnum);
|
||||
s8 crsticky = joyGetRStickYOnSample(j, contpadnum);
|
||||
s8 absstickx;
|
||||
s8 abssticky;
|
||||
u16 buttonsstate = joyGetButtonsOnSample(j, contpadnum, 0xffff);
|
||||
u16 buttonspressed = joyGetButtonsPressedOnSample(j, contpadnum, 0xffff);
|
||||
u32 buttonsstate = joyGetButtonsOnSample(j, contpadnum, 0xffffffff);
|
||||
u32 buttonspressed = joyGetButtonsPressedOnSample(j, contpadnum, 0xffffffff);
|
||||
bool stickpushed = false;
|
||||
s32 slotnum;
|
||||
bool stayopen;
|
||||
@@ -77,8 +79,8 @@ 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)am->mousex;
|
||||
const s32 newsticky = (s32)csticky - (s32)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;
|
||||
}
|
||||
@@ -88,6 +90,8 @@ void amTick(void)
|
||||
buttonsstate = buttonsstate & D_JPAD;
|
||||
cstickx = 0;
|
||||
csticky = 0;
|
||||
crstickx = 0;
|
||||
crsticky = 0;
|
||||
buttonspressed = 0;
|
||||
}
|
||||
|
||||
@@ -162,8 +166,8 @@ void amTick(void)
|
||||
s8 contpadnum2 = optionsGetContpadNum2(g_Vars.currentplayerstats->mpindex);
|
||||
s8 cstickx2 = joyGetStickXOnSample(j, contpadnum2);
|
||||
s8 csticky2 = joyGetStickYOnSample(j, contpadnum2);
|
||||
u16 buttonsstate2 = joyGetButtonsOnSample(j, contpadnum2, 0xffff);
|
||||
u16 buttonspressed2 = joyGetButtonsPressedOnSample(j, contpadnum2, 0xffff);
|
||||
u32 buttonsstate2 = joyGetButtonsOnSample(j, contpadnum2, 0xffffffff);
|
||||
u32 buttonspressed2 = joyGetButtonsPressedOnSample(j, contpadnum2, 0xffffffff);
|
||||
|
||||
if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) {
|
||||
buttonsstate2 = buttonsstate2 & D_JPAD;
|
||||
|
||||
+14
-3
@@ -701,8 +701,8 @@ void eyespyProcessInput(bool allowbuttons)
|
||||
s8 c2stickx;
|
||||
s8 c1sticky = joyGetStickY(contpad1);
|
||||
s8 c2sticky;
|
||||
u16 c1buttons = allowbuttons ? joyGetButtons(contpad1, 0xffff) : 0;
|
||||
u16 c2buttons;
|
||||
u32 c1buttons = allowbuttons ? joyGetButtons(contpad1, 0xffffffff) : 0;
|
||||
u32 c2buttons;
|
||||
bool domovecentre = true;
|
||||
s32 controlmode = optionsGetControlMode(g_Vars.currentplayerstats->mpindex);
|
||||
|
||||
@@ -726,10 +726,15 @@ void eyespyProcessInput(bool allowbuttons)
|
||||
c2stickx = joyGetStickX(contpad2);
|
||||
c2sticky = joyGetStickY(contpad2);
|
||||
|
||||
c2buttons = allowbuttons ? joyGetButtons(contpad2, 0xffff) : 0;
|
||||
c2buttons = allowbuttons ? joyGetButtons(contpad2, 0xffffffff) : 0;
|
||||
} else {
|
||||
#ifndef PLATFORM_N64
|
||||
c2stickx = joyGetRStickX(contpad1);
|
||||
c2sticky = joyGetRStickY(contpad1);
|
||||
#else
|
||||
c2stickx = c1stickx;
|
||||
c2sticky = c1sticky;
|
||||
#endif
|
||||
c2buttons = c1buttons;
|
||||
}
|
||||
|
||||
@@ -833,9 +838,15 @@ void eyespyProcessInput(bool allowbuttons)
|
||||
} else {
|
||||
ascendspeed = c1sticky * 0.25f;
|
||||
forwardspeed = (c1buttons & (U_CBUTTONS) ? 24.0f : 0) - (c1buttons & (D_CBUTTONS) ? 24.0f : 0);
|
||||
#ifndef PLATFORM_N64
|
||||
forwardspeed += c2sticky;
|
||||
#endif
|
||||
}
|
||||
|
||||
sidespeed = (c1buttons & (R_CBUTTONS) ? 1 : 0) - (c1buttons & (L_CBUTTONS) ? 1 : 0);
|
||||
#ifndef PLATFORM_N64
|
||||
if (!sidespeed) sidespeed = c2stickx * 0.0125f;
|
||||
#endif
|
||||
} else if (controlmode == CONTROLMODE_21 || controlmode == CONTROLMODE_23) {
|
||||
forwardspeed = c1sticky;
|
||||
|
||||
|
||||
+232
-65
@@ -43,6 +43,54 @@
|
||||
#include "video.h"
|
||||
#endif
|
||||
|
||||
void handleProcessInputAltButton(struct movedata *data, s8 contpad, s32 i){
|
||||
s32 buttons = joyGetButtonsOnSample(i, contpad, 0xffffffff);
|
||||
if (buttons & (BUTTON_ALTMODE)) {
|
||||
if (g_Vars.currentplayer->altdowntime >= -1) {
|
||||
if (buttons & (Z_TRIG)
|
||||
&& g_Vars.currentplayer->altdowntime >= 0
|
||||
&& bgunConsiderToggleGunFunction(g_Vars.currentplayer->altdowntime, true, false, true) != USETIMER_CONTINUE) {
|
||||
g_Vars.currentplayer->altdowntime = -3;
|
||||
}
|
||||
|
||||
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 (buttons & (BUTTON_CANCEL_USE | BUTTON_ACCEPT_USE)) {
|
||||
if (g_Vars.currentplayer->altdowntime >= -1) {
|
||||
if (buttons & (Z_TRIG)
|
||||
&& g_Vars.currentplayer->altdowntime >= 0
|
||||
&& bgunConsiderToggleGunFunction(g_Vars.currentplayer->altdowntime, true, false, true) != USETIMER_CONTINUE) {
|
||||
g_Vars.currentplayer->altdowntime = -3;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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;
|
||||
bgun0f0a8c50();
|
||||
}
|
||||
}
|
||||
|
||||
void bmoveSetControlDef(u32 controldef)
|
||||
{
|
||||
g_Vars.currentplayer->controldef = controldef;
|
||||
@@ -579,6 +627,7 @@ void bmoveResetMoveData(struct movedata *data)
|
||||
#ifndef PLATFORM_N64
|
||||
data->freelookdx = 0.0f;
|
||||
data->freelookdy = 0.0f;
|
||||
data->analoglean = 0.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -602,10 +651,10 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
s32 weaponnum;
|
||||
bool canmanualzoom;
|
||||
s32 result;
|
||||
u16 c1buttons;
|
||||
u16 c1buttonsthisframe;
|
||||
u16 c1allowedbuttons;
|
||||
u16 c1inhibitedbuttons;
|
||||
u32 c1buttons;
|
||||
u32 c1buttonsthisframe;
|
||||
u32 c1allowedbuttons;
|
||||
u32 c1inhibitedbuttons;
|
||||
u32 aimonhist[20];
|
||||
u32 aimoffhist[20];
|
||||
s32 numsamples;
|
||||
@@ -613,19 +662,19 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
f32 fVar25;
|
||||
s8 shootpad;
|
||||
s8 aimpad;
|
||||
u16 aimallowedbuttons;
|
||||
u16 shootallowedbuttons;
|
||||
u32 aimallowedbuttons;
|
||||
u32 shootallowedbuttons;
|
||||
s8 c2stickx;
|
||||
u16 c2buttons;
|
||||
u16 c2buttonsthisframe;
|
||||
u32 c2buttons;
|
||||
u32 c2buttonsthisframe;
|
||||
s32 i;
|
||||
s32 tmpc2sticky;
|
||||
u16 c2allowedbuttons;
|
||||
u32 c2allowedbuttons;
|
||||
s32 tmpc2stickx;
|
||||
s32 c2sticky;
|
||||
u16 shootbuttons;
|
||||
u16 aimbuttons;
|
||||
u16 invbuttons;
|
||||
u32 shootbuttons;
|
||||
u32 aimbuttons;
|
||||
u32 invbuttons;
|
||||
bool zoomout;
|
||||
bool zoomin;
|
||||
f32 increment;
|
||||
@@ -640,7 +689,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
s8 contpad2;
|
||||
s8 c1stickx;
|
||||
s8 c1sticky;
|
||||
u16 inhibitedbuttons;
|
||||
u32 inhibitedbuttons;
|
||||
bool offbike;
|
||||
bool cancycleweapons;
|
||||
u32 stack;
|
||||
@@ -658,19 +707,23 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
|
||||
c1stickx = allowc1x ? joyGetStickX(contpad1) : 0;
|
||||
c1sticky = allowc1y ? joyGetStickY(contpad1) : 0;
|
||||
#ifndef PLATFORM_N64
|
||||
c2stickx = allowc1x ? (s8) joyGetRStickX(contpad1) : 0;
|
||||
c2sticky = allowc1y ? (s8) joyGetRStickY(contpad1) : 0;
|
||||
#endif
|
||||
|
||||
c1buttons = allowc1buttons ? joyGetButtons(contpad1, 0xffff) : 0;
|
||||
c1buttonsthisframe = allowc1buttons ? joyGetButtonsPressedThisFrame(contpad1, 0xffff) : 0;
|
||||
c1buttons = allowc1buttons ? joyGetButtons(contpad1, 0xffffffff) : 0;
|
||||
c1buttonsthisframe = allowc1buttons ? joyGetButtonsPressedThisFrame(contpad1, 0xffffffff) : 0;
|
||||
|
||||
c1allowedbuttons = 0xffff;
|
||||
c1allowedbuttons = 0xffffffff;
|
||||
|
||||
if (g_Vars.currentplayer->joybutinhibit & 0xffff) {
|
||||
inhibitedbuttons = g_Vars.currentplayer->joybutinhibit & 0xffff;
|
||||
if (g_Vars.currentplayer->joybutinhibit & 0xffffffff) {
|
||||
inhibitedbuttons = g_Vars.currentplayer->joybutinhibit & 0xffffffff;
|
||||
c1allowedbuttons = ~inhibitedbuttons;
|
||||
inhibitedbuttons = joyGetButtons(contpad1, 0xffff) & inhibitedbuttons;
|
||||
inhibitedbuttons = joyGetButtons(contpad1, 0xffffffff) & inhibitedbuttons;
|
||||
c1buttons &= ~inhibitedbuttons;
|
||||
c1buttonsthisframe &= ~inhibitedbuttons;
|
||||
g_Vars.currentplayer->joybutinhibit = (g_Vars.currentplayer->joybutinhibit & 0xffff0000) | inhibitedbuttons;
|
||||
g_Vars.currentplayer->joybutinhibit = (g_Vars.currentplayer->joybutinhibit & 0x0) | inhibitedbuttons;
|
||||
}
|
||||
|
||||
numsamples = joyGetNumSamples();
|
||||
@@ -747,21 +800,22 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
contpad2 = (s8) optionsGetContpadNum2(g_Vars.currentplayerstats->mpindex);
|
||||
c2stickx = (s8) joyGetStickX(contpad2);
|
||||
c2sticky = (joyGetStickY(contpad2) << 24) >> 24;
|
||||
c2buttons = joyGetButtons(contpad2, 0xffff);
|
||||
c2buttonsthisframe = joyGetButtonsPressedThisFrame(contpad2, 0xffff);
|
||||
c2buttons = joyGetButtons(contpad2, 0xffffffff);
|
||||
c2buttonsthisframe = joyGetButtonsPressedThisFrame(contpad2, 0xffffffff);
|
||||
|
||||
tmpc2stickx = c2stickx;
|
||||
tmpc2sticky = c2sticky;
|
||||
|
||||
c2allowedbuttons = 0xffff;
|
||||
c2allowedbuttons = 0xffffffff;
|
||||
|
||||
if (g_Vars.currentplayer->joybutinhibit << 0 >> 16) {
|
||||
inhibitedbuttons = g_Vars.currentplayer->joybutinhibit >> 16;
|
||||
// NOTE: I'm not 100% sure of correctness here
|
||||
if (g_Vars.currentplayer->joybutinhibit << 0 >> 32) {
|
||||
inhibitedbuttons = g_Vars.currentplayer->joybutinhibit >> 32;
|
||||
c2allowedbuttons = ~inhibitedbuttons;
|
||||
inhibitedbuttons = joyGetButtons(contpad2, 0xffff) & inhibitedbuttons;
|
||||
inhibitedbuttons = joyGetButtons(contpad2, 0xffffffff) & inhibitedbuttons;
|
||||
c2buttons &= ~inhibitedbuttons;
|
||||
c2buttonsthisframe &= ~inhibitedbuttons;
|
||||
g_Vars.currentplayer->joybutinhibit = (g_Vars.currentplayer->joybutinhibit & 0xffff) | (inhibitedbuttons << 16);
|
||||
g_Vars.currentplayer->joybutinhibit = (g_Vars.currentplayer->joybutinhibit & 0xffffffff) | (inhibitedbuttons << 32);
|
||||
}
|
||||
|
||||
if (ignorec2) {
|
||||
@@ -1086,6 +1140,9 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
|
||||
movedata.rleanleft = false;
|
||||
movedata.rleanright = false;
|
||||
#ifndef PLATFORM_N64
|
||||
movedata.analoglean = 0.f;
|
||||
#endif
|
||||
|
||||
// Handle mine detonation
|
||||
if ((((c1buttons & A_BUTTON) && (c1buttonsthisframe & B_BUTTON))
|
||||
@@ -1137,6 +1194,16 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
aimbuttons = R_TRIG;
|
||||
invbuttons = A_BUTTON;
|
||||
}
|
||||
#ifndef PLATFORM_N64
|
||||
if (!g_Vars.currentplayer->insightaimmode) {
|
||||
movedata.analogstrafe = c2stickx;
|
||||
movedata.analogwalk = c2sticky;
|
||||
movedata.unk14 = 1;
|
||||
} else {
|
||||
movedata.analogstrafe = 0.f;
|
||||
movedata.analogwalk = 0.f;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (optionsGetAimControl(g_Vars.currentplayerstats->mpindex) == AIMCONTROL_HOLD) {
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
@@ -1189,13 +1256,21 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
|
||||
movedata.digitalstepforward = !g_Vars.currentplayer->insightaimmode && (c1buttons & (U_CBUTTONS));
|
||||
movedata.digitalstepback = !g_Vars.currentplayer->insightaimmode && (c1buttons & (D_CBUTTONS));
|
||||
movedata.canlookahead = false;
|
||||
movedata.canlookahead = !g_Vars.currentplayer->insightaimmode;
|
||||
movedata.cannaturalpitch = !g_Vars.currentplayer->insightaimmode;
|
||||
movedata.speedvertadown = 0;
|
||||
movedata.speedvertaup = 0;
|
||||
movedata.cannaturalturn = !g_Vars.currentplayer->insightaimmode;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if ((g_Vars.currentplayer->devicesactive & DEVICE_EYESPY) || g_Vars.currentplayer->visionmode > 1 || g_Vars.tickmode != 1) {
|
||||
movedata.analogturn = 0;
|
||||
movedata.analogpitch = 0;
|
||||
movedata.analogstrafe = 0;
|
||||
movedata.analogwalk = 0;
|
||||
movedata.analoglean = 0.f;
|
||||
}
|
||||
|
||||
if (g_PlayerMouseAimMode == MOUSEAIM_LOCKED || bgunGetWeaponNum(HAND_RIGHT) == WEAPON_HORIZONSCANNER) {
|
||||
movedata.cannaturalpitch = movedata.cannaturalpitch || (movedata.freelookdy != 0.0f);
|
||||
movedata.cannaturalturn = movedata.cannaturalturn || (movedata.freelookdx != 0.0f);
|
||||
@@ -1212,6 +1287,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
#ifndef PLATFORM_N64
|
||||
movedata.freelookdx = 0.0f;
|
||||
movedata.freelookdy = 0.0f;
|
||||
movedata.analoglean = 0.f;
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
@@ -1244,7 +1320,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
}
|
||||
|
||||
movedata.cannaturalturn = !g_Vars.currentplayer->insightaimmode;
|
||||
movedata.unk14 = 0;
|
||||
movedata.unk14 = !g_Vars.currentplayer->insightaimmode;
|
||||
|
||||
if (g_Vars.tickmode == TICKMODE_AUTOWALK) {
|
||||
movedata.analogstrafe = 0;
|
||||
@@ -1254,6 +1330,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
#ifndef PLATFORM_N64
|
||||
movedata.freelookdx = 0.0f;
|
||||
movedata.freelookdy = 0.0f;
|
||||
movedata.analoglean = 0.f;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1424,42 +1501,45 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (allowc1buttons) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
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 {
|
||||
// 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;
|
||||
bgun0f0a8c50();
|
||||
}
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
handleProcessInputAltButton(&movedata, contpad1, i);
|
||||
}
|
||||
// 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;
|
||||
// }
|
||||
//
|
||||
// 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 {
|
||||
// // 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;
|
||||
// bgun0f0a8c50();
|
||||
// }
|
||||
// }
|
||||
|
||||
// Handle ALT1 / MI Reload Hack
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
@@ -1493,8 +1573,78 @@ 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) {
|
||||
increment = 1;
|
||||
zoomout = c1buttons & (D_CBUTTONS);
|
||||
zoomin = c1buttons & (U_CBUTTONS);
|
||||
|
||||
// @bug? Should this be HAND_RIGHT?
|
||||
if (bgunGetWeaponNum(HAND_LEFT) == WEAPON_FARSIGHT) {
|
||||
increment = 0.5f;
|
||||
}
|
||||
|
||||
if (zoomout) {
|
||||
movedata.zoomoutfovpersec = increment;
|
||||
}
|
||||
|
||||
if (zoomin) {
|
||||
movedata.zoominfovpersec = increment;
|
||||
}
|
||||
|
||||
if (c2sticky < 0) {
|
||||
movedata.zoomoutfovpersec = -c2sticky / 70.0f;
|
||||
|
||||
if (movedata.zoomoutfovpersec > 1) {
|
||||
movedata.zoomoutfovpersec = 1;
|
||||
}
|
||||
|
||||
movedata.zoomoutfovpersec = movedata.zoomoutfovpersec + movedata.zoomoutfovpersec;
|
||||
}
|
||||
|
||||
if (c2sticky > 0) {
|
||||
movedata.zoominfovpersec = c2sticky / 70.0f;
|
||||
|
||||
if (movedata.zoominfovpersec > 1) {
|
||||
movedata.zoominfovpersec = 1;
|
||||
}
|
||||
|
||||
movedata.zoominfovpersec = movedata.zoominfovpersec + movedata.zoominfovpersec;
|
||||
}
|
||||
}
|
||||
|
||||
// // Handle xbla-style crouch cycling
|
||||
for (i = 0; i < numsamples; i++) {
|
||||
s32 crouchsample = joyGetButtonsPressedOnSample(i, contpad1, 0xffffffff) & BUTTON_CROUCH_CYCLE;
|
||||
if (crouchsample) {
|
||||
if (g_Vars.currentplayer->crouchpos <= 0) {
|
||||
g_Vars.currentplayer->crouchpos = CROUCHPOS_STAND;
|
||||
} else {
|
||||
g_Vars.currentplayer->crouchpos--;
|
||||
}
|
||||
}
|
||||
|
||||
// handle 1964GEPD style crouch setting
|
||||
crouchsample = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons) & BUTTON_HALF_CROUCH;
|
||||
if (crouchsample) {
|
||||
if (g_Vars.currentplayer->crouchpos == CROUCHPOS_DUCK) {
|
||||
g_Vars.currentplayer->crouchpos = CROUCHPOS_STAND;
|
||||
} else {
|
||||
g_Vars.currentplayer->crouchpos = CROUCHPOS_DUCK;
|
||||
}
|
||||
}
|
||||
|
||||
crouchsample = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons) & BUTTON_FULL_CROUCH;
|
||||
if (crouchsample) {
|
||||
if (g_Vars.currentplayer->crouchpos == CROUCHPOS_SQUAT) {
|
||||
g_Vars.currentplayer->crouchpos = CROUCHPOS_STAND;
|
||||
} else {
|
||||
g_Vars.currentplayer->crouchpos = CROUCHPOS_SQUAT;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Handle manual zoom in and out (sniper, farsight and horizon scanner)
|
||||
if (canmanualzoom && g_Vars.currentplayer->insightaimmode) {
|
||||
increment = 1;
|
||||
@@ -1561,6 +1711,8 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Handle shutting eyes in multiplayer
|
||||
if (bmoveGetCrouchPos() == CROUCHPOS_SQUAT
|
||||
@@ -1574,9 +1726,20 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
|
||||
if (bgunGetWeaponNum(HAND_RIGHT) == WEAPON_FARSIGHT) {
|
||||
movedata.farsighttempautoseek = g_Vars.currentplayer->insightaimmode && (c1buttons & (L_CBUTTONS | R_CBUTTONS));
|
||||
if (g_Vars.currentplayer->insightaimmode) {
|
||||
movedata.unk14 = 1;
|
||||
#ifndef PLATFORM_N64
|
||||
movedata.analogstrafe = c2stickx;
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
movedata.rleanleft = g_Vars.currentplayer->insightaimmode && (c1buttons & (L_CBUTTONS));
|
||||
movedata.rleanright = g_Vars.currentplayer->insightaimmode && (c1buttons & (R_CBUTTONS));
|
||||
#ifndef PLATFORM_N64
|
||||
if (g_Vars.currentplayer->insightaimmode) {
|
||||
movedata.analoglean = c2stickx / 127.f;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Handle mine detonation
|
||||
@@ -1634,7 +1797,11 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
movedata.triggeron = g_Vars.currentplayer->waitforzrelease == false
|
||||
&& (c1buttons & shootbuttons)
|
||||
&& g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED
|
||||
#ifdef PLATFORM_N64
|
||||
&& (c1buttons & invbuttons) == 0;
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (controlmode == CONTROLMODE_12 || controlmode == CONTROLMODE_14) {
|
||||
|
||||
+2
-2
@@ -1368,8 +1368,8 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl)
|
||||
|
||||
{
|
||||
s8 contpadnum = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex);
|
||||
u16 buttonsdown = joyGetButtons(contpadnum, 0xffff); \
|
||||
u16 buttonsthisframe = joyGetButtonsPressedThisFrame(contpadnum, 0xffff);
|
||||
u32 buttonsdown = joyGetButtons(contpadnum, 0xffffffff); \
|
||||
u32 buttonsthisframe = joyGetButtonsPressedThisFrame(contpadnum, 0xffffffff);
|
||||
s8 cstickx = joyGetStickX(contpadnum); \
|
||||
s8 csticky = joyGetStickY(contpadnum);
|
||||
s32 xpos;
|
||||
|
||||
+21
-5
@@ -120,6 +120,10 @@ void bwalkInit(void)
|
||||
}
|
||||
}
|
||||
|
||||
void bwalkSetSwayTargetf(f32 value) {
|
||||
g_Vars.currentplayer->swaytarget = value * 75.f;
|
||||
}
|
||||
|
||||
void bwalkSetSwayTarget(s32 value)
|
||||
{
|
||||
g_Vars.currentplayer->swaytarget = value * 75.0f;
|
||||
@@ -1294,12 +1298,11 @@ void bwalkApplyMoveData(struct movedata *data)
|
||||
bwalkUpdateSpeedSideways(1, 0.2f, data->digitalstepright);
|
||||
} else if (data->unk14 == false) {
|
||||
bwalkUpdateSpeedSideways(0, 0.2f, g_Vars.lvupdate60);
|
||||
}
|
||||
|
||||
if (data->unk14) {
|
||||
} else if (data->unk14){
|
||||
bwalkUpdateSpeedSideways(data->analogstrafe * 0.014285714365542f, 0.2f, g_Vars.lvupdate60);
|
||||
}
|
||||
|
||||
|
||||
// Forward/back
|
||||
if (data->digitalstepforward) {
|
||||
bwalkUpdateSpeedForwards(1, 1);
|
||||
@@ -1308,11 +1311,12 @@ void bwalkApplyMoveData(struct movedata *data)
|
||||
bwalkUpdateSpeedForwards(-1, 1);
|
||||
} else if (data->canlookahead == false) {
|
||||
bwalkUpdateSpeedForwards(0, 1);
|
||||
} else {
|
||||
bwalkUpdateSpeedForwards(data->analogwalk * 0.014285714365542f, 1);
|
||||
}
|
||||
|
||||
if (data->canlookahead) {
|
||||
bwalkUpdateSpeedForwards(data->analogwalk * 0.014285714365542f, 1);
|
||||
|
||||
if (data->canlookahead) {
|
||||
if (data->analogwalk > 60) {
|
||||
g_Vars.currentplayer->speedmaxtime60 += g_Vars.lvupdate60;
|
||||
} else {
|
||||
@@ -1345,6 +1349,17 @@ void bwalkApplyMoveData(struct movedata *data)
|
||||
g_Vars.currentplayer->speedmaxtime60 = 0;
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (data->rleanleft) {
|
||||
bwalkSetSwayTarget(-1);
|
||||
} else if (data->rleanright) {
|
||||
bwalkSetSwayTarget(1);
|
||||
} else if (fabsf(data->analoglean)) {
|
||||
bwalkSetSwayTargetf(data->analoglean);
|
||||
} else {
|
||||
bwalkSetSwayTarget(0);
|
||||
}
|
||||
#else
|
||||
if (data->rleanleft) {
|
||||
bwalkSetSwayTarget(-1);
|
||||
} else if (data->rleanright) {
|
||||
@@ -1352,6 +1367,7 @@ void bwalkApplyMoveData(struct movedata *data)
|
||||
} else {
|
||||
bwalkSetSwayTarget(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
while (data->crouchdown-- > 0) {
|
||||
bwalkAdjustCrouchPos(-1);
|
||||
|
||||
+1
-1
@@ -538,7 +538,7 @@ void debug0f11944cnb(void) // not called
|
||||
}
|
||||
#endif
|
||||
|
||||
bool debugProcessInput(s8 stickx, s8 sticky, u16 buttons, u16 buttonsthisframe)
|
||||
bool debugProcessInput(s8 stickx, s8 sticky, u32 buttons, u32 buttonsthisframe)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
s32 i;
|
||||
|
||||
+8
-8
@@ -2130,22 +2130,22 @@ void lvTick(void)
|
||||
bgunTickBoost();
|
||||
hudmsgsTick();
|
||||
|
||||
if ((joyGetButtonsPressedThisFrame(0, 0xffff) != 0
|
||||
if ((joyGetButtonsPressedThisFrame(0, 0xffffffff) != 0
|
||||
|| joyGetStickX(0) > 10
|
||||
|| joyGetStickX(0) < -10
|
||||
|| joyGetStickY(0) > 10
|
||||
|| joyGetStickY(0) < -10
|
||||
|| joyGetButtonsPressedThisFrame(1, 0xffff) != 0
|
||||
|| joyGetButtonsPressedThisFrame(1, 0xffffffff) != 0
|
||||
|| joyGetStickX(1) > 10
|
||||
|| joyGetStickX(1) < -10
|
||||
|| joyGetStickY(1) > 10
|
||||
|| joyGetStickY(1) < -10
|
||||
|| joyGetButtonsPressedThisFrame(2, 0xffff) != 0
|
||||
|| joyGetButtonsPressedThisFrame(2, 0xffffffff) != 0
|
||||
|| joyGetStickX(2) > 10
|
||||
|| joyGetStickX(2) < -10
|
||||
|| joyGetStickY(2) > 10
|
||||
|| joyGetStickY(2) < -10
|
||||
|| joyGetButtonsPressedThisFrame(3, 0xffff) != 0
|
||||
|| joyGetButtonsPressedThisFrame(3, 0xffffffff) != 0
|
||||
|| joyGetStickX(3) > 10
|
||||
|| joyGetStickX(3) < -10
|
||||
|| joyGetStickY(3) > 10
|
||||
@@ -2159,22 +2159,22 @@ void lvTick(void)
|
||||
}
|
||||
|
||||
if (g_Vars.stagenum < STAGE_TITLE && !g_IsTitleDemo && !g_Vars.in_cutscene) {
|
||||
if (joyGetButtons(0, 0xffff) == 0
|
||||
if (joyGetButtons(0, 0xffffffff) == 0
|
||||
&& joyGetStickX(0) < 10
|
||||
&& joyGetStickX(0) > -10
|
||||
&& joyGetStickY(0) < 10
|
||||
&& joyGetStickY(0) > -10
|
||||
&& joyGetButtons(1, 0xffff) == 0
|
||||
&& joyGetButtons(1, 0xffffffff) == 0
|
||||
&& joyGetStickX(1) < 10
|
||||
&& joyGetStickX(1) > -10
|
||||
&& joyGetStickY(1) < 10
|
||||
&& joyGetStickY(1) > -10
|
||||
&& joyGetButtons(2, 0xffff) == 0
|
||||
&& joyGetButtons(2, 0xffffffff) == 0
|
||||
&& joyGetStickX(2) < 10
|
||||
&& joyGetStickX(2) > -10
|
||||
&& joyGetStickY(2) < 10
|
||||
&& joyGetStickY(2) > -10
|
||||
&& joyGetButtons(3, 0xffff) == 0
|
||||
&& joyGetButtons(3, 0xffffffff) == 0
|
||||
&& joyGetStickX(3) < 10
|
||||
&& joyGetStickX(3) > -10
|
||||
&& joyGetStickY(3) < 10
|
||||
|
||||
+15
-2
@@ -4612,8 +4612,10 @@ void menuProcessInput(void)
|
||||
for (i = 0; i < numcontpads; i++) {
|
||||
s8 thisstickx = joyGetStickX(contpadnums[i]);
|
||||
s8 thissticky = joyGetStickY(contpadnums[i]);
|
||||
u16 buttons = joyGetButtons(contpadnums[i], 0xffff);
|
||||
u16 buttonsnow = joyGetButtonsPressedThisFrame(contpadnums[i], 0xffff);
|
||||
s8 thisrstickx = joyGetRStickX(contpadnums[i]);
|
||||
s8 thisrsticky = joyGetRStickY(contpadnums[i]);
|
||||
u32 buttons = joyGetButtons(contpadnums[i], 0xffffffff);
|
||||
u32 buttonsnow = joyGetButtonsPressedThisFrame(contpadnums[i], 0xffffffff);
|
||||
|
||||
if (buttonsnow & A_BUTTON) {
|
||||
inputs.select = 1;
|
||||
@@ -4650,9 +4652,20 @@ void menuProcessInput(void)
|
||||
stickx = thisstickx;
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if ((stickx < 0 ? -stickx : stickx) < (thisrstickx < 0 ? -thisrstickx : thisrstickx)) {
|
||||
stickx = thisrstickx;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((sticky < 0 ? -sticky : sticky) < (thissticky < 0 ? -thissticky : thissticky)) {
|
||||
sticky = thissticky;
|
||||
}
|
||||
#ifndef PLATFORM_N64
|
||||
if ((sticky < 0 ? -sticky : sticky) < (thisrsticky < 0 ? -thisrsticky : thisrsticky)) {
|
||||
sticky = thisrsticky;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (buttons & U_CBUTTONS) {
|
||||
yhelddir = -1;
|
||||
|
||||
+2
-2
@@ -334,7 +334,7 @@ void menuTick(void)
|
||||
if (g_MenuData.root == MENUROOT_MPSETUP || g_MenuData.root == MENUROOT_4MBMAINMENU) {
|
||||
// Check if player is joining the game
|
||||
bool canjoin;
|
||||
u16 buttons = joyGetButtonsPressedThisFrame(i, 0xffff);
|
||||
u32 buttons = joyGetButtonsPressedThisFrame(i, 0xffffffff);
|
||||
|
||||
if (g_MenuData.root == MENUROOT_4MBMAINMENU) {
|
||||
if (g_Vars.mpsetupmenu == MPSETUPMENU_GENERAL) {
|
||||
@@ -428,7 +428,7 @@ void menuTick(void)
|
||||
// Note that MPENDSCREEN also refers to coop and anti modes.
|
||||
// Handle re-opening the endscreen by pressing B.
|
||||
if (g_MenuData.root == MENUROOT_MPENDSCREEN) {
|
||||
u16 buttons2 = joyGetButtonsPressedThisFrame(g_PlayerConfigsArray[i].contpad1, 0xffff);
|
||||
u32 buttons2 = joyGetButtonsPressedThisFrame(g_PlayerConfigsArray[i].contpad1, 0xffffffff);
|
||||
|
||||
if (buttons2 & B_BUTTON) {
|
||||
s32 playernum = -1;
|
||||
|
||||
+19
-5
@@ -1897,7 +1897,7 @@ void playerTickCutscene(bool arg0)
|
||||
f32 fovy;
|
||||
s32 endframe;
|
||||
s8 contpadnum = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex);
|
||||
u16 buttons;
|
||||
u32 buttons;
|
||||
#if PAL
|
||||
u8 stack3[0x2c];
|
||||
#endif
|
||||
@@ -1910,7 +1910,7 @@ void playerTickCutscene(bool arg0)
|
||||
f32 sp54[4];
|
||||
|
||||
if (arg0) {
|
||||
buttons = joyGetButtons(contpadnum, 0xffff);
|
||||
buttons = joyGetButtons(contpadnum, 0xffffffff);
|
||||
} else {
|
||||
buttons = 0;
|
||||
}
|
||||
@@ -2029,7 +2029,7 @@ void playerTickCutscene(bool arg0)
|
||||
}
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (g_CutsceneCurTotalFrame60f > 30 && (buttons & 0xffff)) {
|
||||
if (g_CutsceneCurTotalFrame60f > 30 && (buttons & 0xffffffff)) {
|
||||
g_CutsceneSkipRequested = true;
|
||||
|
||||
if (g_Vars.autocutplaying) {
|
||||
@@ -2042,7 +2042,7 @@ void playerTickCutscene(bool arg0)
|
||||
}
|
||||
#else
|
||||
if (g_CutsceneCurTotalFrame60f > 30) {
|
||||
if (buttons & 0xffff) {
|
||||
if (buttons & 0xffffffff) {
|
||||
g_CutsceneSkipRequested = true;
|
||||
}
|
||||
|
||||
@@ -3300,7 +3300,7 @@ void playerTick(bool arg0)
|
||||
if (g_Vars.currentplayer->eyespy->active) {
|
||||
// And is being controlled
|
||||
s8 contpad1 = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex);
|
||||
u16 buttons = arg0 ? joyGetButtons(contpad1, 0xffff) : 0;
|
||||
u32 buttons = arg0 ? joyGetButtons(contpad1, 0xffffffff) : 0;
|
||||
|
||||
if (g_Vars.currentplayer->isdead == false
|
||||
&& g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED
|
||||
@@ -3491,6 +3491,9 @@ void playerTick(bool arg0)
|
||||
s8 contpad2 = optionsGetContpadNum2(g_Vars.currentplayerstats->mpindex);
|
||||
s8 stickx = 0;
|
||||
s8 sticky = 0;
|
||||
#ifndef PLATFORM_N64
|
||||
s8 rsticky = joyGetRStickY(contpad1);
|
||||
#endif
|
||||
Mtxf sp1fc;
|
||||
Mtxf sp1bc;
|
||||
Mtxf sp17c;
|
||||
@@ -3507,6 +3510,7 @@ void playerTick(bool arg0)
|
||||
f32 sp11c[3];
|
||||
#endif
|
||||
bool explode = false;
|
||||
// NOTE: slayer handling
|
||||
bool slow = false;
|
||||
bool pause = false;
|
||||
f32 newspeed;
|
||||
@@ -3659,6 +3663,16 @@ void playerTick(bool arg0)
|
||||
targetspeed = 12;
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
targetspeed += rsticky / 127.f * 12.f;
|
||||
if (targetspeed > 12) {
|
||||
targetspeed = 12;
|
||||
}
|
||||
if (targetspeed < 1) {
|
||||
targetspeed = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
newspeed = prevspeed;
|
||||
|
||||
if (prevspeed < targetspeed) {
|
||||
|
||||
+4
-4
@@ -731,7 +731,7 @@ void titleTickPdLogo(void)
|
||||
titleSetNextMode(TITLEMODE_SKIP);
|
||||
}
|
||||
|
||||
if (joyGetButtonsPressedThisFrame(0, 0xffff)) {
|
||||
if (joyGetButtonsPressedThisFrame(0, 0xffffffff)) {
|
||||
g_TitleButtonPressed = g_TitleFastForward = true;
|
||||
|
||||
if (g_TitleTimer < TICKS(549)) {
|
||||
@@ -1694,7 +1694,7 @@ void titleTickRarePresents(void)
|
||||
|
||||
if (g_TitleTimer > TICKS(300)) {
|
||||
titleSetNextMode(TITLEMODE_PDLOGO);
|
||||
} else if (joyGetButtonsPressedThisFrame(0, 0xffff)) {
|
||||
} else if (joyGetButtonsPressedThisFrame(0, 0xffffffff)) {
|
||||
titleSetNextMode(TITLEMODE_SKIP);
|
||||
}
|
||||
}
|
||||
@@ -1848,7 +1848,7 @@ void titleTickNintendoLogo(void)
|
||||
g_TitleTimer += g_Vars.lvupdate60;
|
||||
}
|
||||
|
||||
if (joyGetButtonsPressedThisFrame(0, 0xffff)) {
|
||||
if (joyGetButtonsPressedThisFrame(0, 0xffffffff)) {
|
||||
if (osResetType == RESETTYPE_WARM) {
|
||||
g_TitleButtonPressed = true;
|
||||
titleSetNextMode(TITLEMODE_PDLOGO);
|
||||
@@ -2021,7 +2021,7 @@ void titleTickRareLogo(void)
|
||||
|
||||
g_TitleTimer += g_Vars.lvupdate60;
|
||||
|
||||
if (joyGetButtonsPressedThisFrame(0, 0xffff)) {
|
||||
if (joyGetButtonsPressedThisFrame(0, 0xffffffff)) {
|
||||
if (osResetType == RESETTYPE_WARM) {
|
||||
g_TitleButtonPressed = true;
|
||||
titleSetNextMode(TITLEMODE_PDLOGO);
|
||||
|
||||
@@ -4689,6 +4689,10 @@ enum weaponnum {
|
||||
#define BUTTON_RADIAL D_JPAD
|
||||
#define BUTTON_ALTMODE L_TRIG
|
||||
|
||||
#define BUTTON_CROUCH_CYCLE CONT_8000
|
||||
#define BUTTON_HALF_CROUCH CONT_4000
|
||||
#define BUTTON_FULL_CROUCH CONT_2000
|
||||
|
||||
#define MOUSEAIM_CLASSIC 0 // crosshair moves around the screen in aim mode
|
||||
#define MOUSEAIM_LOCKED 1 // crosshair locked to the center of the screen in aim mode
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
void bwalkInit(void);
|
||||
void bwalkSetSwayTarget(s32 value);
|
||||
void bwalkSetSwayTargetf(f32 value);
|
||||
void bwalkAdjustCrouchPos(s32 value);
|
||||
void bwalk0f0c3b38(struct coord *param_1, struct defaultobj *obj);
|
||||
s32 bwalkTryMoveUpwards(f32 amount);
|
||||
|
||||
@@ -46,7 +46,7 @@ void dmenuNavigateDown(void);
|
||||
Gfx *dmenuRender(Gfx *gdl);
|
||||
|
||||
void debugUpdateMenu(void);
|
||||
bool debugProcessInput(s8 stickx, s8 sticky, u16 buttons, u16 buttonsthisframe);
|
||||
bool debugProcessInput(s8 stickx, s8 sticky, u32 buttons, u32 buttonsthisframe);
|
||||
bool debugIsLineModeEnabled(void);
|
||||
|
||||
extern s32 var800786f4nb;
|
||||
|
||||
+10
-5
@@ -26,16 +26,21 @@ void joyReadData(void);
|
||||
void joysHandleRetrace(void);
|
||||
void joy00014810(bool value);
|
||||
s32 joyGetNumSamples(void);
|
||||
s32 joyGetRStickXOnSample(s32 samplenum, s8 contpadnum);
|
||||
s32 joyGetRStickYOnSample(s32 samplenum, s8 contpadnum);
|
||||
s32 joyGetStickXOnSample(s32 samplenum, s8 contpadnum);
|
||||
s32 joyGetStickYOnSample(s32 samplenum, s8 contpadnum);
|
||||
s32 joyGetStickYOnSampleIndex(s32 samplenum, s8 contpadnum);
|
||||
u16 joyGetButtonsOnSample(s32 samplenum, s8 contpadnum, u16 mask);
|
||||
u16 joyGetButtonsPressedOnSample(s32 samplenum, s8 contpadnum, u16 mask);
|
||||
s32 joyCountButtonsOnSpecificSamples(u32 *arg0, s8 contpadnum, u16 mask);
|
||||
s32 joyGetRStickYOnSampleIndex(s32 samplenum, s8 contpadnum);
|
||||
u32 joyGetButtonsOnSample(s32 samplenum, s8 contpadnum, u32 mask);
|
||||
u32 joyGetButtonsPressedOnSample(s32 samplenum, s8 contpadnum, u32 mask);
|
||||
s32 joyCountButtonsOnSpecificSamples(u32 *arg0, s8 contpadnum, u32 mask);
|
||||
s8 joyGetStickX(s8 contpadnum);
|
||||
s8 joyGetStickY(s8 contpadnum);
|
||||
u16 joyGetButtons(s8 contpadnum, u16 mask);
|
||||
u16 joyGetButtonsPressedThisFrame(s8 contpadnum, u16 mask);
|
||||
s8 joyGetRStickX(s8 contpadnum);
|
||||
s8 joyGetRStickY(s8 contpadnum);
|
||||
u32 joyGetButtons(s8 contpadnum, u32 mask);
|
||||
u32 joyGetButtonsPressedThisFrame(s8 contpadnum, u32 mask);
|
||||
bool joyIsCyclicPollingEnabled(void);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
|
||||
@@ -5076,6 +5076,7 @@ struct movedata {
|
||||
#ifndef PLATFORM_N64
|
||||
/* */ f32 freelookdx; // how much the mouse moved ...
|
||||
/* */ f32 freelookdy; // ... scaled by sensitivity
|
||||
/* */ f32 analoglean; // how much we're trying to lean
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
+91
-16
@@ -45,8 +45,8 @@ struct joydata {
|
||||
s32 curstart;
|
||||
s32 nextlast;
|
||||
s32 nextsecondlast;
|
||||
u16 buttonspressed[NUM_PADS];
|
||||
u16 buttonsreleased[NUM_PADS];
|
||||
u32 buttonspressed[NUM_PADS];
|
||||
u32 buttonsreleased[NUM_PADS];
|
||||
s32 unk200;
|
||||
};
|
||||
|
||||
@@ -80,6 +80,8 @@ u32 var8005ee68 = 0;
|
||||
// when controller was disconnected or not ready.
|
||||
u32 g_JoyBadReadsStickX[NUM_PADS] = {0};
|
||||
u32 g_JoyBadReadsStickY[NUM_PADS] = {0};
|
||||
u32 g_JoyBadReadsRStickX[NUM_PADS] = {0};
|
||||
u32 g_JoyBadReadsRStickY[NUM_PADS] = {0};
|
||||
u32 g_JoyBadReadsButtons[NUM_PADS] = {0};
|
||||
u32 g_JoyBadReadsButtonsPressed[NUM_PADS] = {0};
|
||||
|
||||
@@ -438,8 +440,8 @@ void joyConsumeSamples(struct joydata *joydata)
|
||||
{
|
||||
s8 i;
|
||||
s32 samplenum;
|
||||
u16 buttons1;
|
||||
u16 buttons2;
|
||||
u32 buttons1;
|
||||
u32 buttons2;
|
||||
|
||||
joydata->curstart = joydata->curlast;
|
||||
joydata->curlast = joydata->nextlast;
|
||||
@@ -462,7 +464,12 @@ void joyConsumeSamples(struct joydata *joydata)
|
||||
&& joydata->samples[samplenum].pads[i].stick_x < 15
|
||||
&& joydata->samples[samplenum].pads[i].stick_x > -15
|
||||
&& joydata->samples[samplenum].pads[i].stick_y < 15
|
||||
&& joydata->samples[samplenum].pads[i].stick_y > -15) {
|
||||
&& joydata->samples[samplenum].pads[i].stick_y > -15
|
||||
&& joydata->samples[samplenum].pads[i].rstick_x < 15
|
||||
&& joydata->samples[samplenum].pads[i].rstick_x > -15
|
||||
&& joydata->samples[samplenum].pads[i].rstick_y < 15
|
||||
&& joydata->samples[samplenum].pads[i].rstick_y > -15
|
||||
) {
|
||||
g_JoyDisableCooldown[i] = 0;
|
||||
} else {
|
||||
g_JoyDisableCooldown[i]--;
|
||||
@@ -700,9 +707,11 @@ void joysHandleRetrace(void)
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < NUM_PADS; i++) {
|
||||
if (g_JoyBadReadsStickX[i] || g_JoyBadReadsStickY[i] || g_JoyBadReadsButtons[i] || g_JoyBadReadsButtonsPressed[i]) {
|
||||
if (g_JoyBadReadsStickX[i] || g_JoyBadReadsStickY[i] || g_JoyBadReadsRStickX[i] || g_JoyBadReadsRStickY[i] || g_JoyBadReadsButtons[i] || g_JoyBadReadsButtonsPressed[i]) {
|
||||
g_JoyBadReadsStickX[i] = 0;
|
||||
g_JoyBadReadsStickY[i] = 0;
|
||||
g_JoyBadReadsRStickX[i] = 0;
|
||||
g_JoyBadReadsRStickY[i] = 0;
|
||||
g_JoyBadReadsButtons[i] = 0;
|
||||
g_JoyBadReadsButtonsPressed[i] = 0;
|
||||
}
|
||||
@@ -724,6 +733,32 @@ s32 joyGetNumSamples(void)
|
||||
return (g_JoyDataPtr->curlast - g_JoyDataPtr->curstart + NUM_SAMPLES) % NUM_SAMPLES;
|
||||
}
|
||||
|
||||
s32 joyGetRStickXOnSample(s32 samplenum, s8 contpadnum) {
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
g_JoyBadReadsRStickX[contpadnum]++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (g_JoyDisableCooldown[contpadnum] > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return g_JoyDataPtr->samples[(g_JoyDataPtr->curstart + samplenum + 1) % NUM_SAMPLES].pads[contpadnum].rstick_x;
|
||||
}
|
||||
|
||||
s32 joyGetRStickYOnSample(s32 samplenum, s8 contpadnum) {
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
g_JoyBadReadsStickY[contpadnum]++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (g_JoyDisableCooldown[contpadnum] > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return g_JoyDataPtr->samples[(g_JoyDataPtr->curstart + samplenum + 1) % NUM_SAMPLES].pads[contpadnum].rstick_y;
|
||||
}
|
||||
|
||||
s32 joyGetStickXOnSample(s32 samplenum, s8 contpadnum)
|
||||
{
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
@@ -752,6 +787,20 @@ s32 joyGetStickYOnSample(s32 samplenum, s8 contpadnum)
|
||||
return g_JoyDataPtr->samples[(g_JoyDataPtr->curstart + samplenum + 1) % NUM_SAMPLES].pads[contpadnum].stick_y;
|
||||
}
|
||||
|
||||
s32 joyGetRStickYOnSampleIndex(s32 samplenum, s8 contpadnum)
|
||||
{
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
g_JoyBadReadsStickY[contpadnum]++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (g_JoyDisableCooldown[contpadnum] > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return g_JoyDataPtr->samples[(g_JoyDataPtr->curstart + samplenum) % NUM_SAMPLES].pads[contpadnum].rstick_y;
|
||||
}
|
||||
|
||||
s32 joyGetStickYOnSampleIndex(s32 samplenum, s8 contpadnum)
|
||||
{
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
@@ -766,9 +815,9 @@ s32 joyGetStickYOnSampleIndex(s32 samplenum, s8 contpadnum)
|
||||
return g_JoyDataPtr->samples[(g_JoyDataPtr->curstart + samplenum) % NUM_SAMPLES].pads[contpadnum].stick_y;
|
||||
}
|
||||
|
||||
u16 joyGetButtonsOnSample(s32 samplenum, s8 contpadnum, u16 mask)
|
||||
u32 joyGetButtonsOnSample(s32 samplenum, s8 contpadnum, u32 mask)
|
||||
{
|
||||
u16 button;
|
||||
u32 button;
|
||||
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
g_JoyBadReadsButtons[contpadnum]++;
|
||||
@@ -784,10 +833,10 @@ u16 joyGetButtonsOnSample(s32 samplenum, s8 contpadnum, u16 mask)
|
||||
return button & mask;
|
||||
}
|
||||
|
||||
u16 joyGetButtonsPressedOnSample(s32 samplenum, s8 contpadnum, u16 mask)
|
||||
u32 joyGetButtonsPressedOnSample(s32 samplenum, s8 contpadnum, u32 mask)
|
||||
{
|
||||
u16 button1;
|
||||
u16 button2;
|
||||
u32 button1;
|
||||
u32 button2;
|
||||
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
g_JoyBadReadsButtonsPressed[contpadnum]++;
|
||||
@@ -811,12 +860,12 @@ u16 joyGetButtonsPressedOnSample(s32 samplenum, s8 contpadnum, u16 mask)
|
||||
* For example, if checksamples[5] is nonzero and a button was pressed on
|
||||
* samplenum 5 which matches the mask, count is incremented.
|
||||
*/
|
||||
s32 joyCountButtonsOnSpecificSamples(u32 *checksamples, s8 contpadnum, u16 mask)
|
||||
s32 joyCountButtonsOnSpecificSamples(u32 *checksamples, s8 contpadnum, u32 mask)
|
||||
{
|
||||
s32 count = 0;
|
||||
s32 index = 0;
|
||||
s32 i;
|
||||
u16 button;
|
||||
u32 button;
|
||||
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
g_JoyBadReadsButtons[contpadnum]++;
|
||||
@@ -863,6 +912,32 @@ s8 joyGetStickX(s8 contpadnum)
|
||||
return g_JoyDataPtr->samples[g_JoyDataPtr->curlast].pads[contpadnum].stick_x;
|
||||
}
|
||||
|
||||
s8 joyGetRStickX(s8 contpadnum) {
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
g_JoyBadReadsRStickX[contpadnum]++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (g_JoyDisableCooldown[contpadnum] > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return g_JoyDataPtr->samples[g_JoyDataPtr->curlast].pads[contpadnum].rstick_x;
|
||||
}
|
||||
|
||||
s8 joyGetRStickY(s8 contpadnum) {
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
g_JoyBadReadsRStickY[contpadnum]++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (g_JoyDisableCooldown[contpadnum] > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return g_JoyDataPtr->samples[g_JoyDataPtr->curlast].pads[contpadnum].rstick_y;
|
||||
}
|
||||
|
||||
s8 joyGetStickY(s8 contpadnum)
|
||||
{
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
@@ -877,7 +952,7 @@ s8 joyGetStickY(s8 contpadnum)
|
||||
return g_JoyDataPtr->samples[g_JoyDataPtr->curlast].pads[contpadnum].stick_y;
|
||||
}
|
||||
|
||||
u16 joyGetButtons(s8 contpadnum, u16 mask)
|
||||
u32 joyGetButtons(s8 contpadnum, u32 mask)
|
||||
{
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
g_JoyBadReadsButtons[contpadnum]++;
|
||||
@@ -891,7 +966,7 @@ u16 joyGetButtons(s8 contpadnum, u16 mask)
|
||||
return g_JoyDataPtr->samples[g_JoyDataPtr->curlast].pads[contpadnum].button & mask;
|
||||
}
|
||||
|
||||
u16 joyGetButtonsPressedThisFrame(s8 contpadnum, u16 mask)
|
||||
u32 joyGetButtonsPressedThisFrame(s8 contpadnum, u32 mask)
|
||||
{
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
g_JoyBadReadsButtonsPressed[contpadnum]++;
|
||||
@@ -906,7 +981,7 @@ u16 joyGetButtonsPressedThisFrame(s8 contpadnum, u16 mask)
|
||||
}
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
u16 joyGetButtonsReleasedThisFrame(s8 contpadnum, u16 mask)
|
||||
u32 joyGetButtonsReleasedThisFrame(s8 contpadnum, u32 mask)
|
||||
{
|
||||
if (g_JoyDataPtr->unk200 < 0 && (g_JoyConnectedControllers >> contpadnum & 1) == 0) {
|
||||
g_JoyBadReadsButtonsPressed[contpadnum]++;
|
||||
|
||||
+2
-2
@@ -1028,11 +1028,11 @@ void mainTick(void)
|
||||
|
||||
#ifdef DEBUG
|
||||
if (g_MainIsDebugMenuOpen || joyGetButtons(0, U_CBUTTONS | D_CBUTTONS) == (U_CBUTTONS | D_CBUTTONS)) {
|
||||
g_MainIsDebugMenuOpen = debugProcessInput(joyGetStickX(0), joyGetStickY(0), joyGetButtons(0, 0xffff), joyGetButtonsPressedThisFrame(0, 0xffff));
|
||||
g_MainIsDebugMenuOpen = debugProcessInput(joyGetStickX(0), joyGetStickY(0), joyGetButtons(0, 0xffffffff), joyGetButtonsPressedThisFrame(0, 0xffffffff));
|
||||
} else if (joyGetButtons(0, START_BUTTON) == 0) {
|
||||
var80075d68 = var800786f4nb;
|
||||
} else {
|
||||
g_MainIsDebugMenuOpen = debugProcessInput(joyGetStickX(0), joyGetStickY(0), joyGetButtons(0, 0xffff), joyGetButtonsPressedThisFrame(0, 0xffff));
|
||||
g_MainIsDebugMenuOpen = debugProcessInput(joyGetStickX(0), joyGetStickY(0), joyGetButtons(0, 0xffffffff), joyGetButtonsPressedThisFrame(0, 0xffffffff));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ typedef struct
|
||||
/* 0x1 */ u8 txsize;
|
||||
/* 0x2 */ u8 rxsize;
|
||||
/* 0x3 */ u8 cmd;
|
||||
/* 0x4 */ u16 button;
|
||||
/* 0x4 */ u32 button;
|
||||
/* 0x6 */ s8 stick_x;
|
||||
/* 0x7 */ s8 stick_y;
|
||||
} __OSContReadFormat;
|
||||
|
||||
Reference in new issue
Block a user