Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port: add friendly fire mp option #411

Merged
merged 3 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/game/chraction.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions src/game/mplayer/mplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 8 additions & 0 deletions src/game/mplayer/scenarios/capturethecase.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions src/game/mplayer/scenarios/combat.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions src/game/mplayer/scenarios/hackthatmac.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions src/game/mplayer/scenarios/holdthebriefcase.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions src/game/mplayer/scenarios/kingofthehill.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions src/game/mplayer/scenarios/popacap.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/include/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading