// Chocolate-heretic-plus bumps limits and removes crashing menu. 
// Make a new directory and run these two commands in it.
// $git clone https://github.com/chocolate-doom/chocolate-doom chocolate-heretic-plus
// $patch -p0  < chocolate-heretic-plus.patch
// Recommend renaming the chocolate-heretic binary and moving it to where 
// 	the other chocolate-doom binaries are.
// Also removes "Bad V_DrawPatch" crash. May break something else.

diff -ruN chocolate-heretic-plus/src/heretic/doomdef.h chocolate-doom/src/heretic/doomdef.h
--- chocolate-heretic-plus/src/heretic/doomdef.h	2021-09-08 07:18:19.828328602 -0400
+++ chocolate-doom/src/heretic/doomdef.h	2021-09-08 07:13:29.565229616 -0400
@@ -547,7 +547,7 @@
 
 extern ticcmd_t *netcmds;
 
-#define SAVEGAMESIZE 0x30000
+#define SAVEGAMESIZE 0x30000*16
 #define SAVESTRINGSIZE 24
 
 extern mapthing_t *deathmatch_p;
diff -ruN chocolate-heretic-plus/src/heretic/p_spec.h chocolate-doom/src/heretic/p_spec.h
--- chocolate-heretic-plus/src/heretic/p_spec.h	2021-09-08 07:18:19.848329370 -0400
+++ chocolate-doom/src/heretic/p_spec.h	2021-09-08 07:13:29.569229768 -0400
@@ -55,7 +55,7 @@
 //
 //      Animating line specials
 //
-#define	MAXLINEANIMS		64
+#define	MAXLINEANIMS		64*256
 extern short numlinespecials;
 extern line_t *linespeciallist[MAXLINEANIMS];
 
@@ -183,8 +183,8 @@
     void *soundorg;
 } button_t;
 
-#define	MAXSWITCHES	50      // max # of wall switches in a level
-#define	MAXBUTTONS	16      // 4 players, 4 buttons each at once, max.
+#define	MAXSWITCHES	50*4      // max # of wall switches in a level
+#define	MAXBUTTONS	16*4      // 4 players, 4 buttons each at once, max.
 #define BUTTONTIME	35      // 1 second
 
 extern button_t buttonlist[MAXBUTTONS];
@@ -233,7 +233,7 @@
 
 #define	PLATWAIT	3
 #define	PLATSPEED	FRACUNIT
-#define	MAXPLATS	30
+#define	MAXPLATS	30*256
 
 extern plat_t *activeplats[MAXPLATS];
 
diff -ruN chocolate-heretic-plus/src/heretic/r_bsp.c chocolate-doom/src/heretic/r_bsp.c
--- chocolate-heretic-plus/src/heretic/r_bsp.c	2021-09-08 07:18:19.852329524 -0400
+++ chocolate-doom/src/heretic/r_bsp.c	2021-09-08 07:13:29.569229768 -0400
@@ -448,7 +448,7 @@
     }
 
     // check for solidsegs overflow - extremely unsatisfactory!
-    if(newend > &solidsegs[32])
+    if(newend > &solidsegs[32*16])
         I_Error("R_Subsector: solidsegs overflow (vanilla may crash here)\n");
 }
 
diff -ruN chocolate-heretic-plus/src/heretic/r_local.h chocolate-doom/src/heretic/r_local.h
--- chocolate-heretic-plus/src/heretic/r_local.h	2021-09-08 07:18:19.852329524 -0400
+++ chocolate-doom/src/heretic/r_local.h	2021-09-08 07:13:29.569229768 -0400
@@ -147,8 +147,8 @@
 
 typedef byte lighttable_t;      // this could be wider for >8 bit display
 
-#define	MAXVISPLANES	128
-#define	MAXOPENINGS		SCREENWIDTH*64
+#define	MAXVISPLANES	128*8
+#define	MAXOPENINGS		SCREENWIDTH*64*8
 
 typedef struct
 {
@@ -184,7 +184,7 @@
 #define SIL_TOP		2
 #define	SIL_BOTH	3
 
-#define	MAXDRAWSEGS		256
+#define	MAXDRAWSEGS		256*8
 
 // A vissprite_t is a thing that will be drawn during a refresh
 typedef struct vissprite_s
@@ -400,7 +400,7 @@
 //
 // R_things.c
 //
-#define	MAXVISSPRITES	128
+#define	MAXVISSPRITES	128*8
 
 extern vissprite_t vissprites[MAXVISSPRITES], *vissprite_p;
 extern vissprite_t vsprsortedhead;
diff -ruN chocolate-heretic-plus/src/v_video.c chocolate-doom/src/v_video.c
--- chocolate-heretic-plus/src/v_video.c	2021-09-08 07:18:19.948333209 -0400
+++ chocolate-doom/src/v_video.c	2021-09-08 07:17:54.279348071 -0400
@@ -158,16 +158,6 @@
             return;
     }
 
-#ifdef RANGECHECK
-    if (x < 0
-     || x + SHORT(patch->width) > SCREENWIDTH
-     || y < 0
-     || y + SHORT(patch->height) > SCREENHEIGHT)
-    {
-        I_Error("Bad V_DrawPatch");
-    }
-#endif
-
     V_MarkRect(x, y, SHORT(patch->width), SHORT(patch->height));
 
     col = 0;
