Work on CPlayer

This commit is contained in:
Jack Andersen 2017-08-17 15:30:15 -10:00
parent 7e492e0db4
commit 98b2fb6855
23 changed files with 637 additions and 112 deletions

View File

@ -949,28 +949,28 @@ float CAutoMapper::GetMapAreaMiniMapDrawAlphaSurfaceVisited(const CStateManager&
{
float mapAlphaInterp = g_tweakGui->GetMapAlphaInterpolant();
return g_tweakAutoMapper->GetMiniAlphaSurfaceVisited() * (1.f - mapAlphaInterp) *
stateMgr.Player()->GetMapAlpha() + mapAlphaInterp;
stateMgr.Player()->GetGunAlpha() + mapAlphaInterp;
}
float CAutoMapper::GetMapAreaMiniMapDrawAlphaOutlineVisited(const CStateManager& stateMgr)
{
float mapAlphaInterp = g_tweakGui->GetMapAlphaInterpolant();
return g_tweakAutoMapper->GetMiniAlphaOutlineVisited() * (1.f - mapAlphaInterp) *
stateMgr.Player()->GetMapAlpha() + mapAlphaInterp;
stateMgr.Player()->GetGunAlpha() + mapAlphaInterp;
}
float CAutoMapper::GetMapAreaMiniMapDrawAlphaSurfaceUnvisited(const CStateManager& stateMgr)
{
float mapAlphaInterp = g_tweakGui->GetMapAlphaInterpolant();
return g_tweakAutoMapper->GetMiniAlphaSurfaceUnvisited() * (1.f - mapAlphaInterp) *
stateMgr.Player()->GetMapAlpha() + mapAlphaInterp;
stateMgr.Player()->GetGunAlpha() + mapAlphaInterp;
}
float CAutoMapper::GetMapAreaMiniMapDrawAlphaOutlineUnvisited(const CStateManager& stateMgr)
{
float mapAlphaInterp = g_tweakGui->GetMapAlphaInterpolant();
return g_tweakAutoMapper->GetMiniAlphaOutlineUnvisited() * (1.f - mapAlphaInterp) *
stateMgr.Player()->GetMapAlpha() + mapAlphaInterp;
stateMgr.Player()->GetGunAlpha() + mapAlphaInterp;
}
float CAutoMapper::GetDesiredMiniMapCameraDistance(const CStateManager& mgr) const

View File

@ -1503,6 +1503,17 @@ bool CStateManager::TestRayDamage(const zeus::CVector3f& pos, const CActor& dama
return CGameCollision::RayDynamicIntersectionBool(*this, pos, dir, filter, nearList, &damagee, depth * origMag);
}
bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const CMaterialFilter& filter, const CActor& damagee)
{
zeus::CVector3f delta = end - start;
float mag = delta.magnitude();
delta = delta / mag;
rstl::reserved_vector<TUniqueId, 1024> nearList;
BuildNearList(nearList, start, delta, mag, filter, &damagee);
return RayCollideWorldInternal(start, end, filter, nearList, &damagee);
}
bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const CMaterialFilter& filter, const CActor& damagee)

View File

@ -333,6 +333,8 @@ public:
const CDamageInfo& info);
bool TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee,
const rstl::reserved_vector<TUniqueId, 1024>& nearList);
bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const CMaterialFilter& filter, const CActor& damagee);
bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const CMaterialFilter& filter, const CActor& damagee);

View File

@ -30,4 +30,14 @@ void CBallCamera::SetState(EBallCameraState state, CStateManager& mgr)
}
bool CBallCamera::TransitionFromMorphBallState(CStateManager& mgr)
{
return false;
}
void CBallCamera::TeleportCamera(const zeus::CVector3f& pos, CStateManager& mgr)
{
}
}

View File

@ -11,9 +11,16 @@ class CBallCamera : public CGameCamera
public:
enum class EBallCameraState
{
Zero
Zero,
One,
Two,
Three,
Four,
Five
};
private:
TUniqueId x3dc_ = kInvalidUniqueId;
float x3e0_ = 10000.f;
public:
CBallCamera(TUniqueId, TUniqueId, const zeus::CTransform& xf, float, float, float, float);
@ -21,6 +28,10 @@ public:
void ProcessInput(const CFinalInput&, CStateManager& mgr);
void Reset(const zeus::CTransform&, CStateManager& mgr);
void SetState(EBallCameraState state, CStateManager& mgr);
bool TransitionFromMorphBallState(CStateManager& mgr);
TUniqueId GetX3DC() const { return x3dc_; }
float GetX3E0() const { return x3e0_; }
void TeleportCamera(const zeus::CVector3f& pos, CStateManager& mgr);
};
}

View File

@ -314,7 +314,7 @@ void CCameraManager::SetupBallCamera(CStateManager& mgr)
}
void CCameraManager::LeaveBallCamera(CStateManager& mgr, TUniqueId newCamId)
void CCameraManager::SetPlayerCamera(CStateManager& mgr, TUniqueId newCamId)
{
}
@ -325,4 +325,9 @@ float CCameraManager::GetCameraBobMagnitude() const
x7c_fpCamera->GetTransform().basis[1].dot(zeus::CVector3f::skUp), 1.f) /
std::cos(2.f * M_PIF / 12.f), 1.f);
}
bool CCameraManager::HasBallCameraInitialPositionHint(CStateManager& mgr) const
{
return false;
}
}

View File

@ -126,9 +126,10 @@ public:
void RenderCameras(const CStateManager& mgr);
void SetupBallCamera(CStateManager& mgr);
void LeaveBallCamera(CStateManager& mgr, TUniqueId newCamId);
void SetPlayerCamera(CStateManager& mgr, TUniqueId newCamId);
int GetFluidCounter() const { return x74_fluidCounter; }
float GetCameraBobMagnitude() const;
bool HasBallCameraInitialPositionHint(CStateManager& mgr) const;
};
}

View File

@ -74,10 +74,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
TCastToPtr<CPlayer> player(mgr.ObjectById(GetWatchedObject()));
if (!player)
{
x34_transform = zeus::CTransform::Identity();
xe4_27_ = true;
xe4_28_ = true;
xe4_29_actorLightsDirty = true;
SetTransform(zeus::CTransform::Identity());
return;
}
@ -257,12 +254,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
}
x190_gunFollowXf = qGun.toTransform() * gunXf;
x34_transform = x190_gunFollowXf * bobXf.getRotation();
xe4_27_ = true;
xe4_28_ = true;
xe4_28_ = true;
xe4_29_actorLightsDirty = true;
SetTransform(x190_gunFollowXf * bobXf.getRotation());
CActor::SetTranslation(x190_gunFollowXf.origin + player->GetTransform().rotate(bobXf.origin));
x190_gunFollowXf.orthonormalize();

View File

