Merge pull request #412 from jonaeru/port-autorandom

port: add auto random mp weapon option
This commit is contained in:
fgsfds authored and GitHub committed 2024-05-14 11:21:22 +02:00
commit 51d842f516
3 files changed
+84

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)
{
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,
+6
View File
@@ -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