mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
Replace some uses of 9999/-9999, and 999999/-999999 with FLT_MAX/-FLT_MAX
Was sent a sample map where the texture scale was such that the CalcSurfaceExtents mins/maxs were calculated incorrectly because of the use of 999999 not being large enough magnitude, leading to a crash later (maxs-mins was negative). git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1671 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
be4dbdb29c
commit
ad3aadb373
5 changed files with 13 additions and 14 deletions
|
@ -1002,8 +1002,8 @@ void CalcSurfaceExtents (msurface_t *s)
|
|||
mtexinfo_t *tex;
|
||||
int bmins[2], bmaxs[2];
|
||||
|
||||
mins[0] = mins[1] = 999999;
|
||||
maxs[0] = maxs[1] = -999999; // FIXME: change these two to FLT_MAX/-FLT_MAX
|
||||
mins[0] = mins[1] = FLT_MAX;
|
||||
maxs[0] = maxs[1] = -FLT_MAX;
|
||||
|
||||
tex = s->texinfo;
|
||||
|
||||
|
@ -1114,8 +1114,8 @@ void Mod_CalcSurfaceBounds (msurface_t *s)
|
|||
int i, e;
|
||||
mvertex_t *v;
|
||||
|
||||
s->mins[0] = s->mins[1] = s->mins[2] = 9999;
|
||||
s->maxs[0] = s->maxs[1] = s->maxs[2] = -9999;
|
||||
s->mins[0] = s->mins[1] = s->mins[2] = FLT_MAX;
|
||||
s->maxs[0] = s->maxs[1] = s->maxs[2] = -FLT_MAX;
|
||||
|
||||
for (i=0 ; i<s->numedges ; i++)
|
||||
{
|
||||
|
@ -2421,8 +2421,8 @@ void Mod_CalcAliasBounds (aliashdr_t *a)
|
|||
//clear out all data
|
||||
for (i=0; i<3;i++)
|
||||
{
|
||||
loadmodel->mins[i] = loadmodel->ymins[i] = loadmodel->rmins[i] = 999999;
|
||||
loadmodel->maxs[i] = loadmodel->ymaxs[i] = loadmodel->rmaxs[i] = -999999;
|
||||
loadmodel->mins[i] = loadmodel->ymins[i] = loadmodel->rmins[i] = FLT_MAX;
|
||||
loadmodel->maxs[i] = loadmodel->ymaxs[i] = loadmodel->rmaxs[i] = -FLT_MAX;
|
||||
radius = yawradius = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -991,8 +991,8 @@ void Sky_DrawSky (void)
|
|||
//
|
||||
for (i=0 ; i<6 ; i++)
|
||||
{
|
||||
skymins[0][i] = skymins[1][i] = 9999;
|
||||
skymaxs[0][i] = skymaxs[1][i] = -9999;
|
||||
skymins[0][i] = skymins[1][i] = FLT_MAX;
|
||||
skymaxs[0][i] = skymaxs[1][i] = -FLT_MAX;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -56,8 +56,8 @@ void BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
|
|||
int i, j;
|
||||
float *v;
|
||||
|
||||
mins[0] = mins[1] = mins[2] = 999999999;
|
||||
maxs[0] = maxs[1] = maxs[2] = -999999999;
|
||||
mins[0] = mins[1] = mins[2] = FLT_MAX;
|
||||
maxs[0] = maxs[1] = maxs[2] = -FLT_MAX;
|
||||
v = verts;
|
||||
for (i=0 ; i<numverts ; i++)
|
||||
for (j=0 ; j<3 ; j++, v++)
|
||||
|
|
|
@ -202,8 +202,8 @@ static void SetMinMaxSize (edict_t *e, float *minvec, float *maxvec, qboolean ro
|
|||
VectorCopy (minvec, bounds[0]);
|
||||
VectorCopy (maxvec, bounds[1]);
|
||||
|
||||
rmin[0] = rmin[1] = rmin[2] = 9999;
|
||||
rmax[0] = rmax[1] = rmax[2] = -9999;
|
||||
rmin[0] = rmin[1] = rmin[2] = FLT_MAX;
|
||||
rmax[0] = rmax[1] = rmax[2] = -FLT_MAX;
|
||||
|
||||
for (i = 0; i <= 1; i++)
|
||||
{
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <float.h>
|
||||
|
||||
/*==========================================================================*/
|
||||
|
||||
|
@ -79,13 +80,11 @@
|
|||
#define Q_MAXSHORT ((short)0x7fff)
|
||||
#define Q_MAXINT ((int)0x7fffffff)
|
||||
#define Q_MAXLONG ((int)0x7fffffff)
|
||||
#define Q_MAXFLOAT ((int)0x7fffffff)
|
||||
|
||||
#define Q_MINCHAR ((char)0x80)
|
||||
#define Q_MINSHORT ((short)0x8000)
|
||||
#define Q_MININT ((int)0x80000000)
|
||||
#define Q_MINLONG ((int)0x80000000)
|
||||
#define Q_MINFLOAT ((int)0x7fffffff)
|
||||
|
||||
/* Make sure the types really have the right
|
||||
* sizes: These macros are from SDL headers.
|
||||
|
|
Loading…
Reference in a new issue