diff --git a/src/game/mplayer/mplayer.c b/src/game/mplayer/mplayer.c index 20270b1ed..851a2d1c5 100644 --- a/src/game/mplayer/mplayer.c +++ b/src/game/mplayer/mplayer.c @@ -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); } diff --git a/src/game/mplayer/setup.c b/src/game/mplayer/setup.c index 87b99860d..44834bbfb 100644 --- a/src/game/mplayer/setup.c +++ b/src/game/mplayer/setup.c @@ -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) +{ + static 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 = ARRAYCOUNT(labels); + 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 == AUTORANDOMWEAPON_START) { + g_MpSetup.options |= MPOPTION_AUTORANDOMWEAPON_START; + } else if (data->dropdown.value == AUTORANDOMWEAPON_END) { + g_MpSetup.options |= MPOPTION_AUTORANDOMWEAPON_END; + } + break; + case MENUOP_GETSELECTEDINDEX: + if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_END) { + data->dropdown.value = AUTORANDOMWEAPON_END; + } else if (g_MpSetup.options & MPOPTION_AUTORANDOMWEAPON_START) { + data->dropdown.value = AUTORANDOMWEAPON_START; + } else { + data->dropdown.value = AUTORANDOMWEAPON_OFF; + } + 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, diff --git a/src/include/constants.h b/src/include/constants.h index cb57fe34b..5a51e08c5 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -2892,6 +2892,8 @@ #define MPOPTION_PAC_SHOWONRADAR 0x00100000 #define MPOPTION_SPAWNWITHWEAPON 0x00200000 #define MPOPTION_NODRUGBLUR 0x00400000 +#define MPOPTION_AUTORANDOMWEAPON_START 0x00800000 +#define MPOPTION_AUTORANDOMWEAPON_END 0x01000000 #define MPPAUSEMODE_UNPAUSED 0 #define MPPAUSEMODE_PAUSED 1 @@ -3804,6 +3806,10 @@ #define SLOWMOTION_ON 1 #define SLOWMOTION_SMART 2 +#define AUTORANDOMWEAPON_OFF 0 +#define AUTORANDOMWEAPON_START 1 +#define AUTORANDOMWEAPON_END 2 + #define SMOKETYPE_NONE 0 #define SMOKETYPE_ELECTRICAL 1 // Dr Caroll, mainframes in Infiltration bunker #define SMOKETYPE_MINI 2 // Phoenix, Laptop sentry