Browse Source

ref_soft: fix double promotion

pull/2/head
Alibek Omarov 5 years ago
parent
commit
c8eac04e9b
  1. 96
      r_aclip.c
  2. 22
      r_beams.c
  3. 10
      r_bsp.c
  4. 4
      r_decals.c
  5. 30
      r_edge.c
  6. 10
      r_local.h
  7. 8
      r_main.c
  8. 2
      r_math.c
  9. 30
      r_misc.c
  10. 4
      r_polyse.c
  11. 8
      r_rast.c
  12. 12
      r_scan.c
  13. 8
      r_studio.c
  14. 2
      r_surf.c
  15. 2
      r_trialias.c

96
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) / scale = (float)(RI.aliasvrect.x - pfv0->u) /
(pfv1->u - pfv0->u); (pfv1->u - pfv0->u);
out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5; out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5f;
out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5; out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5f;
out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5; out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5f;
out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5; out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5f;
out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5; out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5f;
out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5; out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5f;
} }
else else
{ {
scale = (float)(RI.aliasvrect.x - pfv1->u) / scale = (float)(RI.aliasvrect.x - pfv1->u) /
(pfv0->u - pfv1->u); (pfv0->u - pfv1->u);
out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5; out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5f;
out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5; out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5f;
out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5; out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5f;
out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5; out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5f;
out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5; out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5f;
out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5; 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 ) / scale = (float)(RI.aliasvrectright - pfv0->u ) /
(pfv1->u - pfv0->u ); (pfv1->u - pfv0->u );
out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5; out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5f;
out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5; out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5f;
out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5; out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5f;
out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5; out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5f;
out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5; out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5f;
out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5; out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5f;
} }
else else
{ {
scale = (float)(RI.aliasvrectright - pfv1->u ) / scale = (float)(RI.aliasvrectright - pfv1->u ) /
(pfv0->u - pfv1->u ); (pfv0->u - pfv1->u );
out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5; out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5f;
out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5; out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5f;
out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5; out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5f;
out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5; out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5f;
out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5; out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5f;
out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5; 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) / scale = (float)(RI.aliasvrect.y - pfv0->v) /
(pfv1->v - pfv0->v); (pfv1->v - pfv0->v);
out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5; out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5f;
out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5; out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5f;
out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5; out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5f;
out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5; out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5f;
out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5; out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5f;
out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5; out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5f;
} }
else else
{ {
scale = (float)(RI.aliasvrect.y - pfv1->v) / scale = (float)(RI.aliasvrect.y - pfv1->v) /
(pfv0->v - pfv1->v); (pfv0->v - pfv1->v);
out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5; out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5f;
out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5; out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5f;
out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5; out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5f;
out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5; out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5f;
out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5; out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5f;
out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5; 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) / scale = (float)(RI.aliasvrectbottom - pfv0->v) /
(pfv1->v - pfv0->v); (pfv1->v - pfv0->v);
out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5; out->u = pfv0->u + ( pfv1->u - pfv0->u ) * scale + 0.5f;
out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5; out->v = pfv0->v + ( pfv1->v - pfv0->v ) * scale + 0.5f;
out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5; out->s = pfv0->s + ( pfv1->s - pfv0->s ) * scale + 0.5f;
out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5; out->t = pfv0->t + ( pfv1->t - pfv0->t ) * scale + 0.5f;
out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5; out->l = pfv0->l + ( pfv1->l - pfv0->l ) * scale + 0.5f;
out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5; out->zi = pfv0->zi + ( pfv1->zi - pfv0->zi) * scale + 0.5f;
} }
else else
{ {
scale = (float)(RI.aliasvrectbottom - pfv1->v) / scale = (float)(RI.aliasvrectbottom - pfv1->v) /
(pfv0->v - pfv1->v); (pfv0->v - pfv1->v);
out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5; out->u = pfv1->u + ( pfv0->u - pfv1->u ) * scale + 0.5f;
out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5; out->v = pfv1->v + ( pfv0->v - pfv1->v ) * scale + 0.5f;
out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5; out->s = pfv1->s + ( pfv0->s - pfv1->s ) * scale + 0.5f;
out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5; out->t = pfv1->t + ( pfv0->t - pfv1->t ) * scale + 0.5f;
out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5; out->l = pfv1->l + ( pfv0->l - pfv1->l ) * scale + 0.5f;
out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5; out->zi = pfv1->zi + ( pfv0->zi - pfv1->zi) * scale + 0.5f;
} }
} }

22
r_beams.c

@ -64,7 +64,7 @@ static void FracNoise( float *noise, int divs )
static void SineNoise( float *noise, int divs ) static void SineNoise( float *noise, int divs )
{ {
float freq = 0; float freq = 0;
float step = M_PI / (float)divs; float step = M_PI_F / (float)divs;
int i; int i;
for( i = 0; i < divs; 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 else
{ {
scale *= length * 2.0; scale *= length * 2.0f;
} }
// Iterator to resample noise waveform (it needs to be generated in powers of 2) // 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; 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 ); 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 // 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 ) if( segments > NOISE_DIVISIONS )
segments = NOISE_DIVISIONS; segments = NOISE_DIVISIONS;
length = VectorLength( delta ) * 0.01; length = VectorLength( delta ) * 0.01f;
if( length < 0.5 ) length = 0.5; // don't lose all of the noise/texture on short beams if( length < 0.5f ) length = 0.5f; // don't lose all of the noise/texture on short beams
div = 1.0f / (segments - 1); 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 ); VectorMA( point, factor, RI.vup, point );
// rotate the noise along the perpendicluar axis a bit to keep the bolt from looking diagonal // 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 ); 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, last1 );
VectorMA( delta, -pbeam->width, normal, last2 ); VectorMA( delta, -pbeam->width, normal, last2 );
div = 1.0 / pbeam->amplitude; div = 1.0f / pbeam->amplitude;
fraction = ( pbeam->die - gpGlobals->time ) * div; fraction = ( pbeam->die - gpGlobals->time ) * div;
vLast = 0.0; vLast = 0.0f;
vStep = 1.0; vStep = 1.0f;
while( particles ) 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 ) if( segments > NOISE_DIVISIONS * 8 )
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 if( length < 0.5f ) length = 0.5f; // Don't lose all of the noise/texture on short beams
div = 1.0f / ( segments - 1 ); 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 // 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 = 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 ); VectorMA( point, factor, RI.vright, point );
// Transform point into screen space // Transform point into screen space

10
r_bsp.c

@ -110,7 +110,7 @@ void R_RotateBmodel (void)
// yaw // yaw
angle = RI.currententity->angles[YAW]; angle = RI.currententity->angles[YAW];
angle = angle * M_PI*2 / 360; angle = angle * M_PI_F * 2 / 360.0f;
s = sin(angle); s = sin(angle);
c = cos(angle); c = cos(angle);
@ -127,7 +127,7 @@ void R_RotateBmodel (void)
// pitch // pitch
angle = RI.currententity->angles[PITCH]; angle = RI.currententity->angles[PITCH];
angle = angle * M_PI*2 / 360; angle = angle * M_PI_F * 2 / 360.0f;
s = sin(angle); s = sin(angle);
c = cos(angle); c = cos(angle);
@ -145,7 +145,7 @@ void R_RotateBmodel (void)
// roll // roll
angle = RI.currententity->angles[ROLL]; angle = RI.currententity->angles[ROLL];
angle = angle * M_PI*2 / 360; angle = angle * M_PI_F*2 / 360.0f;
s = sin(angle); s = sin(angle);
c = cos(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 )) if( psurf->plane->type != PLANE_Z && !FBitSet( RI.currententity->curstate.effects, EF_WATERSIDES ))
continue; 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; continue;
} }
// find which side of the node we are on // 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 )) if( psurf->plane->type != PLANE_Z && !FBitSet( RI.currententity->curstate.effects, EF_WATERSIDES ))
continue; 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; continue;
} }
// find which side of the node we are on // find which side of the node we are on

