Browse Source

ref: soft: convert to usage of ref_client_t to get client time

pull/2/head
Alibek Omarov 11 months ago
parent
commit
64f3884f23
  1. 20
      ref/soft/r_beams.c
  2. 2
      ref/soft/r_bsp.c
  3. 4
      ref/soft/r_edge.c
  4. 4
      ref/soft/r_light.c
  5. 28
      ref/soft/r_main.c
  6. 6
      ref/soft/r_part.c
  7. 4
      ref/soft/r_scan.c
  8. 26
      ref/soft/r_sprite.c
  9. 10
      ref/soft/r_studio.c
  10. 4
      ref/soft/r_surf.c

20
ref/soft/r_beams.c

@ -611,7 +611,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime ) @@ -611,7 +611,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
if( pnew )
{
VectorCopy( pbeam->source, pnew->org );
pnew->die = gpGlobals->time + pbeam->amplitude;
pnew->die = gp_cl->time + pbeam->amplitude;
VectorClear( pnew->vel );
pnew->next = particles;
@ -658,7 +658,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime ) @@ -658,7 +658,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
VectorMA( delta, -pbeam->width, normal, last2 );
div = 1.0f / pbeam->amplitude;
fraction = ( pbeam->die - gpGlobals->time ) * div;
fraction = ( pbeam->die - gp_cl->time ) * div;
vLast = 0.0f;
vStep = 1.0f;
@ -694,7 +694,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime ) @@ -694,7 +694,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
if( particles->next != NULL )
{
fraction = (particles->die - gpGlobals->time) * div;
fraction = (particles->die - gp_cl->time) * div;
}
else
{
@ -929,7 +929,7 @@ qboolean R_BeamRecomputeEndpoints( BEAM *pbeam ) @@ -929,7 +929,7 @@ qboolean R_BeamRecomputeEndpoints( BEAM *pbeam )
else if( !FBitSet( pbeam->flags, FBEAM_FOREVER ))
{
ClearBits( pbeam->flags, FBEAM_ENDENTITY );
pbeam->die = gpGlobals->time;
pbeam->die = gp_cl->time;
return false;
}
else
@ -962,7 +962,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime ) @@ -962,7 +962,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
if( !model || model->type != mod_sprite )
{
pbeam->flags &= ~FBEAM_ISACTIVE; // force to ignore
pbeam->die = gpGlobals->time;
pbeam->die = gp_cl->time;
return;
}
@ -1020,7 +1020,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime ) @@ -1020,7 +1020,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
if( pbeam->flags & ( FBEAM_FADEIN|FBEAM_FADEOUT ))
{
// update life cycle
pbeam->t = pbeam->freq + ( pbeam->die - gpGlobals->time );
pbeam->t = pbeam->freq + ( pbeam->die - gp_cl->time );
if( pbeam->t != 0.0f ) pbeam->t = 1.0f - pbeam->freq / pbeam->t;
}
@ -1068,7 +1068,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime ) @@ -1068,7 +1068,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
TriRenderMode( FBitSet( pbeam->flags, FBEAM_SOLID ) ? kRenderNormal : kRenderTransAdd );
if( !TriSpriteTexture( model, (int)(pbeam->frame + pbeam->frameRate * gpGlobals->time) % pbeam->frameCount ))
if( !TriSpriteTexture( model, (int)(pbeam->frame + pbeam->frameRate * gp_cl->time) % pbeam->frameCount ))
{
ClearBits( pbeam->flags, FBEAM_ISACTIVE );
return;
@ -1173,8 +1173,8 @@ static void R_BeamSetup( BEAM *pbeam, vec3_t start, vec3_t end, int modelIndex, @@ -1173,8 +1173,8 @@ static void R_BeamSetup( BEAM *pbeam, vec3_t start, vec3_t end, int modelIndex,
VectorCopy( end, pbeam->target );
VectorSubtract( end, start, pbeam->delta );
pbeam->freq = speed * gpGlobals->time;
pbeam->die = life + gpGlobals->time;
pbeam->freq = speed * gp_cl->time;
pbeam->die = life + gp_cl->time;
pbeam->amplitude = amplitude;
pbeam->brightness = brightness;
pbeam->width = width;
@ -1304,7 +1304,7 @@ void GAME_EXPORT CL_DrawBeams( int fTrans, BEAM *active_beams ) @@ -1304,7 +1304,7 @@ void GAME_EXPORT CL_DrawBeams( int fTrans, BEAM *active_beams )
if( !fTrans && !FBitSet( pBeam->flags, FBEAM_SOLID ))
continue;
R_BeamDraw( pBeam, gpGlobals->time - gpGlobals->oldtime );
R_BeamDraw( pBeam, gp_cl->time - gp_cl->oldtime );
}
//pglShadeModel( GL_FLAT );

2
ref/soft/r_bsp.c

@ -950,7 +950,7 @@ void R_RenderWorld (void) @@ -950,7 +950,7 @@ void R_RenderWorld (void)
// auto cycle the world frame for texture animation
RI.currententity = CL_GetEntityByIndex(0);
//RI.currententity->frame = (int)(gpGlobals->time*2);
//RI.currententity->frame = (int)(gp_cl->time*2);
VectorCopy (RI.vieworg, tr.modelorg);
RI.currentmodel = WORLDMODEL;

4
ref/soft/r_edge.c

@ -864,9 +864,9 @@ void D_CalcGradients (msurface_t *pface) @@ -864,9 +864,9 @@ void D_CalcGradients (msurface_t *pface)
{
if(pface->flags & SURF_DRAWTURB)
sadjust += 0x10000 * (-128 * ( (gpGlobals->time * 0.25f) - (int)(gpGlobals->time * 0.25f) ));
sadjust += 0x10000 * (-128 * ( (gp_cl->time * 0.25f) - (int)(gp_cl->time * 0.25f) ));
else
sadjust += 0x10000 * (-128 * ( (gpGlobals->time * 0.77f) - (int)(gpGlobals->time * 0.77f) ));
sadjust += 0x10000 * (-128 * ( (gp_cl->time * 0.77f) - (int)(gp_cl->time * 0.77f) ));
bbextents = ((pface->extents[0] << 16) >> miplevel) - 1;
}
else

4
ref/soft/r_light.c

@ -39,7 +39,7 @@ void GAME_EXPORT CL_RunLightStyles( void ) @@ -39,7 +39,7 @@ void GAME_EXPORT CL_RunLightStyles( void )
{
int i, k, flight, clight;
float l, lerpfrac, backlerp;
float frametime = (gpGlobals->time - gpGlobals->oldtime);
float frametime = (gp_cl->time - gp_cl->oldtime);
float scale;
lightstyle_t *ls;
@ -163,7 +163,7 @@ void R_PushDlights( void ) @@ -163,7 +163,7 @@ void R_PushDlights( void )
{
l = gEngfuncs.GetDynamicLight( i );
if( l->die < gpGlobals->time || !l->radius )
if( l->die < gp_cl->time || !l->radius )
continue;
//if( GL_FrustumCullSphere( &RI.frustum, l->origin, l->radius, 15 ))

28
ref/soft/r_main.c

@ -441,8 +441,8 @@ void R_SetupFrustum( void ) @@ -441,8 +441,8 @@ void R_SetupFrustum( void )
/*if( RP_NORMALPASS() && ( ENGINE_GET_PARM( PARM_WATER_LEVEL ) >= 3 ) && ENGINE_GET_PARM( PARM_QUAKE_COMPATIBLE ))
{
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97 + sin( gpGlobals->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03 - sin( gpGlobals->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97 + sin( gp_cl->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03 - sin( gp_cl->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
}*/
// build the transformation matrix for the given view angles
@ -1171,7 +1171,7 @@ void R_DrawBEntitiesOnList (void) @@ -1171,7 +1171,7 @@ void R_DrawBEntitiesOnList (void)
dlight_t *l = gEngfuncs.GetDynamicLight( k );
vec3_t origin_l, oldorigin;
if( l->die < gpGlobals->time || !l->radius )
if( l->die < gp_cl->time || !l->radius )
continue;
VectorCopy( l->origin, oldorigin ); // save lightorigin
@ -1326,7 +1326,7 @@ void R_DrawBrushModel(cl_entity_t *pent) @@ -1326,7 +1326,7 @@ void R_DrawBrushModel(cl_entity_t *pent)
dlight_t *l = gEngfuncs.GetDynamicLight( k );
vec3_t origin_l, oldorigin;
if( l->die < gpGlobals->time || !l->radius )
if( l->die < gp_cl->time || !l->radius )
continue;
VectorCopy( l->origin, oldorigin ); // save lightorigin
@ -1561,7 +1561,7 @@ void GAME_EXPORT R_RenderScene( void ) @@ -1561,7 +1561,7 @@ void GAME_EXPORT R_RenderScene( void )
// frametime is valid only for normal pass
if( RP_NORMALPASS( ))
tr.frametime = gpGlobals->time - gpGlobals->oldtime;
tr.frametime = gp_cl->time - gp_cl->oldtime;
else tr.frametime = 0.0;
// begin a new frame
@ -1984,16 +1984,16 @@ int CL_FxBlend( cl_entity_t *e ) @@ -1984,16 +1984,16 @@ int CL_FxBlend( cl_entity_t *e )
switch( e->curstate.renderfx )
{
case kRenderFxPulseSlowWide:
blend = e->curstate.renderamt + 0x40 * sin( gpGlobals->time * 2 + offset );
blend = e->curstate.renderamt + 0x40 * sin( gp_cl->time * 2 + offset );
break;
case kRenderFxPulseFastWide:
blend = e->curstate.renderamt + 0x40 * sin( gpGlobals->time * 8 + offset );
blend = e->curstate.renderamt + 0x40 * sin( gp_cl->time * 8 + offset );
break;
case kRenderFxPulseSlow:
blend = e->curstate.renderamt + 0x10 * sin( gpGlobals->time * 2 + offset );
blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 2 + offset );
break;
case kRenderFxPulseFast:
blend = e->curstate.renderamt + 0x10 * sin( gpGlobals->time * 8 + offset );
blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 8 + offset );
break;
case kRenderFxFadeSlow:
if( RP_NORMALPASS( ))
@ -2032,27 +2032,27 @@ int CL_FxBlend( cl_entity_t *e ) @@ -2032,27 +2032,27 @@ int CL_FxBlend( cl_entity_t *e )
blend = e->curstate.renderamt;
break;
case kRenderFxStrobeSlow:
blend = 20 * sin( gpGlobals->time * 4 + offset );
blend = 20 * sin( gp_cl->time * 4 + offset );
if( blend < 0 ) blend = 0;
else blend = e->curstate.renderamt;
break;
case kRenderFxStrobeFast:
blend = 20 * sin( gpGlobals->time * 16 + offset );
blend = 20 * sin( gp_cl->time * 16 + offset );
if( blend < 0 ) blend = 0;
else blend = e->curstate.renderamt;
break;
case kRenderFxStrobeFaster:
blend = 20 * sin( gpGlobals->time * 36 + offset );
blend = 20 * sin( gp_cl->time * 36 + offset );
if( blend < 0 ) blend = 0;
else blend = e->curstate.renderamt;
break;
case kRenderFxFlickerSlow:
blend = 20 * (sin( gpGlobals->time * 2 ) + sin( gpGlobals->time * 17 + offset ));
blend = 20 * (sin( gp_cl->time * 2 ) + sin( gp_cl->time * 17 + offset ));
if( blend < 0 ) blend = 0;
else blend = e->curstate.renderamt;
break;
case kRenderFxFlickerFast:
blend = 20 * (sin( gpGlobals->time * 16 ) + sin( gpGlobals->time * 23 + offset ));
blend = 20 * (sin( gp_cl->time * 16 ) + sin( gp_cl->time * 23 + offset ));
if( blend < 0 ) blend = 0;
else blend = e->curstate.renderamt;
break;

6
ref/soft/r_part.c

@ -86,7 +86,7 @@ void GAME_EXPORT CL_DrawParticles( double frametime, particle_t *cl_active_parti @@ -86,7 +86,7 @@ void GAME_EXPORT CL_DrawParticles( double frametime, particle_t *cl_active_parti
p->color = bound( 0, p->color, 255 );
color = tr.palette[p->color];
alpha = 255 * (p->die - gpGlobals->time) * 16.0f;
alpha = 255 * (p->die - gp_cl->time) * 16.0f;
if( alpha > 255 || p->type == pt_static )
alpha = 255;
@ -200,7 +200,7 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers @@ -200,7 +200,7 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers
for( p = cl_active_tracers; p; p = p->next )
{
atten = (p->die - gpGlobals->time);
atten = (p->die - gp_cl->time);
if( atten > 0.1f ) atten = 0.1f;
VectorScale( p->vel, ( p->ramp * atten ), delta );
@ -268,7 +268,7 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers @@ -268,7 +268,7 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers
p->vel[1] *= scale;
p->vel[2] -= gravity;
p->packedColor = 255 * (p->die - gpGlobals->time) * 2;
p->packedColor = 255 * (p->die - gp_cl->time) * 2;
if( p->packedColor > 255 ) p->packedColor = 255;
}
else if( p->type == pt_slowgrav )

4
ref/soft/r_scan.c

@ -100,7 +100,7 @@ void Turbulent8 (espan_t *pspan) @@ -100,7 +100,7 @@ void Turbulent8 (espan_t *pspan)
float sdivz, tdivz, zi, z, du, dv, spancountminus1;
float sdivz16stepu, tdivz16stepu, zi16stepu;
r_turb_turb = sintable + ((int)(gpGlobals->time*SPEED)&(CYCLE-1));
r_turb_turb = sintable + ((int)(gp_cl->time*SPEED)&(CYCLE-1));
r_turb_sstep = 0; // keep compiler happy
r_turb_tstep = 0; // ditto
@ -239,7 +239,7 @@ void TurbulentZ8 (espan_t *pspan, int alpha1) @@ -239,7 +239,7 @@ void TurbulentZ8 (espan_t *pspan, int alpha1)
if( alpha == 0 )
return;
r_turb_turb = sintable + ((int)(gpGlobals->time*SPEED)&(CYCLE-1));
r_turb_turb = sintable + ((int)(gp_cl->time*SPEED)&(CYCLE-1));
r_turb_sstep = 0; // keep compiler happy
r_turb_tstep = 0; // ditto

26
ref/soft/r_sprite.c

@ -430,7 +430,7 @@ mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw ) @@ -430,7 +430,7 @@ mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw )
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
// are positive, so we don't have to worry about division by zero
targettime = gpGlobals->time - ((int)( gpGlobals->time / fullinterval )) * fullinterval;
targettime = gp_cl->time - ((int)( gp_cl->time / fullinterval )) * fullinterval;
for( i = 0; i < (numframes - 1); i++ )
{
@ -494,25 +494,25 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe, @@ -494,25 +494,25 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
// this can be happens when rendering switched between single and angled frames
// or change model on replace delta-entity
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gpGlobals->time;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 1.0f;
}
if( ent->latched.sequencetime < gpGlobals->time )
if( ent->latched.sequencetime < gp_cl->time )
{
if( frame != ent->latched.prevblending[1] )
{
ent->latched.prevblending[0] = ent->latched.prevblending[1];
ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gpGlobals->time;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 0.0f;
}
else lerpFrac = (gpGlobals->time - ent->latched.sequencetime) * 11.0f;
else lerpFrac = (gp_cl->time - ent->latched.sequencetime) * 11.0f;
}
else
{
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gpGlobals->time;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 0.0f;
}
}
@ -526,7 +526,7 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe, @@ -526,7 +526,7 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
{
// reset interpolation on change model
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gpGlobals->time;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 0.0f;
}
@ -541,7 +541,7 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe, @@ -541,7 +541,7 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
numframes = pspritegroup->numframes;
fullinterval = pintervals[numframes-1];
jinterval = pintervals[1] - pintervals[0];
time = gpGlobals->time;
time = gp_cl->time;
jtime = 0.0f;
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
@ -580,25 +580,25 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe, @@ -580,25 +580,25 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
// this can be happens when rendering switched between single and angled frames
// or change model on replace delta-entity
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gpGlobals->time;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 1.0f;
}
if( ent->latched.sequencetime < gpGlobals->time )
if( ent->latched.sequencetime < gp_cl->time )
{
if( frame != ent->latched.prevblending[1] )
{
ent->latched.prevblending[0] = ent->latched.prevblending[1];
ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gpGlobals->time;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 0.0f;
}
else lerpFrac = (gpGlobals->time - ent->latched.sequencetime) * ent->curstate.framerate;
else lerpFrac = (gp_cl->time - ent->latched.sequencetime) * ent->curstate.framerate;
}
else
{
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gpGlobals->time;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 0.0f;
}
}

