Initial CDrone imps

This commit is contained in:
Phillip Stephens 2020-04-04 04:46:22 -07:00
parent d033ddeb1d
commit ff0cf969c2
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
4 changed files with 170 additions and 14 deletions

View File

@ -19,7 +19,7 @@ struct Drone : IScriptObject {
Value<atUint32> unknown3;
DamageInfo damageInfo2;
UniqueID32 unknown4;
UniqueID32 unknown5;
Value<atUint32> unused;
UniqueID32 unknown6;
FlareDefinition flareDefinition1;
FlareDefinition flareDefinition2;
@ -73,6 +73,8 @@ struct Drone : IScriptObject {
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const override {
g_curSpec->flattenDependencies(unknown4, pathsOut);
g_curSpec->flattenDependencies(unknown6, pathsOut);
g_curSpec->flattenDependencies(crsc, pathsOut);
flareDefinition1.depIDs(pathsOut);
flareDefinition2.depIDs(pathsOut);

View File

@ -1,18 +1,76 @@
#include "Runtime/MP1/World/CDrone.hpp"
#include "Runtime/Audio/CSfxManager.hpp"
#include "Runtime/World/CPatternedInfo.hpp"
#include "Runtime/CSimplePool.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
namespace urde::MP1 {
CDrone::CDrone(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info,
const zeus::CTransform& xf, float f1, CModelData&& mData, const CPatternedInfo& pInfo,
const CActorParameters& actParms, EMovementType movement, EColliderType colliderType, EBodyType bodyType,
const CDamageInfo& dInfo1, CAssetId w1, const CDamageInfo& dInfo2, CAssetId w2,
const std::vector<CVisorFlare::CFlareDef>& flares, float f2, float f3, float f4, float f5, float f6,
float f7, float f8, float f9, float f10, float f11, float f12, float f13, float f14, float f15,
float f16, float f17, float f18, float f19, float f20, float f21, float f22, float f23, float f24,
CAssetId w3, bool b1)
const CDamageInfo& dInfo1, CAssetId aId1, const CDamageInfo& dInfo2, CAssetId aId2,
std::vector<CVisorFlare::CFlareDef> flares, float f2, float f3, float f4, float f5, float f6, float f7,
float f8, float f9, float f10, float f11, float f12, float f13, float f14, float f15, float f16,
float f17, float f18, float f19, float f20, CAssetId crscId, float f21, float f22, float f23, float f24,
s32 sId, bool b1)
: CPatterned(ECharacter::Drone, uid, name, flavor, info, xf, std::move(mData), pInfo, movement, colliderType, bodyType,
actParms, EKnockBackVariant(flavor == EFlavorType::Zero)) {}
actParms, EKnockBackVariant(flavor == EFlavorType::Zero))
, x568_(aId1)
, x56c_(g_SimplePool->GetObj({SBIG('CRSC'), crscId}))
, x57c_flares(std::move(flares))
, x590_(dInfo1)
, x5ac_(dInfo2)
, x5e4_(f23)
, x5ec_(f1)
, x5f0_(f2)
, x5f4_(f3)
, x5f8_(f4)
, x5fc_(f5)
, x600_(f11)
, x608_(f6)
, x60c_(f7)
, x610_(f8)
, x614_(f9)
, x618_(f10)
, x61c_(f12)
, x620_(f20)
, x63c_(f13)
, x640_(f14)
, x648_(f15)
, x64c_(f16)
, x650_(f17)
, x654_(f18)
, x658_(f19)
, x65c_(f21)
, x660_(f22)
, x664_(f24)
, x690_(zeus::CSphere({0.f, 0.f, 1.8f}, 1.1f), CActor::GetMaterialList())
, x6b0_pathFind(nullptr, 3 + int(b1), pInfo.GetPathfindingIndex(), 1.f, 2.4f)
, x7cc_(CSfxManager::TranslateSFXID(sId))
, x82c_(std::make_unique<CModelData>(CStaticRes{aId2, zeus::skOne3f}))
, x830_13_(0)
, x830_10_(0)
, x834_24_(false)
, x834_25_(false)
, x834_26_(false)
, x834_27_(false)
, x834_28_(false)
, x834_29_(false)
, x834_30_(false)
, x834_31_(false)
, x835_24_(false)
, x835_25_(b1)
, x835_26_(false) {
UpdateTouchBounds(pInfo.GetHalfExtent());
x460_knockBackController.SetEnableShock(true);
x460_knockBackController.SetAvailableState(EKnockBackAnimationState::Hurled, false);
x460_knockBackController.SetLocomotionDuringElectrocution(true);
MakeThermalColdAndHot();
CreateShadow(flavor != EFlavorType::One);
}
void CDrone::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CDrone::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) {
@ -29,4 +87,11 @@ void CDrone::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateM
}
}
void CDrone::UpdateTouchBounds(float radius) {
const zeus::CTransform xf = GetLctrTransform("Skeleton_Root"sv);
const zeus::CVector3f diff = xf.origin - GetTranslation();
SetBoundingBox(zeus::CAABox{diff - radius, diff + radius});
x6b0_pathFind.SetRadius(0.25f + radius);
}
} // namespace urde::MP1

View File

