ref: 0804001177b1f91b9ba126efa8369bc26a38c57a
parent: b165d7bb0ccfe03c70e1fc65a0cec5d5d7a27caa
author: qwx <>
date: Sun Dec 23 08:39:34 EST 2018
qw: warp fixes (from quake2) fixes crashes on resolutions > 1280x1024 when drawing underwater
--- a/qw/d_scan.c
+++ b/qw/d_scan.c
@@ -29,8 +29,8 @@
int *turb;
int *col;
byte **row;
- byte *rowptr[1024];
- int column[1280];
+ byte *rowptr[MAXHEIGHT+AMP2*2];
+ int column[MAXWIDTH+AMP2*2];
float wratio, hratio;
w = r_refdef.vrect.width;
@@ -372,7 +372,7 @@
do
{
- pdest = d_pzbuffer + (d_zwidth * pspan->v) + pspan->u;
+ pdest = d_pzbuffer + (d_zwidth * abs(pspan->v)) + pspan->u;
count = pspan->count;
--- a/qw/r_draw.c
+++ b/qw/r_draw.c
@@ -29,8 +29,8 @@
static qboolean makeleftedge, makerightedge;
qboolean r_nearzionly;
-int sintable[1280];
-int intsintable[1280];
+int sintable[MAXWIDTH+CYCLE];
+int intsintable[nelem(sintable)];
mvertex_t r_leftenter, r_leftexit;
mvertex_t r_rightenter, r_rightexit;
--- a/qw/r_main.c
+++ b/qw/r_main.c
@@ -1031,7 +1031,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/qw/r_shared.h
+++ b/qw/r_shared.h
@@ -27,8 +27,8 @@
extern cvar_t r_clearcolor;
-extern int sintable[1280];
-extern int intsintable[1280];
+extern int sintable[MAXWIDTH+CYCLE];
+extern int intsintable[nelem(sintable)];
extern vec3_t vup, base_vup;
extern vec3_t vpn, base_vpn;