Reworked CGameArchitectureSupport initialization, initial CFirstPersonCamera imp

This commit is contained in:
Phillip Stephens 2016-09-15 00:26:35 -07:00
parent f5ac582541
commit c40135f97f
28 changed files with 2478 additions and 69 deletions

View File

@ -14,6 +14,8 @@ struct ITweakPlayer : BigYAML
virtual float GetPlayerSomething1() const=0; // x274
virtual float GetPlayerSomething2() const=0; // x278
virtual float GetPlayerSomething3() const=0; // x27c
virtual float GetPlayerSomething4() const=0; // x134
virtual bool GetPlayerSomething5() const=0; // x228_24
virtual float GetLeftLogicalThreshold() const=0;
virtual float GetRightLogicalThreshold() const=0;
};

View File

@ -24,7 +24,8 @@ make_dnalist(liblist
Tweaks/CTweakPlayerGun
Tweaks/CTweakGunRes
Tweaks/CTweakPlayerRes
Tweaks/CTweakGui)
Tweaks/CTweakGui
Tweaks/CTweakCameraBob)
add_library(DNAMP1
DNAMP1.hpp DNAMP1.cpp
@ -41,4 +42,5 @@ add_library(DNAMP1
MREA.cpp
SCLY.hpp SCLY.cpp
FRME.cpp
DeafBabe.cpp)
DeafBabe.cpp
Tweaks/CTweakPlayer.cpp)

View File

@ -26,6 +26,8 @@
#include "../DNACommon/Tweaks/TweakWriter.hpp"
#include "Tweaks/CTweakPlayerRes.hpp"
#include "Tweaks/CTweakGunRes.hpp"
#include "Tweaks/CTweakPlayer.hpp"
#include "Tweaks/CTweakCameraBob.hpp"
namespace DataSpec
{
@ -315,6 +317,10 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
return {ExtractTweak<CTweakPlayerRes>, nullptr, {_S(".yaml")}};
if (!name.compare("GunRes"))
return {ExtractTweak<CTweakGunRes>, nullptr, {_S(".yaml")}};
if (!name.compare("Player"))
return {ExtractTweak<CTweakPlayer>, nullptr, {_S(".yaml")}};
if (!name.compare("CameraBob"))
return {ExtractTweak<CTweakCameraBob>, nullptr, {_S(".yaml")}};
}
break;
}

View File

@ -0,0 +1,31 @@
#ifndef __URDE_CTWEAKCAMERABOB_HPP__
#define __URDE_CTWEAKCAMERABOB_HPP__
#include "../../DNACommon/DNACommon.hpp"
namespace DataSpec
{
namespace DNAMP1
{
struct CTweakCameraBob : BigYAML
{
DECL_YAML
Value<float> cameraBobExtentX;
Value<float> cameraBobExtentY;
Value<float> cameraBobPeriod;
Value<float> orbitScale;
Value<float> maxOrbitScale;
Value<float> slowSpeedPeriodScale;
Value<float> targetMagnitudeTrackingRate;
Value<float> landingBobSpringConstant;
Value<float> viewWanderRadius;
Value<float> viewWanderSpeedMin;
Value<float> viewWanderSpeedMax;
Value<float> viewWanderRollVariation;
Value<float> gunBobMagnitude;
Value<float> helmetBobMagnitude;
};
}
}
#endif // __URDE_CTWEAKCAMERABOB_HPP__

File diff suppressed because it is too large Load Diff

View File

@ -10,22 +10,196 @@ namespace DNAMP1
struct CTweakPlayer : ITweakPlayer
{
DECL_YAML
Value<float> m_playerHeight;
Value<float> m_playerXYHalfExtent;
Value<float> m_unk1;
Value<float> m_unk2;
Value<float> m_unk3;
Value<float> m_leftDiv;
Value<float> m_rightDiv;
float GetPlayerHeight() const { return m_playerHeight; }
float GetPlayerXYHalfExtent() const { return m_playerXYHalfExtent; }
float GetPlayerSomething1() const { return m_unk1; }
float GetPlayerSomething2() const { return m_unk2; }
float GetPlayerSomething3() const { return m_unk3; }
float GetLeftLogicalThreshold() const {return m_leftDiv;}
float GetRightLogicalThreshold() const {return m_rightDiv;}
CTweakPlayer(athena::io::IStreamReader& reader) {this->read(reader);}
Delete _d;
Value<float> x4_[8];
Value<float> x24_[8];
Value<float> x44_[8];
Value<float> x64_[8];
Value<float> x84_[8];
Value<float> xa4_[8];
Value<float> xc4_;
Value<float> xc8_;
Value<float> xcc_;
Value<float> xd0_;
Value<float> xd4_;
Value<float> xd8_;
Value<float> xdc_;
Value<float> xe0_;
Value<float> xe4_;
Value<float> xe8_;
Value<float> xec_;
Value<float> xf0_;
Value<float> xf4_;
Value<float> xf8_;
Value<float> xfc_;
Value<float> x100_;
Value<float> x104_;
Value<float> x108_;
Value<float> x10c_;
Value<float> x110_;
Value<float> x114_;
Value<float> x118_;
Value<float> x11c_;
Value<float> x120_;
Value<float> x124_;
Value<float> x128_;
Value<float> x12c_;
Value<float> x130_;
Value<float> x134_;
Value<float> x138_;
Value<float> x13c_;
Value<float> x140_;
Value<float> x144_;
Value<float> x148_;
Value<float> x14c_;
Value<float> x150_leftDiv;
Value<float> x154_rightDiv;
Value<float> x158_[3];
Value<float> x164_[3];
Value<float> x170_[3];
Value<float> x17c_;
Value<float> x180_;
Value<float> x184_;
Value<float> x188_;
Value<float> x18c_;
Value<float> x190_;
Value<float> x194_;
Value<float> x198_;
Value<float> x19c_;
Value<float> x1a0_;
Value<float> x1a4_;
Value<atUint32> x1a8_[2];
Value<atUint32> x1b0_[2];
Value<atUint32> x1b8_[2];
Value<atUint32> x1c0_[2];
Value<atUint32> x1c8_[2];
Value<atUint32> x1d0_[2];
Value<float> x1d8_;
Value<float> x1dc_;
Value<float> x1e0_;
Value<float> x1e4_;
Value<float> x1e8_;
Value<float> x1ec_;
Value<float> x1f0_;
Value<float> x1f4_;
Value<float> x1f8_;
Value<float> x1fc_;
Value<bool> x200_24_ : 1;
Value<bool> x200_25_ : 1;
Value<float> x204_;
Value<float> x208_;
Value<float> x20c_;
Value<float> x210_;
Value<float> x214_;
Value<float> x218_;
Value<bool> x21c_24_ : 1;
Value<bool> x21c_25_ : 1;
Value<bool> x21c_26_ : 1;
Value<float> x220_;
Value<float> x224_;
Value<bool> x228_24_ : 1;
Value<bool> x228_25_ : 1;
Value<bool> x228_26_ : 1;
Value<bool> x228_27_ : 1;
Value<bool> x228_28_ : 1;
Value<bool> x228_29_ : 1;
Value<bool> x228_30_ : 1;
Value<bool> x228_31_ : 1;
Value<bool> x229_24_ : 1;
Value<bool> x229_25_ : 1;
Value<bool> x229_26_ : 1;
Value<bool> x229_27_ : 1;
Value<bool> x229_28_ : 1;
Value<bool> x229_29_ : 1;
Value<bool> x229_30_ : 1;
Value<bool> x229_31_ : 1;
Value<bool> x22a_24_ : 1;
Value<bool> x22a_25_ : 1;
Value<bool> x22a_26_ : 1;
Value<bool> x22a_27_ : 1;
Value<bool> x22a_28_ : 1;
Value<float> x22c_;
Value<float> x230_;
Value<float> x234_;
Value<float> x238_;
Value<float> x23c_;
Value<float> x240_;
Value<float> x244_;
Value<float> x248_;
Value<float> x24c_;
Value<float> x250_;
Value<float> x254_;
Value<float> x258_;
Value<float> x25c_;
Value<float> x260_;
Value<float> x264_;
Value<float> x268_;
Value<float> x26c_playerHeight;
Value<float> x270_playerXYHalfExtent;
Value<float> x274_;
Value<float> x278_;
Value<float> x27c_;
Value<float> x280_;
Value<float> x284_;
Value<float> x288_;
Value<float> x28c_;
Value<float> x290_;
Value<float> x294_;
Value<float> x298_;
Value<float> x29c_;
Value<float> x2a0_;
Value<float> x2a4_;
Value<float> x2a8_;
Value<float> x2ac_;
Value<float> x2b0_;
Value<float> x2b4_;
Value<float> x2b8_;
Value<float> x2bc_;
Value<float> x2c0_;
Value<float> x2c4_;
Value<float> x2c8_;
Value<float> x2cc_;
Value<atUint32> x2d0_;
Value<bool> x2d4_;
Value<bool> x2d5_;
Value<float> x2d8_;
Value<float> x2dc_;
Value<float> x2e0_;
Value<float> x2e4_;
Value<float> x2e8_;
Value<float> x2ec_;
Value<float> x2f0_;
Value<bool> x2f4_;
Value<float> x2f8_;
Value<atUint32> x2fc_;
Value<float> x300_;
Value<float> x304_;
Value<float> x308_;
float GetPlayerHeight() const { return x26c_playerHeight; }
float GetPlayerXYHalfExtent() const { return x270_playerXYHalfExtent; }
float GetPlayerSomething1() const { return x274_; }
float GetPlayerSomething2() const { return x278_; }
float GetPlayerSomething3() const { return x27c_; }
float GetPlayerSomething4() const { return x134_; }
bool GetPlayerSomething5() const { return x228_24_; }
float GetLeftLogicalThreshold() const {return x150_leftDiv;}
float GetRightLogicalThreshold() const {return x154_rightDiv;}
CTweakPlayer() = default;
CTweakPlayer(athena::io::IStreamReader& reader)
{
read(reader);
FixupValues();
}
void read(athena::io::IStreamReader& __dna_reader);
void write(athena::io::IStreamWriter& __dna_writer) const;
void read(athena::io::YAMLDocReader& __dna_docin);
void write(athena::io::YAMLDocWriter& __dna_docout) const;
void FixupValues();
static const char* DNAType();
const char* DNATypeV() const { return DNAType(); }
size_t binarySize(size_t __isz) const;
};
}

View File

@ -22,6 +22,8 @@
#include "DNACommon/Tweaks/TweakWriter.hpp"
#include "DNAMP1/Tweaks/CTweakPlayerRes.hpp"
#include "DNAMP1/Tweaks/CTweakGunRes.hpp"
#include "DNAMP1/Tweaks/CTweakPlayer.hpp"
#include "DNAMP1/Tweaks/CTweakCameraBob.hpp"
#include "hecl/ClientProcess.hpp"
@ -354,6 +356,10 @@ struct SpecMP1 : SpecBase
return true;
else if (!strcmp(classType, DNAMP1::CTweakGunRes::DNAType()))
return true;
else if (!strcmp(classType, DNAMP1::CTweakPlayer::DNAType()))
return true;
else if (!strcmp(classType, DNAMP1::CTweakCameraBob::DNAType()))
return true;
else if (!strcmp(classType, DNAMP1::HINT::DNAType()))
return true;
return false;
@ -507,6 +513,18 @@ struct SpecMP1 : SpecBase
gunRes.read(reader);
WriteTweak(gunRes, out);
}
else if (!classStr.compare(DNAMP1::CTweakPlayer::DNAType()))
{
DNAMP1::CTweakPlayer player;
player.read(reader);
WriteTweak(player, out);
}
else if (!classStr.compare(DNAMP1::CTweakCameraBob::DNAType()))
{
DNAMP1::CTweakCameraBob cBob;
cBob.read(reader);
WriteTweak(cBob, out);
}
else if (!classStr.compare(DNAMP1::HINT::DNAType()))
{
DNAMP1::HINT::Cook(in, out);

View File

@ -131,7 +131,7 @@ makeProj:
m_factoryMP1.IndexMP1Resources(*m_proj);
m_mainMP1.emplace(m_factoryMP1, m_objStore, m_vm.m_mainBooFactory,
m_vm.m_mainCommandQueue, m_vm.m_renderTex, *m_vm.m_amuseAllocWrapper);
m_vm.m_mainCommandQueue, m_vm.m_renderTex);
m_vm.InitMP1(*m_mainMP1);
m_vm.BuildTestPART(m_objStore);

View File

@ -140,7 +140,9 @@ SObjectTag ProjectResourceFactoryMP1::TagFromPath(const hecl::ProjectPath& path,
return true;
}
else if (!strcmp(className, "DataSpec::DNAMP1::CTweakPlayerRes") ||
!strcmp(className, "DataSpec::DNAMP1::CTweakGunRes"))
!strcmp(className, "DataSpec::DNAMP1::CTweakGunRes") ||
!strcmp(className, "DataSpec::DNAMP1::CTweakPlayer") ||
!strcmp(className, "DataSpec::DNAMP1::CTweakCameraBob"))
{
resTag.type = SBIG('CTWK');
return true;

View File

@ -77,7 +77,7 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
void ViewManager::InitMP1(MP1::CMain& main)
{
main.Init(m_fileStoreManager, m_voiceEngine.get());
main.Init(m_fileStoreManager, m_voiceEngine.get(), *m_amuseAllocWrapper);
}
void ViewManager::ParticleView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)

View File

@ -1,6 +1,9 @@
#include "CPlayerState.hpp"
#include "IOStreams.hpp"
#include "zeus/Math.hpp"
#include "CStateManager.hpp"
#include "Camera/CCameraManager.hpp"
#include "Camera/CFirstPersonCamera.hpp"
namespace urde
{
@ -201,13 +204,8 @@ bool CPlayerState::CanVisorSeeFog(const CStateManager& stateMgr) const
CPlayerState::EPlayerVisor CPlayerState::GetActiveVisor(const CStateManager& stateMgr) const
{
/* TODO: We need CGameCamera, and gang in order to enable this */
#if 0
CFirstPersionCamera* cam = dynamic_cast<CFirstPersonCamera*>(stateMgr.GetCameraManager()->GetCurrentCamera(stateMgr));
if (!cam)
return EVisorType::Combat;
#endif
return x14_currentVisor;
const CFirstPersonCamera* cam = static_cast<const CFirstPersonCamera*>(stateMgr.GetCameraManager()->GetCurrentCamera(stateMgr));
return (cam ? x14_currentVisor : EPlayerVisor::Combat);
}
void CPlayerState::UpdateStaticInterference(CStateManager& stateMgr, const float& dt)

View File

@ -1,5 +1,7 @@
#include "CStateManager.hpp"
#include "Camera/CCameraShakeData.hpp"
#include "Camera/CGameCamera.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "CSortedLists.hpp"
#include "CWeaponMgr.hpp"
#include "CFluidPlaneManager.hpp"
@ -301,8 +303,14 @@ void CStateManager::TouchSky() const
{
}
void CStateManager::DrawSpaceWarp(const zeus::CVector3f&, float) const
void CStateManager::DrawSpaceWarp(const zeus::CVector3f& v, float strength) const
{
CPlayerState::EPlayerVisor visor = x8b8_playerState->GetActiveVisor(*this);
if (visor == CPlayerState::EPlayerVisor::Scan || visor == CPlayerState::EPlayerVisor::Combat)
{
zeus::CVector3f screenV = x870_cameraManager->GetCurrentCamera(*this)->ConvertToScreenSpace(v);
g_Renderer->DrawSpaceWarp(screenV, strength);
}
}
void CStateManager::DrawReflection(const zeus::CVector3f&)

View File

@ -283,7 +283,7 @@ public:
CWorld* GetWorld() {return x850_world.get();}
CRelayTracker* GetRelayTracker() { return x8bc_relayTracker.get(); }
CCameraManager* GetCameraManager() { return x870_cameraManager; }
CCameraManager* GetCameraManager() const { return x870_cameraManager; }
std::shared_ptr<CMapWorldInfo> MapWorldInfo() { return x8c0_mapWorldInfo; }

View File

@ -1,11 +1,15 @@
#include "CFirstPersonCamera.hpp"
#include "GameGlobalObjects.hpp"
#include "Character/CCharLayoutInfo.hpp"
#include "CStateManager.hpp"
#include "World/CPlayer.hpp"
#include <math.h>
namespace urde
{
CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf, TUniqueId watchedObj,
float, float fov, float nearz, float farz, float aspect)
float f1, float fov, float nearz, float farz, float aspect)
: CGameCamera(uid, true, "First Person Camera",
CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList),
xf, fov, nearz, farz, aspect, watchedObj, false, 0)
@ -20,4 +24,51 @@ void CFirstPersonCamera::Reset(const zeus::CTransform&, CStateManager& mgr)
{
}
void CFirstPersonCamera::sub800E318()
{
x1c8_ = zeus::CVector3f::skZero;
x1d4_ = 0.f;
}
zeus::CTransform CFirstPersonCamera::GetGunFollowTransform()
{
return x190_gunFollowXf;
}
void CFirstPersonCamera::UpdateTransform(CStateManager& mgr)
{
CPlayer* player = static_cast<CPlayer*>(mgr.ObjectById(GetWatchedObject()));
if (!player)
{
x34_transform = zeus::CTransform::Identity();
xe4_27_ = true;
xe4_28_ = true;
xe4_29_ = true;
return;
}
zeus::CTransform playerXf = player->GetTransform();
float rZ = std::sin(x1c0_);
if (std::fabs(rZ) > 1.0f)
rZ = (rZ > -0.f ? -1.0f : 1.0f);
float rY = std::cos(x1c0_);
if (std::fabs(rY) > 1.0f)
rY = (rY > -0.f ? -1.0f : 1.0f);
zeus::CVector3f rVec = playerXf.rotate({0.f, rY, rZ});
#if 1
if (player->x3dc_)
{
float f32 = g_tweakPlayer->GetPlayerSomething4();
}
#endif
}
void CFirstPersonCamera::UpdateElevation(CStateManager&)
{
}
}

