Initial InGameGuiManager imps

This commit is contained in:
Jack Andersen 2017-02-11 17:17:18 -10:00
parent def32a1cca
commit a7cab596e6
57 changed files with 1133 additions and 221 deletions

View File

@ -8,6 +8,7 @@ namespace DataSpec
struct ITweakAutoMapper : public ITweak struct ITweakAutoMapper : public ITweak
{ {
virtual const zeus::CVector3f& GetDoorCenter() const=0; virtual const zeus::CVector3f& GetDoorCenter() const=0;
virtual float GetCamVerticalOffset() const=0;
}; };
} }

View File

@ -9,10 +9,33 @@ namespace DataSpec
struct ITweakGui : ITweak struct ITweakGui : ITweak
{ {
enum class EHudVisMode : atUint32
{
Zero,
One,
Two,
Three
};
enum class EHelmetVisMode : atUint32
{
Zero,
One,
Two,
Three,
Four
};
virtual EHudVisMode GetHudVisMode() const=0;
virtual EHelmetVisMode GetHelmetVisMode() const=0;
virtual atUint32 GetEnableAutoMapper() const=0;
virtual atUint32 GetEnableTargetingManager() const=0;
virtual atUint32 GetEnablePlayerVisor() const=0;
virtual float GetScanAppearanceOffset() const=0; virtual float GetScanAppearanceOffset() const=0;
virtual float GetScanSpeed(int idx) const=0; virtual float GetScanSpeed(int idx) const=0;
virtual float GetXrayBlurScaleLinear() const=0; virtual float GetXrayBlurScaleLinear() const=0;
virtual float GetXrayBlurScaleQuadratic() const=0; virtual float GetXrayBlurScaleQuadratic() const=0;
virtual float GetWorldTransManagerCharsPerSfx() const=0;
}; };
} }

View File

@ -3,6 +3,7 @@
#include "ITweak.hpp" #include "ITweak.hpp"
#include "Runtime/IFactory.hpp" #include "Runtime/IFactory.hpp"
#include "Runtime/CPlayerState.hpp"
namespace DataSpec namespace DataSpec
{ {
@ -10,14 +11,7 @@ namespace DataSpec
struct ITweakPlayerRes : ITweak struct ITweakPlayerRes : ITweak
{ {
using ResId = int64_t; using ResId = int64_t;
enum class EBeamId using EBeamId = urde::CPlayerState::EBeamId;
{
Power,
Ice,
Plasma,
Wave,
Phazon
};
ResId x4_saveStationIcon; ResId x4_saveStationIcon;
ResId x8_missileStationIcon; ResId x8_missileStationIcon;
@ -132,7 +126,7 @@ struct ITweakPlayerRes : ITweak
xc4_ballTransitionsANCS = factory.GetResourceIdByName(GetBallTransitionsANCS().c_str())->id; xc4_ballTransitionsANCS = factory.GetResourceIdByName(GetBallTransitionsANCS().c_str())->id;
for (int i=0 ; i<5 ; ++i) for (int i=0 ; i<5 ; ++i)
xc8_ballTransitions[i] = factory.GetResourceIdByName(GetBallTransitionModel(i).c_str())->id; xc8_ballTransitions[i] = factory.GetResourceIdByName(GetBallTransitionBeamRes(i).c_str())->id;
for (int i=0 ; i<5 ; ++i) for (int i=0 ; i<5 ; ++i)
xc8_cineGun[i] = factory.GetResourceIdByName(GetBeamCineModel(i).c_str())->id; xc8_cineGun[i] = factory.GetResourceIdByName(GetBeamCineModel(i).c_str())->id;
@ -163,7 +157,7 @@ protected:
virtual const std::string& GetBallTransitionsANCS() const=0; virtual const std::string& GetBallTransitionsANCS() const=0;
virtual const std::string& GetBallTransitionModel(size_t idx) const=0; virtual const std::string& GetBallTransitionBeamRes(size_t idx) const=0;
virtual const std::string& GetBeamCineModel(size_t idx) const=0; virtual const std::string& GetBeamCineModel(size_t idx) const=0;
virtual float GetUnkFloat() const=0; virtual float GetUnkFloat() const=0;

View File

@ -70,7 +70,7 @@ struct CTweakAutoMapper : public ITweakAutoMapper
Value<float> xe0_; Value<float> xe0_;
Value<float> xe4_; Value<float> xe4_;
Value<float> xe8_; Value<float> xe8_;
Value<float> xec_; Value<float> xec_camVerticalOffset;
DNAColor xf0_; DNAColor xf0_;
DNAColor xf4_; DNAColor xf4_;
DNAColor xf8_; DNAColor xf8_;
@ -83,6 +83,7 @@ struct CTweakAutoMapper : public ITweakAutoMapper
CTweakAutoMapper() = default; CTweakAutoMapper() = default;
CTweakAutoMapper(athena::io::IStreamReader& r) { this->read(r); } CTweakAutoMapper(athena::io::IStreamReader& r) { this->read(r); }
const zeus::CVector3f& GetDoorCenter() const { return xa4_doorCenter; } const zeus::CVector3f& GetDoorCenter() const { return xa4_doorCenter; }
float GetCamVerticalOffset() const { return xec_camVerticalOffset; }
}; };
} }
} }

View File

@ -67,12 +67,12 @@ struct CTweakGui : ITweakGui
Value<float> xec_; Value<float> xec_;
Value<float> xf0_; Value<float> xf0_;
Value<float> xf4_; Value<float> xf4_;
Value<atUint32> xf8_; Value<EHudVisMode> xf8_hudVisMode;
Value<atUint32> xfc_; Value<EHelmetVisMode> xfc_helmetVisMode;
Value<atUint32> x100_; Value<atUint32> x100_enableAutoMapper;
Value<atUint32> x104_; Value<atUint32> x104_;
Value<atUint32> x108_; Value<atUint32> x108_enableTargetingManager;
Value<atUint32> x10c_; Value<atUint32> x10c_enablePlayerVisor;
Value<float> x110_; Value<float> x110_;
Value<float> x114_; Value<float> x114_;
Value<float> x118_; Value<float> x118_;
@ -150,7 +150,7 @@ struct CTweakGui : ITweakGui
Value<float> x270_; Value<float> x270_;
Value<bool> x274_; Value<bool> x274_;
bool x275_ = true; bool x275_ = true;
Value<float> x278_; Value<float> x278_wtMgrCharsPerSfx;
Value<atUint32> x27c_; Value<atUint32> x27c_;
Value<float> x280_; Value<float> x280_;
Value<float> x284_; Value<float> x284_;
@ -195,9 +195,15 @@ struct CTweakGui : ITweakGui
CTweakGui() = default; CTweakGui() = default;
CTweakGui(athena::io::IStreamReader& r) { this->read(r); } CTweakGui(athena::io::IStreamReader& r) { this->read(r); }
EHudVisMode GetHudVisMode() const { return xf8_hudVisMode; }
EHelmetVisMode GetHelmetVisMode() const { return xfc_helmetVisMode; }
atUint32 GetEnableAutoMapper() const { return x100_enableAutoMapper; }
atUint32 GetEnableTargetingManager() const { return x108_enableTargetingManager; }
atUint32 GetEnablePlayerVisor() const { return x10c_enablePlayerVisor; }
float GetScanAppearanceOffset() const { return x244_scanAppearanceOffset; } float GetScanAppearanceOffset() const { return x244_scanAppearanceOffset; }
float GetXrayBlurScaleLinear() const { return x204_xrayBlurScaleLinear; } float GetXrayBlurScaleLinear() const { return x204_xrayBlurScaleLinear; }
float GetXrayBlurScaleQuadratic() const { return x208_xrayBlurScaleQuadratic; } float GetXrayBlurScaleQuadratic() const { return x208_xrayBlurScaleQuadratic; }
float GetWorldTransManagerCharsPerSfx() const { return x278_wtMgrCharsPerSfx; }
float GetScanSpeed(int idx) const float GetScanSpeed(int idx) const
{ {

View File

@ -94,7 +94,7 @@ struct CTweakPlayerRes : ITweakPlayerRes
const std::string& GetBallTransitionsANCS() const { return m_ballTransitionsANCS; } const std::string& GetBallTransitionsANCS() const { return m_ballTransitionsANCS; }
const std::string& GetBallTransitionModel(size_t idx) const { return (&m_ballTransitionsPower)[idx]; } const std::string& GetBallTransitionBeamRes(size_t idx) const { return (&m_ballTransitionsPower)[idx]; }
const std::string& GetBeamCineModel(size_t idx) const { return (&m_cinePower)[idx]; } const std::string& GetBeamCineModel(size_t idx) const { return (&m_cinePower)[idx]; }
float GetUnkFloat() const { return m_unkFloat; } float GetUnkFloat() const { return m_unkFloat; }

View File

@ -53,10 +53,18 @@ struct OriginalIDs
{ {
static void Generate(PAKRouter<DNAMP1::PAKBridge>& pakRouter, hecl::Database::Project& project) static void Generate(PAKRouter<DNAMP1::PAKBridge>& pakRouter, hecl::Database::Project& project)
{ {
std::unordered_set<UniqueID32> addedIDs;
std::vector<UniqueID32> originalIDs; std::vector<UniqueID32> originalIDs;
pakRouter.enumerateResources([&](const DNAMP1::PAK::Entry* ent) -> bool { pakRouter.enumerateResources([&](const DNAMP1::PAK::Entry* ent) -> bool {
if (ent->type == FOURCC('MLVL') || ent->type == FOURCC('SCAN')) if (ent->type == FOURCC('MLVL') || ent->type == FOURCC('SCAN') ||
ent->id.toUint32() == 0xB7BBD0B4 || ent->id.toUint32() == 0x1F9DA858)
{
if (addedIDs.find(ent->id) == addedIDs.cend())
{
addedIDs.insert(ent->id);
originalIDs.push_back(ent->id); originalIDs.push_back(ent->id);
}
}
return true; return true;
}); });
std::sort(originalIDs.begin(), originalIDs.end()); std::sort(originalIDs.begin(), originalIDs.end());

View File

@ -3,4 +3,14 @@
namespace urde namespace urde
{ {
CAutoMapper::CAutoMapper(CStateManager& stateMgr)
{
}
bool CAutoMapper::CheckLoadComplete()
{
return false;
}
} }

View File

@ -6,6 +6,7 @@
#include "zeus/CQuaternion.hpp" #include "zeus/CQuaternion.hpp"
#include "zeus/CTransform.hpp" #include "zeus/CTransform.hpp"
#include "zeus/CVector3f.hpp" #include "zeus/CVector3f.hpp"
#include "MP1/CInGameGuiManager.hpp"
namespace urde namespace urde
{ {
@ -13,10 +14,10 @@ class CFinalInput;
class IWorld; class IWorld;
class CMapWorldInfo; class CMapWorldInfo;
class CStateManager; class CStateManager;
enum class EInGameGuiState;
class CAutoMapper class CAutoMapper
{ {
public: public:
using EInGameGuiState = MP1::EInGameGuiState;
enum class EAutoMapperState enum class EAutoMapperState
{ {
}; };

View File

@ -11,7 +11,7 @@ class CDependencyGroup
public: public:
CDependencyGroup(CInputStream& in); CDependencyGroup(CInputStream& in);
void ReadFromStream(CInputStream& in); void ReadFromStream(CInputStream& in);
std::vector<SObjectTag> GetObjectTagVector() const { return x0_objectTags; } const std::vector<SObjectTag>& GetObjectTagVector() const { return x0_objectTags; }
}; };
CFactoryFnReturn FDependencyGroupFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param, CFactoryFnReturn FDependencyGroupFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param,

View File

@ -79,7 +79,7 @@ CWorldState::CWorldState(ResId id)
{ {
x8_relayTracker = std::make_shared<CRelayTracker>(); x8_relayTracker = std::make_shared<CRelayTracker>();
xc_mapWorldInfo = std::make_shared<CMapWorldInfo>(); xc_mapWorldInfo = std::make_shared<CMapWorldInfo>();
x10_ = -1; x10_desiredAreaAssetId = -1;
x14_layerState = std::make_shared<CWorldLayerState>(); x14_layerState = std::make_shared<CWorldLayerState>();
} }
@ -87,7 +87,7 @@ CWorldState::CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorl
: x0_mlvlId(mlvlId) : x0_mlvlId(mlvlId)
{ {
x4_areaId = reader.ReadEncoded(32); x4_areaId = reader.ReadEncoded(32);
x10_ = reader.ReadEncoded(32); x10_desiredAreaAssetId = reader.ReadEncoded(32);
x8_relayTracker = std::make_shared<CRelayTracker>(reader, saveWorld); x8_relayTracker = std::make_shared<CRelayTracker>(reader, saveWorld);
xc_mapWorldInfo = std::make_shared<CMapWorldInfo>(reader, saveWorld, mlvlId); xc_mapWorldInfo = std::make_shared<CMapWorldInfo>(reader, saveWorld, mlvlId);
x14_layerState = std::make_shared<CWorldLayerState>(reader, saveWorld); x14_layerState = std::make_shared<CWorldLayerState>(reader, saveWorld);
@ -96,7 +96,7 @@ CWorldState::CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorl
void CWorldState::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw) const void CWorldState::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw) const
{ {
writer.WriteEncoded(x4_areaId, 32); writer.WriteEncoded(x4_areaId, 32);
writer.WriteEncoded(x10_, 32); writer.WriteEncoded(x10_desiredAreaAssetId, 32);
x8_relayTracker->PutTo(writer, savw); x8_relayTracker->PutTo(writer, savw);
xc_mapWorldInfo->PutTo(writer, savw, x0_mlvlId); xc_mapWorldInfo->PutTo(writer, savw, x0_mlvlId);
x14_layerState->PutTo(writer); x14_layerState->PutTo(writer);

View File

@ -48,7 +48,7 @@ class CWorldState
TAreaId x4_areaId = kInvalidAreaId; TAreaId x4_areaId = kInvalidAreaId;
std::shared_ptr<CRelayTracker> x8_relayTracker; std::shared_ptr<CRelayTracker> x8_relayTracker;
std::shared_ptr<CMapWorldInfo> xc_mapWorldInfo; std::shared_ptr<CMapWorldInfo> xc_mapWorldInfo;
u32 x10_; ResId x10_desiredAreaAssetId;
std::shared_ptr<CWorldLayerState> x14_layerState; std::shared_ptr<CWorldLayerState> x14_layerState;
public: public:
@ -57,6 +57,7 @@ public:
ResId GetWorldAssetId() const { return x0_mlvlId; } ResId GetWorldAssetId() const { return x0_mlvlId; }
void SetAreaId(TAreaId aid) { x4_areaId = aid; } void SetAreaId(TAreaId aid) { x4_areaId = aid; }
TAreaId GetCurrentAreaId() const { return x4_areaId; } TAreaId GetCurrentAreaId() const { return x4_areaId; }
ResId GetDesiredAreaAssetId() const { return x10_desiredAreaAssetId; }
const std::shared_ptr<CRelayTracker>& RelayTracker() const { return x8_relayTracker; } const std::shared_ptr<CRelayTracker>& RelayTracker() const { return x8_relayTracker; }
const std::shared_ptr<CMapWorldInfo>& MapWorldInfo() const { return xc_mapWorldInfo; } const std::shared_ptr<CMapWorldInfo>& MapWorldInfo() const { return xc_mapWorldInfo; }
const std::shared_ptr<CWorldLayerState>& GetLayerState() const { return x14_layerState; } const std::shared_ptr<CWorldLayerState>& GetLayerState() const { return x14_layerState; }

View File

@ -41,7 +41,7 @@ add_subdirectory(MP3)
if(APPLE) if(APPLE)
set_source_files_properties(MP1/CFrontEndUITouchBarMac.mm set_source_files_properties(MP1/CFrontEndUITouchBarMac.mm
MP1/CSaveUITouchBarMac.mm MP1/CSaveGameScreenTouchBarMac.mm
CGameOptionsTouchBarMac.mm CGameOptionsTouchBarMac.mm
PROPERTIES COMPILE_FLAGS -fobjc-arc) PROPERTIES COMPILE_FLAGS -fobjc-arc)
bintoc(startButton.c Resources/startButton@2x.png START_BUTTON_2X) bintoc(startButton.c Resources/startButton@2x.png START_BUTTON_2X)

View File

@ -27,6 +27,7 @@ class CSaveWorldMemory
TLockedToken<CSaveWorld> x3c_saveWorld; /* used to be optional */ TLockedToken<CSaveWorld> x3c_saveWorld; /* used to be optional */
public: public:
ResId GetWorldNameId() const { return x0_strgId; }
ResId GetSaveWorldAssetId() const { return x4_savwId; } ResId GetSaveWorldAssetId() const { return x4_savwId; }
u32 GetAreaCount() const { return x8_areaCount; } u32 GetAreaCount() const { return x8_areaCount; }
const std::vector<CWorldLayers::Area>& GetDefaultLayerStates() const { return x1c_defaultLayerStates; } const std::vector<CWorldLayers::Area>& GetDefaultLayerStates() const { return x1c_defaultLayerStates; }

View File

@ -68,4 +68,13 @@ void CSimplePool::ObjectUnreferenced(const SObjectTag& tag)
x8_resources.erase(iter); x8_resources.erase(iter);
} }
std::vector<SObjectTag> CSimplePool::GetReferencedTags() const
{
std::vector<SObjectTag> ret;
ret.reserve(x8_resources.size());
for (const auto& obj : x8_resources)
ret.push_back(obj.first);
return ret;
}
} }

View File

@ -30,6 +30,7 @@ public:
IFactory& GetFactory() const {return x18_factory;} IFactory& GetFactory() const {return x18_factory;}
void Flush(); void Flush();
void ObjectUnreferenced(const SObjectTag&); void ObjectUnreferenced(const SObjectTag&);
std::vector<SObjectTag> GetReferencedTags() const;
}; };
} }

View File

@ -20,6 +20,7 @@
#include "World/CEnvFxManager.hpp" #include "World/CEnvFxManager.hpp"
#include "World/CActorModelParticles.hpp" #include "World/CActorModelParticles.hpp"
#include "Input/CRumbleManager.hpp" #include "Input/CRumbleManager.hpp"
#include "Camera/CCameraShakeData.hpp"
namespace urde namespace urde
{ {
@ -44,6 +45,11 @@ class CWorld;
class CTexture; class CTexture;
class CWorldLayerState; class CWorldLayerState;
namespace MP1
{
class CMFGameLoader;
}
struct SScriptObjectStream struct SScriptObjectStream
{ {
CEntity* x0_obj; CEntity* x0_obj;
@ -52,8 +58,17 @@ struct SScriptObjectStream
u32 xc_length; u32 xc_length;
}; };
struct SOnScreenTex
{
ResId x0_id = -1;
zeus::CVector2i x4_origin;
zeus::CVector2i xc_extent;
};
class CStateManager class CStateManager
{ {
friend class MP1::CMFGameLoader;
s16 x0_nextFreeIndex = 0; s16 x0_nextFreeIndex = 0;
TUniqueId x8_idArr[1024] = {}; TUniqueId x8_idArr[1024] = {};
@ -114,6 +129,8 @@ class CStateManager
TLockedToken<CTexture> x8f0_shadowTex; /* DefaultShadow in MiscData */ TLockedToken<CTexture> x8f0_shadowTex; /* DefaultShadow in MiscData */
CRandom16 x8fc_random; CRandom16 x8fc_random;
CRandom16* x900_activeRandom = nullptr; CRandom16* x900_activeRandom = nullptr;
u32 x904_ = 0;
u32 x908_ = 0;
FScriptLoader x90c_loaderFuncs[int(EScriptObjectType::ScriptObjectTypeMAX)] = {}; FScriptLoader x90c_loaderFuncs[int(EScriptObjectType::ScriptObjectTypeMAX)] = {};
bool xab0_worldLoaded = false; bool xab0_worldLoaded = false;
@ -153,30 +170,59 @@ class CStateManager
}; };
u16 _dummy = 0; u16 _dummy = 0;
}; };
s32 xef4_;
zeus::CVector2i xef8_; SOnScreenTex xef4_pendingScreenTex;
zeus::CVector2i xf00_; ResId xf08_ = -1;
float xf0c_ = 0.f;
float xf10_ = 0.f;
float xf14_ = 0.f;
TUniqueId xf18_ = kInvalidUniqueId;
float xf1c_ = 0.f;
u32 xf20_ = 0;
float xf24_thermColdScale1 = 0.f; float xf24_thermColdScale1 = 0.f;
float xf28_thermColdScale2 = 0.f; float xf28_thermColdScale2 = 0.f;
float xf2c_ = 1.f; float xf2c_ = 1.f;
float xf30_ = 1.f; float xf30_ = 1.f;
TUniqueId xf6c_playerActor; u32 xf34_ = 2;
void UpdateThermalVisor(); TUniqueId xf38_ = kInvalidUniqueId;
std::list<u32> xf3c_;
u32 xf50_ = 0;
std::list<u32> xf54_;
u32 xf68_ = 0;
TUniqueId xf6c_playerActor = kInvalidUniqueId;
u32 xf70_ = 0;
TUniqueId xf74_lastTrigger = kInvalidUniqueId; TUniqueId xf74_lastTrigger = kInvalidUniqueId;
TUniqueId xf76_lastRelay = kInvalidUniqueId; TUniqueId xf76_lastRelay = kInvalidUniqueId;
float xf78_ = 0.f;
u32 xf7c_ = 0;
u32 xf80_ = 0;
ResId xf84_ = -1;
ResId xf88_ = -1;
float xf8c_ = 0.f;
u32 xf90_ = 0;
union union
{ {
struct struct
{ {
bool xf94_24_ : 1;
bool xf94_25_ : 1;
bool xf94_26_generatingObject : 1; bool xf94_26_generatingObject : 1;
bool xf94_27_ : 1;
bool xf94_28_ : 1;
bool xf94_29_ : 1;
bool xf94_30_ : 1;
}; };
u32 xf94_ = 0; u32 xf94_ = 0;
}; };
void UpdateThermalVisor();
public: public:
/* TODO: Public for CFirstPersonCamera */ /* TODO: Public for CFirstPersonCamera */
u32 x904_; u32 Get904() const { return x904_; }
CStateManager(const std::weak_ptr<CRelayTracker>&, CStateManager(const std::weak_ptr<CRelayTracker>&,
const std::weak_ptr<CMapWorldInfo>&, const std::weak_ptr<CMapWorldInfo>&,
const std::weak_ptr<CPlayerState>&, const std::weak_ptr<CPlayerState>&,

View File

@ -232,7 +232,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
zeus::CTransform bobXf = player->GetCameraBob()->GetCameraBobTransformation(); zeus::CTransform bobXf = player->GetCameraBob()->GetCameraBobTransformation();
if (player->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed || player->x304_ == 5 || if (player->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed || player->x304_ == 5 ||
player->x3b8_ == 0 || mgr.x904_ == 1 || mgr.GetCameraManager()->IsInCinematicCamera()) player->x3b8_ == 0 || mgr.Get904() == 1 || mgr.GetCameraManager()->IsInCinematicCamera())
{ {
bobXf = zeus::CTransform::Identity(); bobXf = zeus::CTransform::Identity();
player->GetCameraBob()->SetCameraBobTransform(bobXf); player->GetCameraBob()->SetCameraBobTransform(bobXf);

View File

@ -45,6 +45,7 @@ public:
CGuiSys& GetGuiSys() {return x8_guiSys;} CGuiSys& GetGuiSys() {return x8_guiSys;}
CGuiLight* GetFrameLight(int idx) const { return x3c_lights[idx].get(); } CGuiLight* GetFrameLight(int idx) const { return x3c_lights[idx].get(); }
CGuiCamera* GetFrameCamera() const { return x14_camera.get(); }
CGuiWidget* FindWidget(const std::string& name) const; CGuiWidget* FindWidget(const std::string& name) const;
CGuiWidget* FindWidget(s16 id) const; CGuiWidget* FindWidget(s16 id) const;
void SetFrameCamera(std::shared_ptr<CGuiCamera>&& camr) { x14_camera = std::move(camr); } void SetFrameCamera(std::shared_ptr<CGuiCamera>&& camr) { x14_camera = std::move(camr); }

View File

@ -28,6 +28,7 @@ public:
const zeus::CVector3f& GetLocalPosition() const { return x4_localXF.origin; } const zeus::CVector3f& GetLocalPosition() const { return x4_localXF.origin; }
void SetLocalPosition(const zeus::CVector3f& pos); void SetLocalPosition(const zeus::CVector3f& pos);
const zeus::CVector3f& GetWorldPosition() const { return x34_worldXF.origin; } const zeus::CVector3f& GetWorldPosition() const { return x34_worldXF.origin; }
const zeus::CTransform& GetLocalTransform() const { return x34_worldXF; }
void RotateReset(); void RotateReset();
zeus::CVector3f RotateW2O(const zeus::CVector3f& vec) const; zeus::CVector3f RotateW2O(const zeus::CVector3f& vec) const;
zeus::CVector3f RotateO2P(const zeus::CVector3f& vec) const; zeus::CVector3f RotateO2P(const zeus::CVector3f& vec) const;

View File

@ -135,6 +135,7 @@ public:
void SetVerticalJustification(EVerticalJustification j); void SetVerticalJustification(EVerticalJustification j);
void SetImageBaseline(bool b); void SetImageBaseline(bool b);
bool GetIsTextSupportFinishedLoading() const; bool GetIsTextSupportFinishedLoading() const;
float GetCurTime() const { return x3c_curTime; }
}; };
} }

View File

@ -0,0 +1,53 @@
#include "CFaceplateDecoration.hpp"
#include "CStateManager.hpp"
#include "World/CPlayer.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
namespace urde
{
namespace MP1
{
CFaceplateDecoration::CFaceplateDecoration(CStateManager& stateMgr) {}
void CFaceplateDecoration::Update(float dt, CStateManager& stateMgr)
{
ResId txtrId = stateMgr.GetPlayer().GetVisorSteam().GetTextureId();
if (txtrId == -1)
{
if (xc_ready)
{
x4_tex.Unlock();
x0_id = txtrId;
if (m_texFilter)
m_texFilter = std::experimental::nullopt;
}
}
if (x0_id != txtrId && txtrId != -1)
{
if (m_texFilter)
m_texFilter = std::experimental::nullopt;
x0_id = txtrId;
x4_tex = g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), txtrId});
xc_ready = true;
x4_tex.Lock();
}
if (!m_texFilter && x4_tex.IsLoaded())
m_texFilter.emplace(CCameraFilterPass::EFilterType::Blend, x4_tex);
}
void CFaceplateDecoration::Draw(CStateManager& stateMgr)
{
if (xc_ready && m_texFilter)
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = stateMgr.GetPlayer().GetVisorSteam().GetAlpha();
m_texFilter->draw(color, 1.f);
}
}
}
}

View File

@ -0,0 +1,29 @@
#ifndef __URDE_CFACEPLATEDECORATION_HPP__
#define __URDE_CFACEPLATEDECORATION_HPP__
#include "RetroTypes.hpp"
#include "Graphics/Shaders/CTexturedQuadFilter.hpp"
namespace urde
{
class CStateManager;
namespace MP1
{
class CFaceplateDecoration
{
ResId x0_id;
TToken<CTexture> x4_tex;
bool xc_ready = false;
std::experimental::optional<CTexturedQuadFilter> m_texFilter;
public:
CFaceplateDecoration(CStateManager& stateMgr);
void Update(float dt, CStateManager& stateMgr);
void Draw(CStateManager& stateMgr);
};
}
}
#endif // __URDE_CFACEPLATEDECORATION_HPP__

