mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Initial 'EntityByIndex' implementation
This commit is contained in:
parent
66ef9fb6a0
commit
2c7636ec0d
@ -272,7 +272,7 @@ class VBaseEntity : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const
|
||||
{
|
||||
g_pEntityList = p_CBaseEntity__GetBaseEntity.FindPattern("48 8D 0D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CEntInfo*>();
|
||||
g_pEntityList = p_CBaseEntity__GetBaseEntity.FindPattern("48 8D 0D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CEntInfo**>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
|
@ -6,4 +6,12 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "entitylist.h"
|
||||
|
||||
CEntInfo* g_pEntityList = nullptr;
|
||||
IHandleEntity* LookupEntityByIndex(int iEntity)
|
||||
{
|
||||
Assert(iEntity >= 0 && iEntity < NUM_ENT_ENTRIES); // Programmer error!
|
||||
|
||||
IHandleEntity* pHandle = reinterpret_cast<IHandleEntity*>(*&g_pEntityList[6 * iEntity]);
|
||||
return pHandle; // !TODO: implement CBaseEntityList properly.
|
||||
}
|
||||
|
||||
CEntInfo** g_pEntityList = nullptr;
|
@ -8,6 +8,7 @@
|
||||
#define ENTITYLIST_H
|
||||
#include "game/shared/entitylist_base.h"
|
||||
|
||||
extern CEntInfo* g_pEntityList;
|
||||
IHandleEntity* LookupEntityByIndex(int iEntity);
|
||||
extern CEntInfo** g_pEntityList;
|
||||
|
||||
#endif // ENTITYLIST_H
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define MAX_EDICTS (1<<MAX_EDICT_BITS)
|
||||
// Used for networking ehandles.
|
||||
#define NUM_ENT_ENTRY_BITS (MAX_EDICT_BITS + 2)
|
||||
#define NUM_ENT_ENTRIES (1 << NUM_ENT_ENTRY_BITS) // !TODO: is this correct?
|
||||
#define NUM_ENT_ENTRIES (1 << NUM_ENT_ENTRY_BITS) // Value is correct for r5.
|
||||
#define INVALID_EHANDLE_INDEX 0xFFFFFFFF
|
||||
|
||||
#define NUM_SERIAL_NUM_BITS 16 // (32 - NUM_ENT_ENTRY_BITS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user