CScriptCoverPoint: Fix GetAttackDirection

This commit is contained in:
Luke Street 2020-04-11 02:02:28 -04:00
parent bb7e94f304
commit 0339c16e20
4 changed files with 10 additions and 3 deletions

View File

@ -2082,7 +2082,7 @@ void CSpacePirate::Cover(CStateManager& mgr, EStateMsg msg, float dt) {
case EStateMsg::Activate:
if (x450_bodyController->GetCurrentStateId() != pas::EAnimationState::Cover) {
if (CScriptCoverPoint* cp = GetCoverPoint(mgr, x640_coverPoint)) {
x79c_coverDir = (cp->GetAttackDirection() & 0x2) ? pas::ECoverDirection::Left : pas::ECoverDirection::Right;
x79c_coverDir = cp->GetAttackDirection();
x32c_animState = EAnimState::Ready;
x2e0_destPos = cp->GetTranslation();
TryCommand(mgr, pas::EAnimationState::Cover, &CPatterned::TryCover, int(x79c_coverDir));

View File

@ -104,7 +104,7 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
else
RemoveMaterial(EMaterialTypes::Scannable, mgr);
if (HasModelData() && x64_modelData->GetAnimationData()) {
if (HasModelData() && x64_modelData->HasAnimData()) {
TAreaId aid = GetAreaId();
x64_modelData->GetAnimationData()->InitializeEffects(mgr, aid, x64_modelData->GetScale());
}

View File

@ -14,6 +14,8 @@ CScriptCoverPoint::CScriptCoverPoint(TUniqueId uid, std::string_view name, const
, xe8_26_landHere((flags & 0x20) != 0u)
, xe8_27_wallHang((flags & 0x10) != 0u)
, xe8_28_stay((flags & 0x8) != 0u)
, xe8_29_((flags & 0x4) != 0u)
, xe8_30_attackDirection((flags & 0x2) != 0u)
, xf4_coverTime(coverTime)
, xf8_24_crouch(crouch)
, xf8_25_inUse(false) {

View File

@ -4,6 +4,7 @@
#include <string_view>
#include "Runtime/GCNTypes.hpp"
#include "Runtime/Character/CharacterCommon.hpp"
#include "Runtime/World/CActor.hpp"
#include <zeus/CAABox.hpp>
@ -13,6 +14,8 @@ class CScriptCoverPoint : public CActor {
bool xe8_26_landHere : 1;
bool xe8_27_wallHang : 1;
bool xe8_28_stay : 1;
bool xe8_29_ : 1;
bool xe8_30_attackDirection : 1;
float xec_cosHorizontalAngle;
float xf0_sinVerticalAngle;
float xf4_coverTime;
@ -42,7 +45,9 @@ public:
bool Blown(const zeus::CVector3f& pos) const;
float GetSinSqVerticalAngle() const;
float GetCosHorizontalAngle() const { return xec_cosHorizontalAngle; }
u32 GetAttackDirection() const { return xe8_flags; }
pas::ECoverDirection GetAttackDirection() const {
return xe8_30_attackDirection ? pas::ECoverDirection::Left : pas::ECoverDirection::Right;
}
void Reserve(TUniqueId id) { xfa_occupant = id; }
};
} // namespace urde