mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 01:07:43 +00:00
Finish CSamusDoll
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "CDependencyGroup.hpp"
|
||||
#include "zeus/CEulerAngles.hpp"
|
||||
#include "Collision/CollisionUtil.hpp"
|
||||
#include "Graphics/CBooRenderer.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
@@ -113,6 +114,45 @@ static const u32 Character2and3Idxs[8][2] =
|
||||
{30, 31}
|
||||
};
|
||||
|
||||
static const u8 BallGlowColors[9][3] =
|
||||
{
|
||||
{0xff, 0xff, 0xff},
|
||||
{0xff, 0xff, 0xff},
|
||||
{0xff, 0xff, 0xff},
|
||||
{0xff, 0xff, 0xff},
|
||||
{0xff, 0xd5, 0x19},
|
||||
{0xff, 0xff, 0xff},
|
||||
{0xff, 0xff, 0xff},
|
||||
{0xff, 0xff, 0xff},
|
||||
{0xff, 0xff, 0xff},
|
||||
};
|
||||
|
||||
static const u8 BallTransFlashColors[9][3] =
|
||||
{
|
||||
{0xc2, 0x7e, 0x10},
|
||||
{0x66, 0xc4, 0xff},
|
||||
{0x60, 0xff, 0x90},
|
||||
{0x33, 0x33, 0xff},
|
||||
{0xff, 0x20, 0x20},
|
||||
{0x0, 0x9d, 0xb6},
|
||||
{0xd3, 0xf1, 0x0},
|
||||
{0xa6, 0x86, 0xd8},
|
||||
{0xfb, 0x98, 0x21}
|
||||
};
|
||||
|
||||
static const u8 BallAuxGlowColors[9][3] =
|
||||
{
|
||||
{0xc2, 0x7e, 0x10},
|
||||
{0x66, 0xc4, 0xff},
|
||||
{0x6c, 0xff, 0x61},
|
||||
{0x33, 0x33, 0xff},
|
||||
{0xff, 0x20, 0x20},
|
||||
{0x0, 0x9d, 0xb6},
|
||||
{0xd3, 0xf1, 0x0},
|
||||
{0xa6, 0x86, 0xd8},
|
||||
{0xfb, 0x98, 0x21}
|
||||
};
|
||||
|
||||
CSamusDoll::CSamusDoll(const CDependencyGroup& suitDgrp, const CDependencyGroup& ballDgrp,
|
||||
CPlayerState::EPlayerSuit suit, CPlayerState::EBeamId beam,
|
||||
bool hasSpiderBall, bool hasGrappleBeam)
|
||||
@@ -166,7 +206,7 @@ bool CSamusDoll::IsLoaded() const
|
||||
return false;
|
||||
if (x218_invFins && !x218_invFins.IsLoaded())
|
||||
return false;
|
||||
return xc8_suitModel1.operator bool();
|
||||
return xc8_suitModel0.operator bool();
|
||||
}
|
||||
|
||||
CModelData CSamusDoll::BuildSuitModelData1(CPlayerState::EPlayerSuit suit)
|
||||
@@ -196,7 +236,7 @@ bool CSamusDoll::CheckLoadComplete()
|
||||
if (!tok.IsLoaded())
|
||||
return false;
|
||||
|
||||
xc8_suitModel1.emplace(BuildSuitModelData1(x44_suit));
|
||||
xc8_suitModel0.emplace(BuildSuitModelData1(x44_suit));
|
||||
for (int i=0 ; i<2 ; ++i)
|
||||
{
|
||||
CAnimRes res(g_ResFactory->GetResourceIdByName("ANCS_ItemScreenSamus")->id,
|
||||
@@ -222,55 +262,448 @@ bool CSamusDoll::CheckLoadComplete()
|
||||
|
||||
void CSamusDoll::Update(float dt, CRandom16& rand)
|
||||
{
|
||||
if (x1f4_invBeam.IsLoaded())
|
||||
x1f4_invBeam->Touch(0);
|
||||
if (x200_invVisor.IsLoaded())
|
||||
x200_invVisor->Touch(0);
|
||||
if (x20c_invGrappleBeam.IsLoaded())
|
||||
x20c_invGrappleBeam->Touch(0);
|
||||
if (x1d4_spiderBallGlass.IsLoaded())
|
||||
x1d4_spiderBallGlass->Touch(0);
|
||||
if (x218_invFins.IsLoaded())
|
||||
x218_invFins->Touch(0);
|
||||
|
||||
if (!CheckLoadComplete())
|
||||
return;
|
||||
|
||||
x40_alphaIn = std::min(x40_alphaIn + 2.f * dt, 1.f);
|
||||
if (x54_remTransitionTime > 0.f)
|
||||
{
|
||||
float oldRemTransTime = x54_remTransitionTime;
|
||||
x54_remTransitionTime = std::max(0.f, x54_remTransitionTime - dt);
|
||||
if (!x4c_completedMorphball && x4d_selectedMorphball &&
|
||||
oldRemTransTime >= x50_totalTransitionTime - 0.5f &&
|
||||
x54_remTransitionTime < x50_totalTransitionTime - 0.5f)
|
||||
{
|
||||
x238_ballTransitionFlashGen = std::make_unique<CElementGen>(x230_ballTransitionFlash,
|
||||
CElementGen::EModelOrientationType::Normal,
|
||||
CElementGen::EOptionalSystemFlags::One);
|
||||
x238_ballTransitionFlashGen->SetGlobalScale(zeus::CVector3f(0.625f));
|
||||
}
|
||||
|
||||
if (x54_remTransitionTime == 0.f)
|
||||
{
|
||||
x4c_completedMorphball = x4d_selectedMorphball;
|
||||
if (!x4d_selectedMorphball)
|
||||
{
|
||||
xc8_suitModel0->AnimationData()->SetAnimation(CAnimPlaybackParms(2, -1, 1.f, true), false);
|
||||
x134_suitModelBoots->AnimationData()->SetAnimation(CAnimPlaybackParms(2, -1, 1.f, true), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (x270_26_pulseSuit)
|
||||
x58_suitPulseFactor = std::min(x58_suitPulseFactor + 2.f * dt, 1.f);
|
||||
else
|
||||
x58_suitPulseFactor = std::max(x58_suitPulseFactor - 2.f * dt, 0.f);
|
||||
|
||||
if (x270_27_pulseBeam)
|
||||
x5c_beamPulseFactor = std::min(x5c_beamPulseFactor + 2.f * dt, 1.f);
|
||||
else
|
||||
x5c_beamPulseFactor = std::max(x5c_beamPulseFactor - 2.f * dt, 0.f);
|
||||
|
||||
if (x270_28_pulseGrapple)
|
||||
x60_grapplePulseFactor = std::min(x60_grapplePulseFactor + 2.f * dt, 1.f);
|
||||
else
|
||||
x60_grapplePulseFactor = std::max(x60_grapplePulseFactor - 2.f * dt, 0.f);
|
||||
|
||||
if (x270_29_pulseBoots)
|
||||
x64_bootsPulseFactor = std::min(x64_bootsPulseFactor + 2.f * dt, 1.f);
|
||||
else
|
||||
x64_bootsPulseFactor = std::max(x64_bootsPulseFactor - 2.f * dt, 0.f);
|
||||
|
||||
if (x270_30_pulseVisor)
|
||||
x68_visorPulseFactor = std::min(x68_visorPulseFactor + 2.f * dt, 1.f);
|
||||
else
|
||||
x68_visorPulseFactor = std::max(x68_visorPulseFactor - 2.f * dt, 0.f);
|
||||
|
||||
if (x4c_completedMorphball)
|
||||
x6c_ballPulseFactor = std::min(x6c_ballPulseFactor + 2.f * dt, 1.f);
|
||||
else
|
||||
x6c_ballPulseFactor = std::max(x6c_ballPulseFactor - 2.f * dt, 0.f);
|
||||
|
||||
if (x44_suit == CPlayerState::EPlayerSuit::Phazon)
|
||||
{
|
||||
if (!x250_phazonIndirectTexture)
|
||||
x250_phazonIndirectTexture = g_SimplePool->GetObj("PhazonIndirectTexture");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x250_phazonIndirectTexture)
|
||||
x250_phazonIndirectTexture = TLockedToken<CTexture>();
|
||||
}
|
||||
|
||||
if (x250_phazonIndirectTexture)
|
||||
{
|
||||
x260_phazonOffsetAngle += 0.03f;
|
||||
g_Renderer->AllocatePhazonSuitMaskTexture();
|
||||
}
|
||||
|
||||
xc8_suitModel0->AdvanceAnimationIgnoreParticles(dt, rand, true);
|
||||
x134_suitModelBoots->AdvanceAnimationIgnoreParticles(dt, rand, true);
|
||||
x184_ballModelData->AdvanceAnimationIgnoreParticles(dt, rand, true);
|
||||
|
||||
SetupLights();
|
||||
|
||||
x22c_ballInnerGlowGen->SetGlobalTranslation(x10_xf.origin);
|
||||
x22c_ballInnerGlowGen->Update(dt);
|
||||
|
||||
if (x238_ballTransitionFlashGen)
|
||||
{
|
||||
if (x238_ballTransitionFlashGen->IsSystemDeletable())
|
||||
x238_ballTransitionFlashGen.reset();
|
||||
if (x238_ballTransitionFlashGen)
|
||||
{
|
||||
x22c_ballInnerGlowGen->SetGlobalTranslation(x10_xf.origin);
|
||||
x22c_ballInnerGlowGen->Update(dt);
|
||||
}
|
||||
}
|
||||
|
||||
if (xc4_viewInterp != 0.f && xc4_viewInterp != 1.f)
|
||||
{
|
||||
if (xc4_viewInterp < 0.f)
|
||||
xc4_viewInterp = std::min(xc4_viewInterp + 3.f * dt, 0.f);
|
||||
else
|
||||
xc4_viewInterp = std::min(xc4_viewInterp + 3.f * dt, 1.f);
|
||||
|
||||
float interp = std::fabs(xc4_viewInterp);
|
||||
float oneMinusInterp = 1.f - interp;
|
||||
xa4_offset = x84_interpStartOffset * interp + skInitialOffset * oneMinusInterp;
|
||||
|
||||
xb0_userRot = zeus::CQuaternion::slerpShort(x70_fixedRot, x90_userInterpRot, interp);
|
||||
|
||||
if (xc4_viewInterp <= 0.f) // Zoom out
|
||||
xc0_userZoom = x80_fixedZoom * oneMinusInterp + xa0_userInterpZoom * interp;
|
||||
else // Zoom in
|
||||
xc0_userZoom = x80_fixedZoom * interp + xa0_userInterpZoom * oneMinusInterp;
|
||||
}
|
||||
}
|
||||
|
||||
void CSamusDoll::Draw(const CStateManager& mgr, float alpha)
|
||||
{
|
||||
if (!IsLoaded())
|
||||
return;
|
||||
|
||||
alpha *= x40_alphaIn;
|
||||
|
||||
float itemPulse = zeus::clamp(0.f, (std::sin(5.f * CGraphics::GetSecondsMod900()) + 1.f) * 0.5f, 1.f) *
|
||||
(1.f - std::fabs(xc4_viewInterp));
|
||||
|
||||
g_Renderer->SetPerspective(55.f, g_Viewport.x8_width, g_Viewport.xc_height, 0.2f, 4096.f);
|
||||
|
||||
CGraphics::SetViewPointMatrix(zeus::CTransform(xb0_userRot, xa4_offset) *
|
||||
zeus::CTransform::Translate(0.f, xc0_userZoom, 0.f));
|
||||
|
||||
zeus::CTransform gunXf = xc8_suitModel0->GetScaledLocatorTransform("GUN_LCTR");
|
||||
zeus::CTransform visorXf = xc8_suitModel0->GetScaledLocatorTransform("VISOR_LCTR");
|
||||
zeus::CTransform grappleXf = xc8_suitModel0->GetScaledLocatorTransform("GRAPPLE_LCTR");
|
||||
|
||||
if (!x4c_completedMorphball || !x4d_selectedMorphball)
|
||||
{
|
||||
float suitPulse = itemPulse * x58_suitPulseFactor;
|
||||
float bootsPulse = std::max(suitPulse, itemPulse * x64_bootsPulseFactor);
|
||||
|
||||
bool phazonSuit = x44_suit == CPlayerState::EPlayerSuit::Phazon;
|
||||
// Enable dst alpha 1.0
|
||||
|
||||
for (int i=0 ; i<=x118_suitModel1and2.size() ; ++i)
|
||||
{
|
||||
TCachedToken<CSkinnedModel> backupModelData = xc8_suitModel0->GetAnimationData()->GetModelData();
|
||||
if (i < x118_suitModel1and2.size())
|
||||
xc8_suitModel0->AnimationData()->SubstituteModelData(x118_suitModel1and2[i]);
|
||||
xc8_suitModel0->InvSuitDraw(CModelData::EWhichModel::Normal, zeus::CTransform::Identity(),
|
||||
x24c_actorLights.get(), zeus::CColor(1.f, alpha),
|
||||
zeus::CColor(1.f, alpha * suitPulse));
|
||||
xc8_suitModel0->AnimationData()->SubstituteModelData(backupModelData);
|
||||
}
|
||||
|
||||
x134_suitModelBoots->InvSuitDraw(CModelData::EWhichModel::Normal, zeus::CTransform::Identity(),
|
||||
x24c_actorLights.get(), zeus::CColor(1.f, alpha),
|
||||
zeus::CColor(1.f, alpha * bootsPulse));
|
||||
|
||||
{
|
||||
CGraphics::SetModelMatrix(gunXf);
|
||||
x1f4_invBeam->GetInstance().ActivateLights(x23c_lights);
|
||||
CModelFlags flags = {};
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullLEqualAlphaOnly;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
x1f4_invBeam->Draw(flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.x4_color = zeus::CColor(1.f, alpha);
|
||||
x1f4_invBeam->Draw(flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
||||
flags.x4_color = zeus::CColor(1.f, alpha * itemPulse * x5c_beamPulseFactor);
|
||||
x1f4_invBeam->Draw(flags);
|
||||
}
|
||||
|
||||
{
|
||||
CGraphics::SetModelMatrix(visorXf);
|
||||
|
||||
float visorT = std::fmod(CGraphics::GetSecondsMod900(), 1.f) * (1.f - std::fabs(xc4_viewInterp));
|
||||
float alphaBlend = (visorT < 0.25f) ? 1.f - 2.f * visorT : (visorT < 0.5f) ? 2.f * (visorT - 0.25f) + 0.5f : 1.f;
|
||||
float addBlend = (visorT > 0.75f) ? 1.f - 4.f * (visorT - 0.75f) : (visorT > 0.5f) ? 4.f * (visorT - 0.5f) : 0.f;
|
||||
|
||||
x200_invVisor->GetInstance().ActivateLights(x23c_lights);
|
||||
CModelFlags flags = {};
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.x4_color = zeus::CColor::lerp(zeus::CColor(1.f, alpha), zeus::CColor(alphaBlend, alpha), x68_visorPulseFactor);
|
||||
x200_invVisor->Draw(flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
||||
flags.x4_color = zeus::CColor(1.f, alpha * addBlend * x68_visorPulseFactor);
|
||||
x200_invVisor->Draw(flags);
|
||||
}
|
||||
|
||||
if (x270_25_hasGrappleBeam)
|
||||
{
|
||||
CGraphics::SetModelMatrix(grappleXf);
|
||||
|
||||
x20c_invGrappleBeam->GetInstance().ActivateLights(x23c_lights);
|
||||
CModelFlags flags = {};
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.x4_color = zeus::CColor(1.f, alpha);
|
||||
x20c_invGrappleBeam->Draw(flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
||||
flags.x4_color = zeus::CColor(1.f, alpha * itemPulse * x60_grapplePulseFactor);
|
||||
x20c_invGrappleBeam->Draw(flags);
|
||||
}
|
||||
else if (x44_suit >= CPlayerState::EPlayerSuit::FusionPower)
|
||||
{
|
||||
CGraphics::SetModelMatrix(grappleXf);
|
||||
|
||||
x218_invFins->GetInstance().ActivateLights(x23c_lights);
|
||||
CModelFlags flags = {};
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.x4_color = zeus::CColor(1.f, alpha);
|
||||
x218_invFins->Draw(flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
||||
flags.x4_color = zeus::CColor(1.f, alpha * suitPulse);
|
||||
x218_invFins->Draw(flags);
|
||||
}
|
||||
|
||||
if (x54_remTransitionTime > 0.f)
|
||||
{
|
||||
float ballT = 1.f - x54_remTransitionTime / x50_totalTransitionTime;
|
||||
|
||||
float ballAlpha = 0.f;
|
||||
if (x4d_selectedMorphball)
|
||||
ballAlpha = 1.f - std::min(x54_remTransitionTime / 0.25f, 1.f);
|
||||
else if (x4c_completedMorphball)
|
||||
ballAlpha = std::max(0.f, (x54_remTransitionTime - (x50_totalTransitionTime - 0.25f)) / 0.25f);
|
||||
|
||||
if (ballAlpha > 0.f)
|
||||
{
|
||||
CModelFlags flags = {};
|
||||
flags.x1_matSetIdx = x1e0_ballMatIdx;
|
||||
flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullLEqualAlphaOnly;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
x184_ballModelData->Render(mgr, x10_xf, x24c_actorLights.get(), flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
flags.x4_color.a = alpha * ballAlpha;
|
||||
x184_ballModelData->Render(mgr, x10_xf, x24c_actorLights.get(), flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
flags.x4_color.a = x6c_ballPulseFactor * alpha * ballAlpha * itemPulse;
|
||||
x184_ballModelData->Render(mgr, x10_xf, x24c_actorLights.get(), flags);
|
||||
}
|
||||
|
||||
if (x4d_selectedMorphball && ballT > 0.5f)
|
||||
{
|
||||
float ballEndT = (ballT - 0.5f) / 0.5f;
|
||||
float oneMinusBallEndT = 1.f - ballEndT;
|
||||
|
||||
float spinScale = 0.75f * oneMinusBallEndT + 1.f;
|
||||
float spinAlpha;
|
||||
if (ballEndT < 0.1f)
|
||||
spinAlpha = 0.f;
|
||||
else if (ballEndT < 0.2f)
|
||||
spinAlpha = (ballEndT - 0.1f) / 0.1f;
|
||||
else if (ballEndT < 0.9f)
|
||||
spinAlpha = 1.f;
|
||||
else
|
||||
spinAlpha = 1.f - (ballT - 0.9f) / 0.1f;
|
||||
|
||||
zeus::CRelAngle spinAngle = zeus::degToRad(360.f * oneMinusBallEndT);
|
||||
spinAlpha *= 0.5f;
|
||||
if (spinAlpha > 0.f)
|
||||
{
|
||||
CModelFlags flags = {};
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
||||
flags.x1_matSetIdx = x1e0_ballMatIdx;
|
||||
flags.x4_color = zeus::CColor(1.f, spinAlpha * alpha);
|
||||
x184_ballModelData->Render(mgr, x10_xf * zeus::CTransform::RotateZ(spinAngle) * zeus::CTransform::Scale(spinScale),
|
||||
x24c_actorLights.get(), flags);
|
||||
}
|
||||
}
|
||||
|
||||
if (x270_24_hasSpiderBall)
|
||||
{
|
||||
CGraphics::SetModelMatrix(x10_xf);
|
||||
CModelFlags flags = {};
|
||||
flags.x1_matSetIdx = x1e4_glassMatIdx;
|
||||
x1d4_spiderBallGlass->GetInstance().ActivateLights(x23c_lights);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullLEqualAlphaOnly;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
x1d4_spiderBallGlass->Draw(flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
flags.x4_color.a = alpha;
|
||||
x1d4_spiderBallGlass->Draw(flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
flags.x4_color.a = x6c_ballPulseFactor * alpha * itemPulse;
|
||||
x1d4_spiderBallGlass->Draw(flags);
|
||||
}
|
||||
|
||||
if (phazonSuit && alpha > 0.1f)
|
||||
{
|
||||
float radius = zeus::clamp(0.2f, (10.f - (xc0_userZoom >= 0.f ? xc0_userZoom : -xc0_userZoom)) / 20.f, 1.f);
|
||||
float offset = std::sin(x260_phazonOffsetAngle);
|
||||
zeus::CColor color = g_tweakGuiColors->GetInvPhazonSuitFilterMod();
|
||||
color.a = alpha;
|
||||
g_Renderer->DrawPhazonSuitIndirectEffect(zeus::CColor(0.1f, alpha), x250_phazonIndirectTexture,
|
||||
color, radius, 0.1f, offset, offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CModelFlags flags = {};
|
||||
flags.x1_matSetIdx = x1e0_ballMatIdx;
|
||||
flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullLEqualAlphaOnly;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
x184_ballModelData->Render(mgr, x10_xf, x24c_actorLights.get(), flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
flags.x4_color.a = alpha;
|
||||
x184_ballModelData->Render(mgr, x10_xf, x24c_actorLights.get(), flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
flags.x4_color.a = x6c_ballPulseFactor * alpha * itemPulse;
|
||||
x184_ballModelData->Render(mgr, x10_xf, x24c_actorLights.get(), flags);
|
||||
|
||||
const u8* c = BallGlowColors[x1e8_ballGlowColorIdx];
|
||||
zeus::CColor color = {c[0] / 255.f, c[1] / 255.f, c[2] / 255.f, alpha};
|
||||
x22c_ballInnerGlowGen->SetModulationColor(color);
|
||||
|
||||
if (alpha > 0.f)
|
||||
{
|
||||
if (x22c_ballInnerGlowGen->GetNumActiveChildParticles() > 0)
|
||||
{
|
||||
const u8* c = BallTransFlashColors[x1e8_ballGlowColorIdx];
|
||||
zeus::CColor color = {c[0] / 255.f, c[1] / 255.f, c[2] / 255.f, alpha};
|
||||
x22c_ballInnerGlowGen->GetActiveChildParticle(0).SetModulationColor(color);
|
||||
|
||||
if (x22c_ballInnerGlowGen->GetNumActiveChildParticles() > 1)
|
||||
{
|
||||
const u8* c = BallAuxGlowColors[x1e8_ballGlowColorIdx];
|
||||
zeus::CColor color = {c[0] / 255.f, c[1] / 255.f, c[2] / 255.f, alpha};
|
||||
x22c_ballInnerGlowGen->GetActiveChildParticle(1).SetModulationColor(color);
|
||||
}
|
||||
}
|
||||
x22c_ballInnerGlowGen->Render();
|
||||
}
|
||||
|
||||
if (x270_24_hasSpiderBall)
|
||||
{
|
||||
CGraphics::SetModelMatrix(x10_xf);
|
||||
CModelFlags flags = {};
|
||||
flags.x1_matSetIdx = x1e4_glassMatIdx;
|
||||
x1d4_spiderBallGlass->GetInstance().ActivateLights(x23c_lights);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullLEqualAlphaOnly;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
x1d4_spiderBallGlass->Draw(flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
flags.x4_color.a = alpha;
|
||||
x1d4_spiderBallGlass->Draw(flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
flags.x4_color.a = x6c_ballPulseFactor * alpha * itemPulse;
|
||||
x1d4_spiderBallGlass->Draw(flags);
|
||||
}
|
||||
}
|
||||
|
||||
if (x238_ballTransitionFlashGen)
|
||||
{
|
||||
const u8* c = BallTransFlashColors[x1e8_ballGlowColorIdx];
|
||||
zeus::CColor color = {c[0] / 255.f, c[1] / 255.f, c[2] / 255.f, 1.f};
|
||||
x238_ballTransitionFlashGen->SetModulationColor(color);
|
||||
x238_ballTransitionFlashGen->Render();
|
||||
}
|
||||
|
||||
CGraphics::DisableAllLights();
|
||||
}
|
||||
|
||||
void CSamusDoll::Touch()
|
||||
{
|
||||
if (!CheckLoadComplete())
|
||||
return;
|
||||
xc8_suitModel1->AnimationData()->PreRender();
|
||||
xc8_suitModel0->AnimationData()->PreRender();
|
||||
x134_suitModelBoots->AnimationData()->PreRender();
|
||||
x184_ballModelData->AnimationData()->PreRender();
|
||||
xc8_suitModel1->Touch(CModelData::EWhichModel::Normal, 0);
|
||||
xc8_suitModel0->Touch(CModelData::EWhichModel::Normal, 0);
|
||||
x134_suitModelBoots->Touch(CModelData::EWhichModel::Normal, 0);
|
||||
x184_ballModelData->Touch(CModelData::EWhichModel::Normal, 0);
|
||||
}
|
||||
|
||||
void CSamusDoll::SetupLights()
|
||||
{
|
||||
x23c_lights[0] = CLight::BuildDirectional(xb0_rot.toTransform().basis[1], zeus::CColor(0.75f, 1.f));
|
||||
x23c_lights[0] = CLight::BuildDirectional(xb0_userRot.toTransform().basis[1], zeus::CColor(0.75f, 1.f));
|
||||
x24c_actorLights->BuildFakeLightList(x23c_lights, zeus::CColor::skBlack);
|
||||
}
|
||||
|
||||
void CSamusDoll::CheckTransition(bool morphballComplete)
|
||||
void CSamusDoll::SetInMorphball(bool morphball)
|
||||
{
|
||||
if (x54_ > 0.f)
|
||||
if (x54_remTransitionTime > 0.f)
|
||||
return;
|
||||
if (x4d_morphballComplete == morphballComplete)
|
||||
if (x4d_selectedMorphball == morphball)
|
||||
return;
|
||||
x4d_morphballComplete = morphballComplete;
|
||||
x4d_selectedMorphball = morphball;
|
||||
SetTransitionAnimation();
|
||||
}
|
||||
|
||||
void CSamusDoll::SetTransitionAnimation()
|
||||
{
|
||||
if (!x4c_intoBallComplete)
|
||||
if (!x4c_completedMorphball)
|
||||
{
|
||||
xc8_suitModel1->AnimationData()->SetAnimation(CAnimPlaybackParms{0, -1, 1.f, true}, false);
|
||||
/* Into morphball */
|
||||
xc8_suitModel0->AnimationData()->SetAnimation(CAnimPlaybackParms{0, -1, 1.f, true}, false);
|
||||
x134_suitModelBoots->AnimationData()->SetAnimation(CAnimPlaybackParms{0, -1, 1.f, true}, false);
|
||||
x50_ = x54_ = xc8_suitModel1->GetAnimationData()->GetAnimationDuration(0);
|
||||
x50_totalTransitionTime = x54_remTransitionTime = xc8_suitModel0->GetAnimationData()->GetAnimationDuration(0);
|
||||
}
|
||||
else if (!x4d_morphballComplete)
|
||||
else if (!x4d_selectedMorphball)
|
||||
{
|
||||
xc8_suitModel1->AnimationData()->SetAnimation(CAnimPlaybackParms{1, -1, 1.f, true}, false);
|
||||
/* Outta morphball */
|
||||
xc8_suitModel0->AnimationData()->SetAnimation(CAnimPlaybackParms{1, -1, 1.f, true}, false);
|
||||
x134_suitModelBoots->AnimationData()->SetAnimation(CAnimPlaybackParms{1, -1, 1.f, true}, false);
|
||||
x50_ = x54_ = xc8_suitModel1->GetAnimationData()->GetAnimationDuration(1);
|
||||
x50_totalTransitionTime = x54_remTransitionTime = xc8_suitModel0->GetAnimationData()->GetAnimationDuration(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +757,7 @@ void CSamusDoll::SetRotation(float xDelta, float zDelta, float f3)
|
||||
if (xc4_viewInterp != 0.f && xc4_viewInterp != 1.f)
|
||||
return;
|
||||
SetRotationSfxPlaying(xDelta != 0.f || zDelta != 0.f);
|
||||
zeus::CEulerAngles angles(xb0_rot);
|
||||
zeus::CEulerAngles angles(xb0_userRot);
|
||||
|
||||
zeus::CRelAngle angX(angles.x);
|
||||
zeus::CRelAngle angZ(angles.z);
|
||||
@@ -345,7 +778,7 @@ void CSamusDoll::SetRotation(float xDelta, float zDelta, float f3)
|
||||
zeus::CQuaternion quat;
|
||||
quat.rotateZ(angZ);
|
||||
quat.rotateX(angX);
|
||||
xb0_rot = quat;
|
||||
xb0_userRot = quat;
|
||||
}
|
||||
|
||||
void CSamusDoll::SetOffset(const zeus::CVector3f& offset, float sfxThreshold)
|
||||
@@ -353,13 +786,13 @@ void CSamusDoll::SetOffset(const zeus::CVector3f& offset, float sfxThreshold)
|
||||
if (xc4_viewInterp != 0.f && xc4_viewInterp != 1.f)
|
||||
return;
|
||||
zeus::CVector3f oldOffset = xa4_offset;
|
||||
zeus::CMatrix3f rotMtx = xb0_rot.toTransform().basis;
|
||||
zeus::CMatrix3f rotMtx = xb0_userRot.toTransform().basis;
|
||||
xa4_offset += rotMtx * zeus::CVector3f(offset.x, 0.f, offset.z);
|
||||
SetOffsetSfxPlaying((oldOffset - xa4_offset).magnitude() > sfxThreshold);
|
||||
float oldZoom = xc0_zoom;
|
||||
xc0_zoom = zeus::clamp(-4.f, xc0_zoom + offset.y, -2.2f);
|
||||
bool zoomSfx = std::fabs(xc0_zoom - oldZoom) > sfxThreshold;
|
||||
float zoomDelta = offset.y - (xc0_zoom - oldZoom);
|
||||
float oldZoom = xc0_userZoom;
|
||||
xc0_userZoom = zeus::clamp(-4.f, xc0_userZoom + offset.y, -2.2f);
|
||||
bool zoomSfx = std::fabs(xc0_userZoom - oldZoom) > sfxThreshold;
|
||||
float zoomDelta = offset.y - (xc0_userZoom - oldZoom);
|
||||
zeus::CVector3f newOffset = rotMtx[1] * zoomDelta + xa4_offset;
|
||||
zeus::CVector3f delta = newOffset - xa4_offset;
|
||||
oldOffset = xa4_offset;
|
||||
@@ -388,7 +821,7 @@ void CSamusDoll::SetOffset(const zeus::CVector3f& offset, float sfxThreshold)
|
||||
xa4_offset = delta.normalized() + skInitialOffset;
|
||||
}
|
||||
|
||||
void CSamusDoll::BeginViewInterpolate(bool zoomOut)
|
||||
void CSamusDoll::BeginViewInterpolate(bool zoomIn)
|
||||
{
|
||||
if (xc4_viewInterp == 0.f)
|
||||
{
|
||||
@@ -402,12 +835,11 @@ void CSamusDoll::BeginViewInterpolate(bool zoomOut)
|
||||
CSfxManager::SfxStart(1441, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
}
|
||||
|
||||
xc4_viewInterp = zoomOut ? FLT_EPSILON : (-1.f + FLT_EPSILON);
|
||||
xc4_viewInterp = zoomIn ? FLT_EPSILON : (-1.f + FLT_EPSILON);
|
||||
x84_interpStartOffset = xa4_offset;
|
||||
x90_interpStartRot = xb0_rot;
|
||||
xa0_interpStartZoom = xc0_zoom;
|
||||
|
||||
x80_ = zoomOut ? -2.2f : -3.6f;
|
||||
x90_userInterpRot = xb0_userRot;
|
||||
xa0_userInterpZoom = xc0_userZoom;
|
||||
x80_fixedZoom = zoomIn ? -2.2f : -3.6f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user