fix most implicit float > double conversions
This commit is contained in:
1 parent
bdeb7e5e9d
commit
3c85295622
12 files changed
+53
-53
No files matched your search
+2
-2
@@ -838,7 +838,7 @@ static void COM_Help_f(void)
|
||||
{
|
||||
{
|
||||
if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX"))
|
||||
{
|
||||
{
|
||||
if (floatmode)
|
||||
{
|
||||
float fu = FIXED_TO_FLOAT(cvar->PossibleValue[0].value);
|
||||
@@ -1044,7 +1044,7 @@ static void COM_Add_f(void)
|
||||
|
||||
if (( cvar->flags & CV_FLOAT ))
|
||||
{
|
||||
float n =FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2));
|
||||
float n = FIXED_TO_FLOAT(cvar->value) + (float)atof(COM_Argv(2));
|
||||
CV_Set(cvar, va("%ld%s", (long)n, M_Ftrim(n)));
|
||||
}
|
||||
else
|
||||
|
||||
+1
-1
@@ -868,7 +868,7 @@ void D_SRB2Loop(void)
|
||||
// I looked at the possibility of putting in a float drawer for
|
||||
// perfstats and it's very complicated, so we'll just do this instead...
|
||||
ps_interp_frac.value.p = (precise_t)((FIXED_TO_FLOAT(g_time.timefrac)) * 1000.0f);
|
||||
ps_interp_lag.value.p = (precise_t)((deltasecs) * 1000.0f);
|
||||
ps_interp_lag.value.p = (precise_t)((deltasecs) * 1000.0);
|
||||
|
||||
const boolean lagging = ((deltatics >= 1.0) || hu_stopped);
|
||||
|
||||
|
||||
@@ -331,8 +331,8 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||
|
||||
// ok, this is a gross hack that barely works...
|
||||
// but at least it doesn't overestimate too much...
|
||||
clipfov = atan(1 / projMatrix[0]) * 360.0f / M_PIl;
|
||||
floatangle = 2.0f + (45.0f + (tilt / 1.9f)) * clipfov / 90.0f;
|
||||
clipfov = atan(1 / (GLdouble)projMatrix[0]) * 360.0 / M_PIl;
|
||||
floatangle = 2.0 + (45.0 + ((double)tilt / 1.9)) * clipfov / 90.0;
|
||||
if (floatangle >= 180.0)
|
||||
return 0xffffffff;
|
||||
a1 = (angle_t)xs_CRoundToInt(ANG1 * floatangle);
|
||||
|
||||
@@ -496,7 +496,7 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
||||
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum)
|
||||
{
|
||||
FOutVector v[4];
|
||||
double dflatsize;
|
||||
float dflatsize;
|
||||
INT32 flatflag;
|
||||
const size_t len = W_LumpLength(flatlumpnum);
|
||||
|
||||
|
||||
@@ -681,8 +681,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
tempxsow = flatxref;
|
||||
tempytow = flatyref;
|
||||
anglef = ANG2RAD(InvAngle(angle));
|
||||
flatxref = (tempxsow * cos(anglef)) - (tempytow * sin(anglef));
|
||||
flatyref = (tempxsow * sin(anglef)) + (tempytow * cos(anglef));
|
||||
flatxref = (tempxsow * cosf(anglef)) - (tempytow * sinf(anglef));
|
||||
flatyref = (tempxsow * sinf(anglef)) + (tempytow * cosf(anglef));
|
||||
}
|
||||
|
||||
#define SETUP3DVERT(vert, vx, vy) {\
|
||||
@@ -695,8 +695,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
{\
|
||||
tempxsow = vert->s;\
|
||||
tempytow = vert->t;\
|
||||
vert->s = (tempxsow * cos(anglef)) - (tempytow * sin(anglef));\
|
||||
vert->t = (tempxsow * sin(anglef)) + (tempytow * cos(anglef));\
|
||||
vert->s = (tempxsow * cosf(anglef)) - (tempytow * sinf(anglef));\
|
||||
vert->t = (tempxsow * sinf(anglef)) + (tempytow * cosf(anglef));\
|
||||
}\
|
||||
\
|
||||
vert->x = (vx);\
|
||||
|
||||
@@ -227,8 +227,9 @@ static void GL_MSG_Warning(const char *format, ...)
|
||||
CONS_Alert(CONS_WARNING, "%s", str);
|
||||
#endif
|
||||
#ifdef DEBUG_TO_FILE
|
||||
if (!gllogstream)
|
||||
if (!gllogstream)
|
||||
gllogstream = fopen("ogllog.txt", "w");
|
||||
|
||||
fwrite(str, strlen(str), 1, gllogstream);
|
||||
#endif
|
||||
}
|
||||
@@ -2843,7 +2844,7 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
|
||||
scaley = vscale;
|
||||
scalez = hscale;
|
||||
|
||||
if (duration > 0.0 && tics >= 0.0) // don't interpolate if instantaneous or infinite in length
|
||||
if (duration > 0.0f && tics >= 0.0f) // don't interpolate if instantaneous or infinite in length
|
||||
{
|
||||
float newtime = (duration - tics); // + 1;
|
||||
|
||||
@@ -3380,10 +3381,10 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
|
||||
fix[6] = fix[0] + xfix;
|
||||
fix[4] = fix[2] + xfix;
|
||||
fix[1] = fix[7] = i*yfix;
|
||||
fix[3] = fix[5] = (i+0.015)*yfix;
|
||||
fix[3] = fix[5] = (i+0.015f)*yfix;
|
||||
|
||||
screenVerts[1] = screenVerts[10] = 2*i - 1.0f;
|
||||
screenVerts[4] = screenVerts[7] = screenVerts[1] + 0.03;
|
||||
screenVerts[4] = screenVerts[7] = screenVerts[1] + 0.03f;
|
||||
|
||||
pglColor4ubv(color);
|
||||
|
||||
|
||||
+2
-2
@@ -60,7 +60,7 @@ void I_UpdateTime(fixed_t timescale)
|
||||
tic_t realtics;
|
||||
|
||||
// get real tics
|
||||
ticratescaled = (double)TICRATE * FixedToFloat(timescale);
|
||||
ticratescaled = (double)TICRATE * FixedToDouble(timescale);
|
||||
|
||||
enterprecise = I_GetPreciseTime();
|
||||
elapsedseconds = (double)(enterprecise - oldenterprecise) / I_GetPrecisePrecision();
|
||||
@@ -79,6 +79,6 @@ void I_UpdateTime(fixed_t timescale)
|
||||
{
|
||||
double fractional, integral;
|
||||
fractional = modf(tictimer * ticratescaled, &integral);
|
||||
g_time.timefrac = FloatToFixed(fractional);
|
||||
g_time.timefrac = DoubleToFixed(fractional);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -343,7 +343,7 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
}
|
||||
else
|
||||
{
|
||||
double left = width;
|
||||
float left = width;
|
||||
iz += ds->szp.x * left;
|
||||
uz += ds->sup.x * left;
|
||||
vz += ds->svp.x * left;
|
||||
|
||||
+6
-6
@@ -411,8 +411,8 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
||||
float x = vx / (float)FRACUNIT;
|
||||
float y = vy / (float)FRACUNIT;
|
||||
|
||||
vx = (x * cos(ang) + y * sin(ang)) * FRACUNIT;
|
||||
vy = (-x * sin(ang) + y * cos(ang)) * FRACUNIT;
|
||||
vx = (x * cosf(ang) + y * sinf(ang)) * FRACUNIT;
|
||||
vy = (-x * sinf(ang) + y * cosf(ang)) * FRACUNIT;
|
||||
|
||||
xoff = vx;
|
||||
yoff = vy;
|
||||
@@ -431,8 +431,8 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
||||
float ang = ANG2RAD(polyobj->angle);
|
||||
float x = FixedToFloat(polyobj->centerPt.x);
|
||||
float y = FixedToFloat(polyobj->centerPt.y);
|
||||
xoff -= FloatToFixed(x * cos(ang) + y * sin(ang));
|
||||
yoff -= FloatToFixed(x * sin(ang) - y * cos(ang));
|
||||
xoff -= FloatToFixed(x * cosf(ang) + y * sinf(ang));
|
||||
yoff -= FloatToFixed(x * sinf(ang) - y * cosf(ang));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -914,8 +914,8 @@ static void R_SetSlopePlaneOrigin(drawspandata_t *ds, pslope_t *slope, fixed_t x
|
||||
// p is the texture origin in view space
|
||||
// Don't add in the offsets at this stage, because doing so can result in
|
||||
// errors if the flat is rotated.
|
||||
p->x = vxf * cos(ang) - vyf * sin(ang);
|
||||
p->z = vxf * sin(ang) + vyf * cos(ang);
|
||||
p->x = vxf * cosf(ang) - vyf * sinf(ang);
|
||||
p->z = vxf * sinf(ang) + vyf * cosf(ang);
|
||||
p->y = (R_GetSlopeZAt(slope, -xoff, yoff) - zpos) / (float)FRACUNIT;
|
||||
}
|
||||
|
||||
|
||||
@@ -357,7 +357,6 @@ static void write_backtrace(bt_crash_reason_t reason)
|
||||
buf.pos = backtrace;
|
||||
buf.size = BUFSIZE;
|
||||
|
||||
|
||||
if (!out)
|
||||
{
|
||||
fprintf(stderr, "\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n");
|
||||
|
||||
@@ -626,7 +626,7 @@ Countstutter (int len)
|
||||
else
|
||||
bytes = ( music_bytes - music_stutter_bytes );
|
||||
|
||||
I_SetSongPosition((int)( (float)bytes/4/44100.0*1000 ));
|
||||
I_SetSongPosition((int)( (float)bytes/4/44100.0f*1000 ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+28
-28
@@ -107,22 +107,22 @@ static boolean InitCube(void)
|
||||
{
|
||||
{
|
||||
{
|
||||
{0.0, 0.0, 0.0}, // black corner
|
||||
{0.0, 0.0, 1.0} // blue corner
|
||||
{0.0f, 0.0f, 0.0f}, // black corner
|
||||
{0.0f, 0.0f, 1.0f} // blue corner
|
||||
},
|
||||
{
|
||||
{0.0, 1.0, 0.0}, // green corner
|
||||
{0.0, 1.0, 1.0} // cyan corner
|
||||
{0.0f, 1.0f, 0.0f}, // green corner
|
||||
{0.0f, 1.0f, 1.0f} // cyan corner
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
{1.0, 0.0, 0.0}, // red corner
|
||||
{1.0, 0.0, 1.0} // magenta corner
|
||||
{1.0f, 0.0f, 0.0f}, // red corner
|
||||
{1.0f, 0.0f, 1.0f} // magenta corner
|
||||
},
|
||||
{
|
||||
{1.0, 1.0, 0.0}, // yellow corner
|
||||
{1.0, 1.0, 1.0} // white corner
|
||||
{1.0f, 1.0f, 0.0f}, // yellow corner
|
||||
{1.0f, 1.0f, 1.0f} // white corner
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -145,9 +145,9 @@ static boolean InitCube(void)
|
||||
#endif
|
||||
|
||||
#define gammascale 8
|
||||
globalgammamul = (cv_globalgamma.value ? ((255 - (gammascale*abs(cv_globalgamma.value)))/255.0) : 1.0);
|
||||
globalgammaoffs = ((cv_globalgamma.value > 0) ? ((gammascale*cv_globalgamma.value)/255.0) : 0.0);
|
||||
desatur[0] = desatur[1] = desatur[2] = globalgammaoffs + (0.33*globalgammamul);
|
||||
globalgammamul = (cv_globalgamma.value ? ((255.0f - (gammascale*abs(cv_globalgamma.value))) / 255.0f) : 1.0f);
|
||||
globalgammaoffs = ((cv_globalgamma.value > 0) ? ((gammascale*cv_globalgamma.value) / 255.0f) : 0.0f);
|
||||
desatur[0] = desatur[1] = desatur[2] = globalgammaoffs + (0.33f * globalgammamul);
|
||||
|
||||
if (doinggamma
|
||||
|| diffcons(cv_rhue)
|
||||
@@ -171,8 +171,8 @@ static boolean InitCube(void)
|
||||
working[1][1][1][0] = working[1][1][1][1] = working[1][1][1][2] = globalgammaoffs+globalgammamul;
|
||||
|
||||
#define dohue(hue, gamma, loc) \
|
||||
tempgammamul = (gamma ? ((255 - (gammascale*abs(gamma)))/255.0)*globalgammamul : globalgammamul);\
|
||||
tempgammaoffs = ((gamma > 0) ? ((gammascale*gamma)/255.0) + globalgammaoffs : globalgammaoffs);\
|
||||
tempgammamul = (gamma ? ((255.0f - (gammascale*abs(gamma)))/255.0f)*globalgammamul : globalgammamul);\
|
||||
tempgammaoffs = ((gamma > 0) ? ((gammascale*gamma)/255.0f) + globalgammaoffs : globalgammaoffs);\
|
||||
mod = ((hue % huecoloursteps)*(tempgammamul)/huecoloursteps);\
|
||||
switch (hue/huecoloursteps)\
|
||||
{\
|
||||
@@ -223,14 +223,14 @@ static boolean InitCube(void)
|
||||
{\
|
||||
float work, mod, tempgammamul, tempgammaoffs;\
|
||||
apply = true;\
|
||||
work = (cv_sat.value/10.0);\
|
||||
mod = ((hue % huecoloursteps)*(1.0)/huecoloursteps);\
|
||||
work = (cv_sat.value/10.0f);\
|
||||
mod = ((hue % huecoloursteps)*(1.0f)/huecoloursteps);\
|
||||
if (hue & huecoloursteps)\
|
||||
mod = 2-mod;\
|
||||
else\
|
||||
mod += 1;\
|
||||
tempgammamul = (gamma ? ((255 - (gammascale*abs(gamma)))/255.0)*globalgammamul : globalgammamul);\
|
||||
tempgammaoffs = ((gamma > 0) ? ((gammascale*gamma)/255.0) + globalgammaoffs : globalgammaoffs);\
|
||||
tempgammamul = (gamma ? ((255.0f - (gammascale*abs(gamma)))/255.0f)*globalgammamul : globalgammamul);\
|
||||
tempgammaoffs = ((gamma > 0) ? ((gammascale*gamma)/255.0f) + globalgammaoffs : globalgammaoffs);\
|
||||
for (q = 0; q < 3; q++)\
|
||||
dosaturation(working[r][g][b][q], (tempgammaoffs+(desatur[q]*mod*tempgammamul)));\
|
||||
}
|
||||
@@ -246,7 +246,7 @@ static boolean InitCube(void)
|
||||
|
||||
if diffconssat(cv_globalsaturation)
|
||||
{
|
||||
float work = (cv_globalsaturation.value/10.0);
|
||||
float work = (cv_globalsaturation.value/10.0f);
|
||||
|
||||
apply = true;
|
||||
|
||||
@@ -272,10 +272,10 @@ static boolean InitCube(void)
|
||||
return false;
|
||||
|
||||
#define dowork(i, j, k, l) \
|
||||
if (working[i][j][k][l] > 1.0)\
|
||||
working[i][j][k][l] = 1.0;\
|
||||
else if (working[i][j][k][l] < 0.0)\
|
||||
working[i][j][k][l] = 0.0;\
|
||||
if (working[i][j][k][l] > 1.0f)\
|
||||
working[i][j][k][l] = 1.0f;\
|
||||
else if (working[i][j][k][l] < 0.0f)\
|
||||
working[i][j][k][l] = 0.0f;\
|
||||
Cubepal[i][j][k][l] = working[i][j][k][l]
|
||||
for (q = 0; q < 3; q++)
|
||||
{
|
||||
@@ -466,7 +466,7 @@ void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue)
|
||||
if (!Cubeapply)
|
||||
return;
|
||||
|
||||
linear = (*red/255.0);
|
||||
linear = (*red/255.0f);
|
||||
#define dolerp(e1, e2) ((1 - linear)*e1 + linear*e2)
|
||||
for (q = 0; q < 3; q++)
|
||||
{
|
||||
@@ -475,19 +475,19 @@ void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue)
|
||||
working[2][q] = dolerp(Cubepal[0][0][1][q], Cubepal[1][0][1][q]);
|
||||
working[3][q] = dolerp(Cubepal[0][1][1][q], Cubepal[1][1][1][q]);
|
||||
}
|
||||
linear = (*green/255.0);
|
||||
linear = (*green/255.0f);
|
||||
for (q = 0; q < 3; q++)
|
||||
{
|
||||
working[0][q] = dolerp(working[0][q], working[1][q]);
|
||||
working[1][q] = dolerp(working[2][q], working[3][q]);
|
||||
}
|
||||
linear = (*blue/255.0);
|
||||
linear = (*blue/255.0f);
|
||||
for (q = 0; q < 3; q++)
|
||||
{
|
||||
working[0][q] = 255*dolerp(working[0][q], working[1][q]);
|
||||
if (working[0][q] > 255.0)
|
||||
working[0][q] = 255.0;
|
||||
else if (working[0][q] < 0.0)
|
||||
if (working[0][q] > 255.0f)
|
||||
working[0][q] = 255.0f;
|
||||
else if (working[0][q] < 0.0f)
|
||||
working[0][q] = 0.0;
|
||||
}
|
||||
#undef dolerp
|
||||
|
||||
Reference in new issue
Block a user