Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 36 additions & 25 deletions src/game/server/gameinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ static int g_nCommandClientIndex = 0;
// The chapter number of the current
static int g_nCurrentChapterIndex = -1;

#ifdef _DEBUG

static ConVar sv_showhitboxes( "sv_showhitboxes", "-1", FCVAR_CHEAT, "Send server-side hitboxes for specified entity to client (NOTE: this uses lots of bandwidth, use on listen server only)." );
#endif


void PrecachePointTemplates();

Expand Down Expand Up @@ -1313,37 +1313,48 @@ void CServerGameDLL::PreClientUpdate( bool simulating )

IGameSystem::PreClientUpdateAllSystems();

#ifdef _DEBUG
if ( sv_showhitboxes.GetInt() == -1 )
return;

if ( sv_showhitboxes.GetInt() == 0 )
if (!engine->IsDedicatedServer())
{
// assume it's text
CBaseEntity *pEntity = NULL;

while (1)
if (developer.GetInt() >= 1)
{
pEntity = gEntList.FindEntityByName( pEntity, sv_showhitboxes.GetString() );
if ( !pEntity )
break;
if (sv_showhitboxes.GetInt() == -1)
return;

CBaseAnimating *anim = dynamic_cast< CBaseAnimating * >( pEntity );

if (anim)
if (sv_showhitboxes.GetInt() == 0)
{
anim->DrawServerHitboxes();
// assume it's text
CBaseEntity* pEntity = NULL;

while (1)
{
pEntity = gEntList.FindEntityByName(pEntity, sv_showhitboxes.GetString());
if (!pEntity)
break;

CBaseAnimating* anim = dynamic_cast<CBaseAnimating*>(pEntity);

if (anim)
{
anim->DrawServerHitboxes();
}
}
return;
}

CBaseAnimating* anim = dynamic_cast<CBaseAnimating*>(CBaseEntity::Instance(engine->PEntityOfEntIndex(sv_showhitboxes.GetInt())));
if (!anim)
return;

anim->DrawServerHitboxes();

}
return;
}

CBaseAnimating *anim = dynamic_cast< CBaseAnimating * >( CBaseEntity::Instance( engine->PEntityOfEntIndex( sv_showhitboxes.GetInt() ) ) );
if ( !anim )
return;
}
else
{
DevMsg("sv_showhitboxes only on allowed on listen servers");
}

anim->DrawServerHitboxes();
#endif
}

void CServerGameDLL::Think( bool finalTick )
Expand Down