2022-10-09 05:13:17 +00:00
|
|
|
#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 {
|
2022-09-18 05:55:13 +00:00
|
|
|
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;
|
2022-10-09 05:37:23 +00:00
|
|
|
short mNext;
|
|
|
|
short mPrev;
|
2022-10-14 04:50:56 +00:00
|
|
|
SObjectListEntry() : mEnt(nullptr), mNext(-1), mPrev(-1) {}
|
2022-08-05 10:23:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
CObjectList(EGameObjectList list);
|
2022-09-18 05:55:13 +00:00
|
|
|
|
2022-10-14 05:58:49 +00:00
|
|
|
virtual uchar IsQualified(const CEntity& ent);
|
2022-09-18 05:55:13 +00:00
|
|
|
|
2022-08-05 10:23:49 +00:00
|
|
|
void AddObject(CEntity& ent);
|
|
|
|
void RemoveObject(TUniqueId uid);
|
2022-10-14 04:50:56 +00:00
|
|
|
CEntity* GetObjectById(TUniqueId uid);
|
|
|
|
const CEntity* GetObjectById(TUniqueId uid) const;
|
2022-08-05 10:23:49 +00:00
|
|
|
CEntity* GetValidObjectById(TUniqueId uid);
|
|
|
|
const CEntity* GetValidObjectById(TUniqueId uid) const;
|
2022-09-05 04:01:13 +00:00
|
|
|
CEntity* operator[](int idx);
|
|
|
|
const CEntity* operator[](int idx) const;
|
2022-10-14 04:50:56 +00:00
|
|
|
const CEntity* GetObjectByIndex(int idx) const;
|
2022-09-05 04:01:13 +00:00
|
|
|
int size() const { return mCount; }
|
2022-08-13 01:26:00 +00:00
|
|
|
|
2022-09-18 05:55:13 +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;
|
2022-10-09 05:37:23 +00:00
|
|
|
short mFirstId;
|
|
|
|
short mCount;
|
2022-08-13 01:26:00 +00:00
|
|
|
};
|
2022-09-18 05:55:13 +00:00
|
|
|
CHECK_SIZEOF(CObjectList, 0x200c)
|
2022-08-05 10:23:49 +00:00
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _COBJECTLIST
|