CElitePirate: Start impl; create CGrenadeLauncher

This commit is contained in:
Luke Street 2020-03-26 03:30:54 -04:00
parent 566c356612
commit c33703bd93
7 changed files with 425 additions and 51 deletions

View File

@ -1,15 +1,41 @@
#include "Runtime/MP1/World/CElitePirate.hpp"
#include "Runtime/Collision/CCollisionActor.hpp"
#include "Runtime/Collision/CCollisionActorManager.hpp"
#include "Runtime/CSimplePool.hpp"
#include "Runtime/CStateManager.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/World/CPatternedInfo.hpp"
#include "Runtime/World/CPlayer.hpp"
#include "Runtime/World/ScriptLoader.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
namespace urde::MP1 {
namespace {
static constexpr std::array<SJointInfo, 3> skJointInfoL{{
{"L_shoulder", "L_elbow", 1.f, 1.5f},
{"L_wrist", "L_elbow", 0.9f, 1.3f},
{"L_knee", "L_ankle", 0.9f, 1.3f},
}};
static constexpr std::array<SJointInfo, 3> skJointInfoR{{
{"R_shoulder", "R_elbow", 1.f, 1.5f},
{"R_wrist", "R_elbow", 0.9f, 1.3f},
{"R_knee", "R_ankle", 0.9f, 1.3f},
}};
static constexpr std::array<SSphereJointInfo, 7> skSphereJointInfo{{
{"Head_1", 1.2f},
{"L_Palm_LCTR", 1.5f},
{"R_Palm_LCTR", 1.5f},
{"Spine_1", 1.5f},
{"Collar", 1.2f},
{"L_Ball", 0.8f},
{"R_Ball", 0.8f},
}};
} // namespace
CElitePirateData::CElitePirateData(CInputStream& in, u32 propCount)
: x0_(in.readFloatBig())
, x4_(in.readFloatBig())
@ -22,7 +48,7 @@ CElitePirateData::CElitePirateData(CInputStream& in, u32 propCount)
, x20_(in)
, x24_(CSfxManager::TranslateSFXID(in.readUint32Big()))
, x28_(ScriptLoader::LoadActorParameters(in))
, x90_(ScriptLoader::LoadAnimationParameters(in))
, x90_launcherParams(ScriptLoader::LoadAnimationParameters(in))
, x9c_(in)
, xa0_(CSfxManager::TranslateSFXID(in.readUint32Big()))
, xa4_(in)
@ -53,14 +79,24 @@ CElitePirate::CElitePirate(TUniqueId uid, std::string_view name, const CEntityIn
const CElitePirateData& eliteData)
: CPatterned(ECharacter::ElitePirate, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Ground, EColliderType::One, EBodyType::BiPedal, actParms, EKnockBackVariant::Large)
, x56c_(pInfo.GetDamageVulnerability())
, x5d8_(eliteData)
, x6f8_(*GetModelData()->GetAnimationData(), "Head_1", zeus::degToRad(80.f), zeus::degToRad(180.f),
EBoneTrackingFlags::None)
, x56c_vulnerability(pInfo.GetDamageVulnerability())
, x5d8_data(eliteData)
, x6f8_boneTracking(*GetModelData()->GetAnimationData(), "Head_1", zeus::degToRad(80.f), zeus::degToRad(180.f),
EBoneTrackingFlags::None)
, x738_(GetBoundingBox(), GetMaterialList())
, x7d0_(nullptr, 1, pInfo.GetPathfindingIndex(), 1.f, 1.f) {
if (x5d8_.GetX20().IsValid()) {
x760_ = g_SimplePool->GetObj({SBIG('PART'), x5d8_.GetX20()});
, x7d0_pathFindSearch(nullptr, 1, pInfo.GetPathfindingIndex(), 1.f, 1.f)
, x8c0_(5.f)
, x988_24_(false)
, x988_25_(false)
, x988_26_(false)
, x988_27_(false)
, x988_28_alert(false)
, x988_29_(false)
, x988_30_(false)
, x988_31_(false)
, x989_24_(false) {
if (x5d8_data.GetX20().IsValid()) {
x760_ = g_SimplePool->GetObj({SBIG('PART'), x5d8_data.GetX20()});
}
x460_knockBackController.SetEnableFreeze(false);
@ -68,41 +104,82 @@ CElitePirate::CElitePirate(TUniqueId uid, std::string_view name, const CEntityIn
x460_knockBackController.SetEnableBurn(false);
x460_knockBackController.SetEnableExplodeDeath(false);
x460_knockBackController.SetEnableLaggedBurnDeath(false);
sub80229248();
sub_80229248();
}
void CElitePirate::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CElitePirate::Think(float dt, CStateManager& mgr) { CPatterned::Think(dt, mgr); }
void CElitePirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
switch (msg) {
case EScriptObjectMessage::Activate: {
if (V179())
x730_->SetActive(mgr, true);
if (CEntity* ent = mgr.ObjectById(x772_))
if (sub_802273a8()) {
x730_collisionActorMgr2->SetActive(mgr, true);
}
if (CEntity* ent = mgr.ObjectById(x772_)) {
ent->SetActive(true);
}
break;
}
case EScriptObjectMessage::Deactivate: {
if (V179())
x730_->SetActive(mgr, false);
x5d4_->SetActive(mgr, false);
if (CEntity* ent = mgr.ObjectById(x772_))
if (sub_802273a8()) {
x730_collisionActorMgr2->SetActive(mgr, false);
}
x5d4_collisionActorMgr1->SetActive(mgr, false);
if (CEntity* ent = mgr.ObjectById(x772_)) {
ent->SetActive(false);
}
break;
}
case EScriptObjectMessage::Alert:
x988_28_ = true;
x988_28_alert = true;
break;
case EScriptObjectMessage::Touched:
case EScriptObjectMessage::Touched: {
if (HealthInfo(mgr)->GetHP() <= 0.f)
break;
TCastToPtr<CCollisionActor> actor = mgr.ObjectById(uid);
if (!actor) {
if (uid == x772_ && x772_ != kInvalidUniqueId) {
sub_8022759c(true, mgr);
}
break;
}
const TUniqueId& touchedUid = actor->GetLastTouchedObject();
if (touchedUid != GetUniqueId()) {
if (TCastToPtr<CGameProjectile> projectile = mgr.ObjectById(touchedUid)) {
sub_8022759c(true, mgr);
}
break;
}
if (!x988_31_) { // TODO is this right?
if (x420_curDamageRemTime <= 0.f) {
CDamageInfo info = GetContactDamage();
info.SetDamage(0.5f * info.GetDamage());
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), info,
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), zeus::skZero3f);
x420_curDamageRemTime = x424_damageWaitTime;
}
break;
}
if ((!x988_25_ || !sub_802293f8(uid, x774_collisionRJointIds)) &&
(!x988_26_ || !sub_802293f8(uid, x788_collisionLJointIds))) {
break;
}
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), GetContactDamage(),
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), zeus::skZero3f);
x420_curDamageRemTime = x424_damageWaitTime;
x988_24_ = false;
break;
}
case EScriptObjectMessage::Registered:
x450_bodyController->Activate(mgr);
SetupCollisionManager(mgr);
SetupCollisionManagers(mgr);
// TODO
break;
default:
break;
}
// TODO
CPatterned::AcceptScriptMsg(msg, uid, mgr);
}
void CElitePirate::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) { CPatterned::PreRender(mgr, frustum); }
@ -120,14 +197,12 @@ zeus::CVector3f CElitePirate::GetAimPosition(const CStateManager& mgr, float dt)
void CElitePirate::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
CPatterned::DoUserAnimEvent(mgr, node, type, dt);
}
const CCollisionPrimitive* CElitePirate::GetCollisionPrimitive() const {
return CPhysicsActor::GetCollisionPrimitive();
}
const CCollisionPrimitive* CElitePirate::GetCollisionPrimitive() const { return &x738_; }
void CElitePirate::KnockBack(const zeus::CVector3f& pos, CStateManager& mgr, const CDamageInfo& info,
EKnockBackType type, bool inDeferred, float magnitude) {
CPatterned::KnockBack(pos, mgr, info, type, inDeferred, magnitude);
}
void CElitePirate::TakeDamage(const zeus::CVector3f& pos, float arg) { CPatterned::TakeDamage(pos, arg); }
void CElitePirate::TakeDamage(const zeus::CVector3f& pos, float) {}
void CElitePirate::Patrol(CStateManager& mgr, EStateMsg msg, float dt) { CPatterned::Patrol(mgr, msg, dt); }
void CElitePirate::PathFind(CStateManager& mgr, EStateMsg msg, float dt) { CPatterned::PathFind(mgr, msg, dt); }
void CElitePirate::TargetPatrol(CStateManager& mgr, EStateMsg msg, float dt) { CPatterned::TargetPatrol(mgr, msg, dt); }
@ -155,6 +230,151 @@ bool CElitePirate::ShotAt(CStateManager& mgr, float arg) { return CAi::ShotAt(mg
bool CElitePirate::ShouldSpecialAttack(CStateManager& mgr, float arg) { return CAi::ShouldSpecialAttack(mgr, arg); }
bool CElitePirate::ShouldCallForBackup(CStateManager& mgr, float arg) { return CAi::ShouldCallForBackup(mgr, arg); }
CPathFindSearch* CElitePirate::GetSearchPath() { return CPatterned::GetSearchPath(); }
void CElitePirate::V181(CStateManager& mgr) {}
void CElitePirate::v182(CStateManager& mgr, bool b) {}
void CElitePirate::sub_80229114(CStateManager& mgr) {}
void CElitePirate::sub_802289b0(CStateManager& mgr, bool b) {}
void CElitePirate::sub_80229248() {
float scale = 1.5f * GetModelData()->GetScale().y();
float fVar1 = sub_802273b0() ? 5.f : 1.f;
zeus::CAABox box{{-scale, -scale, 0.f}, {scale, scale, fVar1 * scale}};
SetBoundingBox(box);
x738_.SetBox(box);
x7d0_pathFindSearch.SetCharacterRadius(scale);
x7d0_pathFindSearch.SetCharacterHeight(3.f * scale);
}
void CElitePirate::sub_8022759c(bool param_1, CStateManager& mgr) {
if (!sub_802273b0() || x7b4_ <= 0.f || !param_1) {
x988_27_ = param_1;
} else if (HealthInfo(mgr)->GetHP() / x7b4_ <= x7b0_) {
x7b0_ -= 0.2f;
x988_27_ = true;
}
if (x988_27_) {
x7c0_ = mgr.GetActiveRandom()->Float() * x5d8_data.x18_ + x5d8_data.x14_;
} else {
x7c0_ = 0.f;
}
}
bool CElitePirate::sub_802293f8(TUniqueId uid, const rstl::reserved_vector<TUniqueId, 8>& vec) const {
return std::find(vec.begin(), vec.end(), uid) != vec.end();
}
void CElitePirate::AddCollisionList(const SJointInfo* joints, size_t count,
std::vector<CJointCollisionDescription>& outJoints) const {
const CAnimData* animData = GetModelData()->GetAnimationData();
for (size_t i = 0; i < count; ++i) {
const auto& joint = joints[i];
const CSegId from = animData->GetLocatorSegId(joint.from);
const CSegId to = animData->GetLocatorSegId(joint.to);
if (to.IsInvalid() || from.IsInvalid()) {
continue;
}
outJoints.emplace_back(CJointCollisionDescription::SphereSubdivideCollision(
to, from, joint.radius, joint.separation, CJointCollisionDescription::EOrientationType::One, joint.from, 10.f));
}
}
void CElitePirate::AddSphereCollisionList(const SSphereJointInfo* joints, size_t count,
std::vector<CJointCollisionDescription>& outJoints) const {
const CAnimData* animData = GetModelData()->GetAnimationData();
for (size_t i = 0; i < count; ++i) {
const auto& joint = joints[i];
const CSegId seg = animData->GetLocatorSegId(joint.name);
if (seg.IsInvalid()) {
continue;
}
outJoints.emplace_back(CJointCollisionDescription::SphereCollision(seg, joint.radius, joint.name, 10.f));
}
}
void CElitePirate::SetupCollisionManagers(CStateManager& mgr) {
constexpr size_t jointInfoCount = skJointInfoL.size() + skJointInfoR.size() + skSphereJointInfo.size();
std::vector<CJointCollisionDescription> joints(jointInfoCount);
AddCollisionList(skJointInfoL.data(), skJointInfoL.size(), joints);
AddCollisionList(skJointInfoR.data(), skJointInfoL.size(), joints);
AddSphereCollisionList(skSphereJointInfo.data(), skSphereJointInfo.size(), joints);
if (sub_802273a8()) {
x730_collisionActorMgr2 =
std::make_unique<CCollisionActorManager>(mgr, GetUniqueId(), GetAreaIdAlways(), joints, true);
x730_collisionActorMgr2->SetActive(mgr, GetActive());
}
x774_collisionRJointIds.clear();
x788_collisionLJointIds.clear();
const CAnimData* animData = GetModelData()->GetAnimationData();
constexpr zeus::CVector3f bounds{4.f, 4.f, 2.f};
joints.emplace_back(CJointCollisionDescription::OBBCollision(animData->GetLocatorSegId("L_Palm_LCTR"sv), bounds,
zeus::skZero3f, "Shield"sv, 10.f));
x5d4_collisionActorMgr1 =
std::make_unique<CCollisionActorManager>(mgr, GetUniqueId(), GetAreaIdAlways(), joints, false);
sub_80229818(mgr);
sub_80229114(mgr);
SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(
{EMaterialTypes::Solid},
{EMaterialTypes::CollisionActor, EMaterialTypes::AIPassthrough, EMaterialTypes::Player}));
AddMaterial(EMaterialTypes::ProjectilePassthrough, mgr);
}
void CElitePirate::sub_80229818(CStateManager& mgr) {
if (sub_802273a8()) {
for (size_t i = 0; i < x730_collisionActorMgr2->GetNumCollisionActors(); ++i) {
const auto& colDesc = x730_collisionActorMgr2->GetCollisionDescFromIndex(i);
const TUniqueId& uid = colDesc.GetCollisionActorId();
if (TCastToPtr<CCollisionActor> act = mgr.ObjectById(uid)) {
if (colDesc.GetName() == "Head_1"sv) {
x770_collisionHeadId = uid;
} else if (sub_8022943c(colDesc.GetName(), "R_Palm_LCTR"sv, skJointInfoR.data(), skJointInfoR.size())) {
x774_collisionRJointIds.push_back(uid);
} else if (sub_8022943c(colDesc.GetName(), "L_Palm_LCTR"sv, skJointInfoL.data(), skJointInfoL.size())) {
x788_collisionLJointIds.push_back(uid);
}
if (uid != x770_collisionHeadId) {
act->SetDamageVulnerability(CDamageVulnerability::ReflectVulnerabilty());
}
}
}
x730_collisionActorMgr2->AddMaterial(
mgr, {EMaterialTypes::AIJoint, EMaterialTypes::CameraPassthrough, EMaterialTypes::Immovable});
}
const CJointCollisionDescription& description = x5d4_collisionActorMgr1->GetCollisionDescFromIndex(0);
x79c_ = description.GetCollisionActorId();
if (TCastToPtr<CCollisionActor> act = mgr.ObjectById(x79c_)) {
act->SetWeaponCollisionResponseType(EWeaponCollisionResponseTypes::None);
}
x5d4_collisionActorMgr1->AddMaterial(mgr, {EMaterialTypes::AIJoint, EMaterialTypes::CameraPassthrough});
}
bool CElitePirate::sub_8022943c(std::string_view name, std::string_view locator, const SJointInfo* info,
size_t infoCount) {
if (name == locator) {
return true;
}
for (size_t i = 0; i < infoCount; ++i) {
if (name == info[i].from) {
return true;
}
}
return false;
}
void CElitePirate::CreateGrenadeLauncher(CStateManager& mgr, TUniqueId uid) {
CAnimationParameters& params = x5d8_data.x90_launcherParams;
if (!params.GetACSFile().IsValid()) {
return;
}
CModelData data(CAnimRes(params.GetACSFile(), params.GetCharacter(), GetModelData()->GetScale(),
params.GetInitialAnimation(), true));
// TODO
}
} // namespace urde::MP1

