]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix handling of .alpha, .renderamt, .scale, and .glow_color defaulting when 0 (it...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 22 Aug 2003 23:44:31 +0000 (23:44 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 22 Aug 2003 23:44:31 +0000 (23:44 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3402 d7cf8633-e32d-0410-b094-e92efae38249

sv_main.c

index 8c17d6f0596e923861ac9ceda0bb83f2d96687df..cc999fe10caec30f86f8059b6b672cbf51cf5e8f 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -712,6 +712,7 @@ static entity_state_t *sendentitiesindex[MAX_EDICTS];
 void SV_PrepareEntitiesForSending(void)
 {
        int e, i;
+       float f;
        edict_t *ent;
        entity_state_t cs;
        // send all entities that touch the pvs
@@ -749,25 +750,33 @@ void SV_PrepareEntitiesForSending(void)
                if (i >= 1 && i < MAX_MODELS && *PR_GetString(ent->v->model))
                        cs.modelindex = i;
 
-
                cs.alpha = 255;
-               i = (int)(GETEDICTFIELDVALUE(ent, eval_alpha)->_float * 255.0f);
-               if (i)
+               f = (GETEDICTFIELDVALUE(ent, eval_alpha)->_float * 255.0f);
+               if (f)
+               {
+                       i = (int)f;
                        cs.alpha = (qbyte)bound(0, i, 255);
+               }
                // halflife
-               i = (int)(GETEDICTFIELDVALUE(ent, eval_renderamt)->_float);
-               if (i)
+               f = (GETEDICTFIELDVALUE(ent, eval_renderamt)->_float);
+               if (f)
+               {
+                       i = (int)f;
                        cs.alpha = (qbyte)bound(0, i, 255);
+               }
 
                cs.scale = 16;
-               i = (int)(GETEDICTFIELDVALUE(ent, eval_scale)->_float * 16.0f);
-               if (i)
+               f = (GETEDICTFIELDVALUE(ent, eval_scale)->_float * 16.0f);
+               if (f)
+               {
+                       i = (int)f;
                        cs.scale = (qbyte)bound(0, i, 255);
+               }
 
                cs.glowcolor = 254;
-               i = (int)(GETEDICTFIELDVALUE(ent, eval_glow_color)->_float);
-               if (i)
-                       cs.glowcolor = i;
+               f = (GETEDICTFIELDVALUE(ent, eval_glow_color)->_float);
+               if (f)
+                       cs.glowcolor = (int)f;
 
                if (GETEDICTFIELDVALUE(ent, eval_fullbright)->_float)
                        cs.effects |= EF_FULLBRIGHT;