Initial CChozoGhost stubs

This commit is contained in:
Phillip Stephens 2020-03-04 05:32:41 -08:00
parent 2f9dd38bbe
commit d91e86a94a
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
2 changed files with 205 additions and 64 deletions

View File

@ -1,30 +1,33 @@
#include "Runtime/MP1/World/CChozoGhost.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/CStateManager.hpp"
#include "Runtime/CSimplePool.hpp"
#include "Runtime/CRandom16.hpp"
#include "Runtime/Character/CPASAnimParmData.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
namespace urde::MP1 {
CChozoGhost::CBehaveChance::CBehaveChance(CInputStream& in)
: x0_propertyCount(in.readUint32Big())
, x4_(in.readFloatBig())
, x4_lurk(in.readFloatBig())
, x8_(in.readFloatBig())
, xc_(in.readFloatBig())
, x10_(in.readFloatBig())
, x14_(in.readFloatBig())
, x18_(x0_propertyCount <= 5 ? 0.5f : in.readFloatBig() * .01f)
, x1c_(x0_propertyCount <= 6 ? 2 : in.readUint32Big()) {
float f2 = 1.f / (x10_ + xc_ + x4_ + x8_);
x4_ *= f2;
, xc_attack(in.readFloatBig())
, x10_move(in.readFloatBig())
, x14_lurkTime(in.readFloatBig())
, x18_chargeAttack(x0_propertyCount <= 5 ? 0.5f : in.readFloatBig() * .01f)
, x1c_numBolts(x0_propertyCount <= 6 ? 2 : in.readUint32Big()) {
float f2 = 1.f / (x10_move + xc_attack + x4_lurk + x8_);
x4_lurk *= f2;
x8_ *= f2;
xc_ *= f2;
x10_ *= f2;
xc_attack *= f2;
x10_move *= f2;
}
u32 CChozoGhost::CBehaveChance::GetBehave(EBehaveType type, CStateManager& mgr) const {
float dVar5 = x4_;
float dVar5 = x4_lurk;
float dVar4 = x8_;
float dVar3 = xc_;
float dVar3 = xc_attack;
if (type == EBehaveType::Zero) {
float dVar2 = dVar5 / 3.f;
dVar5 = 0.f;
@ -41,7 +44,7 @@ u32 CChozoGhost::CBehaveChance::GetBehave(EBehaveType type, CStateManager& mgr)
dVar5 += dVar2;
dVar4 += dVar2;
} else if (type == EBehaveType::Three) {
float dVar2 = x10_ / 3.f;
float dVar2 = x10_move / 3.f;
dVar5 += dVar2;
dVar4 += dVar2;
dVar3 += dVar2;
@ -58,35 +61,37 @@ u32 CChozoGhost::CBehaveChance::GetBehave(EBehaveType type, CStateManager& mgr)
}
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,
float f2, float f3, float f4, CAssetId wpsc1, const CDamageInfo& dInfo1, CAssetId wpsc2,
const CDamageInfo& dInfo2, const CBehaveChance& chance1, const CBehaveChance& chance2,
const CBehaveChance& chance3, u16 sId1, float f5, u16 sId2, u16 sId3, u32 w1, float f6, u32 w2,
float f7, CAssetId partId, s16 sId4, float f8, float f9, u32 w3, u32 w4)
CModelData&& mData, const CActorParameters& actParms, const CPatternedInfo& pInfo,
float hearingRadius, float fadeOutDelay, float attackDelay, float freezeTime, CAssetId wpsc1,
const CDamageInfo& dInfo1, CAssetId wpsc2, const CDamageInfo& dInfo2,
const CBehaveChance& chance1, const CBehaveChance& chance2, const CBehaveChance& chance3,
u16 soundImpact, float f5, u16 sId2, u16 sId3, u32 w1, float f6, u32 w2, float hurlRecoverTime,
CAssetId projectileVisorEffect, s16 soundProjectileVisor, float f8, float f9, u32 nearChance,
u32 midChance)
: CPatterned(ECharacter::ChozoGhost, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Flyer, EColliderType::Zero, EBodyType::BiPedal, actParms, EKnockBackVariant::Medium)
, x568_(f1)
, x56c_(f2)
, x570_(f3)
, x574_(f4)
, x568_hearingRadius(hearingRadius)
, x56c_fadeOutDelay(fadeOutDelay)
, x570_attackDelay(attackDelay)
, x574_freezeTime(freezeTime)
, x578_(wpsc1, dInfo1)
, x5a0_(wpsc2, dInfo2)
, x5c8_(chance1)
, x5e8_(chance2)
, x608_(chance3)
, x628_(sId1)
, x628_soundImpact(soundImpact)
, x62c_(f5)
, x630_(sId2)
, x632_(sId3)
, x634_(f6)
, x638_(f7)
, x638_hurlRecoverTime(hurlRecoverTime)
, x63c_(w2)
, x650_(sId4)
, x650_sound_ProjectileVisor(soundProjectileVisor)
, x654_(f8)
, x658_(f9)
, x65c_(w3)
, x660_(w4)
, x664_24_(w1)
, x65c_nearChance(nearChance)
, x660_midChance(midChance)
, x664_24_onGround(w1)
, x664_25_(w1)
, x664_26_(false)
, x664_27_(false)
@ -100,6 +105,107 @@ CChozoGhost::CChozoGhost(TUniqueId uid, std::string_view name, const CEntityInfo
, x665_27_(false)
, x665_28_(false)
, x665_29_(false)
, x680_(x664_24_onGround ? 2 : 4)
, x68c_boneTracking(*GetModelData()->GetAnimationData(), "Head_1"sv, zeus::degToRad(80.f), zeus::degToRad(180.f),
EBoneTrackingFlags::None) {}
EBoneTrackingFlags::None) {
x578_.Token().Lock();
x5a0_.Token().Lock();
x668_ = GetModelData()->GetScale().z() *
GetAnimationDistance(CPASAnimParmData(13, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(0)));
x66c_ = GetModelData()->GetScale().z() *
GetAnimationDistance(CPASAnimParmData(15, CPASAnimParm::FromEnum(1), CPASAnimParm::FromReal32(90.f)));
x670_ = GetModelData()->GetScale().z() *
GetAnimationDistance(CPASAnimParmData(7, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(2)));
if (projectileVisorEffect.IsValid())
x640_ = g_SimplePool->GetObj({SBIG('PART'), projectileVisorEffect});
x460_knockBackController.SetEnableBurn(false);
x460_knockBackController.SetEnableLaggedBurnDeath(false);
x460_knockBackController.SetEnableShock(false);
x460_knockBackController.SetEnableFreeze(false);
CreateShadow(false);
MakeThermalColdAndHot();
}
void CChozoGhost::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
CPatterned::AcceptScriptMsg(msg, uid, mgr);
}
void CChozoGhost::Think(float dt, CStateManager& mgr) { CPatterned::Think(dt, mgr); }
void CChozoGhost::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) { CPatterned::PreRender(mgr, frustum); }
void CChozoGhost::Render(const CStateManager& mgr) const { CPatterned::Render(mgr); }
void CChozoGhost::Touch(CActor& act, CStateManager& mgr) { CPatterned::Touch(act, mgr); }
EWeaponCollisionResponseTypes CChozoGhost::GetCollisionResponseType(const zeus::CVector3f& pos,
const zeus::CVector3f& dir, const CWeaponMode& mode,
EProjectileAttrib attrib) const {
return CAi::GetCollisionResponseType(pos, dir, mode, attrib);
}
void CChozoGhost::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
CPatterned::DoUserAnimEvent(mgr, node, type, dt);
}
void CChozoGhost::KnockBack(const zeus::CVector3f& dir, CStateManager& mgr, const CDamageInfo& info,
EKnockBackType type, bool inDeferred, float magnitude) {
CPatterned::KnockBack(dir, mgr, info, type, inDeferred, magnitude);
}
bool CChozoGhost::CanBeShot(const CStateManager& mgr, int w1) { return CAi::CanBeShot(mgr, w1); }
void CChozoGhost::Dead(CStateManager& mgr, EStateMsg msg, float arg) { CPatterned::Dead(mgr, msg, arg); }
void CChozoGhost::SelectTarget(CStateManager& mgr, EStateMsg msg, float arg) { CAi::SelectTarget(mgr, msg, arg); }
void CChozoGhost::Run(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Run(mgr, msg, arg); }
void CChozoGhost::Generate(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Generate(mgr, msg, arg); }
void CChozoGhost::Deactivate(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Deactivate(mgr, msg, arg); }
void CChozoGhost::Attack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Attack(mgr, msg, arg); }
void CChozoGhost::Shuffle(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Shuffle(mgr, msg, arg); }
void CChozoGhost::InActive(CStateManager& mgr, EStateMsg msg, float arg) { CAi::InActive(mgr, msg, arg); }
void CChozoGhost::Taunt(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Taunt(mgr, msg, arg); }
void CChozoGhost::Hurled(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Hurled(mgr, msg, arg); }
void CChozoGhost::WallDetach(CStateManager& mgr, EStateMsg msg, float arg) { CAi::WallDetach(mgr, msg, arg); }
void CChozoGhost::Growth(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Growth(mgr, msg, arg); }
void CChozoGhost::Land(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Land(mgr, msg, arg); }
bool CChozoGhost::Leash(CStateManager& mgr, float arg) { return CPatterned::Leash(mgr, arg); }
bool CChozoGhost::InRange(CStateManager& mgr, float arg) { return CPatterned::InRange(mgr, arg); }
bool CChozoGhost::InPosition(CStateManager& mgr, float arg) { return CPatterned::InPosition(mgr, arg); }
bool CChozoGhost::AggressionCheck(CStateManager& mgr, float arg) { return CAi::AggressionCheck(mgr, arg); }
bool CChozoGhost::ShouldTaunt(CStateManager& mgr, float arg) { return CAi::ShouldTaunt(mgr, arg); }
bool CChozoGhost::ShouldFlinch(CStateManager& mgr, float arg) { return CAi::ShouldFlinch(mgr, arg); }
bool CChozoGhost::ShouldMove(CStateManager& mgr, float arg) { return CAi::ShouldMove(mgr, arg); }
bool CChozoGhost::AIStage(CStateManager& mgr, float arg) { return CAi::AIStage(mgr, arg); }
u8 CChozoGhost::GetModelAlphau8(const CStateManager& mgr) const {
if (mgr.GetPlayerState()->GetActiveVisor(mgr) != CPlayerState::EPlayerVisor::XRay || !IsAlive())
return u8(x42c_color.a() * 255);
return 255;
}
bool CChozoGhost::IsOnGround() const { return x664_24_onGround; }
CProjectileInfo* CChozoGhost::GetProjectileInfo() { return CPatterned::GetProjectileInfo(); }
} // namespace urde::MP1

