From 3b1c5c054d7759ccbd964fefd18d217a7293ccb3 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 22 Aug 2003 23:44:31 +0000 Subject: [PATCH] fix handling of .alpha, .renderamt, .scale, and .glow_color defaulting when 0 (it has to compare the float value, not the byte version of it) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3402 d7cf8633-e32d-0410-b094-e92efae38249 --- sv_main.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/sv_main.c b/sv_main.c index 8c17d6f0..cc999fe1 100644 --- 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; -- 2.39.2