Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "EntityList.h"
- #include "Process.h"
- #include "HL2.h"
- #include "Engine.h"
- CEntityList* g_pEntList = new CEntityList ();
- CEntityList::CEntityList ( void )
- {
- ZeroMemory(&m_LocalEntity, sizeof(CEntity) );
- ZeroMemory(&m_EntityList, sizeof(CEntity) * 64 );
- }
- CEntityList::~CEntityList ( void )
- {
- ZeroMemory(&m_LocalEntity, sizeof(CEntity) );
- ZeroMemory(&m_EntityList, sizeof(CEntity) * 64 );
- }
- void CEntityList::Update ( void )
- {
- base_entity_t Entity;
- byte Buffer[0x3000];
- int index = g_pEngine->GetLocalPlayer ();
- for ( int i = 1; i < 65; i++ )
- {
- if ( i == index )
- {
- hl2->ReadMemory ( hl2->m_client + HL2::m_EntityList + 40 + sizeof(base_entity_t) * i, &Entity, sizeof(base_entity_t) );
- if ( Entity.m_basePointer == 0 )
- m_LocalEntity.Invalidate ();
- else
- {
- hl2->ReadMemory ( Entity.m_basePointer - 8, Buffer, 0x3000 );
- m_LocalEntity.Update ( Entity.m_basePointer, i, Buffer );
- }
- }
- else
- {
- hl2->ReadMemory ( hl2->m_client + HL2::m_EntityList + 40 + sizeof(base_entity_t) * i, &Entity, sizeof(base_entity_t) );
- if ( Entity.m_basePointer == 0 )
- m_EntityList[i].Invalidate ();
- else
- {
- hl2->ReadMemory ( Entity.m_basePointer - 8, Buffer, 0x3000 );
- m_EntityList[i].Update ( Entity.m_basePointer, i, Buffer );
- }
- }
- }
- }
- void CEntityList::Invalidate ( void )
- {
- ZeroMemory(&m_LocalEntity, sizeof(CEntity) );
- ZeroMemory(&m_EntityList, sizeof(CEntity) * 64 );
- }
- CEntity* CEntityList::GetEntityByIndex ( int index )
- {
- return &m_EntityList[index];
- }
- CEntity* CEntityList::GetLocalEntity ( void )
- {
- return &m_LocalEntity;
- }
Advertisement
Add Comment
Please, Sign In to add comment