4
r_decals.c

@ -410,12 +410,12 @@ static void R_DecalVertsLight( float *v, msurface_t *surf, int vertCount )
// lightmap texture coordinates // lightmap texture coordinates
s = DotProduct( v, info->lmvecs[0] ) + info->lmvecs[0][3] - info->lightmapmins[0]; s = DotProduct( v, info->lmvecs[0] ) + info->lmvecs[0][3] - info->lightmapmins[0];
s += surf->light_s * sample_size; 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; s /= BLOCK_SIZE * sample_size; //fa->texinfo->texture->width;
t = DotProduct( v, info->lmvecs[1] ) + info->lmvecs[1][3] - info->lightmapmins[1]; t = DotProduct( v, info->lmvecs[1] ) + info->lmvecs[1][3] - info->lightmapmins[1];
t += surf->light_t * sample_size; 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; t /= BLOCK_SIZE * sample_size; //fa->texinfo->texture->height;
v[5] = s; v[5] = s;

30
r_edge.c

@ -474,10 +474,10 @@ void R_LeadingEdge (edge_t *edge)
if (surf->insubmodel && (surf->key == surf2->key)) if (surf->insubmodel && (surf->key == surf2->key))
{ {
// must be two bmodels in the same leaf; sort on 1/z // 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 + newzi = surf->d_ziorigin + fv*surf->d_zistepv +
fu*surf->d_zistepu; fu*surf->d_zistepu;
newzibottom = newzi * 0.99; newzibottom = newzi * 0.99f;
testzi = surf2->d_ziorigin + fv*surf2->d_zistepv + testzi = surf2->d_ziorigin + fv*surf2->d_zistepv +
fu*surf2->d_zistepu; fu*surf2->d_zistepu;
@ -487,7 +487,7 @@ void R_LeadingEdge (edge_t *edge)
goto newtop; goto newtop;
} }
newzitop = newzi * 1.01; newzitop = newzi * 1.01f;
if (newzitop >= testzi) if (newzitop >= testzi)
{ {
if (surf->d_zistepu >= surf2->d_zistepu) if (surf->d_zistepu >= surf2->d_zistepu)
@ -512,10 +512,10 @@ continue_search:
goto continue_search; goto continue_search;
// must be two bmodels in the same leaf; sort on 1/z // 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 + newzi = surf->d_ziorigin + fv*surf->d_zistepv +
fu*surf->d_zistepu; fu*surf->d_zistepu;
newzibottom = newzi * 0.99; newzibottom = newzi * 0.99f;
testzi = surf2->d_ziorigin + fv*surf2->d_zistepv + testzi = surf2->d_ziorigin + fv*surf2->d_zistepv +
fu*surf2->d_zistepu; fu*surf2->d_zistepu;
@ -525,7 +525,7 @@ continue_search:
goto gotposition; goto gotposition;
} }
newzitop = newzi * 1.01; newzitop = newzi * 1.01f;
if (newzitop >= testzi) if (newzitop >= testzi)
{ {
if (surf->d_zistepu >= surf2->d_zistepu) if (surf->d_zistepu >= surf2->d_zistepu)
@ -819,7 +819,7 @@ void D_CalcGradients (msurface_t *pface)
pplane = pface->plane; pplane = pface->plane;
mipscale = 1.0 / (float)(1 << miplevel); mipscale = 1.0f / (float)(1 << miplevel);
if( pface->texinfo->flags & TEX_WORLD_LUXELS ) if( pface->texinfo->flags & TEX_WORLD_LUXELS )
@ -829,8 +829,8 @@ void D_CalcGradients (msurface_t *pface)
} }
else else
{ {
TransformVector (pface->info->lmvecs[0], p_saxis); TransformVector (pface->info->lmvecs[0], p_saxis);
TransformVector (pface->info->lmvecs[1], p_taxis); TransformVector (pface->info->lmvecs[1], p_taxis);
} }
t = xscaleinv * mipscale; t = xscaleinv * mipscale;
@ -851,19 +851,19 @@ void D_CalcGradients (msurface_t *pface)
t = 0x10000*mipscale; t = 0x10000*mipscale;
if( pface->texinfo->flags & TEX_WORLD_LUXELS ) 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->texturemins[0] << 16) >> miplevel)
+ pface->texinfo->vecs[0][3]*t; + 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->texturemins[1] << 16) >> miplevel)
+ pface->texinfo->vecs[1][3]*t; + pface->texinfo->vecs[1][3]*t;
} }
else 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->lightmapmins[0] << 16) >> miplevel)
+ pface->info->lmvecs[0][3]*t; + 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->lightmapmins[1] << 16) >> miplevel)
+ pface->info->lmvecs[1][3]*t; + pface->info->lmvecs[1][3]*t;
} }
@ -872,9 +872,9 @@ void D_CalcGradients (msurface_t *pface)
{ {
if(pface->flags & SURF_DRAWTURB) 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 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; bbextents = ((pface->extents[0] << 16) >> miplevel) - 1;
} }
else else

