From a7cab596e64e2f78ba9a8e1a93a65b74a5b898c9 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sat, 11 Feb 2017 17:17:18 -1000 Subject: [PATCH] Initial InGameGuiManager imps --- .../DNACommon/Tweaks/ITweakAutoMapper.hpp | 1 + DataSpec/DNACommon/Tweaks/ITweakGui.hpp | 25 ++- DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp | 14 +- DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp | 3 +- DataSpec/DNAMP1/Tweaks/CTweakGui.hpp | 18 +- DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp | 2 +- DataSpec/SpecMP1.cpp | 12 +- Runtime/AutoMapper/CAutoMapper.cpp | 10 ++ Runtime/AutoMapper/CAutoMapper.hpp | 3 +- Runtime/CDependencyGroup.hpp | 2 +- Runtime/CGameState.cpp | 6 +- Runtime/CGameState.hpp | 3 +- Runtime/CMakeLists.txt | 2 +- Runtime/CMemoryCardSys.hpp | 1 + Runtime/CSimplePool.cpp | 9 + Runtime/CSimplePool.hpp | 1 + Runtime/CStateManager.hpp | 58 +++++- Runtime/Camera/CFirstPersonCamera.cpp | 2 +- Runtime/GuiSys/CGuiFrame.hpp | 1 + Runtime/GuiSys/CGuiObject.hpp | 1 + Runtime/GuiSys/CGuiTextSupport.hpp | 1 + Runtime/MP1/CFaceplateDecoration.cpp | 53 ++++++ Runtime/MP1/CFaceplateDecoration.hpp | 29 +++ Runtime/MP1/CFrontEndUI.cpp | 64 ++++--- Runtime/MP1/CFrontEndUI.hpp | 26 +-- Runtime/MP1/CInGameGuiManager.cpp | 170 ++++++++++++++++++ Runtime/MP1/CInGameGuiManager.hpp | 118 ++++++++++++ Runtime/MP1/CMFGame.cpp | 70 +++++++- Runtime/MP1/CMFGame.hpp | 3 +- Runtime/MP1/CMainFlow.cpp | 4 +- Runtime/MP1/CMakeLists.txt | 15 +- Runtime/MP1/CMemoryCardDriver.hpp | 2 +- Runtime/MP1/CMessageScreen.cpp | 0 Runtime/MP1/CMessageScreen.hpp | 18 ++ Runtime/MP1/CPauseScreen.cpp | 19 ++ Runtime/MP1/CPauseScreen.hpp | 19 ++ Runtime/MP1/CPlayerVisor.cpp | 14 ++ Runtime/MP1/CPlayerVisor.hpp | 20 +++ .../{CQuitScreen.cpp => CQuitGameScreen.cpp} | 22 +-- .../{CQuitScreen.hpp => CQuitGameScreen.hpp} | 10 +- Runtime/MP1/CSamusFaceReflection.cpp | 15 ++ Runtime/MP1/CSamusFaceReflection.hpp | 23 +++ Runtime/MP1/CSamusHud.cpp | 24 +++ Runtime/MP1/CSamusHud.hpp | 25 +++ .../MP1/{CSaveUI.cpp => CSaveGameScreen.cpp} | 40 ++--- .../MP1/{CSaveUI.hpp => CSaveGameScreen.hpp} | 8 +- Runtime/MP1/CSaveGameScreenTouchBar.cpp | 21 +++ ...uchBar.hpp => CSaveGameScreenTouchBar.hpp} | 6 +- ...arMac.mm => CSaveGameScreenTouchBarMac.mm} | 18 +- Runtime/MP1/CSaveUITouchBar.cpp | 21 --- Runtime/World/CHealthInfo.hpp | 2 +- Runtime/World/CPlayer.cpp | 28 +-- Runtime/World/CPlayer.hpp | 156 ++++++++++++---- Runtime/World/CWorldTransManager.cpp | 90 +++++++++- Runtime/World/CWorldTransManager.hpp | 18 +- Runtime/World/ScriptLoader.cpp | 6 +- specter | 2 +- 57 files changed, 1133 insertions(+), 221 deletions(-) create mode 100644 Runtime/MP1/CFaceplateDecoration.cpp create mode 100644 Runtime/MP1/CFaceplateDecoration.hpp create mode 100644 Runtime/MP1/CInGameGuiManager.cpp create mode 100644 Runtime/MP1/CInGameGuiManager.hpp create mode 100644 Runtime/MP1/CMessageScreen.cpp create mode 100644 Runtime/MP1/CMessageScreen.hpp create mode 100644 Runtime/MP1/CPauseScreen.cpp create mode 100644 Runtime/MP1/CPauseScreen.hpp create mode 100644 Runtime/MP1/CPlayerVisor.cpp create mode 100644 Runtime/MP1/CPlayerVisor.hpp rename Runtime/MP1/{CQuitScreen.cpp => CQuitGameScreen.cpp} (82%) rename Runtime/MP1/{CQuitScreen.hpp => CQuitGameScreen.hpp} (84%) create mode 100644 Runtime/MP1/CSamusFaceReflection.cpp create mode 100644 Runtime/MP1/CSamusFaceReflection.hpp create mode 100644 Runtime/MP1/CSamusHud.cpp create mode 100644 Runtime/MP1/CSamusHud.hpp rename Runtime/MP1/{CSaveUI.cpp => CSaveGameScreen.cpp} (94%) rename Runtime/MP1/{CSaveUI.hpp => CSaveGameScreen.hpp} (94%) create mode 100644 Runtime/MP1/CSaveGameScreenTouchBar.cpp rename Runtime/MP1/{CSaveUITouchBar.hpp => CSaveGameScreenTouchBar.hpp} (74%) rename Runtime/MP1/{CSaveUITouchBarMac.mm => CSaveGameScreenTouchBarMac.mm} (88%) delete mode 100644 Runtime/MP1/CSaveUITouchBar.cpp diff --git a/DataSpec/DNACommon/Tweaks/ITweakAutoMapper.hpp b/DataSpec/DNACommon/Tweaks/ITweakAutoMapper.hpp index 7e7e89433..237b46097 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakAutoMapper.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakAutoMapper.hpp @@ -8,6 +8,7 @@ namespace DataSpec struct ITweakAutoMapper : public ITweak { virtual const zeus::CVector3f& GetDoorCenter() const=0; + virtual float GetCamVerticalOffset() const=0; }; } diff --git a/DataSpec/DNACommon/Tweaks/ITweakGui.hpp b/DataSpec/DNACommon/Tweaks/ITweakGui.hpp index 09c3a2616..89d9768b6 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakGui.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakGui.hpp @@ -9,10 +9,33 @@ namespace DataSpec struct ITweakGui : ITweak { - virtual float GetScanAppearanceOffset() const = 0; + 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 GetScanSpeed(int idx) const=0; virtual float GetXrayBlurScaleLinear() const=0; virtual float GetXrayBlurScaleQuadratic() const=0; + virtual float GetWorldTransManagerCharsPerSfx() const=0; }; } diff --git a/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp b/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp index 2719e3ea8..7cc674a36 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp @@ -3,6 +3,7 @@ #include "ITweak.hpp" #include "Runtime/IFactory.hpp" +#include "Runtime/CPlayerState.hpp" namespace DataSpec { @@ -10,14 +11,7 @@ namespace DataSpec struct ITweakPlayerRes : ITweak { using ResId = int64_t; - enum class EBeamId - { - Power, - Ice, - Plasma, - Wave, - Phazon - }; + using EBeamId = urde::CPlayerState::EBeamId; ResId x4_saveStationIcon; ResId x8_missileStationIcon; @@ -132,7 +126,7 @@ struct ITweakPlayerRes : ITweak xc4_ballTransitionsANCS = factory.GetResourceIdByName(GetBallTransitionsANCS().c_str())->id; 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) 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& 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 float GetUnkFloat() const=0; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp b/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp index 23b7bc72d..f7bb90f3c 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp @@ -70,7 +70,7 @@ struct CTweakAutoMapper : public ITweakAutoMapper Value xe0_; Value xe4_; Value xe8_; - Value xec_; + Value xec_camVerticalOffset; DNAColor xf0_; DNAColor xf4_; DNAColor xf8_; @@ -83,6 +83,7 @@ struct CTweakAutoMapper : public ITweakAutoMapper CTweakAutoMapper() = default; CTweakAutoMapper(athena::io::IStreamReader& r) { this->read(r); } const zeus::CVector3f& GetDoorCenter() const { return xa4_doorCenter; } + float GetCamVerticalOffset() const { return xec_camVerticalOffset; } }; } } diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp index 76b443c50..7b76481b6 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp @@ -67,12 +67,12 @@ struct CTweakGui : ITweakGui Value xec_; Value xf0_; Value xf4_; - Value xf8_; - Value xfc_; - Value x100_; + Value xf8_hudVisMode; + Value xfc_helmetVisMode; + Value x100_enableAutoMapper; Value x104_; - Value x108_; - Value x10c_; + Value x108_enableTargetingManager; + Value x10c_enablePlayerVisor; Value x110_; Value x114_; Value x118_; @@ -150,7 +150,7 @@ struct CTweakGui : ITweakGui Value x270_; Value x274_; bool x275_ = true; - Value x278_; + Value x278_wtMgrCharsPerSfx; Value x27c_; Value x280_; Value x284_; @@ -195,9 +195,15 @@ struct CTweakGui : ITweakGui CTweakGui() = default; 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 GetXrayBlurScaleLinear() const { return x204_xrayBlurScaleLinear; } float GetXrayBlurScaleQuadratic() const { return x208_xrayBlurScaleQuadratic; } + float GetWorldTransManagerCharsPerSfx() const { return x278_wtMgrCharsPerSfx; } float GetScanSpeed(int idx) const { diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp index 04bf04469..2626d9faf 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp @@ -94,7 +94,7 @@ struct CTweakPlayerRes : ITweakPlayerRes 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]; } float GetUnkFloat() const { return m_unkFloat; } diff --git a/DataSpec/SpecMP1.cpp b/DataSpec/SpecMP1.cpp index b0979dc12..d9c02e7d4 100644 --- a/DataSpec/SpecMP1.cpp +++ b/DataSpec/SpecMP1.cpp @@ -53,10 +53,18 @@ struct OriginalIDs { static void Generate(PAKRouter& pakRouter, hecl::Database::Project& project) { + std::unordered_set addedIDs; std::vector originalIDs; pakRouter.enumerateResources([&](const DNAMP1::PAK::Entry* ent) -> bool { - if (ent->type == FOURCC('MLVL') || ent->type == FOURCC('SCAN')) - originalIDs.push_back(ent->id); + 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); + } + } return true; }); std::sort(originalIDs.begin(), originalIDs.end()); diff --git a/Runtime/AutoMapper/CAutoMapper.cpp b/Runtime/AutoMapper/CAutoMapper.cpp index 0b1dcad29..0bbd7448d 100644 --- a/Runtime/AutoMapper/CAutoMapper.cpp +++ b/Runtime/AutoMapper/CAutoMapper.cpp @@ -3,4 +3,14 @@ namespace urde { +CAutoMapper::CAutoMapper(CStateManager& stateMgr) +{ + +} + +bool CAutoMapper::CheckLoadComplete() +{ + return false; +} + } diff --git a/Runtime/AutoMapper/CAutoMapper.hpp b/Runtime/AutoMapper/CAutoMapper.hpp index 9b9c08894..e2cce8d70 100644 --- a/Runtime/AutoMapper/CAutoMapper.hpp +++ b/Runtime/AutoMapper/CAutoMapper.hpp @@ -6,6 +6,7 @@ #include "zeus/CQuaternion.hpp" #include "zeus/CTransform.hpp" #include "zeus/CVector3f.hpp" +#include "MP1/CInGameGuiManager.hpp" namespace urde { @@ -13,10 +14,10 @@ class CFinalInput; class IWorld; class CMapWorldInfo; class CStateManager; -enum class EInGameGuiState; class CAutoMapper { public: + using EInGameGuiState = MP1::EInGameGuiState; enum class EAutoMapperState { }; diff --git a/Runtime/CDependencyGroup.hpp b/Runtime/CDependencyGroup.hpp index c70d57695..d130cc20a 100644 --- a/Runtime/CDependencyGroup.hpp +++ b/Runtime/CDependencyGroup.hpp @@ -11,7 +11,7 @@ class CDependencyGroup public: CDependencyGroup(CInputStream& in); void ReadFromStream(CInputStream& in); - std::vector GetObjectTagVector() const { return x0_objectTags; } + const std::vector& GetObjectTagVector() const { return x0_objectTags; } }; CFactoryFnReturn FDependencyGroupFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param, diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index f93f916ba..dacaaf1af 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -79,7 +79,7 @@ CWorldState::CWorldState(ResId id) { x8_relayTracker = std::make_shared(); xc_mapWorldInfo = std::make_shared(); - x10_ = -1; + x10_desiredAreaAssetId = -1; x14_layerState = std::make_shared(); } @@ -87,7 +87,7 @@ CWorldState::CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorl : x0_mlvlId(mlvlId) { x4_areaId = reader.ReadEncoded(32); - x10_ = reader.ReadEncoded(32); + x10_desiredAreaAssetId = reader.ReadEncoded(32); x8_relayTracker = std::make_shared(reader, saveWorld); xc_mapWorldInfo = std::make_shared(reader, saveWorld, mlvlId); x14_layerState = std::make_shared(reader, saveWorld); @@ -96,7 +96,7 @@ CWorldState::CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorl void CWorldState::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw) const { writer.WriteEncoded(x4_areaId, 32); - writer.WriteEncoded(x10_, 32); + writer.WriteEncoded(x10_desiredAreaAssetId, 32); x8_relayTracker->PutTo(writer, savw); xc_mapWorldInfo->PutTo(writer, savw, x0_mlvlId); x14_layerState->PutTo(writer); diff --git a/Runtime/CGameState.hpp b/Runtime/CGameState.hpp index bee866e69..244e0a65a 100644 --- a/Runtime/CGameState.hpp +++ b/Runtime/CGameState.hpp @@ -48,7 +48,7 @@ class CWorldState TAreaId x4_areaId = kInvalidAreaId; std::shared_ptr x8_relayTracker; std::shared_ptr xc_mapWorldInfo; - u32 x10_; + ResId x10_desiredAreaAssetId; std::shared_ptr x14_layerState; public: @@ -57,6 +57,7 @@ public: ResId GetWorldAssetId() const { return x0_mlvlId; } void SetAreaId(TAreaId aid) { x4_areaId = aid; } TAreaId GetCurrentAreaId() const { return x4_areaId; } + ResId GetDesiredAreaAssetId() const { return x10_desiredAreaAssetId; } const std::shared_ptr& RelayTracker() const { return x8_relayTracker; } const std::shared_ptr& MapWorldInfo() const { return xc_mapWorldInfo; } const std::shared_ptr& GetLayerState() const { return x14_layerState; } diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index 9b59023c6..119f1c3fa 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -41,7 +41,7 @@ add_subdirectory(MP3) if(APPLE) set_source_files_properties(MP1/CFrontEndUITouchBarMac.mm - MP1/CSaveUITouchBarMac.mm + MP1/CSaveGameScreenTouchBarMac.mm CGameOptionsTouchBarMac.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) bintoc(startButton.c Resources/startButton@2x.png START_BUTTON_2X) diff --git a/Runtime/CMemoryCardSys.hpp b/Runtime/CMemoryCardSys.hpp index 90dc48931..344583b02 100644 --- a/Runtime/CMemoryCardSys.hpp +++ b/Runtime/CMemoryCardSys.hpp @@ -27,6 +27,7 @@ class CSaveWorldMemory TLockedToken x3c_saveWorld; /* used to be optional */ public: + ResId GetWorldNameId() const { return x0_strgId; } ResId GetSaveWorldAssetId() const { return x4_savwId; } u32 GetAreaCount() const { return x8_areaCount; } const std::vector& GetDefaultLayerStates() const { return x1c_defaultLayerStates; } diff --git a/Runtime/CSimplePool.cpp b/Runtime/CSimplePool.cpp index 79b071830..eccee97e6 100644 --- a/Runtime/CSimplePool.cpp +++ b/Runtime/CSimplePool.cpp @@ -68,4 +68,13 @@ void CSimplePool::ObjectUnreferenced(const SObjectTag& tag) x8_resources.erase(iter); } +std::vector CSimplePool::GetReferencedTags() const +{ + std::vector ret; + ret.reserve(x8_resources.size()); + for (const auto& obj : x8_resources) + ret.push_back(obj.first); + return ret; +} + } diff --git a/Runtime/CSimplePool.hpp b/Runtime/CSimplePool.hpp index b2406a618..1478dcfa8 100644 --- a/Runtime/CSimplePool.hpp +++ b/Runtime/CSimplePool.hpp @@ -30,6 +30,7 @@ public: IFactory& GetFactory() const {return x18_factory;} void Flush(); void ObjectUnreferenced(const SObjectTag&); + std::vector GetReferencedTags() const; }; } diff --git a/Runtime/CStateManager.hpp b/Runtime/CStateManager.hpp index 74f6384ff..8e020cf02 100644 --- a/Runtime/CStateManager.hpp +++ b/Runtime/CStateManager.hpp @@ -20,6 +20,7 @@ #include "World/CEnvFxManager.hpp" #include "World/CActorModelParticles.hpp" #include "Input/CRumbleManager.hpp" +#include "Camera/CCameraShakeData.hpp" namespace urde { @@ -44,6 +45,11 @@ class CWorld; class CTexture; class CWorldLayerState; +namespace MP1 +{ +class CMFGameLoader; +} + struct SScriptObjectStream { CEntity* x0_obj; @@ -52,8 +58,17 @@ struct SScriptObjectStream u32 xc_length; }; +struct SOnScreenTex +{ + ResId x0_id = -1; + zeus::CVector2i x4_origin; + zeus::CVector2i xc_extent; +}; + class CStateManager { + friend class MP1::CMFGameLoader; + s16 x0_nextFreeIndex = 0; TUniqueId x8_idArr[1024] = {}; @@ -114,6 +129,8 @@ class CStateManager TLockedToken x8f0_shadowTex; /* DefaultShadow in MiscData */ CRandom16 x8fc_random; CRandom16* x900_activeRandom = nullptr; + u32 x904_ = 0; + u32 x908_ = 0; FScriptLoader x90c_loaderFuncs[int(EScriptObjectType::ScriptObjectTypeMAX)] = {}; bool xab0_worldLoaded = false; @@ -153,30 +170,59 @@ class CStateManager }; u16 _dummy = 0; }; - s32 xef4_; - zeus::CVector2i xef8_; - zeus::CVector2i xf00_; + + SOnScreenTex xef4_pendingScreenTex; + 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 xf28_thermColdScale2 = 0.f; float xf2c_ = 1.f; float xf30_ = 1.f; - TUniqueId xf6c_playerActor; - void UpdateThermalVisor(); + u32 xf34_ = 2; + TUniqueId xf38_ = kInvalidUniqueId; + std::list xf3c_; + u32 xf50_ = 0; + std::list xf54_; + u32 xf68_ = 0; + TUniqueId xf6c_playerActor = kInvalidUniqueId; + u32 xf70_ = 0; TUniqueId xf74_lastTrigger = 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 { struct { + bool xf94_24_ : 1; + bool xf94_25_ : 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; }; + void UpdateThermalVisor(); + public: /* TODO: Public for CFirstPersonCamera */ - u32 x904_; + u32 Get904() const { return x904_; } CStateManager(const std::weak_ptr&, const std::weak_ptr&, const std::weak_ptr&, diff --git a/Runtime/Camera/CFirstPersonCamera.cpp b/Runtime/Camera/CFirstPersonCamera.cpp index 73114b4dd..4da252bad 100644 --- a/Runtime/Camera/CFirstPersonCamera.cpp +++ b/Runtime/Camera/CFirstPersonCamera.cpp @@ -232,7 +232,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) zeus::CTransform bobXf = player->GetCameraBob()->GetCameraBobTransformation(); 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(); player->GetCameraBob()->SetCameraBobTransform(bobXf); diff --git a/Runtime/GuiSys/CGuiFrame.hpp b/Runtime/GuiSys/CGuiFrame.hpp index 6dc43fc85..b334433b2 100644 --- a/Runtime/GuiSys/CGuiFrame.hpp +++ b/Runtime/GuiSys/CGuiFrame.hpp @@ -45,6 +45,7 @@ public: CGuiSys& GetGuiSys() {return x8_guiSys;} 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(s16 id) const; void SetFrameCamera(std::shared_ptr&& camr) { x14_camera = std::move(camr); } diff --git a/Runtime/GuiSys/CGuiObject.hpp b/Runtime/GuiSys/CGuiObject.hpp index 8542c386e..5a5ffcc68 100644 --- a/Runtime/GuiSys/CGuiObject.hpp +++ b/Runtime/GuiSys/CGuiObject.hpp @@ -28,6 +28,7 @@ public: const zeus::CVector3f& GetLocalPosition() const { return x4_localXF.origin; } void SetLocalPosition(const zeus::CVector3f& pos); const zeus::CVector3f& GetWorldPosition() const { return x34_worldXF.origin; } + const zeus::CTransform& GetLocalTransform() const { return x34_worldXF; } void RotateReset(); zeus::CVector3f RotateW2O(const zeus::CVector3f& vec) const; zeus::CVector3f RotateO2P(const zeus::CVector3f& vec) const; diff --git a/Runtime/GuiSys/CGuiTextSupport.hpp b/Runtime/GuiSys/CGuiTextSupport.hpp index 5ec785554..a3e59816e 100644 --- a/Runtime/GuiSys/CGuiTextSupport.hpp +++ b/Runtime/GuiSys/CGuiTextSupport.hpp @@ -135,6 +135,7 @@ public: void SetVerticalJustification(EVerticalJustification j); void SetImageBaseline(bool b); bool GetIsTextSupportFinishedLoading() const; + float GetCurTime() const { return x3c_curTime; } }; } diff --git a/Runtime/MP1/CFaceplateDecoration.cpp b/Runtime/MP1/CFaceplateDecoration.cpp new file mode 100644 index 000000000..ec307f323 --- /dev/null +++ b/Runtime/MP1/CFaceplateDecoration.cpp @@ -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); + } +} + +} +} diff --git a/Runtime/MP1/CFaceplateDecoration.hpp b/Runtime/MP1/CFaceplateDecoration.hpp new file mode 100644 index 000000000..9b753b92a --- /dev/null +++ b/Runtime/MP1/CFaceplateDecoration.hpp @@ -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 x4_tex; + bool xc_ready = false; + std::experimental::optional m_texFilter; +public: + CFaceplateDecoration(CStateManager& stateMgr); + void Update(float dt, CStateManager& stateMgr); + void Draw(CStateManager& stateMgr); +}; + +} +} + +#endif // __URDE_CFACEPLATEDECORATION_HPP__ diff --git a/Runtime/MP1/CFrontEndUI.cpp b/Runtime/MP1/CFrontEndUI.cpp index fd8960433..67a075c44 100644 --- a/Runtime/MP1/CFrontEndUI.cpp +++ b/Runtime/MP1/CFrontEndUI.cpp @@ -8,7 +8,7 @@ #include "CSlideShow.hpp" #include "Audio/CSfxManager.hpp" #include "Graphics/CMoviePlayer.hpp" -#include "CSaveUI.hpp" +#include "CSaveGameScreen.hpp" #include "GuiSys/CGuiTextPane.hpp" #include "GuiSys/CGuiFrame.hpp" #include "GuiSys/CStringTable.hpp" @@ -20,8 +20,9 @@ #include "Audio/CAudioGroupSet.hpp" #include "GuiSys/CGuiWidgetDrawParms.hpp" #include "CNESEmulator.hpp" -#include "CQuitScreen.hpp" +#include "CQuitGameScreen.hpp" #include "Input/RumbleFxTable.hpp" +#include namespace urde { @@ -74,7 +75,7 @@ void CFrontEndUI::PlayAdvanceSfx() 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) { x10_frme = g_SimplePool->GetObj("FRME_NewFileSelect"); @@ -159,7 +160,7 @@ bool CFrontEndUI::SNewFileSelectFrame::IsTextDoneAnimating() const 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) @@ -1022,9 +1023,9 @@ void CFrontEndUI::SFusionBonusFrame::SetTableColors(CGuiTableGroup* tbgp) const 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) { @@ -1072,7 +1073,7 @@ void CFrontEndUI::SFusionBonusFrame::Update(float dt, CSaveUI* saveUI) } CFrontEndUI::SFusionBonusFrame::EAction -CFrontEndUI::SFusionBonusFrame::ProcessUserInput(const CFinalInput& input, CSaveUI* sui, +CFrontEndUI::SFusionBonusFrame::ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui, CFrontEndUITouchBar::EAction tbAction) { x8_action = EAction::None; @@ -1225,6 +1226,7 @@ void CFrontEndUI::SFusionBonusFrame::DoAdvance(CGuiTableGroup* caller) else if (g_GameState->SystemOptions().GetPlayerBeatFusion()) { x8_action = EAction::None; + CSfxManager::SfxStart(1094, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); //x8_action = EAction::PlayNESMetroid; } else @@ -1437,23 +1439,23 @@ void CFrontEndUI::SNesEmulatorFrame::SetMode(EMode mode) x8_quitScreen.reset(); break; case EMode::SaveProgress: - x8_quitScreen = std::make_unique(EQuitType::SaveProgress); + x8_quitScreen = std::make_unique(EQuitType::SaveProgress); break; case EMode::ContinuePlaying: - x8_quitScreen = std::make_unique(EQuitType::ContinuePlaying); + x8_quitScreen = std::make_unique(EQuitType::ContinuePlaying); break; case EMode::QuitNESMetroid: - x8_quitScreen = std::make_unique(EQuitType::QuitNESMetroid); + x8_quitScreen = std::make_unique(EQuitType::QuitNESMetroid); break; default: break; } x0_mode = mode; } -void CFrontEndUI::SNesEmulatorFrame::ProcessUserInput(const CFinalInput& input, CSaveUI* sui) +void CFrontEndUI::SNesEmulatorFrame::ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui) { bool processInput = true; - if (sui && sui->GetUIType() != CSaveUI::EUIType::SaveReady) + if (sui && sui->GetUIType() != CSaveGameScreen::EUIType::SaveReady) processInput = false; if (sui) 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); zeus::CColor geomCol(zeus::CColor::skWhite); @@ -1561,10 +1563,10 @@ bool CFrontEndUI::SNesEmulatorFrame::Update(float dt, CSaveUI* saveUi) return false; } -void CFrontEndUI::SNesEmulatorFrame::Draw(CSaveUI* saveUi) const +void CFrontEndUI::SNesEmulatorFrame::Draw(CSaveGameScreen* saveUi) const { 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) mulColor = zeus::CColor::skBlack; @@ -1841,7 +1843,7 @@ bool CFrontEndUI::SOptionsFrontEndFrame::PumpLoad() return true; } -bool CFrontEndUI::SOptionsFrontEndFrame::ProcessUserInput(const CFinalInput& input, CSaveUI* sui) +bool CFrontEndUI::SOptionsFrontEndFrame::ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui) { x134_25_exitOptions = false; if (sui) @@ -1945,10 +1947,10 @@ bool CFrontEndUI::SOptionsFrontEndFrame::ProcessUserInput(const CFinalInput& inp return !x134_25_exitOptions; } -void CFrontEndUI::SOptionsFrontEndFrame::Update(float dt, CSaveUI* sui) +void CFrontEndUI::SOptionsFrontEndFrame::Update(float dt, CSaveGameScreen* sui) { x40_rumbleGen.Update(dt); - x134_24_visible = !sui || sui->GetUIType() == CSaveUI::EUIType::SaveReady; + x134_24_visible = !sui || sui->GetUIType() == CSaveGameScreen::EUIType::SaveReady; if (!PumpLoad()) return; @@ -1985,14 +1987,15 @@ CFrontEndUI::CFrontEndUI() { CMain* m = static_cast(g_Main); - x18_rndA = std::min(rand() * 3 / RAND_MAX, 2); - x1c_rndB = std::min(rand() * 3 / RAND_MAX, 2); + CRandom16 r(time(nullptr)); + x18_rndA = r.Range(0, 2); + x1c_rndB = r.Range(0, 2); x20_depsGroup = g_SimplePool->GetObj("FrontEnd_DGRP"); x38_pressStart = g_SimplePool->GetObj("TXTR_PressStart"); x44_frontendAudioGrp = g_SimplePool->GetObj("FrontEnd_AGSC"); - xdc_saveUI = std::make_unique(ESaveContext::FrontEnd, g_GameState->GetCardSerial()); + xdc_saveUI = std::make_unique(ESaveContext::FrontEnd, g_GameState->GetCardSerial()); m->ResetGameState(); g_GameState->SetCurrentWorldId(g_ResFactory->TranslateOriginalToNew(g_DefaultWorldTag.id)); @@ -2330,7 +2333,20 @@ bool CFrontEndUI::PumpMovieLoad() if (!x70_menuMovies[i]) { const FEMovie& movie = FEMovies[i]; - x70_menuMovies[i] = std::make_unique(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(path.c_str(), 0.05f, movie.loop, false); x70_menuMovies[i]->SetPlayMode(CMoviePlayer::EPlayMode::Stopped); return false; } @@ -2635,7 +2651,7 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue) if (xf0_optionsFrme) { bool optionsActive = true; - if (xdc_saveUI && xdc_saveUI->GetUIType() != CSaveUI::EUIType::SaveReady) + if (xdc_saveUI && xdc_saveUI->GetUIType() != CSaveGameScreen::EUIType::SaveReady) optionsActive = false; if (optionsActive) diff --git a/Runtime/MP1/CFrontEndUI.hpp b/Runtime/MP1/CFrontEndUI.hpp index 818528dd6..e40e8e57d 100644 --- a/Runtime/MP1/CFrontEndUI.hpp +++ b/Runtime/MP1/CFrontEndUI.hpp @@ -36,8 +36,8 @@ class CGuiModel; namespace MP1 { class CNESEmulator; -class CSaveUI; -class CQuitScreen; +class CSaveGameScreen; +class CQuitGameScreen; class CFrontEndUI : public CIOWin { @@ -120,7 +120,7 @@ public: }; u32 x0_rnd; - CSaveUI* x4_saveUI; + CSaveGameScreen* x4_saveUI; ESubMenu x8_subMenu = ESubMenu::Root; EAction xc_action = EAction::None; TLockedToken x10_frme; @@ -146,7 +146,7 @@ public: CFrontEndUITouchBar& m_touchBar; - SNewFileSelectFrame(CSaveUI* sui, u32 rnd, CFrontEndUITouchBar& touchBar); + SNewFileSelectFrame(CSaveGameScreen* sui, u32 rnd, CFrontEndUITouchBar& touchBar); void FinishedLoading(); bool PumpLoad(); bool IsTextDoneAnimating() const; @@ -253,8 +253,8 @@ public: void FinishedLoading(); bool PumpLoad(); void SetTableColors(CGuiTableGroup* tbgp) const; - void Update(float dt, CSaveUI* saveUI); - EAction ProcessUserInput(const CFinalInput& input, CSaveUI* sui, + void Update(float dt, CSaveGameScreen* saveUI); + EAction ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui, CFrontEndUITouchBar::EAction tbAction); void Draw() const; @@ -315,7 +315,7 @@ public: EMode x0_mode = EMode::Emulator; std::unique_ptr x4_nesEmu; - std::unique_ptr x8_quitScreen; + std::unique_ptr x8_quitScreen; std::unique_ptr xc_textSupport; float x10_remTime = 8.f; bool x14_emulationSuspended = false; @@ -323,9 +323,9 @@ public: SNesEmulatorFrame(); void SetMode(EMode mode); - void ProcessUserInput(const CFinalInput& input, CSaveUI* sui); - bool Update(float dt, CSaveUI* saveUi); - void Draw(CSaveUI* saveUi) const; + void ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui); + bool Update(float dt, CSaveGameScreen* saveUi); + void Draw(CSaveGameScreen* saveUi) const; }; struct SOptionsFrontEndFrame @@ -372,8 +372,8 @@ public: void FinishedLoading(); bool PumpLoad(); - bool ProcessUserInput(const CFinalInput& input, CSaveUI* sui); - void Update(float dt, CSaveUI* saveUi); + bool ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui); + void Update(float dt, CSaveGameScreen* saveUi); void Draw() const; }; @@ -413,7 +413,7 @@ private: bool xd2_deferSlideShow = false; std::unique_ptr xd4_audio1; std::unique_ptr xd8_audio2; - std::unique_ptr xdc_saveUI; + std::unique_ptr xdc_saveUI; std::unique_ptr xe0_frontendCardFrme; std::unique_ptr xe4_fusionBonusFrme; std::unique_ptr xe8_frontendNoCardFrme; diff --git a/Runtime/MP1/CInGameGuiManager.cpp b/Runtime/MP1/CInGameGuiManager.cpp new file mode 100644 index 000000000..9b594fe62 --- /dev/null +++ b/Runtime/MP1/CInGameGuiManager.cpp @@ -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> CInGameGuiManager::LockPauseScreenDependencies() +{ + std::vector> 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(stateMgr); + x34_samusHud = std::make_unique(stateMgr); + x38_autoMapper = std::make_unique(stateMgr); + x3c_pauseScreen = std::make_unique(); + x40_samusReflection = std::make_unique(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(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; + } +} + +} +} diff --git a/Runtime/MP1/CInGameGuiManager.hpp b/Runtime/MP1/CInGameGuiManager.hpp new file mode 100644 index 000000000..58d1cc17c --- /dev/null +++ b/Runtime/MP1/CInGameGuiManager.hpp @@ -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 x0_iggmPreLoad; + std::vector x8_preLoadDeps; + ELoadPhase x18_loadPhase = ELoadPhase::LoadDepsGroup; + CRandom16 x1c_rand; + CFaceplateDecoration x20_faceplateDecor; + std::unique_ptr x30_playerVisor; + std::unique_ptr x34_samusHud; + std::unique_ptr x38_autoMapper; + std::unique_ptr x3c_pauseScreen; + std::unique_ptr x40_samusReflection; + std::unique_ptr x44_; + u32 x48_ = 0; + std::unique_ptr x4c_saveUI; + TLockedToken x50_deathDot; + std::vector> x5c_pauseScreenDGRPs; + std::vector> xc8_inGameGuiDGRPs; + std::vector xd8_; + std::vector xe8_; + CCameraFilterPass xf8_camFilter; + std::list 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 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> LockPauseScreenDependencies(); + bool CheckDGRPLoadComplete() const; + void BeginStateTransition(EInGameGuiState state, CStateManager& stateMgr); + +public: + CInGameGuiManager(CStateManager& stateMgr, CArchitectureQueue& archQueue); + bool CheckLoadComplete(CStateManager& stateMgr); +}; + +} +} + +#endif // __URDE_CINGAMEGUIMANAGER_HPP__ diff --git a/Runtime/MP1/CMFGame.cpp b/Runtime/MP1/CMFGame.cpp index d6cf79861..eb3476e39 100644 --- a/Runtime/MP1/CMFGame.cpp +++ b/Runtime/MP1/CMFGame.cpp @@ -6,6 +6,7 @@ #include "World/CPlayer.hpp" #include "MP1.hpp" #include "Character/CCharLayoutInfo.hpp" +#include "AutoMapper/CAutoMapper.hpp" namespace urde { @@ -39,12 +40,28 @@ CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader") case EFlowState::Six: { ResId mlvlId = g_GameState->CurrentWorldAssetId(); - // g_GameState->WorldTransitionManager()-> - // g_MemoryCardSys-> + if (g_MemoryCardSys->HasSaveWorldMemory(mlvlId)) + { + 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: + 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); } } @@ -65,14 +82,55 @@ CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg, float dt = tick.x4_parm; if (!x2c_24_initialized) { - if (x1c_.empty()) + if (x1c_loadList.empty()) + { 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 { wtMgr->Update(dt); } + + if (!x14_stateMgr) + { + CWorldTransManager::WaitForModelsAndTextures(); + CWorldState& wldState = g_GameState->CurrentWorldState(); + x14_stateMgr = std::make_shared(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(*x14_stateMgr, queue); + } + } } default: break; diff --git a/Runtime/MP1/CMFGame.hpp b/Runtime/MP1/CMFGame.hpp index 03d2c52bd..b0dbff81f 100644 --- a/Runtime/MP1/CMFGame.hpp +++ b/Runtime/MP1/CMFGame.hpp @@ -2,6 +2,7 @@ #define __URDE_CMFGAME_HPP__ #include "CMFGameBase.hpp" +#include "CInGameGuiManager.hpp" namespace urde { @@ -39,7 +40,7 @@ class CMFGameLoader : public CMFGameLoaderBase { std::shared_ptr x14_stateMgr; std::shared_ptr x18_guiMgr; - std::vector x1c_; + std::vector x1c_loadList; union { diff --git a/Runtime/MP1/CMainFlow.cpp b/Runtime/MP1/CMainFlow.cpp index 0cc698d52..2a08ad4b9 100644 --- a/Runtime/MP1/CMainFlow.cpp +++ b/Runtime/MP1/CMainFlow.cpp @@ -7,12 +7,12 @@ #include "CFrontEndUI.hpp" #include "GameGlobalObjects.hpp" #include "Character/CCharLayoutInfo.hpp" -#include "CSaveUI.hpp" +#include "CSaveGameScreen.hpp" #include "CCredits.hpp" #include "CPreFrontEnd.hpp" #include "CStateSetterFlow.hpp" #include "CNESEmulator.hpp" -#include "CQuitScreen.hpp" +#include "CQuitGameScreen.hpp" namespace urde { diff --git a/Runtime/MP1/CMakeLists.txt b/Runtime/MP1/CMakeLists.txt index 24e05fdb8..be3a29018 100644 --- a/Runtime/MP1/CMakeLists.txt +++ b/Runtime/MP1/CMakeLists.txt @@ -4,7 +4,7 @@ add_subdirectory(World) if(APPLE) set(MP1_PLAT_SOURCES CFrontEndUITouchBarMac.mm - CSaveUITouchBarMac.mm) + CSaveGameScreenTouchBarMac.mm) endif() set(MP1_SOURCES @@ -19,13 +19,20 @@ set(MP1_SOURCES CFrontEndUITouchBar.hpp CFrontEndUITouchBar.cpp CPreFrontEnd.hpp CPreFrontEnd.cpp CSlideShow.hpp CSlideShow.cpp - CSaveUI.hpp CSaveUI.cpp - CSaveUITouchBar.hpp CSaveUITouchBar.cpp + CSaveGameScreen.hpp CSaveGameScreen.cpp + CSaveGameScreenTouchBar.hpp CSaveGameScreenTouchBar.cpp CMemoryCardDriver.hpp CMemoryCardDriver.cpp - CQuitScreen.hpp CQuitScreen.cpp + CQuitGameScreen.hpp CQuitGameScreen.cpp + CMessageScreen.hpp CMessageScreen.cpp CCredits.hpp CCredits.cpp CStateSetterFlow.hpp CStateSetterFlow.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_PLAT_SOURCES} ${MP1_WORLD_SOURCES}) diff --git a/Runtime/MP1/CMemoryCardDriver.hpp b/Runtime/MP1/CMemoryCardDriver.hpp index f1e3e3cc7..5cac2f7b3 100644 --- a/Runtime/MP1/CMemoryCardDriver.hpp +++ b/Runtime/MP1/CMemoryCardDriver.hpp @@ -11,7 +11,7 @@ namespace MP1 class CMemoryCardDriver { - friend class CSaveUI; + friend class CSaveGameScreen; public: enum class EState { diff --git a/Runtime/MP1/CMessageScreen.cpp b/Runtime/MP1/CMessageScreen.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/MP1/CMessageScreen.hpp b/Runtime/MP1/CMessageScreen.hpp new file mode 100644 index 000000000..00acdab7f --- /dev/null +++ b/Runtime/MP1/CMessageScreen.hpp @@ -0,0 +1,18 @@ +#ifndef __URDE_CMESSAGESCREEN_HPP__ +#define __URDE_CMESSAGESCREEN_HPP__ + +namespace urde +{ +namespace MP1 +{ + +class CMessageScreen +{ +public: + CMessageScreen(); +}; + +} +} + +#endif // __URDE_CMESSAGESCREEN_HPP__ diff --git a/Runtime/MP1/CPauseScreen.cpp b/Runtime/MP1/CPauseScreen.cpp new file mode 100644 index 000000000..fe3f15d54 --- /dev/null +++ b/Runtime/MP1/CPauseScreen.cpp @@ -0,0 +1,19 @@ +#include "CPauseScreen.hpp" + +namespace urde +{ +namespace MP1 +{ + +CPauseScreen::CPauseScreen() +{ + +} + +bool CPauseScreen::CheckLoadComplete() +{ + return false; +} + +} +} diff --git a/Runtime/MP1/CPauseScreen.hpp b/Runtime/MP1/CPauseScreen.hpp new file mode 100644 index 000000000..e46623876 --- /dev/null +++ b/Runtime/MP1/CPauseScreen.hpp @@ -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__ diff --git a/Runtime/MP1/CPlayerVisor.cpp b/Runtime/MP1/CPlayerVisor.cpp new file mode 100644 index 000000000..e158e00c1 --- /dev/null +++ b/Runtime/MP1/CPlayerVisor.cpp @@ -0,0 +1,14 @@ +#include "CPlayerVisor.hpp" + +namespace urde +{ +namespace MP1 +{ + +CPlayerVisor::CPlayerVisor(CStateManager& stateMgr) +{ + +} + +} +} diff --git a/Runtime/MP1/CPlayerVisor.hpp b/Runtime/MP1/CPlayerVisor.hpp new file mode 100644 index 000000000..b1788bb42 --- /dev/null +++ b/Runtime/MP1/CPlayerVisor.hpp @@ -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__ diff --git a/Runtime/MP1/CQuitScreen.cpp b/Runtime/MP1/CQuitGameScreen.cpp similarity index 82% rename from Runtime/MP1/CQuitScreen.cpp rename to Runtime/MP1/CQuitGameScreen.cpp index 25f296e05..e7cd1dffd 100644 --- a/Runtime/MP1/CQuitScreen.cpp +++ b/Runtime/MP1/CQuitGameScreen.cpp @@ -1,4 +1,4 @@ -#include "CQuitScreen.hpp" +#include "CQuitGameScreen.hpp" #include "Input/CFinalInput.hpp" #include "GameGlobalObjects.hpp" #include "CSimplePool.hpp" @@ -29,22 +29,22 @@ static const float VerticalOffsets[] = 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}, zeus::CColor{0.196078f, 0.196078f, 0.196078f, 1.f}); } -void CQuitScreen::FinishedLoading() +void CQuitGameScreen::FinishedLoading() { x10_loadedFrame = x4_frame.GetObj(); x14_tablegroup_quitgame = static_cast( x10_loadedFrame->FindWidget("tablegroup_quitgame")); x14_tablegroup_quitgame->SetMenuAdvanceCallback( - std::bind(&CQuitScreen::DoAdvance, this, std::placeholders::_1)); + std::bind(&CQuitGameScreen::DoAdvance, this, std::placeholders::_1)); 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(x10_loadedFrame->FindWidget("textpane_title"))->TextSupport()-> SetText(g_MainStringTable->GetString(Titles[int(x0_type)])); @@ -58,13 +58,13 @@ void CQuitScreen::FinishedLoading() SetColors(); } -void CQuitScreen::DoSelectionChange(CGuiTableGroup* caller, int userSel) +void CQuitGameScreen::DoSelectionChange(CGuiTableGroup* caller, int userSel) { SetColors(); 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) { @@ -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()) FinishedLoading(); return x18_action; } -void CQuitScreen::Draw() +void CQuitGameScreen::Draw() { if (x0_type == EQuitType::QuitGame) m_blackScreen->draw(zeus::CColor::skBlack); @@ -97,7 +97,7 @@ void CQuitScreen::Draw() 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) return; @@ -108,7 +108,7 @@ void CQuitScreen::ProcessUserInput(const CFinalInput& input) x18_action = EQuitAction::No; } -CQuitScreen::CQuitScreen(EQuitType tp) +CQuitGameScreen::CQuitGameScreen(EQuitType tp) : x0_type(tp) { x4_frame = g_SimplePool->GetObj("FRME_QuitScreen"); diff --git a/Runtime/MP1/CQuitScreen.hpp b/Runtime/MP1/CQuitGameScreen.hpp similarity index 84% rename from Runtime/MP1/CQuitScreen.hpp rename to Runtime/MP1/CQuitGameScreen.hpp index 879679b74..6a99c4d5a 100644 --- a/Runtime/MP1/CQuitScreen.hpp +++ b/Runtime/MP1/CQuitGameScreen.hpp @@ -1,5 +1,5 @@ -#ifndef __URDE_CQUITSCREEN_HPP__ -#define __URDE_CQUITSCREEN_HPP__ +#ifndef __URDE_CQUITGAMESCREEN_HPP__ +#define __URDE_CQUITGAMESCREEN_HPP__ #include "RetroTypes.hpp" #include "CToken.hpp" @@ -31,7 +31,7 @@ enum class EQuitAction No }; -class CQuitScreen +class CQuitGameScreen { EQuitType x0_type; TLockedToken x4_frame; @@ -47,10 +47,10 @@ public: EQuitAction Update(float dt); void Draw(); void ProcessUserInput(const CFinalInput& input); - CQuitScreen(EQuitType pos); + CQuitGameScreen(EQuitType pos); }; } } -#endif // __URDE_CQUITSCREEN_HPP__ +#endif // __URDE_CQUITGAMESCREEN_HPP__ diff --git a/Runtime/MP1/CSamusFaceReflection.cpp b/Runtime/MP1/CSamusFaceReflection.cpp new file mode 100644 index 000000000..40ffd632c --- /dev/null +++ b/Runtime/MP1/CSamusFaceReflection.cpp @@ -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) +{ + +} + +} +} diff --git a/Runtime/MP1/CSamusFaceReflection.hpp b/Runtime/MP1/CSamusFaceReflection.hpp new file mode 100644 index 000000000..562eb5ff1 --- /dev/null +++ b/Runtime/MP1/CSamusFaceReflection.hpp @@ -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__ diff --git a/Runtime/MP1/CSamusHud.cpp b/Runtime/MP1/CSamusHud.cpp new file mode 100644 index 000000000..263964d60 --- /dev/null +++ b/Runtime/MP1/CSamusHud.cpp @@ -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() +{ + +} + +} +} diff --git a/Runtime/MP1/CSamusHud.hpp b/Runtime/MP1/CSamusHud.hpp new file mode 100644 index 000000000..e52123972 --- /dev/null +++ b/Runtime/MP1/CSamusHud.hpp @@ -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__ diff --git a/Runtime/MP1/CSaveUI.cpp b/Runtime/MP1/CSaveGameScreen.cpp similarity index 94% rename from Runtime/MP1/CSaveUI.cpp rename to Runtime/MP1/CSaveGameScreen.cpp index 486b7b429..df3a40d9b 100644 --- a/Runtime/MP1/CSaveUI.cpp +++ b/Runtime/MP1/CSaveGameScreen.cpp @@ -1,4 +1,4 @@ -#include "CSaveUI.hpp" +#include "CSaveGameScreen.hpp" #include "CSimplePool.hpp" #include "GameGlobalObjects.hpp" #include "CMemoryCardSys.hpp" @@ -17,7 +17,7 @@ namespace MP1 using EState = CMemoryCardDriver::EState; using EError = CMemoryCardDriver::EError; -void CSaveUI::ResetCardDriver() +void CSaveGameScreen::ResetCardDriver() { x92_savingDisabled = false; x6c_cardDriver.reset(); @@ -28,7 +28,7 @@ void CSaveUI::ResetCardDriver() SetUIText(); } -CIOWin::EMessageReturn CSaveUI::Update(float dt) +CIOWin::EMessageReturn CSaveGameScreen::Update(float dt) { if (!PumpLoad()) return CIOWin::EMessageReturn::Normal; @@ -100,7 +100,7 @@ CIOWin::EMessageReturn CSaveUI::Update(float dt) return CIOWin::EMessageReturn::Normal; } -bool CSaveUI::PumpLoad() +bool CSaveGameScreen::PumpLoad() { if (x50_loadedFrame) return true; @@ -128,9 +128,9 @@ bool CSaveUI::PumpLoad() x68_textpane_choice3 = static_cast(x50_loadedFrame->FindWidget("textpane_choice3")); x58_tablegroup_choices->SetMenuAdvanceCallback( - std::bind(&CSaveUI::DoAdvance, this, std::placeholders::_1)); + std::bind(&CSaveGameScreen::DoAdvance, this, std::placeholders::_1)); 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) x6c_cardDriver->StartCardProbe(); @@ -140,7 +140,7 @@ bool CSaveUI::PumpLoad() return true; } -CSaveUI::EUIType CSaveUI::SelectUIType() const +CSaveGameScreen::EUIType CSaveGameScreen::SelectUIType() const { if (x6c_cardDriver->x10_state == EState::NoCard) return EUIType::NoCardFound; @@ -196,7 +196,7 @@ CSaveUI::EUIType CSaveUI::SelectUIType() const return EUIType::Empty; } -void CSaveUI::SetUIText() +void CSaveGameScreen::SetUIText() { x91_uiTextDirty = false; @@ -350,25 +350,25 @@ void CSaveUI::SetUIText() SetUIColors(); } -void CSaveUI::SetUIColors() +void CSaveGameScreen::SetUIColors() { x58_tablegroup_choices->SetColors(zeus::CColor::skWhite, zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f}); } -void CSaveUI::Draw() const +void CSaveGameScreen::Draw() const { if (x50_loadedFrame) x50_loadedFrame->Draw(CGuiWidgetDrawParms::Default); } -void CSaveUI::ContinueWithoutSaving() +void CSaveGameScreen::ContinueWithoutSaving() { x80_iowRet = CIOWin::EMessageReturn::RemoveIOWin; g_GameState->SetCardSerial(0); } -void CSaveUI::DoAdvance(CGuiTableGroup* caller) +void CSaveGameScreen::DoAdvance(CGuiTableGroup* caller) { int userSel = x58_tablegroup_choices->GetUserSelection(); int sfx = -1; @@ -610,13 +610,13 @@ void CSaveUI::DoAdvance(CGuiTableGroup* caller) 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(); 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) { @@ -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); x6c_cardDriver->ExportPersistentOptions(); @@ -643,7 +643,7 @@ void CSaveUI::StartGame(int idx) x80_iowRet = CIOWin::EMessageReturn::Exit; } -void CSaveUI::SaveNESState() +void CSaveGameScreen::SaveNESState() { if (!x92_savingDisabled) { @@ -653,19 +653,19 @@ void CSaveUI::SaveNESState() } } -void CSaveUI::EraseGame(int idx) +void CSaveGameScreen::EraseGame(int idx) { x6c_cardDriver->EraseFileSlot(idx); x90_needsDriverReset = true; x6c_cardDriver->StartFileCreateTransactional(); } -const CGameState::GameFileStateInfo* CSaveUI::GetGameData(int idx) const +const CGameState::GameFileStateInfo* CSaveGameScreen::GetGameData(int idx) const { 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()) { x14_txtrSaveBanner = g_SimplePool->GetObj("TXTR_SaveBanner"); @@ -692,7 +692,7 @@ CSaveUI::CSaveUI(ESaveContext saveCtx, u64 serial) } } -std::unique_ptr CSaveUI::ConstructCardDriver(bool importPersistent) +std::unique_ptr CSaveGameScreen::ConstructCardDriver(bool importPersistent) { return std::make_unique(kabufuda::ECardSlot::SlotA, g_ResFactory->GetResourceIdByName("TXTR_SaveBanner")->id, diff --git a/Runtime/MP1/CSaveUI.hpp b/Runtime/MP1/CSaveGameScreen.hpp similarity index 94% rename from Runtime/MP1/CSaveUI.hpp rename to Runtime/MP1/CSaveGameScreen.hpp index ffb1e6622..fa63bf232 100644 --- a/Runtime/MP1/CSaveUI.hpp +++ b/Runtime/MP1/CSaveGameScreen.hpp @@ -5,7 +5,7 @@ #include "CToken.hpp" #include "CIOWin.hpp" #include "CMemoryCardDriver.hpp" -#include "CSaveUITouchBar.hpp" +#include "CSaveGameScreenTouchBar.hpp" namespace urde { @@ -26,7 +26,7 @@ enum class ESaveContext InGame }; -class CSaveUI +class CSaveGameScreen { public: enum class EUIType @@ -91,7 +91,7 @@ private: bool x92_savingDisabled = false; bool x93_inGame; - std::unique_ptr m_touchBar; + std::unique_ptr m_touchBar; void ContinueWithoutSaving(); @@ -116,7 +116,7 @@ public: const CGameState::GameFileStateInfo* GetGameData(int idx) const; EUIType GetUIType() const { return x10_uiType; } bool IsSavingDisabled() const { return x92_savingDisabled; } - CSaveUI(ESaveContext saveCtx, u64 serial); + CSaveGameScreen(ESaveContext saveCtx, u64 serial); }; } diff --git a/Runtime/MP1/CSaveGameScreenTouchBar.cpp b/Runtime/MP1/CSaveGameScreenTouchBar.cpp new file mode 100644 index 000000000..02c779618 --- /dev/null +++ b/Runtime/MP1/CSaveGameScreenTouchBar.cpp @@ -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 NewSaveUITouchBar() +{ + return std::make_unique(); +} +#endif + +} +} diff --git a/Runtime/MP1/CSaveUITouchBar.hpp b/Runtime/MP1/CSaveGameScreenTouchBar.hpp similarity index 74% rename from Runtime/MP1/CSaveUITouchBar.hpp rename to Runtime/MP1/CSaveGameScreenTouchBar.hpp index 9ee0e714b..edd16aff4 100644 --- a/Runtime/MP1/CSaveUITouchBar.hpp +++ b/Runtime/MP1/CSaveGameScreenTouchBar.hpp @@ -10,17 +10,17 @@ namespace urde namespace MP1 { -class CSaveUITouchBar +class CSaveGameScreenTouchBar { public: - virtual ~CSaveUITouchBar() = default; + virtual ~CSaveGameScreenTouchBar() = default; virtual int PopOption(); virtual void SetUIOpts(const std::u16string& opt0, const std::u16string& opt1, const std::u16string& opt2); }; -std::unique_ptr NewSaveUITouchBar(); +std::unique_ptr NewSaveUITouchBar(); } } diff --git a/Runtime/MP1/CSaveUITouchBarMac.mm b/Runtime/MP1/CSaveGameScreenTouchBarMac.mm similarity index 88% rename from Runtime/MP1/CSaveUITouchBarMac.mm rename to Runtime/MP1/CSaveGameScreenTouchBarMac.mm index fa0e985e0..4a0f331e8 100644 --- a/Runtime/MP1/CSaveUITouchBarMac.mm +++ b/Runtime/MP1/CSaveGameScreenTouchBarMac.mm @@ -1,5 +1,5 @@ #include -#include "CSaveUITouchBar.hpp" +#include "CSaveGameScreenTouchBar.hpp" #include "GameGlobalObjects.hpp" #include "MP1/MP1.hpp" @@ -7,7 +7,7 @@ #error ARC Required #endif -@interface SaveUITouchBar : NSObject +@interface SaveGameScreenTouchBar : NSObject { @public NSString* _opts[3]; @@ -18,7 +18,7 @@ -(IBAction)onOpt2:(id)sender; @end -@implementation SaveUITouchBar +@implementation SaveGameScreenTouchBar - (NSTouchBar*)makeTouchBar { NSTouchBar* touchBar = [NSTouchBar new]; @@ -89,13 +89,13 @@ namespace urde namespace MP1 { -class CSaveUITouchBarMac : public CSaveUITouchBar +class CSaveGameScreenTouchBarMac : public CSaveGameScreenTouchBar { - SaveUITouchBar* m_touchBar; + SaveGameScreenTouchBar* m_touchBar; public: - CSaveUITouchBarMac() + CSaveGameScreenTouchBarMac() { - m_touchBar = [SaveUITouchBar new]; + m_touchBar = [SaveGameScreenTouchBar new]; m_touchBar->_opt = -1; } int PopOption() @@ -119,9 +119,9 @@ public: } }; -std::unique_ptr NewSaveUITouchBar() +std::unique_ptr NewSaveUITouchBar() { - return std::make_unique(); + return std::make_unique(); } } diff --git a/Runtime/MP1/CSaveUITouchBar.cpp b/Runtime/MP1/CSaveUITouchBar.cpp deleted file mode 100644 index c3180c74e..000000000 --- a/Runtime/MP1/CSaveUITouchBar.cpp +++ /dev/null @@ -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 NewSaveUITouchBar() -{ - return std::make_unique(); -} -#endif - -} -} diff --git a/Runtime/World/CHealthInfo.hpp b/Runtime/World/CHealthInfo.hpp index f643e4ef7..d3e58de6e 100644 --- a/Runtime/World/CHealthInfo.hpp +++ b/Runtime/World/CHealthInfo.hpp @@ -1,7 +1,7 @@ #ifndef __URDE_CHEALTHINFO_HPP__ #define __URDE_CHEALTHINFO_HPP__ -#include "RetroTypes.hpp" +#include "Runtime/RetroTypes.hpp" namespace urde { diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 7598e5808..517ea23db 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -21,9 +21,15 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox& const CMaterialList& ml) : CPhysicsActor(uid, true, "CPlayer", CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList), xf, 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)); + x9c4_26_ = true; + x9c4_27_ = true; + x9c4_28_ = true; + x9c5_31_ = true; + ResId beamId = g_tweakPlayerRes->GetBeamBallTransitionModel(x7ec_); + x7f0_ballTransitionBeamModel = std::make_unique(CStaticRes(beamId, playerScale)); } 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; } -ResId CPlayer::CVisorSteam::GetTextureId() const { return xc_; } +ResId CPlayer::CVisorSteam::GetTextureId() const { return xc_tex; } void CPlayer::CVisorSteam::Update(float dt) { @@ -331,19 +337,19 @@ void CPlayer::CVisorSteam::Update(float dt) x0_ = x10_; x4_ = x14_; x8_ = x18_; - xc_ = x1c_; + xc_tex = x1c_; } 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; - if (x20_ > x0_) + if (x20_alpha > x0_) { if (x24_ <= 0.f) { - x20_ -= (dt / x8_); - x20_ = std::min(x20_, x0_); + x20_alpha -= (dt / x8_); + x20_alpha = std::min(x20_alpha, x0_); } else { @@ -353,13 +359,13 @@ void CPlayer::CVisorSteam::Update(float dt) return; } - CToken tmpTex = g_SimplePool->GetObj({SBIG('TXTR'), xc_}); + CToken tmpTex = g_SimplePool->GetObj({SBIG('TXTR'), xc_tex}); if (!tmpTex) return; - x20_ += (x20_ + (dt / x4_)); - if (x20_ > x0_) - x20_ = x0_; + x20_alpha += (x20_alpha + (dt / x4_)); + if (x20_alpha > x0_) + x20_alpha = x0_; x24_ = 0.1f; } diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index ddd239afd..57bfb07f7 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -6,6 +6,8 @@ #include "zeus/CTransform.hpp" #include "Weapon/CWeaponMgr.hpp" #include "CPlayerEnergyDrain.hpp" +#include "Weapon/CPlayerGun.hpp" +#include "CMorphBall.hpp" namespace urde { @@ -59,21 +61,21 @@ private: float x0_; float x4_; float x8_; - ResId xc_; + ResId xc_tex; float x10_ = 0.f; float x14_ = 0.f; float x18_ = 0.f; ResId x1c_ = -1; - float x20_ = 0.f; + float x20_alpha = 0.f; float x24_ = 0.f; bool x28_ = false; 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; void SetSteam(float a, float b, float c, ResId d, bool e); void Update(float dt); - float GetAlpha() const; + float GetAlpha() const { return x20_alpha; } }; zeus::CVector3f x1b4_; TUniqueId x1c4_ = kInvalidUniqueId; @@ -126,7 +128,7 @@ private: float x380_ = 0.f; float x384_ = 0.f; float x388_ = 0.f; - bool x38c_; + bool x38c_ = false; u32 x390_ = 2; u8 x394_ = 0; float x398_ = 1.5f; @@ -149,9 +151,9 @@ private: bool x3dc_ = 0; bool x3dd_ = 0; bool x3de_ = 0; - float x3e4_; - float x3e8_; - float x3ec_; + float x3e4_ = 0.f; + float x3e8_ = 0.f; + float x3ec_ = 0.f; float x3f0_ = 0.f; TUniqueId x3f4_ = kInvalidUniqueId; zeus::CVector3f x3f8_ = zeus::CVector3f::skZero; @@ -163,37 +165,125 @@ private: float x49c_; /* Value retrieved from TweakPlayerGun */ // std::unqiue_ptr<> x4a0_; u32 x4a4_ = 0; - bool x558_; - float x55c_; - float x560_; + float x4f8_ = 0.f; + float x4fc_ = 0.f; + float x53c_ = 0.f; + bool x558_ = false; + float x55c_ = 0.f; + float x560_ = 0.f; 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 x768_morphball; std::unique_ptr x76c_cameraBob; CSfxHandle x770_; - float x774_; - u32 x778_; - u32 x77c_; - u32 x780_; - float x784_; - u16 x88_; - u16 x88a_; - float x78c_; - u32 x790_; - float x794_; - float x798_; - float x79c_; - CVisorSteam x7a0_ = CVisorSteam(0.f, 0.f, 0.f, -1); - float x9f4_; - TUniqueId xa00_; - float xa04_; - ResId xa08_steamTextureId; + float x774_ = 0.f; + u32 x778_ = 0; + u32 x77c_ = 0; + u32 x780_ = 0; + float x784_ = 0.f; + u16 x788_ = 0; + float x78c_ = 0.f; + u32 x790_ = 0; + zeus::CVector3f x794_; + CVisorSteam x7a0_visorSteam = CVisorSteam(0.f, 0.f, 0.f, -1); + ResId x7cc_ = -1; + CAnimRes x7d0_animRes; + CPlayerState::EBeamId x7ec_ = CPlayerState::EBeamId::Power; + std::unique_ptr x7f0_ballTransitionBeamModel; + zeus::CTransform x7f4_; + float x824_ = 0.f; + 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_; - u32 xa10_; - float xa14_; + u32 xa10_ = 0; + 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: - 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&); bool IsTransparent() const; @@ -318,6 +408,8 @@ public: void ComputeMovement(const CFinalInput& input, CStateManager& mgr, float); float GetWeight() const; float GetDampedClampedVelocityWR() const; + const CVisorSteam& GetVisorSteam() const { return x7a0_visorSteam; } + float Get74C() const { return x74c_; } void Touch(); const std::unique_ptr& GetCameraBob() const { return x76c_cameraBob; } diff --git a/Runtime/World/CWorldTransManager.cpp b/Runtime/World/CWorldTransManager.cpp index e2b5ee0bd..37c68c9ac 100644 --- a/Runtime/World/CWorldTransManager.cpp +++ b/Runtime/World/CWorldTransManager.cpp @@ -12,6 +12,8 @@ #include "Graphics/CBooRenderer.hpp" #include "Camera/CCameraManager.hpp" #include "Character/CActorLights.hpp" +#include "GuiSys/CStringTable.hpp" +#include "Audio/CSfxManager.hpp" namespace urde { @@ -128,8 +130,47 @@ void CWorldTransManager::UpdateEnabled(float 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) @@ -266,7 +307,22 @@ void CWorldTransManager::DrawDisabled() 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() @@ -370,27 +426,34 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes, TouchModels(); } -void CWorldTransManager::EnableTransition(ResId fontId, ResId stringId, bool b1, bool b2, - float chFadeTime, float chFadeRate, float f3) +void CWorldTransManager::EnableTransition(ResId fontId, ResId stringId, u32 strIdx, bool fadeWhite, + float chFadeTime, float chFadeRate, float textStartTime) { - x40_ = b1; - x38_ = f3; + x40_strIdx = strIdx; + x38_textStartTime = textStartTime; x44_25_stopSoon = false; x30_type = ETransType::Text; x4_modelData.reset(); - x44_27_ = b2; + x44_27_fadeWhite = fadeWhite; CGuiTextProperties props(false, true, EJustification::Center, EVerticalJustification::Center); x8_textData.reset(new CGuiTextSupport(fontId, props, 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); xc_strTable = g_SimplePool->GetObj(SObjectTag{FOURCC('STRG'), stringId}); x8_textData->SetText(u""); } +void CWorldTransManager::StartTextFadeOut() +{ + if (!x44_25_stopSoon) + x34_stopTime = x0_curTime; + x44_25_stopSoon = true; +} + void CWorldTransManager::DisableTransition() { x4_modelData.reset(); @@ -403,7 +466,7 @@ void CWorldTransManager::StartTransition() x0_curTime = 0.f; x18_bgOffset = 0.f; x44_24_transFinished = false; - x44_28_ = true; + x44_28_textDirty = true; } void CWorldTransManager::EndTransition() @@ -411,4 +474,15 @@ void CWorldTransManager::EndTransition() DisableTransition(); } +bool CWorldTransManager::WaitForModelsAndTextures() +{ + std::vector 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; +} + } diff --git a/Runtime/World/CWorldTransManager.hpp b/Runtime/World/CWorldTransManager.hpp index ac55a9852..6a25f6a1b 100644 --- a/Runtime/World/CWorldTransManager.hpp +++ b/Runtime/World/CWorldTransManager.hpp @@ -65,8 +65,10 @@ private: u8 x2c_ = 127; u8 x2d_ = 64; ETransType x30_type = ETransType::Disabled; - float x38_ = 0.f; - bool x40_; + float x34_stopTime; + float x38_textStartTime = 0.f; + float x3c_sfxInterval; + bool x40_strIdx; union { struct @@ -74,8 +76,8 @@ private: bool x44_24_transFinished : 1; bool x44_25_stopSoon : 1; bool x44_26_goingUp : 1; - bool x44_27_ : 1; - bool x44_28_ : 1; + bool x44_27_fadeWhite : 1; + bool x44_28_textDirty : 1; }; u8 dummy = 0; }; @@ -101,24 +103,26 @@ private: public: CWorldTransManager() { x44_24_transFinished = true; } - void Update(float); void Draw(); void EnableTransition(const CAnimRes& samusRes, ResId platRes, const zeus::CVector3f& platScale, ResId bgRes, const zeus::CVector3f& bgScale, bool goingUp); - void EnableTransition(ResId fontId, ResId stringId, bool b1, bool b2, - float chFadeTime, float chFadeRate, float f3); + void EnableTransition(ResId fontId, ResId stringId, u32 strIdx, bool fadeWhite, + float chFadeTime, float chFadeRate, float textStartTime); void StartTransition(); void EndTransition(); bool IsTransitionFinished() const { return x44_24_transFinished; } void PleaseStopSoon() { x44_25_stopSoon = true; } + void StartTextFadeOut(); bool IsTransitionEnabled() const { return x30_type != ETransType::Disabled; } void DisableTransition(); void TouchModels(); ETransType GetTransType() { return x30_type; } + + static bool WaitForModelsAndTextures(); }; } diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 7ebf85009..e51d0810f 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -78,8 +78,10 @@ static SObjectTag MorphballDoorANCS = {}; static const SObjectTag& GetMorphballDoorACS() { if (!MorphballDoorANCS) - MorphballDoorANCS = - static_cast(g_ResFactory)->TagFromPath(_S("MP1/Shared/ANCS_1F9DA858.blend")); + { + MorphballDoorANCS.type = FOURCC('ANCS'); + MorphballDoorANCS.id = g_ResFactory->TranslateOriginalToNew(0x1F9DA858); + } return MorphballDoorANCS; } diff --git a/specter b/specter index ba23dd8d9..7cb049f09 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit ba23dd8d9449076c1ebf7c010c1b45c599456792 +Subproject commit 7cb049f093f9d1d91c501fbabfd12009a5bb0995