mirror of https://github.com/AxioDL/metaforce.git
Working grapple beam
This commit is contained in:
parent
73d48c9b41
commit
cd3bba2f0e
|
@ -735,9 +735,9 @@ void CAnimData::SetAnimation(const CAnimPlaybackParms& parms, bool noTrans)
|
||||||
{
|
{
|
||||||
if (parms.GetAnimationId() == x40c_playbackParms.GetAnimationId() ||
|
if (parms.GetAnimationId() == x40c_playbackParms.GetAnimationId() ||
|
||||||
(parms.GetSecondAnimationId() == x40c_playbackParms.GetSecondAnimationId() &&
|
(parms.GetSecondAnimationId() == x40c_playbackParms.GetSecondAnimationId() &&
|
||||||
parms.GetBlendFactor() == x40c_playbackParms.GetBlendFactor() &&
|
parms.GetSecondAnimationId() != -1) ||
|
||||||
parms.GetBlendFactor() != 1.f) ||
|
(parms.GetBlendFactor() == x40c_playbackParms.GetBlendFactor() &&
|
||||||
parms.GetSecondAnimationId() == -1)
|
parms.GetBlendFactor() != 1.f))
|
||||||
{
|
{
|
||||||
if (x220_29_animationJustStarted)
|
if (x220_29_animationJustStarted)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -211,8 +211,7 @@ static zeus::CVector3f ClipRayToPlane(const zeus::CVector3f& a, const zeus::CVec
|
||||||
bool CMetroidAreaCollider::ConvexPolyCollision(const zeus::CPlane* planes, const zeus::CVector3f* verts,
|
bool CMetroidAreaCollider::ConvexPolyCollision(const zeus::CPlane* planes, const zeus::CVector3f* verts,
|
||||||
zeus::CAABox& aabb)
|
zeus::CAABox& aabb)
|
||||||
{
|
{
|
||||||
/* FIXME: HACK: Increasing the size from 20 to 128 to give us more headroom, we should try and trim this back down to a more reasonable size */
|
rstl::reserved_vector<zeus::CVector3f, 20> vecs[2];
|
||||||
rstl::reserved_vector<zeus::CVector3f, 128> vecs[2];
|
|
||||||
|
|
||||||
g_CalledClip += 1;
|
g_CalledClip += 1;
|
||||||
g_RejectedByClip -= 1;
|
g_RejectedByClip -= 1;
|
||||||
|
@ -225,8 +224,8 @@ bool CMetroidAreaCollider::ConvexPolyCollision(const zeus::CPlane* planes, const
|
||||||
int otherVecIdx = 1;
|
int otherVecIdx = 1;
|
||||||
for (int i=0 ; i<6 ; ++i)
|
for (int i=0 ; i<6 ; ++i)
|
||||||
{
|
{
|
||||||
rstl::reserved_vector<zeus::CVector3f, 128>& vec = vecs[vecIdx];
|
rstl::reserved_vector<zeus::CVector3f, 20>& vec = vecs[vecIdx];
|
||||||
rstl::reserved_vector<zeus::CVector3f, 128>& otherVec = vecs[otherVecIdx];
|
rstl::reserved_vector<zeus::CVector3f, 20>& otherVec = vecs[otherVecIdx];
|
||||||
otherVec.clear();
|
otherVec.clear();
|
||||||
|
|
||||||
bool inFrontOf = planes[i].pointToPlaneDist(vec.front()) >= 0.f;
|
bool inFrontOf = planes[i].pointToPlaneDist(vec.front()) >= 0.f;
|
||||||
|
@ -235,8 +234,10 @@ bool CMetroidAreaCollider::ConvexPolyCollision(const zeus::CPlane* planes, const
|
||||||
const zeus::CVector3f& b = vec[(j + 1) % vec.size()];
|
const zeus::CVector3f& b = vec[(j + 1) % vec.size()];
|
||||||
if (inFrontOf)
|
if (inFrontOf)
|
||||||
otherVec.push_back(vec[j]);
|
otherVec.push_back(vec[j]);
|
||||||
if ((planes[i].pointToPlaneDist(b) >= 0.f) ^ inFrontOf)
|
bool nextInFrontOf = planes[i].pointToPlaneDist(b) >= 0.f;
|
||||||
|
if (nextInFrontOf ^ inFrontOf)
|
||||||
otherVec.push_back(ClipRayToPlane(vec[j], b, planes[i]));
|
otherVec.push_back(ClipRayToPlane(vec[j], b, planes[i]));
|
||||||
|
inFrontOf = nextInFrontOf;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (otherVec.empty())
|
if (otherVec.empty())
|
||||||
|
@ -246,7 +247,7 @@ bool CMetroidAreaCollider::ConvexPolyCollision(const zeus::CPlane* planes, const
|
||||||
otherVecIdx ^= 1;
|
otherVecIdx ^= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rstl::reserved_vector<zeus::CVector3f, 128>& accumVec = vecs[otherVecIdx ^ 1];
|
rstl::reserved_vector<zeus::CVector3f, 20>& accumVec = vecs[otherVecIdx ^ 1];
|
||||||
for (const zeus::CVector3f& point : accumVec)
|
for (const zeus::CVector3f& point : accumVec)
|
||||||
aabb.accumulateBounds(point);
|
aabb.accumulateBounds(point);
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ void CCompoundTargetReticle::Update(float dt, const CStateManager& mgr)
|
||||||
xc4_chargeGauge.x0_model.Lock();
|
xc4_chargeGauge.x0_model.Lock();
|
||||||
else
|
else
|
||||||
xc4_chargeGauge.x0_model.Unlock();
|
xc4_chargeGauge.x0_model.Unlock();
|
||||||
if (scan)
|
if (!scan)
|
||||||
x94_grapple.Lock();
|
x94_grapple.Lock();
|
||||||
else
|
else
|
||||||
x94_grapple.Unlock();
|
x94_grapple.Unlock();
|
||||||
|
@ -492,12 +492,12 @@ void CCompoundTargetReticle::DrawGrapplePoint(const CScriptGrapplePoint& point,
|
||||||
color = g_tweakTargeting->GetLockedGrapplePointSelectColor();
|
color = g_tweakTargeting->GetLockedGrapplePointSelectColor();
|
||||||
else
|
else
|
||||||
color = g_tweakTargeting->GetGrapplePointSelectColor();
|
color = g_tweakTargeting->GetGrapplePointSelectColor();
|
||||||
color = zeus::CColor::lerp(color, g_tweakTargeting->GetGrapplePointColor(), t);
|
color = zeus::CColor::lerp(g_tweakTargeting->GetGrapplePointColor(), color, t);
|
||||||
zeus::CMatrix3f scale(
|
zeus::CMatrix3f scale(
|
||||||
CalculateClampedScale(orbitPos, 1.f, g_tweakTargeting->GetGrappleClampMin(),
|
CalculateClampedScale(orbitPos, 1.f, g_tweakTargeting->GetGrappleClampMin(),
|
||||||
g_tweakTargeting->GetGrappleClampMax(), mgr) *
|
g_tweakTargeting->GetGrappleClampMax(), mgr) *
|
||||||
(1.f - t) * g_tweakTargeting->GetGrappleScale() + t * g_tweakTargeting->GetGrappleSelectScale());
|
((1.f - t) * g_tweakTargeting->GetGrappleScale() + t * g_tweakTargeting->GetGrappleSelectScale()));
|
||||||
zeus::CTransform modelXf(scale, orbitPos);
|
zeus::CTransform modelXf(rot * scale, orbitPos);
|
||||||
CGraphics::SetModelMatrix(modelXf);
|
CGraphics::SetModelMatrix(modelXf);
|
||||||
CModelFlags flags(7, 0, 0, color);
|
CModelFlags flags(7, 0, 0, color);
|
||||||
x94_grapple->Draw(flags);
|
x94_grapple->Draw(flags);
|
||||||
|
|
|
@ -2016,7 +2016,7 @@ CFrontEndUI::CFrontEndUI()
|
||||||
m_touchBar = NewFrontEndUITouchBar();
|
m_touchBar = NewFrontEndUITouchBar();
|
||||||
m_touchBar->SetPhase(CFrontEndUITouchBar::EPhase::None);
|
m_touchBar->SetPhase(CFrontEndUITouchBar::EPhase::None);
|
||||||
|
|
||||||
//x14_phase = EPhase::ExitFrontEnd;
|
x14_phase = EPhase::ExitFrontEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrontEndUI::StartSlideShow(CArchitectureQueue& queue)
|
void CFrontEndUI::StartSlideShow(CArchitectureQueue& queue)
|
||||||
|
|
|
@ -233,9 +233,9 @@ bool CParticleSwoosh::Update(double dt)
|
||||||
timeElem->GetValue(x28_curFrame, time);
|
timeElem->GetValue(x28_curFrame, time);
|
||||||
|
|
||||||
x30_curTime += std::max(0.0, dt * time);
|
x30_curTime += std::max(0.0, dt * time);
|
||||||
while (!x1d0_26_disableUpdate && evalTime < x30_curTime)
|
while (x1d0_26_forceOneUpdate || evalTime < x30_curTime)
|
||||||
{
|
{
|
||||||
x1d0_26_disableUpdate = false;
|
x1d0_26_forceOneUpdate = false;
|
||||||
|
|
||||||
x158_curParticle += 1;
|
x158_curParticle += 1;
|
||||||
if (x158_curParticle >= x15c_swooshes.size())
|
if (x158_curParticle >= x15c_swooshes.size())
|
||||||
|
|
|
@ -80,7 +80,7 @@ class CParticleSwoosh : public CParticleGen
|
||||||
{
|
{
|
||||||
bool x1d0_24_emitting : 1;
|
bool x1d0_24_emitting : 1;
|
||||||
bool x1d0_25_AALP : 1;
|
bool x1d0_25_AALP : 1;
|
||||||
bool x1d0_26_disableUpdate : 1;
|
bool x1d0_26_forceOneUpdate : 1;
|
||||||
bool x1d0_27_renderGaps : 1;
|
bool x1d0_27_renderGaps : 1;
|
||||||
bool x1d0_28_LLRD : 1;
|
bool x1d0_28_LLRD : 1;
|
||||||
bool x1d0_29_VLS1 : 1;
|
bool x1d0_29_VLS1 : 1;
|
||||||
|
@ -162,7 +162,7 @@ public:
|
||||||
|
|
||||||
void DoWarmupUpdate()
|
void DoWarmupUpdate()
|
||||||
{
|
{
|
||||||
x1d0_26_disableUpdate = true;
|
x1d0_26_forceOneUpdate = true;
|
||||||
Update(0.0);
|
Update(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ public:
|
||||||
{
|
{
|
||||||
for (int i=0 ; i<x15c_swooshes.size() ; ++i)
|
for (int i=0 ; i<x15c_swooshes.size() ; ++i)
|
||||||
{
|
{
|
||||||
x1d0_26_disableUpdate = true;
|
x1d0_26_forceOneUpdate = true;
|
||||||
Update(0.0);
|
Update(0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ public:
|
||||||
{
|
{
|
||||||
for (int i=0 ; i<x15c_swooshes.size()-1 ; ++i)
|
for (int i=0 ; i<x15c_swooshes.size()-1 ; ++i)
|
||||||
{
|
{
|
||||||
x1d0_26_disableUpdate = true;
|
x1d0_26_forceOneUpdate = true;
|
||||||
Update(0.0);
|
Update(0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ public:
|
||||||
for (int i=0 ; i<6 ; ++i)
|
for (int i=0 ; i<6 ; ++i)
|
||||||
{
|
{
|
||||||
SetTranslation(translation);
|
SetTranslation(translation);
|
||||||
x1d0_26_disableUpdate = true;
|
x1d0_26_forceOneUpdate = true;
|
||||||
Update(0.0);
|
Update(0.0);
|
||||||
translation += transInc;
|
translation += transInc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ CGrappleArm::CGrappleArm(const zeus::CVector3f& scale)
|
||||||
x360_grappleClawDesc(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), g_tweakGunRes->xb8_grappleClaw})),
|
x360_grappleClawDesc(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), g_tweakGunRes->xb8_grappleClaw})),
|
||||||
x36c_grappleHitDesc(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), g_tweakGunRes->xbc_grappleHit})),
|
x36c_grappleHitDesc(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), g_tweakGunRes->xbc_grappleHit})),
|
||||||
x378_grappleMuzzleDesc(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), g_tweakGunRes->xc0_grappleMuzzle})),
|
x378_grappleMuzzleDesc(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), g_tweakGunRes->xc0_grappleMuzzle})),
|
||||||
x384_grappleSwooshDesc(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), g_tweakGunRes->xc4_grappleSwoosh})),
|
x384_grappleSwooshDesc(g_SimplePool->GetObj(SObjectTag{FOURCC('SWHC'), g_tweakGunRes->xc4_grappleSwoosh})),
|
||||||
x390_grappleSegmentGen(std::make_unique<CElementGen>(x354_grappleSegmentDesc)),
|
x390_grappleSegmentGen(std::make_unique<CElementGen>(x354_grappleSegmentDesc)),
|
||||||
x394_grappleClawGen(std::make_unique<CElementGen>(x360_grappleClawDesc)),
|
x394_grappleClawGen(std::make_unique<CElementGen>(x360_grappleClawDesc)),
|
||||||
x398_grappleHitGen(std::make_unique<CElementGen>(x36c_grappleHitDesc)),
|
x398_grappleHitGen(std::make_unique<CElementGen>(x36c_grappleHitDesc)),
|
||||||
|
@ -272,6 +272,7 @@ void CGrappleArm::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node,
|
||||||
case EUserEventType::Projectile:
|
case EUserEventType::Projectile:
|
||||||
if (x3b2_27_armMoving)
|
if (x3b2_27_armMoving)
|
||||||
return;
|
return;
|
||||||
|
x3b2_25_beamActive = true;
|
||||||
x398_grappleHitGen = std::make_unique<CElementGen>(x36c_grappleHitDesc);
|
x398_grappleHitGen = std::make_unique<CElementGen>(x36c_grappleHitDesc);
|
||||||
x39c_grappleMuzzleGen = std::make_unique<CElementGen>(x378_grappleMuzzleDesc);
|
x39c_grappleMuzzleGen = std::make_unique<CElementGen>(x378_grappleMuzzleDesc);
|
||||||
x338_beamT = 0.f;
|
x338_beamT = 0.f;
|
||||||
|
|
|
@ -3771,8 +3771,10 @@ void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, f
|
||||||
{
|
{
|
||||||
zeus::CVector3f pointToPlayerFlat = pointToPlayer;
|
zeus::CVector3f pointToPlayerFlat = pointToPlayer;
|
||||||
pointToPlayerFlat.z = 0.f;
|
pointToPlayerFlat.z = 0.f;
|
||||||
|
zeus::CVector3f pointAtPlayerHeight = point->GetTranslation();
|
||||||
|
pointAtPlayerHeight.z = GetTranslation().z;
|
||||||
zeus::CVector3f playerToGrapplePlane =
|
zeus::CVector3f playerToGrapplePlane =
|
||||||
point->GetTranslation() + turnRot.transform(pointToPlayerFlat) - GetTranslation();
|
pointAtPlayerHeight + turnRot.transform(pointToPlayerFlat) - GetTranslation();
|
||||||
if (playerToGrapplePlane.canBeNormalized())
|
if (playerToGrapplePlane.canBeNormalized())
|
||||||
pullVec += playerToGrapplePlane / dt;
|
pullVec += playerToGrapplePlane / dt;
|
||||||
}
|
}
|
||||||
|
@ -3876,7 +3878,7 @@ void CPlayer::UpdateGrappleState(const CFinalInput& input, CStateManager& mgr)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!g_tweakPlayer->GetGrappleJumpMode() && x3d8_grappleJumpTimeout <= 0.f)
|
if (g_tweakPlayer->GetGrappleJumpMode() == 0 && x3d8_grappleJumpTimeout <= 0.f)
|
||||||
ApplyGrappleJump(mgr);
|
ApplyGrappleJump(mgr);
|
||||||
BreakGrapple(EPlayerOrbitRequest::StopOrbit, mgr);
|
BreakGrapple(EPlayerOrbitRequest::StopOrbit, mgr);
|
||||||
}
|
}
|
||||||
|
@ -3946,7 +3948,10 @@ void CPlayer::UpdateGrappleState(const CFinalInput& input, CStateManager& mgr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case EGrappleState::None:
|
case EGrappleState::None:
|
||||||
x3b8_grappleState = EGrappleState::Firing;
|
x3b8_grappleState = EGrappleState::Firing;
|
||||||
x490_gun->GetGrappleArm().Activate(true);
|
x490_gun->GetGrappleArm().Activate(true);
|
||||||
|
|
|
@ -9,12 +9,11 @@ namespace urde
|
||||||
CScriptGrapplePoint::CScriptGrapplePoint(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
CScriptGrapplePoint::CScriptGrapplePoint(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||||
const zeus::CTransform &transform, bool active,
|
const zeus::CTransform &transform, bool active,
|
||||||
const CGrappleParameters ¶ms)
|
const CGrappleParameters ¶ms)
|
||||||
: CActor(uid, active, name, info, transform, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Orbit),
|
: CActor(uid, active, name, info, transform, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Orbit),
|
||||||
CActorParameters::None(),
|
CActorParameters::None(),
|
||||||
kInvalidUniqueId),
|
kInvalidUniqueId),
|
||||||
xe8_(x34_transform.origin - 0.5f,
|
xe8_touchBounds(x34_transform.origin - 0.5f, x34_transform.origin + 0.5f),
|
||||||
x34_transform.origin + 0.5f),
|
x100_parameters(params)
|
||||||
x100_parameters(params)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,4 +22,47 @@ void CScriptGrapplePoint::Accept(IVisitor& visitor)
|
||||||
visitor.Visit(this);
|
visitor.Visit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CScriptGrapplePoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr)
|
||||||
|
{
|
||||||
|
switch (msg)
|
||||||
|
{
|
||||||
|
case EScriptObjectMessage::Activate:
|
||||||
|
if (!GetActive())
|
||||||
|
{
|
||||||
|
AddMaterial(EMaterialTypes::Orbit, mgr);
|
||||||
|
SetActive(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case EScriptObjectMessage::Deactivate:
|
||||||
|
if (GetActive())
|
||||||
|
{
|
||||||
|
RemoveMaterial(EMaterialTypes::Orbit, mgr);
|
||||||
|
SetActive(false);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptGrapplePoint::Think(float, CStateManager&)
|
||||||
|
{
|
||||||
|
// Empty
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptGrapplePoint::Render(const CStateManager&) const
|
||||||
|
{
|
||||||
|
// Empty
|
||||||
|
}
|
||||||
|
|
||||||
|
std::experimental::optional<zeus::CAABox> CScriptGrapplePoint::GetTouchBounds() const
|
||||||
|
{
|
||||||
|
return {xe8_touchBounds};
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptGrapplePoint::AddToRenderer(const zeus::CFrustum&, const CStateManager& mgr) const
|
||||||
|
{
|
||||||
|
CActor::EnsureRendered(mgr);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,18 @@ namespace urde
|
||||||
{
|
{
|
||||||
class CScriptGrapplePoint : public CActor
|
class CScriptGrapplePoint : public CActor
|
||||||
{
|
{
|
||||||
zeus::CAABox xe8_;
|
zeus::CAABox xe8_touchBounds;
|
||||||
CGrappleParameters x100_parameters;
|
CGrappleParameters x100_parameters;
|
||||||
public:
|
public:
|
||||||
CScriptGrapplePoint(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
CScriptGrapplePoint(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||||
const zeus::CTransform& transform, bool active, const CGrappleParameters& params);
|
const zeus::CTransform& transform, bool active, const CGrappleParameters& params);
|
||||||
|
|
||||||
void Accept(IVisitor& visitor);
|
void Accept(IVisitor& visitor);
|
||||||
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||||
|
void Think(float, CStateManager&);
|
||||||
|
void Render(const CStateManager&) const;
|
||||||
|
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||||
|
void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const;
|
||||||
const CGrappleParameters& GetGrappleParameters() const { return x100_parameters; }
|
const CGrappleParameters& GetGrappleParameters() const { return x100_parameters; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue