CFlyingPirate: Start implementation

This commit is contained in:
Luke Street 2020-03-12 01:36:13 -04:00
parent 36ac0a8d78
commit e925dc2628
2 changed files with 182 additions and 2 deletions

View File

@ -1,10 +1,108 @@
#include "Runtime/MP1/World/CFlyingPirate.hpp"
#include "Runtime/CSimplePool.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/World/CPatternedInfo.hpp"
#include "Runtime/Character/CPASAnimParmData.hpp"
namespace urde::MP1 {
namespace {
constexpr std::array<SBurst, 6> skBurst1{{
{4, {3, 4, 11, 12, -1, 0, 0, 0}, 0.1f, 0.05f},
{20, {2, 3, 4, 5, -1, 0, 0, 0}, 0.1f, 0.05f},
{20, {10, 11, 12, 13, -1, 0, 0, 0}, 0.1f, 0.05f},
{25, {15, 16, 1, 2, -1, 0, 0, 0}, 0.1f, 0.05f},
{25, {5, 6, 7, 8, -1, 0, 0, 0}, 0.1f, 0.05f},
{0, {0, 0, 0, 0, 0, 0, 0, 0}, 0.000000, 0.000000},
}};
constexpr std::array<SBurst, 6> skBurst2{{
{5, {3, 4, 8, 12, -1, 0, 0, 0}, 0.1f, 0.05f},
{10, {2, 3, 4, 5, -1, 0, 0, 0}, 0.1f, 0.05f},
{10, {10, 11, 12, 13, -1, 0, 0, 0}, 0.1f, 0.05f},
{40, {15, 16, 1, 2, -1, 0, 0, 0}, 0.1f, 0.05f},
{35, {5, 6, 7, 8, -1, 0, 0, 0}, 0.1f, 0.05f},
{0, {0, 0, 0, 0, 0, 0, 0, 0}, 0.000000, 0.000000},
}};
constexpr std::array<SBurst, 5> skBurst3{{
{30, {3, 4, 5, 11, 12, 4, -1, 0}, 0.1f, 0.05f},
{20, {2, 3, 4, 5, 4, 3, -1, 0}, 0.1f, 0.05f},
{20, {5, 4, 3, 13, 12, 11, -1, 0}, 0.1f, 0.05f},
{30, {1, 2, 3, 4, 5, 6, -1, 0}, 0.1f, 0.05f},
{0, {0, 0, 0, 0, 0, 0, 0, 0}, 0.000000, 0.000000},
}};
constexpr std::array<SBurst, 5> skBurst4{{
{10, {6, 5, 4, 14, 13, 12, -1, 0}, 0.1f, 0.05f},
{20, {14, 13, 12, 11, 10, 9, -1, 0}, 0.1f, 0.05f},
{20, {14, 15, 16, 11, 10, 9, -1, 0}, 0.1f, 0.05f},
{50, {11, 10, 9, 8, 7, 6, -1, 0}, 0.1f, 0.05f},
{0, {0, 0, 0, 0, 0, 0, 0, 0}, 0.000000, 0.000000},
}};
constexpr std::array<const SBurst*, 5> skBursts{
skBurst1.data(), skBurst2.data(), skBurst3.data(), skBurst4.data(), nullptr,
};
} // namespace
CFlyingPirate::CFlyingPirateData::CFlyingPirateData(CInputStream& in, u32 propCount)
: x0_(in.readFloatBig())
, x4_(in.readFloatBig())
, x8_(in.readInt32Big())
, xc_projInfo1(in)
, x34_sfx1(in.readUint16Big())
, x38_projInfo2(in)
, x60_projInfo3(in.readInt32Big(), {})
, x88_(in.readFloatBig())
, x8c_(in.readFloatBig())
, x90_particleGenDesc(g_SimplePool->GetObj({SBIG('PART'), in.readInt32Big()}))
, x9c_dInfo(in)
, xb8_(in.readFloatBig())
, xbc_(in.readFloatBig())
, xc0_(in.readFloatBig())
, xc4_(in.readFloatBig())
, xca_sfx3(in.readUint16Big())
, xcc_(in.readFloatBig())
, xd0_(in.readFloatBig())
, xd4_(in.readFloatBig())
, xd8_(in)
, xdc_(in)
, xe0_(in)
, xe4_sfx4(in.readUint16Big())
, xe6_sfx5(in.readUint16Big())
, xe8_(in.readFloatBig())
, xec_(in.readFloatBig())
, xf0_(propCount < 36 ? 0.f : in.readFloatBig()) {
xc_projInfo1.Token().Lock();
x38_projInfo2.Token().Lock();
x60_projInfo3.Token().Lock();
}
CFlyingPirate::CFlyingPirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CActorParameters& actParms, const CPatternedInfo& pInfo,
CInputStream& in, u32 propCount)
: CPatterned(ECharacter::FlyingPirate, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Flyer, EColliderType::One, EBodyType::NewFlyer, actParms, EKnockBackVariant::Medium) {}
EMovementType::Ground, EColliderType::One, EBodyType::NewFlyer, actParms, EKnockBackVariant::Medium)
, x568_data(in, propCount)
, x6a8_pathFindSearch(nullptr, 0 /* TODO */, pInfo.GetHalfExtent(), pInfo.GetHeight(), pInfo.GetPathfindingIndex())
, x7a0_boneTracking(*GetModelData()->GetAnimationData(), "Head_1", zeus::degToRad(80.f), zeus::degToRad(180.f),
EBoneTrackingFlags::None)
, x7ec_burstFire(skBursts.data(), 0) {
CModelData* modelData = GetModelData();
CAnimData* animData = modelData->GetAnimationData();
x798_ = animData->GetLocatorSegId("Head_1");
x7e0_ = animData->GetLocatorSegId("L_gun_LCTR");
x864_missileSegments.push_back(animData->GetLocatorSegId("L_Missile_LCTR"));
x864_missileSegments.push_back(animData->GetLocatorSegId("R_Missile_LCTR"));
x850_ = modelData->GetScale().x() * GetAnimationDistance({3, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(1)});
if (x568_data.xd8_.IsValid() && x568_data.xdc_.IsValid() && x568_data.xe0_.IsValid()) {
x65c_particleGenDescs.push_back(g_SimplePool->GetObj({SBIG('PART'), x568_data.xd8_}));
x65c_particleGenDescs.push_back(g_SimplePool->GetObj({SBIG('PART'), x568_data.xdc_}));
x65c_particleGenDescs.push_back(g_SimplePool->GetObj({SBIG('PART'), x568_data.xe0_}));
for (const auto& desc : x65c_particleGenDescs) {
x684_particleGens.push_back(std::make_unique<CElementGen>(desc));
}
}
x460_knockBackController.SetLocomotionDuringElectrocution(true);
}
} // namespace urde::MP1

