mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 07:12:03 +00:00
Merge branch 'float_equal' into 'master'
Clear Float equal warnings See merge request STJr/SRB2!383
This commit is contained in:
commit
58a2cec70f
9 changed files with 32 additions and 24 deletions
|
@ -112,9 +112,7 @@ ifndef GCC295
|
||||||
WFLAGS+=-Wno-div-by-zero
|
WFLAGS+=-Wno-div-by-zero
|
||||||
endif
|
endif
|
||||||
#WFLAGS+=-Wsystem-headers
|
#WFLAGS+=-Wsystem-headers
|
||||||
ifndef ERRORMODE
|
WFLAGS+=-Wfloat-equal
|
||||||
#WFLAGS+=-Wfloat-equal
|
|
||||||
endif
|
|
||||||
#WFLAGS+=-Wtraditional
|
#WFLAGS+=-Wtraditional
|
||||||
ifdef VCHELP
|
ifdef VCHELP
|
||||||
WFLAGS+=-Wdeclaration-after-statement
|
WFLAGS+=-Wdeclaration-after-statement
|
||||||
|
|
|
@ -1102,7 +1102,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
|
||||||
if (var->flags & CV_FLOAT)
|
if (var->flags & CV_FLOAT)
|
||||||
{
|
{
|
||||||
double d = atof(valstr);
|
double d = atof(valstr);
|
||||||
if (!d && valstr[0] != '0')
|
if (fpclassify(d) == FP_ZERO && valstr[0] != '0')
|
||||||
v = INT32_MIN;
|
v = INT32_MIN;
|
||||||
else
|
else
|
||||||
v = (INT32)(d * FRACUNIT);
|
v = (INT32)(d * FRACUNIT);
|
||||||
|
|
|
@ -193,7 +193,7 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
||||||
v2dy = bsp->dy;
|
v2dy = bsp->dy;
|
||||||
|
|
||||||
den = v2dy*v1dx - v2dx*v1dy;
|
den = v2dy*v1dx - v2dx*v1dy;
|
||||||
if (fabs(den) < 1.0E-36f) // avoid checking exactly for 0.0
|
if (fabsf((float)den) < 1.0E-36f) // avoid checking exactly for 0.0
|
||||||
return NULL; // parallel
|
return NULL; // parallel
|
||||||
|
|
||||||
// first check the frac along the polygon segment,
|
// first check the frac along the polygon segment,
|
||||||
|
@ -235,6 +235,11 @@ static boolean SameVertice (polyvertex_t *p1, polyvertex_t *p2)
|
||||||
return false;
|
return false;
|
||||||
if (p1->y != p2->y)
|
if (p1->y != p2->y)
|
||||||
return false;
|
return false;
|
||||||
|
#elif 0
|
||||||
|
if (fabsf( p2->x - p1->x ) > 1.0E-36f )
|
||||||
|
return false;
|
||||||
|
if (fabsf( p2->y - p1->y ) > 1.0E-36f )
|
||||||
|
return false;
|
||||||
#else
|
#else
|
||||||
#define DIVLINE_VERTEX_DIFF 0.45f
|
#define DIVLINE_VERTEX_DIFF 0.45f
|
||||||
float ep = DIVLINE_VERTEX_DIFF;
|
float ep = DIVLINE_VERTEX_DIFF;
|
||||||
|
|
|
@ -227,14 +227,14 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
||||||
Z_Free(realpatch);
|
Z_Free(realpatch);
|
||||||
}
|
}
|
||||||
// centre screen
|
// centre screen
|
||||||
if ((float)vid.width != (float)BASEVIDWIDTH * dupx)
|
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||||
{
|
{
|
||||||
if (option & V_SNAPTORIGHT)
|
if (option & V_SNAPTORIGHT)
|
||||||
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||||
else if (!(option & V_SNAPTOLEFT))
|
else if (!(option & V_SNAPTOLEFT))
|
||||||
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2;
|
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2;
|
||||||
}
|
}
|
||||||
if ((float)vid.height != (float)BASEVIDHEIGHT * dupy)
|
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||||
{
|
{
|
||||||
if ((option & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM))
|
if ((option & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM))
|
||||||
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
|
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
|
||||||
|
@ -375,14 +375,14 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||||
Z_Free(realpatch);
|
Z_Free(realpatch);
|
||||||
}
|
}
|
||||||
// centre screen
|
// centre screen
|
||||||
if ((float)vid.width != (float)BASEVIDWIDTH * dupx)
|
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||||
{
|
{
|
||||||
if (option & V_SNAPTORIGHT)
|
if (option & V_SNAPTORIGHT)
|
||||||
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||||
else if (!(option & V_SNAPTOLEFT))
|
else if (!(option & V_SNAPTOLEFT))
|
||||||
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2;
|
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2;
|
||||||
}
|
}
|
||||||
if ((float)vid.height != (float)BASEVIDHEIGHT * dupy)
|
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||||
{
|
{
|
||||||
if ((option & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM))
|
if ((option & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM))
|
||||||
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
|
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
|
||||||
|
@ -834,14 +834,14 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||||
fw *= dupx;
|
fw *= dupx;
|
||||||
fh *= dupy;
|
fh *= dupy;
|
||||||
|
|
||||||
if ((float)vid.width != (float)BASEVIDWIDTH * dupx)
|
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||||
{
|
{
|
||||||
if (color & V_SNAPTORIGHT)
|
if (color & V_SNAPTORIGHT)
|
||||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||||
else if (!(color & V_SNAPTOLEFT))
|
else if (!(color & V_SNAPTOLEFT))
|
||||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
|
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
|
||||||
}
|
}
|
||||||
if ((float)vid.height != (float)BASEVIDHEIGHT * dupy)
|
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||||
{
|
{
|
||||||
// same thing here
|
// same thing here
|
||||||
if (color & V_SNAPTOBOTTOM)
|
if (color & V_SNAPTOBOTTOM)
|
||||||
|
|
|
@ -4137,7 +4137,7 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t
|
||||||
swallVerts[0].z = swallVerts[3].z = spr->z1;
|
swallVerts[0].z = swallVerts[3].z = spr->z1;
|
||||||
swallVerts[2].z = swallVerts[1].z = spr->z2;
|
swallVerts[2].z = swallVerts[1].z = spr->z2;
|
||||||
|
|
||||||
if (spr->mobj && this_scale != 1.0f)
|
if (spr->mobj && fabsf(this_scale - 1.0f) > 1.0E-36f)
|
||||||
{
|
{
|
||||||
// Always a pixel above the floor, perfectly flat.
|
// Always a pixel above the floor, perfectly flat.
|
||||||
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->ty - gpatch->topoffset * this_scale - (floorheight+3);
|
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->ty - gpatch->topoffset * this_scale - (floorheight+3);
|
||||||
|
@ -4305,7 +4305,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||||
wallVerts[1].z = wallVerts[2].z = spr->z2;
|
wallVerts[1].z = wallVerts[2].z = spr->z2;
|
||||||
|
|
||||||
wallVerts[2].y = wallVerts[3].y = spr->ty;
|
wallVerts[2].y = wallVerts[3].y = spr->ty;
|
||||||
if (spr->mobj && this_scale != 1.0f)
|
if (spr->mobj && fabsf(this_scale - 1.0f) > 1.0E-36f)
|
||||||
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height * this_scale;
|
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height * this_scale;
|
||||||
else
|
else
|
||||||
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height;
|
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height;
|
||||||
|
@ -4595,7 +4595,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
||||||
wallVerts[0].x = wallVerts[3].x = spr->x1;
|
wallVerts[0].x = wallVerts[3].x = spr->x1;
|
||||||
wallVerts[2].x = wallVerts[1].x = spr->x2;
|
wallVerts[2].x = wallVerts[1].x = spr->x2;
|
||||||
wallVerts[2].y = wallVerts[3].y = spr->ty;
|
wallVerts[2].y = wallVerts[3].y = spr->ty;
|
||||||
if (spr->mobj && this_scale != 1.0f)
|
if (spr->mobj && fabsf(this_scale - 1.0f) > 1.0E-36f)
|
||||||
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height * this_scale;
|
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height * this_scale;
|
||||||
else
|
else
|
||||||
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height;
|
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height;
|
||||||
|
@ -4851,7 +4851,7 @@ static void HWR_SortVisSprites(void)
|
||||||
best = ds;
|
best = ds;
|
||||||
}
|
}
|
||||||
// order visprites of same scale by dispoffset, smallest first
|
// order visprites of same scale by dispoffset, smallest first
|
||||||
else if (ds->tz == bestdist && ds->dispoffset < bestdispoffset)
|
else if (fabsf(ds->tz - bestdist) < 1.0E-36f && ds->dispoffset < bestdispoffset)
|
||||||
{
|
{
|
||||||
bestdispoffset = ds->dispoffset;
|
bestdispoffset = ds->dispoffset;
|
||||||
best = ds;
|
best = ds;
|
||||||
|
@ -5772,7 +5772,7 @@ void HWR_SetViewSize(void)
|
||||||
|
|
||||||
gr_viewwindowx = (vid.width - gr_viewwidth) / 2;
|
gr_viewwindowx = (vid.width - gr_viewwidth) / 2;
|
||||||
gr_windowcenterx = (float)(vid.width / 2);
|
gr_windowcenterx = (float)(vid.width / 2);
|
||||||
if (gr_viewwidth == vid.width)
|
if (fabsf(gr_viewwidth - vid.width) < 1.0E-36f)
|
||||||
{
|
{
|
||||||
gr_baseviewwindowy = 0;
|
gr_baseviewwindowy = 0;
|
||||||
gr_basewindowcentery = gr_viewheight / 2; // window top left corner at 0,0
|
gr_basewindowcentery = gr_viewheight / 2; // window top left corner at 0,0
|
||||||
|
|
|
@ -602,7 +602,8 @@ static void GLPerspective(GLdouble fovy, GLdouble aspect)
|
||||||
const GLdouble deltaZ = zFar - zNear;
|
const GLdouble deltaZ = zFar - zNear;
|
||||||
GLdouble cotangent;
|
GLdouble cotangent;
|
||||||
|
|
||||||
if ((deltaZ == 0.0f) || (sine == 0.0f) || (aspect == 0.0f)) {
|
if ((fabsf((float)deltaZ) < 1.0E-36f) || fpclassify(sine) == FP_ZERO || fpclassify(aspect) == FP_ZERO)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cotangent = cos(radians) / sine;
|
cotangent = cos(radians) / sine;
|
||||||
|
@ -641,7 +642,7 @@ static void GLProject(GLdouble objX, GLdouble objY, GLdouble objZ,
|
||||||
out[2] * projMatrix[2*4+i] +
|
out[2] * projMatrix[2*4+i] +
|
||||||
out[3] * projMatrix[3*4+i];
|
out[3] * projMatrix[3*4+i];
|
||||||
}
|
}
|
||||||
if (in[3] == 0.0f) return;
|
if (fpclassify(in[3]) == FP_ZERO) return;
|
||||||
in[0] /= in[3];
|
in[0] /= in[3];
|
||||||
in[1] /= in[3];
|
in[1] /= in[3];
|
||||||
in[2] /= in[3];
|
in[2] /= in[3];
|
||||||
|
@ -1986,7 +1987,7 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration,
|
||||||
|
|
||||||
pglTexCoord2f(s, t);
|
pglTexCoord2f(s, t);
|
||||||
|
|
||||||
if (!nextframe || pol == 0.0f)
|
if (!nextframe || fpclassify(pol) == FP_ZERO)
|
||||||
{
|
{
|
||||||
pglNormal3f(frame->vertices[pindex].normal[0],
|
pglNormal3f(frame->vertices[pindex].normal[0],
|
||||||
frame->vertices[pindex].normal[1],
|
frame->vertices[pindex].normal[1],
|
||||||
|
@ -2055,6 +2056,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||||
pglLoadIdentity();
|
pglLoadIdentity();
|
||||||
if (stransform)
|
if (stransform)
|
||||||
{
|
{
|
||||||
|
boolean fovx90;
|
||||||
// keep a trace of the transformation for md2
|
// keep a trace of the transformation for md2
|
||||||
memcpy(&md2_transform, stransform, sizeof (md2_transform));
|
memcpy(&md2_transform, stransform, sizeof (md2_transform));
|
||||||
|
|
||||||
|
@ -2069,7 +2071,8 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||||
|
|
||||||
pglMatrixMode(GL_PROJECTION);
|
pglMatrixMode(GL_PROJECTION);
|
||||||
pglLoadIdentity();
|
pglLoadIdentity();
|
||||||
special_splitscreen = (stransform->splitscreen && stransform->fovxangle == 90.0f);
|
fovx90 = stransform->fovxangle > 0.0f && fabsf(stransform->fovxangle - 90.0f) < 0.5f;
|
||||||
|
special_splitscreen = (stransform->splitscreen && fovx90);
|
||||||
if (special_splitscreen)
|
if (special_splitscreen)
|
||||||
GLPerspective(53.13l, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
|
GLPerspective(53.13l, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
|
||||||
else
|
else
|
||||||
|
|
|
@ -1220,7 +1220,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
continue;
|
continue;
|
||||||
if (maskcolor == extra_colormaps[i].maskcolor
|
if (maskcolor == extra_colormaps[i].maskcolor
|
||||||
&& fadecolor == extra_colormaps[i].fadecolor
|
&& fadecolor == extra_colormaps[i].fadecolor
|
||||||
&& (float)maskamt == (float)extra_colormaps[i].maskamt
|
&& fabsf((float)(maskamt - extra_colormaps[i].maskamt)) < 1.0E-36f
|
||||||
&& fadestart == extra_colormaps[i].fadestart
|
&& fadestart == extra_colormaps[i].fadestart
|
||||||
&& fadeend == extra_colormaps[i].fadeend
|
&& fadeend == extra_colormaps[i].fadeend
|
||||||
&& fog == extra_colormaps[i].fog)
|
&& fog == extra_colormaps[i].fog)
|
||||||
|
|
|
@ -765,6 +765,7 @@ void I_UnloadSong(void)
|
||||||
|
|
||||||
boolean I_PlaySong(boolean looping)
|
boolean I_PlaySong(boolean looping)
|
||||||
{
|
{
|
||||||
|
boolean lpz = fpclassify(loop_point) == FP_ZERO;
|
||||||
#ifdef HAVE_LIBGME
|
#ifdef HAVE_LIBGME
|
||||||
if (gme)
|
if (gme)
|
||||||
{
|
{
|
||||||
|
@ -778,14 +779,15 @@ boolean I_PlaySong(boolean looping)
|
||||||
if (!music)
|
if (!music)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Mix_PlayMusic(music, looping && loop_point == 0.0f ? -1 : 0) == -1)
|
|
||||||
|
if (Mix_PlayMusic(music, looping && lpz ? -1 : 0) == -1)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
|
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Mix_VolumeMusic((UINT32)music_volume*128/31);
|
Mix_VolumeMusic((UINT32)music_volume*128/31);
|
||||||
|
|
||||||
if (loop_point != 0.0f)
|
if (!lpz)
|
||||||
Mix_HookMusicFinished(music_loop);
|
Mix_HookMusicFinished(music_loop);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -996,7 +996,7 @@ static INT32 WINAPI VID_SetDirectDrawMode(viddef_t *lvid, vmode_t *currentmode)
|
||||||
// but rather render to memory bitmap buffer
|
// but rather render to memory bitmap buffer
|
||||||
lvid->direct = NULL;
|
lvid->direct = NULL;
|
||||||
|
|
||||||
if (!cv_stretch.value && (float)vid.width/vid.height != ((float)BASEVIDWIDTH/BASEVIDHEIGHT))
|
if (!cv_stretch.value && fabsf((float)vid.width/vid.height - ((float)BASEVIDWIDTH/BASEVIDHEIGHT)) > 1.0E-36f)
|
||||||
vid.height = (int)(vid.width * ((float)BASEVIDHEIGHT/BASEVIDWIDTH));// Adjust the height to match
|
vid.height = (int)(vid.width * ((float)BASEVIDHEIGHT/BASEVIDWIDTH));// Adjust the height to match
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue