2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2017-03-31 19:51:40 +00:00
|
|
|
|
2019-09-22 21:52:05 +00:00
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
#include "Runtime/World/CAi.hpp"
|
2017-03-31 19:51:40 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2017-03-31 19:51:40 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CDestroyableRock : public CAi {
|
2019-12-14 23:50:29 +00:00
|
|
|
|
2020-01-06 04:24:54 +00:00
|
|
|
/* Used to be a CModelData */
|
|
|
|
CStaticRes x2d8_phazonModel;
|
|
|
|
float x324_ = 0.f;
|
|
|
|
float x328_ = 0.f;
|
|
|
|
float x32c_thermalMag;
|
|
|
|
zeus::CColor x330_ = zeus::skWhite;
|
|
|
|
bool x334_isCold = false;
|
|
|
|
bool x335_usePhazonModel = false;
|
|
|
|
CHealthInfo x338_healthInfo;
|
2020-09-05 21:51:21 +00:00
|
|
|
bool x340_;
|
2020-01-06 04:24:54 +00:00
|
|
|
bool x341_;
|
|
|
|
|
2017-03-31 19:51:40 +00:00
|
|
|
public:
|
2021-05-26 14:00:57 +00:00
|
|
|
DEFINE_ENTITY
|
2018-12-08 05:30:43 +00:00
|
|
|
CDestroyableRock(TUniqueId id, bool active, std::string_view name, const CEntityInfo& info,
|
|
|
|
const zeus::CTransform& xf, CModelData&& modelData, float mass, const CHealthInfo& health,
|
|
|
|
const CDamageVulnerability& vulnerability, const CMaterialList& matList, CAssetId fsm,
|
2020-01-06 04:24:54 +00:00
|
|
|
const CActorParameters& actParams, const CStaticRes& phazonModel, s32);
|
2019-11-24 15:01:07 +00:00
|
|
|
|
|
|
|
void Accept(IVisitor& visitor) override;
|
2020-01-06 04:24:54 +00:00
|
|
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override {
|
|
|
|
CAi::AcceptScriptMsg(msg, uid, mgr);
|
|
|
|
if (msg == EScriptObjectMessage::Registered) {
|
|
|
|
AddMaterial(EMaterialTypes::ProjectilePassthrough, mgr);
|
|
|
|
AddMaterial(EMaterialTypes::CameraPassthrough, mgr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state) override {
|
|
|
|
x334_isCold = true;
|
|
|
|
}
|
2019-11-24 15:01:07 +00:00
|
|
|
void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info, EKnockBackType type, bool inDeferred,
|
2020-01-06 04:24:54 +00:00
|
|
|
float magnitude) override {}
|
|
|
|
|
|
|
|
zeus::CVector3f GetAimPosition(const CStateManager&, float) const override { return GetTranslation(); }
|
|
|
|
zeus::CVector3f GetOrbitPosition(const CStateManager&) const override { return GetTranslation(); }
|
|
|
|
std::optional<zeus::CAABox> GetTouchBounds() const override { return GetModelData()->GetBounds(GetTransform()); }
|
|
|
|
bool CanRenderUnsorted(const CStateManager&) const override { return true; }
|
|
|
|
void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) override;
|
|
|
|
void TakeDamage(const zeus::CVector3f&, float) override {
|
|
|
|
x324_ = 1.f;
|
|
|
|
x328_ = 2.f;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Think(float dt, CStateManager& mgr) override;
|
2019-12-14 23:50:29 +00:00
|
|
|
|
2020-09-13 04:07:39 +00:00
|
|
|
float Get_x324() const { return x324_; }
|
2020-09-07 00:18:46 +00:00
|
|
|
void SetThermalMag(float val) { x32c_thermalMag = val; }
|
2020-01-06 04:24:54 +00:00
|
|
|
void SetIsCold(bool v) { x334_isCold = v; }
|
|
|
|
bool IsUsingPhazonModel() const { return x335_usePhazonModel; }
|
|
|
|
void UsePhazonModel() {
|
|
|
|
SetModelData(std::make_unique<CModelData>(x2d8_phazonModel));
|
|
|
|
x335_usePhazonModel = true;
|
|
|
|
/* This used to be in the constructor, since we can't store CModelData directly in the class we must set it here */
|
|
|
|
GetModelData()->SetSortThermal(true);
|
|
|
|
}
|
2020-09-05 21:51:21 +00:00
|
|
|
|
|
|
|
void Set_x340(bool v) { x340_ = v; }
|
2017-03-31 19:51:40 +00:00
|
|
|
};
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|