View File

@ -8,11 +8,34 @@ namespace urde
class CFirstPersonCamera : public CGameCamera
{
float x188_;
u8 x18c_;
zeus::CTransform x190_gunFollowXf;
float x1c0_;
TUniqueId x1c4_;
union
{
struct
{
bool x1c6_24_ : 1;
};
u16 _dummy = 0;
};
zeus::CVector3f x1c8_;
float x1d4_ = 0.f;
public:
CFirstPersonCamera(TUniqueId, const zeus::CTransform& xf, TUniqueId, float, float, float, float, float);
void PreThink(float, CStateManager &);
void Think(float, CStateManager &);
void ProcessInput(const CFinalInput&, CStateManager& mgr);
void Reset(const zeus::CTransform&, CStateManager& mgr);
void sub800E318();
zeus::CTransform GetGunFollowTransform();
void UpdateTransform(CStateManager&);
void UpdateElevation(CStateManager&);
};
}

View File

@ -110,5 +110,59 @@ TUniqueId CGameCamera::GetWatchedObject() const { return xe8_watchedObject; }
float CGameCamera::GetFov() const { return x15c_fov; }
void CGameCamera::SetFov(float fov) { x15c_fov = fov; }
void CGameCamera::sub8005AE3C(float f1)
{
if (x174_ > 0.f)
{
x174_ -= f1;
return;
}
if (x178_ <= 0.f)
return;
x178_ -= f1;
if (x178_ > 0.f)
{
x15c_fov = x184_;
x170_24_perspDirty = true;
}
else
{
x15c_fov = zeus::clamp(0.f, (f1 / x17c_), 1.f) + ((x180_ - x184_) * x184_);
x170_24_perspDirty = true;
}
}
void CGameCamera::sub8005AF18(float f1, float f2, float f3, float f4)
{
if (f3 < 0.f)
{
x15c_fov = f2;
x170_24_perspDirty = true;
x184_ = f2;
x184_ = x174_ = 0.f;
}
else
{
x174_ = std::max(0.f, f4);
x17c_ = f3;
x178_ = f3;
x180_ = f1;
x184_ = f2;
x15c_fov = f1;
x170_24_perspDirty = true;
}
}
void CGameCamera::sub8005AF88()
{
if (x178_ > 0)
{
x15c_fov = x184_;
x170_24_perspDirty = true;
}
x178_ = x174_ = 0.f;
}
}

View File

@ -49,10 +49,11 @@ public:
float GetAspectRatio() const;
TUniqueId GetWatchedObject() const;
float GetFov() const;
void SetFov(float);
void GetControllerNumber() const;
bool DisablesInput() const;
void sub8005AE3C(float);
void sub8005AF18(float, float, float, float);
void sub8005AF88();
};
}

View File

@ -5,6 +5,7 @@ namespace urde
namespace MP1
{
class CMain* g_Main = nullptr;
class CGameArchitectureSupport* g_archSupport = nullptr;
}
class CMemoryCardSys* g_MemoryCardSys = nullptr;

View File

@ -15,6 +15,7 @@ namespace urde
namespace MP1
{
extern class CMain* g_Main;
extern class CGameArchitectureSupport* g_archSupport;
}
extern class CMemoryCardSys* g_MemoryCardSys;

