Build fixes & cleanup for CDrone, CIceSheegoth

This commit is contained in:
Luke Street 2020-05-31 17:23:02 -04:00
parent ca96676057
commit 932b5587a2
13 changed files with 47 additions and 47 deletions

4
.gitignore vendored
View File

@ -4,7 +4,5 @@ version.h
.DS_Store .DS_Store
*.autosave *.autosave
docs/* docs/*
.idea/dictionaries .idea/
.idea/workspace.xml
.idea/misc.xml
Editor/platforms/win/urde.rc Editor/platforms/win/urde.rc

View File

@ -1,13 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<extensions>
<pair source="cpp" header="hpp" fileNamingConvention="PASCAL_CASE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
<clangFormatSettings>
<option name="ENABLED" value="true" />
</clangFormatSettings>
</code_scheme>
</component>

View File

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/urde.iml" filepath="$PROJECT_DIR$/.idea/urde.iml" />
</modules>
</component>
</project>

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

View File

@ -301,7 +301,7 @@ void CDrone::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
} }
} }
void CDrone::Render(const CStateManager& mgr) const { void CDrone::Render(CStateManager& mgr) {
bool isOne = x3fc_flavor == EFlavorType::One; bool isOne = x3fc_flavor == EFlavorType::One;
if (!isOne || GetModelAlphau8(mgr) != 0) { if (!isOne || GetModelAlphau8(mgr) != 0) {
if (isOne && mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) { if (isOne && mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) {
@ -811,10 +811,13 @@ bool CDrone::LineOfSight(CStateManager& mgr, float arg) {
{EMaterialTypes::Player, EMaterialTypes::ProjectilePassthrough}), {EMaterialTypes::Player, EMaterialTypes::ProjectilePassthrough}),
this); this);
} }
bool CDrone::ShouldMove(CStateManager& mgr, float arg) { return x644_ <= 0.f; } bool CDrone::ShouldMove(CStateManager& mgr, float arg) { return x644_ <= 0.f; }
bool CDrone::CodeTrigger(CStateManager& mgr, float arg) { return x834_29_codeTrigger; } bool CDrone::CodeTrigger(CStateManager& mgr, float arg) { return x834_29_codeTrigger; }
void CDrone::Burn(float duration, float damage) { /* Intentionally empty */
} void CDrone::Burn(float duration, float damage) { /* Intentionally empty */ }
CPathFindSearch* CDrone::GetSearchPath() { return &x6b0_pathFind; } CPathFindSearch* CDrone::GetSearchPath() { return &x6b0_pathFind; }
void CDrone::BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat, void CDrone::BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat,
@ -823,6 +826,7 @@ void CDrone::BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat,
mgr.BuildNearList(listOut, zeus::CAABox(pos - radius, pos + radius), mgr.BuildNearList(listOut, zeus::CAABox(pos - radius, pos + radius),
CMaterialFilter::MakeIncludeExclude({includeMat}, {excludeMat}), nullptr); CMaterialFilter::MakeIncludeExclude({includeMat}, {excludeMat}), nullptr);
} }
void CDrone::SetLightEnabled(CStateManager& mgr, bool activate) { void CDrone::SetLightEnabled(CStateManager& mgr, bool activate) {
mgr.SendScriptMsgAlways(x578_lightId, GetUniqueId(), mgr.SendScriptMsgAlways(x578_lightId, GetUniqueId(),
activate ? EScriptObjectMessage::Activate : EScriptObjectMessage::Deactivate); activate ? EScriptObjectMessage::Activate : EScriptObjectMessage::Deactivate);
@ -848,6 +852,7 @@ bool CDrone::HitShield(const zeus::CVector3f& dir) const {
return false; return false;
} }
void CDrone::AddToTeam(CStateManager& mgr) const { void CDrone::AddToTeam(CStateManager& mgr) const {
if (x688_teamMgr == kInvalidUniqueId) { if (x688_teamMgr == kInvalidUniqueId) {
return; return;
@ -858,6 +863,7 @@ void CDrone::AddToTeam(CStateManager& mgr) const {
CTeamAiRole::ETeamAiRole::Invalid); CTeamAiRole::ETeamAiRole::Invalid);
} }
} }
void CDrone::RemoveFromTeam(CStateManager& mgr) const { void CDrone::RemoveFromTeam(CStateManager& mgr) const {
if (TCastToPtr<CTeamAiMgr> teamMgr = mgr.ObjectById(x688_teamMgr)) { if (TCastToPtr<CTeamAiMgr> teamMgr = mgr.ObjectById(x688_teamMgr)) {
if (teamMgr->IsPartOfTeam(GetUniqueId())) { if (teamMgr->IsPartOfTeam(GetUniqueId())) {
@ -865,6 +871,7 @@ void CDrone::RemoveFromTeam(CStateManager& mgr) const {
} }
} }
} }
void CDrone::UpdateLaser(CStateManager& mgr, u32 laserIdx, bool b1) { void CDrone::UpdateLaser(CStateManager& mgr, u32 laserIdx, bool b1) {
// TODO: Finish // TODO: Finish
} }
@ -902,6 +909,7 @@ void CDrone::StrafeFromCompanions(CStateManager& mgr) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCStepCmd(pas::EStepDirection::Right, pas::EStepType::Normal)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCStepCmd(pas::EStepDirection::Right, pas::EStepType::Normal));
} }
} }
void CDrone::UpdateScanner(CStateManager& mgr, float dt) { void CDrone::UpdateScanner(CStateManager& mgr, float dt) {
x5d4_ = zeus::CRelAngle::MakeRelativeAngle(1.2f * dt + x5d4_); x5d4_ = zeus::CRelAngle::MakeRelativeAngle(1.2f * dt + x5d4_);
x5d8_ = zeus::CRelAngle::MakeRelativeAngle(x5d8_); x5d8_ = zeus::CRelAngle::MakeRelativeAngle(x5d8_);
@ -923,8 +931,13 @@ void CDrone::UpdateScanner(CStateManager& mgr, float dt) {
} }
} }
} }
void CDrone::sub_80163c40(float, CStateManager& mgr) {} void CDrone::sub_80163c40(float, CStateManager& mgr) {}
void CDrone::sub_801633a8(CStateManager& mgr) {} void CDrone::sub_801633a8(CStateManager& mgr) {}
void CDrone::sub_8015f25c(float dt, CStateManager& mgr) {} void CDrone::sub_8015f25c(float dt, CStateManager& mgr) {}
void CDrone::sub_8015f158(float dt) {} void CDrone::sub_8015f158(float dt) {}
} // namespace urde::MP1 } // namespace urde::MP1

