From d6e0a1c7c6f2dbfb5dda9ddef2f93d5dad7e5c34 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 26 Aug 2015 14:23:46 -1000 Subject: [PATCH] More class stubs --- Runtime/{CIOWin.cpp => CGameDebug.cpp} | 0 Runtime/CGameDebug.hpp | 56 +++++++++++++++++ Runtime/CIOWin.hpp | 2 +- Runtime/CIOWinManager.cpp | 10 +-- Runtime/CIOWinManager.hpp | 4 +- Runtime/CInGameTweakManagerBase.hpp | 20 ++++++ Runtime/CMFGame.hpp | 19 ------ Runtime/CMFGameBase.hpp | 23 +++++++ Runtime/CMainFlow.cpp | 39 ------------ Runtime/CMainFlowBase.cpp | 43 +++++++++++++ Runtime/CMainFlowBase.hpp | 30 +++++++++ Runtime/CMakeLists.txt | 11 ++-- Runtime/CMoviePlayer.cpp | 71 +++++++++++++++++++++ Runtime/CMoviePlayer.hpp | 44 +++++++++++++ Runtime/CPlayMovieBase.hpp | 22 +++++++ Runtime/CResFactory.hpp | 1 + Runtime/GameGlobalObjects.hpp | 2 +- Runtime/MP1/CFrontEndUI.cpp | 67 ++++++++++++++++++++ Runtime/MP1/CFrontEndUI.hpp | 59 ++++++++++++++++++ Runtime/MP1/CInGameTweakManager.hpp | 12 ++-- Runtime/{ => MP1}/CMFGame.cpp | 3 + Runtime/MP1/CMFGame.hpp | 30 +++++++++ Runtime/MP1/CMain.hpp | 54 ++++++++++++++++ Runtime/MP1/CMainFlow.cpp | 61 ++++++++++++++++++ Runtime/{ => MP1}/CMainFlow.hpp | 14 ++--- Runtime/MP1/CMakeLists.txt | 5 ++ Runtime/MP1/CPlayMovie.cpp | 13 ++++ Runtime/MP1/CPlayMovie.hpp | 30 +++++++++ Runtime/MP1/CTweakParticle.cpp | 3 + Runtime/MP1/CTweakParticle.hpp | 3 + Runtime/MP1/CTweaks.cpp | 3 + Runtime/MP1/CTweaks.hpp | 3 + Runtime/MP1/main.cpp | 85 +++++++++++++------------- 33 files changed, 716 insertions(+), 126 deletions(-) rename Runtime/{CIOWin.cpp => CGameDebug.cpp} (100%) create mode 100644 Runtime/CGameDebug.hpp create mode 100644 Runtime/CInGameTweakManagerBase.hpp delete mode 100644 Runtime/CMFGame.hpp create mode 100644 Runtime/CMFGameBase.hpp delete mode 100644 Runtime/CMainFlow.cpp create mode 100644 Runtime/CMainFlowBase.cpp create mode 100644 Runtime/CMainFlowBase.hpp create mode 100644 Runtime/CMoviePlayer.cpp create mode 100644 Runtime/CMoviePlayer.hpp create mode 100644 Runtime/CPlayMovieBase.hpp create mode 100644 Runtime/MP1/CFrontEndUI.cpp create mode 100644 Runtime/MP1/CFrontEndUI.hpp rename Runtime/{ => MP1}/CMFGame.cpp (96%) create mode 100644 Runtime/MP1/CMFGame.hpp create mode 100644 Runtime/MP1/CMain.hpp create mode 100644 Runtime/MP1/CMainFlow.cpp rename Runtime/{ => MP1}/CMainFlow.hpp (54%) create mode 100644 Runtime/MP1/CPlayMovie.cpp create mode 100644 Runtime/MP1/CPlayMovie.hpp diff --git a/Runtime/CIOWin.cpp b/Runtime/CGameDebug.cpp similarity index 100% rename from Runtime/CIOWin.cpp rename to Runtime/CGameDebug.cpp diff --git a/Runtime/CGameDebug.hpp b/Runtime/CGameDebug.hpp new file mode 100644 index 000000000..7c9f6c8c3 --- /dev/null +++ b/Runtime/CGameDebug.hpp @@ -0,0 +1,56 @@ +#ifndef __RETRO_CGAMEDEBUG_HPP__ +#define __RETRO_CGAMEDEBUG_HPP__ + +#include + +namespace Retro +{ +class CFinalInput; + +const char* StringForControlOption(int); + +enum EDebugMenu +{ +}; + +enum EDebugOptions +{ +}; + +enum EDebugMainMenu +{ +}; + +class CDebugOption +{ +public: + CDebugOption(EDebugMenu, EDebugOptions, const std::string&, bool); + CDebugOption(EDebugMenu, EDebugOptions, const std::string&, float, float, float, float); +}; + +class CGameDebug +{ +public: + enum EReturnValue + { + }; + + void DeactivateMenu(); + void AddDebugOption(EDebugMenu, EDebugOptions, const char*, bool); + void AddDebugOption(EDebugMenu, EDebugOptions, const char*, float, float, float, float); + void SetCaptureMovieTimeLeft(float); + const std::string& GetCaptureMovieName(); + void SetCaptureMovieName(const std::string&); + void AddDebugOptions(); + void CopyDebugToTweaks(); + void CopyTweaksToDebug(); + void ProcessControllerInput(const CFinalInput&); + void Update(float); + void Draw(void) const; + void ActivateMenu(EDebugMainMenu, int); + void AddDebugOption(const CDebugOption&); +}; + +} + +#endif // __RETRO_CGAMEDEBUG_HPP__ diff --git a/Runtime/CIOWin.hpp b/Runtime/CIOWin.hpp index f0cb28f3a..88940199a 100644 --- a/Runtime/CIOWin.hpp +++ b/Runtime/CIOWin.hpp @@ -22,7 +22,7 @@ public: MsgRetRemoveIOWin = 3 }; virtual ~CIOWin() {} - CIOWin(const std::string& name) : m_name(name) {m_nameHash = std::hash()(name);} + CIOWin(const char* name) : m_name(name) {m_nameHash = std::hash()(m_name);} virtual EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&)=0; virtual bool GetIsContinueDraw() const {return true;} virtual void Draw() const {} diff --git a/Runtime/CIOWinManager.cpp b/Runtime/CIOWinManager.cpp index 339f9b1d3..e84b74a14 100644 --- a/Runtime/CIOWinManager.cpp +++ b/Runtime/CIOWinManager.cpp @@ -70,16 +70,16 @@ bool CIOWinManager::DistributeOneMessage(const CArchitectureMessage& msg, while (node) { CIOWin* iow = node->GetIOWin(); - CIOWin::EMessageReturn mret = iow->OnMessage(msg, x8_internalQueue); + CIOWin::EMessageReturn mret = iow->OnMessage(msg, x8_localGatherQueue); - while (x8_internalQueue) + while (x8_localGatherQueue) { - CArchitectureMessage msg = x8_internalQueue.Pop(); + CArchitectureMessage msg = x8_localGatherQueue.Pop(); if (msg.GetTarget() == TargetIOWinManager) { if (OnIOWinMessage(msg)) { - x8_internalQueue.Clear(); + x8_localGatherQueue.Clear(); queue.Clear(); return true; } @@ -238,6 +238,7 @@ void CIOWinManager::RemoveAllIOWins() node = node->x8_next; delete delNode; } + x0_drawRoot = nullptr; node = x4_pumpRoot; while (node) { @@ -245,6 +246,7 @@ void CIOWinManager::RemoveAllIOWins() node = node->x8_next; delete delNode; } + x4_pumpRoot = nullptr; } void CIOWinManager::RemoveIOWin(CIOWin* chIow) diff --git a/Runtime/CIOWinManager.hpp b/Runtime/CIOWinManager.hpp index 867659e13..382d61ad6 100644 --- a/Runtime/CIOWinManager.hpp +++ b/Runtime/CIOWinManager.hpp @@ -25,7 +25,7 @@ class CIOWinManager }; IOWinPQNode* x0_drawRoot = nullptr; IOWinPQNode* x4_pumpRoot = nullptr; - CArchitectureQueue x8_internalQueue; + CArchitectureQueue x8_localGatherQueue; public: bool OnIOWinMessage(const CArchitectureMessage& msg); void Draw() const; @@ -39,8 +39,6 @@ public: void AddIOWin(rstl::ncrc_ptr toAdd, int pumpPrio, int drawPrio); }; - - } #endif // __RETRO_CIOWINMANAGER_HPP__ diff --git a/Runtime/CInGameTweakManagerBase.hpp b/Runtime/CInGameTweakManagerBase.hpp new file mode 100644 index 000000000..c5c225186 --- /dev/null +++ b/Runtime/CInGameTweakManagerBase.hpp @@ -0,0 +1,20 @@ +#ifndef __RETRO_CINGAMETWEAKMANAGERBASE_HPP__ +#define __RETRO_CINGAMETWEAKMANAGERBASE_HPP__ + +#include + +namespace Retro +{ + +class CInGameTweakManagerBase +{ +public: + bool ReadFromMemoryCard(const std::string& name) + { + return true; + } +}; + +} + +#endif // __RETRO_CINGAMETWEAKMANAGERBASE_HPP__ diff --git a/Runtime/CMFGame.hpp b/Runtime/CMFGame.hpp deleted file mode 100644 index e972eb4fb..000000000 --- a/Runtime/CMFGame.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __RETRO_CMFGAME_HPP__ -#define __RETRO_CMFGAME_HPP__ - -#include "CIOWin.hpp" - -namespace Retro -{ - -class CMFGameLoader : public CIOWin -{ -public: - CMFGameLoader() : CIOWin("CMFGameLoader") {} - EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue); - void Draw() const; -}; - -} - -#endif // __RETRO_CMFGAME_HPP__ diff --git a/Runtime/CMFGameBase.hpp b/Runtime/CMFGameBase.hpp new file mode 100644 index 000000000..4da1871e4 --- /dev/null +++ b/Runtime/CMFGameBase.hpp @@ -0,0 +1,23 @@ +#ifndef __RETRO_CMFGAMEBASE_HPP__ +#define __RETRO_CMFGAMEBASE_HPP__ + +#include "CIOWin.hpp" + +namespace Retro +{ + +class CMFGameBase : public CIOWin +{ +public: + CMFGameBase(const char* name) : CIOWin(name) {} +}; + +class CMFGameLoaderBase : public CIOWin +{ +public: + CMFGameLoaderBase(const char* name) : CIOWin(name) {} +}; + +} + +#endif // __RETRO_CMFGAMEBASE_HPP__ diff --git a/Runtime/CMainFlow.cpp b/Runtime/CMainFlow.cpp deleted file mode 100644 index fe3b181e2..000000000 --- a/Runtime/CMainFlow.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "CMainFlow.hpp" -#include "CArchitectureQueue.hpp" -#include "CMFGame.hpp" - -namespace Retro -{ - -void CMainFlow::AdvanceGameState(CArchitectureQueue& queue) -{ -} -void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue) -{ - switch (state) - { - case StateGameLoad: - queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 10, 1000, new CMFGameLoader()))); - break; - default: break; - } -} -CIOWin::EMessageReturn CMainFlow::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) -{ - switch (msg.GetType()) - { - case MsgTimerTick: - AdvanceGameState(queue); - break; - case MsgSetGameState: - { - CArchMsgParmInt32 state = MakeMsg::GetParmNewGameflowState(msg); - SetGameState(EClientFlowStates(state.x4_parm), queue); - return MsgRetExit; - } - default: break; - } - return MsgRetNormal; -} - -} diff --git a/Runtime/CMainFlowBase.cpp b/Runtime/CMainFlowBase.cpp new file mode 100644 index 000000000..727b56217 --- /dev/null +++ b/Runtime/CMainFlowBase.cpp @@ -0,0 +1,43 @@ +#include "CMainFlowBase.hpp" +#include "CArchitectureMessage.hpp" + +namespace Retro +{ + +CIOWin::EMessageReturn CMainFlowBase::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) +{ + switch (msg.GetType()) + { + case MsgTimerTick: + AdvanceGameState(queue); + break; + case MsgSetGameState: + { + const CArchMsgParmInt32& state = MakeMsg::GetParmNewGameflowState(msg); + x14_gameState = EClientFlowStates(state.x4_parm); + SetGameState(x14_gameState, queue); + return MsgRetExit; + } + default: break; + } + return MsgRetNormal; +} + +void CMainFlowBase::AdvanceGameState(CArchitectureQueue& queue) +{ + switch (x14_gameState) + { + case ClientStateFrontEnd: + SetGameState(ClientStateGameLoad, queue); + break; + case ClientStateUnspecified: + case ClientStateGameLoad: + SetGameState(ClientStateMoviePlay, queue); + break; + case ClientStateMoviePlay: + SetGameState(ClientStateFrontEnd, queue); + break; + } +} + +} diff --git a/Runtime/CMainFlowBase.hpp b/Runtime/CMainFlowBase.hpp new file mode 100644 index 000000000..532903179 --- /dev/null +++ b/Runtime/CMainFlowBase.hpp @@ -0,0 +1,30 @@ +#ifndef __RETRO_CMAINFLOWBASE_HPP__ +#define __RETRO_CMAINFLOWBASE_HPP__ + +#include "CIOWin.hpp" + +namespace Retro +{ + +enum EClientFlowStates +{ + ClientStateUnspecified = -1, + ClientStateFrontEnd = 7, + ClientStateGameLoad = 13, + ClientStateMoviePlay = 14 +}; + +class CMainFlowBase : public CIOWin +{ +protected: + EClientFlowStates x14_gameState; +public: + CMainFlowBase(const char* name) : CIOWin(name) {} + EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue); + void AdvanceGameState(CArchitectureQueue& queue); + virtual void SetGameState(EClientFlowStates state, CArchitectureQueue& queue)=0; +}; + +} + +#endif // __RETRO_CMAINFLOWBASE_HPP__ diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index 3eb7b8dcf..6dd9e6b0d 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -17,13 +17,12 @@ endif() add_library(RuntimeCommon COsContext.hpp COsContextBoo.cpp - CMainFlow.hpp CMainFlow.cpp CMemory.hpp CMemory.cpp CMemoryCardSys.hpp IAllocator.hpp IAllocator.cpp CGameAllocator.hpp CGameAllocator.cpp CBasics.hpp CBasicsPC.cpp - CIOWin.hpp CIOWin.cpp + CIOWin.hpp CIOWinManager.hpp CIOWinManager.cpp CStateManager.hpp CStateManager.cpp CGameState.hpp CGameState.cpp @@ -46,8 +45,6 @@ add_library(RuntimeCommon IFactory.hpp ScriptObjectSupport.hpp ScriptObjectSupport.cpp CObjectList.hpp - CMFGame.hpp CMFGame.cpp - CMainFlow.hpp CMainFlow.cpp CArchitectureMessage.hpp CArchitectureQueue.hpp CArchitectureQueue.cpp IObj.hpp @@ -61,6 +58,12 @@ add_library(RuntimeCommon CStringExtras.hpp CCallStack.hpp IOStreams.hpp IOStreams.cpp + CMainFlowBase.hpp CMainFlowBase.cpp + CMFGameBase.hpp + CInGameTweakManagerBase.hpp + CPlayMovieBase.hpp + CMoviePlayer.hpp CMoviePlayer.cpp + CGameDebug.hpp CGameDebug.cpp rstl.hpp rstl.cpp GameGlobalObjects.hpp RetroTypes.hpp diff --git a/Runtime/CMoviePlayer.cpp b/Runtime/CMoviePlayer.cpp new file mode 100644 index 000000000..24178117c --- /dev/null +++ b/Runtime/CMoviePlayer.cpp @@ -0,0 +1,71 @@ +#include "CMoviePlayer.hpp" + +namespace Retro +{ + +CMoviePlayer::CMoviePlayer(const char* path, float startTime, bool flag) +: CDvdFile(path) +{ +} + +void CMoviePlayer::VerifyCallbackStatus() +{ +} +void CMoviePlayer::DisableStaticAudio() +{ +} +void CMoviePlayer::SetStaticAudioVolume(int vol) +{ +} +void CMoviePlayer::SetStaticAudio(const void* data, u32 length, u32 loopStart, u32 loopEnd) +{ +} +void CMoviePlayer::MixAudio(short* out, const short* in, u32 length) +{ +} +void CMoviePlayer::MixStaticAudio(short* out, const short* in, u32 length) +{ +} +void CMoviePlayer::StaticMyAudioCallback() +{ +} +void CMoviePlayer::Rewind() +{ +} + +bool CMoviePlayer::GetIsMovieFinishedPlaying() const +{ +} +bool CMoviePlayer::GetIsFullyCached() const +{ +} +float CMoviePlayer::GetPlayedSeconds() const +{ +} +float CMoviePlayer::GetTotalSeconds() const +{ +} +void CMoviePlayer::SetPlayMode(EPlayMode mode) +{ +} +void CMoviePlayer::DrawFrame(const CVector3f& a, const CVector3f& b, + const CVector3f& c, const CVector3f& d) +{ +} +void CMoviePlayer::Update(float dt) +{ +} +void CMoviePlayer::DecodeFromRead(const void* data) +{ +} +void CMoviePlayer::ReadCompleted() +{ +} +void CMoviePlayer::PostDVDReadRequestIfNeeded() +{ +} +void CMoviePlayer::InitializeTextures() +{ +} + +} diff --git a/Runtime/CMoviePlayer.hpp b/Runtime/CMoviePlayer.hpp new file mode 100644 index 000000000..e50eb3154 --- /dev/null +++ b/Runtime/CMoviePlayer.hpp @@ -0,0 +1,44 @@ +#ifndef __RETRO_CMOVIEPLAYER_HPP__ +#define __RETRO_CMOVIEPLAYER_HPP__ + +#include "RetroTypes.hpp" +#include "CDvdFile.hpp" + +namespace Retro +{ +class CVector3f; + +class CMoviePlayer : public CDvdFile +{ +public: + enum EPlayMode + { + }; + + CMoviePlayer(const char* path, float startTime, bool flag); + + static void VerifyCallbackStatus(); + static void DisableStaticAudio(); + static void SetStaticAudioVolume(int vol); + static void SetStaticAudio(const void* data, u32 length, u32 loopStart, u32 loopEnd); + void MixAudio(short* out, const short* in, u32 length); + static void MixStaticAudio(short* out, const short* in, u32 length); + static void StaticMyAudioCallback(); + void Rewind(); + + bool GetIsMovieFinishedPlaying() const; + bool GetIsFullyCached() const; + float GetPlayedSeconds() const; + float GetTotalSeconds() const; + void SetPlayMode(EPlayMode); + void DrawFrame(const CVector3f& a, const CVector3f& b, const CVector3f& c, const CVector3f& d); + void Update(float dt); + void DecodeFromRead(const void* data); + void ReadCompleted(); + void PostDVDReadRequestIfNeeded(); + void InitializeTextures(); +}; + +} + +#endif // __RETRO_CMOVIEPLAYER_HPP__ diff --git a/Runtime/CPlayMovieBase.hpp b/Runtime/CPlayMovieBase.hpp new file mode 100644 index 000000000..0aac31d9b --- /dev/null +++ b/Runtime/CPlayMovieBase.hpp @@ -0,0 +1,22 @@ +#ifndef __RETRO_CPLAYMOVIEBASE_HPP__ +#define __RETRO_CPLAYMOVIEBASE_HPP__ + +#include "CIOWin.hpp" +#include "CMoviePlayer.hpp" + +namespace Retro +{ + +class CPlayMovieBase : public CIOWin +{ + CMoviePlayer x18_moviePlayer; +public: + CPlayMovieBase(const char* iowName, const char* path) + : CIOWin(iowName), x18_moviePlayer(path, 0.0, false) {} + EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) {} + void Draw() const {} +}; + +} + +#endif // __RETRO_CPLAYMOVIEBASE_HPP__ diff --git a/Runtime/CResFactory.hpp b/Runtime/CResFactory.hpp index e381f6cda..ba288de05 100644 --- a/Runtime/CResFactory.hpp +++ b/Runtime/CResFactory.hpp @@ -25,6 +25,7 @@ private: std::unordered_map m_loadList; void AddToLoadList(const SLoadingData& data) {m_loadList[data.tag] = data;} public: + CResLoader& GetLoader() {return x4_loader;} std::unique_ptr Build(const SObjectTag&, const CVParamTransfer&); void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**); void CancelBuild(const SObjectTag&); diff --git a/Runtime/GameGlobalObjects.hpp b/Runtime/GameGlobalObjects.hpp index d8e499f82..387119ef9 100644 --- a/Runtime/GameGlobalObjects.hpp +++ b/Runtime/GameGlobalObjects.hpp @@ -10,7 +10,7 @@ extern class CSimplePool* g_SimplePool; extern class CCharacterFactoryBuilder* g_CharFactoryBuilder; extern class CAiFuncMap* g_AiFuncMap; extern class CGameState* g_GameState; -extern class CInGameTweakManager* g_TweakManager; +extern class CInGameTweakManagerBase* g_TweakManager; extern class CBooRenderer* g_Renderer; } diff --git a/Runtime/MP1/CFrontEndUI.cpp b/Runtime/MP1/CFrontEndUI.cpp new file mode 100644 index 000000000..7da532a60 --- /dev/null +++ b/Runtime/MP1/CFrontEndUI.cpp @@ -0,0 +1,67 @@ +#include "CFrontEndUI.hpp" + +namespace Retro +{ +namespace MP1 +{ + +CFrontEndUI::CFrontEndUI(CArchitectureQueue& queue) +: CIOWin("CFrontEnd") +{} +void CFrontEndUI::OnSliderSelectionChange(CGuiSliderGroup* grp, float) +{} +void CFrontEndUI::OnCheckBoxSelectionChange(CGuiTableGroup* grp) +{} +void CFrontEndUI::OnOptionSubMenuCancel(CGuiTableGroup* grp) +{} +void CFrontEndUI::OnOptionsMenuCancel(CGuiTableGroup* grp) +{} +void CFrontEndUI::OnNewGameMenuCancel(CGuiTableGroup* grp) +{} +void CFrontEndUI::OnFileMenuCancel(CGuiTableGroup* grp) +{} +void CFrontEndUI::OnGenericMenuSelectionChange(CGuiTableGroup* grp, int, int) +{} +void CFrontEndUI::OnOptionsMenuAdvance(CGuiTableGroup* grp) +{} +void CFrontEndUI::OnNewGameMenuAdvance(CGuiTableGroup* grp) +{} +void CFrontEndUI::OnFileMenuAdvance(CGuiTableGroup* grp) +{} +void CFrontEndUI::OnMainMenuAdvance(CGuiTableGroup* grp) +{} +const char* CFrontEndUI::GetAttractMovieFileName(int idx) +{} +const char* CFrontEndUI::GetNextAttractMovieFileName(int idx) +{} +void CFrontEndUI::SetCurrentMovie(EMenuMovie movie) +{} +void CFrontEndUI::StopAttractMovie() +{} +void CFrontEndUI::StartAttractMovie(int idx) +{} +void CFrontEndUI::UpdateMenuHighlights(CGuiTableGroup* grp) +{} +void CFrontEndUI::CompleteStateTransition() +{} +bool CFrontEndUI::CanBuild(const SObjectTag& tag) +{} +void CFrontEndUI::StartStateTransition(EScreen screen) +{} +void CFrontEndUI::HandleDebugMenuReturnValue(CGameDebug::EReturnValue val, CArchitectureQueue& queue) +{} +void CFrontEndUI::Draw() const +{} +void CFrontEndUI::UpdateMovies(float dt) +{} +void CFrontEndUI::Update(float dt, CArchitectureQueue& queue) +{} +CIOWin::EMessageReturn CFrontEndUI::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) +{} +void CFrontEndUI::StartGame() +{} +void CFrontEndUI::InitializeFrame() +{} + +} +} diff --git a/Runtime/MP1/CFrontEndUI.hpp b/Runtime/MP1/CFrontEndUI.hpp new file mode 100644 index 000000000..0210babb4 --- /dev/null +++ b/Runtime/MP1/CFrontEndUI.hpp @@ -0,0 +1,59 @@ +#ifndef __RETRO_CFRONTENDUI_HPP__ +#define __RETRO_CFRONTENDUI_HPP__ + +#include "CIOWin.hpp" +#include "CGameDebug.hpp" + +namespace Retro +{ +class CGuiSliderGroup; +class CGuiTableGroup; +class SObjectTag; + +namespace MP1 +{ + +class CFrontEndUI : public CIOWin +{ +public: + enum EMenuMovie + { + }; + enum EScreen + { + }; + + CFrontEndUI(CArchitectureQueue& queue); + void OnSliderSelectionChange(CGuiSliderGroup* grp, float); + void OnCheckBoxSelectionChange(CGuiTableGroup* grp); + void OnOptionSubMenuCancel(CGuiTableGroup* grp); + void OnOptionsMenuCancel(CGuiTableGroup* grp); + void OnNewGameMenuCancel(CGuiTableGroup* grp); + void OnFileMenuCancel(CGuiTableGroup* grp); + void OnGenericMenuSelectionChange(CGuiTableGroup* grp, int, int); + void OnOptionsMenuAdvance(CGuiTableGroup* grp); + void OnNewGameMenuAdvance(CGuiTableGroup* grp); + void OnFileMenuAdvance(CGuiTableGroup* grp); + void OnMainMenuAdvance(CGuiTableGroup* grp); + const char* GetAttractMovieFileName(int idx); + const char* GetNextAttractMovieFileName(int idx); + void SetCurrentMovie(EMenuMovie movie); + void StopAttractMovie(); + void StartAttractMovie(int idx); + void UpdateMenuHighlights(CGuiTableGroup* grp); + void CompleteStateTransition(); + bool CanBuild(const SObjectTag& tag); + void StartStateTransition(EScreen screen); + void HandleDebugMenuReturnValue(CGameDebug::EReturnValue val, CArchitectureQueue& queue); + void Draw() const; + void UpdateMovies(float dt); + void Update(float dt, CArchitectureQueue& queue); + EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue); + void StartGame(); + void InitializeFrame(); +}; + +} +} + +#endif // __RETRO_CFRONTENDUI_HPP__ diff --git a/Runtime/MP1/CInGameTweakManager.hpp b/Runtime/MP1/CInGameTweakManager.hpp index 1a778f206..6be467118 100644 --- a/Runtime/MP1/CInGameTweakManager.hpp +++ b/Runtime/MP1/CInGameTweakManager.hpp @@ -1,20 +1,20 @@ #ifndef __RETRO_CINGAMETWEAKMANAGER_HPP__ #define __RETRO_CINGAMETWEAKMANAGER_HPP__ -#include +#include "CInGameTweakManagerBase.hpp" namespace Retro { +namespace MP1 +{ -class CInGameTweakManager +class CInGameTweakManager : public CInGameTweakManagerBase { public: - bool ReadFromMemoryCard(const std::string& name) - { - return true; - } + }; +} } #endif // __RETRO_CINGAMETWEAKMANAGER_HPP__ diff --git a/Runtime/CMFGame.cpp b/Runtime/MP1/CMFGame.cpp similarity index 96% rename from Runtime/CMFGame.cpp rename to Runtime/MP1/CMFGame.cpp index 3cc415e64..5773ee0ee 100644 --- a/Runtime/CMFGame.cpp +++ b/Runtime/MP1/CMFGame.cpp @@ -5,6 +5,8 @@ namespace Retro { +namespace MP1 +{ CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) { @@ -26,3 +28,4 @@ void CMFGameLoader::Draw() const } } +} diff --git a/Runtime/MP1/CMFGame.hpp b/Runtime/MP1/CMFGame.hpp new file mode 100644 index 000000000..548c0e388 --- /dev/null +++ b/Runtime/MP1/CMFGame.hpp @@ -0,0 +1,30 @@ +#ifndef __RETRO_CMFGAME_HPP__ +#define __RETRO_CMFGAME_HPP__ + +#include "CMFGameBase.hpp" + +namespace Retro +{ +namespace MP1 +{ + +class CMFGame : public CMFGameBase +{ +public: + CMFGame() : CMFGameBase("CMFGame") {} + CIOWin::EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue); + void Draw() const; +}; + +class CMFGameLoader : public CMFGameLoaderBase +{ +public: + CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader") {} + EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue); + void Draw() const; +}; + +} +} + +#endif // __RETRO_CMFGAME_HPP__ diff --git a/Runtime/MP1/CMain.hpp b/Runtime/MP1/CMain.hpp new file mode 100644 index 000000000..d57dfe8c6 --- /dev/null +++ b/Runtime/MP1/CMain.hpp @@ -0,0 +1,54 @@ +#ifndef __RETRO_CMAIN_HPP__ +#define __RETRO_CMAIN_HPP__ + +#include "COsContext.hpp" +#include "CMemory.hpp" +#include "CTweaks.hpp" +#include "CPlayMovie.hpp" + +namespace Retro +{ +class CStopwatch; + +namespace MP1 +{ + +enum EGameplayResult +{ + GameplayResultNone, + GameplayResultWin, + GameplayResultLose, + GameplayResultPlaying +}; + +class CMain : public COsContext +{ + CMemorySys x6c_memSys; + CTweaks x70_tweaks; + EGameplayResult xe4_gameplayResult; + bool xe8_finished = false; +public: + CMain(); + void RegisterResourceTweaks(); + void ResetGameState(); + void StreamNewGameState(CInputStream&); + void CheckTweakManagerDebugOptions() {} + void AddWorldPaks(); + int RsMain(int argc, const char* argv[]); + bool CheckReset(); + bool CheckTerminate() {return false;} + void DrawDebugMetrics(double, CStopwatch&) {} + void DoPredrawMetrics() {} + void FillInAssetIDs(); + void LoadAudio(); + void ShutdownSubsystems(); + void InitializeSubsystems(); + EGameplayResult GetGameplayResult() const {return xe4_gameplayResult;} + void SetGameplayResult(EGameplayResult wl) {xe4_gameplayResult = wl;} +}; + +extern CMain* g_main; +} +} + +#endif // __RETRO_CMAIN_HPP__ diff --git a/Runtime/MP1/CMainFlow.cpp b/Runtime/MP1/CMainFlow.cpp new file mode 100644 index 000000000..ded4f242b --- /dev/null +++ b/Runtime/MP1/CMainFlow.cpp @@ -0,0 +1,61 @@ +#include "CMainFlow.hpp" +#include "CArchitectureQueue.hpp" +#include "CMFGame.hpp" +#include "CMain.hpp" +#include "CPlayMovie.hpp" +#include "CResFactory.hpp" +#include "CFrontEndUI.hpp" +#include "GameGlobalObjects.hpp" + +namespace Retro +{ +namespace MP1 +{ + + + +void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue) +{ + switch (state) + { + case ClientStateFrontEnd: + { + if (g_main->GetGameplayResult() == GameplayResultNone) + { + g_main->SetGameplayResult(GameplayResultPlaying); + break; + } + CResLoader& loader = g_ResFactory->GetLoader(); + while (!loader.AreAllPaksLoaded()) + loader.AsyncIdlePakLoading(); + g_main->LoadAudio(); + g_main->RegisterResourceTweaks(); + queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 12, 11, new CFrontEndUI(queue)))); + break; + } + case ClientStateGameLoad: + { + queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 10, 1000, new CMFGameLoader()))); + break; + } + case ClientStateMoviePlay: + { + switch (g_main->GetGameplayResult()) + { + case GameplayResultWin: + queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 12, 11, new CPlayMovie(CPlayMovie::MovieWinGame)))); + break; + case GameplayResultLose: + queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 12, 11, new CPlayMovie(CPlayMovie::MovieLoseGame)))); + break; + default: break; + } + break; + } + default: break; + } +} + + +} +} diff --git a/Runtime/CMainFlow.hpp b/Runtime/MP1/CMainFlow.hpp similarity index 54% rename from Runtime/CMainFlow.hpp rename to Runtime/MP1/CMainFlow.hpp index a5a8f0ad7..9feb1a7f2 100644 --- a/Runtime/CMainFlow.hpp +++ b/Runtime/MP1/CMainFlow.hpp @@ -1,29 +1,27 @@ #ifndef __RETRO_CMAINFLOW_HPP__ #define __RETRO_CMAINFLOW_HPP__ -#include "CIOWin.hpp" +#include "CMainFlowBase.hpp" namespace Retro { class CArchitectureMessage; class CArchitectureQueue; -enum EClientFlowStates +namespace MP1 { - StateGameLoad = 13, -}; -class CMainFlow : public CIOWin +class CMainFlow : public CMainFlowBase { public: - CMainFlow() : CIOWin("CMainFlow") {} - void AdvanceGameState(CArchitectureQueue& queue); + CMainFlow() : CMainFlowBase("CMainFlow") {} void SetGameState(EClientFlowStates state, CArchitectureQueue& queue); - EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue); bool GetIsContinueDraw() const {return false;} void Draw() const {} }; } +} + #endif // __RETRO_CMAINFLOW_HPP__ diff --git a/Runtime/MP1/CMakeLists.txt b/Runtime/MP1/CMakeLists.txt index 65058324b..da5202074 100644 --- a/Runtime/MP1/CMakeLists.txt +++ b/Runtime/MP1/CMakeLists.txt @@ -3,6 +3,11 @@ add_executable(mp1 CTweaks.hpp CTweaks.cpp CInGameTweakManager.hpp CInGameTweakManager.cpp CTweakParticle.hpp CTweakParticle.cpp + CMainFlow.hpp CMainFlow.cpp + CMFGame.hpp CMFGame.cpp + CPlayMovie.hpp CPlayMovie.cpp + CFrontEndUI.hpp CFrontEndUI.cpp + CMain.hpp main.cpp) target_link_libraries(mp1 RuntimeCommonCharacter diff --git a/Runtime/MP1/CPlayMovie.cpp b/Runtime/MP1/CPlayMovie.cpp new file mode 100644 index 000000000..f9c977211 --- /dev/null +++ b/Runtime/MP1/CPlayMovie.cpp @@ -0,0 +1,13 @@ +namespace Retro +{ +namespace MP1 +{ + +const char* kMovies[] = +{ + "Video/wingame.thp", + "Video/losegame.thp" +}; + +} +} diff --git a/Runtime/MP1/CPlayMovie.hpp b/Runtime/MP1/CPlayMovie.hpp new file mode 100644 index 000000000..251b7e215 --- /dev/null +++ b/Runtime/MP1/CPlayMovie.hpp @@ -0,0 +1,30 @@ +#ifndef __RETRO_CPLAYMOVIE_HPP__ +#define __RETRO_CPLAYMOVIE_HPP__ + +#include "CPlayMovieBase.hpp" + +namespace Retro +{ +namespace MP1 +{ + +extern const char* kMovies[]; + +class CPlayMovie : public CPlayMovieBase +{ +public: + enum EWhichMovie + { + MovieWinGame, + MovieLoseGame + }; +private: + EWhichMovie x14_which; +public: + CPlayMovie(EWhichMovie which) : CPlayMovieBase("CPlayMovie", kMovies[which]), x14_which(which) {} +}; + +} +} + +#endif // __RETRO_CPLAYMOVIE_HPP__ diff --git a/Runtime/MP1/CTweakParticle.cpp b/Runtime/MP1/CTweakParticle.cpp index be4265443..f1e37b628 100644 --- a/Runtime/MP1/CTweakParticle.cpp +++ b/Runtime/MP1/CTweakParticle.cpp @@ -2,6 +2,8 @@ namespace Retro { +namespace MP1 +{ CTweakParticle::CTweakParticle(CInputStream&) { @@ -9,3 +11,4 @@ CTweakParticle::CTweakParticle(CInputStream&) } } +} diff --git a/Runtime/MP1/CTweakParticle.hpp b/Runtime/MP1/CTweakParticle.hpp index 7c7d564a3..d8c26c6f7 100644 --- a/Runtime/MP1/CTweakParticle.hpp +++ b/Runtime/MP1/CTweakParticle.hpp @@ -6,6 +6,8 @@ namespace Retro { +namespace MP1 +{ class CTweakParticle : DNAMP1::CTweakParticle { @@ -13,6 +15,7 @@ public: CTweakParticle(CInputStream&); }; +} } #endif // __RETRO_CTWEAKPARTICLE_HPP__ diff --git a/Runtime/MP1/CTweaks.cpp b/Runtime/MP1/CTweaks.cpp index 900f8f7d9..15c75d914 100644 --- a/Runtime/MP1/CTweaks.cpp +++ b/Runtime/MP1/CTweaks.cpp @@ -2,6 +2,8 @@ namespace Retro { +namespace MP1 +{ void CTweaks::RegisterTweaks() { @@ -12,3 +14,4 @@ void CTweaks::RegisterResourceTweaks() } } +} diff --git a/Runtime/MP1/CTweaks.hpp b/Runtime/MP1/CTweaks.hpp index ef642fed4..717131278 100644 --- a/Runtime/MP1/CTweaks.hpp +++ b/Runtime/MP1/CTweaks.hpp @@ -6,6 +6,8 @@ namespace Retro { +namespace MP1 +{ class CTweaks { @@ -15,6 +17,7 @@ public: void RegisterResourceTweaks(); }; +} } #endif // __RETRO_CTWEAKS_HPP__ diff --git a/Runtime/MP1/main.cpp b/Runtime/MP1/main.cpp index 0c282e43e..c76d7362b 100644 --- a/Runtime/MP1/main.cpp +++ b/Runtime/MP1/main.cpp @@ -1,9 +1,6 @@ #include #include -#include "COsContext.hpp" #include "CBasics.hpp" -#include "CTweaks.hpp" -#include "CMemory.hpp" #include "CMemoryCardSys.hpp" #include "CResFactory.hpp" #include "CSimplePool.hpp" @@ -25,6 +22,7 @@ #include "Audio/CAudioStateWin.hpp" #include "GameGlobalObjects.hpp" #include "CArchitectureQueue.hpp" +#include "CMain.hpp" namespace Retro { @@ -34,11 +32,12 @@ CSimplePool* g_SimplePool = nullptr; CCharacterFactoryBuilder* g_CharFactoryBuilder = nullptr; CAiFuncMap* g_AiFuncMap = nullptr; CGameState* g_GameState = nullptr; -CInGameTweakManager* g_TweakManager = nullptr; +CInGameTweakManagerBase* g_TweakManager = nullptr; CBooRenderer* g_Renderer = nullptr; namespace MP1 { +class CMain* g_main = nullptr; class CGameGlobalObjects { @@ -109,46 +108,50 @@ public: } }; -class CMain : public COsContext +CMain::CMain() +: x6c_memSys(*this, CMemorySys::GetGameAllocator()) { - CMemorySys m_memSys; - CTweaks m_tweaks; - bool m_finished = false; -public: - CMain() - : m_memSys(*this, CMemorySys::GetGameAllocator()) + OpenWindow("", 0, 0, 640, 480); + g_main = this; + xe4_gameplayResult = GameplayResultPlaying; +} +void CMain::RegisterResourceTweaks() +{ +} +void CMain::ResetGameState() +{ +} +void CMain::InitializeSubsystems() +{ + CElementGen::Initialize(); + CAnimData::InitializeCache(); + CDecalManager::Initialize(); +} +void CMain::AddWorldPaks() +{ +} +void CMain::FillInAssetIDs() +{ +} +void CMain::LoadAudio() +{ +} +int CMain::RsMain(int argc, const char* argv[]) +{ + TOneStatic globalObjs; + InitializeSubsystems(); + globalObjs->PostInitialize(*this, x6c_memSys); + x70_tweaks.RegisterTweaks(); + AddWorldPaks(); + g_TweakManager->ReadFromMemoryCard("AudioTweaks"); + FillInAssetIDs(); + TOneStatic archSupport(*this); + while (!xe8_finished) { - OpenWindow("", 0, 0, 640, 480); + xe8_finished = archSupport->Update(); } - void InitializeSubsystems() - { - CElementGen::Initialize(); - CAnimData::InitializeCache(); - CDecalManager::Initialize(); - } - void AddWorldPaks() - { - } - void FillInAssetIDs() - { - } - int RsMain(int argc, const char* argv[]) - { - TOneStatic globalObjs; - InitializeSubsystems(); - globalObjs->PostInitialize(*this, m_memSys); - m_tweaks.RegisterTweaks(); - AddWorldPaks(); - g_TweakManager->ReadFromMemoryCard("AudioTweaks"); - FillInAssetIDs(); - TOneStatic archSupport(*this); - while (!m_finished) - { - m_finished = archSupport->Update(); - } - return 0; - } -}; + return 0; +} } }