mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 15:47:46 +00:00
Implement class declaration for CFluidPlane/CFluidPlaneCPU
This commit is contained in:
@@ -1310,9 +1310,9 @@ void CStateManager::KnockBackPlayer(CPlayer& player, const zeus::CVector3f& pos,
|
||||
if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed)
|
||||
{
|
||||
usePower = power * 1000.f;
|
||||
CPlayer::EPlayerMovementSurface surface =
|
||||
player.x2b0_ == 2 ? player.x2ac_movementSurface : CPlayer::EPlayerMovementSurface::Four;
|
||||
if (surface != CPlayer::EPlayerMovementSurface::Normal &&
|
||||
CPlayer::ESurfaceRestraints surface =
|
||||
player.x2b0_ == 2 ? player.x2ac_surfaceRestraint : CPlayer::ESurfaceRestraints::Four;
|
||||
if (surface != CPlayer::ESurfaceRestraints::Normal &&
|
||||
player.GetOrbitState() == CPlayer::EPlayerOrbitState::Zero)
|
||||
usePower /= 7.f;
|
||||
}
|
||||
|
||||
@@ -262,12 +262,12 @@ void CCameraManager::UpdateListener(CStateManager& mgr)
|
||||
|
||||
float CCameraManager::CalculateFogDensity(CStateManager& mgr, const CScriptWater* water)
|
||||
{
|
||||
float f31 = 1.f /* 1.f - water->x1b4_->x40_; */;
|
||||
float f31 = water->GetFluidPlane().GetAlpha();
|
||||
float f1 = 0;
|
||||
if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GravitySuit))
|
||||
f1 = (g_tweakPlayer->GetX54() * g_tweakPlayer->GetX50()) + f31;
|
||||
f1 = (g_tweakPlayer->GetPlayerTranslationFriction(4) * g_tweakPlayer->GetPlayerTranslationFriction(3)) + f31;
|
||||
else
|
||||
f1 = (g_tweakPlayer->GetX5C() * g_tweakPlayer->GetX58()) + f31;
|
||||
f1 = (g_tweakPlayer->GetPlayerTranslationFriction(6) * g_tweakPlayer->GetPlayerTranslationFriction(5)) + f31;
|
||||
|
||||
return f1 * x94_;
|
||||
}
|
||||
|
||||
@@ -91,9 +91,9 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
||||
angle = (player->x3ec_freeLookPitchAngle > -0.f ? -1.f : 1.f);
|
||||
zeus::CVector3f vec;
|
||||
vec.z = std::sin(angle);
|
||||
vec.y = std::cos(-player->x3e4_) * std::cos(angle);
|
||||
vec.x = std::sin(-player->x3e4_) * std::cos(angle);
|
||||
if (g_tweakPlayer->GetX228_24() && !zeus::close_enough(vec, zeus::CVector3f::skZero))
|
||||
vec.y = std::cos(-player->x3e4_freeLookYawAngle) * std::cos(angle);
|
||||
vec.x = std::sin(-player->x3e4_freeLookYawAngle) * std::cos(angle);
|
||||
if (g_tweakPlayer->GetFreeLookTurnsPlayer() && !zeus::close_enough(vec, zeus::CVector3f::skZero))
|
||||
vec.normalize();
|
||||
|
||||
rVec = zeus::CQuaternion::lookAt({0.f, 1.f, 0.f}, rVec, zeus::CRelAngle::FromDegrees(360.f)).transform(vec);
|
||||
@@ -240,7 +240,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
||||
float angle = gunFront.dot(rVec);
|
||||
if (std::fabs(angle) > 1.f)
|
||||
angle = (angle > -0.f ? -1.f : 1.f);
|
||||
float sdt = dt * g_tweakPlayer->GetX138();
|
||||
float sdt = dt * g_tweakPlayer->GetFreeLookSpeed();
|
||||
qGun = zeus::CQuaternion::lookAt(
|
||||
rVec, gunFront, sdt * zeus::clamp(0.f, g_tweakPlayer->GetX14C() * (std::acos(angle) / sdt), 1.f));
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ void CSamusFaceReflection::Update(float dt, const CStateManager& mgr, CRandom16&
|
||||
lookDot = lookDot > 0.f ? 1.f : -1.f;
|
||||
float lookAng = std::acos(lookDot);
|
||||
x50_lookRot = zeus::CQuaternion::slerp(x50_lookRot, xfLook2,
|
||||
zeus::clamp(0.f, 18.f * dt * ((lookAng > 0.f) ? 0.5f * dt * g_tweakPlayer->GetHudLagAmount() / lookAng : 0.f), 1.f));
|
||||
zeus::clamp(0.f, 18.f * dt * ((lookAng > 0.f) ? 0.5f * dt * g_tweakPlayer->GetFreeLookSpeed() / lookAng : 0.f), 1.f));
|
||||
x60_lookDir = lookDir;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,7 +690,7 @@ void CSamusHud::ApplyClassicLag(const zeus::CUnitVector3f& lookDir, zeus::CQuate
|
||||
float angle = std::acos(dot);
|
||||
float tmp = 0.f;
|
||||
if (angle > 0.f)
|
||||
tmp = 0.5f * dt * g_tweakPlayer->GetHudLagAmount() / angle;
|
||||
tmp = 0.5f * dt * g_tweakPlayer->GetFreeLookSpeed() / angle;
|
||||
|
||||
float t = zeus::clamp(0.f, 18.f * dt * tmp, 1.f);
|
||||
rot = zeus::CQuaternion::slerp(rot, doubleRot, t);
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
#include <Runtime/GameGlobalObjects.hpp>
|
||||
#include "CFluidPlane.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
CFluidPlane::CFluidPlane(u32, u32, u32, EFluidType, float, const urde::CFluidUVMotion&, float)
|
||||
|
||||
CFluidPlane::CFluidPlane(ResId texPattern1, ResId texPattern2, ResId texColor, float alpha, EFluidType fluidType,
|
||||
float f2, const CFluidUVMotion& motion)
|
||||
: x4_texPattern1Id(texPattern1), x8_texPattern2Id(texPattern2), xc_texColorId(texColor), x40_alpha(alpha),
|
||||
x44_fluidType(fluidType), x48_f2(f2), x4c_uvMotion(motion)
|
||||
{
|
||||
if (g_ResFactory->GetResourceTypeById(texPattern1) == FOURCC('TXTR'))
|
||||
x10_texPattern1.emplace(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), texPattern1}));
|
||||
if (g_ResFactory->GetResourceTypeById(texPattern2) == FOURCC('TXTR'))
|
||||
x20_texPattern2.emplace(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), texPattern2}));
|
||||
if (g_ResFactory->GetResourceTypeById(texColor) == FOURCC('TXTR'))
|
||||
x30_texColor.emplace(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), texColor}));
|
||||
}
|
||||
|
||||
void CFluidPlane::Ripple(float mag, TUniqueId rippler, const zeus::CVector3f& pos,
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
#define __URDE_CFLUIDPLANE_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CToken.hpp"
|
||||
#include "Graphics/CTexture.hpp"
|
||||
#include "CFluidUVMotion.hpp"
|
||||
#include "zeus/CAABox.hpp"
|
||||
#include "zeus/CFrustum.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CFluidUVMotion;
|
||||
@@ -22,28 +28,36 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
u32 x4_;
|
||||
u32 x8_;
|
||||
u32 xc_;
|
||||
float x40_;
|
||||
ResId x4_texPattern1Id;
|
||||
ResId x8_texPattern2Id;
|
||||
ResId xc_texColorId;
|
||||
std::experimental::optional<TLockedToken<CTexture>> x10_texPattern1;
|
||||
std::experimental::optional<TLockedToken<CTexture>> x20_texPattern2;
|
||||
std::experimental::optional<TLockedToken<CTexture>> x30_texColor;
|
||||
float x40_alpha;
|
||||
EFluidType x44_fluidType;
|
||||
float x48_;
|
||||
float x48_f2;
|
||||
CFluidUVMotion x4c_uvMotion;
|
||||
public:
|
||||
CFluidPlane() = default;
|
||||
CFluidPlane(u32, u32, u32, EFluidType, float, const CFluidUVMotion&, float);
|
||||
CFluidPlane(ResId texPattern1, ResId texPattern2, ResId texColor, float alpha, EFluidType fluidType,
|
||||
float f2, const CFluidUVMotion& motion);
|
||||
|
||||
virtual void Ripple(float mag, TUniqueId rippler, const zeus::CVector3f& pos,
|
||||
CScriptWater& water, CStateManager& mgr);
|
||||
virtual void Update();
|
||||
float GetAlpha() const;
|
||||
virtual void Render(const CStateManager& mgr, const zeus::CAABox& aabb, const zeus::CTransform& xf,
|
||||
const zeus::CTransform& areaXf, bool noSubdiv, const zeus::CFrustum& frustum,
|
||||
const std::experimental::optional<CRippleManager>& rippleManager, TUniqueId waterId,
|
||||
const bool* gridFlags, u32 gridDimX, u32 gridDimY, const zeus::CVector3f& areaCenter) const {}
|
||||
float GetAlpha() const { return x40_alpha; }
|
||||
EFluidType GetFluidType() const { return x44_fluidType; }
|
||||
const CFluidUVMotion& GetUVMotion() const;
|
||||
void GetColorTexture() const;
|
||||
bool HasColorTexture() const;
|
||||
void GetTexturePattern1() const;
|
||||
bool HasTexturePattern1() const;
|
||||
void GetTexturePattern2() const;
|
||||
bool HasTexturePattern2() const;
|
||||
const CFluidUVMotion& GetUVMotion() const { return x4c_uvMotion; }
|
||||
const CTexture& GetColorTexture() const { return **x30_texColor; }
|
||||
bool HasColorTexture() const { return x30_texColor.operator bool(); }
|
||||
const CTexture& GetTexturePattern1() const { return **x10_texPattern1; }
|
||||
bool HasTexturePattern1() const { return x10_texPattern1.operator bool(); }
|
||||
const CTexture& GetTexturePattern2() const { return **x20_texPattern2; }
|
||||
bool HasTexturePattern2() const { return x20_texPattern2.operator bool(); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,91 @@
|
||||
#include "CFluidPlaneCPU.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
|
||||
#define kTableSize 2048
|
||||
|
||||
namespace urde
|
||||
{
|
||||
CFluidPlaneCPU::CFluidPlaneCPU(u32 w1, u32 w2, u32 w3, u32 w4, u32 w5, u32 w6, float f1, u32 w7, u32 w8,
|
||||
EFluidType fluidType, float f2, const zeus::CVector3f& v1, float f3,
|
||||
const urde::CFluidUVMotion& motion, float f4, float f5, float f6, float f7, float f8,
|
||||
float f9, float f10, float f11, float f12, float f13, float f14, float f15, float f16,
|
||||
float f17)
|
||||
: CFluidPlane(w1, w2, w3, fluidType, f3, motion, f17)
|
||||
CFluidPlaneCPU::CTurbulence::CTurbulence(float speed, float distance, float freqMax, float freqMin,
|
||||
float phaseMax, float phaseMin, float amplitudeMax, float amplitudeMin)
|
||||
: x0_speed(speed), x4_distance(distance), x8_freqMax(freqMax), xc_freqMin(freqMin),
|
||||
x10_phaseMax(phaseMax), x14_phaseMin(phaseMin), x18_amplitudeMax(amplitudeMax), x1c_amplitudeMin(amplitudeMin),
|
||||
x2c_ooTurbSpeed(1.f / x0_speed), x30_ooTurbDistance(1.f / x4_distance)
|
||||
{
|
||||
if (x18_amplitudeMax != 0.f || x1c_amplitudeMin != 0.f)
|
||||
{
|
||||
x24_tableCount = kTableSize;
|
||||
x28_heightSelPitch = x24_tableCount;
|
||||
x20_table.reset(new float[x24_tableCount]);
|
||||
float anglePitch = 2.f * M_PIF / x28_heightSelPitch;
|
||||
float freqConstant = 0.5f * (x8_freqMax + xc_freqMin);
|
||||
float freqLinear = 0.5f * (x8_freqMax - xc_freqMin);
|
||||
float phaseConstant = 0.5f * (x10_phaseMax + x14_phaseMin);
|
||||
float phaseLinear = 0.5f * (x10_phaseMax - x14_phaseMin);
|
||||
float amplitudeConstant = 0.5f * (x18_amplitudeMax + x1c_amplitudeMin);
|
||||
float amplitudeLinear = 0.5f * (x18_amplitudeMax - x1c_amplitudeMin);
|
||||
|
||||
float curAng = 0.f;
|
||||
for (int i=0 ; i<x24_tableCount ; ++i, curAng += anglePitch)
|
||||
{
|
||||
float angCos = std::cos(curAng);
|
||||
x20_table[i] = (amplitudeLinear * angCos + amplitudeConstant) *
|
||||
std::sin((freqLinear * angCos + freqConstant) * curAng + (phaseLinear * angCos + phaseConstant));
|
||||
}
|
||||
|
||||
x34_hasTurbulence = true;
|
||||
}
|
||||
}
|
||||
|
||||
CFluidPlaneCPU::CFluidPlaneCPU(ResId texPattern1, ResId texPattern2, ResId texColor, ResId bumpMap, ResId envMap,
|
||||
ResId envBumpMap, ResId unkMap, float f1, float tileSize, u32 tileSubdivisions,
|
||||
EFluidType fluidType, float alpha, const zeus::CVector3f& bumpLightDir, float bumpScale,
|
||||
const CFluidUVMotion& mot, float turbSpeed, float turbDistance, float turbFreqMax,
|
||||
float turbFreqMin, float turbPhaseMax, float turbPhaseMin, float turbAmplitudeMax,
|
||||
float turbAmplitudeMin, float specularMin, float specularMax, float reflectionBlend,
|
||||
float reflectionSize, float fluidPlaneF2)
|
||||
: CFluidPlane(texPattern1, texPattern2, texColor, alpha, fluidType, fluidPlaneF2, mot),
|
||||
xa0_texIdBumpMap(bumpMap), xa4_texIdEnvMap(envMap), xa8_texIdEnvBumpMap(envBumpMap), xac_texId4(unkMap),
|
||||
xf0_bumpLightDir(bumpLightDir), xfc_bumpScale(bumpScale), x100_tileSize(tileSize),
|
||||
x104_tileSubdivisions(tileSubdivisions & ~0x1),
|
||||
x108_rippleResolution(x100_tileSize / float(x104_tileSubdivisions)),
|
||||
x10c_specularMin(specularMin), x110_specularMax(specularMax), x114_reflectionBlend(reflectionBlend),
|
||||
x118_reflectionSize(reflectionSize), x11c_f1(f1),
|
||||
x120_turbulence(turbSpeed, turbDistance, turbFreqMax, turbFreqMin, turbPhaseMax,
|
||||
turbPhaseMin, turbAmplitudeMax, turbAmplitudeMin)
|
||||
{
|
||||
if (g_ResFactory->GetResourceTypeById(xa0_texIdBumpMap) == FOURCC('TXTR'))
|
||||
xb0_bumpMap.emplace(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), xa0_texIdBumpMap}));
|
||||
if (g_ResFactory->GetResourceTypeById(xa4_texIdEnvMap) == FOURCC('TXTR'))
|
||||
xc0_envMap.emplace(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), xa4_texIdEnvMap}));
|
||||
if (g_ResFactory->GetResourceTypeById(xa8_texIdEnvBumpMap) == FOURCC('TXTR'))
|
||||
xd0_envBumpMap.emplace(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), xa8_texIdEnvBumpMap}));
|
||||
if (g_ResFactory->GetResourceTypeById(xac_texId4) == FOURCC('TXTR'))
|
||||
xe0_tex4.emplace(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), xac_texId4}));
|
||||
}
|
||||
|
||||
void CFluidPlaneCPU::CreateRipple(const CRipple& ripple, CStateManager& mgr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CFluidPlaneCPU::RenderSetup(const CStateManager& mgr, float, const zeus::CTransform& xf,
|
||||
const zeus::CTransform& areaXf, const zeus::CAABox& aabb, CScriptWater* water) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CFluidPlaneCPU::Render(const CStateManager& mgr, const zeus::CAABox& aabb, const zeus::CTransform& xf,
|
||||
const zeus::CTransform& areaXf, bool noSubdiv, const zeus::CFrustum& frustum,
|
||||
const std::experimental::optional<CRippleManager>& rippleManager, TUniqueId waterId,
|
||||
const bool* gridFlags, u32 gridDimX, u32 gridDimY, const zeus::CVector3f& areaCenter) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CFluidPlaneCPU::RenderCleanup() const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,16 +2,91 @@
|
||||
#define __URDE_CFLUIDPLANECPU_HPP__
|
||||
|
||||
#include "CFluidPlane.hpp"
|
||||
#include "CRipple.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CFluidUVMotion;
|
||||
class CFluidPlaneCPU : public CFluidPlane
|
||||
{
|
||||
class CTurbulence
|
||||
{
|
||||
float x0_speed;
|
||||
float x4_distance;
|
||||
float x8_freqMax;
|
||||
float xc_freqMin;
|
||||
float x10_phaseMax;
|
||||
float x14_phaseMin;
|
||||
float x18_amplitudeMax;
|
||||
float x1c_amplitudeMin;
|
||||
std::unique_ptr<float[]> x20_table; // x140
|
||||
u32 x24_tableCount = 0; // x144
|
||||
float x28_heightSelPitch = 0.f; // x148
|
||||
float x2c_ooTurbSpeed; // x14c
|
||||
float x30_ooTurbDistance; // x150
|
||||
bool x34_hasTurbulence = false; // x154
|
||||
public:
|
||||
CTurbulence(float speed, float distance, float freqMax, float freqMin,
|
||||
float phaseMax, float phaseMin, float amplitudeMax, float amplitudeMin);
|
||||
float GetHeight(float sel) const { return x20_table[(x24_tableCount - 1) & int(sel * x28_heightSelPitch)]; }
|
||||
float GetOODistance() const { return x30_ooTurbDistance; }
|
||||
float GetOOSpeed() const { return x2c_ooTurbSpeed; }
|
||||
bool HasTurbulence() const { return x34_hasTurbulence; }
|
||||
};
|
||||
|
||||
ResId xa0_texIdBumpMap;
|
||||
ResId xa4_texIdEnvMap;
|
||||
ResId xa8_texIdEnvBumpMap;
|
||||
ResId xac_texId4;
|
||||
std::experimental::optional<TLockedToken<CTexture>> xb0_bumpMap;
|
||||
std::experimental::optional<TLockedToken<CTexture>> xc0_envMap;
|
||||
std::experimental::optional<TLockedToken<CTexture>> xd0_envBumpMap;
|
||||
std::experimental::optional<TLockedToken<CTexture>> xe0_tex4;
|
||||
zeus::CVector3f xf0_bumpLightDir;
|
||||
float xfc_bumpScale;
|
||||
float x100_tileSize;
|
||||
u32 x104_tileSubdivisions;
|
||||
float x108_rippleResolution;
|
||||
float x10c_specularMin;
|
||||
float x110_specularMax;
|
||||
float x114_reflectionBlend;
|
||||
float x118_reflectionSize;
|
||||
float x11c_f1;
|
||||
CTurbulence x120_turbulence;
|
||||
public:
|
||||
CFluidPlaneCPU(u32, u32, u32, u32, u32, u32, float, u32, u32, EFluidType, float, const zeus::CVector3f&,
|
||||
float, const CFluidUVMotion&, float, float, float, float, float, float, float, float, float, float,
|
||||
float, float, float, float);
|
||||
CFluidPlaneCPU(ResId texPattern1, ResId texPattern2, ResId texColor, ResId bumpMap, ResId envMap, ResId envBumpMap,
|
||||
ResId unkMap, float f1, float tileSize, u32 tileSubdivisions, EFluidType fluidType, float alpha,
|
||||
const zeus::CVector3f& bumpLightDir, float bumpScale, const CFluidUVMotion& mot, float turbSpeed,
|
||||
float turbDistance, float turbFreqMax, float turbFreqMin, float turbPhaseMax, float turbPhaseMin,
|
||||
float turbAmplitudeMax, float turbAmplitudeMin, float specularMin, float specularMax,
|
||||
float reflectionBlend, float reflectionSize, float fluidPlaneF2);
|
||||
void CreateRipple(const CRipple& ripple, CStateManager& mgr);
|
||||
void RenderSetup(const CStateManager& mgr, float, const zeus::CTransform& xf, const zeus::CTransform& areaXf,
|
||||
const zeus::CAABox& aabb, CScriptWater* water) const;
|
||||
void Render(const CStateManager& mgr, const zeus::CAABox& aabb, const zeus::CTransform& xf,
|
||||
const zeus::CTransform& areaXf, bool noSubdiv, const zeus::CFrustum& frustum,
|
||||
const std::experimental::optional<CRippleManager>& rippleManager, TUniqueId waterId,
|
||||
const bool* gridFlags, u32 gridDimX, u32 gridDimY, const zeus::CVector3f& areaCenter) const;
|
||||
void RenderCleanup() const;
|
||||
float GetReflectionBlend() const { return x114_reflectionBlend; }
|
||||
float GetSpecularMax() const { return x110_specularMax; }
|
||||
float GetSpecularMin() const { return x10c_specularMin; }
|
||||
float GetReflectionSize() const { return x118_reflectionSize; }
|
||||
float GetBumpScale() const { return xfc_bumpScale; }
|
||||
bool HasBumpMap() const { return xb0_bumpMap.operator bool(); }
|
||||
const CTexture& GetBumpMap() const { return **xb0_bumpMap; }
|
||||
bool HasEnvMap() const { return xc0_envMap.operator bool(); }
|
||||
const CTexture& GetEnvMap() const { return **xc0_envMap; }
|
||||
bool HasEnvBumpMap() const { return xd0_envBumpMap.operator bool(); }
|
||||
const CTexture& GetEnvBumpMap() const { return **xd0_envBumpMap; }
|
||||
const zeus::CVector3f& GetBumpLightDir() const { return xf0_bumpLightDir; }
|
||||
float GetTileSize() const { return x100_tileSize; }
|
||||
u32 GetTileSubdivisions() const { return x104_tileSubdivisions; }
|
||||
float GetRippleResolution() const { return x108_rippleResolution; }
|
||||
float GetTurbulenceHeight(float sel) const { return x120_turbulence.GetHeight(sel); }
|
||||
float GetOOTurbulenceDistance() const { return x120_turbulence.GetOODistance(); }
|
||||
float GetOOTurbulenceSpeed() const { return x120_turbulence.GetOOSpeed(); }
|
||||
bool HasTurbulence() const { return x120_turbulence.HasTurbulence(); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ public:
|
||||
float x8_b = 0.f;
|
||||
float xc_c = 1.f;
|
||||
float x10_d = 5.f;
|
||||
float x14_e = 0.2f;
|
||||
float x14_envNormalScale = 0.2f;
|
||||
|
||||
SFluidLayerMotion() = default;
|
||||
SFluidLayerMotion(EFluidUVMotion motion, float a, float b, float c, float d)
|
||||
: x0_motion(motion), x4_a(1.f / a), x8_b(b), xc_c(c), x10_d(d), x14_e(1.f / d)
|
||||
: x0_motion(motion), x4_a(1.f / a), x8_b(b), xc_c(c), x10_d(d), x14_envNormalScale(1.f / d)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
void SetTouchedHalfPipeRecently(bool) {}
|
||||
void DisableHalfPipeStatus() {}
|
||||
void BallCloseToCollision(const CStateManager&, float) const {}
|
||||
void CollidedWith(const TUniqueId&, const CCollisionInfoList&, CStateManager&) {}
|
||||
void CollidedWith(TUniqueId, const CCollisionInfoList&, CStateManager&) {}
|
||||
bool IsInFrustum(const zeus::CFrustum&) const { return false; }
|
||||
void ComputeLiftForces(const zeus::CVector3f&, const zeus::CVector3f&, const CStateManager&) {}
|
||||
void CalculateSurfaceFriction() const {}
|
||||
|
||||
@@ -346,7 +346,7 @@ void CPlayer::TakeDamage(bool significant, const zeus::CVector3f& location,
|
||||
doRumble = true;
|
||||
}
|
||||
|
||||
if (damageLoopSfx && !x9c7_24_ && x2ac_movementSurface >= EPlayerMovementSurface::Ice)
|
||||
if (damageLoopSfx && !x9c7_24_ && x2ac_surfaceRestraint >= ESurfaceRestraints::Ice)
|
||||
{
|
||||
if (!x770_damageLoopSfx || x788_damageLoopSfxId != damageLoopSfx)
|
||||
{
|
||||
@@ -987,7 +987,7 @@ void CPlayer::UpdateFreeLookState(const CFinalInput& input, float dt, CStateMana
|
||||
zeus::CVector3f lookDir = mgr.GetCameraManager()->GetFirstPersonCamera()->GetTransform().basis[1];
|
||||
zeus::CVector3f lookDirFlat = lookDir;
|
||||
lookDirFlat.z = 0.f;
|
||||
x3e4_ = 0.f;
|
||||
x3e4_freeLookYawAngle = 0.f;
|
||||
if (lookDirFlat.canBeNormalized())
|
||||
{
|
||||
lookDirFlat.normalize();
|
||||
@@ -1022,7 +1022,7 @@ void CPlayer::UpdateFreeLookState(const CFinalInput& input, float dt, CStateMana
|
||||
ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookDown, input) >= 0.1f ||
|
||||
ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookUp, input) >= 0.1f);
|
||||
x3dd_freeLookPitchAngleCalculated = false;
|
||||
if (std::fabs(x3e4_) < g_tweakPlayer->GetFreeLookCenteredThresholdAngle() &&
|
||||
if (std::fabs(x3e4_freeLookYawAngle) < g_tweakPlayer->GetFreeLookCenteredThresholdAngle() &&
|
||||
std::fabs(x3ec_freeLookPitchAngle) < g_tweakPlayer->GetFreeLookCenteredThresholdAngle())
|
||||
{
|
||||
if (x3e0_curFreeLookCenteredTime > g_tweakPlayer->GetFreeLookCenteredTime())
|
||||
@@ -1046,9 +1046,34 @@ void CPlayer::UpdateFreeLookState(const CFinalInput& input, float dt, CStateMana
|
||||
UpdateCrosshairsState(input);
|
||||
}
|
||||
|
||||
void CPlayer::UpdateFreeLook(float dt) {}
|
||||
void CPlayer::UpdateFreeLook(float dt)
|
||||
{
|
||||
if (GetFrozenState())
|
||||
return;
|
||||
float lookDeltaAngle = dt * g_tweakPlayer->GetFreeLookSpeed();
|
||||
if (!x3de_lookControlHeld)
|
||||
lookDeltaAngle = dt * g_tweakPlayer->GetFreeLookSnapSpeed();
|
||||
float angleVelP = x3f0_vertFreeLookAngleVel - x3ec_freeLookPitchAngle;
|
||||
float vertLookDamp = zeus::clamp(0.f, std::fabs(angleVelP / 1.0471976f), 1.f);
|
||||
float dx = lookDeltaAngle * (2.f * vertLookDamp - std::sin((M_PIF / 2.f) * vertLookDamp));
|
||||
if (0.f <= angleVelP)
|
||||
x3ec_freeLookPitchAngle += dx;
|
||||
else
|
||||
x3ec_freeLookPitchAngle -= dx;
|
||||
angleVelP = x3e8_horizFreeLookAngleVel - x3e4_freeLookYawAngle;
|
||||
dx = lookDeltaAngle * zeus::clamp(0.f, std::fabs(angleVelP / g_tweakPlayer->GetHorizontalFreeLookAngleVel()), 1.f);
|
||||
if (0.f <= angleVelP)
|
||||
x3e4_freeLookYawAngle += dx;
|
||||
else
|
||||
x3e4_freeLookYawAngle -= dx;
|
||||
if (g_tweakPlayer->GetFreeLookTurnsPlayer())
|
||||
x3e4_freeLookYawAngle = 0.f;
|
||||
}
|
||||
|
||||
float CPlayer::GetMaximumPlayerPositiveVerticalVelocity(CStateManager&) const { return 0.f; }
|
||||
float CPlayer::GetMaximumPlayerPositiveVerticalVelocity(CStateManager& mgr) const
|
||||
{
|
||||
return mgr.GetPlayerState()->GetItemAmount(CPlayerState::EItemType::SpaceJumpBoots) ? 14.f : 11.666666f;
|
||||
}
|
||||
|
||||
void CPlayer::StartLandingControlFreeze()
|
||||
{
|
||||
@@ -1652,16 +1677,16 @@ void CPlayer::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CState
|
||||
SetMoveState(EPlayerMovementState::StartingJump, mgr);
|
||||
break;
|
||||
case EScriptObjectMessage::OnIceSurface:
|
||||
x2ac_movementSurface = EPlayerMovementSurface::Ice;
|
||||
x2ac_surfaceRestraint = ESurfaceRestraints::Ice;
|
||||
break;
|
||||
case EScriptObjectMessage::OnMudSlowSurface:
|
||||
x2ac_movementSurface = EPlayerMovementSurface::MudSlow;
|
||||
x2ac_surfaceRestraint = ESurfaceRestraints::MudSlow;
|
||||
break;
|
||||
case EScriptObjectMessage::OnNormalSurface:
|
||||
x2ac_movementSurface = EPlayerMovementSurface::Normal;
|
||||
x2ac_surfaceRestraint = ESurfaceRestraints::Normal;
|
||||
break;
|
||||
case EScriptObjectMessage::InSnakeWeed:
|
||||
x2ac_movementSurface = EPlayerMovementSurface::SnakeWeed;
|
||||
x2ac_surfaceRestraint = ESurfaceRestraints::SnakeWeed;
|
||||
break;
|
||||
case EScriptObjectMessage::AddSplashInhabitant:
|
||||
{
|
||||
@@ -1690,13 +1715,13 @@ void CPlayer::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CState
|
||||
break;
|
||||
case CFluidPlane::EFluidType::Two:
|
||||
case CFluidPlane::EFluidType::Five:
|
||||
x2ac_movementSurface = EPlayerMovementSurface::Fluid2Or5;
|
||||
x2ac_surfaceRestraint = ESurfaceRestraints::Fluid2Or5;
|
||||
break;
|
||||
case CFluidPlane::EFluidType::One:
|
||||
x2b0_ = 0;
|
||||
break;
|
||||
case CFluidPlane::EFluidType::Three:
|
||||
x2ac_movementSurface = EPlayerMovementSurface::Fluid3;
|
||||
x2ac_surfaceRestraint = ESurfaceRestraints::Fluid3;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
@@ -1775,7 +1800,7 @@ void CPlayer::UpdateFootstepSounds(const CFinalInput& input, CStateManager& mgr,
|
||||
float sfxDelay = 0.f;
|
||||
if (forward > 0.05f || x304_orbitState != EPlayerOrbitState::Zero)
|
||||
{
|
||||
float vel = std::min(1.f, x138_velocity.magnitude() / GetActualFirstPersonMaxVelocity());
|
||||
float vel = std::min(1.f, x138_velocity.magnitude() / GetActualFirstPersonMaxVelocity(dt));
|
||||
if (vel > 0.05f)
|
||||
{
|
||||
sfxDelay = -0.475f * vel + 0.85f;
|
||||
@@ -3830,6 +3855,11 @@ float CPlayer::GetEyeHeight() const
|
||||
return x9c8_eyeZBias + (x2d8_fpBounds.max.z - g_tweakPlayer->GetEyeOffset());
|
||||
}
|
||||
|
||||
float CPlayer::GetUnbiasedEyeHeight() const
|
||||
{
|
||||
return x2d8_fpBounds.max.z - g_tweakPlayer->GetEyeOffset();
|
||||
}
|
||||
|
||||
float CPlayer::GetStepUpHeight() const
|
||||
{
|
||||
if (x258_movementState == EPlayerMovementState::Jump ||
|
||||
@@ -3878,11 +3908,34 @@ const CCollidableSphere* CPlayer::GetCollidableSphere() const
|
||||
return x768_morphball->GetCollidableSphere();
|
||||
}
|
||||
|
||||
zeus::CTransform CPlayer::GetPrimitiveTransform() const { return {}; }
|
||||
zeus::CTransform CPlayer::GetPrimitiveTransform() const
|
||||
{
|
||||
return CPhysicsActor::GetPrimitiveTransform();
|
||||
}
|
||||
|
||||
void CPlayer::CollidedWith(TUniqueId, const CCollisionInfoList&, CStateManager& mgr) {}
|
||||
void CPlayer::CollidedWith(TUniqueId id, const CCollisionInfoList& list, CStateManager& mgr)
|
||||
{
|
||||
if (x2f8_morphTransState != EPlayerMorphBallState::Unmorphed)
|
||||
x768_morphball->CollidedWith(id, list, mgr);
|
||||
}
|
||||
|
||||
float CPlayer::GetActualFirstPersonMaxVelocity() const { return 0.f; }
|
||||
float CPlayer::GetActualBallMaxVelocity(float dt) const
|
||||
{
|
||||
ESurfaceRestraints surf = x2b0_ == 2 ? x2ac_surfaceRestraint : ESurfaceRestraints::Four;
|
||||
float friction = g_tweakBall->GetBallTranslationFriction(int(surf));
|
||||
float maxSpeed = g_tweakBall->GetBallTranslationMaxSpeed(int(surf));
|
||||
float acceleration = g_tweakBall->GetMaxBallTranslationAcceleration(int(surf));
|
||||
return -(friction * xe8_mass * maxSpeed / (acceleration * dt) - maxSpeed - friction);
|
||||
}
|
||||
|
||||
float CPlayer::GetActualFirstPersonMaxVelocity(float dt) const
|
||||
{
|
||||
ESurfaceRestraints surf = x2b0_ == 2 ? x2ac_surfaceRestraint : ESurfaceRestraints::Four;
|
||||
float friction = g_tweakPlayer->GetPlayerTranslationFriction(int(surf));
|
||||
float maxSpeed = g_tweakPlayer->GetPlayerTranslationMaxSpeed(int(surf));
|
||||
float acceleration = g_tweakPlayer->GetMaxTranslationalAcceleration(int(surf));
|
||||
return -(friction * xe8_mass * maxSpeed / (acceleration * dt) - maxSpeed - friction);
|
||||
}
|
||||
|
||||
void CPlayer::SetMoveState(EPlayerMovementState, CStateManager& mgr) {}
|
||||
|
||||
@@ -4004,7 +4057,7 @@ void CPlayer::LeaveMorphBallState(CStateManager& mgr)
|
||||
SetHudDisable(FLT_EPSILON, 0.f, 2.f);
|
||||
SetIntoBallReadyAnimation(mgr);
|
||||
CPhysicsActor::Stop();
|
||||
x3e4_ = 0.f;
|
||||
x3e4_freeLookYawAngle = 0.f;
|
||||
x3e8_horizFreeLookAngleVel = 0.f;
|
||||
x3ec_freeLookPitchAngle = 0.f;
|
||||
x3f0_vertFreeLookAngleVel = 0.f;
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
Four
|
||||
};
|
||||
|
||||
enum class EPlayerMovementSurface
|
||||
enum class ESurfaceRestraints
|
||||
{
|
||||
Normal,
|
||||
One,
|
||||
@@ -217,7 +217,7 @@ private:
|
||||
float x2a0_ = 0.f;
|
||||
bool x2a4_cancelCameraPitch = false;
|
||||
float x2a8_ = 1000.f;
|
||||
EPlayerMovementSurface x2ac_movementSurface = EPlayerMovementSurface::Normal;
|
||||
ESurfaceRestraints x2ac_surfaceRestraint = ESurfaceRestraints::Normal;
|
||||
u32 x2b0_ = 2;
|
||||
rstl::reserved_vector<float, 6> x2b4_;
|
||||
u32 x2d0_ = 3;
|
||||
@@ -271,7 +271,7 @@ private:
|
||||
bool x3dd_freeLookPitchAngleCalculated = false;
|
||||
bool x3de_lookControlHeld = false;
|
||||
float x3e0_curFreeLookCenteredTime = 0.f;
|
||||
float x3e4_ = 0.f;
|
||||
float x3e4_freeLookYawAngle = 0.f;
|
||||
float x3e8_horizFreeLookAngleVel = 0.f;
|
||||
float x3ec_freeLookPitchAngle = 0.f;
|
||||
float x3f0_vertFreeLookAngleVel = 0.f;
|
||||
@@ -554,6 +554,7 @@ public:
|
||||
zeus::CVector3f GetBallPosition() const;
|
||||
zeus::CVector3f GetEyePosition() const;
|
||||
float GetEyeHeight() const;
|
||||
float GetUnbiasedEyeHeight() const;
|
||||
float GetStepUpHeight() const;
|
||||
float GetStepDownHeight() const;
|
||||
void Teleport(const zeus::CTransform& xf, CStateManager& mgr, bool);
|
||||
@@ -563,7 +564,8 @@ public:
|
||||
const CCollidableSphere* GetCollidableSphere() const;
|
||||
zeus::CTransform GetPrimitiveTransform() const;
|
||||
void CollidedWith(TUniqueId, const CCollisionInfoList&, CStateManager& mgr);
|
||||
float GetActualFirstPersonMaxVelocity() const;
|
||||
float GetActualBallMaxVelocity(float dt) const;
|
||||
float GetActualFirstPersonMaxVelocity(float dt) const;
|
||||
void SetMoveState(EPlayerMovementState, CStateManager& mgr);
|
||||
float JumpInput(const CFinalInput& input, CStateManager& mgr);
|
||||
float TurnInput(const CFinalInput& input) const;
|
||||
|
||||
@@ -39,6 +39,26 @@ private:
|
||||
u32 x264_ = 0;
|
||||
TLockedToken<CParticleGen> x268_splashEffects[5];
|
||||
u16 x29c_splashSounds[5];
|
||||
u32 x2c0_tesselationSize;
|
||||
u32 x2c4_gridDimX = 0;
|
||||
u32 x2c8_gridDimY = 0;
|
||||
u32 x2cc_gridCellCount = 0;
|
||||
std::unique_ptr<bool[]> x2d8_gridFlags;
|
||||
std::unique_ptr<bool[]> x2e0_;
|
||||
u32 x2e4_gridCellCount2 = 0;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x2e8_24 : 1;
|
||||
bool x2e8_25 : 1;
|
||||
bool x2e8_26 : 1;
|
||||
bool x2e8_27 : 1;
|
||||
bool x2e8_28 : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
void SetupGrid(bool b);
|
||||
public:
|
||||
CScriptWater(CStateManager&, TUniqueId, const std::string& name, const CEntityInfo&, const zeus::CVector3f&,
|
||||
const zeus::CAABox&, CDamageInfo const&, zeus::CVector3f&, ETriggerFlags, bool, bool, ResId, ResId, ResId, ResId,
|
||||
|
||||
Reference in New Issue
Block a user