]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixed problems with cl.time stepping backwards causing a black fade-in and other...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 18 Jan 2007 10:39:02 +0000 (10:39 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 18 Jan 2007 10:39:02 +0000 (10:39 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6698 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c
cl_particles.c
view.c

index 01a98318bf7c90eddfccf69d222013fe409539c4..0bfb154571c6fbce4d64ae06d598cad931cf8ca2 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -658,7 +658,7 @@ void CL_DecayLights(void)
        dlight_t *dl;
        float time, f;
 
-       time = cl.time - cl.oldtime;
+       time = bound(0, cl.time - cl.oldtime, 0.1);
        oldmax = cl.num_dlights;
        cl.num_dlights = 0;
        for (i = 0, dl = cl.dlights;i < oldmax;i++, dl++)
@@ -1050,9 +1050,9 @@ void CL_UpdateNetworkEntity(entity_t *e)
                                dlightcolor[2] += 1.50f;
                        }
                        if (e->render.effects & EF_FLAME)
-                               CL_ParticleEffect(EFFECT_EF_FLAME, cl.time - cl.oldtime, origin, origin, vec3_origin, vec3_origin, NULL, 0);
+                               CL_ParticleEffect(EFFECT_EF_FLAME, bound(0, cl.time - cl.oldtime, 0.1), origin, origin, vec3_origin, vec3_origin, NULL, 0);
                        if (e->render.effects & EF_STARDUST)
-                               CL_ParticleEffect(EFFECT_EF_STARDUST, cl.time - cl.oldtime, origin, origin, vec3_origin, vec3_origin, NULL, 0);
+                               CL_ParticleEffect(EFFECT_EF_STARDUST, bound(0, cl.time - cl.oldtime, 0.1), origin, origin, vec3_origin, vec3_origin, NULL, 0);
                        if (e->render.effects & (EF_FLAG1QW | EF_FLAG2QW))
                        {
                                // these are only set on player entities
@@ -1067,7 +1067,7 @@ void CL_UpdateNetworkEntity(entity_t *e)
                        tempmatrix = e->render.matrix;
                        Matrix4x4_SetOrigin(&tempmatrix, trace.endpos[0], trace.endpos[1], trace.endpos[2]);
                        CL_AllocDlight(NULL, &tempmatrix, 100, e->persistent.muzzleflash, e->persistent.muzzleflash, e->persistent.muzzleflash, 0, 0, 0, -1, true, 0, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
-                       e->persistent.muzzleflash -= (cl.time - cl.oldtime) * 10;
+                       e->persistent.muzzleflash -= bound(0, cl.time - cl.oldtime, 0.1) * 10;
                }
                // LordHavoc: if the model has no flags, don't check each
                if (e->render.model && e->render.model->flags && (!e->state_current.tagentity && !(e->render.flags & RENDER_VIEWMODEL)))
index cf1e27189e60a67634c667c0bfcd823cf94ffd8c..4da00b2ffa5149ca4b80bfe30a6114b9351e7eb6 100644 (file)
@@ -1421,7 +1421,7 @@ void CL_MoveParticles (void)
                return;
        }
 
-       frametime = cl.time - cl.oldtime;
+       frametime = bound(0, cl.time - cl.oldtime, 0.1);
        gravity = frametime * sv_gravity.value;
        dvel = 1+4*frametime;
        decalfade = frametime * 255 / cl_decals_fadetime.value;
diff --git a/view.c b/view.c
index 9506c9483bb51c58afaacaaf1b93e67eb791330f..4d0de9c8a770c55b9d158b0d5185075a96eca868 100644 (file)
--- a/view.c
+++ b/view.c
@@ -322,17 +322,17 @@ CL_StairSmoothing
 void CL_StairSmoothing (void)
 {
        if (v_dmg_time > 0)
-               v_dmg_time -= (cl.time - cl.oldtime);
+               v_dmg_time -= bound(0, cl.time - cl.oldtime, 0.1);
 
        // stair smoothing
        if (cl.onground && cl.stairoffset < 0)
        {
-               cl.stairoffset += (cl.time - cl.oldtime) * cl_stairsmoothspeed.value;
+               cl.stairoffset += bound(0, cl.time - cl.oldtime, 0.1) * cl_stairsmoothspeed.value;
                cl.stairoffset = bound(-16, cl.stairoffset, 0);
        }
        else if (cl.onground && cl.stairoffset > 0)
        {
-               cl.stairoffset -= (cl.time - cl.oldtime) * cl_stairsmoothspeed.value;
+               cl.stairoffset -= bound(0, cl.time - cl.oldtime, 0.1) * cl_stairsmoothspeed.value;
                cl.stairoffset = bound(0, cl.stairoffset, 16);
        }
        else
@@ -538,6 +538,9 @@ void V_CalcRefdef (void)
 
 void V_FadeViewFlashs(void)
 {
+       // don't flash if time steps backwards
+       if (cl.time <= cl.oldtime)
+               return;
        // drop the damage value
        cl.cshifts[CSHIFT_DAMAGE].percent -= (cl.time - cl.oldtime)*150;
        if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)