]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Just in case, make decalsequence always unsigned too.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 2 Mar 2015 21:25:46 +0000 (21:25 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 2 Mar 2015 21:25:46 +0000 (21:25 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12171 d7cf8633-e32d-0410-b094-e92efae38249

cl_particles.c
client.h
gl_rmain.c

index 04ff9fb8f505647535e578960628d1a8b5a5f5bc..7b8ef5bfef405448425fa15953a5f3c03483d09c 100644 (file)
@@ -2566,7 +2566,7 @@ void R_DrawDecals (void)
        float frametime;
        float decalfade;
        float drawdist2;
-       int killsequence = cl.decalsequence - max(0, cl_decals_max.integer);
+       unsigned int killsequence = cl.decalsequence - bound(0, (unsigned int) cl_decals_max.integer, cl.decalsequence);
 
        frametime = bound(0, cl.time - cl.decals_updatetime, 1);
        cl.decals_updatetime = bound(cl.time - 1, cl.decals_updatetime + frametime, cl.time + 1);
@@ -2584,7 +2584,7 @@ void R_DrawDecals (void)
                if (!decal->typeindex)
                        continue;
 
-               if (killsequence - decal->decalsequence > 0)
+               if (killsequence > decal->decalsequence)
                        goto killdecal;
 
                if (cl.time > decal->time2 + cl_decals_time.value)
index e254d81fc183e440d8eddbbecbf37252b6577e57..c074d238ce200e9e3781ddf509fdf1a459c38e8a 100644 (file)
--- a/client.h
+++ b/client.h
@@ -213,7 +213,7 @@ typedef struct tridecal_s
        // for visibility culling
        int                             surfaceindex;
        // old decals are killed to obey cl_decals_max
-       int                             decalsequence;
+       unsigned int    decalsequence;
 }
 tridecal_t;
 
@@ -967,7 +967,7 @@ typedef struct decal_s
        // fields used by rendering:  (44 bytes)
        unsigned short  typeindex;
        unsigned short  texnum;
-       int                             decalsequence;
+       unsigned int    decalsequence;
        vec3_t                  org;
        vec3_t                  normal;
        float                   size;
@@ -1290,7 +1290,7 @@ typedef struct client_state_s
        vec3_t playercrouchmaxs;
 
        // old decals are killed based on this
-       int decalsequence;
+       unsigned int decalsequence;
 
        int max_entities;
        int max_csqcrenderentities;
index 8572190380e502c71ed9f6a81b7d85c07334672f..a9e5bf299a44b72b163e8954d2142e6445ec4fdd 100644 (file)
@@ -11626,7 +11626,7 @@ void R_DecalSystem_Reset(decalsystem_t *decalsystem)
        memset(decalsystem, 0, sizeof(*decalsystem));
 }
 
-static void R_DecalSystem_SpawnTriangle(decalsystem_t *decalsystem, const float *v0, const float *v1, const float *v2, const float *t0, const float *t1, const float *t2, const float *c0, const float *c1, const float *c2, int triangleindex, int surfaceindex, int decalsequence)
+static void R_DecalSystem_SpawnTriangle(decalsystem_t *decalsystem, const float *v0, const float *v1, const float *v2, const float *t0, const float *t1, const float *t2, const float *c0, const float *c1, const float *c2, int triangleindex, int surfaceindex, unsigned int decalsequence)
 {
        tridecal_t *decal;
        tridecal_t *decals;
@@ -11706,7 +11706,7 @@ extern cvar_t cl_decals_bias;
 extern cvar_t cl_decals_models;
 extern cvar_t cl_decals_newsystem_intensitymultiplier;
 // baseparms, parms, temps
-static void R_DecalSystem_SplatTriangle(decalsystem_t *decalsystem, float r, float g, float b, float a, float s1, float t1, float s2, float t2, int decalsequence, qboolean dynamic, float (*planes)[4], matrix4x4_t *projection, int triangleindex, int surfaceindex)
+static void R_DecalSystem_SplatTriangle(decalsystem_t *decalsystem, float r, float g, float b, float a, float s1, float t1, float s2, float t2, unsigned int decalsequence, qboolean dynamic, float (*planes)[4], matrix4x4_t *projection, int triangleindex, int surfaceindex)
 {
        int cornerindex;
        int index;
@@ -11799,7 +11799,7 @@ static void R_DecalSystem_SplatTriangle(decalsystem_t *decalsystem, float r, flo
                for (cornerindex = 0;cornerindex < numpoints-2;cornerindex++)
                        R_DecalSystem_SpawnTriangle(decalsystem, v[0], v[cornerindex+1], v[cornerindex+2], tc[0], tc[cornerindex+1], tc[cornerindex+2], c[0], c[cornerindex+1], c[cornerindex+2], -1, surfaceindex, decalsequence);
 }
-static void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldorigin, const vec3_t worldnormal, float r, float g, float b, float a, float s1, float t1, float s2, float t2, float worldsize, int decalsequence)
+static void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldorigin, const vec3_t worldnormal, float r, float g, float b, float a, float s1, float t1, float s2, float t2, float worldsize, unsigned int decalsequence)
 {
        matrix4x4_t projection;
        decalsystem_t *decalsystem;
@@ -11960,7 +11960,7 @@ static void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldor
 }
 
 // do not call this outside of rendering code - use R_DecalSystem_SplatEntities instead
-static void R_DecalSystem_ApplySplatEntities(const vec3_t worldorigin, const vec3_t worldnormal, float r, float g, float b, float a, float s1, float t1, float s2, float t2, float worldsize, int decalsequence)
+static void R_DecalSystem_ApplySplatEntities(const vec3_t worldorigin, const vec3_t worldnormal, float r, float g, float b, float a, float s1, float t1, float s2, float t2, float worldsize, unsigned int decalsequence)
 {
        int renderentityindex;
        float worldmins[3];
@@ -11996,7 +11996,7 @@ typedef struct r_decalsystem_splatqueue_s
        float color[4];
        float tcrange[4];
        float worldsize;
-       int decalsequence;
+       unsigned int decalsequence;
 }
 r_decalsystem_splatqueue_t;
 
@@ -12035,7 +12035,7 @@ static void R_DrawModelDecals_FadeEntity(entity_render_t *ent)
        int i;
        decalsystem_t *decalsystem = &ent->decalsystem;
        int numdecals;
-       int killsequence;
+       unsigned int killsequence;
        tridecal_t *decal;
        float frametime;
        float lifetime;
@@ -12052,7 +12052,7 @@ static void R_DrawModelDecals_FadeEntity(entity_render_t *ent)
                return;
        }
 
-       killsequence = cl.decalsequence - max(1, cl_decals_max.integer);
+       killsequence = cl.decalsequence - bound(1, (unsigned int) cl_decals_max.integer, cl.decalsequence);
        lifetime = cl_decals_time.value + cl_decals_fadetime.value;
 
        if (decalsystem->lastupdatetime)
@@ -12067,7 +12067,7 @@ static void R_DrawModelDecals_FadeEntity(entity_render_t *ent)
                if (decal->color4f[0][3])
                {
                        decal->lived += frametime;
-                       if (killsequence - decal->decalsequence > 0 || decal->lived >= lifetime)
+                       if (killsequence > decal->decalsequence || decal->lived >= lifetime)
                        {
                                memset(decal, 0, sizeof(*decal));
                                if (decalsystem->freedecal > i)