Oooh optimization! Thanks :-)

---------------------------------------
Chris Adams

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jeffrey "botman"
Broome
Sent: 11 August 2005 19:24
To: [email protected]
Subject: Re: [hlcoders] Several bugs: particlemgr.cpp (730),
CBaseAnimatingOverlay::AddGesture and gamerules.cpp (66)

Jeffrey "botman" Broome wrote:
>
> ...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);

...and while we're at it, quick optimization (you don't need to sort if
there's only one particle).  Change this...

// Do an O(N) bucket sort. This helps the sort when there are lots of
particles.
#define NUM_BUCKETS     32

..to this...

if (!pMaterial->m_Particles.m_pNext)  // is there only one particle?
    return;  // don't need to sort just one

// Do an O(N) bucket sort. This helps the sort when there are lots of
particles.
#define NUM_BUCKETS     32

--
Jeffrey "botman" Broome

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




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

Reply via email to