View File

@ -21,13 +21,13 @@ class CChozoGhost : public CPatterned {
public:
class CBehaveChance {
u32 x0_propertyCount;
float x4_;
float x4_lurk;
float x8_;
float xc_;
float x10_;
float x14_;
float x18_;
u32 x1c_;
float xc_attack;
float x10_move;
float x14_lurkTime;
float x18_chargeAttack;
u32 x1c_numBolts;
public:
CBehaveChance(CInputStream&);
@ -36,47 +36,42 @@ public:
};
private:
float x568_;
float x56c_;
float x570_;
float x574_;
float x568_hearingRadius;
float x56c_fadeOutDelay;
float x570_attackDelay;
float x574_freezeTime;
CProjectileInfo x578_;
CProjectileInfo x5a0_;
CBehaveChance x5c8_;
CBehaveChance x5e8_;
CBehaveChance x608_;
s16 x628_;
s16 x628_soundImpact;
float x62c_;
s16 x630_;
s16 x632_;
float x634_;
float x638_;
float x638_hurlRecoverTime;
u32 x63c_;
TLockedToken<CGenDescription> x640_;
s16 x650_;
s16 x650_sound_ProjectileVisor;
float x654_;
float x658_;
u32 x65c_;
u32 x660_;
union {
struct {
bool x664_24_ : 1;
bool x664_25_ : 1;
bool x664_26_ : 1;
bool x664_27_ : 1;
bool x664_28_ : 1;
bool x664_29_ : 1;
bool x664_30_ : 1;
bool x664_31_ : 1;
bool x665_24_ : 1;
bool x665_25_ : 1;
bool x665_26_ : 1;
bool x665_27_ : 1;
bool x665_28_ : 1;
bool x665_29_ : 1;
};
u32 _dummy = 0;
};
u32 x65c_nearChance;
u32 x660_midChance;
bool x664_24_onGround : 1;
bool x664_25_ : 1;
bool x664_26_ : 1;
bool x664_27_ : 1;
bool x664_28_ : 1;
bool x664_29_ : 1;
bool x664_30_ : 1;
bool x664_31_ : 1;
bool x665_24_ : 1;
bool x665_25_ : 1;
bool x665_26_ : 1;
bool x665_27_ : 1;
bool x665_28_ : 1;
bool x665_29_ : 1;
float x668_ = 0.f;
float x66c_ = 0.f;
float x670_ = 0.f;
@ -92,6 +87,7 @@ private:
zeus::CVector3f x6cc_;
u32 x6d8_ = 1;
u32 x6dc_;
CTeamAiMgr
public:
DEFINE_PATTERNED(ChozoGhost)
@ -101,6 +97,45 @@ public:
const CBehaveChance&, u16, float, u16, u16, u32, float, u32, float, CAssetId, s16, float, float, u32,
u32);
float GetGravityConstant() const { return 60.f; }
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
void Think(float dt, CStateManager&) override;
void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) override;
void Render(const CStateManager& mgr) const override;
void Touch(CActor& act, CStateManager& mgr) override;
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
const CWeaponMode& mode, EProjectileAttrib attrib) const override;
void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) override;
void KnockBack(const zeus::CVector3f& dir, CStateManager& mgr, const CDamageInfo& info, EKnockBackType type,
bool inDeferred, float magnitude) override;
bool CanBeShot(const CStateManager& mgr, int w1) override;
zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
const zeus::CVector3f& aimPos) const override {
return x34_transform.origin;
}
void Dead(CStateManager& mgr, EStateMsg msg, float arg) override;
void SelectTarget(CStateManager& mgr, EStateMsg msg, float arg) override;
void Run(CStateManager& mgr, EStateMsg msg, float arg) override;
void Generate(CStateManager& mgr, EStateMsg msg, float arg) override;
void Deactivate(CStateManager& mgr, EStateMsg msg, float arg) override;
void Attack(CStateManager& mgr, EStateMsg msg, float arg) override;
void Shuffle(CStateManager& mgr, EStateMsg msg, float arg) override;
void InActive(CStateManager& mgr, EStateMsg msg, float arg) override;
void Taunt(CStateManager& mgr, EStateMsg msg, float arg) override;
void Hurled(CStateManager& mgr, EStateMsg msg, float arg) override;
void WallDetach(CStateManager& mgr, EStateMsg msg, float arg) override;
void Growth(CStateManager& mgr, EStateMsg msg, float arg) override;
void Land(CStateManager& mgr, EStateMsg msg, float arg) override;
bool Leash(CStateManager& mgr, float arg) override;
bool InRange(CStateManager& mgr, float arg) override;
bool InPosition(CStateManager& mgr, float arg) override;
bool AggressionCheck(CStateManager& mgr, float arg) override;
bool ShouldTaunt(CStateManager& mgr, float arg) override;
bool ShouldFlinch(CStateManager& mgr, float arg) override;
bool ShouldMove(CStateManager& mgr, float arg) override;
bool AIStage(CStateManager& mgr, float arg) override;
u8 GetModelAlphau8(const CStateManager&) const override;
bool IsOnGround() const override;
float GetGravityConstant() const override { return 60.f; }
CProjectileInfo* GetProjectileInfo() override;
};
} // namespace urde::MP1