@ -1,19 +1,107 @@
#pragma once
#include "Runtime/Collision/CCollidableSphere.hpp"
#include "Runtime/World/CPatterned.hpp"
#include "Runtime/World/CPathFindSearch.hpp"
#include "Runtime/World/CVisorFlare.hpp"
namespace urde::MP1 {
class CDrone : public CPatterned {
CAssetId x568_;
TLockedToken<CCollisionResponseData> x56c_;
CCollisionResponseData* x574_;
TUniqueId x578_ = kInvalidUniqueId;
TUniqueId x57a_ = kInvalidUniqueId;
std::vector<CVisorFlare::CFlareDef> x57c_flares;
u32 x58c_ = 2;
CDamageInfo x590_;
CDamageInfo x5ac_;
float x5c8_ = 0.f;
float x5cc_ = 0.f;
float x5d0_ = 0.f;
float x5d4_ = 0.f;
float x5d8_ = 0.f;
float x5dc_ = 0.f;
float x5e0_ = 0.f;
float x5e4_;
float x5e8_ = 0.f;
float x5ec_;
float x5f0_;
float x5f4_;
float x5f8_;
float x5fc_;
float x600_;
float x604_ = 0.f;
float x608_;
float x60c_;
float x610_;
float x614_;
float x618_;
float x61c_;
float x620_;
float x624_ = 0.f;
float x628_ = 0.f;
float x62c_ = 0.f;
float x630_ = 0.f;
float x634_ = 0.f;
float x638_ = 0.f;
float x63c_;
float x640_;
float x644_ = 0.f;
float x648_;
float x64c_;
float x650_;
float x654_;
float x658_;
float x65c_;
float x660_;
float x664_;
float x668_ = 0.f;
float x66c_ = 0.f;
zeus::CVector3f x670_;
zeus::CVector3f x67c_;
TUniqueId x688_ = kInvalidUniqueId;
CCollidableSphere x690_;
CPathFindSearch x6b0_pathFind;
zeus::CAxisAngle x794_;
zeus::CVector3f x7a0_;
float x7ac_ = 0.f;
float x7b0_ = 0.f;
float x7b4_ = 0.f;
float x7b8_ = 0.f;
float x7bc_ = 0.f;
s32 x7c8_ = 0;
s16 x7cc_;
s32 x7d0_ = 0;
rstl::reserved_vector<TUniqueId, 2> x7d4_;
rstl::reserved_vector<zeus::CVector3f, 2> x7e0_;
rstl::reserved_vector<zeus::CVector3f, 2> x7fc_;
rstl::reserved_vector<float, 2> x818_;
rstl::reserved_vector<bool, 2> x824_;
std::unique_ptr<CModelData> x82c_;
u8 x830_13_ : 2;
u8 x830_10_ : 2;
bool x834_24_ : 1;
bool x834_25_ : 1;
bool x834_26_ : 1;
bool x834_27_ : 1;
bool x834_28_ : 1;
bool x834_29_ : 1;
bool x834_30_ : 1;
bool x834_31_ : 1;
bool x835_24_ : 1;
bool x835_25_ : 1;
bool x835_26_ : 1;
void UpdateTouchBounds(float radius);
public:
DEFINE_PATTERNED(Drone);
CDrone(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info, const zeus::CTransform& xf,
float f1, CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
EMovementType movement, EColliderType colliderType, EBodyType bodyType, const CDamageInfo& dInfo1, CAssetId w1,
const CDamageInfo& dInfo2, CAssetId w2, const std::vector<CVisorFlare::CFlareDef>& flares, float f2, float f3,
float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13,
float f14, float f15, float f16, float f17, float f18, float f19, float f20, float f21, float f22, float f23,
float f24, CAssetId w3, bool b1);
EMovementType movement, EColliderType colliderType, EBodyType bodyType, const CDamageInfo& dInfo1,
CAssetId aId1, const CDamageInfo& dInfo2, CAssetId aId2, std::vector<CVisorFlare::CFlareDef> flares, float f2,
float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12,
float f13, float f14, float f15, float f16, float f17, float f18, float f19, float f20, CAssetId crscId,
float f21, float f22, float f23, float f24, s32 w3, bool b1);
void Accept(IVisitor& visitor);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr);

View File

@ -2076,18 +2076,19 @@ CEntity* ScriptLoader::LoadDrone(CStateManager& mgr, CInputStream& in, int propC
float f18 = in.readFloatBig();
float f19 = in.readFloatBig();
float f20 = in.readFloatBig();
CAssetId crscId(in);
float f21 = in.readFloatBig();
float f22 = in.readFloatBig();
float f23 = in.readFloatBig();
float f24 = in.readFloatBig();
CAssetId crscId(in);
s32 soundId = in.readUint32Big();
bool b1 = in.readBool();
CModelData mData(
CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true));
return new MP1::CDrone(mgr.AllocateUniqueId(), name, flavor, info, xf, f1, std::move(mData), pInfo, actParms,
CPatterned::EMovementType::Flyer, CPatterned::EColliderType::One, EBodyType::Pitchable, dInfo1,
aId2, dInfo2, aId2, flares, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16,
f17, f18, f19, f20, f21, f22, f23, f24, crscId, b1);
f17, f18, f19, f20, crscId, f21, f22, f23, f24, soundId, b1);
}
CEntity* ScriptLoader::LoadMetroid(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {