From adc143e0500e347b8d3e4b610c2d3e6cace6f538 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Sat, 18 Jun 2011 14:52:16 +0000 Subject: [PATCH] Bug 5048 - Entity constant light does not work correctly, bug found by Eraesr (Eraser?) --- code/cgame/cg_ents.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/code/cgame/cg_ents.c b/code/cgame/cg_ents.c index a6a5c2a5..58ec0f46 100644 --- a/code/cgame/cg_ents.c +++ b/code/cgame/cg_ents.c @@ -139,16 +139,17 @@ static void CG_EntityEffects( centity_t *cent ) { // constant light glow - if ( cent->currentState.constantLight ) { + if(cent->currentState.constantLight) + { int cl; - int i, r, g, b; + float i, r, g, b; cl = cent->currentState.constantLight; - r = cl & 255; - g = ( cl >> 8 ) & 255; - b = ( cl >> 16 ) & 255; - i = ( ( cl >> 24 ) & 255 ) * 4; - trap_R_AddLightToScene( cent->lerpOrigin, i, r, g, b ); + r = (float) (cl & 0xFF) / 255.0; + g = (float) ((cl >> 8) & 0xFF) / 255.0; + b = (float) ((cl >> 16) & 0xFF) / 255.0; + i = (float) ((cl >> 24) & 0xFF) * 4.0; + trap_R_AddLightToScene(cent->lerpOrigin, i, r, g, b); } }