mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 12:21:19 +00:00
Merge branch 'master' into next
This commit is contained in:
commit
a72d79da54
11 changed files with 39 additions and 30 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 (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
|
||||
|
||||
// first check the frac along the polygon segment,
|
||||
|
@ -235,6 +235,11 @@ static boolean SameVertice (polyvertex_t *p1, polyvertex_t *p2)
|
|||
return false;
|
||||
if (p1->y != p2->y)
|
||||
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
|
||||
#define DIVLINE_VERTEX_DIFF 0.45f
|
||||
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);
|
||||
}
|
||||
// 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));
|
||||
|
@ -834,14 +834,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;
|
||||
|
@ -4595,7 +4595,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;
|
||||
|
@ -4851,7 +4851,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;
|
||||
|
@ -5772,7 +5772,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((float)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
|
||||
|
|
|
@ -6841,9 +6841,10 @@ static void M_Setup2PControlsMenu(INT32 choice)
|
|||
OP_MPControlsMenu[0].status = IT_GRAYEDOUT2;
|
||||
OP_MPControlsMenu[1].status = IT_GRAYEDOUT2;
|
||||
OP_MPControlsMenu[2].status = IT_GRAYEDOUT2;
|
||||
// Hide the pause/console controls too
|
||||
// Hide the pause/console and system menu controls too
|
||||
OP_MiscControlsMenu[3].status = IT_GRAYEDOUT2;
|
||||
OP_MiscControlsMenu[4].status = IT_GRAYEDOUT2;
|
||||
OP_MiscControlsMenu[6].status = IT_GRAYEDOUT2;
|
||||
OP_MiscControlsMenu[8].status = IT_GRAYEDOUT2;
|
||||
|
||||
OP_ControlListDef.prevMenu = &OP_P2ControlsDef;
|
||||
M_SetupNextMenu(&OP_ControlListDef);
|
||||
|
|
|
@ -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((float)(maskamt - extra_colormaps[i].maskamt)) < 1.0E-36f
|
||||
&& fadestart == extra_colormaps[i].fadestart
|
||||
&& fadeend == extra_colormaps[i].fadeend
|
||||
&& fog == extra_colormaps[i].fog)
|
||||
|
|
|
@ -278,13 +278,13 @@ if(${SDL2_FOUND})
|
|||
if (${CMAKE_GENERATOR} STREQUAL "MinGW Makefiles")
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
|
||||
HINTS ${CMAKE_SOURCE_DIR}/Bin/Resources/x86_64
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/x86_64
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/bin
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/bin
|
||||
)
|
||||
else()
|
||||
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
|
||||
HINTS ${CMAKE_SOURCE_DIR}/Bin/Resources/i686
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/i686
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/bin
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/bin
|
||||
)
|
||||
|
@ -292,13 +292,13 @@ if(${SDL2_FOUND})
|
|||
else()
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
|
||||
HINTS ${CMAKE_SOURCE_DIR}/Bin/Resources/x86_64
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/x86_64
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x64
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x64
|
||||
)
|
||||
else()
|
||||
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
|
||||
HINTS ${CMAKE_SOURCE_DIR}/Bin/Resources/i686
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/i686
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x86
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x86
|
||||
)
|
||||
|
|
|
@ -765,6 +765,7 @@ void I_UnloadSong(void)
|
|||
|
||||
boolean I_PlaySong(boolean looping)
|
||||
{
|
||||
boolean lpz = fpclassify(loop_point) == FP_ZERO;
|
||||
#ifdef HAVE_LIBGME
|
||||
if (gme)
|
||||
{
|
||||
|
@ -778,14 +779,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;
|
||||
}
|
||||
|
|
|
@ -996,7 +996,7 @@ static INT32 WINAPI VID_SetDirectDrawMode(viddef_t *lvid, vmode_t *currentmode)
|
|||
// but rather render to memory bitmap buffer
|
||||
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
|
||||
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue