添加项目文件。

This commit is contained in:
Huoji's
2023-10-01 02:28:13 +08:00
parent ee12160e20
commit effb823be9
73 changed files with 7735 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
#include "handle.h"
#include "../cgameentitysystem.h"
CBaseEntity* CHandle::GetBaseEntity() const
{
CGameEntitySystem* pEntitySystem = CGameEntitySystem::GetInstance();
if (!pEntitySystem)
return nullptr;
return pEntitySystem->GetBaseEntity(GetEntryIndex());
}

View File

@@ -0,0 +1,26 @@
#pragma once
#include <cstdint>
#define INVALID_EHANDLE_INDEX 0xFFFFFFFF
#define ENT_ENTRY_MASK 0x7FFF
class CBaseEntity;
class CHandle
{
CBaseEntity* GetBaseEntity() const;
public:
bool operator==(CHandle rhs) const { return m_Index == rhs.m_Index; }
bool IsValid() const { return m_Index != INVALID_EHANDLE_INDEX; }
int GetEntryIndex() const { return m_Index & ENT_ENTRY_MASK; }
template <typename T = CBaseEntity>
T* Get() const
{
return reinterpret_cast<T*>(GetBaseEntity());
}
uint32_t m_Index;
};