Fixed a bug in the r_shadow light entity parser which caused it to not read in
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 17 Aug 2005 12:43:01 +0000 (12:43 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 17 Aug 2005 12:43:01 +0000 (12:43 +0000)
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
svvm_cmds.c

index 2083636..d9553cb 100644 (file)
@@ -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;
index 687f1d5..d77c1f0 100644 (file)
@@ -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]));