From 95f5d6eff65081bdb7d9bc8a96036128a19c3596 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 2 Mar 2015 21:25:46 +0000 Subject: [PATCH] Just in case, make decalsequence always unsigned too. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12171 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_particles.c | 4 ++-- client.h | 6 +++--- gl_rmain.c | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cl_particles.c b/cl_particles.c index 04ff9fb8..7b8ef5bf 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -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) diff --git a/client.h b/client.h index e254d81f..c074d238 100644 --- 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; diff --git a/gl_rmain.c b/gl_rmain.c index 85721903..a9e5bf29 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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) -- 2.39.2