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-10-01 19:00:16 +00:00
|
|
|
CEntityInfo(TAreaId aid, const std::vector<SConnection>& conns, TEditorId eid = kInvalidEditorId)
|
|
|
|
: x0_areaId(aid), x4_conns(conns), x14_editorId(eid) {}
|
2016-04-20 21:44:18 +00:00
|
|
|
TAreaId GetAreaId() const {return x0_areaId;}
|
2016-04-22 20:22:45 +00:00
|
|
|
std::vector<SConnection> GetConnectionList() const { return x4_conns; }
|
2016-08-14 03:00:58 +00:00
|
|
|
TEditorId GetEditorId() const { return x14_editorId; }
|
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;
|
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-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; }
|
|
|
|
|
2016-07-25 06:24:57 +00:00
|
|
|
TAreaId GetAreaId() const
|
2016-04-23 18:04:49 +00:00
|
|
|
{
|
|
|
|
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__
|