mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-22 18:07:09 +01:00
engine: more double promotion fixes
This commit is contained in:
parent
1218f4aeb6
commit
78baf568ae
@ -2939,7 +2939,8 @@ void CL_AdjustClock( void )
|
||||
|
||||
if( fabs( cl.timedelta ) >= 0.001f )
|
||||
{
|
||||
double msec, adjust, sign;
|
||||
double msec, adjust;
|
||||
float sign;
|
||||
|
||||
msec = ( cl.timedelta * 1000.0f );
|
||||
sign = ( msec < 0 ) ? 1.0f : -1.0f;
|
||||
|
@ -876,18 +876,18 @@ void Touch_DeleteProfile_f( void )
|
||||
|
||||
void Touch_InitEditor( void )
|
||||
{
|
||||
float x = 0.1 * (SCR_H/SCR_W);
|
||||
float y = 0.05;
|
||||
float x = 0.1f * (SCR_H/SCR_W);
|
||||
float y = 0.05f;
|
||||
|
||||
Touch_ClearList( &touch.list_edit );
|
||||
|
||||
Touch_AddButton( &touch.list_edit, "close", "touch_default/edit_close.tga", "touch_disableedit", 0, y, x, y + 0.1, (byte*)"\xff\xff\xff\xff" )->flags |= TOUCH_FL_NOEDIT;
|
||||
Touch_AddButton( &touch.list_edit, "close", "#Close and save", "", x, y, x + 0.2, y + 0.1, (byte*)"\xff\xff\xff\xff" )->flags |= TOUCH_FL_NOEDIT;
|
||||
y += 0.2;
|
||||
Touch_AddButton( &touch.list_edit, "cancel", "touch_default/edit_reset.tga", "touch_reloadconfig", 0, y, x, y + 0.1, (byte*)"\xff\xff\xff\xff" )->flags |= TOUCH_FL_NOEDIT;
|
||||
Touch_AddButton( &touch.list_edit, "close", "#Cancel and reset", "", x, y, x + 0.2, y + 0.1, (byte*)"\xff\xff\xff\xff" )->flags |= TOUCH_FL_NOEDIT;
|
||||
y += 0.2;
|
||||
touch.hidebutton = Touch_AddButton( &touch.list_edit, "showhide", "touch_default/edit_hide.tga", "touch_toggleselection", 0, y, x, y + 0.1, (byte*)"\xff\xff\xff\xff" );
|
||||
Touch_AddButton( &touch.list_edit, "close", "touch_default/edit_close.tga", "touch_disableedit", 0, y, x, y + 0.1f, (byte*)"\xff\xff\xff\xff" )->flags |= TOUCH_FL_NOEDIT;
|
||||
Touch_AddButton( &touch.list_edit, "close", "#Close and save", "", x, y, x + 0.2f, y + 0.1f, (byte*)"\xff\xff\xff\xff" )->flags |= TOUCH_FL_NOEDIT;
|
||||
y += 0.2f;
|
||||
Touch_AddButton( &touch.list_edit, "cancel", "touch_default/edit_reset.tga", "touch_reloadconfig", 0, y, x, y + 0.1f, (byte*)"\xff\xff\xff\xff" )->flags |= TOUCH_FL_NOEDIT;
|
||||
Touch_AddButton( &touch.list_edit, "close", "#Cancel and reset", "", x, y, x + 0.2f, y + 0.1f, (byte*)"\xff\xff\xff\xff" )->flags |= TOUCH_FL_NOEDIT;
|
||||
y += 0.2f;
|
||||
touch.hidebutton = Touch_AddButton( &touch.list_edit, "showhide", "touch_default/edit_hide.tga", "touch_toggleselection", 0, y, x, y + 0.1f, (byte*)"\xff\xff\xff\xff" );
|
||||
touch.hidebutton->flags |= TOUCH_FL_HIDE | TOUCH_FL_NOEDIT;
|
||||
}
|
||||
|
||||
@ -1439,13 +1439,13 @@ static void Touch_Motion( touchEventType type, int fingerID, float x, float y, f
|
||||
{
|
||||
touch.wheel_amount += touch.wheel_horizontal ? dx : dy;
|
||||
|
||||
if( touch.wheel_amount > 0.1 )
|
||||
if( touch.wheel_amount > 0.1f )
|
||||
{
|
||||
Cbuf_AddText( touch.wheel_down );
|
||||
touch.wheel_count++;
|
||||
touch.wheel_amount = 0;
|
||||
}
|
||||
if( touch.wheel_amount < -0.1 )
|
||||
if( touch.wheel_amount < -0.1f )
|
||||
{
|
||||
Cbuf_AddText( touch.wheel_up );
|
||||
touch.wheel_count++;
|
||||
@ -1499,7 +1499,7 @@ static void Touch_Motion( touchEventType type, int fingerID, float x, float y, f
|
||||
// save angle, modify only velocity
|
||||
dabs = sqrt( dx * dx + dy * dy );
|
||||
|
||||
if( dabs < 0.000001 )
|
||||
if( dabs < 0.000001f )
|
||||
return; // no motion, avoid division by zero
|
||||
|
||||
dcos = dx / dabs;
|
||||
|
@ -64,7 +64,7 @@ void BuildGammaTable( float lightgamma, float brightness )
|
||||
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
f = 255.0 * pow(( float )i / 255.0f, TEXGAMMA );
|
||||
f = 255.0f * pow(( float )i / 255.0f, TEXGAMMA );
|
||||
inf = (int)(f + 0.5f);
|
||||
texgammatable[i] = bound( 0, inf, 255 );
|
||||
}
|
||||
|
@ -605,7 +605,7 @@ void Netchan_UpdateFlow( netchan_t *chan )
|
||||
}
|
||||
|
||||
pflow->kbytespersec = (faccumulatedtime == 0.0f) ? 0.0f : bytes / faccumulatedtime / 1024.0f;
|
||||
pflow->avgkbytespersec = pflow->avgkbytespersec * FLOW_AVG + pflow->kbytespersec * (1.0 - FLOW_AVG);
|
||||
pflow->avgkbytespersec = pflow->avgkbytespersec * FLOW_AVG + pflow->kbytespersec * (1.0f - FLOW_AVG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2527,7 +2527,7 @@ void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg )
|
||||
if( frame->senttime == 0.0f ) frame->ping_time = 0.0f;
|
||||
|
||||
// don't skew ping based on signon stuff either
|
||||
if(( host.realtime - cl->connection_started ) < 2.0f && ( frame->ping_time > 0.0 ))
|
||||
if(( host.realtime - cl->connection_started ) < 2.0f && ( frame->ping_time > 0.0f ))
|
||||
frame->ping_time = 0.0f;
|
||||
|
||||
cl->latency = SV_CalcClientTime( cl );
|
||||
|
@ -579,7 +579,7 @@ qboolean SV_RunGameFrame( void )
|
||||
|
||||
if( sv_fps.value != 0.0f )
|
||||
{
|
||||
double fps = (1.0 / (double)( sv_fps.value - 0.01 )); // FP issues
|
||||
double fps = (1.0 / (double)( sv_fps.value - 0.01f )); // FP issues
|
||||
int numFrames = 0;
|
||||
|
||||
while( sv.time_residual >= fps )
|
||||
|
@ -917,7 +917,7 @@ void SV_SetupMoveInterpolant( sv_client_t *cl )
|
||||
break;
|
||||
}
|
||||
|
||||
if( i == SV_UPDATE_BACKUP || finalpush - frame->senttime > 1.0 )
|
||||
if( i == SV_UPDATE_BACKUP || finalpush - frame->senttime > 1.0f )
|
||||
{
|
||||
memset( svgame.interp, 0, sizeof( svgame.interp ));
|
||||
has_update = false;
|
||||
|
@ -21,6 +21,10 @@ GNU General Public License for more details.
|
||||
#include <time.h>
|
||||
#include "stdio.h"
|
||||
#include "crtlib.h"
|
||||
#ifdef HAVE_TGMATH_H
|
||||
#include <tgmath.h>
|
||||
#endif
|
||||
|
||||
void Q_strnupr( const char *in, char *out, size_t size_out )
|
||||
{
|
||||
if( size_out == 0 ) return;
|
||||
@ -652,7 +656,7 @@ char *Q_pretifymem( float value, int digitsafterdecimal )
|
||||
digitsafterdecimal = max( digitsafterdecimal, 0 );
|
||||
|
||||
// if it's basically integral, don't do any decimals
|
||||
if( fabs( value - (int)value ) < 0.00001 )
|
||||
if( fabs( value - (int)value ) < 0.00001f )
|
||||
{
|
||||
Q_sprintf( val, "%i%s", (int)value, suffix );
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ GNU General Public License for more details.
|
||||
#endif
|
||||
|
||||
#ifndef M_PI2
|
||||
#define M_PI2 (float)6.28318530717958647692
|
||||
#define M_PI2 ((float)(M_PI * 2))
|
||||
#endif
|
||||
|
||||
#define M_PI_F ((float)(M_PI))
|
||||
@ -73,8 +73,13 @@ GNU General Public License for more details.
|
||||
#define Q_floor( a ) ((float)(int)(a))
|
||||
#define Q_ceil( a ) ((float)(int)((a) + 1))
|
||||
#define Q_round( x, y ) (floor( x / y + 0.5f ) * y )
|
||||
#define Q_rint(x) ((x) < 0 ? ((int)((x)-0.5f)) : ((int)((x)+0.5f)))
|
||||
#define Q_rint(x) ((x) < 0.0f ? ((int)((x)-0.5f)) : ((int)((x)+0.5f)))
|
||||
|
||||
#ifdef isnan // check for C99 isnan
|
||||
#define IS_NAN isnan
|
||||
#else
|
||||
#define IS_NAN(x) (((*(int *)&x) & (255<<23)) == (255<<23))
|
||||
#endif
|
||||
|
||||
#define ALIGN( x, a ) ((( x ) + (( size_t )( a ) - 1 )) & ~(( size_t )( a ) - 1 ))
|
||||
|
||||
|
@ -805,7 +805,7 @@ void DrawGLPoly( glpoly_t *p, float xScale, float yScale )
|
||||
}
|
||||
texture = R_GetTexture( glState.currentTextures[glState.activeTMU] );
|
||||
|
||||
flRate = abs( flConveyorSpeed ) / (float)texture->srcWidth;
|
||||
flRate = fabs( flConveyorSpeed ) / (float)texture->srcWidth;
|
||||
flAngle = ( flConveyorSpeed >= 0 ) ? 180 : 0;
|
||||
|
||||
SinCos( flAngle * ( M_PI_F / 180.0f ), &sy, &cy );
|
||||
|
@ -883,7 +883,7 @@ void R_StudioMergeBones( cl_entity_t *e, model_t *m_pSubModel )
|
||||
matrix3x4 bonematrix;
|
||||
static vec4_t q[MAXSTUDIOBONES];
|
||||
static float pos[MAXSTUDIOBONES][3];
|
||||
double f;
|
||||
float f;
|
||||
|
||||
if( e->curstate.sequence >= m_pStudioHeader->numseq )
|
||||
e->curstate.sequence = 0;
|
||||
@ -936,7 +936,7 @@ StudioSetupBones
|
||||
*/
|
||||
void R_StudioSetupBones( cl_entity_t *e )
|
||||
{
|
||||
double f;
|
||||
float f;
|
||||
mstudiobone_t *pbones;
|
||||
mstudioseqdesc_t *pseqdesc;
|
||||
mstudioanim_t *panim;
|
||||
|
Loading…
Reference in New Issue
Block a user