View File

@ -1,7 +1,7 @@
#pragma once
#include "Runtime/Character/CBoneTracking.hpp"
#include "Runtime/Collision/CJointCollisionDescription.hpp"
#include "Runtime/World/CActorParameters.hpp"
#include "Runtime/World/CAnimationParameters.hpp"
#include "Runtime/World/CPatterned.hpp"
@ -12,6 +12,7 @@ class CCollisionActorManager;
class CGenDescription;
namespace MP1 {
class CElitePirateData {
public:
float x0_;
float x4_;
float x8_;
@ -23,7 +24,7 @@ class CElitePirateData {
CAssetId x20_;
s16 x24_;
CActorParameters x28_;
CAnimationParameters x90_;
CAnimationParameters x90_launcherParams;
CAssetId x9c_;
s16 xa0_;
CAssetId xa4_;
@ -49,7 +50,6 @@ class CElitePirateData {
bool x11e_;
bool x11f_;
public:
CElitePirateData(CInputStream&, u32 propCount);
CAssetId GetX20() const { return x20_; }
@ -82,18 +82,18 @@ class CElitePirate : public CPatterned {
};
s32 x568_ = -1;
CDamageVulnerability x56c_;
std::unique_ptr<CCollisionActorManager> x5d4_;
CElitePirateData x5d8_;
CBoneTracking x6f8_;
std::unique_ptr<CCollisionActorManager> x730_;
CDamageVulnerability x56c_vulnerability;
std::unique_ptr<CCollisionActorManager> x5d4_collisionActorMgr1;
CElitePirateData x5d8_data;
CBoneTracking x6f8_boneTracking;
std::unique_ptr<CCollisionActorManager> x730_collisionActorMgr2;
s32 x734_;
CCollidableAABox x738_;
std::optional<TLockedToken<CGenDescription>> x760_;
TUniqueId x770_ = kInvalidUniqueId;
TUniqueId x770_collisionHeadId = kInvalidUniqueId;
TUniqueId x772_ = kInvalidUniqueId;
s32 x774_ = 0;
s32 x788_ = 0;
rstl::reserved_vector<TUniqueId, 8> x774_collisionRJointIds;
rstl::reserved_vector<TUniqueId, 8> x788_collisionLJointIds;
TUniqueId x79c_ = kInvalidUniqueId;
float x7a0_;
float x7a4_ = 1.f;
@ -107,19 +107,18 @@ class CElitePirate : public CPatterned {
float x7c4_ = 0.f;
s32 x7c8_ = -1;
s32 x7cc_ = 0;
CPathFindSearch x7d0_;
CPathFindSearch x7d0_pathFindSearch;
zeus::CVector3f x8b4_;
SUnknownStruct x8c0_ = SUnknownStruct(5.f);
SUnknownStruct x8c0_;
bool x988_24_ : 1;
bool x988_25_ : 1;
bool x988_26_ : 1;
bool x988_27_ : 1;
bool x988_28_ : 1;
bool x988_28_alert : 1;
bool x988_29_ : 1;
bool x988_30_ : 1;
bool x988_31_ : 1;
bool x989_24_ : 1;
void sub80229248() {}
public:
DEFINE_PATTERNED(ElitePirate)
@ -167,11 +166,26 @@ public:
bool ShouldSpecialAttack(CStateManager&, float arg) override;
bool ShouldCallForBackup(CStateManager&, float arg) override;
CPathFindSearch* GetSearchPath() override;
virtual bool V179() { return true; }
virtual bool V180() { return true; }
virtual void V181(CStateManager& mgr);
virtual void v182(CStateManager& mgr, bool b);
virtual SUnknownStruct2 V183() const {return {x5d8_.GetXF8(), x5d8_.GetXFC(), x5d8_.GetX118(), x5d8_.GetX11C()}; }
virtual bool sub_802273a8() { return true; }
virtual bool sub_802273b0() { return true; }
virtual void sub_80229114(CStateManager& mgr);
virtual void sub_802289b0(CStateManager& mgr, bool b);
virtual SUnknownStruct2 sub_802273b8() const {
return {x5d8_data.GetXF8(), x5d8_data.GetXFC(), x5d8_data.GetX118(), x5d8_data.GetX11C()};
}
private:
void sub_80229248();
void sub_8022759c(bool param_1, CStateManager& mgr);
bool sub_802293f8(TUniqueId uid, const rstl::reserved_vector<TUniqueId, 8>& vec) const;
void AddSphereCollisionList(const SSphereJointInfo* joints, size_t count,
std::vector<CJointCollisionDescription>& outJoints) const;
void AddCollisionList(const SJointInfo* joints, size_t count,
std::vector<CJointCollisionDescription>& outJoints) const;
void SetupCollisionManagers(CStateManager& mgr);
void sub_80229818(CStateManager& mgr);
bool sub_8022943c(std::string_view name, std::string_view locator, const SJointInfo* info, size_t infoCount);
void CreateGrenadeLauncher(CStateManager& mgr, TUniqueId uid);
};
} // namespace MP1
} // namespace urde
} // namespace urde

View File

@ -0,0 +1,34 @@
#include "Runtime/MP1/World/CGrenadeLauncher.hpp"
#include "Runtime/CSimplePool.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/Character/CPASAnimParm.hpp"
#include "Runtime/Character/CPASAnimParmData.hpp"
namespace urde {
namespace MP1 {
CGrenadeLauncher::CGrenadeLauncher(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData, const zeus::CAABox& bounds,
const CHealthInfo& healthInfo, const CDamageVulnerability& vulnerability,
const CActorParameters& actParams, TUniqueId otherId,
const CGrenadeLauncherData& data, float f1)
: CPhysicsActor(uid, true, name, info, xf, std::move(mData), {EMaterialTypes::Character, EMaterialTypes::Solid}, bounds,
{1000.f}, actParams, 0.3f, 0.1f)
, x25c_(healthInfo)
, x264_vulnerability(vulnerability)
, x2cc_otherId(otherId)
, x2d0_data(data)
, x328_cSphere({{}, mData.GetScale().z()}, {EMaterialTypes::Character, EMaterialTypes::Solid})
, x350_actParms(actParams)
, x3c0_particleGenDesc(g_SimplePool->GetObj({SBIG('PART'), data.x40_}))
, x3d8_(actParams.GetThermalMag())
, x3f8_(f1) {
GetModelData()->EnableLooping(true);
const CPASDatabase& pasDatabase = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase();
for (int i = 0; i < 4; i++) {
const auto result = pasDatabase.FindBestAnimation({22, CPASAnimParm::FromEnum(i)}, -1);
x3c8_animIds[i] = result.second;
}
}
} // namespace MP1
} // namespace urde

View File

@ -0,0 +1,102 @@
#pragma once
#include "Runtime/Character/CModelData.hpp"
#include "Runtime/Collision/CCollidableSphere.hpp"
#include "Runtime/Particle/CGenDescription.hpp"
#include "Runtime/RetroTypes.hpp"
#include "Runtime/World/CActorParameters.hpp"
#include "Runtime/World/CDamageInfo.hpp"
#include "Runtime/World/CDamageVulnerability.hpp"
#include "Runtime/World/CEntityInfo.hpp"
#include "Runtime/World/CHealthInfo.hpp"
#include "Runtime/World/CPhysicsActor.hpp"
#include "Runtime/World/CPhysicsActor.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
#include <array>
#include <string_view>
#include <zeus/CColor.hpp>
#include <zeus/CTransform.hpp>
#include <zeus/CQuaternion.hpp>
namespace urde {
namespace MP1 {
struct SGrenadeLauncherData {
CHealthInfo x0_healthInfo;
CDamageInfo x8_damageInfo;
u32 x24_;
u32 x28_;
u32 x2c_;
u32 x30_;
u32 x34_;
u16 x38_;
u16 x3a_;
};
class CGrenadeLauncherData {
public:
SGrenadeLauncherData x0_;
u32 x3c_;
CAssetId x40_;
u16 x44_sfx;
zeus::CQuaternion x48_quat;
CGrenadeLauncherData(const SGrenadeLauncherData& data, u32 w1, CAssetId w2, u16 sfx, const zeus::CQuaternion& quat)
: x0_(data), x3c_(w1), x40_(w2), x44_sfx(sfx), x48_quat(quat){};
};
class CGrenadeLauncher : public CPhysicsActor {
public:
int x258_ = 0;
CHealthInfo x25c_;
CDamageVulnerability x264_vulnerability;
TUniqueId x2cc_otherId;
CGrenadeLauncherData x2d0_data;
CCollidableSphere x328_cSphere;
float x348_ = -1.f;
zeus::CColor x34c_color1{1.f};
CActorParameters x350_actParms;
// was TToken<CGenDescription>
TLockedToken<CGenDescription> x3c0_particleGenDesc;
std::array<s32, 4> x3c8_animIds;
float x3d8_ = 0.f;
float x3dc_ = 0.f;
float x3e0_ = 0.f;
float x3e4_ = 0.f;
float x3e8_thermalMag;
float x3ec_ = 0.f;
zeus::CColor x3f0_color2{0.5f, 0.f, 0.f};
zeus::CColor x3f4_color3{0.f};
float x3f8_;
bool x3fc_ = false;
bool x3fd_ = true;
bool x3fe_ = true;
CGrenadeLauncher(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const zeus::CAABox& bounds, const CHealthInfo& healthInfo,
const CDamageVulnerability& vulnerability, const CActorParameters& actParams, TUniqueId otherId,
const CGrenadeLauncherData& data, float f1);
void Accept(IVisitor& visitor) override { visitor.Visit(this); }
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
void AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const override;
const CCollisionPrimitive* GetCollisionPrimitive() const override { return &x328_cSphere; }
const CDamageVulnerability* GetDamageVulnerability() const override { return &x264_vulnerability; }
std::optional<zeus::CAABox> GetTouchBounds() const override;
CHealthInfo* HealthInfo(CStateManager& mgr) override;
void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) override;
void Render(const CStateManager& mgr) const override;
void Think(float dt, CStateManager& mgr) override;
void Touch(CActor& act, CStateManager& mgr) override;
protected:
void UpdateCollision();
void UpdateColor(float arg);
void sub_8022f69c(float arg);
void sub_8022f770(CStateManager& mgr);
void sub_8022f9e0(CStateManager& mgr, float arg);
void sub_80230438();
};
} // namespace MP1
} // namespace urde