View File

@ -8,7 +8,7 @@
#include "CSlideShow.hpp" #include "CSlideShow.hpp"
#include "Audio/CSfxManager.hpp" #include "Audio/CSfxManager.hpp"
#include "Graphics/CMoviePlayer.hpp" #include "Graphics/CMoviePlayer.hpp"
#include "CSaveUI.hpp" #include "CSaveGameScreen.hpp"
#include "GuiSys/CGuiTextPane.hpp" #include "GuiSys/CGuiTextPane.hpp"
#include "GuiSys/CGuiFrame.hpp" #include "GuiSys/CGuiFrame.hpp"
#include "GuiSys/CStringTable.hpp" #include "GuiSys/CStringTable.hpp"
@ -20,8 +20,9 @@
#include "Audio/CAudioGroupSet.hpp" #include "Audio/CAudioGroupSet.hpp"
#include "GuiSys/CGuiWidgetDrawParms.hpp" #include "GuiSys/CGuiWidgetDrawParms.hpp"
#include "CNESEmulator.hpp" #include "CNESEmulator.hpp"
#include "CQuitScreen.hpp" #include "CQuitGameScreen.hpp"
#include "Input/RumbleFxTable.hpp" #include "Input/RumbleFxTable.hpp"
#include <time.h>
namespace urde namespace urde
{ {
@ -74,7 +75,7 @@ void CFrontEndUI::PlayAdvanceSfx()
CSfxManager::SfxStart(1091, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(1091, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
} }
CFrontEndUI::SNewFileSelectFrame::SNewFileSelectFrame(CSaveUI* sui, u32 rnd, CFrontEndUITouchBar& touchBar) CFrontEndUI::SNewFileSelectFrame::SNewFileSelectFrame(CSaveGameScreen* sui, u32 rnd, CFrontEndUITouchBar& touchBar)
: x0_rnd(rnd), x4_saveUI(sui), m_touchBar(touchBar) : x0_rnd(rnd), x4_saveUI(sui), m_touchBar(touchBar)
{ {
x10_frme = g_SimplePool->GetObj("FRME_NewFileSelect"); x10_frme = g_SimplePool->GetObj("FRME_NewFileSelect");
@ -159,7 +160,7 @@ bool CFrontEndUI::SNewFileSelectFrame::IsTextDoneAnimating() const
void CFrontEndUI::SNewFileSelectFrame::Update(float dt) void CFrontEndUI::SNewFileSelectFrame::Update(float dt)
{ {
bool saveReady = x4_saveUI->GetUIType() == CSaveUI::EUIType::SaveReady; bool saveReady = x4_saveUI->GetUIType() == CSaveGameScreen::EUIType::SaveReady;
if (saveReady != x10c_saveReady) if (saveReady != x10c_saveReady)
{ {
if (saveReady) if (saveReady)
@ -1022,9 +1023,9 @@ void CFrontEndUI::SFusionBonusFrame::SetTableColors(CGuiTableGroup* tbgp) const
zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f}); zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f});
} }
void CFrontEndUI::SFusionBonusFrame::Update(float dt, CSaveUI* saveUI) void CFrontEndUI::SFusionBonusFrame::Update(float dt, CSaveGameScreen* saveUI)
{ {
bool doDraw = !saveUI || saveUI->GetUIType() == CSaveUI::EUIType::SaveReady; bool doDraw = !saveUI || saveUI->GetUIType() == CSaveGameScreen::EUIType::SaveReady;
if (doDraw != x38_lastDoDraw) if (doDraw != x38_lastDoDraw)
{ {
@ -1072,7 +1073,7 @@ void CFrontEndUI::SFusionBonusFrame::Update(float dt, CSaveUI* saveUI)
} }
CFrontEndUI::SFusionBonusFrame::EAction CFrontEndUI::SFusionBonusFrame::EAction
CFrontEndUI::SFusionBonusFrame::ProcessUserInput(const CFinalInput& input, CSaveUI* sui, CFrontEndUI::SFusionBonusFrame::ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui,
CFrontEndUITouchBar::EAction tbAction) CFrontEndUITouchBar::EAction tbAction)
{ {
x8_action = EAction::None; x8_action = EAction::None;
@ -1225,6 +1226,7 @@ void CFrontEndUI::SFusionBonusFrame::DoAdvance(CGuiTableGroup* caller)
else if (g_GameState->SystemOptions().GetPlayerBeatFusion()) else if (g_GameState->SystemOptions().GetPlayerBeatFusion())
{ {
x8_action = EAction::None; x8_action = EAction::None;
CSfxManager::SfxStart(1094, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
//x8_action = EAction::PlayNESMetroid; //x8_action = EAction::PlayNESMetroid;
} }
else else
@ -1437,23 +1439,23 @@ void CFrontEndUI::SNesEmulatorFrame::SetMode(EMode mode)
x8_quitScreen.reset(); x8_quitScreen.reset();
break; break;
case EMode::SaveProgress: case EMode::SaveProgress:
x8_quitScreen = std::make_unique<CQuitScreen>(EQuitType::SaveProgress); x8_quitScreen = std::make_unique<CQuitGameScreen>(EQuitType::SaveProgress);
break; break;
case EMode::ContinuePlaying: case EMode::ContinuePlaying:
x8_quitScreen = std::make_unique<CQuitScreen>(EQuitType::ContinuePlaying); x8_quitScreen = std::make_unique<CQuitGameScreen>(EQuitType::ContinuePlaying);
break; break;
case EMode::QuitNESMetroid: case EMode::QuitNESMetroid:
x8_quitScreen = std::make_unique<CQuitScreen>(EQuitType::QuitNESMetroid); x8_quitScreen = std::make_unique<CQuitGameScreen>(EQuitType::QuitNESMetroid);
break; break;
default: break; default: break;
} }
x0_mode = mode; x0_mode = mode;
} }
void CFrontEndUI::SNesEmulatorFrame::ProcessUserInput(const CFinalInput& input, CSaveUI* sui) void CFrontEndUI::SNesEmulatorFrame::ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui)
{ {
bool processInput = true; bool processInput = true;
if (sui && sui->GetUIType() != CSaveUI::EUIType::SaveReady) if (sui && sui->GetUIType() != CSaveGameScreen::EUIType::SaveReady)
processInput = false; processInput = false;
if (sui) if (sui)
sui->ProcessUserInput(input); sui->ProcessUserInput(input);
@ -1476,9 +1478,9 @@ void CFrontEndUI::SNesEmulatorFrame::ProcessUserInput(const CFinalInput& input,
} }
} }
bool CFrontEndUI::SNesEmulatorFrame::Update(float dt, CSaveUI* saveUi) bool CFrontEndUI::SNesEmulatorFrame::Update(float dt, CSaveGameScreen* saveUi)
{ {
bool doUpdate = (saveUi && saveUi->GetUIType() != CSaveUI::EUIType::SaveReady) ? false : true; bool doUpdate = (saveUi && saveUi->GetUIType() != CSaveGameScreen::EUIType::SaveReady) ? false : true;
x10_remTime = std::max(x10_remTime - dt, 0.f); x10_remTime = std::max(x10_remTime - dt, 0.f);
zeus::CColor geomCol(zeus::CColor::skWhite); zeus::CColor geomCol(zeus::CColor::skWhite);
@ -1561,10 +1563,10 @@ bool CFrontEndUI::SNesEmulatorFrame::Update(float dt, CSaveUI* saveUi)
return false; return false;
} }
void CFrontEndUI::SNesEmulatorFrame::Draw(CSaveUI* saveUi) const void CFrontEndUI::SNesEmulatorFrame::Draw(CSaveGameScreen* saveUi) const
{ {
zeus::CColor mulColor = zeus::CColor::skWhite; zeus::CColor mulColor = zeus::CColor::skWhite;
bool doDraw = (saveUi && saveUi->GetUIType() != CSaveUI::EUIType::SaveReady) ? false : true; bool doDraw = (saveUi && saveUi->GetUIType() != CSaveGameScreen::EUIType::SaveReady) ? false : true;
if (doDraw) if (doDraw)
mulColor = zeus::CColor::skBlack; mulColor = zeus::CColor::skBlack;
@ -1841,7 +1843,7 @@ bool CFrontEndUI::SOptionsFrontEndFrame::PumpLoad()
return true; return true;
} }
bool CFrontEndUI::SOptionsFrontEndFrame::ProcessUserInput(const CFinalInput& input, CSaveUI* sui) bool CFrontEndUI::SOptionsFrontEndFrame::ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui)
{ {
x134_25_exitOptions = false; x134_25_exitOptions = false;
if (sui) if (sui)
@ -1945,10 +1947,10 @@ bool CFrontEndUI::SOptionsFrontEndFrame::ProcessUserInput(const CFinalInput& inp
return !x134_25_exitOptions; return !x134_25_exitOptions;
} }
void CFrontEndUI::SOptionsFrontEndFrame::Update(float dt, CSaveUI* sui) void CFrontEndUI::SOptionsFrontEndFrame::Update(float dt, CSaveGameScreen* sui)
{ {
x40_rumbleGen.Update(dt); x40_rumbleGen.Update(dt);
x134_24_visible = !sui || sui->GetUIType() == CSaveUI::EUIType::SaveReady; x134_24_visible = !sui || sui->GetUIType() == CSaveGameScreen::EUIType::SaveReady;
if (!PumpLoad()) if (!PumpLoad())
return; return;
@ -1985,14 +1987,15 @@ CFrontEndUI::CFrontEndUI()
{ {
CMain* m = static_cast<CMain*>(g_Main); CMain* m = static_cast<CMain*>(g_Main);
x18_rndA = std::min(rand() * 3 / RAND_MAX, 2); CRandom16 r(time(nullptr));
x1c_rndB = std::min(rand() * 3 / RAND_MAX, 2); x18_rndA = r.Range(0, 2);
x1c_rndB = r.Range(0, 2);
x20_depsGroup = g_SimplePool->GetObj("FrontEnd_DGRP"); x20_depsGroup = g_SimplePool->GetObj("FrontEnd_DGRP");
x38_pressStart = g_SimplePool->GetObj("TXTR_PressStart"); x38_pressStart = g_SimplePool->GetObj("TXTR_PressStart");
x44_frontendAudioGrp = g_SimplePool->GetObj("FrontEnd_AGSC"); x44_frontendAudioGrp = g_SimplePool->GetObj("FrontEnd_AGSC");
xdc_saveUI = std::make_unique<CSaveUI>(ESaveContext::FrontEnd, g_GameState->GetCardSerial()); xdc_saveUI = std::make_unique<CSaveGameScreen>(ESaveContext::FrontEnd, g_GameState->GetCardSerial());
m->ResetGameState(); m->ResetGameState();
g_GameState->SetCurrentWorldId(g_ResFactory->TranslateOriginalToNew(g_DefaultWorldTag.id)); g_GameState->SetCurrentWorldId(g_ResFactory->TranslateOriginalToNew(g_DefaultWorldTag.id));
@ -2330,7 +2333,20 @@ bool CFrontEndUI::PumpMovieLoad()
if (!x70_menuMovies[i]) if (!x70_menuMovies[i])
{ {
const FEMovie& movie = FEMovies[i]; const FEMovie& movie = FEMovies[i];
x70_menuMovies[i] = std::make_unique<CMoviePlayer>(movie.path, 0.05f, movie.loop, false); std::string path = movie.path;
if (i == int(EMenuMovie::StartFileSelectA))
{
auto pos = path.find("A.thp");
if (pos != std::string::npos)
path[pos] = 'A' + x18_rndA;
}
else if (i == int(EMenuMovie::FileSelectPlayGameA))
{
auto pos = path.find("A.thp");
if (pos != std::string::npos)
path[pos] = 'A' + x1c_rndB;
}
x70_menuMovies[i] = std::make_unique<CMoviePlayer>(path.c_str(), 0.05f, movie.loop, false);
x70_menuMovies[i]->SetPlayMode(CMoviePlayer::EPlayMode::Stopped); x70_menuMovies[i]->SetPlayMode(CMoviePlayer::EPlayMode::Stopped);
return false; return false;
} }
@ -2635,7 +2651,7 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue)
if (xf0_optionsFrme) if (xf0_optionsFrme)
{ {
bool optionsActive = true; bool optionsActive = true;
if (xdc_saveUI && xdc_saveUI->GetUIType() != CSaveUI::EUIType::SaveReady) if (xdc_saveUI && xdc_saveUI->GetUIType() != CSaveGameScreen::EUIType::SaveReady)
optionsActive = false; optionsActive = false;
if (optionsActive) if (optionsActive)

View File

@ -36,8 +36,8 @@ class CGuiModel;
namespace MP1 namespace MP1
{ {
class CNESEmulator; class CNESEmulator;
class CSaveUI; class CSaveGameScreen;
class CQuitScreen; class CQuitGameScreen;
class CFrontEndUI : public CIOWin class CFrontEndUI : public CIOWin
{ {
@ -120,7 +120,7 @@ public:
}; };
u32 x0_rnd; u32 x0_rnd;
CSaveUI* x4_saveUI; CSaveGameScreen* x4_saveUI;
ESubMenu x8_subMenu = ESubMenu::Root; ESubMenu x8_subMenu = ESubMenu::Root;
EAction xc_action = EAction::None; EAction xc_action = EAction::None;
TLockedToken<CGuiFrame> x10_frme; TLockedToken<CGuiFrame> x10_frme;
@ -146,7 +146,7 @@ public:
CFrontEndUITouchBar& m_touchBar; CFrontEndUITouchBar& m_touchBar;
SNewFileSelectFrame(CSaveUI* sui, u32 rnd, CFrontEndUITouchBar& touchBar); SNewFileSelectFrame(CSaveGameScreen* sui, u32 rnd, CFrontEndUITouchBar& touchBar);
void FinishedLoading(); void FinishedLoading();
bool PumpLoad(); bool PumpLoad();
bool IsTextDoneAnimating() const; bool IsTextDoneAnimating() const;
@ -253,8 +253,8 @@ public:
void FinishedLoading(); void FinishedLoading();
bool PumpLoad(); bool PumpLoad();
void SetTableColors(CGuiTableGroup* tbgp) const; void SetTableColors(CGuiTableGroup* tbgp) const;
void Update(float dt, CSaveUI* saveUI); void Update(float dt, CSaveGameScreen* saveUI);
EAction ProcessUserInput(const CFinalInput& input, CSaveUI* sui, EAction ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui,
CFrontEndUITouchBar::EAction tbAction); CFrontEndUITouchBar::EAction tbAction);
void Draw() const; void Draw() const;
@ -315,7 +315,7 @@ public:
EMode x0_mode = EMode::Emulator; EMode x0_mode = EMode::Emulator;
std::unique_ptr<CNESEmulator> x4_nesEmu; std::unique_ptr<CNESEmulator> x4_nesEmu;
std::unique_ptr<CQuitScreen> x8_quitScreen; std::unique_ptr<CQuitGameScreen> x8_quitScreen;
std::unique_ptr<CGuiTextSupport> xc_textSupport; std::unique_ptr<CGuiTextSupport> xc_textSupport;
float x10_remTime = 8.f; float x10_remTime = 8.f;
bool x14_emulationSuspended = false; bool x14_emulationSuspended = false;
@ -323,9 +323,9 @@ public:
SNesEmulatorFrame(); SNesEmulatorFrame();
void SetMode(EMode mode); void SetMode(EMode mode);
void ProcessUserInput(const CFinalInput& input, CSaveUI* sui); void ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui);
bool Update(float dt, CSaveUI* saveUi); bool Update(float dt, CSaveGameScreen* saveUi);
void Draw(CSaveUI* saveUi) const; void Draw(CSaveGameScreen* saveUi) const;
}; };
struct SOptionsFrontEndFrame struct SOptionsFrontEndFrame
@ -372,8 +372,8 @@ public:
void FinishedLoading(); void FinishedLoading();
bool PumpLoad(); bool PumpLoad();
bool ProcessUserInput(const CFinalInput& input, CSaveUI* sui); bool ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui);
void Update(float dt, CSaveUI* saveUi); void Update(float dt, CSaveGameScreen* saveUi);
void Draw() const; void Draw() const;
}; };
@ -413,7 +413,7 @@ private:
bool xd2_deferSlideShow = false; bool xd2_deferSlideShow = false;
std::unique_ptr<CStaticAudioPlayer> xd4_audio1; std::unique_ptr<CStaticAudioPlayer> xd4_audio1;
std::unique_ptr<CStaticAudioPlayer> xd8_audio2; std::unique_ptr<CStaticAudioPlayer> xd8_audio2;
std::unique_ptr<CSaveUI> xdc_saveUI; std::unique_ptr<CSaveGameScreen> xdc_saveUI;
std::unique_ptr<SNewFileSelectFrame> xe0_frontendCardFrme; std::unique_ptr<SNewFileSelectFrame> xe0_frontendCardFrme;
std::unique_ptr<SFusionBonusFrame> xe4_fusionBonusFrme; std::unique_ptr<SFusionBonusFrame> xe4_fusionBonusFrme;
std::unique_ptr<SFrontEndFrame> xe8_frontendNoCardFrme; std::unique_ptr<SFrontEndFrame> xe8_frontendNoCardFrme;

View File

@ -0,0 +1,170 @@
#include "CInGameGuiManager.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
#include "World/CPlayer.hpp"
#include "CDependencyGroup.hpp"
#include "CSimplePool.hpp"
#include "GuiSys/CGuiFrame.hpp"
#include "GuiSys/CGuiCamera.hpp"
#include "GuiSys/CGuiModel.hpp"
#include "AutoMapper/CAutoMapper.hpp"
namespace urde
{
namespace MP1
{
static const char* InGameGuiDGRPs[] =
{
"InGameGui_DGRP",
"Ice_DGRP",
"Phazon_DGRP",
"Plasma_DGRP",
"Power_DGRP",
"Wave_DGRP",
"BallTransition_DGRP",
"GravitySuit_DGRP",
"Ice_Anim_DGRP",
"Plasma_Anim_DGRP",
"PowerSuit_DGRP",
"Power_Anim_DGRP",
"VariaSuit_DGRP",
"Wave_Anim_DGRP"
};
static const char* PauseScreenDGRPs[] =
{
"InventorySuitPower_DGRP",
"InventorySuitVaria_DGRP",
"InventorySuitGravity_DGRP",
"InventorySuitPhazon_DGRP",
"InventorySuitFusionPower_DGRP",
"InventorySuitFusionVaria_DGRP",
"InventorySuitFusionGravity_DGRP",
"InventorySuitFusionPhazon_DGRP",
"SamusBallANCS_DGRP",
"SamusSpiderBallANCS_DGRP",
"PauseScreenDontDump_DGRP",
"PauseScreenDontDump_NoARAM_DGRP",
"PauseScreenTokens_DGRP"
};
std::vector<TLockedToken<CDependencyGroup>> CInGameGuiManager::LockPauseScreenDependencies()
{
std::vector<TLockedToken<CDependencyGroup>> ret;
ret.reserve(13);
for (int i=0 ; i<13 ; ++i)
ret.push_back(g_SimplePool->GetObj(PauseScreenDGRPs[i]));
return ret;
}
bool CInGameGuiManager::CheckDGRPLoadComplete() const
{
for (const auto& dgrp : x5c_pauseScreenDGRPs)
if (!dgrp.IsLoaded())
return false;
for (const auto& dgrp : xc8_inGameGuiDGRPs)
if (!dgrp.IsLoaded())
return false;
return true;
}
void CInGameGuiManager::BeginStateTransition(EInGameGuiState state, CStateManager& stateMgr)
{
}
CInGameGuiManager::CInGameGuiManager(CStateManager& stateMgr,
CArchitectureQueue& archQueue)
: x0_iggmPreLoad(g_SimplePool->GetObj("PreLoadIGGM_DGRP")), x1c_rand(1234),
x20_faceplateDecor(stateMgr), x50_deathDot(g_SimplePool->GetObj("TXTR_DeathDot")),
x5c_pauseScreenDGRPs(LockPauseScreenDependencies())
{
x1e0_helmetVisMode = g_tweakGui->GetHelmetVisMode();
x1e4_enableTargetingManager = g_tweakGui->GetEnableTargetingManager();
x1e8_enableAutoMapper = g_tweakGui->GetEnableAutoMapper();
x1ec_hudVisMode = g_tweakGui->GetHudVisMode();
x1f0_enablePlayerVisor = g_tweakGui->GetEnablePlayerVisor();
x1f4_player74c = stateMgr.GetPlayer().Get74C();
x1f8_25_ = true;
x1f8_27_ = true;
xc8_inGameGuiDGRPs.reserve(14);
for (int i=0 ; i<14 ; ++i)
xc8_inGameGuiDGRPs.push_back(g_SimplePool->GetObj(PauseScreenDGRPs[i]));
}
bool CInGameGuiManager::CheckLoadComplete(CStateManager& stateMgr)
{
switch (x18_loadPhase)
{
case ELoadPhase::LoadDepsGroup:
{
if (!x0_iggmPreLoad.IsLoaded())
return false;
const auto& tags = x0_iggmPreLoad->GetObjectTagVector();
x8_preLoadDeps.reserve(tags.size());
for (const SObjectTag& tag : tags)
{
x8_preLoadDeps.push_back(g_SimplePool->GetObj(tag));
x8_preLoadDeps.back().Lock();
}
x0_iggmPreLoad.Unlock();
x18_loadPhase = ELoadPhase::PreLoadDeps;
}
case ELoadPhase::PreLoadDeps:
{
for (CToken& tok : x8_preLoadDeps)
if (!tok.IsLoaded())
return false;
x18_loadPhase = ELoadPhase::LoadDeps;
x30_playerVisor = std::make_unique<CPlayerVisor>(stateMgr);
x34_samusHud = std::make_unique<CSamusHud>(stateMgr);
x38_autoMapper = std::make_unique<CAutoMapper>(stateMgr);
x3c_pauseScreen = std::make_unique<CPauseScreen>();
x40_samusReflection = std::make_unique<CSamusFaceReflection>(stateMgr);
}
case ELoadPhase::LoadDeps:
{
if (!x38_autoMapper->CheckLoadComplete())
return false;
if (!x34_samusHud->CheckLoadComplete(stateMgr))
return false;
if (!x50_deathDot.IsLoaded())
return false;
if (!CheckDGRPLoadComplete())
return false;
x8_preLoadDeps.clear();
CGuiFrame& baseHud = *x34_samusHud->x274_loadedBaseHud;
x144_basewidget_automapper = baseHud.FindWidget("BaseWidget_AutoMapper");
x148_model_automapper = static_cast<CGuiModel*>(baseHud.FindWidget("Model_AutoMapper"));
x14c_basehud_camera = baseHud.GetFrameCamera();
x150_basewidget_functional = baseHud.FindWidget("BaseWidget_Functional");
x154_automapperRotate = zeus::CQuaternion(x144_basewidget_automapper->GetLocalTransform().basis);
x164_automapperOffset = x144_basewidget_automapper->GetLocalPosition();
x170_camRotate = zeus::CQuaternion::skNoRotation;
x180_camOffset = x14c_basehud_camera->GetLocalPosition() +
zeus::CVector3f(0.f, 2.f, g_tweakAutoMapper->GetCamVerticalOffset());
zeus::CMatrix3f mtx(x170_camRotate);
x18c_camXf = zeus::CTransform(mtx, x180_camOffset);
BeginStateTransition(EInGameGuiState::One, stateMgr);
x18_loadPhase = ELoadPhase::Done;
}
case ELoadPhase::Done:
{
x34_samusHud->Touch();
return true;
}
default:
return false;
}
}
}
}

View File

@ -0,0 +1,118 @@
#ifndef __URDE_CINGAMEGUIMANAGER_HPP__
#define __URDE_CINGAMEGUIMANAGER_HPP__
#include "CToken.hpp"
#include "CRandom16.hpp"
#include "CPlayerVisor.hpp"
#include "CFaceplateDecoration.hpp"
#include "CSamusHud.hpp"
#include "CPauseScreen.hpp"
#include "CSamusFaceReflection.hpp"
#include "CMessageScreen.hpp"
#include "CSaveGameScreen.hpp"
#include "Camera/CCameraFilter.hpp"
#include "CStateManager.hpp"
#include "DataSpec/DNACommon/Tweaks/ITweakGui.hpp"
namespace urde
{
class CStateManager;
class CArchitectureQueue;
class CDependencyGroup;
class CModelData;
class CActorLights;
class CGuiModel;
class CGuiCamera;
class CAutoMapper;
namespace MP1
{
enum class EInGameGuiState
{
Zero,
One
};
class CInGameGuiManager
{
enum class ELoadPhase
{
LoadDepsGroup = 0,
PreLoadDeps,
LoadDeps,
Done
};
struct SGuiProfileInfo
{
};
TLockedToken<CDependencyGroup> x0_iggmPreLoad;
std::vector<CToken> x8_preLoadDeps;
ELoadPhase x18_loadPhase = ELoadPhase::LoadDepsGroup;
CRandom16 x1c_rand;
CFaceplateDecoration x20_faceplateDecor;
std::unique_ptr<CPlayerVisor> x30_playerVisor;
std::unique_ptr<CSamusHud> x34_samusHud;
std::unique_ptr<CAutoMapper> x38_autoMapper;
std::unique_ptr<CPauseScreen> x3c_pauseScreen;
std::unique_ptr<CSamusFaceReflection> x40_samusReflection;
std::unique_ptr<CMessageScreen> x44_;
u32 x48_ = 0;
std::unique_ptr<CSaveGameScreen> x4c_saveUI;
TLockedToken<CTexture> x50_deathDot;
std::vector<TLockedToken<CDependencyGroup>> x5c_pauseScreenDGRPs;
std::vector<TLockedToken<CDependencyGroup>> xc8_inGameGuiDGRPs;
std::vector<u32> xd8_;
std::vector<CToken> xe8_;
CCameraFilterPass xf8_camFilter;
std::list<CToken> x12c_;
u32 x140_ = 0;
CGuiWidget* x144_basewidget_automapper = nullptr;
CGuiModel* x148_model_automapper = nullptr;
CGuiCamera* x14c_basehud_camera = nullptr;
CGuiWidget* x150_basewidget_functional = nullptr;
zeus::CQuaternion x154_automapperRotate;
zeus::CVector3f x164_automapperOffset;
zeus::CQuaternion x170_camRotate;
zeus::CVector3f x180_camOffset;
zeus::CTransform x18c_camXf;
u32 x1bc_ = 0;
u32 x1c0_ = 0;
SOnScreenTex x1c4_onScreenTex;
float x1d8_ = 0.f;
TLockedToken<CTexture> x1dc_onScreenTexTok; // Used to be heap-allocated
DataSpec::ITweakGui::EHelmetVisMode x1e0_helmetVisMode;
bool x1e4_enableTargetingManager;
bool x1e8_enableAutoMapper;
DataSpec::ITweakGui::EHudVisMode x1ec_hudVisMode;
u32 x1f0_enablePlayerVisor;
float x1f4_player74c;
union
{
struct
{
bool x1f8_24_ : 1;
bool x1f8_25_ : 1;
bool x1f8_26_ : 1;
bool x1f8_27_ : 1;
};
u32 _dummy = 0;
};
static std::vector<TLockedToken<CDependencyGroup>> LockPauseScreenDependencies();
bool CheckDGRPLoadComplete() const;
void BeginStateTransition(EInGameGuiState state, CStateManager& stateMgr);
public:
CInGameGuiManager(CStateManager& stateMgr, CArchitectureQueue& archQueue);
bool CheckLoadComplete(CStateManager& stateMgr);
};
}
}
#endif // __URDE_CINGAMEGUIMANAGER_HPP__

View File

@ -6,6 +6,7 @@
#include "World/CPlayer.hpp" #include "World/CPlayer.hpp"
#include "MP1.hpp" #include "MP1.hpp"
#include "Character/CCharLayoutInfo.hpp" #include "Character/CCharLayoutInfo.hpp"
#include "AutoMapper/CAutoMapper.hpp"
namespace urde namespace urde
{ {
@ -39,14 +40,30 @@ CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader")
case EFlowState::Six: case EFlowState::Six:
{ {
ResId mlvlId = g_GameState->CurrentWorldAssetId(); ResId mlvlId = g_GameState->CurrentWorldAssetId();
// g_GameState->WorldTransitionManager()-> if (g_MemoryCardSys->HasSaveWorldMemory(mlvlId))
// g_MemoryCardSys->
}
default:
{ {
const CSaveWorldMemory& savwMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId);
if (savwMem.GetWorldNameId() != -1)
{
ResId wtMgrFont = g_ResFactory->TranslateOriginalToNew(0xB7BBD0B4);
g_GameState->GetWorldTransitionManager()->EnableTransition(wtMgrFont,
savwMem.GetWorldNameId(),
1, false, 0.1f, 16.f, 1.f);
} }
} }
} }
default: break;
}
if (g_GameState->CurrentWorldAssetId() == g_ResFactory->TranslateOriginalToNew(0x158EFE17) &&
g_GameState->CurrentWorldState().GetCurrentAreaId() == 0)
{
const SObjectTag* strgTag = g_ResFactory->GetResourceIdByName("STRG_IntroLevelLoad");
if (strgTag)
g_GameState->GetWorldTransitionManager()->EnableTransition(-1, strgTag->id,
0, false, 0.1f, 16.f, 1.f);
}
}
void CMFGameLoader::MakeLoadDependencyList() void CMFGameLoader::MakeLoadDependencyList()
{ {
@ -65,14 +82,55 @@ CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg,
float dt = tick.x4_parm; float dt = tick.x4_parm;
if (!x2c_24_initialized) if (!x2c_24_initialized)
{ {
if (x1c_.empty()) if (x1c_loadList.empty())
{
MakeLoadDependencyList(); MakeLoadDependencyList();
wtMgr->StartTransition(); wtMgr->StartTransition();
return EMessageReturn::Exit;
}
u32 loadingCount = 0;
for (CToken& tok : x1c_loadList)
{
tok.Lock();
if (!tok.IsLoaded())
++loadingCount;
}
wtMgr->Update(dt);
if (loadingCount)
return EMessageReturn::Exit;
x2c_24_initialized = true;
} }
else else
{ {
wtMgr->Update(dt); wtMgr->Update(dt);
} }
if (!x14_stateMgr)
{
CWorldTransManager::WaitForModelsAndTextures();
CWorldState& wldState = g_GameState->CurrentWorldState();
x14_stateMgr = std::make_shared<CStateManager>(wldState.RelayTracker(),
wldState.MapWorldInfo(),
g_GameState->GetPlayerState(),
wtMgr,
wldState.GetLayerState());
}
if (x14_stateMgr->xb3c_initPhase != CStateManager::InitPhase::Done)
{
CWorldState& wldState = g_GameState->CurrentWorldState();
x14_stateMgr->InitializeState(wldState.GetWorldAssetId(),
wldState.GetCurrentAreaId(),
wldState.GetDesiredAreaAssetId());
return EMessageReturn::Exit;
}
else
{
if (!x18_guiMgr)
{
x18_guiMgr = std::make_shared<CInGameGuiManager>(*x14_stateMgr, queue);
}
}
} }
default: default:
break; break;

