2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2015-08-19 05:48:57 +00:00
|
|
|
|
2019-09-22 21:52:05 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
#include "Runtime/World/CEntityInfo.hpp"
|
|
|
|
#include "Runtime/World/ScriptObjectSupport.hpp"
|
2015-08-19 05:48:57 +00:00
|
|
|
|
2021-05-26 02:49:24 +00:00
|
|
|
#ifndef ENABLE_IMGUI
|
|
|
|
#define ENABLE_IMGUI 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLE_IMGUI
|
|
|
|
#define IMGUI_ENTITY_PROTOTYPES \
|
|
|
|
std::string_view ImGuiType() override; \
|
|
|
|
void ImGuiInspect() override;
|
|
|
|
#else
|
|
|
|
#define IMGUI_ENTITY_PROTOTYPES
|
|
|
|
#endif
|
|
|
|
|
2021-05-26 14:00:57 +00:00
|
|
|
#define DEFINE_ENTITY IMGUI_ENTITY_PROTOTYPES
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
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
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CEntity {
|
|
|
|
friend class CStateManager;
|
|
|
|
friend class CObjectList;
|
2021-05-27 01:35:46 +00:00
|
|
|
friend class ImGuiConsole;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2015-08-19 05:48:57 +00:00
|
|
|
protected:
|
2018-12-08 05:30:43 +00:00
|
|
|
TAreaId x4_areaId;
|
|
|
|
TUniqueId x8_uid;
|
|
|
|
TEditorId xc_editorId;
|
|
|
|
std::string x10_name;
|
|
|
|
std::vector<SConnection> x20_conns;
|
2020-04-11 05:50:10 +00:00
|
|
|
bool x30_24_active : 1;
|
2020-04-20 04:57:50 +00:00
|
|
|
bool x30_25_inGraveyard : 1 = false;
|
|
|
|
bool x30_26_scriptingBlocked : 1 = false;
|
2020-04-11 05:50:10 +00:00
|
|
|
bool x30_27_inUse : 1;
|
2016-04-20 21:44:18 +00:00
|
|
|
|
2021-05-27 01:35:46 +00:00
|
|
|
// Used in ImGuiConsole
|
|
|
|
bool m_debugSelected = false;
|
|
|
|
bool m_debugHovered = false;
|
|
|
|
|
2015-08-19 05:48:57 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
static const std::vector<SConnection> NullConnectionList;
|
|
|
|
virtual ~CEntity() = default;
|
|
|
|
CEntity(TUniqueId uid, const CEntityInfo& info, bool active, std::string_view name);
|
|
|
|
virtual void Accept(IVisitor& visitor) = 0;
|
2020-03-25 01:28:13 +00:00
|
|
|
virtual void PreThink(float dt, CStateManager& mgr) {}
|
|
|
|
virtual void Think(float dt, CStateManager& mgr) {}
|
2018-12-08 05:30:43 +00:00
|
|
|
virtual void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
|
|
|
|
virtual void SetActive(bool active) { x30_24_active = active; }
|
2016-08-31 00:33:59 +00:00
|
|
|
|
2021-05-26 02:49:24 +00:00
|
|
|
// Debugging utilities
|
|
|
|
virtual std::string_view ImGuiType();
|
|
|
|
virtual void ImGuiInspect();
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool GetActive() const { return x30_24_active; }
|
|
|
|
void ToggleActive() { x30_24_active ^= 1; }
|
2015-08-19 05:48:57 +00:00
|
|
|
|
2018-12-08 05:30:43 +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; }
|
|
|
|
bool IsInUse() const { return x30_27_inUse; }
|
2017-01-04 04:08:30 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
TAreaId GetAreaId() const {
|
|
|
|
if (x30_27_inUse)
|
|
|
|
return x4_areaId;
|
|
|
|
return kInvalidAreaId;
|
|
|
|
}
|
|
|
|
TAreaId GetAreaIdAlways() const { return x4_areaId; }
|
|
|
|
TUniqueId GetUniqueId() const { return x8_uid; }
|
|
|
|
TEditorId GetEditorId() const { return xc_editorId; }
|
|
|
|
void SendScriptMsgs(EScriptObjectState state, CStateManager& stateMgr, EScriptObjectMessage msg);
|
2017-10-05 05:40:44 +00:00
|
|
|
|
2020-03-25 01:29:42 +00:00
|
|
|
std::vector<SConnection>& GetConnectionList() { return x20_conns; }
|
2018-12-08 05:30:43 +00:00
|
|
|
const std::vector<SConnection>& GetConnectionList() const { return x20_conns; }
|
2017-11-26 03:04:25 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
std::string_view GetName() const { return x10_name; }
|
2015-08-19 05:48:57 +00:00
|
|
|
};
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|