diff --git a/ref/gl/gl_alias.c b/ref/gl/gl_alias.c index 550d5a64..c763c8f7 100644 --- a/ref/gl/gl_alias.c +++ b/ref/gl/gl_alias.c @@ -1332,7 +1332,7 @@ static void R_AliasSetupTimings( void ) if( RI.drawWorld ) { // synchronize with server time - g_alias.time = gpGlobals->time; + g_alias.time = gp_cl->time; } else { diff --git a/ref/gl/gl_beams.c b/ref/gl/gl_beams.c index 1a78d3fa..1ec35e24 100644 --- a/ref/gl/gl_beams.c +++ b/ref/gl/gl_beams.c @@ -608,7 +608,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; @@ -655,7 +655,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; @@ -688,7 +688,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 { @@ -916,7 +916,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 @@ -949,7 +949,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; } @@ -1007,7 +1007,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; } @@ -1055,7 +1055,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; @@ -1160,8 +1160,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; @@ -1291,7 +1291,7 @@ void 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 ); diff --git a/ref/gl/gl_rlight.c b/ref/gl/gl_rlight.c index 745f249f..b994d762 100644 --- a/ref/gl/gl_rlight.c +++ b/ref/gl/gl_rlight.c @@ -36,7 +36,7 @@ void 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; @@ -160,7 +160,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 )) diff --git a/ref/gl/gl_rmain.c b/ref/gl/gl_rmain.c index 9adb068b..995bd3e6 100644 --- a/ref/gl/gl_rmain.c +++ b/ref/gl/gl_rmain.c @@ -339,8 +339,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.97f + sin( gpGlobals->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f); - RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03f - sin( gpGlobals->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f); + RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97f + sin( gp_cl->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f); + RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03f - sin( gp_cl->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f); } // build the transformation matrix for the given view angles @@ -954,7 +954,7 @@ void 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 @@ -1181,16 +1181,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( )) @@ -1229,27 +1229,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; diff --git a/ref/gl/gl_rpart.c b/ref/gl/gl_rpart.c index 88bfdd0d..c2c71845 100644 --- a/ref/gl/gl_rpart.c +++ b/ref/gl/gl_rpart.c @@ -87,7 +87,7 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float 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; @@ -194,7 +194,7 @@ void 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 ); @@ -259,7 +259,7 @@ void 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 ) diff --git a/ref/gl/gl_rsurf.c b/ref/gl/gl_rsurf.c index 92a23e96..de2de7d9 100644 --- a/ref/gl/gl_rsurf.c +++ b/ref/gl/gl_rsurf.c @@ -408,7 +408,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; } @@ -500,7 +500,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; @@ -828,8 +828,8 @@ void DrawGLPoly( glpoly_t *p, float xScale, float yScale ) flAngle = ( flConveyorSpeed >= 0 ) ? 180 : 0; SinCos( flAngle * ( M_PI_F / 180.0f ), &sy, &cy ); - sOffset = gpGlobals->time * cy * flRate; - tOffset = gpGlobals->time * sy * flRate; + sOffset = gp_cl->time * cy * flRate; + tOffset = gp_cl->time * sy * flRate; // make sure that we are positive if( sOffset < 0.0f ) sOffset += 1.0f + -(int)sOffset; @@ -1601,7 +1601,7 @@ void R_DrawBrushModel( cl_entity_t *e ) { l = gEngfuncs.GetDynamicLight( k ); - if( l->die < gpGlobals->time || !l->radius ) + if( l->die < gp_cl->time || !l->radius ) continue; VectorCopy( l->origin, oldorigin ); // save lightorigin diff --git a/ref/gl/gl_sprite.c b/ref/gl/gl_sprite.c index 6703a781..60083078 100644 --- a/ref/gl/gl_sprite.c +++ b/ref/gl/gl_sprite.c @@ -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, // 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, { // 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, 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, // 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; } } diff --git a/ref/gl/gl_studio.c b/ref/gl/gl_studio.c index 6e09674e..66b3f88a 100644 --- a/ref/gl/gl_studio.c +++ b/ref/gl/gl_studio.c @@ -174,8 +174,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 { @@ -424,8 +424,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; } /* @@ -2756,7 +2756,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; diff --git a/ref/gl/gl_warp.c b/ref/gl/gl_warp.c index 7ba1afd7..62517cf1 100644 --- a/ref/gl/gl_warp.c +++ b/ref/gl/gl_warp.c @@ -526,7 +526,7 @@ static void R_CloudTexCoord( vec3_t v, float speed, float *s, float *t ) float length, speedscale; vec3_t dir; - speedscale = gpGlobals->time * speed; + speedscale = gp_cl->time * speed; speedscale -= (int)speedscale & ~127; VectorSubtract( v, RI.vieworg, dir ); @@ -813,8 +813,8 @@ void EmitWaterPolys( msurface_t *warp, qboolean reverse ) { if( waveHeight ) { - nv = r_turbsin[(int)(gpGlobals->time * 160.0f + v[1] + v[0]) & 255] + 8.0f; - nv = (r_turbsin[(int)(v[0] * 5.0f + gpGlobals->time * 171.0f - v[1]) & 255] + 8.0f ) * 0.8f + nv; + nv = r_turbsin[(int)(gp_cl->time * 160.0f + v[1] + v[0]) & 255] + 8.0f; + nv = (r_turbsin[(int)(v[0] * 5.0f + gp_cl->time * 171.0f - v[1]) & 255] + 8.0f ) * 0.8f + nv; nv = nv * waveHeight + v[2]; } else nv = v[2]; @@ -824,8 +824,8 @@ void EmitWaterPolys( msurface_t *warp, qboolean reverse ) if( !r_ripple.value ) { - s = os + r_turbsin[(int)((ot * 0.125f + gpGlobals->time) * TURBSCALE) & 255]; - t = ot + r_turbsin[(int)((os * 0.125f + gpGlobals->time) * TURBSCALE) & 255]; + s = os + r_turbsin[(int)((ot * 0.125f + gp_cl->time) * TURBSCALE) & 255]; + t = ot + r_turbsin[(int)((os * 0.125f + gp_cl->time) * TURBSCALE) & 255]; } else { @@ -865,7 +865,7 @@ void R_ResetRipples( void ) { g_ripple.curbuf = g_ripple.buf[0]; g_ripple.oldbuf = g_ripple.buf[1]; - g_ripple.time = g_ripple.oldtime = gpGlobals->time - 0.1; + g_ripple.time = g_ripple.oldtime = gp_cl->time - 0.1; memset( g_ripple.buf, 0, sizeof( g_ripple.buf )); } @@ -936,14 +936,14 @@ static int MostSignificantBit( unsigned int v ) void R_AnimateRipples( void ) { - double frametime = gpGlobals->time - g_ripple.time; + double frametime = gp_cl->time - g_ripple.time; g_ripple.update = r_ripple.value && frametime >= r_ripple_updatetime.value; if( !g_ripple.update ) return; - g_ripple.time = gpGlobals->time; + g_ripple.time = gp_cl->time; R_SwapBufs();