View File

@ -76,7 +76,7 @@ class CDrone : public CPatterned {
CSfxHandle x7d0_; CSfxHandle x7d0_;
rstl::reserved_vector<TUniqueId, 2> x7d4_ = {{kInvalidUniqueId, kInvalidUniqueId}}; rstl::reserved_vector<TUniqueId, 2> x7d4_ = {{kInvalidUniqueId, kInvalidUniqueId}};
rstl::reserved_vector<zeus::CVector3f, 2> x7e0_ = {{zeus::skZero3f, zeus::skZero3f}}; rstl::reserved_vector<zeus::CVector3f, 2> x7e0_ = {{zeus::skZero3f, zeus::skZero3f}};
rstl::reserved_vector<zeus::CVector3f, 2> x7fc_ = {{zeus::skZero3f, zeus::skZero3f}};; rstl::reserved_vector<zeus::CVector3f, 2> x7fc_ = {{zeus::skZero3f, zeus::skZero3f}};
rstl::reserved_vector<float, 2> x818_ = {{0.f, 0.f}}; rstl::reserved_vector<float, 2> x818_ = {{0.f, 0.f}};
rstl::reserved_vector<bool, 2> x824_ = {{false, false}}; rstl::reserved_vector<bool, 2> x824_ = {{false, false}};
std::unique_ptr<CModelData> x82c_shieldModel; std::unique_ptr<CModelData> x82c_shieldModel;
@ -93,6 +93,7 @@ class CDrone : public CPatterned {
bool x835_24_ : 1; bool x835_24_ : 1;
bool x835_25_ : 1; bool x835_25_ : 1;
bool x835_26_ : 1; bool x835_26_ : 1;
void UpdateTouchBounds(float radius); void UpdateTouchBounds(float radius);
bool HitShield(const zeus::CVector3f& dir) const; bool HitShield(const zeus::CVector3f& dir) const;
void AddToTeam(CStateManager& mgr) const; void AddToTeam(CStateManager& mgr) const;
@ -106,6 +107,7 @@ class CDrone : public CPatterned {
void sub_801633a8(CStateManager& mgr); void sub_801633a8(CStateManager& mgr);
void sub_8015f25c(float dt, CStateManager& mgr); void sub_8015f25c(float dt, CStateManager& mgr);
void sub_8015f158(float dt); void sub_8015f158(float dt);
public: public:
DEFINE_PATTERNED(Drone); DEFINE_PATTERNED(Drone);
CDrone(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info, const zeus::CTransform& xf, CDrone(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info, const zeus::CTransform& xf,
@ -120,7 +122,7 @@ public:
void Think(float dt, CStateManager& mgr) override; void Think(float dt, CStateManager& mgr) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) override; void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) override;
void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) override; void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) override;
void Render(const CStateManager& mgr) const override; void Render(CStateManager& mgr) override;
bool CanRenderUnsorted(const CStateManager& mgr) const override; bool CanRenderUnsorted(const CStateManager& mgr) const override;
const CDamageVulnerability* GetDamageVulnerability() const override { return CAi::GetDamageVulnerability(); } const CDamageVulnerability* GetDamageVulnerability() const override { return CAi::GetDamageVulnerability(); }
const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f&, const zeus::CVector3f&, const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f&, const zeus::CVector3f&,

View File

@ -42,12 +42,12 @@ void CDroneLaser::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CS
} }
} }
void CDroneLaser::AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const { void CDroneLaser::AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) {
g_Renderer->AddParticleGen(*x104_beamParticle); g_Renderer->AddParticleGen(*x104_beamParticle);
EnsureRendered(mgr); EnsureRendered(mgr);
} }
void CDroneLaser::Render(const CStateManager& mgr) const { void CDroneLaser::Render(CStateManager& mgr) {
// g_Renderer->SetDepthReadWrite(true, true); // g_Renderer->SetDepthReadWrite(true, true);
RenderBeam(4, 0.01f, zeus::CColor(1.f, .9f, .9f, 1.f), true); RenderBeam(4, 0.01f, zeus::CColor(1.f, .9f, .9f, 1.f), true);
// g_Renderer->SetDepthReadWrite(true, false); // g_Renderer->SetDepthReadWrite(true, false);
@ -64,9 +64,12 @@ void CDroneLaser::CalculateRenderBounds() {
box.accumulateBounds(xe8_ - (mag1 * GetTransform().basis[2])); box.accumulateBounds(xe8_ - (mag1 * GetTransform().basis[2]));
x9c_renderBounds = box; x9c_renderBounds = box;
} }
void CDroneLaser::SetScannerLightActive(CStateManager& mgr, bool activate) { void CDroneLaser::SetScannerLightActive(CStateManager& mgr, bool activate) {
mgr.SendScriptMsgAlways(xf4_scannerLight, GetUniqueId(), mgr.SendScriptMsgAlways(xf4_scannerLight, GetUniqueId(),
activate ? EScriptObjectMessage::Activate : EScriptObjectMessage::Deactivate); activate ? EScriptObjectMessage::Activate : EScriptObjectMessage::Deactivate);
} }
void CDroneLaser::RenderBeam(u32 w, float f, const zeus::CColor& col, bool) const {} void CDroneLaser::RenderBeam(u32 w, float f, const zeus::CColor& col, bool) const {}
} // namespace urde::MP1 } // namespace urde::MP1