View File

@ -2,6 +2,7 @@
#define __URDE_CMFGAME_HPP__ #define __URDE_CMFGAME_HPP__
#include "CMFGameBase.hpp" #include "CMFGameBase.hpp"
#include "CInGameGuiManager.hpp"
namespace urde namespace urde
{ {
@ -39,7 +40,7 @@ class CMFGameLoader : public CMFGameLoaderBase
{ {
std::shared_ptr<CStateManager> x14_stateMgr; std::shared_ptr<CStateManager> x14_stateMgr;
std::shared_ptr<CInGameGuiManager> x18_guiMgr; std::shared_ptr<CInGameGuiManager> x18_guiMgr;
std::vector<CToken> x1c_; std::vector<CToken> x1c_loadList;
union union
{ {

View File

@ -7,12 +7,12 @@
#include "CFrontEndUI.hpp" #include "CFrontEndUI.hpp"
#include "GameGlobalObjects.hpp" #include "GameGlobalObjects.hpp"
#include "Character/CCharLayoutInfo.hpp" #include "Character/CCharLayoutInfo.hpp"
#include "CSaveUI.hpp" #include "CSaveGameScreen.hpp"
#include "CCredits.hpp" #include "CCredits.hpp"
#include "CPreFrontEnd.hpp" #include "CPreFrontEnd.hpp"
#include "CStateSetterFlow.hpp" #include "CStateSetterFlow.hpp"
#include "CNESEmulator.hpp" #include "CNESEmulator.hpp"
#include "CQuitScreen.hpp" #include "CQuitGameScreen.hpp"
namespace urde namespace urde
{ {

View File

@ -4,7 +4,7 @@ add_subdirectory(World)
if(APPLE) if(APPLE)
set(MP1_PLAT_SOURCES set(MP1_PLAT_SOURCES
CFrontEndUITouchBarMac.mm CFrontEndUITouchBarMac.mm
CSaveUITouchBarMac.mm) CSaveGameScreenTouchBarMac.mm)
endif() endif()
set(MP1_SOURCES set(MP1_SOURCES
@ -19,13 +19,20 @@ set(MP1_SOURCES
CFrontEndUITouchBar.hpp CFrontEndUITouchBar.cpp CFrontEndUITouchBar.hpp CFrontEndUITouchBar.cpp
CPreFrontEnd.hpp CPreFrontEnd.cpp CPreFrontEnd.hpp CPreFrontEnd.cpp
CSlideShow.hpp CSlideShow.cpp CSlideShow.hpp CSlideShow.cpp
CSaveUI.hpp CSaveUI.cpp CSaveGameScreen.hpp CSaveGameScreen.cpp
CSaveUITouchBar.hpp CSaveUITouchBar.cpp CSaveGameScreenTouchBar.hpp CSaveGameScreenTouchBar.cpp
CMemoryCardDriver.hpp CMemoryCardDriver.cpp CMemoryCardDriver.hpp CMemoryCardDriver.cpp
CQuitScreen.hpp CQuitScreen.cpp CQuitGameScreen.hpp CQuitGameScreen.cpp
CMessageScreen.hpp CMessageScreen.cpp
CCredits.hpp CCredits.cpp CCredits.hpp CCredits.cpp
CStateSetterFlow.hpp CStateSetterFlow.cpp CStateSetterFlow.hpp CStateSetterFlow.cpp
CAudioStateWin.hpp CAudioStateWin.cpp CAudioStateWin.hpp CAudioStateWin.cpp
CInGameGuiManager.hpp CInGameGuiManager.cpp
CSamusFaceReflection.hpp CSamusFaceReflection.cpp
CPlayerVisor.hpp CPlayerVisor.cpp
CSamusHud.hpp CSamusHud.cpp
CPauseScreen.hpp CPauseScreen.cpp
CFaceplateDecoration.hpp CFaceplateDecoration.cpp
MP1.hpp MP1.cpp MP1.hpp MP1.cpp
${MP1_PLAT_SOURCES} ${MP1_PLAT_SOURCES}
${MP1_WORLD_SOURCES}) ${MP1_WORLD_SOURCES})

View File

@ -11,7 +11,7 @@ namespace MP1
class CMemoryCardDriver class CMemoryCardDriver
{ {
friend class CSaveUI; friend class CSaveGameScreen;
public: public:
enum class EState enum class EState
{ {

View File

View File

@ -0,0 +1,18 @@
#ifndef __URDE_CMESSAGESCREEN_HPP__
#define __URDE_CMESSAGESCREEN_HPP__
namespace urde
{
namespace MP1
{
class CMessageScreen
{
public:
CMessageScreen();
};
}
}
#endif // __URDE_CMESSAGESCREEN_HPP__

View File

@ -0,0 +1,19 @@
#include "CPauseScreen.hpp"
namespace urde
{
namespace MP1
{
CPauseScreen::CPauseScreen()
{
}
bool CPauseScreen::CheckLoadComplete()
{
return false;
}
}
}

View File

@ -0,0 +1,19 @@
#ifndef __URDE_CPAUSESCREEN_HPP__
#define __URDE_CPAUSESCREEN_HPP__
namespace urde
{
namespace MP1
{
class CPauseScreen
{
public:
CPauseScreen();
bool CheckLoadComplete();
};
}
}
#endif // __URDE_CPAUSESCREEN_HPP__

View File

@ -0,0 +1,14 @@
#include "CPlayerVisor.hpp"
namespace urde
{
namespace MP1
{
CPlayerVisor::CPlayerVisor(CStateManager& stateMgr)
{
}
}
}

View File

@ -0,0 +1,20 @@
#ifndef __URDE_CPLAYERVISOR_HPP__
#define __URDE_CPLAYERVISOR_HPP__
namespace urde
{
class CStateManager;
namespace MP1
{
class CPlayerVisor
{
public:
CPlayerVisor(CStateManager& stateMgr);
};
}
}
#endif // __URDE_CPLAYERVISOR_HPP__

View File

@ -1,4 +1,4 @@
#include "CQuitScreen.hpp" #include "CQuitGameScreen.hpp"
#include "Input/CFinalInput.hpp" #include "Input/CFinalInput.hpp"
#include "GameGlobalObjects.hpp" #include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp" #include "CSimplePool.hpp"
@ -29,22 +29,22 @@ static const float VerticalOffsets[] =
0.f, 1.6f, 1.f, 0.f, 1.f 0.f, 1.6f, 1.f, 0.f, 1.f
}; };
void CQuitScreen::SetColors() void CQuitGameScreen::SetColors()
{ {
x14_tablegroup_quitgame->SetColors(zeus::CColor{0.784313f, 0.784313f, 0.784313f, 1.f}, x14_tablegroup_quitgame->SetColors(zeus::CColor{0.784313f, 0.784313f, 0.784313f, 1.f},
zeus::CColor{0.196078f, 0.196078f, 0.196078f, 1.f}); zeus::CColor{0.196078f, 0.196078f, 0.196078f, 1.f});
} }
void CQuitScreen::FinishedLoading() void CQuitGameScreen::FinishedLoading()
{ {
x10_loadedFrame = x4_frame.GetObj(); x10_loadedFrame = x4_frame.GetObj();
x14_tablegroup_quitgame = static_cast<CGuiTableGroup*>( x14_tablegroup_quitgame = static_cast<CGuiTableGroup*>(
x10_loadedFrame->FindWidget("tablegroup_quitgame")); x10_loadedFrame->FindWidget("tablegroup_quitgame"));
x14_tablegroup_quitgame->SetMenuAdvanceCallback( x14_tablegroup_quitgame->SetMenuAdvanceCallback(
std::bind(&CQuitScreen::DoAdvance, this, std::placeholders::_1)); std::bind(&CQuitGameScreen::DoAdvance, this, std::placeholders::_1));
x14_tablegroup_quitgame->SetMenuSelectionChangeCallback( x14_tablegroup_quitgame->SetMenuSelectionChangeCallback(
std::bind(&CQuitScreen::DoSelectionChange, this, std::placeholders::_1, std::placeholders::_2)); std::bind(&CQuitGameScreen::DoSelectionChange, this, std::placeholders::_1, std::placeholders::_2));
static_cast<CGuiTextPane*>(x10_loadedFrame->FindWidget("textpane_title"))->TextSupport()-> static_cast<CGuiTextPane*>(x10_loadedFrame->FindWidget("textpane_title"))->TextSupport()->
SetText(g_MainStringTable->GetString(Titles[int(x0_type)])); SetText(g_MainStringTable->GetString(Titles[int(x0_type)]));
@ -58,13 +58,13 @@ void CQuitScreen::FinishedLoading()
SetColors(); SetColors();
} }
void CQuitScreen::DoSelectionChange(CGuiTableGroup* caller, int userSel) void CQuitGameScreen::DoSelectionChange(CGuiTableGroup* caller, int userSel)
{ {
SetColors(); SetColors();
CSfxManager::SfxStart(1424, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(1424, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
} }
void CQuitScreen::DoAdvance(CGuiTableGroup* caller) void CQuitGameScreen::DoAdvance(CGuiTableGroup* caller)
{ {
if (caller->GetUserSelection() == 0) if (caller->GetUserSelection() == 0)
{ {
@ -80,14 +80,14 @@ void CQuitScreen::DoAdvance(CGuiTableGroup* caller)
} }
} }
EQuitAction CQuitScreen::Update(float dt) EQuitAction CQuitGameScreen::Update(float dt)
{ {
if (!x10_loadedFrame && x4_frame.IsLoaded()) if (!x10_loadedFrame && x4_frame.IsLoaded())
FinishedLoading(); FinishedLoading();
return x18_action; return x18_action;
} }
void CQuitScreen::Draw() void CQuitGameScreen::Draw()
{ {
if (x0_type == EQuitType::QuitGame) if (x0_type == EQuitType::QuitGame)
m_blackScreen->draw(zeus::CColor::skBlack); m_blackScreen->draw(zeus::CColor::skBlack);
@ -97,7 +97,7 @@ void CQuitScreen::Draw()
zeus::CVector3f{0.f, 0.f, VerticalOffsets[int(x0_type)]}}); zeus::CVector3f{0.f, 0.f, VerticalOffsets[int(x0_type)]}});
} }
void CQuitScreen::ProcessUserInput(const CFinalInput& input) void CQuitGameScreen::ProcessUserInput(const CFinalInput& input)
{ {
if (input.ControllerIdx() != 0) if (input.ControllerIdx() != 0)
return; return;
@ -108,7 +108,7 @@ void CQuitScreen::ProcessUserInput(const CFinalInput& input)
x18_action = EQuitAction::No; x18_action = EQuitAction::No;
} }
CQuitScreen::CQuitScreen(EQuitType tp) CQuitGameScreen::CQuitGameScreen(EQuitType tp)
: x0_type(tp) : x0_type(tp)
{ {
x4_frame = g_SimplePool->GetObj("FRME_QuitScreen"); x4_frame = g_SimplePool->GetObj("FRME_QuitScreen");

View File

@ -1,5 +1,5 @@
#ifndef __URDE_CQUITSCREEN_HPP__ #ifndef __URDE_CQUITGAMESCREEN_HPP__
#define __URDE_CQUITSCREEN_HPP__ #define __URDE_CQUITGAMESCREEN_HPP__
#include "RetroTypes.hpp" #include "RetroTypes.hpp"
#include "CToken.hpp" #include "CToken.hpp"
@ -31,7 +31,7 @@ enum class EQuitAction
No No
}; };
class CQuitScreen class CQuitGameScreen
{ {
EQuitType x0_type; EQuitType x0_type;
TLockedToken<CGuiFrame> x4_frame; TLockedToken<CGuiFrame> x4_frame;
@ -47,10 +47,10 @@ public:
EQuitAction Update(float dt); EQuitAction Update(float dt);
void Draw(); void Draw();
void ProcessUserInput(const CFinalInput& input); void ProcessUserInput(const CFinalInput& input);
CQuitScreen(EQuitType pos); CQuitGameScreen(EQuitType pos);
}; };
} }
} }
#endif // __URDE_CQUITSCREEN_HPP__ #endif // __URDE_CQUITGAMESCREEN_HPP__

View File

@ -0,0 +1,15 @@
#include "CSamusFaceReflection.hpp"
namespace urde
{
namespace MP1
{
CSamusFaceReflection::CSamusFaceReflection(CStateManager& stateMgr)
: x4c_lights(8, zeus::CVector3f::skZero, 4, 4, false, 0, 0, 0.1f)
{
}
}
}

View File

@ -0,0 +1,23 @@
#ifndef __URDE_CSAMUSFACEREFLECTION_HPP__
#define __URDE_CSAMUSFACEREFLECTION_HPP__
#include "Character/CModelData.hpp"
#include "Character/CActorLights.hpp"
namespace urde
{
namespace MP1
{
class CSamusFaceReflection
{
CModelData x0_modelData;
CActorLights x4c_lights;
public:
CSamusFaceReflection(CStateManager& stateMgr);
};
}
}
#endif // __URDE_CSAMUSFACEREFLECTION_HPP__

24
Runtime/MP1/CSamusHud.cpp Normal file
View File

@ -0,0 +1,24 @@
#include "CSamusHud.hpp"
namespace urde
{
namespace MP1
{
CSamusHud::CSamusHud(CStateManager& stateMgr)
{
}
bool CSamusHud::CheckLoadComplete(CStateManager& stateMgr)
{
return false;
}
void CSamusHud::Touch()
{
}
}
}

25
Runtime/MP1/CSamusHud.hpp Normal file
View File

@ -0,0 +1,25 @@
#ifndef __URDE_CSAMUSHUD_HPP__
#define __URDE_CSAMUSHUD_HPP__
namespace urde
{
class CGuiFrame;
class CStateManager;
namespace MP1
{
class CSamusHud
{
friend class CInGameGuiManager;
CGuiFrame* x274_loadedBaseHud = nullptr;
public:
CSamusHud(CStateManager& stateMgr);
bool CheckLoadComplete(CStateManager& stateMgr);
void Touch();
};
}
}
#endif // __URDE_CSAMUSHUD_HPP__

View File

@ -1,4 +1,4 @@
#include "CSaveUI.hpp" #include "CSaveGameScreen.hpp"
#include "CSimplePool.hpp" #include "CSimplePool.hpp"
#include "GameGlobalObjects.hpp" #include "GameGlobalObjects.hpp"
#include "CMemoryCardSys.hpp" #include "CMemoryCardSys.hpp"
@ -17,7 +17,7 @@ namespace MP1
using EState = CMemoryCardDriver::EState; using EState = CMemoryCardDriver::EState;
using EError = CMemoryCardDriver::EError; using EError = CMemoryCardDriver::EError;
void CSaveUI::ResetCardDriver() void CSaveGameScreen::ResetCardDriver()
{ {
x92_savingDisabled = false; x92_savingDisabled = false;
x6c_cardDriver.reset(); x6c_cardDriver.reset();
@ -28,7 +28,7 @@ void CSaveUI::ResetCardDriver()
SetUIText(); SetUIText();
} }
CIOWin::EMessageReturn CSaveUI::Update(float dt) CIOWin::EMessageReturn CSaveGameScreen::Update(float dt)
{ {
if (!PumpLoad()) if (!PumpLoad())
return CIOWin::EMessageReturn::Normal; return CIOWin::EMessageReturn::Normal;
@ -100,7 +100,7 @@ CIOWin::EMessageReturn CSaveUI::Update(float dt)
return CIOWin::EMessageReturn::Normal; return CIOWin::EMessageReturn::Normal;
} }
bool CSaveUI::PumpLoad() bool CSaveGameScreen::PumpLoad()
{ {
if (x50_loadedFrame) if (x50_loadedFrame)
return true; return true;
@ -128,9 +128,9 @@ bool CSaveUI::PumpLoad()
x68_textpane_choice3 = static_cast<CGuiTextPane*>(x50_loadedFrame->FindWidget("textpane_choice3")); x68_textpane_choice3 = static_cast<CGuiTextPane*>(x50_loadedFrame->FindWidget("textpane_choice3"));
x58_tablegroup_choices->SetMenuAdvanceCallback( x58_tablegroup_choices->SetMenuAdvanceCallback(
std::bind(&CSaveUI::DoAdvance, this, std::placeholders::_1)); std::bind(&CSaveGameScreen::DoAdvance, this, std::placeholders::_1));
x58_tablegroup_choices->SetMenuSelectionChangeCallback( x58_tablegroup_choices->SetMenuSelectionChangeCallback(
std::bind(&CSaveUI::DoSelectionChange, this, std::placeholders::_1, std::placeholders::_2)); std::bind(&CSaveGameScreen::DoSelectionChange, this, std::placeholders::_1, std::placeholders::_2));
if (x0_saveCtx == ESaveContext::InGame) if (x0_saveCtx == ESaveContext::InGame)
x6c_cardDriver->StartCardProbe(); x6c_cardDriver->StartCardProbe();
@ -140,7 +140,7 @@ bool CSaveUI::PumpLoad()
return true; return true;
} }
CSaveUI::EUIType CSaveUI::SelectUIType() const CSaveGameScreen::EUIType CSaveGameScreen::SelectUIType() const
{ {
if (x6c_cardDriver->x10_state == EState::NoCard) if (x6c_cardDriver->x10_state == EState::NoCard)
return EUIType::NoCardFound; return EUIType::NoCardFound;
@ -196,7 +196,7 @@ CSaveUI::EUIType CSaveUI::SelectUIType() const
return EUIType::Empty; return EUIType::Empty;
} }
void CSaveUI::SetUIText() void CSaveGameScreen::SetUIText()
{ {
x91_uiTextDirty = false; x91_uiTextDirty = false;
@ -350,25 +350,25 @@ void CSaveUI::SetUIText()
SetUIColors(); SetUIColors();
} }
void CSaveUI::SetUIColors() void CSaveGameScreen::SetUIColors()
{ {
x58_tablegroup_choices->SetColors(zeus::CColor::skWhite, x58_tablegroup_choices->SetColors(zeus::CColor::skWhite,
zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f}); zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f});
} }
void CSaveUI::Draw() const void CSaveGameScreen::Draw() const
{ {
if (x50_loadedFrame) if (x50_loadedFrame)
x50_loadedFrame->Draw(CGuiWidgetDrawParms::Default); x50_loadedFrame->Draw(CGuiWidgetDrawParms::Default);
} }
void CSaveUI::ContinueWithoutSaving() void CSaveGameScreen::ContinueWithoutSaving()
{ {
x80_iowRet = CIOWin::EMessageReturn::RemoveIOWin; x80_iowRet = CIOWin::EMessageReturn::RemoveIOWin;
g_GameState->SetCardSerial(0); g_GameState->SetCardSerial(0);
} }
void CSaveUI::DoAdvance(CGuiTableGroup* caller) void CSaveGameScreen::DoAdvance(CGuiTableGroup* caller)
{ {
int userSel = x58_tablegroup_choices->GetUserSelection(); int userSel = x58_tablegroup_choices->GetUserSelection();
int sfx = -1; int sfx = -1;
@ -610,13 +610,13 @@ void CSaveUI::DoAdvance(CGuiTableGroup* caller)
CSfxManager::SfxStart(sfx, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(sfx, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
} }
void CSaveUI::DoSelectionChange(CGuiTableGroup* caller, int userSel) void CSaveGameScreen::DoSelectionChange(CGuiTableGroup* caller, int userSel)
{ {
SetUIColors(); SetUIColors();
CSfxManager::SfxStart(x88_navMoveSfx, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(x88_navMoveSfx, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
} }
void CSaveUI::ProcessUserInput(const CFinalInput& input) void CSaveGameScreen::ProcessUserInput(const CFinalInput& input)
{ {
if (x50_loadedFrame) if (x50_loadedFrame)
{ {
@ -632,7 +632,7 @@ void CSaveUI::ProcessUserInput(const CFinalInput& input)
} }
} }
void CSaveUI::StartGame(int idx) void CSaveGameScreen::StartGame(int idx)
{ {
const CGameState::GameFileStateInfo* info = x6c_cardDriver->GetGameFileStateInfo(idx); const CGameState::GameFileStateInfo* info = x6c_cardDriver->GetGameFileStateInfo(idx);
x6c_cardDriver->ExportPersistentOptions(); x6c_cardDriver->ExportPersistentOptions();
@ -643,7 +643,7 @@ void CSaveUI::StartGame(int idx)
x80_iowRet = CIOWin::EMessageReturn::Exit; x80_iowRet = CIOWin::EMessageReturn::Exit;
} }
void CSaveUI::SaveNESState() void CSaveGameScreen::SaveNESState()
{ {
if (!x92_savingDisabled) if (!x92_savingDisabled)
{ {
@ -653,19 +653,19 @@ void CSaveUI::SaveNESState()
} }
} }
void CSaveUI::EraseGame(int idx) void CSaveGameScreen::EraseGame(int idx)
{ {
x6c_cardDriver->EraseFileSlot(idx); x6c_cardDriver->EraseFileSlot(idx);
x90_needsDriverReset = true; x90_needsDriverReset = true;
x6c_cardDriver->StartFileCreateTransactional(); x6c_cardDriver->StartFileCreateTransactional();
} }
const CGameState::GameFileStateInfo* CSaveUI::GetGameData(int idx) const const CGameState::GameFileStateInfo* CSaveGameScreen::GetGameData(int idx) const
{ {
return x6c_cardDriver->GetGameFileStateInfo(idx); return x6c_cardDriver->GetGameFileStateInfo(idx);
} }
CSaveUI::CSaveUI(ESaveContext saveCtx, u64 serial) CSaveGameScreen::CSaveGameScreen(ESaveContext saveCtx, u64 serial)
: x0_saveCtx(saveCtx), x8_serial(serial), m_touchBar(NewSaveUITouchBar()) : x0_saveCtx(saveCtx), x8_serial(serial), m_touchBar(NewSaveUITouchBar())
{ {
x14_txtrSaveBanner = g_SimplePool->GetObj("TXTR_SaveBanner"); x14_txtrSaveBanner = g_SimplePool->GetObj("TXTR_SaveBanner");
@ -692,7 +692,7 @@ CSaveUI::CSaveUI(ESaveContext saveCtx, u64 serial)
} }
} }
std::unique_ptr<CMemoryCardDriver> CSaveUI::ConstructCardDriver(bool importPersistent) std::unique_ptr<CMemoryCardDriver> CSaveGameScreen::ConstructCardDriver(bool importPersistent)
{ {
return std::make_unique<CMemoryCardDriver>(kabufuda::ECardSlot::SlotA, return std::make_unique<CMemoryCardDriver>(kabufuda::ECardSlot::SlotA,
g_ResFactory->GetResourceIdByName("TXTR_SaveBanner")->id, g_ResFactory->GetResourceIdByName("TXTR_SaveBanner")->id,

View File

@ -5,7 +5,7 @@
#include "CToken.hpp" #include "CToken.hpp"
#include "CIOWin.hpp" #include "CIOWin.hpp"
#include "CMemoryCardDriver.hpp" #include "CMemoryCardDriver.hpp"
#include "CSaveUITouchBar.hpp" #include "CSaveGameScreenTouchBar.hpp"
namespace urde namespace urde
{ {
@ -26,7 +26,7 @@ enum class ESaveContext
InGame InGame
}; };
class CSaveUI class CSaveGameScreen
{ {
public: public:
enum class EUIType enum class EUIType
@ -91,7 +91,7 @@ private:
bool x92_savingDisabled = false; bool x92_savingDisabled = false;
bool x93_inGame; bool x93_inGame;
std::unique_ptr<CSaveUITouchBar> m_touchBar; std::unique_ptr<CSaveGameScreenTouchBar> m_touchBar;
void ContinueWithoutSaving(); void ContinueWithoutSaving();
@ -116,7 +116,7 @@ public:
const CGameState::GameFileStateInfo* GetGameData(int idx) const; const CGameState::GameFileStateInfo* GetGameData(int idx) const;
EUIType GetUIType() const { return x10_uiType; } EUIType GetUIType() const { return x10_uiType; }
bool IsSavingDisabled() const { return x92_savingDisabled; } bool IsSavingDisabled() const { return x92_savingDisabled; }
CSaveUI(ESaveContext saveCtx, u64 serial); CSaveGameScreen(ESaveContext saveCtx, u64 serial);
}; };
} }

View File

@ -0,0 +1,21 @@
#include "CSaveGameScreenTouchBar.hpp"
namespace urde
{
namespace MP1
{
int CSaveGameScreenTouchBar::PopOption() { return -1; }
void CSaveGameScreenTouchBar::SetUIOpts(const std::u16string& opt0,
const std::u16string& opt1,
const std::u16string& opt2) {}
#ifndef __APPLE__
std::unique_ptr<CSaveGameScreenTouchBar> NewSaveUITouchBar()
{
return std::make_unique<CSaveGameScreenTouchBar>();
}
#endif
}
}

View File

@ -10,17 +10,17 @@ namespace urde
namespace MP1 namespace MP1
{ {
class CSaveUITouchBar class CSaveGameScreenTouchBar
{ {
public: public:
virtual ~CSaveUITouchBar() = default; virtual ~CSaveGameScreenTouchBar() = default;
virtual int PopOption(); virtual int PopOption();
virtual void SetUIOpts(const std::u16string& opt0, virtual void SetUIOpts(const std::u16string& opt0,
const std::u16string& opt1, const std::u16string& opt1,
const std::u16string& opt2); const std::u16string& opt2);
}; };
std::unique_ptr<CSaveUITouchBar> NewSaveUITouchBar(); std::unique_ptr<CSaveGameScreenTouchBar> NewSaveUITouchBar();
} }
} }

View File

@ -1,5 +1,5 @@
#include <AppKit/AppKit.h> #include <AppKit/AppKit.h>
#include "CSaveUITouchBar.hpp" #include "CSaveGameScreenTouchBar.hpp"
#include "GameGlobalObjects.hpp" #include "GameGlobalObjects.hpp"
#include "MP1/MP1.hpp" #include "MP1/MP1.hpp"
@ -7,7 +7,7 @@
#error ARC Required #error ARC Required
#endif #endif
@interface SaveUITouchBar : NSObject <NSTouchBarDelegate> @interface SaveGameScreenTouchBar : NSObject <NSTouchBarDelegate>
{ {
@public @public
NSString* _opts[3]; NSString* _opts[3];
@ -18,7 +18,7 @@
-(IBAction)onOpt2:(id)sender; -(IBAction)onOpt2:(id)sender;
@end @end
@implementation SaveUITouchBar @implementation SaveGameScreenTouchBar
- (NSTouchBar*)makeTouchBar - (NSTouchBar*)makeTouchBar
{ {
NSTouchBar* touchBar = [NSTouchBar new]; NSTouchBar* touchBar = [NSTouchBar new];
@ -89,13 +89,13 @@ namespace urde
namespace MP1 namespace MP1
{ {
class CSaveUITouchBarMac : public CSaveUITouchBar class CSaveGameScreenTouchBarMac : public CSaveGameScreenTouchBar
{ {
SaveUITouchBar* m_touchBar; SaveGameScreenTouchBar* m_touchBar;
public: public:
CSaveUITouchBarMac() CSaveGameScreenTouchBarMac()
{ {
m_touchBar = [SaveUITouchBar new]; m_touchBar = [SaveGameScreenTouchBar new];
m_touchBar->_opt = -1; m_touchBar->_opt = -1;
} }
int PopOption() int PopOption()
@ -119,9 +119,9 @@ public:
} }
}; };
std::unique_ptr<CSaveUITouchBar> NewSaveUITouchBar() std::unique_ptr<CSaveGameScreenTouchBar> NewSaveUITouchBar()
{ {
return std::make_unique<CSaveUITouchBarMac>(); return std::make_unique<CSaveGameScreenTouchBarMac>();
} }
} }

View File

@ -1,21 +0,0 @@
#include "CSaveUITouchBar.hpp"
namespace urde
{
namespace MP1
{
int CSaveUITouchBar::PopOption() { return -1; }
void CSaveUITouchBar::SetUIOpts(const std::u16string& opt0,
const std::u16string& opt1,
const std::u16string& opt2) {}
#ifndef __APPLE__
std::unique_ptr<CSaveUITouchBar> NewSaveUITouchBar()
{
return std::make_unique<CSaveUITouchBar>();
}
#endif
}
}

View File

@ -1,7 +1,7 @@
#ifndef __URDE_CHEALTHINFO_HPP__ #ifndef __URDE_CHEALTHINFO_HPP__
#define __URDE_CHEALTHINFO_HPP__ #define __URDE_CHEALTHINFO_HPP__
#include "RetroTypes.hpp" #include "Runtime/RetroTypes.hpp"
namespace urde namespace urde
{ {

View File

@ -21,9 +21,15 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox&
const CMaterialList& ml) const CMaterialList& ml)
: CPhysicsActor(uid, true, "CPlayer", CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList), xf, : CPhysicsActor(uid, true, "CPlayer", CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList), xf,
MakePlayerAnimRes(resId, playerScale), ml, aabb, SMoverData(mass), CActorParameters::None(), stepUp, MakePlayerAnimRes(resId, playerScale), ml, aabb, SMoverData(mass), CActorParameters::None(), stepUp,
stepDown) stepDown), x7d0_animRes(resId, 0, playerScale, 0, true)
{ {
x768_morphball.reset(new CMorphBall(*this, f4)); x768_morphball.reset(new CMorphBall(*this, f4));
x9c4_26_ = true;
x9c4_27_ = true;
x9c4_28_ = true;
x9c5_31_ = true;
ResId beamId = g_tweakPlayerRes->GetBeamBallTransitionModel(x7ec_);
x7f0_ballTransitionBeamModel = std::make_unique<CModelData>(CStaticRes(beamId, playerScale));
} }
bool CPlayer::IsTransparent() const { return x588_alpha < 1.f; } bool CPlayer::IsTransparent() const { return x588_alpha < 1.f; }
@ -320,7 +326,7 @@ void CPlayer::CVisorSteam::SetSteam(float a, float b, float c, ResId d, bool e)
x28_ = e; x28_ = e;
} }
ResId CPlayer::CVisorSteam::GetTextureId() const { return xc_; } ResId CPlayer::CVisorSteam::GetTextureId() const { return xc_tex; }
void CPlayer::CVisorSteam::Update(float dt) void CPlayer::CVisorSteam::Update(float dt)
{ {
@ -331,19 +337,19 @@ void CPlayer::CVisorSteam::Update(float dt)
x0_ = x10_; x0_ = x10_;
x4_ = x14_; x4_ = x14_;
x8_ = x18_; x8_ = x18_;
xc_ = x1c_; xc_tex = x1c_;
} }
x1c_ = -1; x1c_ = -1;
if ((x20_ - x0_) < 0.000009999f || std::fabs(x20_) > 0.000009999f) if ((x20_alpha - x0_) < 0.000009999f || std::fabs(x20_alpha) > 0.000009999f)
return; return;
if (x20_ > x0_) if (x20_alpha > x0_)
{ {
if (x24_ <= 0.f) if (x24_ <= 0.f)
{ {
x20_ -= (dt / x8_); x20_alpha -= (dt / x8_);
x20_ = std::min(x20_, x0_); x20_alpha = std::min(x20_alpha, x0_);
} }
else else
{ {
@ -353,13 +359,13 @@ void CPlayer::CVisorSteam::Update(float dt)
return; return;
} }
CToken tmpTex = g_SimplePool->GetObj({SBIG('TXTR'), xc_}); CToken tmpTex = g_SimplePool->GetObj({SBIG('TXTR'), xc_tex});
if (!tmpTex) if (!tmpTex)
return; return;
x20_ += (x20_ + (dt / x4_)); x20_alpha += (x20_alpha + (dt / x4_));
if (x20_ > x0_) if (x20_alpha > x0_)
x20_ = x0_; x20_alpha = x0_;
x24_ = 0.1f; x24_ = 0.1f;
} }

View File

@ -6,6 +6,8 @@
#include "zeus/CTransform.hpp" #include "zeus/CTransform.hpp"
#include "Weapon/CWeaponMgr.hpp" #include "Weapon/CWeaponMgr.hpp"
#include "CPlayerEnergyDrain.hpp" #include "CPlayerEnergyDrain.hpp"
#include "Weapon/CPlayerGun.hpp"
#include "CMorphBall.hpp"
namespace urde namespace urde
{ {
@ -59,21 +61,21 @@ private:
float x0_; float x0_;
float x4_; float x4_;
float x8_; float x8_;
ResId xc_; ResId xc_tex;
float x10_ = 0.f; float x10_ = 0.f;
float x14_ = 0.f; float x14_ = 0.f;
float x18_ = 0.f; float x18_ = 0.f;
ResId x1c_ = -1; ResId x1c_ = -1;
float x20_ = 0.f; float x20_alpha = 0.f;
float x24_ = 0.f; float x24_ = 0.f;
bool x28_ = false; bool x28_ = false;
public: public:
CVisorSteam(float a, float b, float c, ResId tex) : x0_(a), x4_(b), x8_(c), xc_(tex) {} CVisorSteam(float a, float b, float c, ResId tex) : x0_(a), x4_(b), x8_(c), xc_tex(tex) {}
ResId GetTextureId() const; ResId GetTextureId() const;
void SetSteam(float a, float b, float c, ResId d, bool e); void SetSteam(float a, float b, float c, ResId d, bool e);
void Update(float dt); void Update(float dt);
float GetAlpha() const; float GetAlpha() const { return x20_alpha; }
}; };
zeus::CVector3f x1b4_; zeus::CVector3f x1b4_;
TUniqueId x1c4_ = kInvalidUniqueId; TUniqueId x1c4_ = kInvalidUniqueId;
@ -126,7 +128,7 @@ private:
float x380_ = 0.f; float x380_ = 0.f;
float x384_ = 0.f; float x384_ = 0.f;
float x388_ = 0.f; float x388_ = 0.f;
bool x38c_; bool x38c_ = false;
u32 x390_ = 2; u32 x390_ = 2;
u8 x394_ = 0; u8 x394_ = 0;
float x398_ = 1.5f; float x398_ = 1.5f;
@ -149,9 +151,9 @@ private:
bool x3dc_ = 0; bool x3dc_ = 0;
bool x3dd_ = 0; bool x3dd_ = 0;
bool x3de_ = 0; bool x3de_ = 0;
float x3e4_; float x3e4_ = 0.f;
float x3e8_; float x3e8_ = 0.f;
float x3ec_; float x3ec_ = 0.f;
float x3f0_ = 0.f; float x3f0_ = 0.f;
TUniqueId x3f4_ = kInvalidUniqueId; TUniqueId x3f4_ = kInvalidUniqueId;
zeus::CVector3f x3f8_ = zeus::CVector3f::skZero; zeus::CVector3f x3f8_ = zeus::CVector3f::skZero;
@ -163,37 +165,125 @@ private:
float x49c_; /* Value retrieved from TweakPlayerGun */ float x49c_; /* Value retrieved from TweakPlayerGun */
// std::unqiue_ptr<> x4a0_; // std::unqiue_ptr<> x4a0_;
u32 x4a4_ = 0; u32 x4a4_ = 0;
bool x558_; float x4f8_ = 0.f;
float x55c_; float x4fc_ = 0.f;
float x560_; float x53c_ = 0.f;
bool x558_ = false;
float x55c_ = 0.f;
float x560_ = 0.f;
zeus::CVector3f x564_; zeus::CVector3f x564_;
float x588_alpha; float x570_ = 0.f;
float x574_ = 0.f;
float x578_ = 0.f;
u32 x57c_ = 0;
u32 x580_ = 0;
float x588_alpha = 1.f;
u32 x594_ = 0;
u32 x658_ = 0;
u32 x71c_ = 0;
u32 x734_ = 0;
u32 x738_ = 0;
u32 x73c_ = 0;
float x740_ = 0.f;
float x744_ = 0.f;
float x748_ = 0.f;
float x74c_ = 1.f;
float x750_ = 0.f;
u32 x754_ = 0;
float x758_ = 0.f;
u32 x75c_ = 0;
u32 x760_ = 0;
float x764_ = 0.f;
std::unique_ptr<CMorphBall> x768_morphball; std::unique_ptr<CMorphBall> x768_morphball;
std::unique_ptr<CPlayerCameraBob> x76c_cameraBob; std::unique_ptr<CPlayerCameraBob> x76c_cameraBob;
CSfxHandle x770_; CSfxHandle x770_;
float x774_; float x774_ = 0.f;
u32 x778_; u32 x778_ = 0;
u32 x77c_; u32 x77c_ = 0;
u32 x780_; u32 x780_ = 0;
float x784_; float x784_ = 0.f;
u16 x88_; u16 x788_ = 0;
u16 x88a_; float x78c_ = 0.f;
float x78c_; u32 x790_ = 0;
u32 x790_; zeus::CVector3f x794_;
float x794_; CVisorSteam x7a0_visorSteam = CVisorSteam(0.f, 0.f, 0.f, -1);
float x798_; ResId x7cc_ = -1;
float x79c_; CAnimRes x7d0_animRes;
CVisorSteam x7a0_ = CVisorSteam(0.f, 0.f, 0.f, -1); CPlayerState::EBeamId x7ec_ = CPlayerState::EBeamId::Power;
float x9f4_; std::unique_ptr<CModelData> x7f0_ballTransitionBeamModel;
TUniqueId xa00_; zeus::CTransform x7f4_;
float xa04_; float x824_ = 0.f;
ResId xa08_steamTextureId; float x828_ = 0.f;
bool x82c_ = false;
TUniqueId x82e_ = kInvalidUniqueId;
TUniqueId x830_ = kInvalidUniqueId;
u32 x834_ = 1000;
u32 x838_ = 0;
u32 x93c_ = 0;
u32 x980_ = 0;
union
{
struct
{
bool x9c4_24_ : 1;
bool x9c4_25_ : 1;
bool x9c4_26_ : 1;
bool x9c4_27_ : 1;
bool x9c4_28_ : 1;
bool x9c4_29_ : 1;
bool x9c4_30_ : 1;
bool x9c4_31_ : 1;
bool x9c5_24_ : 1;
bool x9c5_25_ : 1;
bool x9c5_26_ : 1;
bool x9c5_27_ : 1;
bool x9c5_28_ : 1;
bool x9c5_29_ : 1;
bool x9c5_30_ : 1;
bool x9c5_31_ : 1;
bool x9c6_24_ : 1;
bool x9c6_25_ : 1;
bool x9c6_26_ : 1;
bool x9c6_27_ : 1;
bool x9c6_28_ : 1;
bool x9c6_29_ : 1;
bool x9c6_30_ : 1;
bool x9c6_31_ : 1;
bool x9c7_24_ : 1;
bool x9c7_25_ : 1;
};
u32 _dummy = 0;
};
float x9c8_ = 0.f;
float x9cc_ = 0.f;
u32 x9d0_ = 0;
u32 x9d4_ = 0;
float x9d8_ = 0.f;
float x9dc_ = 1.f;
float x9e0_ = 0.f;
u32 x9e4_ = 0;
float x9f4_ = 0.f;
float x9f8_ = 0.f;
float x9fc_ = 0.f;
TUniqueId xa00_ = kInvalidUniqueId;
float xa04_ = 0.f;
ResId xa08_steamTextureId = -1;
ResId xa0c_; ResId xa0c_;
u32 xa10_; u32 xa10_ = 0;
float xa14_; float xa14_ = 0.f;
float xa18_ = 0.f;
float xa1c_ = 0.f;
float xa20_ = 1.f;
float xa24_ = 1.f;
float xa28_ = 0.f;
u32 xa2c_ = 2;
float xa30_ = 4.f;
public: public:
CPlayer(TUniqueId, const zeus::CTransform&, const zeus::CAABox&, unsigned int, const zeus::CVector3f&, float, float, CPlayer(TUniqueId, const zeus::CTransform&, const zeus::CAABox&, unsigned int w1, const zeus::CVector3f&, float, float,
float, float, const CMaterialList&); float, float, const CMaterialList&);
bool IsTransparent() const; bool IsTransparent() const;
@ -318,6 +408,8 @@ public:
void ComputeMovement(const CFinalInput& input, CStateManager& mgr, float); void ComputeMovement(const CFinalInput& input, CStateManager& mgr, float);
float GetWeight() const; float GetWeight() const;
float GetDampedClampedVelocityWR() const; float GetDampedClampedVelocityWR() const;
const CVisorSteam& GetVisorSteam() const { return x7a0_visorSteam; }
float Get74C() const { return x74c_; }
void Touch(); void Touch();
const std::unique_ptr<CPlayerCameraBob>& GetCameraBob() const { return x76c_cameraBob; } const std::unique_ptr<CPlayerCameraBob>& GetCameraBob() const { return x76c_cameraBob; }

View File

@ -12,6 +12,8 @@
#include "Graphics/CBooRenderer.hpp" #include "Graphics/CBooRenderer.hpp"
#include "Camera/CCameraManager.hpp" #include "Camera/CCameraManager.hpp"
#include "Character/CActorLights.hpp" #include "Character/CActorLights.hpp"
#include "GuiSys/CStringTable.hpp"
#include "Audio/CSfxManager.hpp"
namespace urde namespace urde
{ {
@ -128,8 +130,47 @@ void CWorldTransManager::UpdateEnabled(float dt)
UpdateLights(dt); UpdateLights(dt);
} }
void CWorldTransManager::UpdateText(float) void CWorldTransManager::UpdateText(float dt)
{ {
if (x44_28_textDirty)
{
if (xc_strTable.IsLoaded())
{
x8_textData->SetText(xc_strTable->GetString(x40_strIdx));
x3c_sfxInterval = 0.f;
x44_28_textDirty = false;
}
else if (x0_curTime >= x38_textStartTime)
{
x38_textStartTime += dt;
}
}
if (x0_curTime >= x38_textStartTime)
{
x8_textData->Update(dt);
float nextSfxInterval = x3c_sfxInterval + g_tweakGui->GetWorldTransManagerCharsPerSfx();
if (x8_textData->GetNumCharsPrinted() >= nextSfxInterval)
{
x3c_sfxInterval = nextSfxInterval;
CSfxManager::SfxStart(1438, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
}
}
if (x44_25_stopSoon)
{
if (x8_textData->GetTotalAnimationTime() + 1.f < x8_textData->GetCurTime())
{
/* Done typing + 1 sec */
if (x0_curTime - x34_stopTime > 1.f)
x44_24_transFinished = true;
}
else
{
x34_stopTime = x0_curTime;
}
}
} }
void CWorldTransManager::Update(float dt) void CWorldTransManager::Update(float dt)
@ -266,7 +307,22 @@ void CWorldTransManager::DrawDisabled()
void CWorldTransManager::DrawText() void CWorldTransManager::DrawText()
{ {
g_Renderer->SetViewportOrtho(false, -4096.f, 4096.f);
CGraphics::SetModelMatrix(zeus::CTransform::Translate(0.f, 0.f, 448.f));
x8_textData->Render();
float filterAlpha = 0.f;
if (x0_curTime < 1.f)
filterAlpha = 1.f - x0_curTime;
else if (x44_25_stopSoon)
filterAlpha = std::min(1.f, x0_curTime - x34_stopTime);
if (filterAlpha > 0.f)
{
zeus::CColor filterColor = x44_27_fadeWhite ? zeus::CColor::skWhite : zeus::CColor::skBlack;
filterColor.a = filterAlpha;
m_fadeToBlack.draw(filterColor);
}
} }
void CWorldTransManager::Draw() void CWorldTransManager::Draw()
@ -370,27 +426,34 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes,
TouchModels(); TouchModels();
} }
void CWorldTransManager::EnableTransition(ResId fontId, ResId stringId, bool b1, bool b2, void CWorldTransManager::EnableTransition(ResId fontId, ResId stringId, u32 strIdx, bool fadeWhite,
float chFadeTime, float chFadeRate, float f3) float chFadeTime, float chFadeRate, float textStartTime)
{ {
x40_ = b1; x40_strIdx = strIdx;
x38_ = f3; x38_textStartTime = textStartTime;
x44_25_stopSoon = false; x44_25_stopSoon = false;
x30_type = ETransType::Text; x30_type = ETransType::Text;
x4_modelData.reset(); x4_modelData.reset();
x44_27_ = b2; x44_27_fadeWhite = fadeWhite;
CGuiTextProperties props(false, true, EJustification::Center, EVerticalJustification::Center); CGuiTextProperties props(false, true, EJustification::Center, EVerticalJustification::Center);
x8_textData.reset(new CGuiTextSupport(fontId, props, zeus::CColor::skWhite, x8_textData.reset(new CGuiTextSupport(fontId, props, zeus::CColor::skWhite,
zeus::CColor::skBlack, zeus::CColor::skWhite, zeus::CColor::skBlack, zeus::CColor::skWhite,
640, 448, g_SimplePool, CGuiWidget::EGuiModelDrawFlags::Alpha)); 640, 448, g_SimplePool, CGuiWidget::EGuiModelDrawFlags::Additive));
x8_textData->SetTypeWriteEffectOptions(true, chFadeTime, chFadeRate); x8_textData->SetTypeWriteEffectOptions(true, chFadeTime, chFadeRate);
xc_strTable = g_SimplePool->GetObj(SObjectTag{FOURCC('STRG'), stringId}); xc_strTable = g_SimplePool->GetObj(SObjectTag{FOURCC('STRG'), stringId});
x8_textData->SetText(u""); x8_textData->SetText(u"");
} }
void CWorldTransManager::StartTextFadeOut()
{
if (!x44_25_stopSoon)
x34_stopTime = x0_curTime;
x44_25_stopSoon = true;
}
void CWorldTransManager::DisableTransition() void CWorldTransManager::DisableTransition()
{ {
x4_modelData.reset(); x4_modelData.reset();
@ -403,7 +466,7 @@ void CWorldTransManager::StartTransition()
x0_curTime = 0.f; x0_curTime = 0.f;
x18_bgOffset = 0.f; x18_bgOffset = 0.f;
x44_24_transFinished = false; x44_24_transFinished = false;
x44_28_ = true; x44_28_textDirty = true;
} }
void CWorldTransManager::EndTransition() void CWorldTransManager::EndTransition()
@ -411,4 +474,15 @@ void CWorldTransManager::EndTransition()
DisableTransition(); DisableTransition();
} }
bool CWorldTransManager::WaitForModelsAndTextures()
{
std::vector<SObjectTag> tags = g_SimplePool->GetReferencedTags();
for (const SObjectTag& tag : tags)
{
if (tag.type == FOURCC('TXTR') || tag.type == FOURCC('CMDL'))
g_SimplePool->GetObj(tag).GetObj();
}
return true;
}
} }

