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
|
|
|
|
{
|
2016-08-14 03:00:58 +00:00
|
|
|
friend class CStateManager;
|
2016-08-14 21:11:44 +00:00
|
|
|
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;
|
2017-01-04 04:08:30 +00:00
|
|
|
bool x30_25_inGraveyard : 1;
|
2016-08-14 21:11:44 +00:00
|
|
|
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;}
|
2016-08-31 00:33:59 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2017-01-04 04:08:30 +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; }
|
2017-01-04 04:08:30 +00:00
|
|
|
|
2016-07-25 06:24:57 +00:00
|
|
|
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;
|
|
|
|
}
|
2017-03-04 04:31:08 +00:00
|
|
|
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__
|