2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 03:47:43 +00:00

CScriptTrigger work

This commit is contained in:
2017-01-14 19:59:37 -08:00
parent e2c671e9b4
commit 65fb75737f
39 changed files with 707 additions and 448 deletions

View File

@@ -4,54 +4,54 @@ namespace urde
{
CObjectList::CObjectList(EGameObjectList listEnum)
: m_listEnum(listEnum)
: x2004_listEnum(listEnum)
{}
void CObjectList::AddObject(CEntity& entity)
{
if (IsQualified(entity))
{
if (m_firstId != -1)
m_list[m_firstId].prev = entity.GetUniqueId() & 0x3ff;
TUniqueId prevFirst = m_firstId;
m_firstId = entity.GetUniqueId() & 0x3ff;
SObjectListEntry& newEnt = m_list[m_firstId];
if (x2008_firstId != -1)
x0_list[x2008_firstId].prev = entity.GetUniqueId() & 0x3ff;
TUniqueId prevFirst = x2008_firstId;
x2008_firstId = entity.GetUniqueId() & 0x3ff;
SObjectListEntry& newEnt = x0_list[x2008_firstId];
newEnt.entity = &entity;
newEnt.next = prevFirst;
newEnt.prev = -1;
++m_count;
++x200a_count;
}
}
void CObjectList::RemoveObject(TUniqueId uid)
{
uid = uid & 0x3ff;
SObjectListEntry& ent = m_list[uid];
SObjectListEntry& ent = x0_list[uid];
if (!ent.entity || ent.entity->GetUniqueId() != uid)
return;
if (uid == m_firstId)
if (uid == x2008_firstId)
{
m_firstId = ent.next;
x2008_firstId = ent.next;
if (ent.next != -1)
m_list[ent.next].prev = -1;
x0_list[ent.next].prev = -1;
}
else
{
if (ent.next != -1)
m_list[ent.next].prev = -1;
m_list[ent.prev].next = -1;
x0_list[ent.next].prev = -1;
x0_list[ent.prev].next = -1;
}
ent.entity = nullptr;
ent.next = -1;
ent.prev = -1;
--m_count;
--x200a_count;
}
const CEntity* CObjectList::GetObjectById(TUniqueId uid) const
{
if (!uid)
return nullptr;
const SObjectListEntry& ent = m_list[uid & 0x3ff];
const SObjectListEntry& ent = x0_list[uid & 0x3ff];
if (ent.entity->x30_26_scriptingBlocked)
return nullptr;
return ent.entity;
@@ -61,7 +61,7 @@ CEntity* CObjectList::GetObjectById(TUniqueId uid)
{
if (!uid)
return nullptr;
SObjectListEntry& ent = m_list[uid & 0x3ff];
SObjectListEntry& ent = x0_list[uid & 0x3ff];
if (ent.entity->x30_26_scriptingBlocked)
return nullptr;
return ent.entity;