10
r_local.h

@ -419,7 +419,7 @@ void R_DrawModelHull( void );
void GL_Bind( int tmu, unsigned int texnum ); void GL_Bind( int tmu, unsigned int texnum );
// //
// gl_draw.c // gl_draw.cM_PI
// //
void R_Set2DMode( qboolean enable ); void R_Set2DMode( qboolean enable );
void R_DrawTileClear( int texnum, int x, int y, int w, int h ); 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 () #define BMODEL_FULLY_CLIPPED 0x10 // value returned by R_BmodelCheckBBox ()
// if bbox is trivially rejected // if bbox is trivially rejected
#define XCENTERING (1.0 / 2.0) #define XCENTERING (1.0f / 2.0f)
#define YCENTERING (1.0 / 2.0) #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 !!! // !!! 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 //#define MAXALIASVERTS 2000 // TODO: tune this

8
r_main.c

@ -498,11 +498,11 @@ R_SetupProjectionMatrix
static void R_SetupProjectionMatrix( matrix4x4 m ) static void R_SetupProjectionMatrix( matrix4x4 m )
{ {
#if 1 #if 1
double xMin, xMax, yMin, yMax, zNear, zFar; float xMin, xMax, yMin, yMax, zNear, zFar;
if( RI.drawOrtho ) 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 ); Matrix4x4_CreateOrtho( m, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar );
return; return;
} }
@ -512,10 +512,10 @@ static void R_SetupProjectionMatrix( matrix4x4 m )
zNear = 4.0f; zNear = 4.0f;
zFar = max( 256.0f, RI.farClip ); 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; 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; xMin = -xMax;
Matrix4x4_CreateProjection( m, xMax, xMin, yMax, yMin, zNear, zFar ); Matrix4x4_CreateProjection( m, xMax, xMin, yMax, yMin, zNear, zFar );

2
r_math.c

