Skip to content
Snippets Groups Projects
Commit cb42702e authored by mazmazz's avatar mazmazz
Browse files

Merge branch 'float-compare-colormap-fix' into 'master'

Fix float comparison for colormap maskamt

See merge request !428
parents 89133160 10a3e3fe
No related branches found
No related tags found
3 merge requests!488Merge in next and don't billboard papersprites in GL,!428Fix float comparison for colormap maskamt,!402Update code versions to 2.1.22
...@@ -410,6 +410,15 @@ INT32 I_GetKey(void); ...@@ -410,6 +410,15 @@ INT32 I_GetKey(void);
#define max(x, y) (((x) > (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y))
#endif #endif
// Floating point comparison epsilons from float.h
#ifndef FLT_EPSILON
#define FLT_EPSILON 1.1920928955078125e-7f
#endif
#ifndef DBL_EPSILON
#define DBL_EPSILON 2.2204460492503131e-16
#endif
// An assert-type mechanism. // An assert-type mechanism.
#ifdef PARANOIA #ifdef PARANOIA
#define I_Assert(e) ((e) ? (void)0 : I_Error("assert failed: %s, file %s, line %d", #e, __FILE__, __LINE__)) #define I_Assert(e) ((e) ? (void)0 : I_Error("assert failed: %s, file %s, line %d", #e, __FILE__, __LINE__))
......
...@@ -1220,7 +1220,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) ...@@ -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
&& fabsf((float)(maskamt - extra_colormaps[i].maskamt)) < 1.0E-36f && fabs(maskamt - extra_colormaps[i].maskamt) < DBL_EPSILON
&& 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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment