port: add option to reload with use key in extcontrols

This commit is contained in:
fgsfds committed 2025-02-11 20:02:35 +01:00
1 parent f1084b6d93
commit 8a3dd74d5c
6 files changed
+30 -2

No files matched your search

+1
View File
@@ -182,5 +182,6 @@ PD_CONSTRUCTOR static void gameConfigInit(void)
configRegisterUInt(strFmt("Game.Player%d.CrosshairColour", i), &g_PlayerExtCfg[j].crosshaircolour, 0, 0xFFFFFFFF); configRegisterUInt(strFmt("Game.Player%d.CrosshairColour", i), &g_PlayerExtCfg[j].crosshaircolour, 0, 0xFFFFFFFF);
configRegisterUInt(strFmt("Game.Player%d.CrosshairSize", i), &g_PlayerExtCfg[j].crosshairsize, 0, 4); configRegisterUInt(strFmt("Game.Player%d.CrosshairSize", i), &g_PlayerExtCfg[j].crosshairsize, 0, 4);
configRegisterInt(strFmt("Game.Player%d.CrosshairHealth", i), &g_PlayerExtCfg[j].crosshairhealth, 0, CROSSHAIR_HEALTH_ON_WHITE); configRegisterInt(strFmt("Game.Player%d.CrosshairHealth", i), &g_PlayerExtCfg[j].crosshairhealth, 0, CROSSHAIR_HEALTH_ON_WHITE);
configRegisterInt(strFmt("Game.Player%d.UseKeyReloads", i), &g_PlayerExtCfg[j].usereloads, 0, false);
} }
} }
+23
View File
@@ -965,6 +965,21 @@ struct menudialogdef g_ExtendedAudioMenuDialog = {
NULL, NULL,
}; };
static MenuItemHandlerResult menuhandlerUseKeyReloads(s32 operation, struct menuitem *item, union handlerdata *data)
{
switch (operation) {
case MENUOP_CHECKDISABLED:
return !g_PlayerExtCfg[g_ExtMenuPlayer].extcontrols;
case MENUOP_GET:
return g_PlayerExtCfg[g_ExtMenuPlayer].usereloads;
case MENUOP_SET:
g_PlayerExtCfg[g_ExtMenuPlayer].usereloads = data->checkbox.value;
break;
}
return 0;
}
static MenuItemHandlerResult menuhandlerCrouchMode(s32 operation, struct menuitem *item, union handlerdata *data) static MenuItemHandlerResult menuhandlerCrouchMode(s32 operation, struct menuitem *item, union handlerdata *data)
{ {
static const char *opts[] = { static const char *opts[] = {
@@ -1269,6 +1284,14 @@ struct menuitem g_ExtendedGameMenuItems[] = {
0, 0,
menuhandlerCrosshairHealth, menuhandlerCrosshairHealth,
}, },
{
MENUITEMTYPE_CHECKBOX,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Use Key Reloads",
0,
menuhandlerUseKeyReloads,
},
{ {
MENUITEMTYPE_SEPARATOR, MENUITEMTYPE_SEPARATOR,
0, 0,
+3 -1
View File
@@ -1810,7 +1810,9 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
g_Vars.currentplayer->bondactivateorreload = 0; g_Vars.currentplayer->bondactivateorreload = 0;
s32 usereloads = (controlmode != CONTROLMODE_PC);
#ifndef PLATFORM_N64 #ifndef PLATFORM_N64
usereloads = usereloads || PLAYER_EXTCFG().usereloads;
if (controlmode == CONTROLMODE_PC && movedata.alt1tapcount) { if (controlmode == CONTROLMODE_PC && movedata.alt1tapcount) {
g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_RELOAD; g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_RELOAD;
} }
@@ -1818,7 +1820,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
if (movedata.btapcount) { if (movedata.btapcount) {
g_Vars.currentplayer->activatetimelast = g_Vars.currentplayer->activatetimethis; g_Vars.currentplayer->activatetimelast = g_Vars.currentplayer->activatetimethis;
g_Vars.currentplayer->activatetimethis = g_Vars.lvframe60; g_Vars.currentplayer->activatetimethis = g_Vars.lvframe60;
if (controlmode == CONTROLMODE_PC) { if (!usereloads) {
g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_ACTIVATE; g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_ACTIVATE;
} else { } else {
g_Vars.currentplayer->bondactivateorreload = movedata.btapcount ? g_Vars.currentplayer->bondactivateorreload = movedata.btapcount ?
+1 -1
View File
@@ -1303,7 +1303,7 @@ Gfx *lvRender(Gfx *gdl)
if (!currentPlayerInteract(false)) { if (!currentPlayerInteract(false)) {
#ifndef PLATFORM_N64 #ifndef PLATFORM_N64
// n64 behavior: interact sucessful, cancel reload // n64 behavior: interact sucessful, cancel reload
if (!PLAYER_EXTCFG().extcontrols) { if (!PLAYER_EXTCFG().extcontrols || PLAYER_EXTCFG().usereloads) {
g_Vars.currentplayer->bondactivateorreload = (g_Vars.currentplayer->bondactivateorreload & ~JO_ACTION_RELOAD); g_Vars.currentplayer->bondactivateorreload = (g_Vars.currentplayer->bondactivateorreload & ~JO_ACTION_RELOAD);
} }
#endif #endif
+1
View File
@@ -130,6 +130,7 @@ struct mpweapon g_MpWeapons[NUM_MPWEAPONS] = {
.crosshaircolour = 0x00ff0028, \ .crosshaircolour = 0x00ff0028, \
.crosshairsize = 2, \ .crosshairsize = 2, \
.crosshairhealth = CROSSHAIR_HEALTH_OFF, \ .crosshairhealth = CROSSHAIR_HEALTH_OFF, \
.usereloads = false, \
} }
struct extplayerconfig g_PlayerExtCfg[MAX_PLAYERS] = { struct extplayerconfig g_PlayerExtCfg[MAX_PLAYERS] = {
+1
View File
@@ -6152,6 +6152,7 @@ struct extplayerconfig {
u32 crosshaircolour; u32 crosshaircolour;
u32 crosshairsize; u32 crosshairsize;
s32 crosshairhealth; s32 crosshairhealth;
s32 usereloads;
}; };
#endif #endif