@ -169,7 +169,7 @@ void Matrix4x4_CreateRotate( matrix4x4 out, float angle, float x, float y, float
y *= len; y *= len;
z *= len; z *= len;
angle *= (-M_PI / 180.0f); angle *= (-M_PI_F / 180.0f);
SinCos( angle, &s, &c ); SinCos( angle, &s, &c );
out[0][0]=x * x + c * (1 - x * x); out[0][0]=x * x + c * (1 - x * x);

30
r_misc.c

@ -221,22 +221,22 @@ void R_ViewChanged (vrect_t *vr)
RI.vrect = *vr; RI.vrect = *vr;
horizontalFieldOfView = 2*tan((float)RI.fov_x/360*M_PI); horizontalFieldOfView = 2*tan((float)RI.fov_x/360.0f * M_PI_F);
verticalFieldOfView = 2*tan((float)RI.fov_y/360*M_PI); verticalFieldOfView = 2*tan((float)RI.fov_y/360.0f * M_PI_F);
RI.fvrectx = (float)RI.vrect.x; 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.vrect_x_adj_shift20 = (RI.vrect.x<<20) + (1<<19) - 1;
RI.fvrecty = (float)RI.vrect.y; 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 = RI.vrect.x + RI.vrect.width;
RI.vrectright_adj_shift20 = (RI.vrectright<<20) + (1<<19) - 1; RI.vrectright_adj_shift20 = (RI.vrectright<<20) + (1<<19) - 1;
RI.fvrectright = (float)RI.vrectright; RI.fvrectright = (float)RI.vrectright;
RI.fvrectright_adj = (float)RI.vrectright - 0.5; RI.fvrectright_adj = (float)RI.vrectright - 0.5f;
RI.vrectrightedge = (float)RI.vrectright - 0.99; RI.vrectrightedge = (float)RI.vrectright - 0.99f;
RI.vrectbottom = RI.vrect.y + RI.vrect.height; RI.vrectbottom = RI.vrect.y + RI.vrect.height;
RI.fvrectbottom = (float)RI.vrectbottom; 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.x = (int)(RI.vrect.x * r_aliasuvscale);
RI.aliasvrect.y = (int)(RI.vrect.y * 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 // but will definately render in the [range] row and column, so adjust the
// buffer origin to get an exact edge to edge fill // buffer origin to get an exact edge to edge fill
xcenter = ((float)RI.vrect.width * XCENTERING) + xcenter = ((float)RI.vrect.width * XCENTERING) +
RI.vrect.x - 0.5; RI.vrect.x - 0.5f;
aliasxcenter = xcenter * r_aliasuvscale; aliasxcenter = xcenter * r_aliasuvscale;
ycenter = ((float)RI.vrect.height * YCENTERING) + ycenter = ((float)RI.vrect.height * YCENTERING) +
RI.vrect.y - 0.5; RI.vrect.y - 0.5f;
aliasycenter = ycenter * r_aliasuvscale; aliasycenter = ycenter * r_aliasuvscale;
xscale = RI.vrect.width / horizontalFieldOfView; xscale = RI.vrect.width / horizontalFieldOfView;
aliasxscale = xscale * r_aliasuvscale; aliasxscale = xscale * r_aliasuvscale;
xscaleinv = 1.0 / xscale; xscaleinv = 1.0f / xscale;
yscale = xscale; yscale = xscale;
aliasyscale = yscale * r_aliasuvscale; aliasyscale = yscale * r_aliasuvscale;
yscaleinv = 1.0 / yscale; yscaleinv = 1.0f / yscale;
//xscaleshrink = (RI.vrect.width-6)/RI.horizontalFieldOfView; //xscaleshrink = (RI.vrect.width-6)/RI.horizontalFieldOfView;
//yscaleshrink = xscaleshrink; //yscaleshrink = xscaleshrink;
// left side clip // 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[1] = 0;
qfrustum.screenedge[0].normal[2] = 1; qfrustum.screenedge[0].normal[2] = 1;
qfrustum.screenedge[0].type = PLANE_ANYZ; qfrustum.screenedge[0].type = PLANE_ANYZ;
// right side clip // right side clip
qfrustum.screenedge[1].normal[0] = 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[1] = 0;
qfrustum.screenedge[1].normal[2] = 1; qfrustum.screenedge[1].normal[2] = 1;
qfrustum.screenedge[1].type = PLANE_ANYZ; qfrustum.screenedge[1].type = PLANE_ANYZ;
// top side clip // top side clip
qfrustum.screenedge[2].normal[0] = 0; 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].normal[2] = 1;
qfrustum.screenedge[2].type = PLANE_ANYZ; qfrustum.screenedge[2].type = PLANE_ANYZ;
// bottom side clip // bottom side clip
qfrustum.screenedge[3].normal[0] = 0; 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].normal[2] = 1;
qfrustum.screenedge[3].type = PLANE_ANYZ; qfrustum.screenedge[3].type = PLANE_ANYZ;

