port: add auto random mp weapon option

This commit is contained in:
Jonaeru committed 2024-03-26 00:53:57 +09:00
1 parent b4f7f467c0
commit 2483d4fc35
3 files changed
+80

No files matched your search

+18
View File
@@ -184,6 +184,15 @@ void mpStartMatch(void)
s32 numplayers = 0;
s32 stagenum;
#ifndef PLATFORM_N64
if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_START) {
if (g_MpWeaponSetNum == WEAPONSET_RANDOM
|| g_MpWeaponSetNum == WEAPONSET_RANDOMFIVE) {
mpApplyWeaponSet();
}
}
#endif
mpConfigureQuickTeamSimulants();
if (!challengeIsFeatureUnlocked(MPFEATURE_ONEHITKILLS)) {
@@ -2458,6 +2467,15 @@ void mpEndMatch(void)
challengeConsiderMarkingComplete();
}
#ifndef PLATFORM_N64
if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_END) {
if (g_MpWeaponSetNum == WEAPONSET_RANDOM
|| g_MpWeaponSetNum == WEAPONSET_RANDOMFIVE) {
mpApplyWeaponSet();
}
}
#endif
func0f0f820c(NULL, -6);
}
+60
View File
@@ -31,6 +31,10 @@ struct menudialogdef g_MpChangeTeamNameMenuDialog;
struct menudialogdef g_MpEditSimulantMenuDialog;
struct menudialogdef g_MpSaveSetupNameMenuDialog;
#ifndef PLATFORM_N64
extern s32 g_MpWeaponSetNum;
#endif
MenuItemHandlerResult menuhandlerMpDropOut(s32 operation, struct menuitem *item, union handlerdata *data)
{
if (operation == MENUOP_SET) {
@@ -1160,6 +1164,52 @@ struct menudialogdef g_MpSaveSetupExistsMenuDialog = {
NULL,
};
#ifndef PLATFORM_N64
MenuItemHandlerResult menuhandlerMpAutoRandomWeapon(s32 operation, struct menuitem *item, union handlerdata *data)
{
const char *labels[] = {
"Off",
"Start",
"End",
};
switch (operation) {
case MENUOP_CHECKDISABLED:
case MENUOP_CHECKHIDDEN:
if (g_MpWeaponSetNum == WEAPONSET_RANDOM
|| g_MpWeaponSetNum == WEAPONSET_RANDOMFIVE) {
return false;
}
return true;
case MENUOP_GETOPTIONCOUNT:
data->dropdown.value = 3;
break;
case MENUOP_GETOPTIONTEXT:
return (intptr_t)labels[data->dropdown.value];
case MENUOP_SET:
g_MpSetup.options &= ~(MPOPTION_AUTORANDOMWEAPON_START | MPOPTION_AUTORANDOMWEAPON_END);
if (data->dropdown.value == 1) {
g_MpSetup.options |= MPOPTION_AUTORANDOMWEAPON_START;
} else if (data->dropdown.value == 2) {
g_MpSetup.options |= MPOPTION_AUTORANDOMWEAPON_END;
}
break;
case MENUOP_GETSELECTEDINDEX:
if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_END) {
data->dropdown.value = 2;
} else if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_START) {
data->dropdown.value = 1;
} else {
data->dropdown.value = 0;
}
break;
}
return 0;
}
#endif
struct menuitem g_MpWeaponsMenuItems[] = {
{
MENUITEMTYPE_DROPDOWN,
@@ -1169,6 +1219,16 @@ struct menuitem g_MpWeaponsMenuItems[] = {
0,
menuhandlerMpWeaponSetDropdown,
},
#ifndef PLATFORM_N64
{
MENUITEMTYPE_DROPDOWN,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Auto Random\n",
0,
menuhandlerMpAutoRandomWeapon,
},
#endif
{
MENUITEMTYPE_SEPARATOR,
0,
+2
View File
@@ -2890,6 +2890,8 @@
#define MPOPTION_PAC_HIGHLIGHTTARGET 0x00080000
#define MPOPTION_PAC_SHOWONRADAR 0x00100000
#define MPOPTION_SPAWNWITHWEAPON 0x00200000
#define MPOPTION_AUTORANDOMWEAPON_START 0x00400000
#define MPOPTION_AUTORANDOMWEAPON_END 0x00800000
#define MPPAUSEMODE_UNPAUSED 0
#define MPPAUSEMODE_PAUSED 1