@ -125,9 +125,9 @@ void CGameCamera::UpdatePerspective(float dt)
}
}
void CGameCamera::sub8005AF18(float f1, float fov, float f3, float f4)
void CGameCamera::SetFovInterpolation(float start, float fov, float time, float f4)
{
if (f3 < 0.f)
if (time < 0.f)
{
x15c_currentFov = fov;
x170_24_perspDirty = true;
@ -137,11 +137,11 @@ void CGameCamera::sub8005AF18(float f1, float fov, float f3, float f4)
else
{
x174_ = std::max(0.f, f4);
x17c_ = f3;
x178_ = f3;
x180_ = f1;
x17c_ = time;
x178_ = time;
x180_ = start;
x184_fov = fov;
x15c_currentFov = f1;
x15c_currentFov = start;
x170_24_perspDirty = true;
}
}

View File

@ -49,7 +49,7 @@ public:
void GetControllerNumber() const;
bool DisablesInput() const;
void UpdatePerspective(float);
void sub8005AF18(float, float, float, float);
void SetFovInterpolation(float start, float end, float time, float f4);
void sub8005AF88();
};
}

View File

@ -870,7 +870,7 @@ void CAnimData::AdvanceAnim(CCharAnimTime& time, zeus::CVector3f& offset, zeus::
SAdvancementResults results;
std::pair<std::unique_ptr<IAnimReader>, bool> simplified = {};
if (!x104_)
if (x104_animDir == EAnimDir::Forward)
{
results = x1f8_animRoot->VAdvanceView(time);
simplified = x1f8_animRoot->Simplified();

View File

@ -85,6 +85,13 @@ class CAnimData
{
friend class CModelData;
friend class CActor;
public:
enum class EAnimDir
{
Forward,
Backward
};
private:
TLockedToken<CCharacterFactory> x0_charFactory;
CCharacterInfo xc_charInfo;
@ -95,7 +102,7 @@ class CAnimData
std::shared_ptr<CSkinnedModel> xf8_infraModel;
std::shared_ptr<CAnimSysContext> xfc_animCtx;
std::shared_ptr<CAnimationManager> x100_animMgr;
u32 x104_ = 0;
EAnimDir x104_animDir = EAnimDir::Forward;
zeus::CAABox x108_aabb;
CParticleDatabase x120_particleDB;
CAssetId x1d8_selfId;
@ -189,6 +196,7 @@ public:
void EnableLooping(bool val) {x220_25_loop = val; x220_24_animating = true;}
void EnableAnimation(bool val) {x220_24_animating = val;}
bool IsAnimating() const {return x220_24_animating;}
void SetAnimDir(EAnimDir dir) { x104_animDir = dir; }
std::shared_ptr<CAnimSysContext> GetAnimSysContext() const;
std::shared_ptr<CAnimationManager> GetAnimationManager() const;
void RecalcPoseBuilder(const CCharAnimTime*);

View File

@ -38,7 +38,7 @@ public:
class CAnimRes
{
CAssetId x0_ancsId = -1;
CAssetId x0_ancsId;
s32 x4_charIdx = -1;
zeus::CVector3f x8_scale;
bool x14_canLoop = false;
@ -57,6 +57,7 @@ public:
CAssetId GetId() const { return x0_ancsId; }
s32 GetCharacterNodeId() const { return x4_charIdx; }
void SetCharacterNodeId(s32 id) { x4_charIdx = id; }
const zeus::CVector3f& GetScale() const { return x8_scale; }
bool CanLoop() const { return x14_canLoop; }
s32 GetDefaultAnim() const { return x18_defaultAnim; }
@ -147,7 +148,7 @@ public:
const TLockedToken<CModel>& GetNormalModel() const { return x1c_normalModel; }
const TLockedToken<CModel>& GetXRayModel() const { return x2c_xrayModel; }
const TLockedToken<CModel>& GetThermalModel() const { return x3c_infraModel; }
bool IsNull() { return !x10_animData && !x1c_normalModel; }
bool IsNull() const { return !x10_animData && !x1c_normalModel; }
const zeus::CVector3f& GetScale() const { return x0_scale; }
void SetScale(const zeus::CVector3f& scale) { x0_scale = scale; }

View File

@ -1,14 +1,9 @@
#include "CMFGame.hpp"
#include "CArchitectureQueue.hpp"
#include "GameGlobalObjects.hpp"
#include "CGameState.hpp"
#include "CStateManager.hpp"
#include "World/CPlayer.hpp"
#include "MP1.hpp"
#include "Character/CCharLayoutInfo.hpp"
#include "AutoMapper/CAutoMapper.hpp"
#include "CSamusHud.hpp"
#include "CPauseScreen.hpp"
#include "TCastTo.hpp"
#include "Audio/CMidiManager.hpp"
#include "Camera/CCinematicCamera.hpp"

View File

@ -313,6 +313,12 @@ float CActor::GetPitch() const { return zeus::CQuaternion(x34_transform.buildMat
float CActor::GetYaw() const { return zeus::CQuaternion(x34_transform.buildMatrix3f()).yaw(); }
void CActor::EnsureRendered(const CStateManager& mgr)
{
zeus::CAABox aabb = GetSortingBounds(mgr);
EnsureRendered(mgr, aabb.closestPointAlongVector(CGraphics::g_ViewMatrix.origin), aabb);
}
void CActor::EnsureRendered(const CStateManager& stateMgr, const zeus::CVector3f& pos,
const zeus::CAABox& aabb) const
{
@ -517,4 +523,12 @@ float CActor::GetAverageAnimVelocity(int anim) const
return GetModelData()->GetAnimationData()->GetAverageVelocity(anim);
return 0.f;
}
void CActor::SetModelData(std::unique_ptr<CModelData>&& mData)
{
if (mData->IsNull())
x64_modelData.reset();
else
x64_modelData = std::move(mData);
}
}

View File

@ -181,6 +181,7 @@ public:
u8 GetTargetableVisorFlags() const { return xe6_31_targetableVisorFlags; }
bool GetIsTargetable() const { return xe7_31_targetable; }
void SetDrawFlags(const CModelFlags& flags) { xb4_drawFlags = flags; }
void SetModelData(std::unique_ptr<CModelData>&& mData);
};
}

View File

@ -49,6 +49,7 @@ private:
u32 x195c_ = false;
u32 x1960_ = false;
u32 x1964_ = false;
u32 x19dc_ = false;
float x1DE8_boostTime = 0.f;
CMorphBallShadow* x1e50_shadow = nullptr;
@ -117,7 +118,7 @@ public:
void ResetMorphBallTransitionFlash() {}
void UpdateMorphBallTransitionFlash(float) {}
void RenderMorphBallTransitionFlash(const CStateManager&) const {}
void IsMorphBallTransitionFlashValid() const {}
bool IsMorphBallTransitionFlashValid() const { return x19dc_ != 0; }
void RenderDamageEffects(const CStateManager&, const zeus::CTransform&) const {}
void UpdateHalfPipeStatus(CStateManager&, float) {}
bool GetIsInHalfPipeMode() const { return false; }
@ -156,7 +157,7 @@ public:
void CreateBallShadow();
void RenderToShadowTex(CStateManager& mgr);
void StartLandingSfx() {}
bool GetX187c() const { return x187c_; }
bool GetX187c() const { return x187c_ != 0; }
void SetDamageTimer(float t) { x191c_damageTimer = t; }
void Stop() {}
void StopSounds() {}

View File

@ -99,11 +99,7 @@ void CPhysicsActor::AddMotionState(const CMotionState& mst)
{
zeus::CNUQuaternion q{x34_transform.buildMatrix3f()};
q += mst.xc_orientation;
x34_transform = zeus::CTransform(q, x34_transform.origin);
xe4_27_ = true;
xe4_28_ = true;
xe4_29_actorLightsDirty = true;
SetTransform(zeus::CTransform(q, x34_transform.origin));
SetTranslation(x34_transform.origin + mst.x0_translation);
@ -119,11 +115,7 @@ CMotionState CPhysicsActor::GetMotionState() const
void CPhysicsActor::SetMotionState(const CMotionState& mst)
{
x34_transform = zeus::CTransform(mst.xc_orientation, x34_transform.origin);
xe4_27_ = true;
xe4_28_ = true;
xe4_29_actorLightsDirty = true;
SetTransform(zeus::CTransform(mst.xc_orientation, x34_transform.origin));
SetTranslation(mst.x0_translation);
xfc_constantForce = mst.x1c_velocity;
@ -265,10 +257,7 @@ bool CPhysicsActor::WillMove(const CStateManager&)
void CPhysicsActor::SetPhysicsState(const CPhysicsState& state)
{
SetTranslation(state.GetTranslation());
x34_transform = zeus::CTransform(state.GetOrientation(), x34_transform.origin);
xe4_27_ = true;
xe4_28_ = true;
xe4_29_actorLightsDirty = true;
SetTransform(zeus::CTransform(state.GetOrientation(), x34_transform.origin));
xfc_constantForce = state.GetConstantForceWR();
x108_angularMomentum = state.GetAngularMomentumWR();

View File

@ -1,12 +1,8 @@
#include <Runtime/Audio/CStreamAudioManager.hpp>
#include "CPlayer.hpp"
#include "CActorParameters.hpp"
#include "CMorphBall.hpp"
#include "Weapon/CPlayerGun.hpp"
#include "CStateManager.hpp"
#include "CSimplePool.hpp"
#include "GameGlobalObjects.hpp"
#include "Particle/CGenDescription.hpp"
#include "Camera/CFirstPersonCamera.hpp"
#include "Camera/CBallCamera.hpp"
#include "Camera/CCinematicCamera.hpp"
@ -25,7 +21,8 @@
#include "CGameState.hpp"
#include "MP1/CSamusHud.hpp"
#include "CHUDBillboardEffect.hpp"
#include "CPlayerCameraBob.hpp"
#include "Audio/CStreamAudioManager.hpp"
#include "CScriptPlayerHint.hpp"
namespace urde
{
@ -65,7 +62,7 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox&
x9c4_26_ = true;
x9c4_27_canEnterMorphBall = true;
x9c4_28_canLeaveMorphBall = true;
x9c5_31_ = true;
x9c5_31_stepCameraZBiasDirty = true;
CAssetId beamId = g_tweakPlayerRes->GetBeamBallTransitionModel(x7ec_beam);
x7f0_ballTransitionBeamModel = std::make_unique<CModelData>(CStaticRes(beamId, playerScale));
x730_transitionModels.reserve(3);
@ -107,19 +104,418 @@ void CPlayer::InitializeBallTransition()
bool CPlayer::IsTransparent() const { return x588_alpha < 1.f; }
float CPlayer::GetTransitionAlpha(const zeus::CVector3f& camPos, float zNear) const
{
float zLimit = (x2d8_fpBounds.max.x - x2d8_fpBounds.min.x) * 0.5f + zNear;
float zStart = 1.f + zLimit;
float dist = (camPos - GetEyePosition()).magnitude();
if (dist >= zLimit && dist <= zStart)
return (dist - zLimit) / (zStart - zLimit);
else if (dist > zStart)
return 1.f;
else
return 0.f;
}
static const CMaterialFilter BallTransitionCollide =
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid},
{EMaterialTypes::ProjectilePassthrough,
EMaterialTypes::Player,
EMaterialTypes::Character,
EMaterialTypes::CameraPassthrough});
s32 CPlayer::ChooseTransitionToAnimation(float dt, CStateManager& mgr) const
{
if (x258_movementState == EPlayerMovementState::StartingJump)
return 3; // B_airposetoball_samus
zeus::CVector3f localVel = x34_transform.transposeRotate(x138_velocity);
zeus::CVector3f localVelFlat = localVel;
localVelFlat.z = 0.f;
float localVelFlatMag = localVelFlat.magnitude();
if (localVelFlatMag > 1.f)
{
zeus::CRelAngle velAng = std::atan2(localVelFlat.x, localVelFlat.y);
float velDeg = velAng.asDegrees();
if (velDeg < 45.f || velDeg > 315.f)
{
if (localVelFlatMag < 0.5f * GetActualFirstPersonMaxVelocity(dt))
return 0; // B_forwardtoballforward_samus
else
return 4; // B_runtoballfoward_samus
}
else
{
return 1; // B_readytostationarybackwards_samus
}
}
else
{
return 2; // B_readytoball_samus
}
}
void CPlayer::TransitionToMorphBallState(float dt, CStateManager& mgr)
{
x584_ballTransitionAnim = ChooseTransitionToAnimation(dt, mgr);
x58c_transitionVel = x138_velocity.magnitude();
if (x64_modelData && x64_modelData->HasAnimData())
{
CAnimPlaybackParms parms(x584_ballTransitionAnim, -1, 1.f, true);
x64_modelData->AnimationData()->SetAnimation(parms, false);
x64_modelData->AnimationData()->SetAnimDir(CAnimData::EAnimDir::Forward);
}
x64_modelData->EnableLooping(false);
x64_modelData->Touch(mgr, 0);
x150_momentum = zeus::CVector3f::skZero;
CPhysicsActor::Stop();
SetMorphBallState(EPlayerMorphBallState::Morphing, mgr);
SetCameraState(EPlayerCameraState::Three, mgr);
x500_lookDir = x34_transform.basis[1];
x50c_moveDir = x500_lookDir;
x50c_moveDir.z = 0.f;
if (x50c_moveDir.canBeNormalized())
{
x50c_moveDir.normalize();
}
else
{
x500_lookDir = zeus::CVector3f::skForward;
x50c_moveDir = zeus::CVector3f::skForward;
}
CBallCamera* ballCam = mgr.GetCameraManager()->GetBallCamera();
mgr.GetCameraManager()->SetPlayerCamera(mgr, ballCam->GetUniqueId());
if (!mgr.GetCameraManager()->HasBallCameraInitialPositionHint(mgr))
{
mgr.GetCameraManager()->SetupBallCamera(mgr);
ballCam->SetState(CBallCamera::EBallCameraState::Four, mgr);
}
else
{
ballCam->SetState(CBallCamera::EBallCameraState::Zero, mgr);
SetCameraState(EPlayerCameraState::One, mgr);
zeus::CTransform newXf = mgr.GetCameraManager()->GetFirstPersonCamera()->GetTransform();
ballCam->SetTransform(newXf);
ballCam->TeleportCamera(newXf.origin, mgr);
mgr.GetCameraManager()->SetupBallCamera(mgr);
ballCam->SetFovInterpolation(mgr.GetCameraManager()->GetFirstPersonCamera()->GetFov(),
CCameraManager::ThirdPersonFOV(), 1.f, 0.f);
}
SetOrbitRequest(EPlayerOrbitRequest::Two, mgr);
x490_gun->CancelFiring(mgr);
HolsterGun(mgr);
}
void CPlayer::TransitionFromMorphBallState(CStateManager& mgr)
{
x584_ballTransitionAnim = 14; // B_ball_unfurl
x58c_transitionVel = zeus::CVector2f(x138_velocity.x, x138_velocity.y).magnitude();
if (x58c_transitionVel < 1.f)
x584_ballTransitionAnim = 5; // ballstationarytoready_random
if (x258_movementState != EPlayerMovementState::OnGround)
{
zeus::CVector3f ballPos = GetBallPosition();
if (mgr.RayCollideWorld(ballPos, ballPos + zeus::CVector3f(0.f, 0.f, -7.f), BallTransitionCollide, *this))
x584_ballTransitionAnim = 7; // B_balljumptoairpose
}
if (x64_modelData && x64_modelData->HasAnimData())
{
CAnimPlaybackParms parms(x584_ballTransitionAnim, -1, 1.f, true);
x64_modelData->AnimationData()->SetAnimation(parms, false);
x64_modelData->AnimationData()->SetAnimDir(CAnimData::EAnimDir::Forward);
}
x64_modelData->EnableLooping(false);
x64_modelData->Touch(mgr, 0);
SetMorphBallState(EPlayerMorphBallState::Unmorphing, mgr);
x768_morphball->LeaveMorphBallState(mgr);
mgr.GetCameraManager()->SetPlayerCamera(mgr, mgr.GetCameraManager()->GetFirstPersonCamera()->GetUniqueId());
zeus::CVector3f camToPlayer = GetTranslation() - mgr.GetCameraManager()->GetBallCamera()->GetTranslation();
if (camToPlayer.canBeNormalized())
{
camToPlayer.normalize();
zeus::CVector3f vecFlat = x500_lookDir;
vecFlat.z = 0.f;
zeus::CVector3f f31 =
vecFlat.canBeNormalized() && vecFlat.magnitude() >= 0.1f ? x518_leaveMorphDir : camToPlayer;
if (x9c6_26_outOfBallLookAtHint)
{
if (TCastToConstPtr<CScriptPlayerHint> hint = mgr.GetObjectById(x830_playerHint))
{
zeus::CVector3f deltaFlat = hint->GetTranslation() - GetTranslation();
deltaFlat.z = 0.f;
if (deltaFlat.canBeNormalized())
f31 = deltaFlat.normalized();
}
}
if (x9c7_25_outOfBallLookAtHintActor)
{
if (TCastToConstPtr<CScriptPlayerHint> hint = mgr.GetObjectById(x830_playerHint))
{
if (TCastToConstPtr<CActor> act = mgr.GetObjectById(hint->GetActorId()))
{
zeus::CVector3f deltaFlat = act->GetOrbitPosition(mgr) - GetTranslation();
deltaFlat.z = 0.f;
if (deltaFlat.canBeNormalized())
f31 = deltaFlat.normalized();
}
}
}
if (std::acos(zeus::clamp(-1.f, camToPlayer.dot(f31), 1.f)) < M_PIF / 1.2f || x9c7_25_outOfBallLookAtHintActor)
{
SetTransform(zeus::lookAt(GetTranslation(), GetTranslation() + f31));
}
else
{
SetTransform(zeus::lookAt(GetTranslation(), GetTranslation() + camToPlayer));
UpdateArmAndGunTransforms(0.01f, mgr);
}
}
else
{
SetTransform(CreateTransformFromMovementDirection());
}
CBallCamera* ballCam = mgr.GetCameraManager()->GetBallCamera();
if (TCastToConstPtr<CActor> act = mgr.GetObjectById(ballCam->GetX3DC()))
{
if (ballCam->GetX3E0() < 20.f && ballCam->GetX3E0() > 1.f)
{
zeus::CVector3f deltaFlat = act->GetTranslation() - GetTranslation();
deltaFlat.z = 0.f;
zeus::CVector3f deltaFlat2 = act->GetTranslation() - ballCam->GetTranslation();
deltaFlat2.z = 0.f;
if (deltaFlat.canBeNormalized() && deltaFlat2.canBeNormalized())
{
deltaFlat.normalize();
zeus::CVector3f camLookFlat = ballCam->GetTransform().basis[1];
camLookFlat.z = 0.f;
camLookFlat.normalize();
deltaFlat2.normalize();
if (deltaFlat.dot(deltaFlat2) >= 0.3f && deltaFlat2.dot(camLookFlat) >= 0.7f)
{
SetTransform(zeus::lookAt(GetTranslation(), GetTranslation() + deltaFlat));
}
}
}
}
ForceGunOrientation(x34_transform, mgr);
DrawGun(mgr);
ballCam->SetState(CBallCamera::EBallCameraState::Five, mgr);
ClearForcesAndTorques();
SetAngularVelocityWR(zeus::CAxisAngle::sIdentity);
AddMaterial(EMaterialTypes::GroundCollider, mgr);
x150_momentum = zeus::CVector3f::skZero;
SetCameraState(EPlayerCameraState::Three, mgr);
x824_ = 0.01f;
x57c_ = 0;
x580_ = 0;
if (!ballCam->TransitionFromMorphBallState(mgr))
{
x824_ = 0.95f;
LeaveMorphBallState(mgr);
}
}
s32 CPlayer::GetNextBallTransitionAnim(float dt, bool& loopOut, CStateManager& mgr)
{
loopOut = false;
zeus::CVector2f vel(x138_velocity.x, x138_velocity.y);
if (!vel.canBeNormalized())
return 12; // B_ball_ready_samus
float velMag = vel.magnitude();
float maxVel = GetActualFirstPersonMaxVelocity(dt);
if (velMag <= 0.2f * maxVel)
return 12; // B_ball_ready_samus
loopOut = true;
s32 ret = velMag >= maxVel ? 13 : 15; // B_ball_runloop_samus : B_ball_walkloop_samus
if (x50c_moveDir.dot(mgr.GetCameraManager()->GetBallCamera()->GetTransform().basis[1]) < -0.5f)
return 12; // B_ball_ready_samus
return ret;
}
void CPlayer::UpdateMorphBallTransition(float dt, CStateManager& mgr)
{
switch (x2f8_morphTransState)
{
case EPlayerMorphBallState::Unmorphed:
case EPlayerMorphBallState::Morphed:
{
CPlayerState::EPlayerSuit suit = mgr.GetPlayerState()->GetCurrentSuit();
if (mgr.GetPlayerState()->IsFusionEnabled())
suit = CPlayerState::EPlayerSuit(int(suit) + 4);
if (x7cc_transitionSuit != suit)
{
x7cc_transitionSuit = suit;
CAnimRes useRes = x7d0_animRes;
useRes.SetCharacterNodeId(s32(x7cc_transitionSuit));
SetModelData(std::make_unique<CModelData>(x7d0_animRes));
SetIntoBallReadyAnimation(mgr);
}
return;
}
case EPlayerMorphBallState::Unmorphing:
if (x584_ballTransitionAnim == 14) // B_ball_unfurl
{
float dur = x64_modelData->GetAnimationData()->GetAnimationDuration(x584_ballTransitionAnim);
float facRemaining = x64_modelData->GetAnimationData()->GetAnimTimeRemaining("Whole Body") / dur;
if (facRemaining < 0.5f)
{
bool loop = false;
x584_ballTransitionAnim = GetNextBallTransitionAnim(dt, loop, mgr);
if (x64_modelData && x64_modelData->HasAnimData())
{
CAnimPlaybackParms parms(x584_ballTransitionAnim, -1, 1.f, true);
x64_modelData->AnimationData()->SetAnimation(parms, false);
x64_modelData->AnimationData()->EnableLooping(loop);
}
}
}
else if (x584_ballTransitionAnim != 5 && x584_ballTransitionAnim != 7)
// ballstationarytoready_random, B_balljumptoairpose
{
float velMag = zeus::CVector2f(x138_velocity.x, x138_velocity.y).magnitude();
if (std::fabs(x58c_transitionVel - velMag) > 0.04f * GetActualFirstPersonMaxVelocity(dt) || velMag < 1.f)
{
bool loop = false;
s32 nextAnim = GetNextBallTransitionAnim(dt, loop, mgr);
if (x64_modelData && x64_modelData->HasAnimData() &&
x584_ballTransitionAnim != nextAnim && x584_ballTransitionAnim != 7)
{
x584_ballTransitionAnim = nextAnim;
CAnimPlaybackParms parms(x584_ballTransitionAnim, -1, 1.f, true);
x64_modelData->AnimationData()->SetAnimation(parms, false);
x64_modelData->AnimationData()->EnableLooping(loop);
x58c_transitionVel = velMag;
}
}
}
break;
default:
break;
}
SAdvancementDeltas deltas = UpdateAnimation(dt, mgr, true);
MoveInOneFrameOR(deltas.x0_posDelta, dt);
RotateInOneFrameOR(deltas.xc_rotDelta, dt);
x574_morphTime = std::min(x574_morphTime + dt, x578_morphDuration);
float morphT = x574_morphTime / x578_morphDuration;
if ((morphT >= 0.7f || x574_morphTime <= 2.f * dt) && x730_transitionModels.size() != 0)
x730_transitionModels.erase(x730_transitionModels.begin());
for (auto& m : x730_transitionModels)
m->AdvanceAnimation(dt, mgr, kInvalidAreaId, true);
CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
x588_alpha = GetTransitionAlpha(cam->GetTranslation(), cam->GetNearClipDistance());
if (x2f8_morphTransState == EPlayerMorphBallState::Morphing && morphT > 0.93f)
{
x588_alpha *= std::min(1.f, 1.f - (morphT - 0.93f) / 0.07f + 0.2f);
xb4_drawFlags = CModelFlags(5, 0, 1, zeus::CColor(1.f, x588_alpha));
}
else if (x2f8_morphTransState == EPlayerMorphBallState::Unmorphing && x588_alpha < 1.f)
{
if (x588_alpha > 0.05f)
xb4_drawFlags = CModelFlags(5, 0, 0x21, zeus::CColor(1.f, x588_alpha));
else
xb4_drawFlags = CModelFlags(5, 0, 1, zeus::CColor(1.f, x588_alpha));
}
else
{
xb4_drawFlags = CModelFlags(5, 0, 3, zeus::CColor(1.f, x588_alpha));
}
x594_transisionBeamXfs.AddValue(x7f4_gunWorldXf);
x658_transitionModelXfs.AddValue(x34_transform);
x71c_transitionModelAlphas.AddValue(x588_alpha);
switch (x2f8_morphTransState)
{
case EPlayerMorphBallState::Unmorphing:
GetCollisionPrimitive()->CalculateAABox(GetPrimitiveTransform()).center();
ClearForcesAndTorques();
SetAngularVelocityWR(zeus::CAxisAngle::sIdentity);
if (x574_morphTime >= x578_morphDuration || mgr.GetCameraManager()->IsInCinematicCamera())
{
x824_ = std::max(x824_, 0.95f);
zeus::CVector3f pos;
if (CanLeaveMorphBallState(mgr, pos))
{
SetTranslation(GetTranslation() + pos);
LeaveMorphBallState(mgr);
xb4_drawFlags = CModelFlags(0, 0, 3, zeus::CColor::skWhite);
}
else
{
x574_morphTime = x578_morphDuration - x574_morphTime;
TransitionToMorphBallState(dt, mgr);
}
}
break;
case EPlayerMorphBallState::Morphing:
ClearForcesAndTorques();
ClearForcesAndTorques();
SetAngularVelocityWR(zeus::CAxisAngle::sIdentity);
if (x574_morphTime >= x578_morphDuration || mgr.GetCameraManager()->IsInCinematicCamera())
{
if (CanEnterMorphBallState(mgr, 1.f))
{
ActivateMorphBallCamera(mgr);
EnterMorphBallState(mgr);
xb4_drawFlags = CModelFlags(0, 0, 3, zeus::CColor::skWhite);
} else
{
x574_morphTime = x578_morphDuration - x574_morphTime;
TransitionFromMorphBallState(mgr);
}
}
if (x578_morphDuration != 0.f)
{
if (zeus::clamp(0.f, x574_morphTime, 1.f) >= 0.5f)
{
if (!x768_morphball->IsMorphBallTransitionFlashValid())
x768_morphball->ResetMorphBallTransitionFlash();
}
}
break;
default:
break;
}
}
void CPlayer::UpdateGunAlpha()
{
switch (x498_gunHolsterState)
{
case EGunHolsterState::Holstered:
x494_gunAlpha = 0.f;
break;
case EGunHolsterState::Holstering:
x494_gunAlpha = zeus::clamp(0.f, x49c_gunHolsterRemTime / g_tweakPlayerGun->GetGunHolsterTime(), 1.f);
break;
case EGunHolsterState::Drawing:
x494_gunAlpha = 1.f - zeus::clamp(0.f, x49c_gunHolsterRemTime / 0.45f, 1.f);
break;
case EGunHolsterState::Drawn:
x494_gunAlpha = 1.f;
break;
}
}
void CPlayer::UpdatePlayerSounds()
void CPlayer::UpdatePlayerSounds(float dt)
{
if (x784_damageSfxTimer > 0.f)
{
x784_damageSfxTimer -= dt;
if (x784_damageSfxTimer <= 0.f)
{
CSfxManager::SfxStop(x770_damageLoopSfx);
x770_damageLoopSfx.reset();
}
}
}
void CPlayer::Update(float dt, CStateManager& mgr)
@ -189,7 +585,7 @@ void CPlayer::Update(float dt, CStateManager& mgr)
UpdateDebugCamera(mgr);
UpdateVisorTransition(dt, mgr);
mgr.SetActorAreaId(*this, mgr.GetWorld()->GetCurrentAreaId());
UpdatePlayerSounds();
UpdatePlayerSounds(dt);
if (x26c_ != kInvalidUniqueId)
x270_ += dt;
@ -599,7 +995,7 @@ void CPlayer::TakeDamage(bool significant, const zeus::CVector3f& location,
x770_damageLoopSfx = CSfxManager::SfxStart(damageLoopSfx, 1.f, 0.f, false, 0x7f, true, kInvalidAreaId);
x788_damageLoopSfxId = damageLoopSfx;
}
x784_ = 0.5f;
x784_damageSfxTimer = 0.5f;
}
if (suitDamageSfx)
@ -797,7 +1193,7 @@ static const char* UnlockMessageResBases[] =
static CAssetId UpdatePersistentScanPercent(u32 prevLogScans, u32 logScans, u32 totalLogScans)
{
if (prevLogScans == logScans)
return -1;
return {};
float scanPercent = logScans / float(totalLogScans) * 100.f;
float prevScanPercent = prevLogScans / float(totalLogScans) * 100.f;
@ -814,11 +1210,11 @@ static CAssetId UpdatePersistentScanPercent(u32 prevLogScans, u32 logScans, u32
auto message =
std::string(UnlockMessageResBases[zeus::clamp(0, scanPercentProgStep - 1, 1)]) + (firstTime ? '1' : '2');
auto id = g_ResFactory->GetResourceIdByName(message.c_str());
if (id)
if (id != nullptr)
return id->id;
}
return -1;
return {};
}
void CPlayer::FinishNewScan(CStateManager& mgr)
@ -918,7 +1314,7 @@ void CPlayer::RenderGun(const CStateManager& mgr, const zeus::CVector3f& pos) co
(x2f8_morphTransState == EPlayerMorphBallState::Morphing &&
x498_gunHolsterState == EGunHolsterState::Holstering))
{
CModelFlags flags(5, 0, 3, zeus::CColor(1.f, x494_mapAlpha));
CModelFlags flags(5, 0, 3, zeus::CColor(1.f, x494_gunAlpha));
x490_gun->Render(mgr, pos, flags);
}
}
@ -1619,7 +2015,7 @@ void CPlayer::CalculatePlayerMovementDirection(float dt)
{
x53c_ += dt;
x4f8_ = std::fabs(delta.magnitude() / dt);
x500_ = delta.normalized();
x500_lookDir = delta.normalized();
zeus::CVector3f flatDelta(delta.x, delta.y, 0.f);
if (flatDelta.canBeNormalized())
{
@ -1634,8 +2030,8 @@ void CPlayer::CalculatePlayerMovementDirection(float dt)
x524_ = GetTranslation();
break;
default:
x500_ = GetTransform().basis[1];
x50c_moveDir = x500_;
x500_lookDir = GetTransform().basis[1];
x50c_moveDir = x500_lookDir;
x50c_moveDir.z = 0.f;
if (x50c_moveDir.canBeNormalized())
x50c_moveDir.normalize();
@ -1648,8 +2044,8 @@ void CPlayer::CalculatePlayerMovementDirection(float dt)
{
if (x2f8_morphTransState != EPlayerMorphBallState::Morphed)
{
x500_ = GetTransform().basis[1];
x50c_moveDir = x500_;
x500_lookDir = GetTransform().basis[1];
x50c_moveDir = x500_lookDir;
x50c_moveDir.z = 0.f;
if (x50c_moveDir.canBeNormalized())
x50c_moveDir.normalize();
@ -1667,11 +2063,11 @@ void CPlayer::CalculatePlayerMovementDirection(float dt)
case EPlayerMorphBallState::Morphed:
case EPlayerMorphBallState::Morphing:
case EPlayerMorphBallState::Unmorphing:
x500_ = x50c_moveDir;
x500_lookDir = x50c_moveDir;
break;
default:
x500_ = GetTransform().basis[1];
x50c_moveDir = x500_;
x500_lookDir = GetTransform().basis[1];
x50c_moveDir = x500_lookDir;
x50c_moveDir.z = 0.f;
if (x50c_moveDir.canBeNormalized())
x50c_moveDir.normalize();
@ -1685,7 +2081,7 @@ void CPlayer::CalculatePlayerMovementDirection(float dt)
x50c_moveDir.z = 0.f;
if (x50c_moveDir.canBeNormalized())
x500_.normalize();
x500_lookDir.normalize();
}
void CPlayer::Stop(CStateManager& stateMgr)
@ -1805,12 +2201,55 @@ void CPlayer::UpdateFrozenState(const CFinalInput& input, CStateManager& mgr)
void CPlayer::UpdateStepCameraZBias(float dt)
{
float newBias = GetTranslation().z + GetUnbiasedEyeHeight();
if (x258_movementState == EPlayerMovementState::OnGround && !IsMorphBallTransitioning())
{
float oldBias = newBias;
if (!x9c5_31_stepCameraZBiasDirty)
{
float delta = newBias - x9cc_stepCameraZBias;
float newDelta = 5.f * dt;
if (delta > 0.f)
{
if (delta > dt * x138_velocity.z && delta > newDelta)
{
if (delta > GetStepUpHeight())
newDelta += delta - GetStepUpHeight();
newBias = x9cc_stepCameraZBias + newDelta;
}
}
else
{
if (delta < dt * x138_velocity.z && delta < -newDelta)
{
if (delta < -GetStepDownHeight())
newDelta += -delta - GetStepDownHeight();
newBias = x9cc_stepCameraZBias + newDelta;
}
}
}
x9c8_eyeZBias = newBias - oldBias;
}
else
{
x9c8_eyeZBias = 0.f;
}
x9cc_stepCameraZBias = newBias;
x9c5_31_stepCameraZBiasDirty = false;
}
void CPlayer::UpdateWaterSurfaceCameraBias(CStateManager& mgr)
{
if (TCastToConstPtr<CScriptWater> water = mgr.GetObjectById(xc4_fluidId))
{
float waterZ = water->GetTriggerBoundsWR().max.z;
float biasToEyeDelta = GetEyePosition().z - x9c8_eyeZBias;
float waterToDeltaDelta = biasToEyeDelta - waterZ;
if (biasToEyeDelta >= waterZ && waterToDeltaDelta <= 0.25f)
x9c8_eyeZBias += waterZ + 0.25f - biasToEyeDelta;
else if (biasToEyeDelta < waterZ && waterToDeltaDelta >= -0.2f)
x9c8_eyeZBias += waterZ - 0.2f - biasToEyeDelta;
}
}
void CPlayer::UpdatePhazonCameraShake(float dt, CStateManager& mgr)
@ -1924,17 +2363,11 @@ void CPlayer::Think(float dt, CStateManager& mgr)
zeus::CVector3f lookDirFlat(x34_transform.basis[1].x, x34_transform.basis[1].y, 0.f);
if (lookDirFlat.canBeNormalized())
{
x34_transform = zeus::lookAt(zeus::CVector3f::skZero, lookDirFlat.normalized());
xe4_27_ = true;
xe4_28_ = true;
xe4_29_actorLightsDirty = true;
SetTransform(zeus::lookAt(zeus::CVector3f::skZero, lookDirFlat.normalized()));
}
else
{
x34_transform = zeus::CTransform::Identity();
xe4_27_ = true;
xe4_28_ = true;
xe4_29_actorLightsDirty = true;
SetTransform(zeus::CTransform::Identity());
}
SetTranslation(backupTranslation);
}
@ -2930,20 +3363,14 @@ void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, f
x3c0_grappleSwingAxis = turnRot.transform(x3c0_grappleSwingAxis);
x3c0_grappleSwingAxis.normalize();
zeus::CVector3f swingForward(-x3c0_grappleSwingAxis.y, x3c0_grappleSwingAxis.x, 0.f);
x34_transform =
zeus::CTransform(x3c0_grappleSwingAxis, swingForward, zeus::CVector3f::skUp, GetTranslation());
xe4_27_ = true;
xe4_28_ = true;
xe4_29_actorLightsDirty = true;
SetTransform(
zeus::CTransform(x3c0_grappleSwingAxis, swingForward, zeus::CVector3f::skUp, GetTranslation()));
SetVelocityWR(pullVec);
if (!ValidateFPPosition(GetTranslation(), mgr))
{
x3c0_grappleSwingAxis = swingAxisBackup;
x34_transform = backupXf;
xe4_27_ = true;
xe4_28_ = true;
xe4_29_actorLightsDirty = true;
SetTransform(backupXf);
SetVelocityWR(backupVel);
}
}
@ -4544,9 +4971,9 @@ float CPlayer::ForwardInput(const CFinalInput& input, float turnInput) const
float backwards = ControlMapper::GetAnalogInput(ControlMapper::ECommands::Backward, input);
if (x2f8_morphTransState != EPlayerMorphBallState::Unmorphed || InGrappleJumpCooldown())
backwards = 0.f;
if (x2f8_morphTransState == EPlayerMorphBallState::Morphing && x584_ == 2)
if (x2f8_morphTransState == EPlayerMorphBallState::Morphing && x584_ballTransitionAnim == 2)
forwards = 0.f;
if (x2f8_morphTransState == EPlayerMorphBallState::Unmorphing && x584_ == 5)
if (x2f8_morphTransState == EPlayerMorphBallState::Unmorphing && x584_ballTransitionAnim == 5)
forwards = 0.f;
if (forwards >= 0.001f)
{
@ -4953,7 +5380,7 @@ void CPlayer::LeaveMorphBallState(CStateManager& mgr)
x3ec_freeLookPitchAngle = 0.f;
x3f0_vertFreeLookAngleVel = 0.f;
x768_morphball->LeaveMorphBallState(mgr);
mgr.GetCameraManager()->LeaveBallCamera(mgr, mgr.GetCameraManager()->GetFirstPersonCamera()->GetUniqueId());
mgr.GetCameraManager()->SetPlayerCamera(mgr, mgr.GetCameraManager()->GetFirstPersonCamera()->GetUniqueId());
mgr.GetCameraManager()->GetBallCamera()->SetState(CBallCamera::EBallCameraState::Zero, mgr);
SetCameraState(EPlayerCameraState::Zero, mgr);
mgr.GetCameraManager()->GetFirstPersonCamera()->SetX1C6_24(true);

View File

@ -281,14 +281,14 @@ private:
zeus::CVector3f x480_assistedTargetAim = zeus::CVector3f::skZero;
float x48c_aimTargetTimer = 0.f;
std::unique_ptr<CPlayerGun> x490_gun;
float x494_mapAlpha = 1.f;
float x494_gunAlpha = 1.f;
EGunHolsterState x498_gunHolsterState = EGunHolsterState::Drawn;
float x49c_gunHolsterRemTime;
std::unique_ptr<CFailsafeTest> x4a0_failsafeTest;
TReservedAverage<float, 20> x4a4_;
float x4f8_ = 0.f;
float x4fc_ = 0.f;
zeus::CVector3f x500_ = x34_transform.basis[1];
zeus::CVector3f x500_lookDir = x34_transform.basis[1];
zeus::CVector3f x50c_moveDir = x34_transform.basis[1];
zeus::CVector3f x518_leaveMorphDir = x34_transform.basis[1];
zeus::CVector3f x524_ = x34_transform.basis[1];
@ -305,9 +305,9 @@ private:
float x578_morphDuration = 0.f;
u32 x57c_ = 0;
u32 x580_ = 0;
int x584_ = -1;
int x584_ballTransitionAnim = -1;
float x588_alpha = 1.f;
float x58c_ = 0.f;
float x58c_transitionVel = 0.f;
bool x590_ = true;
TReservedAverage<zeus::CTransform, 4> x594_transisionBeamXfs;
TReservedAverage<zeus::CTransform, 4> x658_transitionModelXfs;
@ -330,13 +330,13 @@ private:
CSfxHandle x778_dashSfx;
CSfxHandle x77c_samusVoiceSfx;
int x780_samusVoicePriority = 0;
float x784_ = 0.f;
float x784_damageSfxTimer = 0.f;
u16 x788_damageLoopSfxId = 0;
float x78c_footstepSfxTimer = 0.f;
EFootstepSfx x790_footstepSfxSel = EFootstepSfx::None;
zeus::CVector3f x794_lastVelocity;
CVisorSteam x7a0_visorSteam = CVisorSteam(0.f, 0.f, 0.f, CAssetId()/*kInvalidAssetId*/);
CAssetId x7cc_;
CPlayerState::EPlayerSuit x7cc_transitionSuit;
CAnimRes x7d0_animRes;
zeus::CVector3f x7d8_beamScale;
bool x7e4_ = true;
@ -348,7 +348,7 @@ private:
float x828_waterLevelOnPlayer = 0.f;
bool x82c_inLava = false;
TUniqueId x82e_ridingPlatform = kInvalidUniqueId;
TUniqueId x830_ = kInvalidUniqueId;
TUniqueId x830_playerHint = kInvalidUniqueId;
u32 x834_ = 1000;
u32 x838_ = 0;
u32 x93c_ = 0;
@ -373,23 +373,23 @@ private:
bool x9c5_28_slidingOnWall : 1;
bool x9c5_29_hitWall : 1;
bool x9c5_30_ : 1;
bool x9c5_31_ : 1;
bool x9c5_31_stepCameraZBiasDirty : 1;
bool x9c6_24_extendTargetDistance : 1;
bool x9c6_25_ : 1;
bool x9c6_26_ : 1;
bool x9c6_26_outOfBallLookAtHint : 1;
bool x9c6_27_aimingAtProjectile : 1;
bool x9c6_28_aligningGrappleSwingTurn : 1;
bool x9c6_29_disableInput : 1;
bool x9c6_30_newScanScanning : 1;
bool x9c6_31_overrideRadarRadius : 1;
bool x9c7_24_ : 1;
bool x9c7_25_ : 1;
bool x9c7_25_outOfBallLookAtHintActor : 1;
};
u32 _dummy = 0;
};
float x9c8_eyeZBias = 0.f;
float x9cc_ = 0.f;
float x9cc_stepCameraZBias = 0.f;
u32 x9d0_ = 0;
u32 x9d4_ = 0;
zeus::CVector3f x9d8_ = zeus::CVector3f::skForward;
@ -426,9 +426,14 @@ public:
float, float, const CMaterialList&);
bool IsTransparent() const;
float GetTransitionAlpha(const zeus::CVector3f& camPos, float zNear) const;
s32 ChooseTransitionToAnimation(float dt, CStateManager& mgr) const;
void TransitionToMorphBallState(float dt, CStateManager& mgr);
void TransitionFromMorphBallState(CStateManager& mgr);
s32 GetNextBallTransitionAnim(float dt, bool& loopOut, CStateManager& mgr);
void UpdateMorphBallTransition(float dt, CStateManager& mgr);
void UpdateGunAlpha();
void UpdatePlayerSounds();
void UpdatePlayerSounds(float dt);
void Update(float, CStateManager& mgr);
void PostUpdate(float, CStateManager& mgr);
bool StartSamusVoiceSfx(u16 sfx, float vol, int prio);
@ -598,7 +603,7 @@ public:
zeus::CVector3f GetDampedClampedVelocityWR() const;
const CVisorSteam& GetVisorSteam() const { return x7a0_visorSteam; }
float GetVisorStaticAlpha() const { return x74c_visorStaticAlpha; }
float GetMapAlpha() const { return x494_mapAlpha; }
float GetGunAlpha() const { return x494_gunAlpha; }
const CScriptWater* GetVisorRunoffEffect(const CStateManager& mgr) const;
void SetMorphBallState(EPlayerMorphBallState state, CStateManager& mgr);
bool CanLeaveMorphBallState(CStateManager& mgr, zeus::CVector3f& pos) const;

View File

@ -0,0 +1,19 @@
#include "CScriptPlayerHint.hpp"
#include "CActorParameters.hpp"
#include "TCastTo.hpp"
namespace urde
{
CScriptPlayerHint::CScriptPlayerHint(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, u32 priority, u32 overrideFlags)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), {EMaterialTypes::Unknown},
CActorParameters::None(), kInvalidUniqueId), x100_priority(priority), x104_overrideFlags(overrideFlags)
{}
void CScriptPlayerHint::Accept(IVisitor& visit)
{
visit.Visit(this);
}
}

