shithub: choc

Download patch

ref: 3181ed3caeaaefc20806486078f71919bc770bc9
parent: b18f4641c3043d097038a8e391687a8735197898
author: mfrancis95 <mikefrancis95@gmail.com>
date: Mon Dec 17 20:11:24 EST 2018

Heretic: Gracefully error out when player starts are missing (fix #1122)

--- a/src/heretic/doomdef.h
+++ b/src/heretic/doomdef.h
@@ -553,6 +553,7 @@
 extern mapthing_t *deathmatch_p;
 extern mapthing_t deathmatchstarts[10];
 extern mapthing_t playerstarts[MAXPLAYERS];
+extern boolean playerstartsingame[MAXPLAYERS];
 
 extern int mouseSensitivity;
 
--- a/src/heretic/p_mobj.c
+++ b/src/heretic/p_mobj.c
@@ -1052,6 +1052,7 @@
     {
         // save spots for respawning in network games
         playerstarts[mthing->type - 1] = *mthing;
+        playerstartsingame[mthing->type - 1] = true;
         if (!deathmatch)
         {
             P_SpawnPlayer(mthing);
--- a/src/heretic/p_setup.c
+++ b/src/heretic/p_setup.c
@@ -60,6 +60,7 @@
 
 mapthing_t deathmatchstarts[10], *deathmatch_p;
 mapthing_t playerstarts[MAXPLAYERS];
+boolean playerstartsingame[MAXPLAYERS];
 
 /*
 =================
@@ -277,6 +278,18 @@
         spawnthing.type = SHORT(mt->type);
         spawnthing.options = SHORT(mt->options);
         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);
+            }
+            playerstartsingame[i] = false;
+        }
     }
 
     W_ReleaseLumpNum(lump);