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

Feature/multiplayer things spawn options #1175

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
16 changes: 16 additions & 0 deletions src/doom/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ boolean nomonsters; // checkparm of -nomonsters
boolean respawnparm; // checkparm of -respawn
boolean fastparm; // checkparm of -fast
boolean coop_spawns = false; // [crispy] checkparm of -coop_spawns
boolean coop2 = false; // [crispy] checkparm of -coop2
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we èven need this? What if we simply track "coop2" as "deathmatch == 4"?




Expand Down Expand Up @@ -1577,6 +1578,21 @@ void D_DoomMain (void)
if (M_CheckParm ("-dm3"))
deathmatch = 3;

//!
// @arg <n>
// @category net
//
// [crispy] Start a coop game.
// Spawn mp monsters. Don't spawn other mp things.
//

p = M_ParmExists("-coop2");

if (p)
{
coop2 = true;
}

if (devparm)
DEH_printf(D_DEVSTR);

Expand Down
35 changes: 33 additions & 2 deletions src/doom/d_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,37 @@ static loop_interface_t doom_loop_interface = {
M_Ticker
};

//
// LoadDeathmatchGameSettings
// [crispy] Loads correct deatmatch setting from a net game
//
static void LoadDeathmatchGameSettings(int deathmatch_setings)
{
if (deathmatch_setings == 4)
{
coop2 = true;
deathmatch = 0;
return;
}

deathmatch = deathmatch_setings;
}

//
// SaveDeathmatchGameSettings
// [crispy] Saves correct deatmatch setting for a net game
// from global variables
//
static void SaveDeathmatchGameSettings(net_gamesettings_t *settings)
{
if (coop2)
{
settings->deathmatch = 4;
return;
}

settings->deathmatch = deathmatch;
}

// Load game settings from the specified structure and
// set global variables.
Expand All @@ -108,7 +139,7 @@ static void LoadGameSettings(net_gamesettings_t *settings)
{
unsigned int i;

deathmatch = settings->deathmatch;
LoadDeathmatchGameSettings(settings->deathmatch); // [crispy]
startepisode = settings->episode;
startmap = settings->map;
startskill = settings->skill;
Expand Down Expand Up @@ -140,7 +171,7 @@ static void SaveGameSettings(net_gamesettings_t *settings)
// Fill in game settings structure with appropriate parameters
// for the new game

settings->deathmatch = deathmatch;
SaveDeathmatchGameSettings(settings); // [crispy]
settings->episode = startepisode;
settings->map = startmap;
settings->skill = startskill;
Expand Down
1 change: 1 addition & 0 deletions src/doom/doomstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ extern boolean nomonsters; // checkparm of -nomonsters
extern boolean respawnparm; // checkparm of -respawn
extern boolean fastparm; // checkparm of -fast
extern boolean coop_spawns; // [crispy] checkparm of -coop_spawns
extern boolean coop2; // [crispy] checkparm of -coop2

extern boolean devparm; // DEBUG: launched with -devparm

Expand Down
6 changes: 6 additions & 0 deletions src/doom/p_mobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,12 @@ void P_SpawnMapThing (mapthing_t* mthing)
return;
}

// [crispy] Don't spawn any mp-only things except monsters in the netgame
if (netgame && coop2 && (mthing->options & 16) && !(i == MT_SKULL || (mobjinfo[i].flags & MF_COUNTKILL)))
{
return;
}

// spawn it
x = mthing->x << FRACBITS;
y = mthing->y << FRACBITS;
Expand Down
2 changes: 1 addition & 1 deletion src/net_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ boolean NET_ValidGameSettings(GameMode_t mode, GameMission_t mission,
if (settings->extratics < 0)
return false;

if (settings->deathmatch < 0 || settings->deathmatch > 3)
if (settings->deathmatch < 0 || settings->deathmatch > 4)
return false;

if (settings->skill < sk_noitems || settings->skill > sk_nightmare)
Expand Down
6 changes: 5 additions & 1 deletion src/setup/multiplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static const char *strife_skills[] =

static const char *character_classes[] = { "Fighter", "Cleric", "Mage" };

static const char *gamemodes[] = { "Co-operative", "Deathmatch", "Deathmatch 2.0", "Deathmatch 3.0" };
static const char *gamemodes[] = { "Co-operative", "Deathmatch", "Deathmatch 2.0", "Deathmatch 3.0", "Coop 2" };

static const char *strife_gamemodes[] =
{
Expand Down Expand Up @@ -272,6 +272,10 @@ static void StartGame(int multiplayer)
{
AddCmdLineParameter(exec, "-dm3");
}
else if (deathmatch == 4) // [cripsy] Coop 2
{
AddCmdLineParameter(exec, "-coop2");
}

if (timer > 0)
{
Expand Down