El jue, 11-08-2005 a las 11:28 -0500, Jeffrey "botman" Broome escribió:
> Chris Adams wrote:
> > OK I've done some debugging for the particle error.
> >
> > The text below is my output from when I fire the pistol - the Assert() that
> > it mentions is the line *after* the DevMsg line, so you can see that most of
> > the particles don't cause errors when being sorted, just a few. Looking at
> > the ones that have the problem, the min and max Z values are the same?
> > Please let me know what you think:
>
> Divide by zero in particlemgr.cpp line 728:
>
> float flPercent = (zCoords[iCurParticle] - minZ) / (maxZ - minZ);
>
> ...this probably should be...
>
> float flPercent = 0.0f;
>
> if (abs(maxZ - minZ) > 0.00001)  // avoid nasty divide by zero problem
>     flPercent = (zCoords[iCurParticle] - minZ) / (maxZ - minZ);

<me mode=lame>

other idea:

 const EPSYLON = 0.000001;
 float diffZ = maxZ - minZ;

 if (!diffZ) diffZ = EPSYLON; //avoid divide by zero errors

 flPercent = (zCoords[iCurParticle] - minZ) / diffZ;

if that also crash (maybe the coprocessor dont like really small
values):

 if(!.. can be if (diffZ < EPSYLON)...

</me>





_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to