prime/include/MetroidPrime/CObjectList.hpp

65 lines
1.3 KiB
C++
Raw Normal View History

#ifndef _COBJECTLIST
#define _COBJECTLIST
2022-08-05 10:23:49 +00:00
2022-08-13 01:26:00 +00:00
#include "types.h"
#include "MetroidPrime/TGameTypes.hpp"
2022-08-05 10:23:49 +00:00
#define kMaxObjects 1024
2022-08-13 01:26:00 +00:00
2022-08-05 10:23:49 +00:00
enum EGameObjectList {
kOL_Invalid = -1,
kOL_All,
kOL_Actor,
kOL_PhysicsActor,
kOL_GameCamera,
kOL_GameLight,
kOL_ListeningAi,
kOL_AiWaypoint,
kOL_PlatformAndDoor,
2022-08-05 10:23:49 +00:00
};
class CEntity;
class CObjectList {
struct SObjectListEntry {
CEntity* mEnt;
s16 mNext;
s16 mPrev;
SObjectListEntry();
};
public:
CObjectList(EGameObjectList list);
virtual bool IsQualified(CEntity& ent);
2022-08-05 10:23:49 +00:00
void AddObject(CEntity& ent);
void RemoveObject(TUniqueId uid);
CEntity* GetObjectById();
const CEntity* GetObjectById() const;
CEntity* GetValidObjectById(TUniqueId uid);
const CEntity* GetValidObjectById(TUniqueId uid) const;
CEntity* operator[](int idx);
const CEntity* operator[](int idx) const;
const CEntity* GetValidObjectByIndex(int idx) const;
int size() const { return mCount; }
2022-08-13 01:26:00 +00:00
int GetFirstObjectIndex() const { return mFirstId; }
int GetNextObjectIndex(int idx) const {
if (idx != -1) {
return mObjects[idx].mNext;
} else {
return -1;
}
}
2022-08-05 10:23:49 +00:00
private:
SObjectListEntry mObjects[1024];
EGameObjectList mListType;
s16 mFirstId;
s16 mCount;
2022-08-13 01:26:00 +00:00
};
CHECK_SIZEOF(CObjectList, 0x200c)
2022-08-05 10:23:49 +00:00
#endif // _COBJECTLIST