2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-05-13 15:51:22 +00:00

Scan visor and waterbox fix

This commit is contained in:
Jack Andersen 2018-10-16 17:26:55 -10:00
parent b139e1c000
commit 8d839d8a17
7 changed files with 40 additions and 29 deletions

View File

@ -385,13 +385,13 @@ void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor&
CGameCollision::BuildAreaCollisionCache(mgr, cache); CGameCollision::BuildAreaCollisionCache(mgr, cache);
CPlayer& player = static_cast<CPlayer&>(actor); CPlayer& player = static_cast<CPlayer&>(actor);
player.x9c5_28_slidingOnWall = false; player.x9c5_28_slidingOnWall = false;
bool startingJump = player.x258_movementState == CPlayer::EPlayerMovementState::StartingJump; bool startingJump = player.x258_movementState == CPlayer::EPlayerMovementState::ApplyJump;
bool dampUnderwater = false; bool dampUnderwater = false;
if (player.x9c4_31_dampUnderwaterMotion) if (player.x9c4_31_dampUnderwaterMotion)
if (!mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GravitySuit)) if (!mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GravitySuit))
dampUnderwater = true; dampUnderwater = true;
bool noJump = (player.x258_movementState != CPlayer::EPlayerMovementState::StartingJump && bool noJump = (player.x258_movementState != CPlayer::EPlayerMovementState::ApplyJump &&
player.x258_movementState != CPlayer::EPlayerMovementState::Jump); player.x258_movementState != CPlayer::EPlayerMovementState::Jump);
float stepDown = player.GetStepDownHeight(); float stepDown = player.GetStepDownHeight();

View File

@ -2007,7 +2007,7 @@ CFrontEndUI::CFrontEndUI()
m->ResetGameState(); m->ResetGameState();
g_GameState->SetCurrentWorldId(g_ResFactory->TranslateOriginalToNew(g_DefaultWorldTag.id)); g_GameState->SetCurrentWorldId(g_ResFactory->TranslateOriginalToNew(g_DefaultWorldTag.id));
g_GameState->CurrentWorldState().SetAreaId(4); g_GameState->CurrentWorldState().SetAreaId(7);
g_GameState->GameOptions().ResetToDefaults(); g_GameState->GameOptions().ResetToDefaults();
g_GameState->WriteBackupBuf(); g_GameState->WriteBackupBuf();

View File

@ -402,13 +402,24 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, const CTargetingMana
zeus::CTransform seventeenScale = zeus::CTransform::Scale(17.f * vpScale, 1.f, 17.f * vpScale); zeus::CTransform seventeenScale = zeus::CTransform::Scale(17.f * vpScale, 1.f, 17.f * vpScale);
CGraphics::SetModelMatrix(seventeenScale * windowScale); CGraphics::SetModelMatrix(seventeenScale * windowScale);
float uvX0 = rect.x4_left / float(g_Viewport.x8_width);
float uvX1 = (rect.x4_left + rect.xc_width) / float(g_Viewport.x8_width);
float uvY0 = rect.x8_top / float(g_Viewport.xc_height);
float uvY1 = (rect.x8_top + rect.x10_height) / float(g_Viewport.xc_height);
CTexturedQuadFilter::Vert rttVerts[4] = CTexturedQuadFilter::Vert rttVerts[4] =
{ {
{{-5.f, 0.f, 4.45f}, {rect.x4_left / float(g_Viewport.x8_width), rect.x8_top / float(g_Viewport.xc_height)}}, {{-5.f, 0.f, 4.45f}, {uvX0, uvY0}},
{{ 5.f, 0.f, 4.45f}, {(rect.x4_left + rect.xc_width) / float(g_Viewport.x8_width), rect.x8_top / float(g_Viewport.xc_height)}}, {{ 5.f, 0.f, 4.45f}, {uvX1, uvY0}},
{{-5.f, 0.f, -4.45f}, {rect.x4_left / float(g_Viewport.x8_width), (rect.x8_top + rect.x10_height) / float(g_Viewport.xc_height)}}, {{-5.f, 0.f, -4.45f}, {uvX0, uvY1}},
{{ 5.f, 0.f, -4.45f}, {(rect.x4_left + rect.xc_width) / float(g_Viewport.x8_width), (rect.x8_top + rect.x10_height) / float(g_Viewport.xc_height)}} {{ 5.f, 0.f, -4.45f}, {uvX1, uvY1}}
}; };
if (CGraphics::g_BooPlatform == boo::IGraphicsDataFactory::Platform::OpenGL)
{
rttVerts[0].m_uv.y = uvY1;
rttVerts[1].m_uv.y = uvY1;
rttVerts[2].m_uv.y = uvY0;
rttVerts[3].m_uv.y = uvY0;
}
const_cast<CTexturedQuadFilter&>(x108_newScanPane).drawVerts(zeus::CColor(1.f, transFactor), rttVerts); const_cast<CTexturedQuadFilter&>(x108_newScanPane).drawVerts(zeus::CColor(1.f, transFactor), rttVerts);
// No cull faces // No cull faces

