diff --git a/src/game/chraction.c b/src/game/chraction.c index a770ee77c..8ff7b6502 100644 --- a/src/game/chraction.c +++ b/src/game/chraction.c @@ -4339,6 +4339,18 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse return; } +#ifndef PLATFORM_N64 + // Don't damage if multiplayer and friendly fire is off + if (g_Vars.mplayerisrunning + && !(g_MpSetup.options & MPOPTION_FRIENDLYFIRE) + && aprop + && aprop != vprop + && (aprop->type == PROPTYPE_PLAYER || aprop->type == PROPTYPE_CHR) + && chr->team == aprop->chr->team) { + return; + } +#endif + if (gset == NULL) { gset = &gset2; } diff --git a/src/game/mplayer/mplayer.c b/src/game/mplayer/mplayer.c index 851a2d1c5..80b9a4c1f 100644 --- a/src/game/mplayer/mplayer.c +++ b/src/game/mplayer/mplayer.c @@ -538,6 +538,10 @@ void mpInit(void) | MPOPTION_PAC_HIGHLIGHTTARGET | MPOPTION_PAC_SHOWONRADAR; +#ifndef PLATFORM_N64 + g_MpSetup.options |= MPOPTION_FRIENDLYFIRE; +#endif + g_Vars.mphilltime = 10; func0f187fec(); diff --git a/src/game/mplayer/scenarios/capturethecase.inc b/src/game/mplayer/scenarios/capturethecase.inc index 529fd2916..192b8923c 100644 --- a/src/game/mplayer/scenarios/capturethecase.inc +++ b/src/game/mplayer/scenarios/capturethecase.inc @@ -77,6 +77,14 @@ struct menuitem g_CtcOptionsMenuItems[] = { MPOPTION_NODRUGBLUR, menuhandlerMpCheckboxOption, }, + { + MENUITEMTYPE_CHECKBOX, + 0, + MENUITEMFLAG_LOCKABLEMINOR, + L_OPTIONS_257, // "Friendly Fire" + MPOPTION_FRIENDLYFIRE, + menuhandlerMpDisplayTeam, + }, #endif { MENUITEMTYPE_CHECKBOX, diff --git a/src/game/mplayer/scenarios/combat.inc b/src/game/mplayer/scenarios/combat.inc index 9e58b6b65..854e38319 100644 --- a/src/game/mplayer/scenarios/combat.inc +++ b/src/game/mplayer/scenarios/combat.inc @@ -72,6 +72,14 @@ struct menuitem g_MpCombatOptionsMenuItems[] = { MPOPTION_NODRUGBLUR, menuhandlerMpCheckboxOption, }, + { + MENUITEMTYPE_CHECKBOX, + 0, + MENUITEMFLAG_LOCKABLEMINOR, + L_OPTIONS_257, // "Friendly Fire" + MPOPTION_FRIENDLYFIRE, + menuhandlerMpDisplayTeam, + }, #endif { MENUITEMTYPE_SEPARATOR, diff --git a/src/game/mplayer/scenarios/hackthatmac.inc b/src/game/mplayer/scenarios/hackthatmac.inc index a158bf9d5..9a7cf4b42 100644 --- a/src/game/mplayer/scenarios/hackthatmac.inc +++ b/src/game/mplayer/scenarios/hackthatmac.inc @@ -75,6 +75,14 @@ struct menuitem g_HtmOptionsMenuItems[] = { MPOPTION_NODRUGBLUR, menuhandlerMpCheckboxOption, }, + { + MENUITEMTYPE_CHECKBOX, + 0, + MENUITEMFLAG_LOCKABLEMINOR, + L_OPTIONS_257, // "Friendly Fire" + MPOPTION_FRIENDLYFIRE, + menuhandlerMpDisplayTeam, + }, #endif { MENUITEMTYPE_CHECKBOX, diff --git a/src/game/mplayer/scenarios/holdthebriefcase.inc b/src/game/mplayer/scenarios/holdthebriefcase.inc index 39f98a728..b4bfedf75 100644 --- a/src/game/mplayer/scenarios/holdthebriefcase.inc +++ b/src/game/mplayer/scenarios/holdthebriefcase.inc @@ -75,6 +75,14 @@ struct menuitem g_HtbOptionsMenuItems[] = { MPOPTION_NODRUGBLUR, menuhandlerMpCheckboxOption, }, + { + MENUITEMTYPE_CHECKBOX, + 0, + MENUITEMFLAG_LOCKABLEMINOR, + L_OPTIONS_257, // "Friendly Fire" + MPOPTION_FRIENDLYFIRE, + menuhandlerMpDisplayTeam, + }, #endif { MENUITEMTYPE_CHECKBOX, diff --git a/src/game/mplayer/scenarios/kingofthehill.inc b/src/game/mplayer/scenarios/kingofthehill.inc index 2a4d5c7aa..ff72ea228 100644 --- a/src/game/mplayer/scenarios/kingofthehill.inc +++ b/src/game/mplayer/scenarios/kingofthehill.inc @@ -96,6 +96,14 @@ struct menuitem g_KohOptionsMenuItems[] = { MPOPTION_NODRUGBLUR, menuhandlerMpCheckboxOption, }, + { + MENUITEMTYPE_CHECKBOX, + 0, + MENUITEMFLAG_LOCKABLEMINOR, + L_OPTIONS_257, // "Friendly Fire" + MPOPTION_FRIENDLYFIRE, + menuhandlerMpDisplayTeam, + }, #endif { MENUITEMTYPE_CHECKBOX, diff --git a/src/game/mplayer/scenarios/popacap.inc b/src/game/mplayer/scenarios/popacap.inc index 26221b569..7e37939f7 100644 --- a/src/game/mplayer/scenarios/popacap.inc +++ b/src/game/mplayer/scenarios/popacap.inc @@ -73,6 +73,14 @@ struct menuitem g_PacOptionsMenuItems[] = { MPOPTION_NODRUGBLUR, menuhandlerMpCheckboxOption, }, + { + MENUITEMTYPE_CHECKBOX, + 0, + MENUITEMFLAG_LOCKABLEMINOR, + L_OPTIONS_257, // "Friendly Fire" + MPOPTION_FRIENDLYFIRE, + menuhandlerMpDisplayTeam, + }, #endif { MENUITEMTYPE_CHECKBOX, diff --git a/src/include/constants.h b/src/include/constants.h index 5a51e08c5..f6fea0f11 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -2894,6 +2894,7 @@ #define MPOPTION_NODRUGBLUR 0x00400000 #define MPOPTION_AUTORANDOMWEAPON_START 0x00800000 #define MPOPTION_AUTORANDOMWEAPON_END 0x01000000 +#define MPOPTION_FRIENDLYFIRE 0x02000000 #define MPPAUSEMODE_UNPAUSED 0 #define MPPAUSEMODE_PAUSED 1