View File

@ -65,8 +65,10 @@ private:
u8 x2c_ = 127; u8 x2c_ = 127;
u8 x2d_ = 64; u8 x2d_ = 64;
ETransType x30_type = ETransType::Disabled; ETransType x30_type = ETransType::Disabled;
float x38_ = 0.f; float x34_stopTime;
bool x40_; float x38_textStartTime = 0.f;
float x3c_sfxInterval;
bool x40_strIdx;
union union
{ {
struct struct
@ -74,8 +76,8 @@ private:
bool x44_24_transFinished : 1; bool x44_24_transFinished : 1;
bool x44_25_stopSoon : 1; bool x44_25_stopSoon : 1;
bool x44_26_goingUp : 1; bool x44_26_goingUp : 1;
bool x44_27_ : 1; bool x44_27_fadeWhite : 1;
bool x44_28_ : 1; bool x44_28_textDirty : 1;
}; };
u8 dummy = 0; u8 dummy = 0;
}; };
@ -101,24 +103,26 @@ private:
public: public:
CWorldTransManager() { x44_24_transFinished = true; } CWorldTransManager() { x44_24_transFinished = true; }
void Update(float); void Update(float);
void Draw(); void Draw();
void EnableTransition(const CAnimRes& samusRes, void EnableTransition(const CAnimRes& samusRes,
ResId platRes, const zeus::CVector3f& platScale, ResId platRes, const zeus::CVector3f& platScale,
ResId bgRes, const zeus::CVector3f& bgScale, bool goingUp); ResId bgRes, const zeus::CVector3f& bgScale, bool goingUp);
void EnableTransition(ResId fontId, ResId stringId, bool b1, bool b2, void EnableTransition(ResId fontId, ResId stringId, u32 strIdx, bool fadeWhite,
float chFadeTime, float chFadeRate, float f3); float chFadeTime, float chFadeRate, float textStartTime);
void StartTransition(); void StartTransition();
void EndTransition(); void EndTransition();
bool IsTransitionFinished() const { return x44_24_transFinished; } bool IsTransitionFinished() const { return x44_24_transFinished; }
void PleaseStopSoon() { x44_25_stopSoon = true; } void PleaseStopSoon() { x44_25_stopSoon = true; }
void StartTextFadeOut();
bool IsTransitionEnabled() const { return x30_type != ETransType::Disabled; } bool IsTransitionEnabled() const { return x30_type != ETransType::Disabled; }
void DisableTransition(); void DisableTransition();
void TouchModels(); void TouchModels();
ETransType GetTransType() { return x30_type; } ETransType GetTransType() { return x30_type; }
static bool WaitForModelsAndTextures();
}; };
} }

View File

@ -78,8 +78,10 @@ static SObjectTag MorphballDoorANCS = {};
static const SObjectTag& GetMorphballDoorACS() static const SObjectTag& GetMorphballDoorACS()
{ {
if (!MorphballDoorANCS) if (!MorphballDoorANCS)
MorphballDoorANCS = {
static_cast<ProjectResourceFactoryBase*>(g_ResFactory)->TagFromPath(_S("MP1/Shared/ANCS_1F9DA858.blend")); MorphballDoorANCS.type = FOURCC('ANCS');
MorphballDoorANCS.id = g_ResFactory->TranslateOriginalToNew(0x1F9DA858);
}
return MorphballDoorANCS; return MorphballDoorANCS;
} }

@ -1 +1 @@
Subproject commit ba23dd8d9449076c1ebf7c010c1b45c599456792 Subproject commit 7cb049f093f9d1d91c501fbabfd12009a5bb0995