View File

@ -23,7 +23,7 @@ CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type, bo
CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type,
TLockedToken<CTexture> tex)
: CTexturedQuadFilter(type, tex->GetBooTexture())
: CTexturedQuadFilter(type, (tex ? tex->GetBooTexture() : nullptr))
{
m_tex = tex;
}
@ -93,7 +93,7 @@ CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(CCameraFilterPass::EFilterTyp
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(CCameraFilterPass::EFilterType type,
TLockedToken<CTexture> tex)
: CTexturedQuadFilterAlpha(type, tex->GetBooTexture())
: CTexturedQuadFilterAlpha(type, (tex ? tex->GetBooTexture() : nullptr))
{
m_tex = tex;
}

View File

@ -10,8 +10,24 @@ namespace urde
namespace MP1
{
CMFGameLoader::CMFGameLoader()
: CMFGameLoaderBase("CMFGameLoader")
CMFGame::CMFGame(const std::weak_ptr<CStateManager>& stateMgr, const std::weak_ptr<CInGameGuiManager>& guiMgr,
const CArchitectureQueue&)
: CMFGameBase("CMFGame"), x14_stateManager(stateMgr.lock()), x18_guiManager(guiMgr.lock()), x2a_25_(true)
{
//g_Main->x160_25_ = true;
}
CIOWin::EMessageReturn CMFGame::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
{
return EMessageReturn::Normal;
}
void CMFGame::Draw() const
{
}
CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader")
{
switch (g_Main->GetFlowState())
{
@ -19,8 +35,8 @@ CMFGameLoader::CMFGameLoader()
case CMain::FlowState::Six:
{
ResId mlvlId = g_GameState->CurrentWorldAssetId();
//g_GameState->WorldTransitionManager()->
//g_MemoryCardSys->
// g_GameState->WorldTransitionManager()->
// g_MemoryCardSys->
}
default:
{
@ -38,15 +54,12 @@ CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg,
{
const CArchMsgParmReal32& tick = MakeMsg::GetParmTimerTick(msg);
}
default: break;
default:
break;
}
return EMessageReturn::Exit;
}
void CMFGameLoader::Draw() const
{
g_GameState->GetWorldTransitionManager()->Draw();
}
void CMFGameLoader::Draw() const { g_GameState->GetWorldTransitionManager()->Draw(); }
}
}

View File

@ -14,8 +14,23 @@ namespace MP1
class CMFGame : public CMFGameBase
{
std::shared_ptr<CStateManager> x14_stateManager;
std::shared_ptr<CInGameGuiManager> x18_guiManager;
u32 x1c_ = 0;
u32 x24_ = 0;
TUniqueId x28_ = kInvalidUniqueId;
union
{
struct
{
bool x2a_24_ : 1;
bool x2a_25_ : 1;
};
u8 _dummy = 0;
};
public:
CMFGame() : CMFGameBase("CMFGame") {}
CMFGame(const std::weak_ptr<CStateManager>& stateMgr, const std::weak_ptr<CInGameGuiManager>& guiMgr,
const CArchitectureQueue&);
CIOWin::EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
void Draw() const;
};

View File

@ -10,6 +10,7 @@
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp"
#include "World/CPlayerCameraBob.hpp"
namespace urde
{
@ -29,22 +30,27 @@ static const SObjectTag& IDFromFactory(CResFactory& factory, const char* name)
void CTweaks::RegisterTweaks()
{
ProjectResourceFactoryMP1& factory = ProjectManager::g_SharedManager->resourceFactoryMP1();
std::experimental::optional<CMemoryInStream> strm;
#if 0
CResFactory& factory = *g_ResFactory;
CResLoader& loader = factory.GetLoader();
std::unique_ptr<CInputStream> strm;
strm.reset(loader.LoadNewResourceSync(IDFromFactory(factory, "Game"), nullptr));
TOneStatic<DataSpec::DNAMP1::CTweakGame> game(*strm);
g_tweakGame = game.GetAllocSpace();
strm.reset(loader.LoadNewResourceSync(IDFromFactory(factory, "Player"), nullptr));
TOneStatic<DataSpec::DNAMP1::CTweakPlayer> player(*strm);
g_tweakPlayer = player.GetAllocSpace();
#endif
SObjectTag tag = factory.ProjectResourceFactoryBase::TagFromPath(_S("MP1/Tweaks/Player.yaml"));
strm.emplace(factory.LoadResourceSync(tag).release(), factory.ResourceSize(tag));
g_tweakPlayer = new DataSpec::DNAMP1::CTweakPlayer(*strm);
tag = factory.ProjectResourceFactoryBase::TagFromPath(_S("MP1/Tweaks/CameraBob.yaml"));
strm.emplace(factory.LoadResourceSync(tag).release(), factory.ResourceSize(tag));
CPlayerCameraBob::ReadTweaks(*strm);
#if 0
strm.reset(loader.LoadNewResourceSync(IDFromFactory(factory, "PlayerControls"), nullptr));
TOneStatic<DataSpec::DNAMP1::CTweakPlayerControl> playerControl(*strm);
g_tweakPlayerControl = playerControl.GetAllocSpace();
#endif
}
void CTweaks::RegisterResourceTweaks()

View File

@ -25,8 +25,8 @@ namespace MP1
CGameArchitectureSupport::CGameArchitectureSupport(amuse::IBackendVoiceAllocator& backend)
: m_audioSys(backend, 0,0,0,0,0),
m_inputGenerator(0.0f /*g_tweakPlayer->GetLeftLogicalThreshold()*/,
0.0f /*g_tweakPlayer->GetRightLogicalThreshold()*/),
m_inputGenerator(g_tweakPlayer->GetLeftLogicalThreshold(),
g_tweakPlayer->GetRightLogicalThreshold()),
m_guiSys(*g_ResFactory, *g_SimplePool, CGuiSys::EUsageMode::Zero)
{
g_GuiSys = &m_guiSys;
@ -90,11 +90,9 @@ void CGameArchitectureSupport::Draw()
CMain::CMain(IFactory& resFactory, CSimplePool& resStore,
boo::IGraphicsDataFactory* gfxFactory,
boo::IGraphicsCommandQueue* cmdQ,
boo::ITextureR* spareTex,
amuse::IBackendVoiceAllocator& backend)
boo::ITextureR* spareTex)
: m_booSetter(gfxFactory, cmdQ, spareTex),
x128_globalObjects(resFactory, resStore),
m_archSupport(backend)
x128_globalObjects(resFactory, resStore)
{
xe4_gameplayResult = EGameplayResult::Playing;
g_Main = this;
@ -141,25 +139,28 @@ void CMain::LoadAudio()
}
void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr,
boo::IAudioVoiceEngine* voiceEngine)
boo::IAudioVoiceEngine* voiceEngine,
amuse::IBackendVoiceAllocator& backend)
{
InitializeSubsystems(storeMgr, voiceEngine);
x128_globalObjects.PostInitialize();
x70_tweaks.RegisterTweaks();
x70_tweaks.RegisterResourceTweaks();
m_archSupport.reset(new CGameArchitectureSupport(backend));
g_archSupport = m_archSupport.get();
//g_TweakManager->ReadFromMemoryCard("AudioTweaks");
FillInAssetIDs();
}
bool CMain::Proc()
{
xe8_b24_finished = m_archSupport.Update();
xe8_b24_finished = m_archSupport->Update();
return xe8_b24_finished;
}
void CMain::Draw()
{
m_archSupport.Draw();
m_archSupport->Draw();
}
void CMain::Shutdown()

