metaforce/Runtime/World/CEntity.hpp

75 lines
1.9 KiB
C++
Raw Normal View History

2016-04-13 06:07:23 +00:00
#ifndef __URDE_CENTITY_HPP__
#define __URDE_CENTITY_HPP__
2015-08-19 05:48:57 +00:00
#include "RetroTypes.hpp"
#include "ScriptObjectSupport.hpp"
2016-03-04 23:04:53 +00:00
namespace urde
2015-08-19 05:48:57 +00:00
{
2015-08-22 01:58:41 +00:00
class CStateManager;
2015-08-19 05:48:57 +00:00
struct SConnection
{
2016-04-20 21:44:18 +00:00
EScriptObjectState x0_state;
EScriptObjectMessage x4_msg;
TEditorId x8_objId;
2015-08-19 05:48:57 +00:00
};
class CEntityInfo
{
2016-04-20 21:44:18 +00:00
TAreaId x0_areaId;
std::vector<SConnection> x4_conns;
2016-04-22 20:22:45 +00:00
TEditorId x14_editorId;
2015-08-19 05:48:57 +00:00
public:
2016-04-20 21:44:18 +00:00
CEntityInfo(TAreaId aid, const std::vector<SConnection>& conns, ResId savwId=-1)
: x0_areaId(aid), x4_conns(conns) {}
TAreaId GetAreaId() const {return x0_areaId;}
2016-04-22 20:22:45 +00:00
std::vector<SConnection> GetConnectionList() const { return x4_conns; }
ResId GetEditorId() const { return x14_editorId; }
2015-08-19 05:48:57 +00:00
};
class CEntity
{
protected:
2016-04-20 21:44:18 +00:00
TAreaId x4_areaId;
TUniqueId x8_uid;
2016-04-24 02:46:13 +00:00
TEditorId xc_editorId;
2016-04-20 21:44:18 +00:00
std::string x10_name;
std::vector<SConnection> x20_conns;
union
{
struct
{
bool x30_24_active : 1;
bool x30_25_ : 1;
bool x30_26_ : 1;
2016-04-23 18:04:49 +00:00
bool x30_27_ : 1;
2016-04-20 21:44:18 +00:00
};
u8 _dummy = 0;
};
2015-08-19 05:48:57 +00:00
public:
2016-04-22 20:22:45 +00:00
static const std::vector<SConnection> NullConnectionList;
2015-08-19 05:48:57 +00:00
virtual ~CEntity() {}
2016-04-20 21:44:18 +00:00
CEntity(TUniqueId uid, const CEntityInfo& info, bool active, const std::string& name);
2015-08-19 05:48:57 +00:00
virtual void PreThink(float, CStateManager&) {}
virtual void Think(float, CStateManager&) {}
virtual void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
2016-04-22 20:22:45 +00:00
bool GetActive() const {return x30_24_active;}
2016-04-20 21:44:18 +00:00
virtual void SetActive(bool active) {x30_24_active = active;}
2015-08-19 05:48:57 +00:00
2016-04-23 18:04:49 +00:00
TAreaId GetAreaId() const
{
if (x30_27_)
return x4_areaId;
return kInvalidAreaId;
}
2016-04-20 21:44:18 +00:00
TUniqueId GetUniqueId() const {return x8_uid;}
2015-08-19 05:48:57 +00:00
void SendScriptMsgs(EScriptObjectState state, CStateManager& stateMgr, EScriptObjectMessage msg);
};
}
2016-04-13 06:07:23 +00:00
#endif // __URDE_CENTITY_HPP__