View File

@ -12,13 +12,14 @@ class CDroneLaser : public CActor {
void SetScannerLightActive(CStateManager& mgr, bool activate); void SetScannerLightActive(CStateManager& mgr, bool activate);
void RenderBeam(u32 w, float f, const zeus::CColor& col, bool) const; void RenderBeam(u32 w, float f, const zeus::CColor& col, bool) const;
public: public:
CDroneLaser(TUniqueId uid, TAreaId aId, const zeus::CTransform& xf, CAssetId particle); CDroneLaser(TUniqueId uid, TAreaId aId, const zeus::CTransform& xf, CAssetId particle);
void Accept(IVisitor& visitor) override; void Accept(IVisitor& visitor) override;
void Think(float dt, CStateManager& mgr) override; void Think(float dt, CStateManager& mgr) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) override; void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) override;
void AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const override; void AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) override;
void Render(const CStateManager& mgr) const override; void Render(CStateManager& mgr) override;
void CalculateRenderBounds() override; void CalculateRenderBounds() override;
}; };
} // namespace MP1 } // namespace MP1

View File

@ -762,6 +762,7 @@ void CIceSheegoth::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float dt)
xb28_26_ = false; xb28_26_ = false;
} }
} }
void CIceSheegoth::Flinch(CStateManager& mgr, EStateMsg msg, float dt) { void CIceSheegoth::Flinch(CStateManager& mgr, EStateMsg msg, float dt) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
x568_ = 0; x568_ = 0;
@ -1104,6 +1105,7 @@ void CIceSheegoth::SetupCollisionActorManager(CStateManager& mgr) {
AddMaterial(EMaterialTypes::ProjectilePassthrough, mgr); AddMaterial(EMaterialTypes::ProjectilePassthrough, mgr);
xa2c_collisionManager->AddMaterial(mgr, {EMaterialTypes::AIJoint, EMaterialTypes::CameraPassthrough}); xa2c_collisionManager->AddMaterial(mgr, {EMaterialTypes::AIJoint, EMaterialTypes::CameraPassthrough});
} }
void CIceSheegoth::SetupHealthInfo(CStateManager& mgr) { void CIceSheegoth::SetupHealthInfo(CStateManager& mgr) {
CHealthInfo* thisHealth = HealthInfo(mgr); CHealthInfo* thisHealth = HealthInfo(mgr);
x970_maxHp = thisHealth->GetHP(); x970_maxHp = thisHealth->GetHP();
@ -1223,6 +1225,7 @@ void CIceSheegoth::UpdateTimers(float dt) {
x968_interestTimer += dt; x968_interestTimer += dt;
} }
} }
void CIceSheegoth::UpdateScanState(CStateManager& mgr) { void CIceSheegoth::UpdateScanState(CStateManager& mgr) {
if (!xb29_29_scanned && GetScannableObjectInfo() != nullptr && if (!xb29_29_scanned && GetScannableObjectInfo() != nullptr &&
zeus::close_enough(1.f, mgr.GetPlayerState()->GetScanTime(GetScannableObjectInfo()->GetScannableObjectId()))) { zeus::close_enough(1.f, mgr.GetPlayerState()->GetScanTime(GetScannableObjectInfo()->GetScannableObjectId()))) {
@ -1412,11 +1415,13 @@ bool CIceSheegoth::sub_8019ecdc(CStateManager& mgr, float minAngle) {
return zeus::CVector2f::getAngleDiff(GetTransform().basis[1].toVec2f(), return zeus::CVector2f::getAngleDiff(GetTransform().basis[1].toVec2f(),
plAimPos.toVec2f() - GetTranslation().toVec2f()) > minAngle; plAimPos.toVec2f() - GetTranslation().toVec2f()) > minAngle;
} }
void CIceSheegoth::SetMouthVulnerability(CStateManager& mgr, bool isVulnerable) { void CIceSheegoth::SetMouthVulnerability(CStateManager& mgr, bool isVulnerable) {
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(xaf8_mouthCollider)) { if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(xaf8_mouthCollider)) {
colAct->SetDamageVulnerability(isVulnerable ? x56c_sheegothData.Get_xe8() : x98c_mouthVulnerability); colAct->SetDamageVulnerability(isVulnerable ? x56c_sheegothData.Get_xe8() : x98c_mouthVulnerability);
} }
} }
void CIceSheegoth::SetGillVulnerability(CStateManager& mgr, bool isVulnerable) { void CIceSheegoth::SetGillVulnerability(CStateManager& mgr, bool isVulnerable) {
for (TUniqueId uid : xafc_gillColliders) { for (TUniqueId uid : xafc_gillColliders) {
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(uid)) { if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(uid)) {
@ -1467,6 +1472,7 @@ void CIceSheegoth::ShakePlayer(CStateManager& mgr) {
sub_8019ebf0(mgr, 0.25f * x56c_sheegothData.Get_x170()); sub_8019ebf0(mgr, 0.25f * x56c_sheegothData.Get_x170());
} }
} }
zeus::CVector3f CIceSheegoth::GetEnergyAttractionPos(CStateManager& mgr) const { zeus::CVector3f CIceSheegoth::GetEnergyAttractionPos(CStateManager& mgr) const {
if (const TCastToConstPtr<CCollisionActor> colAct = mgr.GetObjectById(xaf6_iceShardsCollider)) { if (const TCastToConstPtr<CCollisionActor> colAct = mgr.GetObjectById(xaf6_iceShardsCollider)) {
return colAct->GetTranslation(); return colAct->GetTranslation();
@ -1474,6 +1480,7 @@ zeus::CVector3f CIceSheegoth::GetEnergyAttractionPos(CStateManager& mgr) const {
return GetTranslation(); return GetTranslation();
} }
bool CIceSheegoth::ShouldAttractProjectile(const CGameProjectile& proj, CStateManager& mgr) const { bool CIceSheegoth::ShouldAttractProjectile(const CGameProjectile& proj, CStateManager& mgr) const {
if (proj.GetType() != EWeaponType::Missile && proj.GetType() != EWeaponType::Plasma && if (proj.GetType() != EWeaponType::Missile && proj.GetType() != EWeaponType::Plasma &&
(!proj.GetDamageInfo().GetWeaponMode().IsComboed() || proj.GetType() != EWeaponType::Power)) { (!proj.GetDamageInfo().GetWeaponMode().IsComboed() || proj.GetType() != EWeaponType::Power)) {
@ -1500,6 +1507,7 @@ bool CIceSheegoth::ShouldAttractProjectile(const CGameProjectile& proj, CStateMa
return false; return false;
} }
bool CIceSheegoth::IsClosestSheegoth(CStateManager& mgr, rstl::reserved_vector<TUniqueId, 1024> nearList, bool CIceSheegoth::IsClosestSheegoth(CStateManager& mgr, rstl::reserved_vector<TUniqueId, 1024> nearList,
zeus::CVector3f projectileOffset) const { zeus::CVector3f projectileOffset) const {

View File

@ -186,7 +186,8 @@ class CIceSheegoth : public CPatterned {
void UpdateAttackPosition(CStateManager& mgr, zeus::CVector3f& attackPos); void UpdateAttackPosition(CStateManager& mgr, zeus::CVector3f& attackPos);
zeus::CVector3f GetEnergyAttractionPos(CStateManager& mgr) const; zeus::CVector3f GetEnergyAttractionPos(CStateManager& mgr) const;
bool ShouldAttractProjectile(const CGameProjectile& proj, CStateManager& mgr) const; bool ShouldAttractProjectile(const CGameProjectile& proj, CStateManager& mgr) const;
bool IsClosestSheegoth(CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 1024> nearList, const zeus::CVector3f projectileOffset) const; bool IsClosestSheegoth(CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 1024> nearList,
const zeus::CVector3f projectileOffset) const;
public: public:
DEFINE_PATTERNED(IceSheeegoth); DEFINE_PATTERNED(IceSheeegoth);

View File

@ -69,7 +69,9 @@ bool CPuddleSpore::HitShell(const zeus::CVector3f& point) const {
return (distance <= -0.5f || distance >= 0.5f); return (distance <= -0.5f || distance >= 0.5f);
} }
void CPuddleSpore::KnockPlayer(CStateManager&, float) {} void CPuddleSpore::KnockPlayer(CStateManager& mgr, float arg) {
// TODO implement
}
void CPuddleSpore::UpdateBoundingState(const zeus::CAABox& box, CStateManager& mgr, float dt) { void CPuddleSpore::UpdateBoundingState(const zeus::CAABox& box, CStateManager& mgr, float dt) {
SetBoundingBox(box); SetBoundingBox(box);

View File

@ -26,7 +26,7 @@ class CPuddleSpore : public CPatterned {
CCollidableAABox x5a0_; CCollidableAABox x5a0_;
u32 x5c8_ = 0; u32 x5c8_ = 0;
u32 x5cc_ = 0; u32 x5cc_ = 0;
TToken<CGenDescription> x5d0_; TCachedToken<CGenDescription> x5d0_;
std::vector<std::unique_ptr<CElementGen>> x5dc_elemGens; // originally a vector of CElementGen std::vector<std::unique_ptr<CElementGen>> x5dc_elemGens; // originally a vector of CElementGen
CProjectileInfo x5ec_projectileInfo; CProjectileInfo x5ec_projectileInfo;
bool x614_24 : 1 = false; bool x614_24 : 1 = false;