View File

@ -146,6 +146,7 @@ class CGameArchitectureSupport
public:
CGameArchitectureSupport(amuse::IBackendVoiceAllocator& backend);
void PreloadAudio();
bool Update();
void Draw();
@ -203,7 +204,7 @@ private:
/* urde addition: these are simply initialized along with everything else */
CGameGlobalObjects x128_globalObjects;
CGameArchitectureSupport m_archSupport;
std::unique_ptr<CGameArchitectureSupport> m_archSupport;
FlowState x12c_ = FlowState::Five;
@ -235,8 +236,7 @@ public:
CMain(IFactory& resFactory, CSimplePool& resStore,
boo::IGraphicsDataFactory* gfxFactory,
boo::IGraphicsCommandQueue* cmdQ,
boo::ITextureR* spareTex,
amuse::IBackendVoiceAllocator& backend);
boo::ITextureR* spareTex);
void RegisterResourceTweaks();
void ResetGameState();
void StreamNewGameState(CInputStream&);
@ -244,7 +244,8 @@ public:
//int RsMain(int argc, const boo::SystemChar* argv[]);
void Init(const hecl::Runtime::FileStoreManager& storeMgr,
boo::IAudioVoiceEngine* voiceEngine);
boo::IAudioVoiceEngine* voiceEngine,
amuse::IBackendVoiceAllocator& backend);
bool Proc();
void Draw();
void Shutdown();

