mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 22:27:43 +00:00
Various CStateManager additions and camera stubs
This commit is contained in:
@@ -32,65 +32,13 @@ class CObjectList
|
||||
TUniqueId m_lastId = -1;
|
||||
u16 m_count = 0;
|
||||
public:
|
||||
CObjectList(EGameObjectList listEnum)
|
||||
: m_listEnum(listEnum)
|
||||
{}
|
||||
CObjectList(EGameObjectList listEnum);
|
||||
|
||||
void AddObject(CEntity& entity)
|
||||
{
|
||||
if (IsQualified())
|
||||
{
|
||||
if (m_lastId != -1)
|
||||
m_list[m_lastId].next = entity.m_uid & 0x3ff;
|
||||
TUniqueId prevLast = m_lastId;
|
||||
m_lastId = entity.m_uid & 0x3ff;
|
||||
SObjectListEntry& newEnt = m_list[m_lastId];
|
||||
newEnt.entity = &entity;
|
||||
newEnt.prev = prevLast;
|
||||
newEnt.next = -1;
|
||||
++m_count;
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveObject(TUniqueId uid)
|
||||
{
|
||||
uid = uid & 0x3ff;
|
||||
SObjectListEntry& ent = m_list[uid];
|
||||
if (!ent.entity || ent.entity->m_uid != uid)
|
||||
return;
|
||||
if (uid == m_lastId)
|
||||
{
|
||||
m_lastId = ent.prev;
|
||||
if (ent.prev != -1)
|
||||
m_list[ent.prev].next = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ent.prev != -1)
|
||||
m_list[ent.prev].next = -1;
|
||||
m_list[ent.next].prev = -1;
|
||||
}
|
||||
ent.entity = nullptr;
|
||||
ent.prev = -1;
|
||||
ent.next = -1;
|
||||
--m_count;
|
||||
}
|
||||
|
||||
const CEntity* GetObjectById(TUniqueId uid) const
|
||||
{
|
||||
if (!uid)
|
||||
return nullptr;
|
||||
return m_list[uid & 0x3ff].entity;
|
||||
}
|
||||
|
||||
CEntity* GetObjectById(TUniqueId uid)
|
||||
{
|
||||
if (!uid)
|
||||
return nullptr;
|
||||
return m_list[uid & 0x3ff].entity;
|
||||
}
|
||||
|
||||
virtual bool IsQualified() {return true;}
|
||||
void AddObject(CEntity& entity);
|
||||
void RemoveObject(TUniqueId uid);
|
||||
const CEntity* GetObjectById(TUniqueId uid) const;
|
||||
CEntity* GetObjectById(TUniqueId uid);
|
||||
virtual bool IsQualified();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user