mirror of https://github.com/PrimeDecomp/prime.git
Link CScriptCoverPoint
Former-commit-id: 6d203db22386d1b0982b3d70d72707ea2f1b6b86
This commit is contained in:
parent
7e364e92a5
commit
3a1d0d0d34
|
@ -406,7 +406,7 @@ config.libs = [
|
||||||
Object(NonMatching, "MetroidPrime/CRippleManager.cpp"),
|
Object(NonMatching, "MetroidPrime/CRippleManager.cpp"),
|
||||||
Object(NonMatching, "MetroidPrime/Player/CGrappleArm.cpp"),
|
Object(NonMatching, "MetroidPrime/Player/CGrappleArm.cpp"),
|
||||||
Object(NonMatching, "MetroidPrime/Enemies/CSpacePirate.cpp"),
|
Object(NonMatching, "MetroidPrime/Enemies/CSpacePirate.cpp"),
|
||||||
Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptCoverPoint.cpp"),
|
Object(Matching, "MetroidPrime/ScriptObjects/CScriptCoverPoint.cpp"),
|
||||||
Object(NonMatching, "MetroidPrime/Cameras/CPathCamera.cpp"),
|
Object(NonMatching, "MetroidPrime/Cameras/CPathCamera.cpp"),
|
||||||
Object(NonMatching, "MetroidPrime/CFluidPlane.cpp"),
|
Object(NonMatching, "MetroidPrime/CFluidPlane.cpp"),
|
||||||
Object(NonMatching, "MetroidPrime/CFluidPlaneManager.cpp"),
|
Object(NonMatching, "MetroidPrime/CFluidPlaneManager.cpp"),
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
bool ShouldLandHere() const;
|
bool ShouldLandHere() const;
|
||||||
void SetInUse(bool inUse);
|
void SetInUse(bool inUse);
|
||||||
bool GetInUse(TUniqueId uid) const;
|
bool GetInUse(TUniqueId uid) const;
|
||||||
bool Blown(const CVector3f& pos) const;
|
const bool Blown(const CVector3f& pos) const;
|
||||||
float GetSinSqVerticalAngle() const;
|
float GetSinSqVerticalAngle() const;
|
||||||
float GetCosHorizontalAngle() const;
|
float GetCosHorizontalAngle() const;
|
||||||
pas::ECoverDirection GetAttackDirection() const;
|
pas::ECoverDirection GetAttackDirection() const;
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include "MetroidPrime/CActorParameters.hpp"
|
#include "MetroidPrime/CActorParameters.hpp"
|
||||||
|
|
||||||
|
#include "Kyoto/Math/CUnitVector3f.hpp"
|
||||||
|
|
||||||
CScriptCoverPoint::CScriptCoverPoint(TUniqueId uid, const rstl::string& name,
|
CScriptCoverPoint::CScriptCoverPoint(TUniqueId uid, const rstl::string& name,
|
||||||
const CEntityInfo& info, const CTransform4f& xf, bool active,
|
const CEntityInfo& info, const CTransform4f& xf, bool active,
|
||||||
uint flags, bool crouch, float horizontalAngle,
|
uint flags, bool crouch, float horizontalAngle,
|
||||||
|
@ -27,7 +29,8 @@ void CScriptCoverPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid,
|
||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case kSM_InitializedInArea:
|
case kSM_InitializedInArea:
|
||||||
for (rstl::vector< SConnection >::const_iterator conn = GetConnectionList().begin(); conn != GetConnectionList().end(); ++conn) {
|
for (rstl::vector< SConnection >::const_iterator conn = GetConnectionList().begin();
|
||||||
|
conn != GetConnectionList().end(); ++conn) {
|
||||||
if (conn->x0_state == kSS_Retreat) {
|
if (conn->x0_state == kSS_Retreat) {
|
||||||
xfc_retreating = mgr.GetIdForScript(conn->x8_objId);
|
xfc_retreating = mgr.GetIdForScript(conn->x8_objId);
|
||||||
break;
|
break;
|
||||||
|
@ -56,7 +59,7 @@ float CScriptCoverPoint::GetSinSqVerticalAngle() const {
|
||||||
return xf0_sinVerticalAngle * xf0_sinVerticalAngle;
|
return xf0_sinVerticalAngle * xf0_sinVerticalAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CScriptCoverPoint::Blown(const CVector3f& point) const {
|
const bool CScriptCoverPoint::Blown(const CVector3f& point) const {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
if (GetActive()) {
|
if (GetActive()) {
|
||||||
|
@ -67,12 +70,9 @@ bool CScriptCoverPoint::Blown(const CVector3f& point) const {
|
||||||
float magnitude = posDif.Magnitude();
|
float magnitude = posDif.Magnitude();
|
||||||
posDif *= 1.f / magnitude;
|
posDif *= 1.f / magnitude;
|
||||||
if (magnitude > 8.0f) {
|
if (magnitude > 8.0f) {
|
||||||
CVector3f normDif(posDif.DropZ());
|
CUnitVector3f normDif(posDif.GetX(), posDif.GetY(), 0.f, CUnitVector3f::kN_Yes);
|
||||||
normDif.Normalize();
|
CUnitVector3f frontVec(GetTransform().GetColumn(kDY).GetX(),
|
||||||
|
GetTransform().GetColumn(kDY).GetY(), 0.f, CUnitVector3f::kN_Yes);
|
||||||
CVector3f frontVec(GetTransform().GetForward().DropZ());
|
|
||||||
frontVec.Normalize();
|
|
||||||
|
|
||||||
if (CVector3f::Dot(frontVec, normDif) > GetCosHorizontalAngle() &&
|
if (CVector3f::Dot(frontVec, normDif) > GetCosHorizontalAngle() &&
|
||||||
(posDif.GetZ() * posDif.GetZ()) < GetSinSqVerticalAngle())
|
(posDif.GetZ() * posDif.GetZ()) < GetSinSqVerticalAngle())
|
||||||
result = false;
|
result = false;
|
||||||
|
@ -83,28 +83,8 @@ bool CScriptCoverPoint::Blown(const CVector3f& point) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CScriptCoverPoint::GetInUse(TUniqueId uid) const {
|
bool CScriptCoverPoint::GetInUse(TUniqueId uid) const {
|
||||||
// bool result = false;
|
return xf8_25_inUse || x11c_timeLeft > 0.f ||
|
||||||
// do {
|
(xfa_occupant != kInvalidUniqueId && uid != kInvalidUniqueId && uid != xfa_occupant);
|
||||||
// if (!xf8_25_inUse && !(x11c_timeLeft > 0.f)) {
|
|
||||||
// if (xfa_occupant == kInvalidUniqueId)
|
|
||||||
// break;
|
|
||||||
// if (uid == kInvalidUniqueId)
|
|
||||||
// break;
|
|
||||||
// if (xfa_occupant == uid)
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// result = true;
|
|
||||||
// } while (false);
|
|
||||||
// return result;
|
|
||||||
|
|
||||||
bool result = false;
|
|
||||||
if (!xf8_25_inUse && !(x11c_timeLeft > 0.f)) {
|
|
||||||
if (xfa_occupant != kInvalidUniqueId && uid != kInvalidUniqueId && xfa_occupant != uid)
|
|
||||||
result = true;
|
|
||||||
} else {
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptCoverPoint::SetInUse(bool inUse) {
|
void CScriptCoverPoint::SetInUse(bool inUse) {
|
||||||
|
|
Loading…
Reference in New Issue