From 56ea125a48ae3d8fd628559014e68ee83dc5b324 Mon Sep 17 00:00:00 2001 From: black Date: Wed, 17 Aug 2005 12:43:01 +0000 Subject: [PATCH] Fixed a bug in the r_shadow light entity parser which caused it to not read in the pflags, skin and effects key/value pairs in q3 maps. Added a check to PF_lightstyle for style >= 64. Fixed a bug in the cursor drawing of the editrtlights mode (it was reading from a uninitialized vector if you flew out of the map). git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5589 d7cf8633-e32d-0410-b094-e92efae38249 --- r_shadow.c | 16 ++++++++++------ svvm_cmds.c | 4 ++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/r_shadow.c b/r_shadow.c index 20836366..d9553cb9 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -3621,6 +3621,12 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void) } else if (!strcmp("style", key)) style = atoi(value); + else if (!strcmp("skin", key)) + skin = (int)atof(value); + else if (!strcmp("pflags", key)) + pflags = (int)atof(value); + else if (!strcmp("effects", key)) + effects = (int)atof(value); else if (r_refdef.worldmodel->type == mod_brushq3) { if (!strcmp("scale", key)) @@ -3628,12 +3634,6 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void) if (!strcmp("fade", key)) fadescale = atof(value); } - else if (!strcmp("skin", key)) - skin = (int)atof(value); - else if (!strcmp("pflags", key)) - pflags = (int)atof(value); - else if (!strcmp("effects", key)) - effects = (int)atof(value); } if (!islight) continue; @@ -3696,6 +3696,10 @@ void R_Shadow_SetCursorLocationForView(void) push = -push; VectorMA(trace.endpos, push, r_viewforward, endpos); VectorMA(endpos, r_editlights_cursorpushoff.value, trace.plane.normal, endpos); + } + else + { + VectorClear( endpos ); } r_editlights_cursorlocation[0] = floor(endpos[0] / r_editlights_cursorgrid.value + 0.5f) * r_editlights_cursorgrid.value; r_editlights_cursorlocation[1] = floor(endpos[1] / r_editlights_cursorgrid.value + 0.5f) * r_editlights_cursorgrid.value; diff --git a/svvm_cmds.c b/svvm_cmds.c index 687f1d55..d77c1f00 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -862,6 +862,10 @@ void PF_lightstyle (void) style = PRVM_G_FLOAT(OFS_PARM0); val = PRVM_G_STRING(OFS_PARM1); + if( (unsigned) style >= 64 ) { + PRVM_ERROR( "PF_lightstyle: style: %i >= 64", style ); + } + // change the string in sv strlcpy(sv.lightstyles[style], val, sizeof(sv.lightstyles[style])); -- 2.39.2