ref: 02da7ebf0aaf2a83010b86f61e03474a4b370595
parent: 990e55915420c60dc8e889c56af91f809aa2cf81
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sat Oct 14 22:00:09 EDT 2023
use unsigned short for zbuffers
--- a/d_local.h
+++ b/d_local.h
@@ -33,6 +33,8 @@
int u, v, count;
} sspan_t;
+typedef u16int uzint;
+
extern cvar_t d_subdiv16;
extern float scale_for_mip;
@@ -64,7 +66,7 @@
extern int D_MipLevelForScale (float scale);
-extern short *d_pzbuffer;
+extern uzint *d_pzbuffer;
extern unsigned int d_zrowbytes, d_zwidth;
extern int *d_pscantable;
@@ -76,7 +78,7 @@
extern pixel_t *d_viewbuffer;
-extern short *zspantable[MAXHEIGHT];
+extern uzint *zspantable[MAXHEIGHT];
extern int d_minmip;
extern float d_scalemip[3];
--- a/d_modech.c
+++ b/d_modech.c
@@ -9,7 +9,7 @@
int d_y_aspect_shift, d_pix_min, d_pix_max, d_pix_shift;
int d_scantable[MAXHEIGHT];
-short *zspantable[MAXHEIGHT];
+uzint *zspantable[MAXHEIGHT];
/*
================
--- a/d_part.c
+++ b/d_part.c
@@ -36,7 +36,7 @@
vec3_t local, transformed;
float zi;
byte *pdest;
- short *pz;
+ uzint *pz;
int i, izi, pix, count, u, v;
// transform point
--- a/d_polyse.c
+++ b/d_polyse.c
@@ -12,7 +12,7 @@
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct {
void *pdest;
- short *pz;
+ uzint *pz;
int count;
byte *ptex;
int sfrac, tfrac, light, zi;
@@ -64,7 +64,7 @@
spanpackage_t *d_pedgespanpackage;
static int ystart;
byte *d_pdest, *d_ptex;
-short *d_pz;
+uzint *d_pz;
int d_sfrac, d_tfrac, d_light, d_zi;
int d_ptexextrastep, d_sfracextrastep;
int d_tfracextrastep, d_lightextrastep, d_pdestextrastep;
@@ -128,7 +128,7 @@
void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts)
{
int i, z;
- short *zbuf;
+ uzint *zbuf;
for (i=0 ; i<numverts ; i++, fv++)
{
@@ -293,7 +293,7 @@
int d;
int new[6];
int z;
- short *zbuf;
+ uzint *zbuf;
d = lp2[0] - lp1[0];
if (d < -1 || d > 1)
@@ -578,7 +578,7 @@
int lsfrac, ltfrac;
int llight;
int lzi;
- short *lpz;
+ uzint *lpz;
do
{
--- a/d_scan.c
+++ b/d_scan.c
@@ -360,7 +360,7 @@
{
int count, doublecount, izistep;
int izi;
- short *pdest;
+ uzint *pdest;
unsigned ltemp;
double zi;
float du, dv;
--- a/d_sprite.c
+++ b/d_sprite.c
@@ -22,7 +22,7 @@
float sdivz, tdivz, zi, z, du, dv, spancountminus1;
float sdivz8stepu, tdivz8stepu, zi8stepu;
byte btemp;
- short *pz;
+ uzint *pz;
sstep = 0; // keep compiler happy
tstep = 0; // ditto
--- a/d_vars.c
+++ b/d_vars.c
@@ -23,6 +23,6 @@
pixel_t *cacheblock;
int cachewidth;
pixel_t *d_viewbuffer;
-short *d_pzbuffer;
+uzint *d_pzbuffer;
unsigned int d_zrowbytes;
unsigned int d_zwidth;
--- a/d_zpoint.c
+++ b/d_zpoint.c
@@ -12,7 +12,7 @@
void D_DrawZPoint (void)
{
byte *pdest;
- short *pz;
+ uzint *pz;
int izi;
pz = d_pzbuffer + (d_zwidth * r_zpointdesc.v) + r_zpointdesc.u;