Skip to content

Commit ba80b84

Browse files
committed
1 parent 018d36c commit ba80b84

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

src/game/server/gameinterface.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,13 @@ static int g_nCommandClientIndex = 0;
246246
// The chapter number of the current
247247
static int g_nCurrentChapterIndex = -1;
248248

249+
#ifdef BDSBASE
250+
static ConVar sv_showhitboxes("sv_showhitboxes", "0", FCVAR_CHEAT, "Send server-side hitboxes for specified entity to client (NOTE: this uses lots of bandwidth, use on listen server only).");
251+
#else
249252
#ifdef _DEBUG
250253
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)." );
251254
#endif
255+
#endif
252256

253257
void PrecachePointTemplates();
254258

@@ -1323,6 +1327,48 @@ void CServerGameDLL::PreClientUpdate( bool simulating )
13231327

13241328
IGameSystem::PreClientUpdateAllSystems();
13251329

1330+
#ifdef BDSBASE
1331+
if (!engine->IsDedicatedServer())
1332+
{
1333+
if (developer.GetInt() >= 1)
1334+
{
1335+
if (sv_showhitboxes.GetInt() == -1)
1336+
return;
1337+
1338+
if (sv_showhitboxes.GetInt() == 0)
1339+
{
1340+
// assume it's text
1341+
CBaseEntity* pEntity = NULL;
1342+
1343+
while (1)
1344+
{
1345+
pEntity = gEntList.FindEntityByName(pEntity, sv_showhitboxes.GetString());
1346+
if (!pEntity)
1347+
break;
1348+
1349+
CBaseAnimating* anim = dynamic_cast<CBaseAnimating*>(pEntity);
1350+
1351+
if (anim)
1352+
{
1353+
anim->DrawServerHitboxes();
1354+
}
1355+
}
1356+
return;
1357+
}
1358+
1359+
CBaseAnimating* anim = dynamic_cast<CBaseAnimating*>(CBaseEntity::Instance(engine->PEntityOfEntIndex(sv_showhitboxes.GetInt())));
1360+
if (!anim)
1361+
return;
1362+
1363+
anim->DrawServerHitboxes();
1364+
1365+
}
1366+
}
1367+
else
1368+
{
1369+
DevMsg("sv_showhitboxes only allowed on listen servers");
1370+
}
1371+
#else
13261372
#ifdef _DEBUG
13271373
if ( sv_showhitboxes.GetInt() == -1 )
13281374
return;
@@ -1354,6 +1400,7 @@ void CServerGameDLL::PreClientUpdate( bool simulating )
13541400

13551401
anim->DrawServerHitboxes();
13561402
#endif
1403+
#endif
13571404
}
13581405

13591406
void CServerGameDLL::Think( bool finalTick )

0 commit comments

Comments
 (0)