mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Make it a discrete function
Cheaper for runtime.
This commit is contained in:
parent
320ff7fb0f
commit
c7c4672b27
@ -86,6 +86,17 @@ void __fastcall CServerGameDLL::OnReceivedSayTextMessage(void* thisptr, int send
|
||||
#endif
|
||||
}
|
||||
|
||||
void DrawServerHitbox(int iEntity)
|
||||
{
|
||||
IHandleEntity* pEntity = LookupEntityByIndex(iEntity);
|
||||
CBaseAnimating* pAnimating = dynamic_cast<CBaseAnimating*>(pEntity);
|
||||
|
||||
if (pAnimating)
|
||||
{
|
||||
pAnimating->DrawServerHitboxes();
|
||||
}
|
||||
}
|
||||
|
||||
void DrawServerHitboxes(bool bRunOverlays)
|
||||
{
|
||||
int nVal = sv_showhitboxes->GetInt();
|
||||
@ -94,27 +105,16 @@ void DrawServerHitboxes(bool bRunOverlays)
|
||||
if (nVal == -1)
|
||||
return;
|
||||
|
||||
std::function<void(int)> fnLookupAndDraw = [&](int iEntity)
|
||||
{
|
||||
IHandleEntity* pEntity = LookupEntityByIndex(iEntity);
|
||||
CBaseAnimating* pAnimating = dynamic_cast<CBaseAnimating*>(pEntity);
|
||||
|
||||
if (pAnimating)
|
||||
{
|
||||
pAnimating->DrawServerHitboxes();
|
||||
}
|
||||
};
|
||||
|
||||
if (nVal == 0)
|
||||
{
|
||||
for (int i = 0; i < NUM_ENT_ENTRIES; i++)
|
||||
{
|
||||
fnLookupAndDraw(i);
|
||||
DrawServerHitbox(i);
|
||||
}
|
||||
}
|
||||
else // Lookup entity manually by index from 'sv_showhitboxes'.
|
||||
{
|
||||
fnLookupAndDraw(nVal);
|
||||
DrawServerHitbox(nVal);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user