4
r_polyse.c

@ -369,7 +369,7 @@ void FloorDivMod (float numer, float denom, int *quotient,
int q, r; int q, r;
float x; float x;
if (numer >= 0.0) if (numer >= 0.0f)
{ {
x = floor(numer / denom); 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" , 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]); 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; ystepdenominv = -xstepdenominv;

8
r_rast.c

@ -244,7 +244,7 @@ void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1)
if (transformed[2] < NEAR_CLIP) if (transformed[2] < NEAR_CLIP)
transformed[2] = NEAR_CLIP; transformed[2] = NEAR_CLIP;
lzi0 = 1.0 / transformed[2]; lzi0 = 1.0f / transformed[2];
// FIXME: build x/yscale into transform? // FIXME: build x/yscale into transform?
scale = xscale * lzi0; scale = xscale * lzi0;
@ -273,7 +273,7 @@ void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1)
if (transformed[2] < NEAR_CLIP) if (transformed[2] < NEAR_CLIP)
transformed[2] = NEAR_CLIP; transformed[2] = NEAR_CLIP;
r_lzi1 = 1.0 / transformed[2]; r_lzi1 = 1.0f / transformed[2];
scale = xscale * r_lzi1; scale = xscale * r_lzi1;
r_u1 = (xcenter + scale*transformed[0]); r_u1 = (xcenter + scale*transformed[0]);
@ -736,7 +736,7 @@ void R_RenderFace (msurface_t *fa, int clipflags)
// FIXME: cache this? // FIXME: cache this?
TransformVector (pplane->normal, p_normal); TransformVector (pplane->normal, p_normal);
// FIXME: cache this? // 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_zistepu = p_normal[0] * xscaleinv * distinv;
surface_p->d_zistepv = -p_normal[1] * yscaleinv * 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? // FIXME: cache this?
TransformVector (pplane->normal, p_normal); TransformVector (pplane->normal, p_normal);
// FIXME: cache this? // 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_zistepu = p_normal[0] * xscaleinv * distinv;
surface_p->d_zistepv = -p_normal[1] * yscaleinv * distinv; surface_p->d_zistepv = -p_normal[1] * yscaleinv * distinv;

12
r_scan.c

@ -168,7 +168,7 @@ void Turbulent8 (espan_t *pspan)
r_turb_sstep = 0; // keep compiler happy r_turb_sstep = 0; // keep compiler happy
r_turb_tstep = 0; // ditto r_turb_tstep = 0; // ditto
r_turb_pbase = (unsigned char *)cacheblock; r_turb_pbase = cacheblock;
sdivz16stepu = d_sdivzstepu * 16; sdivz16stepu = d_sdivzstepu * 16;
tdivz16stepu = d_tdivzstepu * 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_sstep = 0; // keep compiler happy
r_turb_tstep = 0; // ditto r_turb_tstep = 0; // ditto
r_turb_pbase = (unsigned char *)cacheblock; r_turb_pbase = cacheblock;
sdivz16stepu = d_sdivzstepu * 16; sdivz16stepu = d_sdivzstepu * 16;
tdivz16stepu = d_tdivzstepu * 16; tdivz16stepu = d_tdivzstepu * 16;
@ -604,7 +604,7 @@ void D_DrawSpans16 (espan_t *pspan)
sstep = 0; // keep compiler happy sstep = 0; // keep compiler happy
tstep = 0; // ditto tstep = 0; // ditto
pbase = (unsigned char *)cacheblock; pbase = cacheblock;
sdivz8stepu = d_sdivzstepu * 8; sdivz8stepu = d_sdivzstepu * 8;
tdivz8stepu = d_tdivzstepu * 8; tdivz8stepu = d_tdivzstepu * 8;
@ -772,7 +772,7 @@ void D_AlphaSpans16 (espan_t *pspan)
sstep = 0; // keep compiler happy sstep = 0; // keep compiler happy
tstep = 0; // ditto tstep = 0; // ditto
pbase = (unsigned char *)cacheblock; pbase = cacheblock;
sdivz8stepu = d_sdivzstepu * 8; sdivz8stepu = d_sdivzstepu * 8;
tdivz8stepu = d_tdivzstepu * 8; tdivz8stepu = d_tdivzstepu * 8;
@ -973,7 +973,7 @@ void D_BlendSpans16 (espan_t *pspan, int alpha)
sstep = 0; // keep compiler happy sstep = 0; // keep compiler happy
tstep = 0; // ditto tstep = 0; // ditto
pbase = (unsigned char *)cacheblock; pbase = cacheblock;
sdivz8stepu = d_sdivzstepu * 8; sdivz8stepu = d_sdivzstepu * 8;
tdivz8stepu = d_tdivzstepu * 8; tdivz8stepu = d_tdivzstepu * 8;
@ -1175,7 +1175,7 @@ void D_AddSpans16 (espan_t *pspan)
sstep = 0; // keep compiler happy sstep = 0; // keep compiler happy
tstep = 0; // ditto tstep = 0; // ditto
pbase = (unsigned char *)cacheblock; pbase = cacheblock;
sdivz8stepu = d_sdivzstepu * 8; sdivz8stepu = d_sdivzstepu * 8;
tdivz8stepu = d_tdivzstepu * 8; tdivz8stepu = d_tdivzstepu * 8;

8
r_studio.c

@ -871,7 +871,7 @@ void R_StudioMergeBones( cl_entity_t *e, model_t *m_pSubModel )
matrix3x4 bonematrix; matrix3x4 bonematrix;
static vec4_t q[MAXSTUDIOBONES]; static vec4_t q[MAXSTUDIOBONES];
static float pos[MAXSTUDIOBONES][3]; static float pos[MAXSTUDIOBONES][3];
double f; float f;
if( e->curstate.sequence >= m_pStudioHeader->numseq ) if( e->curstate.sequence >= m_pStudioHeader->numseq )
e->curstate.sequence = 0; e->curstate.sequence = 0;
@ -924,7 +924,7 @@ StudioSetupBones
*/ */
void R_StudioSetupBones( cl_entity_t *e ) void R_StudioSetupBones( cl_entity_t *e )
{ {
double f; float f;
mstudiobone_t *pbones; mstudiobone_t *pbones;
mstudioseqdesc_t *pseqdesc; mstudioseqdesc_t *pseqdesc;
mstudioanim_t *panim; mstudioanim_t *panim;
@ -3015,7 +3015,7 @@ void R_StudioEstimateGait( entity_state_t *pplayer )
} }
else 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;
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 // adjust the depth range to prevent view model from poking into walls
//pglDepthRange( gldepthmin, gldepthmin + 0.3f * ( gldepthmax - gldepthmin )); //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; RI.currentmodel = RI.currententity->model;
// backface culling for left-handed weapons // backface culling for left-handed weapons

2
r_surf.c

@ -571,7 +571,7 @@ void R_DrawSurface (void)
for (u=0 ; u<r_numhblocks; u++) for (u=0 ; u<r_numhblocks; u++)
{ {
r_lightptr = blocklights + (int)(u/ (worldlux_s+0.5)); r_lightptr = blocklights + (int)(u/ (worldlux_s+0.5f));
prowdestbase = pcolumndest; prowdestbase = pcolumndest;

2
r_trialias.c

@ -221,7 +221,7 @@ void R_AliasProjectAndClipTestFinalVert( finalvert_t *fv )
x = fv->xyz[0]; x = fv->xyz[0];
y = fv->xyz[1]; y = fv->xyz[1];
z = fv->xyz[2]; z = fv->xyz[2];
zi = 1.0 / z; zi = 1.0f / z;
fv->zi = zi * s_ziscale; fv->zi = zi * s_ziscale;

Loading…
Cancel
Save