aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwyatt8740 <wyatt8740@users.noreply.github.com>2023-10-02 02:28:26 -0400
committerwyatt8740 <wyatt8740@users.noreply.github.com>2023-10-02 02:28:26 -0400
commit7088dac899e165e84133ba99e1549a1dadec054f (patch)
tree50ef835bae28eb65b4c4d36565e8eeee536cf2b9
parent45959aa12ee28db62ef8be97a0d5e0bc5644b691 (diff)
downloadquake-pum-7088dac899e165e84133ba99e1549a1dadec054f.tar.gz
fixed water warping effect crashing the game after increasing MAXHEIGHT and MAXWIDTH for software rendered quakeworld.
-rw-r--r--QW/client/d_scan.c4
-rw-r--r--QW/client/r_draw.c4
-rw-r--r--QW/client/r_main.c2
-rw-r--r--QW/client/r_shared.h8
4 files changed, 11 insertions, 7 deletions
diff --git a/QW/client/d_scan.c b/QW/client/d_scan.c
index 292bb56..46e0ef7 100644
--- a/QW/client/d_scan.c
+++ b/QW/client/d_scan.c
@@ -49,8 +49,8 @@ void D_WarpScreen (void)
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;
diff --git a/QW/client/r_draw.c b/QW/client/r_draw.c
index 81262f7..2ccf316 100644
--- a/QW/client/r_draw.c
+++ b/QW/client/r_draw.c
@@ -50,8 +50,8 @@ qboolean r_leftclipped, r_rightclipped;
static qboolean makeleftedge, makerightedge;
qboolean r_nearzionly;
-int sintable[1280];
-int intsintable[1280];
+int sintable[SIN_BUFFER_SIZE];
+int intsintable[SIN_BUFFER_SIZE];
mvertex_t r_leftenter, r_leftexit;
mvertex_t r_rightenter, r_rightexit;
diff --git a/QW/client/r_main.c b/QW/client/r_main.c
index 3f59588..64363d0 100644
--- a/QW/client/r_main.c
+++ b/QW/client/r_main.c
@@ -1095,7 +1095,7 @@ void R_InitTurb (void)
{
int i;
- for (i=0 ; i<1280 ; i++)
+ for (i=0 ; i<(SIN_BUFFER_SIZE) ; i++)
{
sintable[i] = AMP + sin(i*3.14159*2/CYCLE)*AMP;
intsintable[i] = AMP2 + sin(i*3.14159*2/CYCLE)*AMP2; // AMP2, not 20
diff --git a/QW/client/r_shared.h b/QW/client/r_shared.h
index ed831b3..9a2a103 100644
--- a/QW/client/r_shared.h
+++ b/QW/client/r_shared.h
@@ -33,6 +33,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAXHEIGHT 2048
#define MAXWIDTH 2560
+#define MAXDIMENSION ((MAXHEIGHT > MAXWIDTH) ? MAXHEIGHT : MAXWIDTH)
+
+#define SIN_BUFFER_SIZE (MAXDIMENSION+CYCLE)
+
#define INFINITE_DISTANCE 0x10000 // distance that's always guaranteed to
// be farther away than anything in
// the scene
@@ -51,8 +55,8 @@ extern int r_drawnpolycount;
extern cvar_t r_clearcolor;
-extern int sintable[1280];
-extern int intsintable[1280];
+extern int sintable[SIN_BUFFER_SIZE];
+extern int intsintable[SIN_BUFFER_SIZE];
extern vec3_t vup, base_vup;
extern vec3_t vpn, base_vpn;