View File

@ -15,11 +15,13 @@ class CDamageInfo;
class CScriptWater;
class IVisitor;
class CFinalInput;
class CPlayerCameraBob;
class CFirstPersonCamera;
class CPlayer : public CPhysicsActor
{
friend class CStateManager;
friend class CFirstPersonCamera;
public:
enum class EPlayerScanState
{
@ -72,9 +74,10 @@ private:
: x0_(a), x4_(b), x8_(c), xc_(d), x1c_(e) {}
};
bool x3dc_;
std::unique_ptr<CPlayerGun> x490_gun;
std::unique_ptr<CMorphBall> x768_morphball;
std::unique_ptr<CPlayerCameraBob> x76c_cameraBob;
public:
CPlayer(TUniqueId, const zeus::CTransform&, const zeus::CAABox&, unsigned int,
const zeus::CVector3f&, float, float, float, float, const CMaterialList&);

View File

@ -2,9 +2,45 @@
namespace urde
{
float CPlayerCameraBob::kCameraBobExtentX = 0.071f;
float CPlayerCameraBob::kCameraBobExtentY = 0.142f;
float CPlayerCameraBob::kCameraBobPeriod = 0.47f;
float CPlayerCameraBob::kOrbitBobScale = 0.769f;
float CPlayerCameraBob::kMaxOrbitBobScale = 0.8f;
float CPlayerCameraBob::kSlowSpeedPeriodScale = 0.3f;
float CPlayerCameraBob::kTargetMagnitudeTrackingRate = 0.1f;
float CPlayerCameraBob::kLandingBobSpringConstant = 150.f;
float CPlayerCameraBob::kViewWanderRadius = 2.9f;
float CPlayerCameraBob::kViewWanderSpeedMin = 0.1f;
float CPlayerCameraBob::kViewWanderSpeedMax = 0.3f;
float CPlayerCameraBob::kViewWanderRollVariation = 0.3f;
float CPlayerCameraBob::kGunBobMagnitude = 0.3f;
float CPlayerCameraBob::kHelmetBobMagnitude = 2.f;
CPlayerCameraBob::CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float)
CPlayerCameraBob::CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float f1)
: x0_type(type), x4_vec(vec), xc_(f1)
{
}
void CPlayerCameraBob::ReadTweaks(CInputStream& in)
{
if (in.hasError())
return;
kCameraBobExtentX = in.readFloatBig();
kCameraBobExtentY = in.readFloatBig();
kCameraBobPeriod = in.readFloatBig();
kOrbitBobScale = in.readFloatBig();
kMaxOrbitBobScale = in.readFloatBig();
kSlowSpeedPeriodScale = in.readFloatBig();
kTargetMagnitudeTrackingRate = in.readFloatBig();
kLandingBobSpringConstant = in.readFloatBig();
kViewWanderRadius = in.readFloatBig();
kViewWanderSpeedMin = in.readFloatBig();
kViewWanderSpeedMax = in.readFloatBig();
kViewWanderRollVariation = in.readFloatBig();
kGunBobMagnitude = in.readFloatBig();
kHelmetBobMagnitude = in.readFloatBig();
}
}

View File

@ -18,6 +18,21 @@ public:
One
};
private:
static float kCameraBobExtentX;
static float kCameraBobExtentY;
static float kCameraBobPeriod;
static float kOrbitBobScale;
static float kMaxOrbitBobScale;
static float kSlowSpeedPeriodScale;
static float kTargetMagnitudeTrackingRate;
static float kLandingBobSpringConstant;
static float kViewWanderRadius;
static float kViewWanderSpeedMin;
static float kViewWanderSpeedMax;
static float kViewWanderRollVariation;
static float kGunBobMagnitude;
static float kHelmetBobMagnitude;
ECameraBobType x0_type;
zeus::CVector2f x4_vec;
float xc_;
@ -48,6 +63,8 @@ private:
float x104_ = 0.f;
public:
CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float);
static void ReadTweaks(CInputStream& in);
};
}