From 600dae58e26e07fc8d26ae831ebbebae77484619 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sun, 26 Nov 2023 18:07:35 +0100 Subject: [PATCH] port: allow using N64 control schemes change from Ext to another control scheme to activate note that this will require rebinding keys, as the default config is for the Ext scheme --- port/src/main.c | 1 + port/src/optionsmenu.c | 35 ++-- src/game/activemenutick.c | 47 +++-- src/game/bondbike.c | 22 ++- src/game/bondeyespy.c | 86 +++++---- src/game/bondgun.c | 15 +- src/game/bondmove.c | 376 ++++++++++++++++++------------------- src/game/bondview.c | 61 +++--- src/game/chraction.c | 3 +- src/game/gamefile.c | 32 +++- src/game/mainmenu.c | 21 ++- src/game/menu.c | 4 +- src/game/menuitem.c | 36 +++- src/game/mplayer/mplayer.c | 23 ++- src/game/mplayer/setup.c | 12 +- src/include/constants.h | 1 + src/include/types.h | 3 +- src/lib/joy.c | 3 +- 18 files changed, 470 insertions(+), 311 deletions(-) diff --git a/port/src/main.c b/port/src/main.c index b3b055079..642007beb 100644 --- a/port/src/main.c +++ b/port/src/main.c @@ -161,5 +161,6 @@ PD_CONSTRUCTOR static void gameConfigInit(void) configRegisterFloat(strFmt("Game.Player%d.RadialMenuSpeed", i), &g_PlayerExtCfg[j].radialmenuspeed, 0.f, 10.f); configRegisterFloat(strFmt("Game.Player%d.CrosshairSway", i), &g_PlayerExtCfg[j].crosshairsway, 0.f, 10.f); configRegisterInt(strFmt("Game.Player%d.CrouchMode", i), &g_PlayerExtCfg[j].crouchmode, 0, CROUCHMODE_TOGGLE_ANALOG); + configRegisterInt(strFmt("Game.Player%d.ExtendedControls", i), &g_PlayerExtCfg[j].extcontrols, 0, 1); } } diff --git a/port/src/optionsmenu.c b/port/src/optionsmenu.c index 265eb13cf..3017a0a49 100644 --- a/port/src/optionsmenu.c +++ b/port/src/optionsmenu.c @@ -886,22 +886,25 @@ struct menudialogdef g_ExtendedBindKeyMenuDialog = { struct menubind { u32 ck; const char *name; + const char *n64name; }; static const struct menubind menuBinds[] = { - { CK_ZTRIG, "Fire [ZT]\n" }, - { CK_LTRIG, "Fire Mode [LT]\n" }, - { CK_RTRIG, "Aim Mode [RT]\n" }, - { CK_A, "Use / Accept [A]\n" }, - { CK_B, "Use / Cancel [B]\n" }, - { CK_X, "Reload [X]\n" }, - { CK_Y, "Next Weapon [Y]\n" }, - { CK_DPAD_L, "Prev Weapon [DL]\n" }, - { CK_DPAD_D, "Radial Menu [DD]\n" }, - { CK_START, "Pause Menu [ST]\n" }, - { CK_8000, "Cycle Crouch [+]\n" }, - { CK_4000, "Half Crouch [+]\n" }, - { CK_2000, "Full Crouch [+]\n" }, + { CK_ZTRIG, "Fire [ZT]\n", "N64 Z Trigger\n" }, + { CK_LTRIG, "Fire Mode [LT]\n", "N64 L Trigger\n"}, + { CK_RTRIG, "Aim Mode [RT]\n", "N64 R Trigger\n" }, + { CK_A, "Use / Accept [A]\n", "N64 A Button\n" }, + { CK_B, "Use / Cancel [B]\n", "N64 B Button\n" }, + { CK_X, "Reload [X]\n", "N64 Ext X\n" }, + { CK_Y, "Next Weapon [Y]\n", "N64 Ext Y\n" }, + { CK_DPAD_U, "D-Pad Up [DU]\n", "N64 D-Pad Up\n" }, + { CK_DPAD_R, "D-Pad Right [DR]\n", "N64 D-Pad Right\n" }, + { CK_DPAD_L, "Prev Weapon [DL]\n", "N64 D-Pad Left\n" }, + { CK_DPAD_D, "Radial Menu [DD]\n", "N64 D-Pad Down\n" }, + { CK_START, "Pause Menu [ST]\n", "N64 Start\n" }, + { CK_8000, "Cycle Crouch [+]\n", "N64 Ext 8000\n" }, + { CK_4000, "Half Crouch [+]\n", "N64 Ext 4000\n" }, + { CK_2000, "Full Crouch [+]\n", "N64 Ext 2000\n" }, }; static const char *menutextBind(struct menuitem *item); @@ -932,6 +935,8 @@ struct menuitem g_ExtendedBindsMenuItems[] = { DEFINE_MENU_BIND(), DEFINE_MENU_BIND(), DEFINE_MENU_BIND(), + DEFINE_MENU_BIND(), + DEFINE_MENU_BIND(), { MENUITEMTYPE_SEPARATOR, 0, @@ -989,7 +994,9 @@ static MenuItemHandlerResult menuhandlerDoBind(s32 operation, struct menuitem *i static const char *menutextBind(struct menuitem *item) { - return menuBinds[item - g_ExtendedBindsMenuItems].name; + return g_PlayerExtCfg[g_ExtMenuPlayer].extcontrols ? + menuBinds[item - g_ExtendedBindsMenuItems].name : + menuBinds[item - g_ExtendedBindsMenuItems].n64name; } static MenuItemHandlerResult menuhandlerBind(s32 operation, struct menuitem *item, union handlerdata *data) diff --git a/src/game/activemenutick.c b/src/game/activemenutick.c index 39b66f02c..e5dabda84 100644 --- a/src/game/activemenutick.c +++ b/src/game/activemenutick.c @@ -44,6 +44,23 @@ void amTick(void) s8 contpadnum = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex); s32 numsamples = joyGetNumSamples(); s32 j; + u32 amask, lrtmask, umask, dmask, lmask, rmask; + + if (controlmode == CONTROLMODE_PC) { + amask = D_JPAD; + lrtmask = R_TRIG; + umask = U_CBUTTONS; + dmask = D_CBUTTONS; + lmask = L_CBUTTONS; + rmask = R_CBUTTONS; + } else { + amask = A_BUTTON; + lrtmask = L_TRIG | R_TRIG; + umask = U_JPAD | U_CBUTTONS; + dmask = D_JPAD | D_CBUTTONS; + lmask = L_JPAD | L_CBUTTONS; + rmask = R_JPAD | R_CBUTTONS; + } for (j = 0; j < numsamples; j++) { s8 gotonextscreen = false; @@ -94,7 +111,7 @@ void amTick(void) #endif if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) { - buttonsstate = buttonsstate & D_JPAD; + buttonsstate = buttonsstate & amask; cstickx = 0; csticky = 0; buttonspressed = 0; @@ -102,11 +119,11 @@ void amTick(void) // JPN fixes the bug that's documented in amChangeScreen if (controlmode == CONTROLMODE_13 || controlmode == CONTROLMODE_14) { - if ((buttonsstate & R_TRIG)) { + if (buttonsstate & (L_TRIG | R_TRIG)) { stayopen = true; } - if (buttonsstate & D_JPAD) { + if (buttonsstate & A_BUTTON) { #if VERSION >= VERSION_JPN_FINAL || !defined(PLATFORM_N64) if (g_Vars.currentplayer->numaibuddies > 0) { g_AmMenus[g_AmIndex].allbots = true; @@ -116,11 +133,11 @@ void amTick(void) #endif } } else { - if (buttonsstate & D_JPAD) { + if (buttonsstate & amask) { stayopen = true; } - if ((buttonsstate & R_TRIG)) { + if (buttonsstate & lrtmask) { #if VERSION >= VERSION_JPN_FINAL || !defined(PLATFORM_N64) if (g_Vars.currentplayer->numaibuddies > 0) { g_AmMenus[g_AmIndex].allbots = true; @@ -148,19 +165,19 @@ void amTick(void) amChangeScreen(0); } - if (buttonsstate & U_CBUTTONS) { + if (buttonsstate & umask) { row = 0; } - if (buttonsstate & D_CBUTTONS) { + if (buttonsstate & dmask) { row = 2; } - if (buttonsstate & L_CBUTTONS) { + if (buttonsstate & lmask) { column = 0; } - if (buttonsstate & R_CBUTTONS) { + if (buttonsstate & rmask) { column = 2; } @@ -175,13 +192,13 @@ void amTick(void) u32 buttonspressed2 = joyGetButtonsPressedOnSample(j, contpadnum2, 0xffffffff); if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) { - buttonsstate2 = buttonsstate2 & D_JPAD; + buttonsstate2 = buttonsstate2 & A_BUTTON; cstickx2 = 0; csticky2 = 0; buttonspressed2 = 0; } - if (buttonsstate2 & D_JPAD) { + if (buttonsstate2 & A_BUTTON) { stayopen = true; } @@ -189,19 +206,19 @@ void amTick(void) toggle = true; } - if (buttonsstate2 & U_CBUTTONS) { + if (buttonsstate2 & umask) { row = 0; } - if (buttonsstate2 & D_CBUTTONS) { + if (buttonsstate2 & dmask) { row = 2; } - if (buttonsstate2 & L_CBUTTONS) { + if (buttonsstate2 & lmask) { column = 0; } - if (buttonsstate2 & R_CBUTTONS) { + if (buttonsstate2 & rmask) { column = 2; } diff --git a/src/game/bondbike.c b/src/game/bondbike.c index ce29b43f5..a3104d83d 100644 --- a/src/game/bondbike.c +++ b/src/game/bondbike.c @@ -202,14 +202,24 @@ void bbikeApplyMoveData(struct movedata *data) s8 contnum = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex); f32 value1; f32 tmp; + s32 contmode = optionsGetControlMode(g_Vars.currentplayerstats->mpindex); - if ((optionsGetControlMode(g_Vars.currentplayerstats->mpindex) == CONTROLMODE_12 - || optionsGetControlMode(g_Vars.currentplayerstats->mpindex) == CONTROLMODE_14 - || optionsGetControlMode(g_Vars.currentplayerstats->mpindex) == CONTROLMODE_13 - || optionsGetControlMode(g_Vars.currentplayerstats->mpindex) == CONTROLMODE_11) + if ((contmode == CONTROLMODE_12 + || contmode == CONTROLMODE_14 + || contmode == CONTROLMODE_13 + || contmode == CONTROLMODE_11 + || contmode == CONTROLMODE_PC) && !lvIsPaused()) { - data->digitalstepleft = joyCountButtonsOnSpecificSamples(0, contnum, L_CBUTTONS); - data->digitalstepright = joyCountButtonsOnSpecificSamples(0, contnum,R_CBUTTONS); + u32 lmask, rmask; + if (contmode == CONTROLMODE_PC) { + lmask = L_CBUTTONS; + rmask = R_CBUTTONS; + } else { + lmask = L_JPAD | L_CBUTTONS; + rmask = R_JPAD | R_CBUTTONS; + } + data->digitalstepleft = joyCountButtonsOnSpecificSamples(0, contnum, lmask); + data->digitalstepright = joyCountButtonsOnSpecificSamples(0, contnum, rmask); } // Forward/back diff --git a/src/game/bondeyespy.c b/src/game/bondeyespy.c index fe281cc84..fe611a183 100644 --- a/src/game/bondeyespy.c +++ b/src/game/bondeyespy.c @@ -720,8 +720,21 @@ void eyespyProcessInput(bool allowbuttons) s32 contpad2; u32 stack[5]; f32 tmp; + u32 umask, dmask, lmask, rmask; - if (controlmode >= CONTROLMODE_21) { + if (controlmode == CONTROLMODE_PC) { + umask = U_CBUTTONS; + dmask = D_CBUTTONS; + lmask = L_CBUTTONS; + rmask = R_CBUTTONS; + } else { + umask = U_JPAD | U_CBUTTONS; + dmask = D_JPAD | D_CBUTTONS; + lmask = L_JPAD | L_CBUTTONS; + rmask = R_JPAD | R_CBUTTONS; + } + + if (controlmode >= CONTROLMODE_21 && controlmode < CONTROLMODE_PC) { contpad2 = (s8) optionsGetContpadNum2(g_Vars.currentplayerstats->mpindex); c2stickx = joyGetStickX(contpad2); c2sticky = joyGetStickY(contpad2); @@ -729,11 +742,15 @@ void eyespyProcessInput(bool allowbuttons) c2buttons = allowbuttons ? joyGetButtons(contpad2, 0xffffffff) : 0; } else { #ifndef PLATFORM_N64 - c2stickx = joyGetRStickX(contpad1); - c2sticky = joyGetRStickY(contpad1); + if (controlmode == CONTROLMODE_PC) { + c2stickx = joyGetRStickX(contpad1); + c2sticky = joyGetRStickY(contpad1); + } else #else - c2stickx = c1stickx; - c2sticky = c1sticky; + { + c2stickx = c1stickx; + c2sticky = c1sticky; + } #endif c2buttons = c1buttons; } @@ -743,16 +760,19 @@ void eyespyProcessInput(bool allowbuttons) shootpressed = c1buttons & A_BUTTON; exitpressed = c1buttons & R_TRIG; activatepressed = c1buttons & B_BUTTON; - } else if (controlmode <= CONTROLMODE_14) { + } else if (controlmode <= CONTROLMODE_14 || controlmode == CONTROLMODE_PC) { aimpressed = c1buttons & (R_TRIG); shootpressed = c1buttons & Z_TRIG; -#ifdef PLATFORM_N64 - exitpressed = (c1buttons | c2buttons) & A_BUTTON; - activatepressed = (c1buttons | c2buttons) & B_BUTTON; -#else - exitpressed = (c1buttons | c2buttons) & (BUTTON_WPNBACK | BUTTON_RADIAL); - activatepressed = (c1buttons | c2buttons) & (BUTTON_CANCEL_USE | BUTTON_ACCEPT_USE); +#ifndef PLATFORM_N64 + if (controlmode == CONTROLMODE_PC) { + exitpressed = (c1buttons | c2buttons) & (BUTTON_WPNBACK | BUTTON_RADIAL); + activatepressed = (c1buttons | c2buttons) & (BUTTON_CANCEL_USE | BUTTON_ACCEPT_USE); + } else #endif + { + exitpressed = (c1buttons | c2buttons) & A_BUTTON; + activatepressed = (c1buttons | c2buttons) & B_BUTTON; + } } else { if (controlmode >= CONTROLMODE_23) { aimpressed = c1buttons & Z_TRIG; @@ -829,23 +849,25 @@ void eyespyProcessInput(bool allowbuttons) forwardspeed = c1sticky; } - ascendspeed = (c1buttons & (U_CBUTTONS) ? 1 : 0) - (c1buttons & (D_CBUTTONS) ? 1 : 0); - sidespeed = (c1buttons & (R_CBUTTONS) ? 1 : 0) - (c1buttons & (L_CBUTTONS) ? 1 : 0); - } else if (controlmode <= CONTROLMODE_14) { + ascendspeed = (c1buttons & (U_CBUTTONS | U_JPAD) ? 1 : 0) - (c1buttons & (D_CBUTTONS | D_JPAD) ? 1 : 0); + sidespeed = (c1buttons & (R_CBUTTONS | R_JPAD) ? 1 : 0) - (c1buttons & (L_CBUTTONS | L_JPAD) ? 1 : 0); + } else if (controlmode <= CONTROLMODE_14 || controlmode == CONTROLMODE_PC) { if (aimpressed) { domovecentre = false; pitchspeed = c1sticky; } else { ascendspeed = c1sticky * 0.25f; - forwardspeed = (c1buttons & (U_CBUTTONS) ? 24.0f : 0) - (c1buttons & (D_CBUTTONS) ? 24.0f : 0); + forwardspeed = (c1buttons & umask ? 24.0f : 0) - (c1buttons & dmask ? 24.0f : 0); #ifndef PLATFORM_N64 - forwardspeed += c2sticky; + if (controlmode == CONTROLMODE_PC) { + forwardspeed += c2sticky; + } #endif } - sidespeed = (c1buttons & (R_CBUTTONS) ? 1 : 0) - (c1buttons & (L_CBUTTONS) ? 1 : 0); + sidespeed = (c1buttons & rmask ? 1 : 0) - (c1buttons & lmask ? 1 : 0); #ifndef PLATFORM_N64 - if (!sidespeed) sidespeed = c2stickx * 0.0125f; + if (!sidespeed && controlmode == CONTROLMODE_PC) sidespeed = c2stickx * 0.0125f; #endif } else if (controlmode == CONTROLMODE_21 || controlmode == CONTROLMODE_23) { forwardspeed = c1sticky; @@ -994,23 +1016,23 @@ void eyespyProcessInput(bool allowbuttons) // Make eyespy look horizontally if (domovecentre) { if (g_Vars.currentplayer->eyespy->verta > 0.0f && forwardspeed != 0) { -#ifdef PLATFORM_N64 - if (g_Vars.currentplayer->eyespy->verta < 180.0f) { - tmp = g_Vars.currentplayer->eyespy->verta; + if (controlmode != CONTROLMODE_PC) { + if (g_Vars.currentplayer->eyespy->verta < 180.0f) { + tmp = g_Vars.currentplayer->eyespy->verta; - for (i = 0; i < g_Vars.lvupdate60; i++) { - tmp *= 0.04f; - g_Vars.currentplayer->eyespy->verta -= tmp; - } - } else { - tmp = 360.0f - g_Vars.currentplayer->eyespy->verta; + for (i = 0; i < g_Vars.lvupdate60; i++) { + tmp *= 0.04f; + g_Vars.currentplayer->eyespy->verta -= tmp; + } + } else { + tmp = 360.0f - g_Vars.currentplayer->eyespy->verta; - for (i = 0; i < g_Vars.lvupdate60; i++) { - tmp *= 0.04f; - g_Vars.currentplayer->eyespy->verta += tmp; + for (i = 0; i < g_Vars.lvupdate60; i++) { + tmp *= 0.04f; + g_Vars.currentplayer->eyespy->verta += tmp; + } } } -#endif g_Vars.currentplayer->eyespy->cosverta = cosf(g_Vars.currentplayer->eyespy->verta * 0.017453292384744f); g_Vars.currentplayer->eyespy->sinverta = sinf(g_Vars.currentplayer->eyespy->verta * 0.017453292384744f); diff --git a/src/game/bondgun.c b/src/game/bondgun.c index efe979624..b614d2c33 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -250,8 +250,9 @@ void bgunRumble(s32 handnum, s32 weaponnum) bool contpad2hasrumble; s32 contpadtouse1; s32 contpadtouse2; + s32 controlmode = optionsGetControlMode(g_Vars.currentplayerstats->mpindex); - if (optionsGetControlMode(g_Vars.currentplayerstats->mpindex) >= CONTROLMODE_21) { + if (controlmode >= CONTROLMODE_21 && controlmode < CONTROLMODE_PC) { contpad1hasrumble = pakGetType(g_Vars.currentplayernum) == PAKTYPE_RUMBLE; contpad2hasrumble = pakGetType(g_Vars.currentplayernum + PLAYERCOUNT()) == PAKTYPE_RUMBLE; @@ -11798,16 +11799,20 @@ s32 bgunConsiderToggleGunFunction(s32 usedowntime, bool trigpressed, bool fromac void bgun0f0a8c50(void) { +#ifndef PLATFORM_N64 switch (bgunGetWeaponNum(HAND_RIGHT)) { case WEAPON_RCP120: case WEAPON_LAPTOPGUN: case WEAPON_DRAGON: case WEAPON_REMOTEMINE: - return; - default: - if (g_Vars.currentplayer->hands[HAND_RIGHT].activatesecondary == false) { - g_Vars.currentplayer->gunctrl.invertgunfunc = false; + if (PLAYER_EXTCFG().extcontrols) { + return; } + break; + } +#endif + if (g_Vars.currentplayer->hands[HAND_RIGHT].activatesecondary == false) { + g_Vars.currentplayer->gunctrl.invertgunfunc = false; } } diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 5e44e837a..5718ac203 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -639,8 +639,8 @@ void bmoveResetMoveData(struct movedata *data) data->analogpitch = 0; data->analogstrafe = 0; data->analogwalk = 0; - data->alt1tapcount = 0; #ifndef PLATFORM_N64 + data->alt1tapcount = 0; data->freelookdx = 0.0f; data->freelookdy = 0.0f; data->analoglean = 0.0f; @@ -712,9 +712,9 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i f32 increment2; f32 newverta; #ifndef PLATFORM_N64 + const f32 mlookscale = g_Vars.lvupdate240 ? (4.f / (f32)g_Vars.lvupdate240) : 4.f; const bool allowmlook = (g_Vars.currentplayernum == 0) && (allowc1x || allowc1y); bool allowmcross = false; - const f32 mlookscale = g_Vars.lvupdate240 ? (4.f / (f32)g_Vars.lvupdate240) : 4.f; #endif controlmode = optionsGetControlMode(g_Vars.currentplayerstats->mpindex); @@ -984,15 +984,16 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } } else { for (i = 0; i < numsamples; i++) { -#ifndef PLATFORM_N64 - if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_WPNFORWARD)) { - movedata.weaponforwardoffset++; - g_Vars.currentplayer->invdowntime = -1; - } else if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_WPNBACK)) { - movedata.weaponbackoffset++; - g_Vars.currentplayer->invdowntime = -1; + if (controlmode == CONTROLMODE_PC) { + if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_WPNFORWARD)) { + movedata.weaponforwardoffset++; + g_Vars.currentplayer->invdowntime = -1; + } else if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_WPNBACK)) { + movedata.weaponbackoffset++; + g_Vars.currentplayer->invdowntime = -1; + } + continue; } -#else if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & A_BUTTON) || joyGetButtonsOnSample(i, contpad2, c2allowedbuttons & A_BUTTON)) { if (g_Vars.currentplayer->invdowntime > -2) { @@ -1004,7 +1005,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i if (g_Vars.currentplayer->invdowntime > -1 && joyGetButtonsOnSample(i, shootpad, shootallowedbuttons & Z_TRIG) == 0) { if (g_Vars.currentplayer->invdowntime > TICKS(15)) { - /* amOpen(); */ + amOpen(); g_Vars.currentplayer->invdowntime = -1; } else { g_Vars.currentplayer->invdowntime++; @@ -1019,14 +1020,12 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i g_Vars.currentplayer->invdowntime = 0; } -#endif } } } -#ifdef PLATFORM_N64 // Handle B button activation - if (allowc1buttons) { + if (allowc1buttons && controlmode != CONTROLMODE_PC) { for (i = 0; i < numsamples; i++) { if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & B_BUTTON) || joyGetButtonsOnSample(i, contpad2, c2allowedbuttons & B_BUTTON)) { @@ -1066,7 +1065,6 @@ 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) { @@ -1202,26 +1200,31 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i movedata.disablelookahead = true; } else { - // 1.x control style - if (controlmode == CONTROLMODE_13 || controlmode == CONTROLMODE_14) { - shootbuttons = A_BUTTON; - aimbuttons = Z_TRIG; - invbuttons = R_TRIG; - } else { + // 1.x or PC control style + if (controlmode == CONTROLMODE_PC) { shootbuttons = Z_TRIG; aimbuttons = R_TRIG; invbuttons = A_BUTTON; - } -#ifndef PLATFORM_N64 - if (!g_Vars.currentplayer->insightaimmode) { - movedata.analogstrafe = c2stickx; - movedata.analogwalk = c2sticky; - movedata.unk14 = (c2stickx || c2sticky); + } else if (controlmode == CONTROLMODE_13 || controlmode == CONTROLMODE_14) { + shootbuttons = A_BUTTON; + aimbuttons = Z_TRIG; + invbuttons = L_TRIG | R_TRIG; } else { - movedata.analogstrafe = 0.f; - movedata.analogwalk = 0.f; + shootbuttons = Z_TRIG; + aimbuttons = L_TRIG | R_TRIG; + invbuttons = A_BUTTON; + } + + if (controlmode == CONTROLMODE_PC) { + if (!g_Vars.currentplayer->insightaimmode) { + movedata.analogstrafe = c2stickx; + movedata.analogwalk = c2sticky; + movedata.unk14 = (c2stickx || c2sticky); + } else { + movedata.analogstrafe = 0.f; + movedata.analogwalk = 0.f; + } } -#endif if (optionsGetAimControl(g_Vars.currentplayerstats->mpindex) == AIMCONTROL_HOLD) { for (i = 0; i < numsamples; i++) { @@ -1253,49 +1256,60 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i movedata.canmanualaim = g_Vars.currentplayer->insightaimmode; movedata.canautoaim = !g_Vars.currentplayer->insightaimmode; - if (controlmode == CONTROLMODE_12 || controlmode == CONTROLMODE_14) { + // On N64 control schemes the d-pad does the same thing as the C buttons + u32 slmask, srmask, sumask, sdmask; + if (controlmode == CONTROLMODE_PC) { + sumask = U_CBUTTONS; + sdmask = D_CBUTTONS; + slmask = L_CBUTTONS; + srmask = R_CBUTTONS; + } else { + sumask = U_JPAD | U_CBUTTONS; + sdmask = D_JPAD | D_CBUTTONS; + slmask = L_JPAD | L_CBUTTONS; + srmask = R_JPAD | R_CBUTTONS; + } + + if (controlmode == CONTROLMODE_12 || controlmode == CONTROLMODE_14 || controlmode == CONTROLMODE_PC) { // Handle side stepping if (g_Vars.currentplayer->insightaimmode == false) { if (allowc1buttons) { - movedata.digitalstepleft = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (L_CBUTTONS)); - movedata.digitalstepright = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (R_CBUTTONS)); + movedata.digitalstepleft = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & slmask); + movedata.digitalstepright = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & srmask); } } else { // This doesn't appear to be r-leaning. // R-leaning still works when these are commented. - if (c1buttons & (L_CBUTTONS)) { + if (c1buttons & slmask) { movedata.unk30 = 1; } - if (c1buttons & (R_CBUTTONS)) { + if (c1buttons & srmask) { movedata.unk34 = 1; } } - movedata.digitalstepforward = !g_Vars.currentplayer->insightaimmode && (c1buttons & (U_CBUTTONS)); - movedata.digitalstepback = !g_Vars.currentplayer->insightaimmode && (c1buttons & (D_CBUTTONS)); -#ifdef PLATFORM_N64 - movedata.canlookahead = false; -#else - movedata.canlookahead = !g_Vars.currentplayer->insightaimmode && (c2stickx || c2sticky); -#endif + movedata.digitalstepforward = !g_Vars.currentplayer->insightaimmode && (c1buttons & sumask); + movedata.digitalstepback = !g_Vars.currentplayer->insightaimmode && (c1buttons & sdmask); + movedata.canlookahead = (controlmode == CONTROLMODE_PC) && !g_Vars.currentplayer->insightaimmode && (c2stickx || c2sticky); 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 (PLAYER_EXTCFG().mouseaimmode == MOUSEAIM_LOCKED || bgunGetWeaponNum(HAND_RIGHT) == WEAPON_HORIZONSCANNER) { - movedata.cannaturalpitch = movedata.cannaturalpitch || (movedata.freelookdy != 0.0f); - movedata.cannaturalturn = movedata.cannaturalturn || (movedata.freelookdx != 0.0f); + if (controlmode == CONTROLMODE_PC) { + 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 (PLAYER_EXTCFG().mouseaimmode == MOUSEAIM_LOCKED || bgunGetWeaponNum(HAND_RIGHT) == WEAPON_HORIZONSCANNER) { + movedata.cannaturalpitch = movedata.cannaturalpitch || (movedata.freelookdy != 0.0f); + movedata.cannaturalturn = movedata.cannaturalturn || (movedata.freelookdx != 0.0f); + } } #endif @@ -1314,17 +1328,17 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } } else { // 1.1 or 1.3 - if (c1buttons & (L_CBUTTONS)) { + if (c1buttons & (L_JPAD | L_CBUTTONS)) { movedata.unk30 = 1; } - if (c1buttons & (R_CBUTTONS)) { + if (c1buttons & (R_JPAD | R_CBUTTONS)) { movedata.unk34 = 1; } if (!g_Vars.currentplayer->insightaimmode && allowc1buttons) { - movedata.digitalstepleft = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (L_CBUTTONS)); - movedata.digitalstepright = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (R_CBUTTONS)); + movedata.digitalstepleft = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (L_JPAD | L_CBUTTONS)); + movedata.digitalstepright = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (R_JPAD | R_CBUTTONS)); } movedata.digitalstepforward = false; @@ -1333,20 +1347,16 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i movedata.cannaturalpitch = false; // Looking up/down - if (!g_Vars.currentplayer->insightaimmode && (c1buttons & (U_CBUTTONS))) { + if (!g_Vars.currentplayer->insightaimmode && (c1buttons & (U_JPAD | U_CBUTTONS))) { movedata.speedvertadown = 1; } - if (!g_Vars.currentplayer->insightaimmode && (c1buttons & (D_CBUTTONS))) { + if (!g_Vars.currentplayer->insightaimmode && (c1buttons & (D_JPAD | D_CBUTTONS))) { movedata.speedvertaup = 1; } movedata.cannaturalturn = !g_Vars.currentplayer->insightaimmode; -#ifdef PLATFORM_N64 - movedata.unk14 = false; -#else - movedata.unk14 = !g_Vars.currentplayer->insightaimmode && (c2stickx || c2sticky); -#endif + movedata.unk14 = 0; if (g_Vars.tickmode == TICKMODE_AUTOWALK) { movedata.analogstrafe = 0; @@ -1433,14 +1443,17 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } else { for (i = 0; i < numsamples; i++) { #ifndef PLATFORM_N64 - if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_WPNFORWARD)) { - movedata.weaponforwardoffset++; - g_Vars.currentplayer->invdowntime = -1; - } else if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_WPNBACK)) { - movedata.weaponbackoffset++; - g_Vars.currentplayer->invdowntime = -1; + if (controlmode == CONTROLMODE_PC) { + if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_WPNFORWARD)) { + movedata.weaponforwardoffset++; + g_Vars.currentplayer->invdowntime = -1; + } else if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & BUTTON_WPNBACK)) { + movedata.weaponbackoffset++; + g_Vars.currentplayer->invdowntime = -1; + } + continue; } -#else +#endif if (joyGetButtonsOnSample(i, contpad1, invbuttons & c1allowedbuttons)) { if (g_Vars.currentplayer->invdowntime > -2) { if (joyGetButtonsPressedOnSample(i, contpad1, shootbuttons & c1allowedbuttons)) { @@ -1451,7 +1464,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i if (g_Vars.currentplayer->invdowntime >= 0 && joyGetButtonsOnSample(i, contpad1, shootbuttons & c1allowedbuttons) == 0) { // Holding A and haven't pressed Z if (g_Vars.currentplayer->invdowntime > TICKS(15)) { - /* amOpen(); */ + amOpen(); g_Vars.currentplayer->invdowntime = -1; } else { g_Vars.currentplayer->invdowntime++; @@ -1468,32 +1481,31 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i g_Vars.currentplayer->invdowntime = 0; } -#endif } } } // Handle B and use-like button + const u32 usemask = (controlmode == CONTROLMODE_PC) ? + (B_BUTTON | BUTTON_CANCEL_USE | BUTTON_ACCEPT_USE) : + B_BUTTON; if (allowc1buttons) { for (i = 0; i < numsamples; i++) { - if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & (B_BUTTON | BUTTON_CANCEL_USE | BUTTON_ACCEPT_USE))) { + if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & usemask)) { if (g_Vars.currentplayer->usedowntime >= -1) { -#ifdef PLATFORM_N64 - if (joyGetButtonsPressedOnSample(i, contpad1, shootbuttons & c1allowedbuttons) - && g_Vars.currentplayer->usedowntime >= 0 - && bgunConsiderToggleGunFunction(g_Vars.currentplayer->usedowntime, true, false, 0) != USETIMER_CONTINUE) { - g_Vars.currentplayer->usedowntime = -3; + if (controlmode != CONTROLMODE_PC) { + if (joyGetButtonsPressedOnSample(i, contpad1, shootbuttons & c1allowedbuttons) + && g_Vars.currentplayer->usedowntime >= 0 + && bgunConsiderToggleGunFunction(g_Vars.currentplayer->usedowntime, true, false, 0) != USETIMER_CONTINUE) { + g_Vars.currentplayer->usedowntime = -3; + } } -#endif if (g_Vars.currentplayer->usedowntime >= 0) { if (g_Vars.currentplayer->usedowntime > TICKS(25)) { -#ifdef PLATFORM_N64 - s32 result = bgunConsiderToggleGunFunction(g_Vars.currentplayer->usedowntime, false, false, 0); -#else - s32 result = USETIMER_CONTINUE; -#endif - + s32 result = (controlmode == CONTROLMODE_PC) ? + USETIMER_CONTINUE : + bgunConsiderToggleGunFunction(g_Vars.currentplayer->usedowntime, false, false, 0); if (result == USETIMER_STOP) { g_Vars.currentplayer->usedowntime = -1; } else if (result == USETIMER_REPEAT) { @@ -1506,11 +1518,9 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } } } else { -#ifdef PLATFORM_N64 - if (g_Vars.currentplayer->usedowntime >= -2) { + if ((controlmode != CONTROLMODE_PC) && g_Vars.currentplayer->usedowntime >= -2) { bgunConsiderToggleGunFunction(g_Vars.currentplayer->usedowntime, false, false, 0); } -#endif } } else { // Released B @@ -1524,9 +1534,8 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } } - #ifndef PLATFORM_N64 - if (allowc1buttons) { + if (controlmode == CONTROLMODE_PC && allowc1buttons) { // handle L button : alt switching for (i = 0; i < numsamples; i++) { bgunProcessInputAltButton(&movedata, contpad1, i); @@ -1606,76 +1615,63 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } } } - - // 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; - } - } -#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 manual zoom in and out (sniper, farsight and horizon scanner) + if (canmanualzoom && g_Vars.currentplayer->insightaimmode) { + increment = 1; + zoomout = c1buttons & sdmask; + zoomin = c1buttons & sumask; + + // @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; + } + +#ifndef PLATFORM_N64 + if (controlmode == CONTROLMODE_PC) { + 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; + } + } +#endif + } + // Handle C-button and analog crouch and uncrouch, if enabled - if ((PLAYER_EXTCFG().crouchmode & CROUCHMODE_ANALOG) && allowc1buttons) { +#ifdef PLATFORM_N64 + if (allowc1buttons) { +#else + if (allowc1buttons && (controlmode != CONTROLMODE_PC || (PLAYER_EXTCFG().crouchmode & CROUCHMODE_ANALOG))) { +#endif for (i = 0; i < numsamples; i++) { if (!canmanualzoom && aimonhist[i]) { - bool goUp = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (U_CBUTTONS)); -#ifndef PLATFORM_N64 - goUp = goUp || ((joyGetRStickYOnSample(i, contpad1) > 30 && joyGetRStickYOnSampleIndex(i, contpad1) <= 30)); -#endif + bool goUp = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & sumask); + if (controlmode == CONTROLMODE_PC) { + goUp = goUp || ((joyGetRStickYOnSample(i, contpad1) > 30 && joyGetRStickYOnSampleIndex(i, contpad1) <= 30)); + } if (goUp) { if (movedata.crouchdown) { movedata.crouchdown--; @@ -1686,10 +1682,10 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i g_Vars.currentplayer->aimtaptime = -1; } - bool goDn = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (D_CBUTTONS)); -#ifndef PLATFORM_N64 - goDn = goDn || ((joyGetRStickYOnSample(i, contpad1) < -30 && joyGetRStickYOnSampleIndex(i, contpad1) >= -30)); -#endif + bool goDn = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & sdmask); + if (controlmode == CONTROLMODE_PC) { + goDn = goDn || ((joyGetRStickYOnSample(i, contpad1) < -30 && joyGetRStickYOnSampleIndex(i, contpad1) >= -30)); + } if (goDn) { if (movedata.crouchup) { movedata.crouchup--; @@ -1730,42 +1726,42 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i && g_Vars.coopplayernum <= -1) { movedata.eyesshut = g_Vars.currentplayer->insightaimmode && !canmanualzoom - && joyGetButtons(contpad1, c1allowedbuttons & (D_CBUTTONS)); + && joyGetButtons(contpad1, c1allowedbuttons & sdmask); } if (bgunGetWeaponNum(HAND_RIGHT) == WEAPON_FARSIGHT) { - movedata.farsighttempautoseek = g_Vars.currentplayer->insightaimmode && (c1buttons & (L_CBUTTONS | R_CBUTTONS)); - if (g_Vars.currentplayer->insightaimmode) { + movedata.farsighttempautoseek = g_Vars.currentplayer->insightaimmode && (c1buttons & (srmask | slmask)); + if (controlmode == CONTROLMODE_PC && 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)); + movedata.rleanleft = g_Vars.currentplayer->insightaimmode && (c1buttons & slmask); + movedata.rleanright = g_Vars.currentplayer->insightaimmode && (c1buttons & srmask); #ifndef PLATFORM_N64 - if (g_Vars.currentplayer->insightaimmode) { + if (controlmode == CONTROLMODE_PC && g_Vars.currentplayer->insightaimmode) { movedata.analoglean = c2stickx / 127.f; } #endif } // Handle mine detonation -#ifdef PLATFORM_N64 - if ((((c1buttons & invbuttons) && (c1buttonsthisframe & B_BUTTON)) - || ((c1buttons & B_BUTTON) && (c1buttonsthisframe & invbuttons))) - && weaponnum == WEAPON_REMOTEMINE) { - movedata.detonating = true; - movedata.weaponbackoffset = 0; - movedata.weaponforwardoffset = 0; - movedata.btapcount = 0; - g_Vars.currentplayer->invdowntime = -2; - g_Vars.currentplayer->usedowntime = -2; + if (controlmode != CONTROLMODE_PC) { + if ((((c1buttons & invbuttons) && (c1buttonsthisframe & B_BUTTON)) + || ((c1buttons & B_BUTTON) && (c1buttonsthisframe & invbuttons))) + && weaponnum == WEAPON_REMOTEMINE) { + movedata.detonating = true; + movedata.weaponbackoffset = 0; + movedata.weaponforwardoffset = 0; + movedata.btapcount = 0; + g_Vars.currentplayer->invdowntime = -2; + g_Vars.currentplayer->usedowntime = -2; + } + } else { + bgunProcessQuickDetonate(&movedata, c1buttons, c1buttonsthisframe, (BUTTON_CANCEL_USE | BUTTON_ACCEPT_USE), (BUTTON_WPNBACK | BUTTON_RADIAL | BUTTON_RELOAD)); } -#else - bgunProcessQuickDetonate(&movedata, c1buttons, c1buttonsthisframe, (BUTTON_CANCEL_USE | BUTTON_ACCEPT_USE), (BUTTON_WPNBACK | BUTTON_RADIAL | BUTTON_RELOAD)); -#endif } movedata.aiming = g_Vars.currentplayer->insightaimmode; @@ -1784,15 +1780,13 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } else { movedata.triggeron = g_Vars.currentplayer->waitforzrelease == false && (c1buttons & shootbuttons) - && g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED -#ifdef PLATFORM_N64 - && (c1buttons & invbuttons) == 0; -#else - ; -#endif + && g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED; + if (controlmode != CONTROLMODE_PC) { + movedata.triggeron = movedata.triggeron && ((c1buttons & invbuttons) == 0); + } } - if (controlmode == CONTROLMODE_12 || controlmode == CONTROLMODE_14) { + if (controlmode == CONTROLMODE_12 || controlmode == CONTROLMODE_14 || controlmode == CONTROLMODE_PC) { movedata.disablelookahead = true; } } // end 1.x @@ -1801,13 +1795,19 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i g_Vars.currentplayer->bondactivateorreload = 0; - if (movedata.alt1tapcount) { +#ifndef PLATFORM_N64 + if (controlmode == CONTROLMODE_PC && movedata.alt1tapcount) { g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_RELOAD; } +#endif if (movedata.btapcount) { g_Vars.currentplayer->activatetimelast = g_Vars.currentplayer->activatetimethis; g_Vars.currentplayer->activatetimethis = g_Vars.lvframe60; - g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_ACTIVATE; + if (controlmode == CONTROLMODE_PC) { + g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_ACTIVATE; + } else { + g_Vars.currentplayer->bondactivateorreload = movedata.btapcount; + } bmoveHandleActivate(); } diff --git a/src/game/bondview.c b/src/game/bondview.c index 7101e21d1..2a086c614 100644 --- a/src/game/bondview.c +++ b/src/game/bondview.c @@ -988,6 +988,7 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) #if VERSION >= VERSION_NTSC_1_0 bool vsplit = false; #endif + u32 umask, dmask, lmask, rmask; #if VERSION >= VERSION_PAL_FINAL #if PAL @@ -1018,6 +1019,18 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } #endif + if (optionsGetControlMode(g_Vars.currentplayerstats->mpindex) == CONTROLMODE_PC) { + umask = U_CBUTTONS; + dmask = D_CBUTTONS; + lmask = L_CBUTTONS; + rmask = R_CBUTTONS; + } else { + umask = U_JPAD | U_CBUTTONS; + dmask = D_JPAD | D_CBUTTONS; + lmask = L_JPAD | L_CBUTTONS; + rmask = R_JPAD | R_CBUTTONS; + } + #if VERSION >= VERSION_NTSC_1_0 movex = chr->prop->pos.x - chr->prevpos.x; movey = chr->prop->pos.y - chr->prevpos.y; @@ -1403,32 +1416,32 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) // Up if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { brightness = 20; \ - if (buttonsdown & (U_CBUTTONS)) { \ + if (buttonsdown & umask) { \ brightness += 20; \ } \ - if (buttonsthisframe & (U_CBUTTONS)) { \ + if (buttonsthisframe & umask) { \ brightness += 20; \ } \ gDPSetPrimColor(gdl++, 0, 0, 0, brightness, 0, 0xff); \ } else if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_DRUGSPY) { brightness = 127; - if (buttonsdown & (U_CBUTTONS)) { + if (buttonsdown & umask) { brightness += 63; } - if (buttonsthisframe & (U_CBUTTONS)) { + if (buttonsthisframe & umask) { brightness += 63; \ } \ gDPSetPrimColor(gdl++, 0, 0, 0x10, 0x20, brightness, 0xff); } else { brightness = 20; - if (buttonsdown & (U_CBUTTONS)) { + if (buttonsdown & umask) { brightness += 20; } - if (buttonsthisframe & (U_CBUTTONS)) { + if (buttonsthisframe & umask) { brightness += 20; \ } \ gDPSetPrimColor(gdl++, 0, 0, brightness, brightness >> 2, 0, 0xff); @@ -1441,10 +1454,10 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { brightness = 20; - if (buttonsdown & (D_CBUTTONS)) { \ + if (buttonsdown & dmask) { \ brightness += 20; \ } \ - if (buttonsthisframe & (D_CBUTTONS)) { + if (buttonsthisframe & dmask) { brightness += 20; } @@ -1452,11 +1465,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_DRUGSPY) { brightness = 127; - if (buttonsdown & (D_CBUTTONS)) { + if (buttonsdown & dmask) { brightness += 63; } - if (buttonsthisframe & (D_CBUTTONS)) { + if (buttonsthisframe & dmask) { brightness += 63; } @@ -1464,11 +1477,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else { brightness = 20; - if (buttonsdown & (D_CBUTTONS)) { + if (buttonsdown & dmask) { brightness += 20; } - if (buttonsthisframe & (D_CBUTTONS)) { + if (buttonsthisframe & dmask) { brightness += 20; } @@ -1482,10 +1495,10 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { brightness = 20; - if (buttonsdown & (L_CBUTTONS)) { \ + if (buttonsdown & lmask) { \ brightness += 20; \ } \ - if (buttonsthisframe & (L_CBUTTONS)) { + if (buttonsthisframe & lmask) { brightness += 20; } @@ -1493,11 +1506,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_DRUGSPY) { brightness = 127; - if (buttonsdown & (L_CBUTTONS)) { + if (buttonsdown & lmask) { brightness += 63; } - if (buttonsthisframe & (L_CBUTTONS)) { + if (buttonsthisframe & lmask) { brightness += 63; } @@ -1505,11 +1518,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else { brightness = 20; - if (buttonsdown & (L_CBUTTONS)) { + if (buttonsdown & lmask) { brightness += 20; } - if (buttonsthisframe & (L_CBUTTONS)) { + if (buttonsthisframe & lmask) { brightness += 20; } @@ -1523,10 +1536,10 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { brightness = 20; - if (buttonsdown & (R_CBUTTONS)) { \ + if (buttonsdown & rmask) { \ brightness += 20; \ } \ - if (buttonsthisframe & (R_CBUTTONS)) { + if (buttonsthisframe & rmask) { brightness += 20; } @@ -1534,11 +1547,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_DRUGSPY) { brightness = 127; - if (buttonsdown & (R_CBUTTONS)) { + if (buttonsdown & rmask) { brightness += 63; } - if (buttonsthisframe & (R_CBUTTONS)) { + if (buttonsthisframe & rmask) { brightness += 63; } @@ -1546,11 +1559,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else { brightness = 20; - if (buttonsdown & (R_CBUTTONS)) { + if (buttonsdown & rmask) { brightness += 20; } - if (buttonsthisframe & (R_CBUTTONS)) { + if (buttonsthisframe & rmask) { brightness += 20; } diff --git a/src/game/chraction.c b/src/game/chraction.c index 2d0495171..a770ee77c 100644 --- a/src/game/chraction.c +++ b/src/game/chraction.c @@ -4478,7 +4478,8 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse pakRumble((s8)g_Vars.currentplayernum, 0.25f, -1, -1); - if (optionsGetControlMode(g_Vars.currentplayerstats->mpindex) >= CONTROLMODE_21) { + s32 controlmode = optionsGetControlMode(g_Vars.currentplayerstats->mpindex); + if (controlmode >= CONTROLMODE_21 && controlmode < CONTROLMODE_PC) { pakRumble((s8)(PLAYERCOUNT() + g_Vars.currentplayernum), 0.25f, -1, -1); } #endif diff --git a/src/game/gamefile.c b/src/game/gamefile.c index b6abc42cd..3f334ace9 100644 --- a/src/game/gamefile.c +++ b/src/game/gamefile.c @@ -160,14 +160,20 @@ void gamefileLoadDefaults(struct gamefile *file) optionsSetMusicVolume(0x7f80); #endif sndSetSoundMode(SOUNDMODE_STEREO); -#ifdef PLATFORM_N64 optionsSetControlMode(player1, CONTROLMODE_11); -#else - optionsSetControlMode(player1, CONTROLMODE_12); -#endif optionsSetControlMode(player2, CONTROLMODE_11); pakClearAllBitflags(file->flags); +#ifndef PLATFORM_N64 + // override with PC controls if enabled in the config + if (g_PlayerExtCfg[0].extcontrols) { + optionsSetControlMode(player1, CONTROLMODE_PC); + } + if (g_PlayerExtCfg[1].extcontrols) { + optionsSetControlMode(player2, CONTROLMODE_PC); + } +#endif + #ifdef PLATFORM_N64 pakSetBitflag(GAMEFILEFLAG_P1_FORWARDPITCH, file->flags, false); #else @@ -333,6 +339,16 @@ s32 gamefileLoad(s32 device) optionsSetControlMode(p1index, savebufferReadBits(&buffer, 3)); optionsSetControlMode(p2index, savebufferReadBits(&buffer, 3)); +#ifndef PLATFORM_N64 + // override with PC controls if enabled in the config + if (g_PlayerExtCfg[0].extcontrols) { + optionsSetControlMode(p1index, CONTROLMODE_PC); + } + if (g_PlayerExtCfg[1].extcontrols) { + optionsSetControlMode(p2index, CONTROLMODE_PC); + } +#endif + for (i = 0; i < ARRAYCOUNT(g_GameFile.flags); i++) { g_GameFile.flags[i] = savebufferReadBits(&buffer, 8); } @@ -499,8 +515,16 @@ s32 gamefileSave(s32 device, s32 fileid, u16 deviceserial) value = g_SoundMode; savebufferOr(&buffer, value, 2); +#ifdef PLATFORM_N64 savebufferOr(&buffer, optionsGetControlMode(p1index), 3); savebufferOr(&buffer, optionsGetControlMode(p2index), 3); +#else + // PC control mode is enabled in the .ini to avoid changing the save structure + s32 controlmode = optionsGetControlMode(p1index); + savebufferOr(&buffer, ((controlmode == CONTROLMODE_PC) ? CONTROLMODE_11 : controlmode), 3); + controlmode = optionsGetControlMode(p2index); + savebufferOr(&buffer, ((controlmode == CONTROLMODE_PC) ? CONTROLMODE_11 : controlmode), 3); +#endif for (i = 0; i < ARRAYCOUNT(g_GameFile.flags); i++) { savebufferOr(&buffer, g_GameFile.flags[i], 8); diff --git a/src/game/mainmenu.c b/src/game/mainmenu.c index c7e309666..c0a918d9f 100644 --- a/src/game/mainmenu.c +++ b/src/game/mainmenu.c @@ -92,21 +92,32 @@ MenuItemHandlerResult menuhandlerControlStyleImpl(s32 operation, struct menuitem switch (operation) { case MENUOP_GETOPTIONCOUNT: - data->list.value = 8; + data->list.value = 9; break; case MENUOP_GETOPTGROUPCOUNT: - data->list.value = 2; + data->list.value = 3; break; case MENUOP_GETOPTIONTEXT: - return (s32) langGet(g_ControlStyleOptions[data->list.value]); + if (data->list.value > 7) { + return (intptr_t) "Ext"; + } else { + return (intptr_t) langGet(g_ControlStyleOptions[data->list.value]); + } case MENUOP_GETOPTGROUPTEXT: - return (s32) langGet(categories[data->list.value]); + if (data->list.value > 1) { + return (intptr_t) "Port"; + } else { + return (intptr_t) langGet(categories[data->list.value]); + } case MENUOP_GETGROUPSTARTINDEX: - data->list.groupstartindex = data->list.value == 0 ? 0 : 4; + data->list.groupstartindex = data->list.value * 4; break; case MENUOP_SET: optionsSetControlMode(mpindex, data->list.value); g_Vars.modifiedfiles |= MODFILE_GAME; +#ifndef PLATFORM_N64 + g_PlayerExtCfg[mpindex & 3].extcontrols = (data->list.value == CONTROLMODE_PC); +#endif break; case MENUOP_GETSELECTEDINDEX: data->list.value = optionsGetControlMode(mpindex); diff --git a/src/game/menu.c b/src/game/menu.c index b8d1633e9..628f987b0 100644 --- a/src/game/menu.c +++ b/src/game/menu.c @@ -4639,7 +4639,7 @@ void menuProcessInput(void) inputs.select = 1; } - #ifndef PLATFORM_N64 +#ifndef PLATFORM_N64 // this seems sensible to achieve 1964 parity if (buttonsnow & BUTTON_RADIAL) { inputs.select = 1; @@ -4648,8 +4648,8 @@ void menuProcessInput(void) if (buttonsnow & BUTTON_WPNBACK) { inputs.back = 1; } +#endif - #endif if (buttonsnow & B_BUTTON) { inputs.back = 1; } diff --git a/src/game/menuitem.c b/src/game/menuitem.c index 2bf147771..11e53274d 100644 --- a/src/game/menuitem.c +++ b/src/game/menuitem.c @@ -4097,7 +4097,7 @@ Gfx *menuitemControllerRenderText(Gfx *gdl, s32 curmode, struct menurendercontex #endif // For the 2.x styles, only labels 4-7 are shown - if (curmode < CONTROLMODE_21 || (i >= 4 && i <= 7)) { + if ((curmode < CONTROLMODE_21 || curmode == CONTROLMODE_PC) || (i >= 4 && i <= 7)) { // Rendering a label such as "L/R BUTTONS:" rx = context->x + padx + 76; #if VERSION < VERSION_NTSC_1_0 @@ -4117,7 +4117,7 @@ Gfx *menuitemControllerRenderText(Gfx *gdl, s32 curmode, struct menurendercontex // during development the second player in the 2.x styles had to // choose their control style separately to player 1, in which case // there would have been 2.5, 2.6, 2.7 and 2.8 for player 2. - if (curmode > CONTROLMODE_24) { + if (curmode > CONTROLMODE_24 && curmode != CONTROLMODE_PC) { if (textnum == menuitemControllerGetButtonAction(prevmode + 4, i)) { colour = labelcolour; } @@ -4128,7 +4128,7 @@ Gfx *menuitemControllerRenderText(Gfx *gdl, s32 curmode, struct menurendercontex } } - if (curmode >= CONTROLMODE_21 && i == 2) { + if (curmode >= CONTROLMODE_21 && curmode < CONTROLMODE_PC && i == 2) { // Rendering a "CONTROLLER 1" or "CONTROLLER 2" heading rx = context->x + padx + 63; colour = labelcolour; @@ -4157,13 +4157,13 @@ Gfx *menuitemControllerRenderPad(Gfx *gdl, struct menurendercontext *context, s3 gdl = menuitemControllerRenderTexture(gdl, rx + 32, ry + 32, 0x36, alpha); #if VERSION >= VERSION_JPN_FINAL - if (curmode >= CONTROLMODE_21) { + if (curmode >= CONTROLMODE_21 && curmode < CONTROLMODE_PC) { gdl = menuitemControllerRenderLines(gdl, context, 13, 20, padx, pady, alpha); } else { gdl = menuitemControllerRenderLines(gdl, context, 0, 22, padx, pady, alpha); } #else - if (curmode >= CONTROLMODE_21) { + if (curmode >= CONTROLMODE_21 && curmode < CONTROLMODE_PC) { gdl = menuitemControllerRenderLines(gdl, context, 13, 19, padx, pady, alpha); } else { gdl = menuitemControllerRenderLines(gdl, context, 0, 21, padx, pady, alpha); @@ -4196,13 +4196,13 @@ Gfx *menuitemControllerRender(Gfx *gdl, struct menurendercontext *context) // If changing control group (eg. 1.4 -> 2.1) if (data->controlgroup == 1) { - if (g_Menus[g_MpPlayerNum].main.controlmode < CONTROLMODE_21) { + if (g_Menus[g_MpPlayerNum].main.controlmode < CONTROLMODE_21 || g_Menus[g_MpPlayerNum].main.controlmode == CONTROLMODE_PC) { data->controlgroup = 2; data->contfadetimer = 0; data->prevmode = -1; } } else { - if (g_Menus[g_MpPlayerNum].main.controlmode >= CONTROLMODE_21) { + if (g_Menus[g_MpPlayerNum].main.controlmode >= CONTROLMODE_21 && g_Menus[g_MpPlayerNum].main.controlmode != CONTROLMODE_PC) { data->controlgroup = 1; data->contfadetimer = 0; data->prevmode = -1; @@ -4252,7 +4252,11 @@ Gfx *menuitemControllerRender(Gfx *gdl, struct menurendercontext *context) g_MenuWave2Colours[dialog->type].item_unfocused, g_MenuWave1Colours[dialog->type].item_unfocused); - if (g_Menus[g_MpPlayerNum].main.controlmode >= CONTROLMODE_21) { + if (g_Menus[g_MpPlayerNum].main.controlmode == CONTROLMODE_PC) { + sprintf(text, langGet(L_MPWEAPONS_213), // "Control Style %s %s" + "Ext", + langGet(L_MPWEAPONS_215)); // "(Two-Handed)" + } else if (g_Menus[g_MpPlayerNum].main.controlmode >= CONTROLMODE_21) { sprintf(text, langGet(L_MPWEAPONS_213), // "Control Style %s %s" langGet(g_ControlStyleOptions[g_Menus[g_MpPlayerNum].main.controlmode]), langGet(L_MPWEAPONS_215)); // "(Two-Handed)" @@ -4271,7 +4275,21 @@ Gfx *menuitemControllerRender(Gfx *gdl, struct menurendercontext *context) textcolour = colourBlend(colour, colour & 0xffffff00, textalpha); colour = colourBlend(colour, colour & 0xffffff00, contalpha); - if (g_Menus[g_MpPlayerNum].main.controlmode >= CONTROLMODE_21) { + if (g_Menus[g_MpPlayerNum].main.controlmode == CONTROLMODE_PC) { + x = context->x; + y = context->y + 92; +#if VERSION == VERSION_JPN_FINAL + y += 34; +#endif + gdl = text0f153628(gdl); + gdl = textRenderProjected(gdl, &x, &y, + "PC Port control scheme.\n" + "Only change to another control scheme\n" + "if you want to use original N64 controls.\n\n" + "See Extended Key Bindings for more info.", + g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, viGetWidth(), viGetHeight(), 0, 0); + gdl = text0f153780(gdl); + } else if (g_Menus[g_MpPlayerNum].main.controlmode >= CONTROLMODE_21) { gdl = menuitemControllerRenderPad(gdl, context, 0, VERSION == VERSION_JPN_FINAL ? -4 : 12, g_Menus[g_MpPlayerNum].main.controlmode, contalpha, textcolour, colour, data->prevmode); diff --git a/src/game/mplayer/mplayer.c b/src/game/mplayer/mplayer.c index 3faa30032..d91f60a4e 100644 --- a/src/game/mplayer/mplayer.c +++ b/src/game/mplayer/mplayer.c @@ -121,6 +121,7 @@ struct mpweapon g_MpWeapons[NUM_MPWEAPONS] = { .radialmenuspeed = 4.f, \ .crosshairsway = 1.f, \ .crouchmode = CROUCHMODE_TOGGLE_ANALOG, \ + .extcontrols = true, \ } struct extplayerconfig g_PlayerExtCfg[MAX_PLAYERS] = { @@ -405,7 +406,13 @@ void mpPlayerSetDefaults(s32 playernum, bool autonames) func0f187fbc(playernum); - g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_12; + g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_11; + +#ifndef PLATFORM_N64 + if (g_PlayerExtCfg[playernum % MAX_PLAYERS].extcontrols) { + g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_PC; + } +#endif g_PlayerConfigsArray[playernum].options = #ifdef PLATFORM_N64 @@ -3393,6 +3400,13 @@ void mpplayerfileLoadWad(s32 playernum, struct savebuffer *buffer, s32 arg2) g_PlayerConfigsArray[playernum].controlmode = savebufferReadBits(buffer, 2); g_PlayerConfigsArray[playernum].options = savebufferReadBits(buffer, 12); +#ifndef PLATFORM_N64 + // override with PC controls if enabled in the config + if (g_PlayerExtCfg[playernum % MAX_PLAYERS].extcontrols) { + g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_PC; + } +#endif + for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) { for (j = 1; j < MAX_PLAYERS + 1; j++) { challengeSetCompletedByPlayerWithNumPlayers(playernum, i, j, savebufferReadBits(buffer, 1)); @@ -3523,7 +3537,14 @@ void mpplayerfileSaveWad(s32 playernum, struct savebuffer *buffer) savebufferOr(buffer, g_PlayerConfigsArray[playernum].survivormedals, 16); +#ifdef PLATFORM_N64 savebufferOr(buffer, g_PlayerConfigsArray[playernum].controlmode, 2); +#else + // PC control mode is enabled in the .ini to avoid changing the save structure + const u32 controlmode = g_PlayerConfigsArray[playernum].controlmode; + savebufferOr(buffer, ((controlmode == CONTROLMODE_PC) ? CONTROLMODE_11 : controlmode), 2); +#endif + savebufferOr(buffer, g_PlayerConfigsArray[playernum].options, 12); for (i = 0; i < ARRAYCOUNT(g_MpChallenges); i++) { diff --git a/src/game/mplayer/setup.c b/src/game/mplayer/setup.c index 92f7940fd..87b99860d 100644 --- a/src/game/mplayer/setup.c +++ b/src/game/mplayer/setup.c @@ -256,15 +256,21 @@ MenuItemHandlerResult menuhandlerMpControlStyle(s32 operation, struct menuitem * switch (operation) { case MENUOP_GETOPTIONCOUNT: - data->dropdown.value = 4; + data->dropdown.value = 5; break; case MENUOP_GETOPTIONTEXT: - return (s32) langGet(labels[data->dropdown.value]); + return (intptr_t) ((data->dropdown.value == 4) ? "Ext" : langGet(labels[data->dropdown.value])); case MENUOP_SET: - optionsSetControlMode(g_MpPlayerNum, data->dropdown.value); + optionsSetControlMode(g_MpPlayerNum, (data->dropdown.value == 4 ? CONTROLMODE_PC : data->dropdown.value)); +#ifndef PLATFORM_N64 + g_PlayerExtCfg[g_MpPlayerNum & 3].extcontrols = (data->dropdown.value == 4); +#endif break; case MENUOP_GETSELECTEDINDEX: data->dropdown.value = optionsGetControlMode(g_MpPlayerNum); + if (data->dropdown.value == CONTROLMODE_PC) { + data->dropdown.value = 4; + } break; } diff --git a/src/include/constants.h b/src/include/constants.h index 33eba0ed2..58bd60cd9 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -694,6 +694,7 @@ #define CONTROLMODE_22 5 #define CONTROLMODE_23 6 #define CONTROLMODE_24 7 +#define CONTROLMODE_PC 8 // "pc port" controls; enabled in the .ini file #define COUNTDOWNTIMERREASON_AI 0x01 #define COUNTDOWNTIMERREASON_NOCONTROL 0x10 diff --git a/src/include/types.h b/src/include/types.h index f307b8ada..159558c67 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -5072,8 +5072,8 @@ struct movedata { /*0xa0*/ s32 analogpitch; /*0xa4*/ s32 analogstrafe; /*0xa8*/ s32 analogwalk; - /*0xac*/ s32 alt1tapcount; #ifndef PLATFORM_N64 + /*0xac*/ s32 alt1tapcount; /* */ f32 freelookdx; // how much the mouse moved ... /* */ f32 freelookdy; // ... scaled by sensitivity /* */ f32 analoglean; // how much we're trying to lean @@ -6135,6 +6135,7 @@ struct extplayerconfig { s32 crouchmode; f32 radialmenuspeed; f32 crosshairsway; + s32 extcontrols; }; #endif diff --git a/src/lib/joy.c b/src/lib/joy.c index ca84bf817..0844ae0a7 100644 --- a/src/lib/joy.c +++ b/src/lib/joy.c @@ -1087,7 +1087,8 @@ void joyGetContpadNumsForPlayer(s8 playernum, s32 *pad1, s32 *pad2) *pad1 = playernum; - if (g_PlayerConfigsArray[g_Vars.playerstats[playernum].mpindex].controlmode >= CONTROLMODE_21) { + u8 controlmode = g_PlayerConfigsArray[g_Vars.playerstats[playernum].mpindex].controlmode; + if (controlmode >= CONTROLMODE_21 && controlmode < CONTROLMODE_PC) { *pad2 = PLAYERCOUNT() + playernum; return; }