fixed a bunch of fp math expressions for lack of precision and incorrectly using double instead of float

This commit is contained in:
myT 2017-05-19 00:00:08 +02:00
parent 85d6762647
commit 389cd1690d
7 changed files with 14 additions and 14 deletions

View file

@ -623,20 +623,20 @@ void Con_RunConsole()
{
// decide on the destination height of the console
if ( cls.keyCatchers & KEYCATCH_CONSOLE )
con.finalFrac = 0.5; // half screen
con.finalFrac = 0.5f; // half screen
else
con.finalFrac = 0; // none visible
con.finalFrac = 0.0f; // none visible
// scroll towards the destination height
if (con.finalFrac < con.displayFrac)
{
con.displayFrac -= con_speed->value * cls.realFrametime * 0.001;
con.displayFrac -= con_speed->value * (float)cls.realFrametime / 1000.0f;
if (con.finalFrac > con.displayFrac)
con.displayFrac = con.finalFrac;
}
else if (con.finalFrac > con.displayFrac)
{
con.displayFrac += con_speed->value * cls.realFrametime * 0.001;
con.displayFrac += con_speed->value * (float)cls.realFrametime / 1000.0f;
if (con.finalFrac < con.displayFrac)
con.displayFrac = con.finalFrac;
}

View file

@ -226,9 +226,9 @@ static void CL_AdjustAngles()
float speed;
if ( in_speed.active ) {
speed = 0.001 * cls.frametime * cl_anglespeedkey->value;
speed = ((float)cls.frametime / 1000.0f) * cl_anglespeedkey->value;
} else {
speed = 0.001 * cls.frametime;
speed = (float)cls.frametime / 1000.0f;
}
if ( !in_strafe.active ) {
@ -324,9 +324,9 @@ static void CL_JoystickMove( usercmd_t *cmd )
}
if ( in_speed.active ) {
anglespeed = 0.001 * cls.frametime * cl_anglespeedkey->value;
anglespeed = ((float)cls.frametime / 1000.0f) * cl_anglespeedkey->value;
} else {
anglespeed = 0.001 * cls.frametime;
anglespeed = (float)cls.frametime / 1000.0f;
}
if ( !in_strafe.active ) {

View file

@ -1919,7 +1919,7 @@ static void Com_Freeze_f( void )
float s = atof( Cmd_Argv(1) );
int start = Com_Milliseconds();
while ( ( Com_Milliseconds() - start ) * 0.001 < s )
while ( ( Com_Milliseconds() - start ) / 1000.0f < s )
;
}

View file

@ -483,7 +483,7 @@ static void RB_RenderDrawSurfList( const drawSurf_t* drawSurfs, int numDrawSurfs
if ( entityNum != ENTITYNUM_WORLD ) {
backEnd.currentEntity = &backEnd.refdef.entities[entityNum];
if (backEnd.isShaderTimeInSec)
backEnd.refdef.floatTime = originalTime - (double)(backEnd.currentEntity->e.shaderTime.iShaderTime) * 0.001;
backEnd.refdef.floatTime = originalTime - (double)(backEnd.currentEntity->e.shaderTime.iShaderTime) / 1000.0;
else
backEnd.refdef.floatTime = originalTime - backEnd.currentEntity->e.shaderTime.fShaderTime;
// we have to reset the shaderTime as well otherwise image animations start
@ -698,7 +698,7 @@ static void RB_SetGL2D()
// set time for 2D shaders
backEnd.refdef.time = ri.Milliseconds();
backEnd.refdef.floatTime = (double)backEnd.refdef.time * 0.001;
backEnd.refdef.floatTime = (double)backEnd.refdef.time / 1000.0;
}

View file

@ -258,7 +258,7 @@ void RE_RenderScene( const refdef_t* fd )
// derived info
tr.refdef.floatTime = (double)tr.refdef.time * 0.001;
tr.refdef.floatTime = (double)tr.refdef.time / 1000.0;
tr.refdef.numDrawSurfs = r_firstSceneDrawSurf;
tr.refdef.drawSurfs = backEndData[tr.smpFrame]->drawSurfs;

View file

@ -193,7 +193,7 @@ static void RB_CalcBulgeVertexes( const deformStage_t* ds )
float *normal = ( float * ) tess.normal;
float now;
now = backEnd.refdef.time * ds->bulgeSpeed * 0.001f;
now = backEnd.refdef.time * ds->bulgeSpeed / 1000.0f;
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, st += 4, normal += 4 ) {
int off;

View file

@ -106,7 +106,7 @@ static void AddSkyPolygon (int nump, vec3_t vecs)
dv = vecs[j - 1];
else
dv = -vecs[-j - 1];
if (dv < 0.001)
if (dv < 0.001f)
continue; // don't divide by zero
j = vec_to_st[axis][0];
if (j < 0)