shithub: riscv

Download patch

ref: 119f35bc702aded0bd57488c275b54872d290bc3
parent: 02ec9f06e426c6b19d4d9368dbe959845aef6928
author: qwx <qwx@sciops.net>
date: Mon Aug 22 18:39:47 EDT 2022

games/doom: raise static limits

makes very large/detailed maps work; raising max intercepts and
spechits may break demos and cause desynchronizations, so they're left
alone despite their potential issues; savegame buffer overflows can
happen for stupidly huge maps with tons of entities

--- a/sys/src/games/doom/g_game.c
+++ b/sys/src/games/doom/g_game.c
@@ -68,7 +68,7 @@
 #include "g_game.h"
 
 
-#define SAVEGAMESIZE	0x2c000
+#define SAVEGAMESIZE	0x200000
 #define SAVESTRINGSIZE	24
 
 
@@ -1203,7 +1203,8 @@
     sprintf (name,SAVEGAMENAME"%d.dsg",savegameslot); 
     description = savedescription; 
 	 
-    save_p = savebuffer = screens[1]+0x4000; 
+    savebuffer = Z_Malloc(SAVEGAMESIZE, PU_STATIC, 0);
+    save_p = savebuffer;
 	 
     memcpy (save_p, description, SAVESTRINGSIZE); 
     save_p += SAVESTRINGSIZE; 
@@ -1239,6 +1240,7 @@
 
     // draw the pattern into the back screen
     R_FillBackScreen ();	
+    Z_Free(savebuffer);	
 } 
  
 
--- a/sys/src/games/doom/i_system.c
+++ b/sys/src/games/doom/i_system.c
@@ -11,7 +11,7 @@
 #include "g_game.h"
 #include "m_misc.h"
 
-int mb_used = 6;	/* 6MB heap */
+int mb_used = 32;	/* 32MB heap */
 
 void I_Init (void)
 {
--- a/sys/src/games/doom/p_spec.c
+++ b/sys/src/games/doom/p_spec.c
@@ -78,7 +78,7 @@
 
 
 
-#define MAXANIMS                32
+#define MAXANIMS                256
 
 extern anim_t	anims[MAXANIMS];
 extern anim_t*	lastanim;
@@ -321,7 +321,7 @@
 // Note: this should be doable w/o a fixed array.
 
 // 20 adjoining sectors max!
-#define MAX_ADJOINING_SECTORS    	20
+#define MAX_ADJOINING_SECTORS    	128
 
 fixed_t
 P_FindNextHighestFloor
--- a/sys/src/games/doom/r_bsp.c
+++ b/sys/src/games/doom/r_bsp.c
@@ -85,7 +85,7 @@
 } cliprange_t;
 
 
-#define MAXSEGS		32
+#define MAXSEGS		SCREENWIDTH/2+1
 
 // newend is one past the last valid seg
 cliprange_t*	newend;
--- a/sys/src/games/doom/r_defs.h
+++ b/sys/src/games/doom/r_defs.h
@@ -52,7 +52,7 @@
 #define SIL_TOP			2
 #define SIL_BOTH		3
 
-#define MAXDRAWSEGS		256
+#define MAXDRAWSEGS		4096
 
 
 
--- a/sys/src/games/doom/r_plane.c
+++ b/sys/src/games/doom/r_plane.c
@@ -47,7 +47,7 @@
 //
 
 // Here comes the obnoxious "visplane".
-#define MAXVISPLANES	128
+#define MAXVISPLANES	1024
 visplane_t		visplanes[MAXVISPLANES];
 visplane_t*		lastvisplane;
 visplane_t*		floorplane;
@@ -54,7 +54,7 @@
 visplane_t*		ceilingplane;
 
 // ?
-#define MAXOPENINGS	SCREENWIDTH*64
+#define MAXOPENINGS	SCREENWIDTH*200
 short			openings[MAXOPENINGS];
 short*			lastopening;
 
--- a/sys/src/games/doom/r_things.h
+++ b/sys/src/games/doom/r_things.h
@@ -24,7 +24,7 @@
 #define __R_THINGS__
 
 
-#define MAXVISSPRITES  	128
+#define MAXVISSPRITES  	4096
 
 extern vissprite_t	vissprites[MAXVISSPRITES];
 extern vissprite_t*	vissprite_p;