View File

@ -15,8 +15,9 @@ set(MP1_WORLD_SOURCES
CAtomicAlpha.hpp CAtomicAlpha.cpp
CAtomicBeta.hpp CAtomicBeta.cpp
CFlickerBat.hpp CFlickerBat.cpp
CJellyZap.hpp CJellyZap.cpp
CFlyingPirate.hpp CFlyingPirate.cpp
CGrenadeLauncher.hpp CGrenadeLauncher.cpp
CJellyZap.hpp CJellyZap.cpp
CMetroidPrimeRelay.hpp CMetroidPrimeRelay.cpp
CMetroidPrimeExo.hpp CMetroidPrimeExo.cpp
CMetroidPrimeProjectile.hpp CMetroidPrimeProjectile.cpp

View File

@ -17,14 +17,14 @@ const CDamageVulnerability CDamageVulnerability::sImmuneVulnerability(
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None);
/* LOL, thanks retro */
const CDamageVulnerability CDamageVulnerability::sReflectVulnerability(
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None);
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::One);
const CDamageVulnerability CDamageVulnerability::sPassThroughVulnerability(
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,

View File

@ -14,6 +14,7 @@ class CPathFindSearch;
class CPathFindVisualizer {
CLineRenderer m_spline = {CLineRenderer::EPrimitiveMode::LineStrip, 16, {}, true};
public:
void Draw(const CPathFindSearch& path);
};
@ -56,6 +57,8 @@ public:
void SetArea(CPFArea* area) { x0_area = area; }
float GetCharacterHeight() const { return xd0_chHeight; }
void SetCharacterHeight(float h) { xd0_chHeight = h; }
float GetCharacterRadius() const { return xd4_chRadius; }
void SetCharacterRadius(float r) { xd4_chRadius = r; }
void SetPadding(float padding) { xd8_padding = padding; }
float RemainingPathDistance(const zeus::CVector3f& pos) const;
void DebugDraw() const;