View File

@ -1,5 +1,10 @@
#pragma once
#include "Runtime/Character/CBoneTracking.hpp"
#include "Runtime/Particle/CElementGen.hpp"
#include "Runtime/Weapon/CBurstFire.hpp"
#include "Runtime/Weapon/CProjectileInfo.hpp"
#include "Runtime/World/CPathFindSearch.hpp"
#include "Runtime/World/CPatterned.hpp"
namespace urde::MP1 {
@ -7,7 +12,84 @@ class CFlyingPirate : public CPatterned {
public:
DEFINE_PATTERNED(FlyingPirate)
private:
class CFlyingPirateData {
friend class CFlyingPirate;
float x0_;
float x4_;
int x8_;
CProjectileInfo xc_projInfo1;
u16 x34_sfx1;
CProjectileInfo x38_projInfo2;
CProjectileInfo x60_projInfo3;
float x88_;
float x8c_;
TCachedToken<CGenDescription> x90_particleGenDesc;
CDamageInfo x9c_dInfo;
float xb8_;
float xbc_;
float xc0_;
float xc4_;
u16 xc8_sfx2;
u16 xca_sfx3;
float xcc_;
float xd0_;
float xd4_;
CAssetId xd8_;
CAssetId xdc_;
CAssetId xe0_;
u16 xe4_sfx4;
u16 xe6_sfx5;
float xe8_;
float xec_;
float xf0_;
public:
CFlyingPirateData(CInputStream& in, u32 propCount);
};
public:
CFlyingPirate(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CActorParameters&, const CPatternedInfo&, CInputStream&, u32);
private:
CFlyingPirateData x568_data;
rstl::reserved_vector<TCachedToken<CGenDescription>, 4> x65c_particleGenDescs;
rstl::reserved_vector<std::unique_ptr<CElementGen>, 16> x684_particleGens;
char x6a0_flags1; // TODO
char x6a1_flags2; // TODO
char x6a2_flags3; // TODO
TUniqueId x6a4_id1 = kInvalidUniqueId;
TUniqueId x6a6_id2 = kInvalidUniqueId;
CPathFindSearch x6a8_pathFindSearch;
int x790_ = 0;
int x794_health;
CSegId x798_;
int x79c_ = -1;
CBoneTracking x7a0_boneTracking;
float x7d8_ = 0.f;
int x7dc_ = 0;
CSegId x7e0_;
float x7e4_ = 1.f;
TUniqueId x7e8_id3 = kInvalidUniqueId;
CBurstFire x7ec_burstFire;
int x84c_ = -1;
float x850_ = 3.f;
float x854_ = FLT_MAX;
float x858_ = FLT_MAX;
TUniqueId x85c_ = kInvalidUniqueId;
float x860_ = 15.f;
rstl::reserved_vector<CSegId, 4> x864_missileSegments;
float x86c_ = 0.f;
zeus::CVector3f x870_ = zeus::skZero3f;
zeus::CVector3f x87c_ = zeus::skZero3f;
float x888_ = 10.f;
float x88c_ = 3.f;
TUniqueId x890_ = kInvalidUniqueId;
float x894_ = 1.f;
float x898_ = 1.f;
// CFlyingPirateRagDoll x89c_ragDoll; TODO
TUniqueId x8a0_ = kInvalidUniqueId;
float x8a4_ = 0.f;
};
} // namespace urde::MP1