mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 07:12:03 +00:00
Clear float equal warnings
This commit is contained in:
parent
880c017f8f
commit
6fd66bdb49
8 changed files with 32 additions and 24 deletions
|
@ -112,9 +112,7 @@ ifndef GCC295
|
|||
WFLAGS+=-Wno-div-by-zero
|
||||
endif
|
||||
#WFLAGS+=-Wsystem-headers
|
||||
ifndef ERRORMODE
|
||||
#WFLAGS+=-Wfloat-equal
|
||||
endif
|
||||
WFLAGS+=-Wfloat-equal
|
||||
#WFLAGS+=-Wtraditional
|
||||
ifdef VCHELP
|
||||
WFLAGS+=-Wdeclaration-after-statement
|
||||
|
|
|
@ -1102,7 +1102,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
|
|||
if (var->flags & CV_FLOAT)
|
||||
{
|
||||
double d = atof(valstr);
|
||||
if (!d && valstr[0] != '0')
|
||||
if (fpclassify(d) == FP_ZERO && valstr[0] != '0')
|
||||
v = INT32_MIN;
|
||||
else
|
||||
v = (INT32)(d * FRACUNIT);
|
||||
|
|
|
@ -193,7 +193,7 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
|||
v2dy = bsp->dy;
|
||||
|
||||
den = v2dy*v1dx - v2dx*v1dy;
|
||||
if (den == 0)
|
||||
if (fabsf(den) < 1.0E-36f)
|
||||
return NULL; // parallel
|
||||
|
||||
// first check the frac along the polygon segment,
|
||||
|
@ -253,11 +253,16 @@ static boolean SameVertice (polyvertex_t *p1, polyvertex_t *p2)
|
|||
diff = p2->y - p1->y;
|
||||
if (diff < -1.5f || diff > 1.5f)
|
||||
return false;
|
||||
#else
|
||||
#elif 0
|
||||
if (p1->x != p2->x)
|
||||
return false;
|
||||
if (p1->y != p2->y)
|
||||
return false;
|
||||
#else
|
||||
if (fabsf( p2->x - p1->x ) > 1.0E-36f )
|
||||
return false;
|
||||
if (fabsf( p2->y - p1->y ) > 1.0E-36f )
|
||||
return false;
|
||||
#endif
|
||||
// p1 and p2 are considered the same vertex
|
||||
return true;
|
||||
|
|
|
@ -227,14 +227,14 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
|||
Z_Free(realpatch);
|
||||
}
|
||||
// centre screen
|
||||
if ((float)vid.width != (float)BASEVIDWIDTH * dupx)
|
||||
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||
{
|
||||
if (option & V_SNAPTORIGHT)
|
||||
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||
else if (!(option & V_SNAPTOLEFT))
|
||||
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))
|
||||
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);
|
||||
}
|
||||
// centre screen
|
||||
if ((float)vid.width != (float)BASEVIDWIDTH * dupx)
|
||||
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||
{
|
||||
if (option & V_SNAPTORIGHT)
|
||||
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||
else if (!(option & V_SNAPTOLEFT))
|
||||
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))
|
||||
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
|
||||
|
@ -846,14 +846,14 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||
fw *= dupx;
|
||||
fh *= dupy;
|
||||
|
||||
if ((float)vid.width != (float)BASEVIDWIDTH * dupx)
|
||||
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||
{
|
||||
if (color & V_SNAPTORIGHT)
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||
else if (!(color & V_SNAPTOLEFT))
|
||||
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
|
||||
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[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.
|
||||
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[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;
|
||||
else
|
||||
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height;
|
||||
|
@ -4585,7 +4585,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
|||
wallVerts[0].x = wallVerts[3].x = spr->x1;
|
||||
wallVerts[2].x = wallVerts[1].x = spr->x2;
|
||||
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;
|
||||
else
|
||||
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height;
|
||||
|
@ -4831,7 +4831,7 @@ static void HWR_SortVisSprites(void)
|
|||
best = ds;
|
||||
}
|
||||
// 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;
|
||||
best = ds;
|
||||
|
@ -5752,7 +5752,7 @@ void HWR_SetViewSize(void)
|
|||
|
||||
gr_viewwindowx = (vid.width - gr_viewwidth) / 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_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;
|
||||
GLdouble cotangent;
|
||||
|
||||
if ((deltaZ == 0.0f) || (sine == 0.0f) || (aspect == 0.0f)) {
|
||||
if ((fabsf(deltaZ) < 1.0E-36f) || fpclassify(sine) == FP_ZERO || fpclassify(aspect) == FP_ZERO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
cotangent = cos(radians) / sine;
|
||||
|
@ -641,7 +642,7 @@ static void GLProject(GLdouble objX, GLdouble objY, GLdouble objZ,
|
|||
out[2] * projMatrix[2*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[1] /= 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);
|
||||
|
||||
if (!nextframe || pol == 0.0f)
|
||||
if (!nextframe || fpclassify(pol) == FP_ZERO)
|
||||
{
|
||||
pglNormal3f(frame->vertices[pindex].normal[0],
|
||||
frame->vertices[pindex].normal[1],
|
||||
|
@ -2055,6 +2056,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
|||
pglLoadIdentity();
|
||||
if (stransform)
|
||||
{
|
||||
boolean fovx90;
|
||||
// keep a trace of the transformation for md2
|
||||
memcpy(&md2_transform, stransform, sizeof (md2_transform));
|
||||
|
||||
|
@ -2069,7 +2071,8 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
|||
|
||||
pglMatrixMode(GL_PROJECTION);
|
||||
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)
|
||||
GLPerspective(53.13l, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
|
||||
else
|
||||
|
|
|
@ -1220,7 +1220,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
|||
continue;
|
||||
if (maskcolor == extra_colormaps[i].maskcolor
|
||||
&& fadecolor == extra_colormaps[i].fadecolor
|
||||
&& (float)maskamt == (float)extra_colormaps[i].maskamt
|
||||
&& fabsf(maskamt - extra_colormaps[i].maskamt) < 1.0E-36f
|
||||
&& fadestart == extra_colormaps[i].fadestart
|
||||
&& fadeend == extra_colormaps[i].fadeend
|
||||
&& fog == extra_colormaps[i].fog)
|
||||
|
|
|
@ -759,6 +759,7 @@ void I_UnloadSong(void)
|
|||
|
||||
boolean I_PlaySong(boolean looping)
|
||||
{
|
||||
boolean lpz = fpclassify(loop_point) == FP_ZERO;
|
||||
#ifdef HAVE_LIBGME
|
||||
if (gme)
|
||||
{
|
||||
|
@ -772,14 +773,15 @@ boolean I_PlaySong(boolean looping)
|
|||
if (!music)
|
||||
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());
|
||||
return false;
|
||||
}
|
||||
Mix_VolumeMusic((UINT32)music_volume*128/31);
|
||||
|
||||
if (loop_point != 0.0f)
|
||||
if (!lpz)
|
||||
Mix_HookMusicFinished(music_loop);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue