2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-04-19 21:25:26 +00:00
|
|
|
|
2019-09-23 19:00:23 +00:00
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
#include "Runtime/World/CPhysicsActor.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CAABox.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2016-04-19 21:25:26 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2016-04-19 21:25:26 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CScriptDoor : public CPhysicsActor {
|
2016-04-22 20:22:45 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
enum class EDoorAnimType {
|
|
|
|
Open,
|
|
|
|
Close,
|
|
|
|
Ready,
|
|
|
|
};
|
|
|
|
|
2021-06-07 19:29:18 +00:00
|
|
|
enum class EDoorOpenCondition { NotReady, Loading, Ready };
|
2019-06-21 06:02:56 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
float x258_animLen;
|
|
|
|
float x25c_animTime = 0.f;
|
|
|
|
EDoorAnimType x260_doorAnimState = EDoorAnimType::Open;
|
|
|
|
zeus::CAABox x264_;
|
|
|
|
TUniqueId x27c_partner1 = kInvalidUniqueId;
|
|
|
|
TUniqueId x27e_partner2 = kInvalidUniqueId;
|
|
|
|
TUniqueId x280_prevDoor = kInvalidUniqueId;
|
|
|
|
TUniqueId x282_dockId = kInvalidUniqueId;
|
|
|
|
zeus::CAABox x284_modelBounds;
|
|
|
|
zeus::CVector3f x29c_orbitPos;
|
|
|
|
|
2020-04-20 04:57:50 +00:00
|
|
|
bool x2a8_24_closing : 1 = false;
|
2018-12-08 05:30:43 +00:00
|
|
|
bool x2a8_25_wasOpen : 1;
|
|
|
|
bool x2a8_26_isOpen : 1;
|
2020-04-20 04:57:50 +00:00
|
|
|
bool x2a8_27_conditionsMet : 1 = false;
|
2018-12-08 05:30:43 +00:00
|
|
|
bool x2a8_28_projectilesCollide : 1;
|
|
|
|
bool x2a8_29_ballDoor : 1;
|
2020-04-20 04:57:50 +00:00
|
|
|
bool x2a8_30_doClose : 1 = false;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2016-04-19 21:25:26 +00:00
|
|
|
public:
|
2021-05-26 14:00:57 +00:00
|
|
|
DEFINE_ENTITY
|
2018-12-08 05:30:43 +00:00
|
|
|
CScriptDoor(TUniqueId, std::string_view name, const CEntityInfo& info, const zeus::CTransform&, CModelData&&,
|
|
|
|
const CActorParameters&, const zeus::CVector3f&, const zeus::CAABox&, bool active, bool open, bool, float,
|
|
|
|
bool ballDoor);
|
|
|
|
|
2019-08-09 12:45:18 +00:00
|
|
|
zeus::CVector3f GetOrbitPosition(const CStateManager& mgr) const override;
|
|
|
|
void Accept(IVisitor& visitor) override;
|
|
|
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
|
|
|
|
void Think(float, CStateManager& mgr) override;
|
2020-04-05 11:54:02 +00:00
|
|
|
void AddToRenderer(const zeus::CFrustum&, CStateManager& mgr) override;
|
2020-04-09 17:28:20 +00:00
|
|
|
void Render(CStateManager&) override {}
|
2018-12-08 05:30:43 +00:00
|
|
|
void ForceClosed(CStateManager&);
|
2019-08-14 10:04:11 +00:00
|
|
|
bool IsConnectedToArea(const CStateManager& mgr, TAreaId area) const;
|
2018-12-08 05:30:43 +00:00
|
|
|
void OpenDoor(TUniqueId, CStateManager&);
|
2019-08-14 10:04:11 +00:00
|
|
|
EDoorOpenCondition GetDoorOpenCondition(CStateManager& mgr) const;
|
2018-12-08 05:30:43 +00:00
|
|
|
void SetDoorAnimation(EDoorAnimType);
|
2019-08-09 12:45:18 +00:00
|
|
|
std::optional<zeus::CAABox> GetTouchBounds() const override;
|
2019-06-12 02:05:17 +00:00
|
|
|
std::optional<zeus::CAABox> GetProjectileBounds() const;
|
2018-12-08 05:30:43 +00:00
|
|
|
bool IsOpen() const { return x2a8_26_isOpen; }
|
2016-04-19 21:25:26 +00:00
|
|
|
};
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|