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

View File

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