mirror of https://github.com/AxioDL/metaforce.git
Initial CChozoGhost imp
This commit is contained in:
parent
9c5dec94c6
commit
8d90edd55f
|
@ -121,7 +121,7 @@ struct BehaveChance : BigDNA {
|
||||||
Value<float> unknown4;
|
Value<float> unknown4;
|
||||||
Value<float> unknown5;
|
Value<float> unknown5;
|
||||||
Value<float> unknown6;
|
Value<float> unknown6;
|
||||||
Value<float> unknown7;
|
Value<atUint32> unknown7;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DamageInfo : BigDNA {
|
struct DamageInfo : BigDNA {
|
||||||
|
|
|
@ -101,9 +101,7 @@ bool CMemoryCardSys::InitializePump() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!x0_hints.IsLoaded() || !x0_hints.GetObj())
|
return !(!x0_hints.IsLoaded() || !x0_hints.GetObj());
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool done = true;
|
bool done = true;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#include "Runtime/MP1/World/CChozoGhost.hpp"
|
#include "Runtime/MP1/World/CChozoGhost.hpp"
|
||||||
|
|
||||||
|
#include "Runtime/CStateManager.hpp"
|
||||||
|
#include "Runtime/CRandom16.hpp"
|
||||||
|
|
||||||
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
namespace urde::MP1 {
|
namespace urde::MP1 {
|
||||||
CChozoGhost::CBehaveChance::CBehaveChance(CInputStream& in)
|
CChozoGhost::CBehaveChance::CBehaveChance(CInputStream& in)
|
||||||
: x0_propertyCount(in.readUint32Big())
|
: x0_propertyCount(in.readUint32Big())
|
||||||
|
@ -17,6 +21,42 @@ CChozoGhost::CBehaveChance::CBehaveChance(CInputStream& in)
|
||||||
x10_ *= f2;
|
x10_ *= f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 CChozoGhost::CBehaveChance::GetBehave(EBehaveType type, CStateManager& mgr) const {
|
||||||
|
float dVar5 = x4_;
|
||||||
|
float dVar4 = x8_;
|
||||||
|
float dVar3 = xc_;
|
||||||
|
if (type == EBehaveType::Zero) {
|
||||||
|
float dVar2 = dVar5 / 3.f;
|
||||||
|
dVar5 = 0.f;
|
||||||
|
dVar4 += dVar2;
|
||||||
|
dVar3 += dVar2;
|
||||||
|
} else if (type == EBehaveType::One) {
|
||||||
|
float dVar2 = dVar4 / 3.f;
|
||||||
|
dVar4 = 0.f;
|
||||||
|
dVar5 += dVar2;
|
||||||
|
dVar3 += dVar2;
|
||||||
|
} else if (type == EBehaveType::Two) {
|
||||||
|
float dVar2 = dVar3 / 3.f;
|
||||||
|
dVar3 = 0.f;
|
||||||
|
dVar5 += dVar2;
|
||||||
|
dVar4 += dVar2;
|
||||||
|
} else if (type == EBehaveType::Three) {
|
||||||
|
float dVar2 = x10_ / 3.f;
|
||||||
|
dVar5 += dVar2;
|
||||||
|
dVar4 += dVar2;
|
||||||
|
dVar3 += dVar2;
|
||||||
|
}
|
||||||
|
|
||||||
|
float rnd = mgr.GetActiveRandom()->Float();
|
||||||
|
if (dVar5 > rnd)
|
||||||
|
return 0;
|
||||||
|
else if (dVar4 > (rnd - dVar5))
|
||||||
|
return 1;
|
||||||
|
else if (dVar3 > (rnd - dVar5) - dVar4)
|
||||||
|
return 2;
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
CChozoGhost::CChozoGhost(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
CChozoGhost::CChozoGhost(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
CModelData&& mData, const CActorParameters& actParms, const CPatternedInfo& pInfo, float f1,
|
CModelData&& mData, const CActorParameters& actParms, const CPatternedInfo& pInfo, float f1,
|
||||||
float f2, float f3, float f4, CAssetId wpsc1, const CDamageInfo& dInfo1, CAssetId wpsc2,
|
float f2, float f3, float f4, CAssetId wpsc1, const CDamageInfo& dInfo1, CAssetId wpsc2,
|
||||||
|
@ -40,5 +80,26 @@ CChozoGhost::CChozoGhost(TUniqueId uid, std::string_view name, const CEntityInfo
|
||||||
, x632_(sId3)
|
, x632_(sId3)
|
||||||
, x634_(f6)
|
, x634_(f6)
|
||||||
, x638_(f7)
|
, x638_(f7)
|
||||||
, x63c_(w2) {}
|
, x63c_(w2)
|
||||||
|
, x650_(sId4)
|
||||||
|
, x654_(f8)
|
||||||
|
, x658_(f9)
|
||||||
|
, x65c_(w3)
|
||||||
|
, x660_(w4)
|
||||||
|
, x664_24_(w1)
|
||||||
|
, x664_25_(w1)
|
||||||
|
, x664_26_(false)
|
||||||
|
, x664_27_(false)
|
||||||
|
, x664_28_(false)
|
||||||
|
, x664_29_(false)
|
||||||
|
, x664_30_(false)
|
||||||
|
, x664_31_(false)
|
||||||
|
, x665_24_(true)
|
||||||
|
, x665_25_(false)
|
||||||
|
, x665_26_(false)
|
||||||
|
, x665_27_(false)
|
||||||
|
, x665_28_(false)
|
||||||
|
, x665_29_(false)
|
||||||
|
, x68c_boneTracking(*GetModelData()->GetAnimationData(), "Head_1"sv, zeus::degToRad(80.f), zeus::degToRad(180.f),
|
||||||
|
EBoneTrackingFlags::None) {}
|
||||||
} // namespace urde::MP1
|
} // namespace urde::MP1
|
|
@ -10,6 +10,13 @@
|
||||||
#include <zeus/CVector3f.hpp>
|
#include <zeus/CVector3f.hpp>
|
||||||
|
|
||||||
namespace urde::MP1 {
|
namespace urde::MP1 {
|
||||||
|
enum class EBehaveType {
|
||||||
|
Zero,
|
||||||
|
One,
|
||||||
|
Two,
|
||||||
|
Three
|
||||||
|
};
|
||||||
|
|
||||||
class CChozoGhost : public CPatterned {
|
class CChozoGhost : public CPatterned {
|
||||||
public:
|
public:
|
||||||
class CBehaveChance {
|
class CBehaveChance {
|
||||||
|
@ -24,6 +31,8 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CBehaveChance(CInputStream&);
|
CBehaveChance(CInputStream&);
|
||||||
|
|
||||||
|
u32 GetBehave(EBehaveType type, CStateManager& mgr) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -72,15 +81,17 @@ private:
|
||||||
float x66c_ = 0.f;
|
float x66c_ = 0.f;
|
||||||
float x670_ = 0.f;
|
float x670_ = 0.f;
|
||||||
TUniqueId x674_ = kInvalidUniqueId;
|
TUniqueId x674_ = kInvalidUniqueId;
|
||||||
|
float x678_ = 0.f;
|
||||||
u32 x67c_ = -1;
|
u32 x67c_ = -1;
|
||||||
u32 x680_;
|
u32 x680_ = 0;
|
||||||
float x684_ = 1.f;
|
float x684_ = 1.f;
|
||||||
CSteeringBehaviors x688_;
|
CSteeringBehaviors x688_;
|
||||||
//CBoneTracking x68c_boneTracking;
|
CBoneTracking x68c_boneTracking;
|
||||||
TUniqueId x6c4_ = kInvalidUniqueId;
|
TUniqueId x6c4_ = kInvalidUniqueId;
|
||||||
float x6c8_ = 0.f;
|
float x6c8_ = 0.f;
|
||||||
zeus::CVector3f x6cc_;
|
zeus::CVector3f x6cc_;
|
||||||
u32 x6d8_ = 1;
|
u32 x6d8_ = 1;
|
||||||
|
u32 x6dc_;
|
||||||
public:
|
public:
|
||||||
DEFINE_PATTERNED(ChozoGhost)
|
DEFINE_PATTERNED(ChozoGhost)
|
||||||
|
|
||||||
|
@ -89,5 +100,7 @@ public:
|
||||||
CAssetId, const CDamageInfo&, const CChozoGhost::CBehaveChance&, const CChozoGhost::CBehaveChance&,
|
CAssetId, const CDamageInfo&, const CChozoGhost::CBehaveChance&, const CChozoGhost::CBehaveChance&,
|
||||||
const CBehaveChance&, u16, float, u16, u16, u32, float, u32, float, CAssetId, s16, float, float, u32,
|
const CBehaveChance&, u16, float, u16, u16, u32, float, u32, float, CAssetId, s16, float, float, u32,
|
||||||
u32);
|
u32);
|
||||||
|
|
||||||
|
float GetGravityConstant() const { return 60.f; }
|
||||||
};
|
};
|
||||||
} // namespace urde::MP1
|
} // namespace urde::MP1
|
|
@ -207,8 +207,8 @@ void CActor::DrawTouchBounds() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CActor::RenderInternal(const CStateManager& mgr) const {
|
void CActor::RenderInternal(const CStateManager& mgr) const {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CActor::RenderInternal {} {} {}"),
|
SCOPED_GRAPHICS_DEBUG_GROUP(
|
||||||
x8_uid, xc_editorId, x10_name).c_str(), zeus::skOrange);
|
fmt::format(fmt("CActor::RenderInternal {} {} {}"), x8_uid, xc_editorId, x10_name).c_str(), zeus::skOrange);
|
||||||
|
|
||||||
CModelData::EWhichModel which = CModelData::GetRenderingModel(mgr);
|
CModelData::EWhichModel which = CModelData::GetRenderingModel(mgr);
|
||||||
if (which == CModelData::EWhichModel::ThermalHot) {
|
if (which == CModelData::EWhichModel::ThermalHot) {
|
||||||
|
@ -265,8 +265,8 @@ void CActor::Render(const CStateManager& mgr) const {
|
||||||
if (xe5_29_globalTimeProvider) {
|
if (xe5_29_globalTimeProvider) {
|
||||||
RenderInternal(mgr);
|
RenderInternal(mgr);
|
||||||
} else {
|
} else {
|
||||||
float timeSince = CGraphics::GetSecondsMod900() - xbc_time;
|
const float timeSince = CGraphics::GetSecondsMod900() - xbc_time;
|
||||||
float tpTime = timeSince - std::floor(timeSince / 900.f) * 900.f;
|
const float tpTime = timeSince - std::floor(timeSince / 900.f) * 900.f;
|
||||||
CTimeProvider tp(tpTime);
|
CTimeProvider tp(tpTime);
|
||||||
RenderInternal(mgr);
|
RenderInternal(mgr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue