2023-01-20 00:28:49 +01:00
|
|
|
|
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
|
|
|
|
|
//
|
|
|
|
|
// Purpose:
|
|
|
|
|
//
|
|
|
|
|
//===========================================================================//
|
|
|
|
|
#include "core/stdafx.h"
|
|
|
|
|
#include "util_shared.h"
|
|
|
|
|
#ifndef CLIENT_DLL
|
|
|
|
|
#include "game/server/player.h"
|
|
|
|
|
#include "game/server/gameinterface.h"
|
|
|
|
|
#endif // !CLIENT_DLL
|
|
|
|
|
|
|
|
|
|
#ifndef CLIENT_DLL
|
2023-05-31 23:55:18 +02:00
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// Purpose: returns the player instance by edict
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2023-01-20 00:28:49 +01:00
|
|
|
|
CPlayer* UTIL_PlayerByIndex(int nIndex)
|
|
|
|
|
{
|
2023-05-31 23:55:18 +02:00
|
|
|
|
if (nIndex < 1 || nIndex >(*g_pGlobals)->m_nMaxClients || nIndex == FL_EDICT_INVALID)
|
|
|
|
|
{
|
|
|
|
|
assert(0);
|
2023-01-20 01:23:08 +01:00
|
|
|
|
return nullptr;
|
2023-05-31 23:55:18 +02:00
|
|
|
|
}
|
2023-01-20 00:28:49 +01:00
|
|
|
|
|
2023-01-20 01:23:08 +01:00
|
|
|
|
// !TODO: Improve this!!!
|
2023-02-12 15:06:08 +01:00
|
|
|
|
CPlayer* pPlayer = reinterpret_cast<CPlayer*>((*g_pGlobals)->m_pEdicts[nIndex + 0x7808]);
|
2023-01-20 01:23:08 +01:00
|
|
|
|
return pPlayer;
|
2023-01-20 00:28:49 +01:00
|
|
|
|
}
|
|
|
|
|
#endif // CLIENT_DLL
|
2023-01-21 16:22:16 +01:00
|
|
|
|
|
2023-05-31 23:55:18 +02:00
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// Purpose: returns the class name, script name, and edict of the entity
|
|
|
|
|
// returns "<<null>>" on NULL entity
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
const char* UTIL_GetEntityScriptInfo(CBaseEntity* pEnt)
|
|
|
|
|
{
|
|
|
|
|
assert(pEnt != nullptr);
|
|
|
|
|
return v_UTIL_GetEntityScriptInfo(pEnt);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-21 16:22:16 +01:00
|
|
|
|
CTraceFilterSimple::CTraceFilterSimple(const IHandleEntity* pPassEntity, int collisionGroup, ShouldHitFunc_t pExtraShouldHitCheckFn)
|
|
|
|
|
{
|
|
|
|
|
void** pVTable = reinterpret_cast<void**>(&*this); // Assign vftable pointer to the implementation supplied by the engine.
|
|
|
|
|
*pVTable = reinterpret_cast<void*>(g_pTraceFilterSimpleVFTable);
|
|
|
|
|
|
2023-04-16 01:23:38 +02:00
|
|
|
|
m_collisionGroup = collisionGroup;
|
2023-01-21 16:22:16 +01:00
|
|
|
|
m_pPassEntity = pPassEntity;
|
|
|
|
|
m_traceType = 0;
|
|
|
|
|
m_pExtraShouldHitCheckFunction = pExtraShouldHitCheckFn;
|
|
|
|
|
}
|