Minor CFlaahgra fixes

This commit is contained in:
Phillip Stephens 2020-03-12 15:06:01 -07:00
parent cfd568bb39
commit 3a37be9d27
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
2 changed files with 28 additions and 27 deletions

View File

@ -895,7 +895,7 @@ void CFlaahgra::Faint(CStateManager& mgr, EStateMsg msg, float arg) {
x7d4_ += arg; x7d4_ += arg;
if (x7d4_ >= x56c_.xc_) if (x7d4_ >= x56c_.xc_)
x568_ = 4; x568_ = 4;
else } else {
x450_bodyController->FaceDirection(x894_, arg); x450_bodyController->FaceDirection(x894_, arg);
} }
} }
@ -1186,13 +1186,16 @@ TUniqueId CFlaahgra::GetMirrorNearestPlayer(const CStateManager& mgr) const {
zeus::CVector3f playerPos = mgr.GetPlayer().GetTranslation(); zeus::CVector3f playerPos = mgr.GetPlayer().GetTranslation();
TUniqueId nearId = kInvalidUniqueId; TUniqueId nearId = kInvalidUniqueId;
float prevMag = -1.f;
for (TUniqueId id : x770_mirrorWaypoints) { for (TUniqueId id : x770_mirrorWaypoints) {
if (TCastToConstPtr<CActor> wp = mgr.GetObjectById(id)) { if (TCastToConstPtr<CActor> wp = mgr.GetObjectById(id)) {
if (!wp->GetActive()) if (!wp->GetActive())
continue; continue;
const float mag = (wp->GetTranslation() - playerPos).magSquared();
if ((wp->GetTranslation() - playerPos).magSquared() > -1.f) if (mag > prevMag) {
nearId = id; nearId = id;
prevMag = mag;
}
} }
} }

View File

@ -22,7 +22,7 @@ class CCollisionActorManager;
class CDependencyGroup; class CDependencyGroup;
class CElementGen; class CElementGen;
class CGenDescription; class CGenDescription;
} } // namespace urde
namespace urde::MP1 { namespace urde::MP1 {
class CFlaahgraData { class CFlaahgraData {
@ -44,6 +44,7 @@ class CFlaahgraData {
float x148_; float x148_;
CAnimationParameters x14c_animationParameters; CAnimationParameters x14c_animationParameters;
CAssetId x158_; CAssetId x158_;
public: public:
static constexpr u32 GetNumProperties() { return 23; } static constexpr u32 GetNumProperties() { return 23; }
CFlaahgraData(CInputStream&); CFlaahgraData(CInputStream&);
@ -53,6 +54,7 @@ public:
class CFlaahgraRenderer : public CActor { class CFlaahgraRenderer : public CActor {
TUniqueId xe8_owner; TUniqueId xe8_owner;
public: public:
CFlaahgraRenderer(TUniqueId, TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&); CFlaahgraRenderer(TUniqueId, TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&);
@ -69,6 +71,7 @@ class CFlaahgraPlants : public CActor {
float x12c_lastDt = 0.f; float x12c_lastDt = 0.f;
zeus::COBBox x130_obbox; zeus::COBBox x130_obbox;
TUniqueId x16c_colAct = kInvalidUniqueId; TUniqueId x16c_colAct = kInvalidUniqueId;
public: public:
CFlaahgraPlants(const TToken<CGenDescription>&, const CActorParameters&, TUniqueId, TAreaId, TUniqueId, CFlaahgraPlants(const TToken<CGenDescription>&, const CActorParameters&, TUniqueId, TAreaId, TUniqueId,
const zeus::CTransform&, const CDamageInfo&, const zeus::CVector3f&); const zeus::CTransform&, const CDamageInfo&, const zeus::CVector3f&);
@ -137,8 +140,6 @@ class CFlaahgra : public CPatterned {
CAnimRes x8ac_; CAnimRes x8ac_;
std::optional<TToken<CDependencyGroup>> x8c8_depGroup; std::optional<TToken<CDependencyGroup>> x8c8_depGroup;
std::vector<CToken> x8d4_tokens; std::vector<CToken> x8d4_tokens;
union {
struct {
bool x8e4_24_loaded : 1; bool x8e4_24_loaded : 1;
bool x8e4_25_loading : 1; bool x8e4_25_loading : 1;
bool x8e4_26_ : 1; bool x8e4_26_ : 1;
@ -154,9 +155,6 @@ class CFlaahgra : public CPatterned {
bool x8e5_28_ : 1; bool x8e5_28_ : 1;
bool x8e5_29_ : 1; bool x8e5_29_ : 1;
bool x8e5_30_ : 1; bool x8e5_30_ : 1;
};
u32 _dummy = 0;
};
void LoadDependencies(CAssetId); void LoadDependencies(CAssetId);
void ResetModelDataAndBodyController(); void ResetModelDataAndBodyController();
@ -192,6 +190,7 @@ class CFlaahgra : public CPatterned {
zeus::CVector3f sub801ae754(const CStateManager&) const; zeus::CVector3f sub801ae754(const CStateManager&) const;
TUniqueId GetMirrorNearestPlayer(const CStateManager&) const; TUniqueId GetMirrorNearestPlayer(const CStateManager&) const;
public: public:
DEFINE_PATTERNED(Flaahgra); DEFINE_PATTERNED(Flaahgra);
CFlaahgra(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, const CAnimRes&, CFlaahgra(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, const CAnimRes&,
@ -235,6 +234,5 @@ public:
void Cover(CStateManager&, EStateMsg, float) override; void Cover(CStateManager&, EStateMsg, float) override;
void SpecialAttack(CStateManager&, EStateMsg, float) override; void SpecialAttack(CStateManager&, EStateMsg, float) override;
void Enraged(CStateManager&, EStateMsg, float) override; void Enraged(CStateManager&, EStateMsg, float) override;
}; };
} } // namespace urde::MP1