View File

@ -0,0 +1,27 @@
#ifndef __URDE_CSCRIPTPLAYERHINT_HPP__
#define __URDE_CSCRIPTPLAYERHINT_HPP__
#include "CActor.hpp"
namespace urde
{
class CScriptPlayerHint : public CActor
{
u32 xe8_ = 0;
bool xfc_ = false;
u32 x100_priority;
u32 x104_overrideFlags;
TUniqueId x108_actor = kInvalidUniqueId;
public:
CScriptPlayerHint(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, u32 priority, u32 overrideFlags);
void Accept(IVisitor& visit);
u32 GetPriority() const { return x100_priority; }
u32 GetOverrideFlags() const { return x104_overrideFlags; }
TUniqueId GetActorId() const { return x108_actor; }
};
}
#endif // __URDE_CSCRIPTPLAYERHINT_HPP__

View File

@ -9,8 +9,6 @@
#include "CFluidUVMotion.hpp"
#include "GameGlobalObjects.hpp"
#include "CWorld.hpp"
#include "Character/CModelData.hpp"
#include "Collision/CMaterialList.hpp"
#include "Particle/CWeaponDescription.hpp"
#include "CDamageInfo.hpp"
#include "CScriptActor.hpp"
@ -73,11 +71,11 @@
#include "CScriptMidi.hpp"
#include "CScriptRoomAcoustics.hpp"
#include "CScriptControllerAction.hpp"
#include "CScriptPlayerHint.hpp"
#include "CPatternedInfo.hpp"
#include "CSimplePool.hpp"
#include "Collision/CCollidableOBBTreeGroup.hpp"
#include "Editor/ProjectResourceFactoryMP1.hpp"
#include "logvisor/logvisor.hpp"
namespace urde
{
@ -1571,7 +1569,15 @@ CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int pr
CEntity* ScriptLoader::LoadPlayerHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 6, "PlayerHint"))
return nullptr;
SActorHead aHead = LoadActorHead(in, mgr);
bool active = in.readBool();
u32 w2 = LoadParameterFlags(in);
u32 w1 = in.readUint32Big();
return new CScriptPlayerHint(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, w1, w2);
}
CEntity* ScriptLoader::LoadRipper(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)