Merge branch 'port' of https://github.com/fgsfdsfgs/perfect_dark into port-debugger

This commit is contained in:
fgsfds committed 2023-10-22 15:25:42 +02:00
commit 10baed1ee1
33 files changed
+606 -194

No files matched your search

+21 -14
View File
@@ -34,22 +34,29 @@ You must already have a Perfect Dark ROM to run the game, as specified above.
## Controls
1964GEPD-style and Xbox-style bindings are partially implemented.
1964GEPD-style and Xbox-style bindings are implemented.
N64 pad buttons X and Y (or `X_BUTTON`, `Y_BUTTON` in the code) refer to the reserved buttons 0x40 and 0x80, which are also leveraged by 1964GEPD.
N64 pad buttons X and Y (or `X_BUTTON`, `Y_BUTTON` in the code) refer to the reserved buttons `0x40` and `0x80`, which are also leveraged by 1964GEPD.
| Action | Keyboard and mouse | Xbox pad | N64 pad |
| - | - | - | - |
| Fire / Accept | LMB/Space | RT | Z Trigger |
| Aim mode | RMB/Z | LT | R Trigger |
| Use / Cancel | E | N/A | B |
| Use / Accept | N/A | A | A |
| Reload | R | X | X `(0x40)` |
| Previous weapon | Mousewheel forward | B | D-Left |
| Next weapon | Mousewheel back | Y | Y `(0x80)` |
| Radial menu | Q | LB | D-Down |
| Alt fire mode | F | RB | L Trigger |
| Quick-detonate | E + Q | A + B | A + D-Left |
Support for one controller, two-stick configurations are enabled for 1.2.
| Action | Keyboard and mouse | Xbox pad | N64 pad |
| - | - | - | - |
| Fire / Accept | LMB/Space | RT | Z Trigger |
| Aim mode | RMB/Z | LT | R Trigger |
| Use / Cancel | E | N/A | B |
| Use / Accept | N/A | A | A |
| Crouch cycle | N/A | L3 | `0x80000000` (Extra) |
| Half-Crouch | Shift | N/A | `0x40000000` (Extra) |
| Full-Crouch | Control | N/A | `0x20000000` (Extra) |
| Reload | R | X | X `(0x40)` |
| Previous weapon | Mousewheel forward | B | D-Left |
| Next weapon | Mousewheel back | Y | Y `(0x80)` |
| Radial menu | Q | LB | D-Down |
| Alt fire mode | F | RB | L Trigger |
| Alt-fire oneshot | F + LMB or E + LMB | A + RT or RB + RT | A + Z, L + Z |
| Quick-detonate | E + Q | A + B | A + D-Left |
## Building
+33 -17
View File
@@ -57,7 +57,7 @@ typedef struct {
}OSContStatus;
typedef struct {
u16 button;
u32 button;
s8 stick_x; /* -80 <= stick_x <= 80 */
s8 stick_y; /* -80 <= stick_y <= 80 */
u8 errnum;
@@ -122,23 +122,39 @@ typedef struct {
#define CONT_EEPROM_BUSY 0x80
/* Buttons */
#define CONT_8000 0x80000000
#define CONT_4000 0x40000000
#define CONT_2000 0x20000000
#define CONT_1000 0x10000000
#define CONT_0800 0x08000000
#define CONT_0400 0x04000000
#define CONT_0200 0x02000000
#define CONT_0100 0x01000000
#define CONT_0080 0x00800000
#define CONT_0040 0x00400000
#define CONT_0020 0x00200000
#define CONT_0010 0x00100000
#define CONT_0008 0x00080000
#define CONT_0004 0x00040000
#define CONT_0002 0x00020000
#define CONT_0001 0x00010000
#define CONT_A 0x8000
#define CONT_B 0x4000
#define CONT_G 0x2000
#define CONT_START 0x1000
#define CONT_UP 0x0800
#define CONT_DOWN 0x0400
#define CONT_LEFT 0x0200
#define CONT_RIGHT 0x0100
#define CONT_EXTRA1 0x0080
#define CONT_EXTRA0 0x0040
#define CONT_L 0x0020
#define CONT_R 0x0010
#define CONT_E 0x0008
#define CONT_D 0x0004
#define CONT_C 0x0002
#define CONT_F 0x0001
#define CONT_A 0x00008000
#define CONT_B 0x00004000
#define CONT_G 0x00002000
#define CONT_START 0x00001000
#define CONT_UP 0x00000800
#define CONT_DOWN 0x00000400
#define CONT_LEFT 0x00000200
#define CONT_RIGHT 0x00000100
#define CONT_EXTRA1 0x00000080
#define CONT_EXTRA0 0x00000040
#define CONT_L 0x00000020
#define CONT_R 0x00000010
#define CONT_E 0x00000008
#define CONT_D 0x00000004
#define CONT_C 0x00000002
#define CONT_F 0x00000001
/* Nintendo's official button names */
+3
View File
@@ -2652,6 +2652,9 @@ static void gfx_run_dl(Gfx* cmd) {
// TODO: skyRender uses these to render some types of skies and skybox water
// by issuing low-level ucode commands G_TRI_FILL and G_TRI_SHADE_TXTR
break;
case G_RDPFLUSH_EXT:
gfx_flush();
break;
case G_RDPPIPESYNC:
case G_RDPFULLSYNC:
case G_RDPLOADSYNC:
+19 -3
View File
@@ -94,15 +94,30 @@ static void gfx_sdl_init(const char* game_name, const char* gfx_api_name, bool s
// ideally we need 3.0 compat
// if that doesn't work, try 3.2 core in case we're on mac, 2.1 compat as a last resort
static const u32 glver[][3] = {
static u32 glver[][3] = {
{ 0, 0, 0 }, // for command line override
{ 3, 0, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY },
{ 3, 2, SDL_GL_CONTEXT_PROFILE_CORE },
{ 2, 1, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY },
};
u32 glcore = false;
u32 verstart = 1;
const u32 verend = sizeof(glver) / sizeof(*glver);
const char *verstr = sysArgGetString("--gl-version");
if (verstr && *verstr) {
// user override
glver[0][2] = strstr(verstr, "core") ? SDL_GL_CONTEXT_PROFILE_CORE :
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
sscanf(verstr, "%d.%d", &glver[0][0], &glver[0][1]);
if (glver[0][0] >= 1 && glver[0][0] <= 4 && glver[0][1] < 9) {
verstart = 0;
}
}
ctx = NULL;
u32 vmin = 0, vmaj = 0;
for (u32 i = 0; i < sizeof(glver) / sizeof(*glver); ++i) {
for (u32 i = verstart; i < verend; ++i) {
vmaj = glver[i][0];
vmin = glver[i][1];
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, vmaj);
@@ -112,6 +127,7 @@ static void gfx_sdl_init(const char* game_name, const char* gfx_api_name, bool s
if (!ctx) {
sysLogPrintf(LOG_WARNING, "GL: could not create GL%d.%d context: %s", vmaj, vmin, SDL_GetError());
} else {
glcore = (glver[i][2] == SDL_GL_CONTEXT_PROFILE_CORE);
break;
}
}
@@ -119,7 +135,7 @@ static void gfx_sdl_init(const char* game_name, const char* gfx_api_name, bool s
if (!ctx) {
sysFatalError("Could not create an OpenGL context of any supported version.\nSDL error: %s", SDL_GetError());
} else {
sysLogPrintf(LOG_NOTE, "GL: created GL%d.%d context", vmaj, vmin);
sysLogPrintf(LOG_NOTE, "GL: created GL%d.%d%s context", vmaj, vmin, glcore ? "core" : "");
}
SDL_GL_MakeCurrent(wnd, ctx);
+14 -2
View File
@@ -12,7 +12,7 @@
#define CONT_STICK_YNEG 0x40000
#define CONT_STICK_YPOS 0x80000
#define CONT_NUM_BUTTONS 16 // not including the stick axes
#define CONT_NUM_BUTTONS 32 // not including the stick axes
enum virtkey {
/* same order as SDL scancodes */
@@ -63,6 +63,18 @@ enum contkey {
CK_STICK_XPOS,
CK_STICK_YNEG,
CK_STICK_YPOS,
CK_0010,
CK_0020,
CK_0040,
CK_0080,
CK_0100,
CK_0200,
CK_0400,
CK_0800,
CK_1000,
CK_2000,
CK_4000,
CK_8000,
CK_TOTAL_COUNT
};
@@ -85,7 +97,7 @@ s32 inputControllerMask(void);
s32 inputKeyPressed(u32 vk);
// idx is controller index, contbtn is one of the CONT_ constants
s32 inputButtonPressed(s32 idx, u16 contbtn);
s32 inputButtonPressed(s32 idx, u32 contbtn);
// bind virtkey vk to n64 pad #idx's button/axis ck as represented by its contkey value
// if bind is -1, picks a bind slot automatically
+2 -1
View File
@@ -13,7 +13,8 @@ enum LogLevel {
LOG_ERROR,
};
void sysInit(s32 argc, const char **argv);
void sysInitArgs(s32 argc, const char **argv);
void sysInit(void);
s32 sysArgCheck(const char *arg);
const char *sysArgGetString(const char *arg);
+1 -1
View File
@@ -11,7 +11,7 @@
#define CONFIG_MAX_STR 512
#define CONFIG_MAX_SECNAME 128
#define CONFIG_MAX_KEYNAME 256
#define CONFIG_MAX_SETTINGS 128
#define CONFIG_MAX_SETTINGS 256
struct configentry {
char key[CONFIG_MAX_KEYNAME + 1];
+3
View File
@@ -310,6 +310,9 @@ void crashInit(void)
void crashShutdown(void)
{
if (!g_CrashEnabled) {
return;
}
#ifdef PLATFORM_WIN32
if (prevExFilter) {
SetUnhandledExceptionFilter(prevExFilter);
+38 -15
View File
@@ -38,7 +38,7 @@ static f32 mouseSensY = 1.5f;
static f32 rumbleScale = 0.5f;
// NOTE: by default this gets inverted for 1.2
// NOTE: by default this gets inverted for 1.2: "right stick" here means left stick on your controller
static u32 axisMap[2][2] = {
{ SDL_CONTROLLER_AXIS_LEFTX, SDL_CONTROLLER_AXIS_LEFTY },
{ SDL_CONTROLLER_AXIS_RIGHTX, SDL_CONTROLLER_AXIS_RIGHTY },
@@ -78,6 +78,18 @@ static const char *ckNames[CK_TOTAL_COUNT] = {
"STICK_XPOS",
"STICK_YNEG",
"STICK_YPOS",
"CK_0010",
"CK_0020",
"CK_0040",
"CK_0080",
"CK_0100",
"CK_0200",
"CK_0400",
"CK_0800",
"CK_1000",
"CK_2000",
"CK_4000",
"CK_8000"
};
static const char *vkPunctNames[] = {
@@ -154,6 +166,8 @@ void inputSetDefaultKeyBinds(void)
{ CK_STICK_XPOS, SDL_SCANCODE_RIGHT, 0 },
{ CK_STICK_YNEG, SDL_SCANCODE_DOWN, 0 },
{ CK_STICK_YPOS, SDL_SCANCODE_UP, 0 },
{ CK_4000, SDL_SCANCODE_LSHIFT, 0 },
{ CK_2000, SDL_SCANCODE_LCTRL, 0 }
};
static const u32 joybinds[][2] = {
@@ -168,7 +182,7 @@ void inputSetDefaultKeyBinds(void)
{ CK_START, SDL_CONTROLLER_BUTTON_START },
{ CK_C_D, SDL_CONTROLLER_BUTTON_DPAD_DOWN },
{ CK_C_U, SDL_CONTROLLER_BUTTON_DPAD_UP },
{ CK_C_R, SDL_CONTROLLER_BUTTON_DPAD_RIGHT },
{ CK_8000, SDL_CONTROLLER_BUTTON_LEFTSTICK },
{ CK_C_L, SDL_CONTROLLER_BUTTON_DPAD_LEFT },
};
@@ -446,7 +460,7 @@ s32 inputInit(void)
stickSens[2] = configGetFloat("Input.RStickScaleX", 1.f);
stickSens[3] = configGetFloat("Input.RStickScaleY", 1.f);
stickCButtons = configGetInt("Input.StickCButtons", 1);
stickCButtons = configGetInt("Input.StickCButtons", 0);
if (configGetInt("Input.SwapSticks", 1)) {
// invert axis map
@@ -529,13 +543,6 @@ s32 inputReadController(s32 idx, OSContPad *npad)
rightX = inputAxisScale(rightX, deadzone[axisMap[1][0]], stickSens[axisMap[1][0]]);
rightY = inputAxisScale(rightY, deadzone[axisMap[1][1]], stickSens[axisMap[1][1]]);
if (stickCButtons) {
if (rightX < -0x4000) npad->button |= L_CBUTTONS;
if (rightX > +0x4000) npad->button |= R_CBUTTONS;
if (rightY < -0x4000) npad->button |= U_CBUTTONS;
if (rightY > +0x4000) npad->button |= D_CBUTTONS;
}
if (!npad->stick_x && leftX) {
npad->stick_x = leftX / 0x100;
}
@@ -545,9 +552,24 @@ s32 inputReadController(s32 idx, OSContPad *npad)
npad->stick_y = (stickY == 128) ? 127 : stickY;
}
stickY = -rightY / 0x100;
npad->rstick_y = (stickY == 128) ? 127 : stickY;
npad->rstick_x = rightX / 0x100;
if (stickCButtons) {
// rstick emulates C buttons
if (rightX < -0x4000) npad->button |= L_CBUTTONS;
if (rightX > +0x4000) npad->button |= R_CBUTTONS;
if (rightY < -0x4000) npad->button |= U_CBUTTONS;
if (rightY > +0x4000) npad->button |= D_CBUTTONS;
npad->rstick_x = 0;
npad->rstick_y = 0;
} else {
// rstick is an analog input
if (rightX) {
npad->rstick_x = rightX / 0x100;
}
s32 rStickY = -rightY / 0x100;
if (rStickY) {
npad->rstick_y = (rStickY == 128) ? 127 : rStickY;
}
}
return 0;
}
@@ -647,6 +669,7 @@ void inputKeyBind(s32 idx, u32 ck, s32 bind, u32 vk)
return;
}
if (bind < 0) {
for (s32 i = 0; i < MAX_BINDS; ++i) {
if (binds[idx][ck][i] == 0) {
@@ -686,7 +709,7 @@ s32 inputKeyPressed(u32 vk)
return 0;
}
static inline u16 inputContToContKey(const u16 cont)
static inline u32 inputContToContKey(const u32 cont)
{
if (cont == 0) {
return 0;
@@ -695,7 +718,7 @@ static inline u16 inputContToContKey(const u16 cont)
return 32 - __builtin_clz(cont - 1);
}
s32 inputButtonPressed(s32 idx, u16 contbtn)
s32 inputButtonPressed(s32 idx, u32 contbtn)
{
if (idx < 0 || idx >= INPUT_MAX_CONTROLLERS) {
return 0;
+2
View File
@@ -196,6 +196,8 @@ void osContGetReadData(OSContPad *pad)
pad->button = 0;
pad->stick_x = 0;
pad->stick_y = 0;
pad->rstick_x = 0;
pad->rstick_y = 0;
if (inputReadController(i, pad) < 0) {
pad->errnum = CONT_NO_RESPONSE_ERROR;
} else {
+8 -2
View File
@@ -75,6 +75,7 @@ static void gameLoadConfig(void)
g_PlayerMouseAimSpeedY = configGetFloatClamped("Game.MouseAimSpeedY", g_PlayerMouseAimSpeedY, 0.f, 10.f);
g_PlayerFovAffectsZoom = configGetIntClamped("Game.FovAffectsZoom", g_PlayerFovAffectsZoom, 0, 1);
g_PlayerFovZoomMultiplier = g_PlayerFovAffectsZoom ? g_PlayerDefaultFovY / 60.0f : 1.0f;
g_PlayerClassicCrouch = configGetIntClamped("Game.ClassicCrouch", 0, 0, 1);
g_ViShakeIntensityMult = configGetFloatClamped("Game.ScreenShakeIntensity", 1.f, 0.f, 100.f);
const s32 center = configGetIntClamped("Game.CenterHUD", 0, 0, 1);
if (center) {
@@ -85,8 +86,13 @@ static void gameLoadConfig(void)
int main(int argc, const char **argv)
{
crashInit();
sysInit(argc, argv);
sysInitArgs(argc, argv);
if (!sysArgCheck("--no-crash-handler")) {
crashInit();
}
sysInit();
fsInit();
configInit();
videoInit();
+6 -3
View File
@@ -19,12 +19,15 @@ static char logPath[2048];
static s32 sysArgc;
static const char **sysArgv;
void sysInit(s32 argc, const char **argv)
void sysInitArgs(s32 argc, const char **argv)
{
startTick = sysGetMicroseconds();
sysArgc = argc;
sysArgv = argv;
}
void sysInit(void)
{
startTick = sysGetMicroseconds();
if (sysArgCheck("--log")) {
// figure out where the log is and clear it
+10 -6
View File
@@ -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;
+20 -3
View File
@@ -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;
@@ -942,6 +953,12 @@ void eyespyProcessInput(bool allowbuttons)
g_Vars.currentplayer->eyespy->sintheta = sinf(g_Vars.currentplayer->eyespy->theta * 0.017453292384744f);
// Update verta
#ifndef PLATFORM_N64
// respect the invert pitch setting
if (optionsGetForwardPitch(g_Vars.currentplayerstats->mpindex)) {
pitchspeed = -pitchspeed;
}
#endif
g_Vars.currentplayer->eyespy->verta -= pitchspeed * 0.0625f * g_Vars.lvupdate60freal;
if (prevverta != g_Vars.currentplayer->eyespy->verta) {
+210 -72
View File
@@ -39,9 +39,56 @@
#include "data.h"
#include "types.h"
#ifndef PLATFORM_N64
#include <math.h>
#include "input.h"
#include "video.h"
#endif
static void bgunProcessInputAltButton(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) {
const bool trigpressed = (g_Vars.currentplayer->altdowntime == -3);
s32 result = bgunConsiderToggleGunFunction(g_Vars.currentplayer->altdowntime, trigpressed, 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();
}
}
#endif // PLATFORM_N64
void bmoveSetControlDef(u32 controldef)
{
@@ -579,6 +626,7 @@ void bmoveResetMoveData(struct movedata *data)
#ifndef PLATFORM_N64
data->freelookdx = 0.0f;
data->freelookdy = 0.0f;
data->analoglean = 0.0f;
#endif
}
@@ -602,10 +650,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 +661,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 +688,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 +706,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 +799,23 @@ 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: joybutinhibit used to store two copies of the 16-bit inhibited mask for some reason
// now it only stores one mask because it is 32 bits in size
if (g_Vars.currentplayer->joybutinhibit) {
inhibitedbuttons = g_Vars.currentplayer->joybutinhibit;
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 |= inhibitedbuttons;
}
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
}
}
@@ -1290,7 +1367,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
#ifndef PLATFORM_N64
// Handle turning and looking up/down via mouselook when aiming
if (g_Vars.currentplayer->insightaimmode && allowmcross) {
if (g_Vars.currentplayer->insightaimmode && allowmcross && bgunGetWeaponNum(HAND_RIGHT) != WEAPON_HORIZONSCANNER) {
if (g_Vars.currentplayer->swivelpos[0] > 0.9f) {
movedata.aimturnrightspeed = (g_Vars.currentplayer->swivelpos[0] - 0.9f) / 0.1f;
movedata.aimturnleftspeed = 0.f;
@@ -1425,40 +1502,8 @@ 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++) {
bgunProcessInputAltButton(&movedata, contpad1, i);
}
// Handle ALT1 / MI Reload Hack
@@ -1468,7 +1513,6 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
}
}
// Handle radial menu (D-Down)
for (i = 0; i < numsamples; i++) {
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & BUTTON_RADIAL)) {
@@ -1492,8 +1536,38 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
g_Vars.currentplayer->amdowntime = 0;
}
}
// 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;
}
}
}
}
#endif
// Handle manual zoom in and out (sniper, farsight and horizon scanner)
if (canmanualzoom && g_Vars.currentplayer->insightaimmode) {
@@ -1513,13 +1587,58 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
if (zoomin) {
movedata.zoominfovpersec = increment;
}
}
// Handle crouch and uncrouch
if (allowc1buttons) {
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;
}
}
#else
// 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;
}
}
#endif
// Handle C-button and analog crouch and uncrouch, if enabled
if (g_PlayerClassicCrouch && allowc1buttons) {
for (i = 0; i < numsamples; i++) {
if (!canmanualzoom && aimonhist[i]) {
if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (U_CBUTTONS))) {
bool goUp = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (U_CBUTTONS));
#ifndef PLATFORM_N64
goUp = goUp || ((joyGetRStickYOnSample(i, contpad1) > 30 && joyGetRStickYOnSampleIndex(i, contpad1) <= 30));
#endif
if (goUp) {
if (movedata.crouchdown) {
movedata.crouchdown--;
} else {
@@ -1529,7 +1648,11 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
g_Vars.currentplayer->aimtaptime = -1;
}
if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (D_CBUTTONS))) {
bool goDn = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (D_CBUTTONS));
#ifndef PLATFORM_N64
goDn = goDn || ((joyGetRStickYOnSample(i, contpad1) < -30 && joyGetRStickYOnSampleIndex(i, contpad1) >= -30));
#endif
if (goDn) {
if (movedata.crouchup) {
movedata.crouchup--;
} else {
@@ -1574,9 +1697,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 +1768,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) {
+24 -2
View File
@@ -715,6 +715,7 @@ Gfx *bviewDrawFisheye(Gfx *gdl, u32 colour, u32 alpha, s32 shuttertime60, s8 sta
#ifndef PLATFORM_N64
// make a copy of the current back buffer contents that we will be using as a texture
gDPFlushEXT(gdl++);
gDPCopyFramebufferEXT(gdl++, g_PrevFrameFb, 0, 0, 0, G_ON);
gDPSetFramebufferTextureEXT(gdl++, 0, 0, 0, g_PrevFrameFb);
#endif
@@ -1367,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;
@@ -2654,6 +2655,16 @@ Gfx *bviewDrawHorizonScanner(Gfx *gdl)
vsplit = 14;
}
#ifndef PLATFORM_N64
if (!videoFramebuffersSupported()) {
return gdl;
}
// make a copy of what we have drawn so far and use it as a texture
gDPFlushEXT(gdl++);
gDPCopyFramebufferEXT(gdl++, g_PrevFrameFb, 0, 0, 0, G_ON);
gDPSetFramebufferTextureEXT(gdl++, 0, 0, 0, g_PrevFrameFb);
#endif
// Iterate horizontal lines down the lens with a bit extra on top and bottom
for (liney = lenstop - 9; liney < lenstop + lensheight + vsplit + 9; liney++) {
if (liney < lenstop + lensheight && liney >= lenstop) {
@@ -2701,7 +2712,18 @@ Gfx *bviewDrawHorizonScanner(Gfx *gdl)
gDPSetColor(gdl++, G_SETENVCOLOR, colour);
#ifdef PLATFORM_N64
gdl = bviewCopyPixels(gdl, fb, liney, 5, liney, RANDOMFRAC() * range + 1, viewleft, viewwidth);
#else
const f32 xscale = RANDOMFRAC() * range + 1;
const f32 halfwidth = viewwidth / 2.f;
const s32 left = viewleft + halfwidth * (1.f - xscale);
const s32 right = viewleft + halfwidth * (1.f + xscale);
gSPImageRectangleEXT(gdl++,
left << 2, liney << 2, viewleft, liney,
right << 2, (liney + 1) << 2, viewleft + viewwidth, liney + 1,
0, videoGetNativeWidth(), videoGetNativeHeight());
#endif
}
return gdl;
+21 -5
View File
@@ -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
View File
@@ -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;
+9 -9
View File
@@ -2057,7 +2057,7 @@ void lvTick(void)
g_Vars.lvupdate240 = 0;
for (j = 0; j < PLAYERCOUNT(); j++) {
g_Vars.players[j]->joybutinhibit = 0xefffefff;
g_Vars.players[j]->joybutinhibit = 0xefffffff;
}
} else {
s32 slowmo = lvGetSlowMotionType();
@@ -2137,22 +2137,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
@@ -2166,22 +2166,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
View File
@@ -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
View File
@@ -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;
+25 -5
View File
@@ -211,6 +211,7 @@ f32 g_PlayerMouseAimSpeedX = 0.75f;
f32 g_PlayerMouseAimSpeedY = 0.75f;
s32 g_PlayerFovAffectsZoom = 1;
f32 g_PlayerFovZoomMultiplier = 1.0f;
s32 g_PlayerClassicCrouch = true;
#endif
/**
@@ -1898,7 +1899,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
@@ -1911,7 +1912,7 @@ void playerTickCutscene(bool arg0)
f32 sp54[4];
if (arg0) {
buttons = joyGetButtons(contpadnum, 0xffff);
buttons = joyGetButtons(contpadnum, 0xffffffff);
} else {
buttons = 0;
}
@@ -2030,7 +2031,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) {
@@ -2043,7 +2044,7 @@ void playerTickCutscene(bool arg0)
}
#else
if (g_CutsceneCurTotalFrame60f > 30) {
if (buttons & 0xffff) {
if (buttons & 0xffffffff) {
g_CutsceneSkipRequested = true;
}
@@ -3301,7 +3302,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
@@ -3492,6 +3493,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;
@@ -3508,6 +3512,7 @@ void playerTick(bool arg0)
f32 sp11c[3];
#endif
bool explode = false;
// NOTE: slayer handling
bool slow = false;
bool pause = false;
f32 newspeed;
@@ -3595,6 +3600,11 @@ void playerTick(bool arg0)
sp174 = -stickx * LVUPDATE60FREAL() * 0.00025f;
#ifndef PLATFORM_N64
// respect the invert pitch setting
if (optionsGetForwardPitch(g_Vars.currentplayerstats->mpindex)) {
sp178 = -sp178;
}
// mouse control
if (g_Vars.currentplayernum == 0) {
f32 mdx, mdy;
inputMouseGetScaledDelta(&mdx, &mdy);
@@ -3660,6 +3670,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
View File
@@ -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);
+4
View File
@@ -4690,6 +4690,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
+1
View File
@@ -542,6 +542,7 @@ extern f32 g_PlayerMouseAimSpeedX;
extern f32 g_PlayerMouseAimSpeedY;
extern s32 g_PlayerFovAffectsZoom;
extern f32 g_PlayerFovZoomMultiplier;
extern s32 g_PlayerClassicCrouch;
extern f32 g_ViShakeIntensityMult;
extern u32 g_TexFilter2D;
extern u32 g_HudAlignModeL;
+1
View File
@@ -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);
+1 -1
View File
@@ -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;
+3
View File
@@ -194,6 +194,7 @@
#define G_SETINTENSITY_EXT 0x40
#define G_COPYFB_EXT 0x41
#define G_IMAGERECT_EXT 0x42
#define G_RDPFLUSH_EXT 0x43
/* G_EXTRAGEOMETRYMODE flags */
@@ -292,6 +293,8 @@
#define gSPTextureRectangleEXT(p, xl, yl, xh, yh, tile, s, t, ds, dt) gSPTextureRectangleWideEXT(p, xl, yl, xh, yh, tile, s, t, ds, dt, G_OFF)
#define gSPTextureRectangleFlipEXT(p, xl, yl, xh, yh, tile, s, t, ds, dt) gSPTextureRectangleWideEXT(p, xl, yl, xh, yh, tile, s, t, ds, dt, G_ON)
#define gDPFlushEXT(pkt) gDPNoParam(pkt, G_RDPFLUSH_EXT)
#undef gDPFillRectangleScaled
#define gDPFillRectangleScaled(pkt, x1, y1, x2, y2) gDPFillRectangleEXT(pkt, (x1) * g_ScaleX, y1, (x2) * g_ScaleX, y2)
+10 -5
View File
@@ -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
+1
View File
@@ -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
View File
@@ -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
View File
@@ -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
+1 -1
View File
@@ -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;