shithub: qk2

Download patch

ref: 36c20e512ee17296b16e79a6010d0deb31e4dcbd
parent: 46ce4198481f1e07568961f745850da6d9b5b468
author: qwx <>
date: Sat Dec 15 14:35:00 EST 2018

fix some hardcoded table sizes

--- a/dat.h
+++ b/dat.h
@@ -1980,9 +1980,9 @@
 extern pixel_t *cacheblock;
 extern int r_screenwidth;
 extern int r_drawnpolycount;
-extern int sintable[1280];
-extern int intsintable[1280];
-extern int blanktable[1280];
+extern int sintable[MAXWIDTH];
+extern int intsintable[nelem(sintable)];
+extern int blanktable[nelem(sintable)];
 extern vec3_t vup;
 extern vec3_t base_vup;
 extern vec3_t vpn;
--- a/r_main.c
+++ b/r_main.c
@@ -211,7 +211,7 @@
 {
 	int		i;
 	
-	for (i=0 ; i<1280 ; i++)
+	for (i=0 ; i<nelem(sintable) ; i++)
 	{
 		sintable[i] = AMP + sin(i*3.14159*2/CYCLE)*AMP;
 		intsintable[i] = AMP2 + sin(i*3.14159*2/CYCLE)*AMP2;	// AMP2, not 20
--- a/r_rast.c
+++ b/r_rast.c
@@ -25,9 +25,9 @@
 static qboolean	makeleftedge, makerightedge;
 qboolean		r_nearzionly;
 
-int		sintable[1280];
-int		intsintable[1280];
-int		blanktable[1280];		// PGM
+int		sintable[MAXWIDTH];
+int		intsintable[nelem(sintable)];
+int		blanktable[nelem(sintable)];		// PGM
 
 mvertex_t	r_leftenter, r_leftexit;
 mvertex_t	r_rightenter, r_rightexit;
--- a/r_scan.c
+++ b/r_scan.c
@@ -32,8 +32,8 @@
 	byte	**row;
 
 	static int	cached_width, cached_height;
-	static byte	*rowptr[1200+AMP2*2];
-	static int	column[1600+AMP2*2];
+	static byte	*rowptr[MAXHEIGHT+AMP2*2];
+	static int	column[MAXWIDTH+AMP2*2];
 
 	//
 	// these are constant over resolutions, and can be saved