View File

@ -158,7 +158,7 @@ static const CMaterialFilter BallTransitionCollide =
s32 CPlayer::ChooseTransitionToAnimation(float dt, CStateManager& mgr) const s32 CPlayer::ChooseTransitionToAnimation(float dt, CStateManager& mgr) const
{ {
if (x258_movementState == EPlayerMovementState::StartingJump) if (x258_movementState == EPlayerMovementState::ApplyJump)
return 3; // B_airposetoball_samus return 3; // B_airposetoball_samus
zeus::CVector3f localVel = x34_transform.transposeRotate(x138_velocity); zeus::CVector3f localVel = x34_transform.transposeRotate(x138_velocity);
zeus::CVector3f localVelFlat = localVel; zeus::CVector3f localVelFlat = localVel;
@ -1878,7 +1878,7 @@ void CPlayer::ProcessInput(const CFinalInput& input, CStateManager& mgr)
if (ShouldSampleFailsafe(mgr)) if (ShouldSampleFailsafe(mgr))
{ {
CFailsafeTest::EInputState inputState = CFailsafeTest::EInputState::Moving; CFailsafeTest::EInputState inputState = CFailsafeTest::EInputState::Moving;
if (x258_movementState == EPlayerMovementState::StartingJump) if (x258_movementState == EPlayerMovementState::ApplyJump)
inputState = CFailsafeTest::EInputState::StartingJump; inputState = CFailsafeTest::EInputState::StartingJump;
else if (x258_movementState == EPlayerMovementState::Jump) else if (x258_movementState == EPlayerMovementState::Jump)
inputState = CFailsafeTest::EInputState::Jump; inputState = CFailsafeTest::EInputState::Jump;
@ -2680,7 +2680,7 @@ void CPlayer::Think(float dt, CStateManager& mgr)
{ {
x288_startingJumpTimeout -= dt; x288_startingJumpTimeout -= dt;
if (0.f >= x288_startingJumpTimeout) if (0.f >= x288_startingJumpTimeout)
SetMoveState(EPlayerMovementState::StartingJump, mgr); SetMoveState(EPlayerMovementState::ApplyJump, mgr);
} }
if (x2a0_ > 0.f) if (x2a0_ > 0.f)
@ -2692,7 +2692,7 @@ void CPlayer::Think(float dt, CStateManager& mgr)
x300_fallingTime += dt; x300_fallingTime += dt;
if (x258_movementState == EPlayerMovementState::FallingMorphed && x300_fallingTime > 0.4f) if (x258_movementState == EPlayerMovementState::FallingMorphed && x300_fallingTime > 0.4f)
SetMoveState(EPlayerMovementState::StartingJump, mgr); SetMoveState(EPlayerMovementState::ApplyJump, mgr);
if (x570_immuneTimer > 0.f) if (x570_immuneTimer > 0.f)
x570_immuneTimer -= dt; x570_immuneTimer -= dt;
@ -2868,7 +2868,7 @@ void CPlayer::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CState
x2f8_morphBallState == EPlayerMorphBallState::Morphed) x2f8_morphBallState == EPlayerMorphBallState::Morphed)
{ {
if (x138_velocity.z < -40.f && !x768_morphball->GetIsInHalfPipeMode() && if (x138_velocity.z < -40.f && !x768_morphball->GetIsInHalfPipeMode() &&
x258_movementState == EPlayerMovementState::StartingJump && x258_movementState == EPlayerMovementState::ApplyJump &&
x300_fallingTime > 0.75f) x300_fallingTime > 0.75f)
SetCoefficientOfRestitutionModifier(0.2f); SetCoefficientOfRestitutionModifier(0.2f);
x768_morphball->StartLandingSfx(); x768_morphball->StartLandingSfx();
@ -2904,8 +2904,8 @@ void CPlayer::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CState
case EScriptObjectMessage::LandOnNotFloor: case EScriptObjectMessage::LandOnNotFloor:
if (x2f8_morphBallState == EPlayerMorphBallState::Morphed && if (x2f8_morphBallState == EPlayerMorphBallState::Morphed &&
x768_morphball->GetSpiderBallState() == CMorphBall::ESpiderBallState::Active && x768_morphball->GetSpiderBallState() == CMorphBall::ESpiderBallState::Active &&
x258_movementState != EPlayerMovementState::StartingJump) x258_movementState != EPlayerMovementState::ApplyJump)
SetMoveState(EPlayerMovementState::StartingJump, mgr); SetMoveState(EPlayerMovementState::ApplyJump, mgr);
break; break;
case EScriptObjectMessage::OnIceSurface: case EScriptObjectMessage::OnIceSurface:
x2ac_surfaceRestraint = ESurfaceRestraints::Ice; x2ac_surfaceRestraint = ESurfaceRestraints::Ice;
@ -4072,7 +4072,7 @@ void CPlayer::UpdateGrappleState(const CFinalInput& input, CStateManager& mgr)
if (x3d8_grappleJumpTimeout <= 0.f) if (x3d8_grappleJumpTimeout <= 0.f)
{ {
BreakGrapple(EPlayerOrbitRequest::StopOrbit, mgr); BreakGrapple(EPlayerOrbitRequest::StopOrbit, mgr);
SetMoveState(EPlayerMovementState::StartingJump, mgr); SetMoveState(EPlayerMovementState::ApplyJump, mgr);
ComputeMovement(input, mgr, input.DeltaTime()); ComputeMovement(input, mgr, input.DeltaTime());
PreventFallingCameraPitch(); PreventFallingCameraPitch();
} }
@ -4094,7 +4094,7 @@ void CPlayer::UpdateGrappleState(const CFinalInput& input, CStateManager& mgr)
x3d8_grappleJumpTimeout -= input.DeltaTime(); x3d8_grappleJumpTimeout -= input.DeltaTime();
if (x3d8_grappleJumpTimeout <= 0.f) if (x3d8_grappleJumpTimeout <= 0.f)
{ {
SetMoveState(EPlayerMovementState::StartingJump, mgr); SetMoveState(EPlayerMovementState::ApplyJump, mgr);
ComputeMovement(input, mgr, input.DeltaTime()); ComputeMovement(input, mgr, input.DeltaTime());
BreakGrapple(EPlayerOrbitRequest::StopOrbit, mgr); BreakGrapple(EPlayerOrbitRequest::StopOrbit, mgr);
PreventFallingCameraPitch(); PreventFallingCameraPitch();
@ -5503,7 +5503,7 @@ float CPlayer::GetUnbiasedEyeHeight() const
float CPlayer::GetStepUpHeight() const float CPlayer::GetStepUpHeight() const
{ {
if (x258_movementState == EPlayerMovementState::Jump || if (x258_movementState == EPlayerMovementState::Jump ||
x258_movementState == EPlayerMovementState::StartingJump) x258_movementState == EPlayerMovementState::ApplyJump)
return 0.3f; return 0.3f;
return CPhysicsActor::GetStepUpHeight(); return CPhysicsActor::GetStepUpHeight();
} }
@ -5512,7 +5512,7 @@ float CPlayer::GetStepDownHeight() const
{ {
if (x258_movementState == EPlayerMovementState::Jump) if (x258_movementState == EPlayerMovementState::Jump)
return -1.f; return -1.f;
if (x258_movementState == EPlayerMovementState::StartingJump) if (x258_movementState == EPlayerMovementState::ApplyJump)
return 0.1f; return 0.1f;
return CPhysicsActor::GetStepDownHeight(); return CPhysicsActor::GetStepDownHeight();
} }
@ -5681,7 +5681,7 @@ void CPlayer::SetMoveState(EPlayerMovementState newState, CStateManager& mgr)
switch (newState) switch (newState)
{ {
case EPlayerMovementState::Jump: case EPlayerMovementState::Jump:
if (x258_movementState == EPlayerMovementState::StartingJump) if (x258_movementState == EPlayerMovementState::ApplyJump)
{ {
CSfxHandle hnd = CSfxManager::SfxStart(SFXsam_b_jump_00, 1.f, 0.f, true, 0x7f, false, kInvalidAreaId); CSfxHandle hnd = CSfxManager::SfxStart(SFXsam_b_jump_00, 1.f, 0.f, true, 0x7f, false, kInvalidAreaId);
ApplySubmergedPitchBend(hnd); ApplySubmergedPitchBend(hnd);
@ -5741,11 +5741,11 @@ void CPlayer::SetMoveState(EPlayerMovementState newState, CStateManager& mgr)
x2a4_cancelCameraPitch = false; x2a4_cancelCameraPitch = false;
x298_jumpPresses = 0; x298_jumpPresses = 0;
break; break;
case EPlayerMovementState::StartingJump: case EPlayerMovementState::ApplyJump:
x288_startingJumpTimeout = 0.f; x288_startingJumpTimeout = 0.f;
if (x258_movementState != EPlayerMovementState::StartingJump) if (x258_movementState != EPlayerMovementState::ApplyJump)
{ {
x258_movementState = EPlayerMovementState::StartingJump; x258_movementState = EPlayerMovementState::ApplyJump;
if (x294_jumpCameraTimer <= x288_startingJumpTimeout && if (x294_jumpCameraTimer <= x288_startingJumpTimeout &&
x29c_fallCameraTimer <= x288_startingJumpTimeout && x29c_fallCameraTimer <= x288_startingJumpTimeout &&
!x3dc_inFreeLook && !x3dd_lookButtonHeld) !x3dc_inFreeLook && !x3dd_lookButtonHeld)
@ -5799,7 +5799,7 @@ float CPlayer::JumpInput(const CFinalInput& input, CStateManager& mgr)
if (x828_distanceUnderWater >= 0.8f * GetEyeHeight()) if (x828_distanceUnderWater >= 0.8f * GetEyeHeight())
doubleJumpImpulse *= jumpFactor; doubleJumpImpulse *= jumpFactor;
if (x258_movementState == EPlayerMovementState::StartingJump) if (x258_movementState == EPlayerMovementState::ApplyJump)
{ {
if (g_tweakPlayer->GetMaxDoubleJumpWindow() - g_tweakPlayer->GetMinDoubleJumpWindow() >= x28c_sjTimer && if (g_tweakPlayer->GetMaxDoubleJumpWindow() - g_tweakPlayer->GetMinDoubleJumpWindow() >= x28c_sjTimer &&
0.f < x28c_sjTimer && ControlMapper::GetPressInput(ControlMapper::ECommands::JumpOrBoost, input)) 0.f < x28c_sjTimer && ControlMapper::GetPressInput(ControlMapper::ECommands::JumpOrBoost, input))
@ -5843,7 +5843,7 @@ float CPlayer::JumpInput(const CFinalInput& input, CStateManager& mgr)
} }
if (x258_movementState == EPlayerMovementState::Jump) if (x258_movementState == EPlayerMovementState::Jump)
SetMoveState(EPlayerMovementState::StartingJump, mgr); SetMoveState(EPlayerMovementState::ApplyJump, mgr);
return 0.f; return 0.f;
} }
@ -6203,7 +6203,7 @@ float CPlayer::GetWeight() const { return xe8_mass * -GetGravity(); }
zeus::CVector3f CPlayer::GetDampedClampedVelocityWR() const zeus::CVector3f CPlayer::GetDampedClampedVelocityWR() const
{ {
zeus::CVector3f localVel = x34_transform.transposeRotate(x138_velocity); zeus::CVector3f localVel = x34_transform.transposeRotate(x138_velocity);
if ((x258_movementState != EPlayerMovementState::StartingJump || if ((x258_movementState != EPlayerMovementState::ApplyJump ||
GetSurfaceRestraint() != ESurfaceRestraints::InAir) && GetSurfaceRestraint() != ESurfaceRestraints::InAir) &&
x304_orbitState == EPlayerOrbitState::NoOrbit) x304_orbitState == EPlayerOrbitState::NoOrbit)
{ {

View File

@ -100,7 +100,7 @@ public:
{ {
OnGround, OnGround,
Jump, Jump,
StartingJump, ApplyJump,
Falling, Falling,
FallingMorphed FallingMorphed
}; };

View File

@ -59,7 +59,7 @@ class Shader_CFluidPlaneShader : public hecl::TessellationShader
const SFluidPlaneShaderInfo& m_info; const SFluidPlaneShaderInfo& m_info;
public: public:
Shader_CFluidPlaneShader(const SFluidPlaneShaderInfo& in, bool tessellation) Shader_CFluidPlaneShader(const SFluidPlaneShaderInfo& in, bool tessellation)
: m_info(in), VtxFmt(tessellation ? TessVtxFmtElems : VtxFmtElems), : m_info(in), VtxFmt(tessellation ? boo::VertexFormatInfo(TessVtxFmtElems) : boo::VertexFormatInfo(VtxFmtElems)),
PipelineInfo({in.m_additive ? boo::BlendFactor::One : boo::BlendFactor::SrcAlpha, PipelineInfo({in.m_additive ? boo::BlendFactor::One : boo::BlendFactor::SrcAlpha,
in.m_additive ? boo::BlendFactor::One : boo::BlendFactor::InvSrcAlpha, in.m_additive ? boo::BlendFactor::One : boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false, boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false,
@ -89,7 +89,7 @@ class Shader_CFluidPlaneDoorShader : public hecl::GeneralShader
const SFluidPlaneDoorShaderInfo& m_info; const SFluidPlaneDoorShaderInfo& m_info;
public: public:
explicit Shader_CFluidPlaneDoorShader(const SFluidPlaneDoorShaderInfo& in) explicit Shader_CFluidPlaneDoorShader(const SFluidPlaneDoorShaderInfo& in)
: m_info(in), VtxFmt(Shader_CFluidPlaneShader::VtxFmtElems), : m_info(in), VtxFmt(boo::VertexFormatInfo(Shader_CFluidPlaneShader::VtxFmtElems)),
PipelineInfo({boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, PipelineInfo({boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false, boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false,
boo::CullMode::None}) {} boo::CullMode::None}) {}

2
hecl

@ -1 +1 @@
Subproject commit 73dc1183d7de7796c391b739727bd462eed9daff Subproject commit 2ef53263a09a8a99ec73e86b23283d7275db23c0