metaforce/Runtime/World/CEntity.hpp

73 lines
2.0 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"
2017-01-30 02:15:21 +00:00
#include "CEntityInfo.hpp"
2015-08-19 05:48:57 +00:00
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;
2017-01-15 03:07:01 +00:00
class IVisitor;
2015-08-19 05:48:57 +00:00
class CEntity
{
friend class CStateManager;
friend class CObjectList;
2015-08-19 05:48:57 +00:00
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_inGraveyard : 1;
bool x30_26_scriptingBlocked : 1;
2017-02-14 04:27:20 +00:00
bool x30_27_inUse : 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;
2017-01-15 03:07:01 +00:00
virtual ~CEntity() = default;
2016-04-20 21:44:18 +00:00
CEntity(TUniqueId uid, const CEntityInfo& info, bool active, const std::string& name);
2017-01-15 03:07:01 +00:00
virtual void Accept(IVisitor& visitor)=0;
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-20 21:44:18 +00:00
virtual void SetActive(bool active) {x30_24_active = active;}
bool GetActive() const {return x30_24_active;}
2016-04-29 10:08:46 +00:00
void ToggleActive()
{
x30_24_active ^= 1;
}
2015-08-19 05:48:57 +00:00
bool IsInGraveyard() const { return x30_25_inGraveyard; }
void SetIsInGraveyard(bool in) { x30_25_inGraveyard = in; }
bool IsScriptingBlocked() const { return x30_26_scriptingBlocked; }
void SetIsScriptingBlocked(bool blocked) { x30_26_scriptingBlocked = blocked; }
2017-02-14 04:27:20 +00:00
bool IsInUse() const { return x30_27_inUse; }
TAreaId GetAreaId() const
2016-04-23 18:04:49 +00:00
{
2017-02-14 04:27:20 +00:00
if (x30_27_inUse)
2016-04-23 18:04:49 +00:00
return x4_areaId;
return kInvalidAreaId;
}
TAreaId GetAreaIdAlways() const { return x4_areaId; }
2016-04-20 21:44:18 +00:00
TUniqueId GetUniqueId() const {return x8_uid;}
2017-02-14 04:27:20 +00:00
TEditorId GetEditorId() const {return xc_editorId;}
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__