From 3e21ed71a3ae99bc542d9eadca76c283366985cf Mon Sep 17 00:00:00 2001 From: mfrancis95 Date: Mon, 1 Oct 2018 18:27:50 -0400 Subject: [PATCH 1/2] Gracefully error out when player starts are missing --- src/doom/doomstat.h | 2 +- src/doom/p_mobj.c | 1 + src/doom/p_setup.c | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/doom/doomstat.h b/src/doom/doomstat.h index 61c127d4..95246aea 100644 --- a/src/doom/doomstat.h +++ b/src/doom/doomstat.h @@ -228,7 +228,7 @@ extern mapthing_t* deathmatch_p; // Player spawn spots. extern mapthing_t playerstarts[MAXPLAYERS]; - +extern boolean playerstartsingame[MAXPLAYERS]; // Intermission stats. // Parameters for world map / intermission. extern wbstartstruct_t wminfo; diff --git a/src/doom/p_mobj.c b/src/doom/p_mobj.c index dd5a93db..285d9b94 100644 --- a/src/doom/p_mobj.c +++ b/src/doom/p_mobj.c @@ -788,6 +788,7 @@ void P_SpawnMapThing (mapthing_t* mthing) { // save spots for respawning in network games playerstarts[mthing->type-1] = *mthing; + playerstartsingame[mthing->type-1] = true; if (!deathmatch) P_SpawnPlayer (mthing); diff --git a/src/doom/p_setup.c b/src/doom/p_setup.c index ff03d258..044554de 100644 --- a/src/doom/p_setup.c +++ b/src/doom/p_setup.c @@ -107,6 +107,7 @@ byte* rejectmatrix; mapthing_t deathmatchstarts[MAX_DEATHMATCH_STARTS]; mapthing_t* deathmatch_p; mapthing_t playerstarts[MAXPLAYERS]; +boolean playerstartsingame[MAXPLAYERS]; @@ -389,6 +390,11 @@ void P_LoadThings (int lump) P_SpawnMapThing(&spawnthing); } + if (!deathmatch) + for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i] && !playerstartsingame[i]) + I_Error("P_LoadThings: Player %d start missing (vanilla crashes here)", i + 1); + W_ReleaseLumpNum(lump); } From 28e6533feb8aee27e51f88624827064ecefcfbd4 Mon Sep 17 00:00:00 2001 From: mfrancis95 Date: Tue, 2 Oct 2018 01:09:06 -0400 Subject: [PATCH 2/2] Format the previous commit according to Chocolate Doom's coding style guidelines --- src/doom/p_setup.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/doom/p_setup.c b/src/doom/p_setup.c index 044554de..72c81988 100644 --- a/src/doom/p_setup.c +++ b/src/doom/p_setup.c @@ -391,9 +391,15 @@ void P_LoadThings (int lump) } if (!deathmatch) + { for (i = 0; i < MAXPLAYERS; i++) + { if (playeringame[i] && !playerstartsingame[i]) + { I_Error("P_LoadThings: Player %d start missing (vanilla crashes here)", i + 1); + } + } + } W_ReleaseLumpNum(lump); }