10
ref/soft/r_studio.c

@ -163,8 +163,8 @@ static void R_StudioSetupTimings( void ) @@ -163,8 +163,8 @@ static void R_StudioSetupTimings( void )
if( RI.drawWorld )
{
// synchronize with server time
g_studio.time = gpGlobals->time;
g_studio.frametime = gpGlobals->time - gpGlobals->oldtime;
g_studio.time = gp_cl->time;
g_studio.frametime = gp_cl->time - gp_cl->oldtime;
}
else
{
@ -413,8 +413,8 @@ pfnGetEngineTimes @@ -413,8 +413,8 @@ pfnGetEngineTimes
static void pfnGetEngineTimes( int *framecount, double *current, double *old )
{
if( framecount ) *framecount = tr.realframecount;
if( current ) *current = gpGlobals->time;
if( old ) *old = gpGlobals->oldtime;
if( current ) *current = gp_cl->time;
if( old ) *old = gp_cl->oldtime;
}
/*
@ -2516,7 +2516,7 @@ static void R_StudioClientEvents( void ) @@ -2516,7 +2516,7 @@ static void R_StudioClientEvents( void )
ClearBits( e->curstate.effects, EF_MUZZLEFLASH );
VectorCopy( e->attachment[0], el->origin );
el->die = gpGlobals->time + 0.05f;
el->die = gp_cl->time + 0.05f;
el->color.r = 255;
el->color.g = 192;
el->color.b = 64;

4
ref/soft/r_surf.c

@ -401,7 +401,7 @@ texture_t *R_TextureAnim( texture_t *b ) @@ -401,7 +401,7 @@ texture_t *R_TextureAnim( texture_t *b )
speed = 10;
else speed = 20;
reletive = (int)(gpGlobals->time * speed) % base->anim_total;
reletive = (int)(gp_cl->time * speed) % base->anim_total;
}
@ -455,7 +455,7 @@ texture_t *R_TextureAnimation( msurface_t *s ) @@ -455,7 +455,7 @@ texture_t *R_TextureAnimation( msurface_t *s )
speed = 10;
else speed = 20;
reletive = (int)(gpGlobals->time * speed) % base->anim_total;
reletive = (int)(gp_cl->time * speed) % base->anim_total;
}
count = 0;

Loading…
Cancel
Save