Replace "Counter-Operative" player selection with "Main Player" + extend to 4 entries

This commit is contained in:
GreaseMonkey committed 2024-02-10 11:20:01 +13:00
1 parent 94e244a236
commit f4530633d6
1 file changed
+93 -1
+93 -1
View File
@@ -748,6 +748,7 @@ MenuItemHandlerResult menuhandlerAcceptMission(s32 operation, struct menuitem *i
setNumPlayers(1);
}
} else if (g_MissionConfig.isanti) {
#ifdef PLATFORM_N64
if (g_Vars.pendingantiplayernum == 1) {
g_Vars.bondplayernum = 0;
g_Vars.antiplayernum = 1;
@@ -757,9 +758,13 @@ MenuItemHandlerResult menuhandlerAcceptMission(s32 operation, struct menuitem *i
}
g_Vars.coopplayernum = -1;
#ifdef PLATFORM_N64
setNumPlayers(2);
#else
g_Vars.bondplayernum = g_Vars.pendingantiplayernum ^ 1;
g_Vars.antiplayernum = (g_Vars.bondplayernum == 0 ? 1 : 0);
g_Vars.coopplayernum = -1;
if ((joyGetConnectedControllers() & 0xF) == 0xF) {
setNumPlayers(4);
g_MpSetup.chrslots = 0xF;
@@ -1558,6 +1563,8 @@ MenuItemHandlerResult menuhandlerAntiRadar(s32 operation, struct menuitem *item,
return 0;
}
#ifdef PLATFORM_N64
MenuItemHandlerResult menuhandlerAntiPlayer(s32 operation, struct menuitem *item, union handlerdata *data)
{
const u16 labels[] = {L_OPTIONS_271, L_OPTIONS_272};
@@ -1624,6 +1631,91 @@ struct menuitem g_AntiOptionsMenuItems[] = {
{ MENUITEMTYPE_END },
};
#else
MenuItemHandlerResult menuhandlerAntiMainPlayer(s32 operation, struct menuitem *item, union handlerdata *data)
{
static const char *labels[] = {
"Player 1",
"Player 2",
"Player 3",
"Player 4",
};
// For consistency with the main save format,
// the main player is (pendingantiplayernum XOR 1)
switch (operation) {
case MENUOP_GETOPTIONCOUNT:
if ((joyGetConnectedControllers() & 0xF) == 0xF) {
data->dropdown.value = 4;
} else if ((joyGetConnectedControllers() & 0x7) == 0x7) {
data->dropdown.value = 3;
} else {
data->dropdown.value = 2;
}
break;
case MENUOP_GETOPTIONTEXT:
return (s32) (labels[data->dropdown.value]);
case MENUOP_SET:
g_Vars.pendingantiplayernum = data->dropdown.value ^ 1;
g_Vars.modifiedfiles |= MODFILE_GAME;
break;
case MENUOP_GETSELECTEDINDEX:
data->dropdown.value = g_Vars.pendingantiplayernum ^ 1;
break;
}
return 0;
}
struct menuitem g_AntiOptionsMenuItems[] = {
{
MENUITEMTYPE_CHECKBOX,
0,
0,
L_OPTIONS_267, // "Radar On"
0,
menuhandlerAntiRadar,
},
{
MENUITEMTYPE_DROPDOWN,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Main Player",
0,
menuhandlerAntiMainPlayer,
},
{
MENUITEMTYPE_SEPARATOR,
0,
0,
0,
0,
NULL,
},
{
MENUITEMTYPE_SELECTABLE,
0,
0,
L_OPTIONS_269, // "Continue"
0,
menuhandlerBuddyOptionsContinue,
},
{
MENUITEMTYPE_SELECTABLE,
0,
MENUITEMFLAG_SELECTABLE_CLOSESDIALOG,
L_OPTIONS_270, // "Cancel"
0,
NULL,
},
{ MENUITEMTYPE_END },
};
#endif
struct menudialogdef g_AntiOptionsMenuDialog = {
MENUDIALOGTYPE_DEFAULT,
L_OPTIONS_266, // "Counter-Operative Options"