diff --git a/r_aclip.c b/r_aclip.c index e807bd61..c1f19611 100644 --- a/r_aclip.c +++ b/r_aclip.c @@ -70,23 +70,23 @@ void R_Alias_clip_left (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out) { scale = (float)(RI.aliasvrect.x - pfv0->u) / (pfv1->u - pfv0->u); - out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5; - out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5; - out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5; - out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5; - out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5; - out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5; + out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5f; + out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5f; + out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5f; + out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5f; + out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5f; + out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5f; } else { scale = (float)(RI.aliasvrect.x - pfv1->u) / (pfv0->u - pfv1->u); - out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5; - out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5; - out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5; - out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5; - out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5; - out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5; + out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5f; + out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5f; + out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5f; + out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5f; + out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5f; + out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5f; } } @@ -99,23 +99,23 @@ void R_Alias_clip_right (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out) { scale = (float)(RI.aliasvrectright - pfv0->u ) / (pfv1->u - pfv0->u ); - out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5; - out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5; - out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5; - out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5; - out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5; - out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5; + out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5f; + out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5f; + out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5f; + out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5f; + out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5f; + out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5f; } else { scale = (float)(RI.aliasvrectright - pfv1->u ) / (pfv0->u - pfv1->u ); - out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5; - out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5; - out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5; - out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5; - out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5; - out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5; + out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5f; + out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5f; + out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5f; + out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5f; + out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5f; + out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5f; } } @@ -128,23 +128,23 @@ void R_Alias_clip_top (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out) { scale = (float)(RI.aliasvrect.y - pfv0->v) / (pfv1->v - pfv0->v); - out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5; - out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5; - out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5; - out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5; - out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5; - out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5; + out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5f; + out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5f; + out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5f; + out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5f; + out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5f; + out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5f; } else { scale = (float)(RI.aliasvrect.y - pfv1->v) / (pfv0->v - pfv1->v); - out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5; - out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5; - out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5; - out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5; - out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5; - out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5; + out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5f; + out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5f; + out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5f; + out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5f; + out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5f; + out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5f; } } @@ -159,24 +159,24 @@ void R_Alias_clip_bottom (finalvert_t *pfv0, finalvert_t *pfv1, scale = (float)(RI.aliasvrectbottom - pfv0->v) / (pfv1->v - pfv0->v); - out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5; - out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5; - out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5; - out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5; - out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5; - out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5; + out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5f; + out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5f; + out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5f; + out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5f; + out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5f; + out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5f; } else { scale = (float)(RI.aliasvrectbottom - pfv1->v) / (pfv0->v - pfv1->v); - out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5; - out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5; - out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5; - out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5; - out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5; - out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5; + out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5f; + out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5f; + out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5f; + out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5f; + out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5f; + out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5f; } } diff --git a/r_beams.c b/r_beams.c index d6648f40..1f7fa00e 100644 --- a/r_beams.c +++ b/r_beams.c @@ -64,7 +64,7 @@ static void FracNoise( float *noise, int divs ) static void SineNoise( float *noise, int divs ) { float freq = 0; - float step = M_PI / (float)divs; + float step = M_PI_F / (float)divs; int i; for( i = 0; i < divs; i++ ) @@ -236,7 +236,7 @@ static void R_DrawSegs( vec3_t source, vec3_t delta, float width, float scale, f } else { - scale *= length * 2.0; + scale *= length * 2.0f; } // Iterator to resample noise waveform (it needs to be generated in powers of 2) @@ -274,7 +274,7 @@ static void R_DrawSegs( vec3_t source, vec3_t delta, float width, float scale, f { float s, c; - SinCos( fraction * M_PI * length + freq, &s, &c ); + SinCos( fraction * M_PI_F * length + freq, &s, &c ); VectorMA( nextSeg.pos, (factor * s), RI.vup, nextSeg.pos ); // rotate the noise along the perpendicluar axis a bit to keep the bolt from looking diagonal @@ -386,8 +386,8 @@ void R_DrawTorus( vec3_t source, vec3_t delta, float width, float scale, float f if( segments > NOISE_DIVISIONS ) segments = NOISE_DIVISIONS; - length = VectorLength( delta ) * 0.01; - if( length < 0.5 ) length = 0.5; // don't lose all of the noise/texture on short beams + length = VectorLength( delta ) * 0.01f; + if( length < 0.5f ) length = 0.5f; // don't lose all of the noise/texture on short beams div = 1.0f / (segments - 1); @@ -421,7 +421,7 @@ void R_DrawTorus( vec3_t source, vec3_t delta, float width, float scale, float f VectorMA( point, factor, RI.vup, point ); // rotate the noise along the perpendicluar axis a bit to keep the bolt from looking diagonal - factor = rgNoise[noiseIndex>>16] * scale * cos( fraction * M_PI * 3 + freq ); + factor = rgNoise[noiseIndex>>16] * scale * cos( fraction * M_PI_F * 3 + freq ); VectorMA( point, factor, RI.vright, point ); } } @@ -658,11 +658,11 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime ) VectorMA( delta, pbeam->width, normal, last1 ); VectorMA( delta, -pbeam->width, normal, last2 ); - div = 1.0 / pbeam->amplitude; + div = 1.0f / pbeam->amplitude; fraction = ( pbeam->die - gpGlobals->time ) * div; - vLast = 0.0; - vStep = 1.0; + vLast = 0.0f; + vStep = 1.0f; while( particles ) { @@ -755,7 +755,7 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa if( segments > NOISE_DIVISIONS * 8 ) segments = NOISE_DIVISIONS * 8; - length = VectorLength( delta ) * 0.01f * M_PI; + length = VectorLength( delta ) * 0.01f * M_PI_F; if( length < 0.5f ) length = 0.5f; // Don't lose all of the noise/texture on short beams div = 1.0f / ( segments - 1 ); @@ -811,7 +811,7 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa // Rotate the noise along the perpendicluar axis a bit to keep the bolt from looking diagonal factor = rgNoise[(noiseIndex >> 16) & (NOISE_DIVISIONS - 1)] * scale; - factor *= cos( fraction * M_PI * 24 + freq ); + factor *= cos( fraction * M_PI_F * 24 + freq ); VectorMA( point, factor, RI.vright, point ); // Transform point into screen space diff --git a/r_bsp.c b/r_bsp.c index d78efbcc..a141ba5f 100644 --- a/r_bsp.c +++ b/r_bsp.c @@ -110,7 +110,7 @@ void R_RotateBmodel (void) // yaw angle = RI.currententity->angles[YAW]; - angle = angle * M_PI*2 / 360; + angle = angle * M_PI_F * 2 / 360.0f; s = sin(angle); c = cos(angle); @@ -127,7 +127,7 @@ void R_RotateBmodel (void) // pitch angle = RI.currententity->angles[PITCH]; - angle = angle * M_PI*2 / 360; + angle = angle * M_PI_F * 2 / 360.0f; s = sin(angle); c = cos(angle); @@ -145,7 +145,7 @@ void R_RotateBmodel (void) // roll angle = RI.currententity->angles[ROLL]; - angle = angle * M_PI*2 / 360; + angle = angle * M_PI_F*2 / 360.0f; s = sin(angle); c = cos(angle); @@ -667,7 +667,7 @@ void R_DrawSolidClippedSubmodelPolygons (model_t *pmodel, mnode_t *topnode) { if( psurf->plane->type != PLANE_Z && !FBitSet( RI.currententity->curstate.effects, EF_WATERSIDES )) continue; - if( r_entorigin[2] + pmodel->mins[2] + 1.0 >= psurf->plane->dist ) + if( r_entorigin[2] + pmodel->mins[2] + 1.0f >= psurf->plane->dist ) continue; } // find which side of the node we are on @@ -749,7 +749,7 @@ void R_DrawSubmodelPolygons (model_t *pmodel, int clipflags, mnode_t *topnode) { if( psurf->plane->type != PLANE_Z && !FBitSet( RI.currententity->curstate.effects, EF_WATERSIDES )) continue; - if( r_entorigin[2] + pmodel->mins[2] + 1.0 >= psurf->plane->dist ) + if( r_entorigin[2] + pmodel->mins[2] + 1.0f >= psurf->plane->dist ) continue; } // find which side of the node we are on diff --git a/r_decals.c b/r_decals.c index 4087e2f2..436d9fbb 100644 --- a/r_decals.c +++ b/r_decals.c @@ -410,12 +410,12 @@ static void R_DecalVertsLight( float *v, msurface_t *surf, int vertCount ) // lightmap texture coordinates s = DotProduct( v, info->lmvecs[0] ) + info->lmvecs[0][3] - info->lightmapmins[0]; s += surf->light_s * sample_size; - s += sample_size * 0.5; + s += sample_size * 0.5f; s /= BLOCK_SIZE * sample_size; //fa->texinfo->texture->width; t = DotProduct( v, info->lmvecs[1] ) + info->lmvecs[1][3] - info->lightmapmins[1]; t += surf->light_t * sample_size; - t += sample_size * 0.5; + t += sample_size * 0.5f; t /= BLOCK_SIZE * sample_size; //fa->texinfo->texture->height; v[5] = s; diff --git a/r_edge.c b/r_edge.c index 97cc7985..6a3ac3fe 100644 --- a/r_edge.c +++ b/r_edge.c @@ -474,10 +474,10 @@ void R_LeadingEdge (edge_t *edge) if (surf->insubmodel && (surf->key == surf2->key)) { // must be two bmodels in the same leaf; sort on 1/z - fu = (float)(edge->u - 0xFFFFF) * (1.0 / 0x100000); + fu = (float)(edge->u - 0xFFFFF) * (1.0f / 0x100000); newzi = surf->d_ziorigin + fv*surf->d_zistepv + fu*surf->d_zistepu; - newzibottom = newzi * 0.99; + newzibottom = newzi * 0.99f; testzi = surf2->d_ziorigin + fv*surf2->d_zistepv + fu*surf2->d_zistepu; @@ -487,7 +487,7 @@ void R_LeadingEdge (edge_t *edge) goto newtop; } - newzitop = newzi * 1.01; + newzitop = newzi * 1.01f; if (newzitop >= testzi) { if (surf->d_zistepu >= surf2->d_zistepu) @@ -512,10 +512,10 @@ continue_search: goto continue_search; // must be two bmodels in the same leaf; sort on 1/z - fu = (float)(edge->u - 0xFFFFF) * (1.0 / 0x100000); + fu = (float)(edge->u - 0xFFFFF) * (1.0f / 0x100000); newzi = surf->d_ziorigin + fv*surf->d_zistepv + fu*surf->d_zistepu; - newzibottom = newzi * 0.99; + newzibottom = newzi * 0.99f; testzi = surf2->d_ziorigin + fv*surf2->d_zistepv + fu*surf2->d_zistepu; @@ -525,7 +525,7 @@ continue_search: goto gotposition; } - newzitop = newzi * 1.01; + newzitop = newzi * 1.01f; if (newzitop >= testzi) { if (surf->d_zistepu >= surf2->d_zistepu) @@ -819,7 +819,7 @@ void D_CalcGradients (msurface_t *pface) pplane = pface->plane; - mipscale = 1.0 / (float)(1 << miplevel); + mipscale = 1.0f / (float)(1 << miplevel); if( pface->texinfo->flags & TEX_WORLD_LUXELS ) @@ -829,8 +829,8 @@ void D_CalcGradients (msurface_t *pface) } else { - TransformVector (pface->info->lmvecs[0], p_saxis); - TransformVector (pface->info->lmvecs[1], p_taxis); + TransformVector (pface->info->lmvecs[0], p_saxis); + TransformVector (pface->info->lmvecs[1], p_taxis); } t = xscaleinv * mipscale; @@ -851,19 +851,19 @@ void D_CalcGradients (msurface_t *pface) t = 0x10000*mipscale; if( pface->texinfo->flags & TEX_WORLD_LUXELS ) { - sadjust = ((fixed16_t)(DotProduct (p_temp1, p_saxis) * 0x10000 + 0.5)) - + sadjust = ((fixed16_t)(DotProduct (p_temp1, p_saxis) * 0x10000 + 0.5f)) - ((pface->texturemins[0] << 16) >> miplevel) + pface->texinfo->vecs[0][3]*t; - tadjust = ((fixed16_t)(DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5)) - + tadjust = ((fixed16_t)(DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5f)) - ((pface->texturemins[1] << 16) >> miplevel) + pface->texinfo->vecs[1][3]*t; } else { - sadjust = ((fixed16_t)(DotProduct (p_temp1, p_saxis) * 0x10000 + 0.5)) - + sadjust = ((fixed16_t)(DotProduct (p_temp1, p_saxis) * 0x10000 + 0.5f)) - ((pface->info->lightmapmins[0] << 16) >> miplevel) + pface->info->lmvecs[0][3]*t; - tadjust = ((fixed16_t)(DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5)) - + tadjust = ((fixed16_t)(DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5f)) - ((pface->info->lightmapmins[1] << 16) >> miplevel) + pface->info->lmvecs[1][3]*t; } @@ -872,9 +872,9 @@ void D_CalcGradients (msurface_t *pface) { if(pface->flags & SURF_DRAWTURB) - sadjust += 0x10000 * (-128 * ( (gpGlobals->time * 0.25) - (int)(gpGlobals->time * 0.25) )); + sadjust += 0x10000 * (-128 * ( (gpGlobals->time * 0.25f) - (int)(gpGlobals->time * 0.25f) )); else - sadjust += 0x10000 * (-128 * ( (gpGlobals->time * 0.77) - (int)(gpGlobals->time * 0.77) )); + sadjust += 0x10000 * (-128 * ( (gpGlobals->time * 0.77f) - (int)(gpGlobals->time * 0.77f) )); bbextents = ((pface->extents[0] << 16) >> miplevel) - 1; } else diff --git a/r_local.h b/r_local.h index 6b36d4fa..f8ec142d 100644 --- a/r_local.h +++ b/r_local.h @@ -419,7 +419,7 @@ void R_DrawModelHull( void ); void GL_Bind( int tmu, unsigned int texnum ); // -// gl_draw.c +// gl_draw.cM_PI // void R_Set2DMode( qboolean enable ); void R_DrawTileClear( int texnum, int x, int y, int w, int h ); @@ -821,13 +821,13 @@ extern cvar_t *r_showhull; #define BMODEL_FULLY_CLIPPED 0x10 // value returned by R_BmodelCheckBBox () // if bbox is trivially rejected -#define XCENTERING (1.0 / 2.0) -#define YCENTERING (1.0 / 2.0) +#define XCENTERING (1.0f / 2.0f) +#define YCENTERING (1.0f / 2.0f) -#define CLIP_EPSILON 0.001 +#define CLIP_EPSILON 0.001f // !!! if this is changed, it must be changed in asm_draw.h too !!! -#define NEAR_CLIP 0.01 +#define NEAR_CLIP 0.01f //#define MAXALIASVERTS 2000 // TODO: tune this diff --git a/r_main.c b/r_main.c index 493914c5..c22092a5 100644 --- a/r_main.c +++ b/r_main.c @@ -498,11 +498,11 @@ R_SetupProjectionMatrix static void R_SetupProjectionMatrix( matrix4x4 m ) { #if 1 - double xMin, xMax, yMin, yMax, zNear, zFar; + float xMin, xMax, yMin, yMax, zNear, zFar; if( RI.drawOrtho ) { - ref_overview_t *ov = gEngfuncs.GetOverviewParms(); + const ref_overview_t *ov = gEngfuncs.GetOverviewParms(); Matrix4x4_CreateOrtho( m, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar ); return; } @@ -512,10 +512,10 @@ static void R_SetupProjectionMatrix( matrix4x4 m ) zNear = 4.0f; zFar = max( 256.0f, RI.farClip ); - yMax = zNear * tan( RI.fov_y * M_PI / 360.0 ); + yMax = zNear * tan( RI.fov_y * M_PI_F / 360.0f ); yMin = -yMax; - xMax = zNear * tan( RI.fov_x * M_PI / 360.0 ); + xMax = zNear * tan( RI.fov_x * M_PI_F / 360.0f ); xMin = -xMax; Matrix4x4_CreateProjection( m, xMax, xMin, yMax, yMin, zNear, zFar ); diff --git a/r_math.c b/r_math.c index c60e09fa..f8a43d7f 100644 --- a/r_math.c +++ b/r_math.c @@ -169,7 +169,7 @@ void Matrix4x4_CreateRotate( matrix4x4 out, float angle, float x, float y, float y *= len; z *= len; - angle *= (-M_PI / 180.0f); + angle *= (-M_PI_F / 180.0f); SinCos( angle, &s, &c ); out[0][0]=x * x + c * (1 - x * x); diff --git a/r_misc.c b/r_misc.c index e3c00f72..cd2c5653 100644 --- a/r_misc.c +++ b/r_misc.c @@ -221,22 +221,22 @@ void R_ViewChanged (vrect_t *vr) RI.vrect = *vr; - horizontalFieldOfView = 2*tan((float)RI.fov_x/360*M_PI); - verticalFieldOfView = 2*tan((float)RI.fov_y/360*M_PI); + horizontalFieldOfView = 2*tan((float)RI.fov_x/360.0f * M_PI_F); + verticalFieldOfView = 2*tan((float)RI.fov_y/360.0f * M_PI_F); RI.fvrectx = (float)RI.vrect.x; - RI.fvrectx_adj = (float)RI.vrect.x - 0.5; + RI.fvrectx_adj = (float)RI.vrect.x - 0.5f; RI.vrect_x_adj_shift20 = (RI.vrect.x<<20) + (1<<19) - 1; RI.fvrecty = (float)RI.vrect.y; - RI.fvrecty_adj = (float)RI.vrect.y - 0.5; + RI.fvrecty_adj = (float)RI.vrect.y - 0.5f; RI.vrectright = RI.vrect.x + RI.vrect.width; RI.vrectright_adj_shift20 = (RI.vrectright<<20) + (1<<19) - 1; RI.fvrectright = (float)RI.vrectright; - RI.fvrectright_adj = (float)RI.vrectright - 0.5; - RI.vrectrightedge = (float)RI.vrectright - 0.99; + RI.fvrectright_adj = (float)RI.vrectright - 0.5f; + RI.vrectrightedge = (float)RI.vrectright - 0.99f; RI.vrectbottom = RI.vrect.y + RI.vrect.height; RI.fvrectbottom = (float)RI.vrectbottom; - RI.fvrectbottom_adj = (float)RI.vrectbottom - 0.5; + RI.fvrectbottom_adj = (float)RI.vrectbottom - 0.5f; RI.aliasvrect.x = (int)(RI.vrect.x * r_aliasuvscale); RI.aliasvrect.y = (int)(RI.vrect.y * r_aliasuvscale); @@ -257,44 +257,44 @@ void R_ViewChanged (vrect_t *vr) // but will definately render in the [range] row and column, so adjust the // buffer origin to get an exact edge to edge fill xcenter = ((float)RI.vrect.width * XCENTERING) + - RI.vrect.x - 0.5; + RI.vrect.x - 0.5f; aliasxcenter = xcenter * r_aliasuvscale; ycenter = ((float)RI.vrect.height * YCENTERING) + - RI.vrect.y - 0.5; + RI.vrect.y - 0.5f; aliasycenter = ycenter * r_aliasuvscale; xscale = RI.vrect.width / horizontalFieldOfView; aliasxscale = xscale * r_aliasuvscale; - xscaleinv = 1.0 / xscale; + xscaleinv = 1.0f / xscale; yscale = xscale; aliasyscale = yscale * r_aliasuvscale; - yscaleinv = 1.0 / yscale; + yscaleinv = 1.0f / yscale; //xscaleshrink = (RI.vrect.width-6)/RI.horizontalFieldOfView; //yscaleshrink = xscaleshrink; // left side clip - qfrustum.screenedge[0].normal[0] = -1.0 / (xOrigin*horizontalFieldOfView); + qfrustum.screenedge[0].normal[0] = -1.0f / (xOrigin*horizontalFieldOfView); qfrustum.screenedge[0].normal[1] = 0; qfrustum.screenedge[0].normal[2] = 1; qfrustum.screenedge[0].type = PLANE_ANYZ; // right side clip qfrustum.screenedge[1].normal[0] = - 1.0 / ((1.0-xOrigin)*horizontalFieldOfView); + 1.0f / ((1.0f-xOrigin)*horizontalFieldOfView); qfrustum.screenedge[1].normal[1] = 0; qfrustum.screenedge[1].normal[2] = 1; qfrustum.screenedge[1].type = PLANE_ANYZ; // top side clip qfrustum.screenedge[2].normal[0] = 0; - qfrustum.screenedge[2].normal[1] = -1.0 / (yOrigin*verticalFieldOfView); + qfrustum.screenedge[2].normal[1] = -1.0f / (yOrigin*verticalFieldOfView); qfrustum.screenedge[2].normal[2] = 1; qfrustum.screenedge[2].type = PLANE_ANYZ; // bottom side clip qfrustum.screenedge[3].normal[0] = 0; - qfrustum.screenedge[3].normal[1] = 1.0 / ((1.0-yOrigin)*verticalFieldOfView); + qfrustum.screenedge[3].normal[1] = 1.0f / ((1.0f-yOrigin)*verticalFieldOfView); qfrustum.screenedge[3].normal[2] = 1; qfrustum.screenedge[3].type = PLANE_ANYZ; diff --git a/r_polyse.c b/r_polyse.c index 11a48933..e987f33d 100644 --- a/r_polyse.c +++ b/r_polyse.c @@ -369,7 +369,7 @@ void FloorDivMod (float numer, float denom, int *quotient, int q, r; float x; - if (numer >= 0.0) + if (numer >= 0.0f) { x = floor(numer / denom); @@ -730,7 +730,7 @@ qboolean R_PolysetCalcGradients (int skinwidth) printf("%d %d %d %d %d %d\n" , r_p1[0], r_p1[1], r_p1[2] >> 16, r_p1[3] >> 16, r_p1[4], r_p1[5]); printf("%d %d %d %d %d %d\n\n", r_p2[0], r_p2[1], r_p2[2] >> 16, r_p2[3] >> 16, r_p2[4], r_p2[5]); */ - xstepdenominv = 1.0 / (float)d_xdenom; + xstepdenominv = 1.0f / (float)d_xdenom; ystepdenominv = -xstepdenominv; diff --git a/r_rast.c b/r_rast.c index ba6aed4b..5e6590a4 100644 --- a/r_rast.c +++ b/r_rast.c @@ -244,7 +244,7 @@ void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1) if (transformed[2] < NEAR_CLIP) transformed[2] = NEAR_CLIP; - lzi0 = 1.0 / transformed[2]; + lzi0 = 1.0f / transformed[2]; // FIXME: build x/yscale into transform? scale = xscale * lzi0; @@ -273,7 +273,7 @@ void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1) if (transformed[2] < NEAR_CLIP) transformed[2] = NEAR_CLIP; - r_lzi1 = 1.0 / transformed[2]; + r_lzi1 = 1.0f / transformed[2]; scale = xscale * r_lzi1; r_u1 = (xcenter + scale*transformed[0]); @@ -736,7 +736,7 @@ void R_RenderFace (msurface_t *fa, int clipflags) // FIXME: cache this? TransformVector (pplane->normal, p_normal); // FIXME: cache this? - distinv = 1.0 / (pplane->dist - DotProduct (tr.modelorg, pplane->normal)); + distinv = 1.0f / (pplane->dist - DotProduct (tr.modelorg, pplane->normal)); surface_p->d_zistepu = p_normal[0] * xscaleinv * distinv; surface_p->d_zistepv = -p_normal[1] * yscaleinv * distinv; @@ -857,7 +857,7 @@ void R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf) // FIXME: cache this? TransformVector (pplane->normal, p_normal); // FIXME: cache this? - distinv = 1.0 / (pplane->dist - DotProduct (tr.modelorg, pplane->normal)); + distinv = 1.0f / (pplane->dist - DotProduct (tr.modelorg, pplane->normal)); surface_p->d_zistepu = p_normal[0] * xscaleinv * distinv; surface_p->d_zistepv = -p_normal[1] * yscaleinv * distinv; diff --git a/r_scan.c b/r_scan.c index c0e7838b..d096e4b7 100644 --- a/r_scan.c +++ b/r_scan.c @@ -168,7 +168,7 @@ void Turbulent8 (espan_t *pspan) r_turb_sstep = 0; // keep compiler happy r_turb_tstep = 0; // ditto - r_turb_pbase = (unsigned char *)cacheblock; + r_turb_pbase = cacheblock; sdivz16stepu = d_sdivzstepu * 16; tdivz16stepu = d_tdivzstepu * 16; @@ -307,7 +307,7 @@ void TurbulentZ8 (espan_t *pspan, int alpha1) r_turb_sstep = 0; // keep compiler happy r_turb_tstep = 0; // ditto - r_turb_pbase = (unsigned char *)cacheblock; + r_turb_pbase = cacheblock; sdivz16stepu = d_sdivzstepu * 16; tdivz16stepu = d_tdivzstepu * 16; @@ -604,7 +604,7 @@ void D_DrawSpans16 (espan_t *pspan) sstep = 0; // keep compiler happy tstep = 0; // ditto - pbase = (unsigned char *)cacheblock; + pbase = cacheblock; sdivz8stepu = d_sdivzstepu * 8; tdivz8stepu = d_tdivzstepu * 8; @@ -772,7 +772,7 @@ void D_AlphaSpans16 (espan_t *pspan) sstep = 0; // keep compiler happy tstep = 0; // ditto - pbase = (unsigned char *)cacheblock; + pbase = cacheblock; sdivz8stepu = d_sdivzstepu * 8; tdivz8stepu = d_tdivzstepu * 8; @@ -973,7 +973,7 @@ void D_BlendSpans16 (espan_t *pspan, int alpha) sstep = 0; // keep compiler happy tstep = 0; // ditto - pbase = (unsigned char *)cacheblock; + pbase = cacheblock; sdivz8stepu = d_sdivzstepu * 8; tdivz8stepu = d_tdivzstepu * 8; @@ -1175,7 +1175,7 @@ void D_AddSpans16 (espan_t *pspan) sstep = 0; // keep compiler happy tstep = 0; // ditto - pbase = (unsigned char *)cacheblock; + pbase = cacheblock; sdivz8stepu = d_sdivzstepu * 8; tdivz8stepu = d_tdivzstepu * 8; diff --git a/r_studio.c b/r_studio.c index d51e6947..227bde87 100644 --- a/r_studio.c +++ b/r_studio.c @@ -871,7 +871,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; @@ -924,7 +924,7 @@ StudioSetupBones */ void R_StudioSetupBones( cl_entity_t *e ) { - double f; + float f; mstudiobone_t *pbones; mstudioseqdesc_t *pseqdesc; mstudioanim_t *panim; @@ -3015,7 +3015,7 @@ void R_StudioEstimateGait( entity_state_t *pplayer ) } else { - m_pPlayerInfo->gaityaw = ( atan2( est_velocity[1], est_velocity[0] ) * 180 / M_PI ); + m_pPlayerInfo->gaityaw = ( atan2( est_velocity[1], est_velocity[0] ) * 180 / M_PI_F ); if( m_pPlayerInfo->gaityaw > 180.0f ) m_pPlayerInfo->gaityaw = 180.0f; if( m_pPlayerInfo->gaityaw < -180.0f ) m_pPlayerInfo->gaityaw = -180.0f; } @@ -3477,7 +3477,7 @@ void R_DrawViewModel( void ) // adjust the depth range to prevent view model from poking into walls //pglDepthRange( gldepthmin, gldepthmin + 0.3f * ( gldepthmax - gldepthmin )); - s_ziscale = (float)0x8000 * (float)0x10000 * 3.0; + s_ziscale = (float)0x8000 * (float)0x10000 * 3.0f; RI.currentmodel = RI.currententity->model; // backface culling for left-handed weapons diff --git a/r_surf.c b/r_surf.c index 7331205d..2257bd2a 100644 --- a/r_surf.c +++ b/r_surf.c @@ -571,7 +571,7 @@ void R_DrawSurface (void) for (u=0 ; uxyz[0]; y = fv->xyz[1]; z = fv->xyz[2]; - zi = 1.0 / z; + zi = 1.0f / z; fv->zi = zi * s_ziscale;