mirror of https://github.com/AxioDL/metaforce.git
Prelim CPlayer imps, fix race condition in CGameGlobalObjects
This commit is contained in:
parent
ae4f770ca2
commit
23b6bd350e
|
@ -2,3 +2,4 @@ version.h
|
|||
*.user
|
||||
.DS_Store
|
||||
*.autosave
|
||||
docs/*
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "CArchitectureQueue.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CGameState.hpp"
|
||||
#include "MP1/MP1.hpp"
|
||||
#include "IMain.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ CIOWin::EMessageReturn CAudioStateWin::OnMessage(const CArchitectureMessage& msg
|
|||
else if (msgType == EArchMsgType::QuitGameplay)
|
||||
{
|
||||
if (g_GameState->GetWorldTransitionManager()->GetTransType() == CWorldTransManager::ETransType::Disabled ||
|
||||
g_Main->GetFlowState() != MP1::CMain::EFlowState::Zero)
|
||||
g_Main->GetFlowState() != IMain::EFlowState::Zero)
|
||||
{
|
||||
CSfxManager::SetChannel(CSfxManager::ESfxChannels::Zero);
|
||||
CSfxManager::KillAll(CSfxManager::ESfxChannels::One);
|
||||
|
|
|
@ -33,6 +33,7 @@ add_subdirectory(MP2)
|
|||
add_subdirectory(MP3)
|
||||
|
||||
add_library(RuntimeCommon
|
||||
RetroTypes.hpp RetroTypes.cpp
|
||||
${CLIENT_SOURCES}
|
||||
${MP1_SOURCES}
|
||||
${AUDIO_SOURCES}
|
||||
|
@ -99,6 +100,5 @@ add_library(RuntimeCommon
|
|||
CGameHintInfo.hpp CGameHintInfo.cpp
|
||||
rstl.hpp rstl.cpp
|
||||
GameGlobalObjects.hpp GameGlobalObjects.cpp
|
||||
RetroTypes.hpp
|
||||
GCNTypes.hpp
|
||||
${PLAT_SRCS})
|
||||
|
|
|
@ -18,7 +18,6 @@ CMemoryCardSys::CMemoryCardSys()
|
|||
{
|
||||
xc_memoryWorlds.reserve(16);
|
||||
x1c_.reserve(16);
|
||||
|
||||
g_ResFactory->EnumerateNamedResources([&](const std::string& name, const SObjectTag& tag) -> bool
|
||||
{
|
||||
if (tag.type == FOURCC('MLVL'))
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "World/CEnvFxManager.hpp"
|
||||
#include "World/CActorModelParticles.hpp"
|
||||
#include "World/CTeamAiTypes.hpp"
|
||||
#include "World/CScriptPlayerActor.hpp"
|
||||
#include "Input/CRumbleManager.hpp"
|
||||
#include "World/CWorld.hpp"
|
||||
#include "Graphics/CLight.hpp"
|
||||
|
@ -303,6 +304,18 @@ void CStateManager::TouchSky() const
|
|||
{
|
||||
}
|
||||
|
||||
void CStateManager::TouchPlayerActor()
|
||||
{
|
||||
if (xf6c_playerActor == kInvalidUniqueId)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
CScriptPlayerActor* spa = dynamic_cast<CScriptPlayerActor*>(GetObjectById(xf6c_playerActor));
|
||||
if (spa)
|
||||
spa->TouchModels();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CStateManager::DrawSpaceWarp(const zeus::CVector3f& v, float strength) const
|
||||
{
|
||||
CPlayerState::EPlayerVisor visor = x8b8_playerState->GetActiveVisor(*this);
|
||||
|
|
|
@ -158,7 +158,7 @@ class CStateManager
|
|||
float xf28_thermColdScale2 = 0.f;
|
||||
float xf2c_ = 1.f;
|
||||
float xf30_ = 1.f;
|
||||
|
||||
TUniqueId xf6c_playerActor;
|
||||
void UpdateThermalVisor();
|
||||
|
||||
public:
|
||||
|
@ -189,6 +189,7 @@ public:
|
|||
const std::string* HashInstanceName(CInputStream& in);
|
||||
void SetActorAreaId(CActor& actor, TAreaId);
|
||||
void TouchSky() const;
|
||||
void TouchPlayerActor();
|
||||
void DrawSpaceWarp(const zeus::CVector3f&, float) const;
|
||||
void DrawReflection(const zeus::CVector3f&);
|
||||
void CacheReflection();
|
||||
|
@ -288,6 +289,7 @@ public:
|
|||
bool IsLayerActive(TAreaId area, int layerIdx) { return false; }
|
||||
|
||||
CPlayer& GetPlayer() const { return *x84c_player; }
|
||||
CPlayer* Player() const { return x84c_player.get(); }
|
||||
|
||||
CObjectList& GetAllObjectList() const { return *x80c_allObjs; }
|
||||
CActorList& GetActorObjectList() const { return *x814_actorObjs; }
|
||||
|
|
|
@ -108,7 +108,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
rVec = v;
|
||||
}
|
||||
}
|
||||
else if (player->x304_ == 0 && player->x2f8_morphTransState != 0 && player->x3dc_ && x1c4_ == kInvalidUniqueId)
|
||||
else if (player->x304_ == 0 && player->x2f8_morphTransState == 0 && player->x3dc_ && x1c4_ == kInvalidUniqueId)
|
||||
{
|
||||
if (player->x294_ > 0.f)
|
||||
{
|
||||
|
@ -233,7 +233,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
}
|
||||
zeus::CTransform bobXf = player->GetCameraBob()->GetCameraBobTransformation();
|
||||
|
||||
if (player->x2f8_morphTransState == 1 || player->x304_ == 5 || player->x3d8_ == 0 || mgr.x904_ == 1 ||
|
||||
if (player->x2f8_morphTransState == 1 || player->x304_ == 5 || player->x3b8_ == 0 || mgr.x904_ == 1 ||
|
||||
mgr.GetCameraManager()->IsInCinematicCamera())
|
||||
{
|
||||
bobXf = zeus::CTransform::Identity();
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
|
||||
const CParticleResData& GetParticleResData() const {return x44_partRes;}
|
||||
u32 GetAnimationIndex(u32 idx) const { return xb0_animIdxs[idx]; }
|
||||
const CPASDatabase& GetPASDatabase() const { return x30_pasDatabase; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
};
|
||||
|
||||
using CMemoryInStream = athena::io::MemoryReader;
|
||||
using CMemoryOutStream = athena::io::MemoryWriter;
|
||||
|
||||
class CZipInputStream : public CInputStream
|
||||
{
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "CArchitectureQueue.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CGameState.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "World/CPlayer.hpp"
|
||||
#include "MP1.hpp"
|
||||
#include "Character/CCharLayoutInfo.hpp"
|
||||
|
||||
|
@ -61,5 +63,12 @@ CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg,
|
|||
}
|
||||
|
||||
void CMFGameLoader::Draw() const { g_GameState->GetWorldTransitionManager()->Draw(); }
|
||||
|
||||
void CMFGameLoader::Touch()
|
||||
{
|
||||
x14_stateMgr->TouchSky();
|
||||
x14_stateMgr->TouchPlayerActor();
|
||||
x14_stateMgr->Player()->Touch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
CMFGameLoader();
|
||||
EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
|
||||
void Draw() const;
|
||||
void Touch();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace MP1
|
|||
{
|
||||
class CGameGlobalObjects
|
||||
{
|
||||
CMemoryCardSys x0_memoryCardSys;
|
||||
std::unique_ptr<CMemoryCardSys> x0_memoryCardSys;
|
||||
IFactory& x4_resFactory;
|
||||
CSimplePool& xcc_simplePool;
|
||||
CCharacterFactoryBuilder xec_charFactoryBuilder;
|
||||
|
@ -71,8 +71,9 @@ public:
|
|||
CSimplePool& objStore)
|
||||
: x4_resFactory(resFactory), xcc_simplePool(objStore)
|
||||
{
|
||||
g_MemoryCardSys = &x0_memoryCardSys;
|
||||
g_ResFactory = &x4_resFactory;
|
||||
x0_memoryCardSys.reset(new CMemoryCardSys());
|
||||
g_MemoryCardSys = x0_memoryCardSys.get();
|
||||
g_SimplePool = &xcc_simplePool;
|
||||
g_CharFactoryBuilder = &xec_charFactoryBuilder;
|
||||
g_AiFuncMap = &x110_aiFuncMap;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#include "RetroTypes.hpp"
|
||||
#include "zeus/CVector3f.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
}
|
|
@ -79,22 +79,39 @@ public:
|
|||
};
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
template <class T, size_t N>
|
||||
class TReservedAverage
|
||||
template <class T>
|
||||
T GetAverage(const T* v, s32 count)
|
||||
{
|
||||
T r = v[0];
|
||||
for (s32 i = 1; i < count; ++i)
|
||||
r += v[i];
|
||||
|
||||
return r / float(count);
|
||||
}
|
||||
|
||||
template <class T, size_t N>
|
||||
class TReservedAverage : rstl::reserved_vector<T, N>
|
||||
{
|
||||
rstl::reserved_vector<T, N> x0_values;
|
||||
public:
|
||||
TReservedAverage() = default;
|
||||
TReservedAverage(const T& v) { x0_values.resize(N, v); }
|
||||
TReservedAverage(const T& t) { resize(N, t); }
|
||||
|
||||
void AddValue(const T&)
|
||||
void AddValue(const T& t)
|
||||
{
|
||||
|
||||
if (this->size() < N)
|
||||
this->push_back(t);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
rstl::optional_object<T> GetAverage() const
|
||||
{
|
||||
if (this->empty())
|
||||
return {};
|
||||
|
||||
return {::GetAverage<T>(this->data(), this->size()) };
|
||||
}
|
||||
|
||||
void Clear() { this->clear(); }
|
||||
};
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
#include "CEnergyDrainSource.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CEnergyDrainSource::CEnergyDrainSource(TUniqueId src, float intensity)
|
||||
: x0_source(src)
|
||||
, x4_intensity(intensity)
|
||||
{
|
||||
}
|
||||
|
||||
TUniqueId CEnergyDrainSource::GetEnergyDrainSourceId() const
|
||||
{
|
||||
return x0_source;
|
||||
}
|
||||
|
||||
void CEnergyDrainSource::SetEnergyDrainIntensity(float in)
|
||||
{
|
||||
x4_intensity = in;
|
||||
}
|
||||
|
||||
float CEnergyDrainSource::GetEnergyDrainIntensity() const
|
||||
{
|
||||
return x4_intensity;
|
||||
}
|
||||
|
||||
bool CEnergyDrainSource::operator<(const CEnergyDrainSource& other)
|
||||
{
|
||||
return x0_source < other.x0_source;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef __URDE_CENERGYDRAINSOURCE_HPP__
|
||||
#define __URDE_CENERGYDRAINSOURCE_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CEnergyDrainSource
|
||||
{
|
||||
TUniqueId x0_source;
|
||||
float x4_intensity;
|
||||
public:
|
||||
CEnergyDrainSource(TUniqueId src, float intensity);
|
||||
TUniqueId GetEnergyDrainSourceId() const;
|
||||
void SetEnergyDrainIntensity(float);
|
||||
float GetEnergyDrainIntensity() const;
|
||||
|
||||
bool operator<(const CEnergyDrainSource& other);
|
||||
};
|
||||
}
|
||||
#endif // __URDE_CENERGYDRAINSOURCE_HPP__
|
|
@ -4,6 +4,8 @@ set(WORLD_SOURCES
|
|||
IGameArea.hpp IGameArea.cpp
|
||||
CGameArea.hpp CGameArea.cpp
|
||||
CPlayer.hpp CPlayer.cpp
|
||||
CPlayerEnergyDrain.hpp CPlayerEnergyDrain.cpp
|
||||
CEnergyDrainSource.hpp CEnergyDrainSource.cpp
|
||||
CPlayerCameraBob.hpp CPlayerCameraBob.cpp
|
||||
CPlayerGun.hpp CPlayerGun.cpp
|
||||
CGunWeapon.hpp CGunWeapon.cpp
|
||||
|
@ -71,6 +73,7 @@ set(WORLD_SOURCES
|
|||
CScriptDistanceFog.hpp CScriptDistanceFog.cpp
|
||||
CScriptActorRotate.hpp CScriptActorRotate.cpp
|
||||
CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp
|
||||
CScriptPlayerActor.hpp CScriptPlayerActor.cpp
|
||||
CScriptColorModulate.hpp CScriptColorModulate.cpp
|
||||
CGrappleParameters.hpp
|
||||
CActorParameters.hpp
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "CMorphBall.hpp"
|
||||
#include "CPlayerGun.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "Particle/CGenDescription.hpp"
|
||||
|
||||
namespace urde
|
||||
|
@ -16,16 +18,16 @@ static CModelData MakePlayerAnimRes(ResId resId, const zeus::CVector3f& scale)
|
|||
CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox& aabb, unsigned int resId,
|
||||
const zeus::CVector3f& playerScale, float mass, float stepUp, float stepDown, float f4,
|
||||
const CMaterialList& ml)
|
||||
: CPhysicsActor(uid, true, "CPlayer", CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList),
|
||||
xf, MakePlayerAnimRes(resId, playerScale), ml, aabb, SMoverData(mass), CActorParameters::None(),
|
||||
stepUp, stepDown)
|
||||
: CPhysicsActor(uid, true, "CPlayer", CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList),
|
||||
xf, MakePlayerAnimRes(resId, playerScale), ml, aabb, SMoverData(mass), CActorParameters::None(),
|
||||
stepUp, stepDown)
|
||||
{
|
||||
x768_morphball.reset(new CMorphBall(*this, f4));
|
||||
}
|
||||
|
||||
bool CPlayer::IsTransparent() const
|
||||
{
|
||||
return false;
|
||||
return x588_alpha < 1.f;
|
||||
}
|
||||
|
||||
void CPlayer::Update(float, CStateManager& mgr)
|
||||
|
@ -34,8 +36,12 @@ void CPlayer::Update(float, CStateManager& mgr)
|
|||
|
||||
bool CPlayer::IsPlayerDeadEnough() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (x2f8_morphTransState == 0)
|
||||
return x9f4_ < 2.5f;
|
||||
else if (x2f8_morphTransState == 1)
|
||||
return x9f4_ < 6.f;
|
||||
|
||||
return false;}
|
||||
|
||||
void CPlayer::AsyncLoadSuit(CStateManager& mgr)
|
||||
{
|
||||
|
@ -197,8 +203,13 @@ void CPlayer::Think(float, CStateManager&)
|
|||
{
|
||||
}
|
||||
|
||||
void CPlayer::PreThink(float, CStateManager&)
|
||||
void CPlayer::PreThink(float dt, CStateManager& mgr)
|
||||
{
|
||||
x558_ = false;
|
||||
x55c_ = 0.f;
|
||||
x560_ = 0.f;
|
||||
x564_ = zeus::CVector3f::skZero;
|
||||
xa04_ = dt;
|
||||
}
|
||||
|
||||
void CPlayer::AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&)
|
||||
|
@ -554,4 +565,67 @@ float CPlayer::GetDampedClampedVelocityWR() const
|
|||
return 0.f;
|
||||
}
|
||||
|
||||
void CPlayer::Touch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CPlayer::CVisorSteam::SetSteam(float a, float b, float c, ResId d, bool e)
|
||||
{
|
||||
if (x1c_ == -1 || a > x10_)
|
||||
{
|
||||
x10_ = a;
|
||||
x14_ = b;
|
||||
x18_ = c;
|
||||
x1c_ = d;
|
||||
}
|
||||
x28_ = e;
|
||||
}
|
||||
|
||||
ResId CPlayer::CVisorSteam::GetTextureId() const
|
||||
{
|
||||
return xc_;
|
||||
}
|
||||
|
||||
void CPlayer::CVisorSteam::Update(float dt)
|
||||
{
|
||||
if (x1c_ == -1)
|
||||
x0_ = 0.f;
|
||||
else
|
||||
{
|
||||
x0_ = x10_;
|
||||
x4_ = x14_;
|
||||
x8_ = x18_;
|
||||
xc_ = x1c_;
|
||||
}
|
||||
|
||||
x1c_ = -1;
|
||||
if ((x20_ - x0_) < 0.000009999f || std::fabs(x20_) > 0.000009999f)
|
||||
return;
|
||||
|
||||
if (x20_ > x0_)
|
||||
{
|
||||
if (x24_ <= 0.f)
|
||||
{
|
||||
x20_ -= (dt / x8_);
|
||||
x20_ = std::min(x20_, x0_);
|
||||
}
|
||||
else
|
||||
{
|
||||
x24_ = x0_ - dt;
|
||||
x24_ = zeus::max(0.f, x24_);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CToken tmpTex = g_SimplePool->GetObj({SBIG('TXTR'), xc_});
|
||||
if (!tmpTex)
|
||||
return;
|
||||
|
||||
x20_ += (x20_ + (dt / x4_));
|
||||
if (x20_ > x0_)
|
||||
x20_ = x0_;
|
||||
|
||||
x24_ = 0.1f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "zeus/CAABox.hpp"
|
||||
#include "zeus/CTransform.hpp"
|
||||
#include "CWeaponMgr.hpp"
|
||||
#include "CPlayerEnergyDrain.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -50,48 +51,134 @@ private:
|
|||
float x0_;
|
||||
float x4_;
|
||||
float x8_;
|
||||
u32 xc_;
|
||||
ResId xc_;
|
||||
float x10_ = 0.f;
|
||||
float x14_ = 0.f;
|
||||
float x18_ = 0.f;
|
||||
u32 x1c_ = 0;
|
||||
ResId x1c_ = -1;
|
||||
float x20_ = 0.f;
|
||||
float x24_ = 0.f;
|
||||
bool x28_ = false;
|
||||
|
||||
void SetSteam(float a, float b, float c, u32 d, bool e)
|
||||
{
|
||||
if (x1c_ == -1 || a > x10_)
|
||||
{
|
||||
x10_ = a;
|
||||
x14_ = b;
|
||||
x18_ = c;
|
||||
x1c_ = d;
|
||||
}
|
||||
x28_ = e;
|
||||
}
|
||||
public:
|
||||
CVisorSteam(float a, float b, float c, ResId tex) : x0_(a), x4_(b), x8_(c), xc_(tex){}
|
||||
ResId GetTextureId() const;
|
||||
void SetSteam(float a, float b, float c, ResId d, bool e);
|
||||
void Update(float dt);
|
||||
CVisorSteam(float a, float b, float c, u32 d, bool e)
|
||||
: x0_(a), x4_(b), x8_(c), xc_(d), x1c_(e) {}
|
||||
float GetAlpha() const;
|
||||
};
|
||||
zeus::CVector3f x1b4_;
|
||||
TUniqueId x1c4_ = kInvalidUniqueId;
|
||||
float x294_;
|
||||
float x29c_;
|
||||
u32 x2f8_morphTransState;
|
||||
u32 x304_;
|
||||
// std::vector<> x258_;
|
||||
TUniqueId x26c_ = kInvalidUniqueId;
|
||||
float x270_ = 0.f;
|
||||
CPlayerEnergyDrain x274_ = CPlayerEnergyDrain(4);
|
||||
float x288_ = 0.f;
|
||||
float x28c_ = 0.f;
|
||||
float x290_ = 0.f;
|
||||
float x294_ = 0.f;
|
||||
u32 x298_ = 0;
|
||||
float x29c_ = 0.f;
|
||||
float x2a0_ = 0.f;
|
||||
u8 x2a4_ = 0;
|
||||
float x2a8_ = 1000.f;
|
||||
u32 x2ac_ = 0;
|
||||
u32 x2b0_ = 2;
|
||||
u32 x2b4_ = 0;
|
||||
u32 x2d0_ = 3;
|
||||
float x2d4_ = 0.f;
|
||||
zeus::CAABox x2d8_;
|
||||
float x2f0_ = 0.f;
|
||||
u32 x2f4_cameraState = 0;
|
||||
u32 x2f8_morphTransState = 0;
|
||||
u32 x2fc_ = 0;
|
||||
float x300_ = 0.f;
|
||||
u32 x304_ = 0;
|
||||
u32 x308_ = 0;
|
||||
u32 x30c_ = 0;
|
||||
TUniqueId x310_grapplePointId = kInvalidUniqueId;
|
||||
zeus::CVector3f x318_;
|
||||
bool x374_;
|
||||
float x314_ = 0.f;
|
||||
float x318_ = 0.f;
|
||||
float x31c_ = 0.f;
|
||||
float x320_ = 0.f;
|
||||
float x324_ = 0.f;
|
||||
float x328_ = 0.f;
|
||||
float x32c_ = 0.f;
|
||||
u32 x330_ = 0;
|
||||
u32 x334_ = 1;
|
||||
u32 x338_ = 1;
|
||||
TUniqueId x33c_ = kInvalidUniqueId;
|
||||
float x340_ = 0.f;
|
||||
// std::vector<> x344_;
|
||||
// std::vector<> x354_;
|
||||
// std::vector<> x364_;
|
||||
bool x374_ = false;
|
||||
float x378_ = 0.f;
|
||||
u8 x37c_ = 0;
|
||||
float x380_ = 0.f;
|
||||
float x384_ = 0.f;
|
||||
float x388_ = 0.f;
|
||||
bool x38c_;
|
||||
u32 x390_ = 2;
|
||||
u8 x394_ = 0;
|
||||
float x398_ = 1.5f;
|
||||
u8 x39c_ = 0;
|
||||
float x3a0_ = 0.5f;
|
||||
float x3a4_ = 0.449f;
|
||||
u32 x3a8_ = 0;
|
||||
float x3ac_ = 0.f;
|
||||
float x3b0_ = 0.f;
|
||||
TUniqueId x3b4_ = kInvalidUniqueId;
|
||||
u32 x3b8_ = 0;
|
||||
float x3bc_ = 0.f;
|
||||
float x3c0_ = 1.0f;
|
||||
float x3c4_ = 0.f;
|
||||
float x3c8_ = 0.f;
|
||||
float x3cc_ = 0.f;
|
||||
float x3d0_ = 0.f;
|
||||
float x3d4_ = 0.f;
|
||||
float x3d8_ = 0.f;
|
||||
bool x3dc_ = 0;
|
||||
bool x3dd_ = 0;
|
||||
bool x3de_ = 0;
|
||||
float x3e4_;
|
||||
float x3e8_;
|
||||
float x3ec_;
|
||||
u32 x3d8_;
|
||||
bool x3dc_;
|
||||
float x3f0_ = 0.f;
|
||||
TUniqueId x3f4_ = kInvalidUniqueId;
|
||||
zeus::CVector3f x3f8_ = zeus::CVector3f::skZero;
|
||||
TReservedAverage<zeus::CVector3f, 20> x404_;
|
||||
zeus::CVector3f x480_ = zeus::CVector3f::skZero;
|
||||
float x48c_ = 0.f;
|
||||
std::unique_ptr<CPlayerGun> x490_gun;
|
||||
float x494_ = 1.f;
|
||||
float x49c_; /* Value retrieved from TweakPlayerGun */
|
||||
// std::unqiue_ptr<> x4a0_;
|
||||
u32 x4a4_ = 0;
|
||||
bool x558_;
|
||||
float x55c_;
|
||||
float x560_;
|
||||
zeus::CVector3f x564_;
|
||||
float x588_alpha;
|
||||
std::unique_ptr<CMorphBall> x768_morphball;
|
||||
std::unique_ptr<CPlayerCameraBob> x76c_cameraBob;
|
||||
CSfxHandle x770_;
|
||||
float x774_;
|
||||
u32 x778_;
|
||||
u32 x77c_;
|
||||
u32 x780_;
|
||||
float x784_;
|
||||
u16 x88_;
|
||||
u16 x88a_;
|
||||
float x78c_;
|
||||
u32 x790_;
|
||||
float x794_;
|
||||
float x798_;
|
||||
float x79c_;
|
||||
CVisorSteam x7a0_ = CVisorSteam(0.f, 0.f, 0.f, -1);
|
||||
float x9f4_;
|
||||
float xa04_;
|
||||
ResId xa08_steamTextureId;
|
||||
ResId xa0c_;
|
||||
public:
|
||||
CPlayer(TUniqueId, const zeus::CTransform&, const zeus::CAABox&, unsigned int,
|
||||
const zeus::CVector3f&, float, float, float, float, const CMaterialList&);
|
||||
|
@ -219,6 +306,7 @@ public:
|
|||
float GetWeight() const;
|
||||
float GetDampedClampedVelocityWR() const;
|
||||
|
||||
void Touch();
|
||||
const std::unique_ptr<CPlayerCameraBob>& GetCameraBob() const { return x76c_cameraBob; }
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#include "CPlayerEnergyDrain.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CPlayerEnergyDrain::CPlayerEnergyDrain(u32 capacity)
|
||||
{
|
||||
x0_sources.reserve(capacity);
|
||||
}
|
||||
|
||||
void CPlayerEnergyDrain::AddEnergyDrainSource(TUniqueId id, float intensity)
|
||||
{
|
||||
x0_sources.emplace_back(id, intensity);
|
||||
}
|
||||
|
||||
void CPlayerEnergyDrain::RemoveEnergyDrainSource(TUniqueId id)
|
||||
{
|
||||
auto it = std::lower_bound(x0_sources.begin(), x0_sources.end(), CEnergyDrainSource(id, 0.f));
|
||||
if (it != x0_sources.end())
|
||||
x0_sources.erase(it);
|
||||
}
|
||||
|
||||
float CPlayerEnergyDrain::GetEnergyDrainIntensity() const
|
||||
{
|
||||
float intensity = 0.f;
|
||||
|
||||
for (const CEnergyDrainSource& src : x0_sources)
|
||||
intensity += src.GetEnergyDrainIntensity();
|
||||
|
||||
return intensity;
|
||||
}
|
||||
|
||||
float CPlayerEnergyDrain::GetEnergyDrainTime() const
|
||||
{
|
||||
return x10_energyDrainTime;
|
||||
}
|
||||
|
||||
void CPlayerEnergyDrain::ProcessEnergyDrain(const CStateManager& mgr, float dt)
|
||||
{
|
||||
auto it = x0_sources.begin();
|
||||
|
||||
for (; it != x0_sources.end(); ++it)
|
||||
{
|
||||
if (mgr.GetObjectById((*it).GetEnergyDrainSourceId()) == nullptr)
|
||||
RemoveEnergyDrainSource((*it).GetEnergyDrainSourceId());
|
||||
}
|
||||
|
||||
if (x0_sources.empty())
|
||||
x10_energyDrainTime = 0.f;
|
||||
else
|
||||
x10_energyDrainTime += dt;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef __URDE_CPLAYERENERGYDRAIN_HPP__
|
||||
#define __URDE_CPLAYERENERGYDRAIN_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CEnergyDrainSource.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CStateManager;
|
||||
class CPlayerEnergyDrain
|
||||
{
|
||||
std::vector<CEnergyDrainSource> x0_sources;
|
||||
float x10_energyDrainTime;
|
||||
public:
|
||||
CPlayerEnergyDrain(u32);
|
||||
const std::vector<CEnergyDrainSource>& GetEnergyDrainSources() const;
|
||||
void AddEnergyDrainSource(TUniqueId, float);
|
||||
void RemoveEnergyDrainSource(TUniqueId id);
|
||||
float GetEnergyDrainIntensity() const;
|
||||
float GetEnergyDrainTime() const;
|
||||
void ProcessEnergyDrain(const CStateManager&, float);
|
||||
};
|
||||
}
|
||||
#endif // __URDE_CPLAYERENERGYDRAIN_HPP__
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef __URDE_CSCRIPTPLAYERACTOR_HPP__
|
||||
#define __URDE_CSCRIPTPLAYERACTOR_HPP__
|
||||
#include "CPhysicsActor.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CScriptPlayerActor : CPhysicsActor
|
||||
{
|
||||
public:
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __URDE_CSCRIPTPLAYERACTOR_HPP__
|
Loading…
Reference in New Issue