Codebase refactor

This commit is contained in:
Jack Andersen 2015-08-18 12:51:54 -10:00
parent d17f2a5e78
commit 6809fcc4a4
94 changed files with 217 additions and 275 deletions

View File

@ -11,6 +11,7 @@ else()
endif() endif()
add_subdirectory(libBoo) add_subdirectory(libBoo)
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libBoo/include)
set(HECL_SUBPROJECT TRUE) set(HECL_SUBPROJECT TRUE)
set(HECL_DATASPEC_DECLS set(HECL_DATASPEC_DECLS

View File

@ -8,7 +8,7 @@ macro(make_dnalist outlist)
foreach(type ${ARGN}) foreach(type ${ARGN})
get_filename_component(dir ${type} DIRECTORY) get_filename_component(dir ${type} DIRECTORY)
get_filename_component(name ${type} NAME) get_filename_component(name ${type} NAME)
atdna(${dir}/atdna_${name}.cpp ${dir}/${name}.hpp) atdna(${CMAKE_CURRENT_BINARY_DIR}/${dir}atdna_${name}.cpp ${dir}/${name}.hpp)
list(APPEND ${outlist} list(APPEND ${outlist}
${CMAKE_CURRENT_BINARY_DIR}/${dir}/atdna_${name}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${dir}/atdna_${name}.cpp
${CMAKE_CURRENT_SOURCE_DIR}/${dir}/${name}.hpp) ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/${name}.hpp)

View File

@ -5,14 +5,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CAudioStateWin : public CIOWin class CAudioStateWin : public CIOWin
{ {
}; };
}
} }
#endif // __RETRO_CAUDIOSTATEWIN_HPP__ #endif // __RETRO_CAUDIOSTATEWIN_HPP__

View File

@ -5,8 +5,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CAudioSys class CAudioSys
{ {
@ -16,7 +14,6 @@ public:
} }
}; };
}
} }
#endif // __RETRO_CAUDIOSYS_HPP__ #endif // __RETRO_CAUDIOSYS_HPP__

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CAiFuncMap class CAiFuncMap
{ {
}; };
}
} }
#endif // __RETRO_CAI_HPP__ #endif // __RETRO_CAI_HPP__

View File

@ -12,8 +12,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
using CInputStream = Athena::io::IStreamReader; using CInputStream = Athena::io::IStreamReader;
using COutputStream = Athena::io::IStreamWriter; using COutputStream = Athena::io::IStreamWriter;
@ -25,7 +23,6 @@ public:
static const char* Stringize(const char* fmt, ...); static const char* Stringize(const char* fmt, ...);
}; };
}
} }
#endif // __RETRO_CBASICS_HPP__ #endif // __RETRO_CBASICS_HPP__

View File

@ -5,8 +5,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
void CBasics::Init() void CBasics::Init()
{ {
@ -24,4 +22,3 @@ const char* CBasics::Stringize(const char* fmt, ...)
} }
} }
}

View File

@ -2,8 +2,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
const uint32_t CCRC32::crc32Table[256] = const uint32_t CCRC32::crc32Table[256] =
{ {
@ -65,4 +63,3 @@ uint32_t CCRC32::Calculate(const void* data, uint32_t length)
} }
} }
}

View File

@ -4,8 +4,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CCRC32 class CCRC32
{ {
@ -17,7 +15,6 @@ public:
static uint32_t Calculate(const void* data, uint32_t length); static uint32_t Calculate(const void* data, uint32_t length);
}; };
}
} }
#endif #endif

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class IObjectStore class IObjectStore
{ {
}; };
}
} }
#endif // __RETRO_CFACTORYSTORE_HPP__ #endif // __RETRO_CFACTORYSTORE_HPP__

View File

@ -2,8 +2,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
bool CGameAllocator::Initialize(COsContext&) bool CGameAllocator::Initialize(COsContext&)
{ {
@ -15,4 +13,3 @@ void CGameAllocator::Shutdown()
} }
} }
}

View File

@ -5,8 +5,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CGameAllocator : public IAllocator class CGameAllocator : public IAllocator
{ {
@ -15,7 +13,6 @@ public:
void Shutdown(); void Shutdown();
}; };
}
} }
#endif // __RETRO_CGAMEALLOCATOR_HPP__ #endif // __RETRO_CGAMEALLOCATOR_HPP__

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CGameOptions class CGameOptions
{ {
}; };
}
} }
#endif // __RETRO_CGAMEOPTIONS_HPP__ #endif // __RETRO_CGAMEOPTIONS_HPP__

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -7,8 +7,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CGameState class CGameState
{ {
@ -20,7 +18,6 @@ public:
} }
}; };
}
} }
#endif // __RETRO_CGAMESTATE_HPP__ #endif // __RETRO_CGAMESTATE_HPP__

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CIOWin class CIOWin
{ {
}; };
}
} }
#endif // __RETRO_CIOWIN_HPP__ #endif // __RETRO_CIOWIN_HPP__

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CIOWinManager class CIOWinManager
{ {
}; };
}
} }
#endif // __RETRO_CIOWINMANAGER_HPP__ #endif // __RETRO_CIOWINMANAGER_HPP__

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CMainFlow class CMainFlow
{ {
}; };
}
} }
#endif // __RETRO_CMAINFLOW_HPP__ #endif // __RETRO_CMAINFLOW_HPP__

View File

@ -1,4 +1,41 @@
add_subdirectory(Common) include_directories(${BOO_INCLUDE_DIR})
add_subdirectory(Audio)
add_subdirectory(Character)
add_subdirectory(Graphics)
add_subdirectory(GuiSys)
add_subdirectory(Input)
add_subdirectory(Particle)
add_library(RuntimeCommon
COsContext.hpp COsContextBoo.cpp
CMainFlow.hpp CMainFlow.cpp
CMemory.hpp CMemory.cpp
CMemoryCardSys.hpp CMemoryCardSysPC.cpp
IAllocator.hpp IAllocator.cpp
CGameAllocator.hpp CGameAllocator.cpp
CBasics.hpp CBasicsPC.cpp
CIOWin.hpp CIOWin.cpp
CIOWinManager.hpp CIOWinManager.cpp
CStateManager.hpp CStateManager.cpp
CGameState.hpp CGameState.cpp
CScriptMailbox.hpp CScriptMailbox.cpp
CMapWorldInfo.hpp CMapWorldInfo.cpp
CPlayerState.hpp CPlayerState.cpp
CWorldTransManager.hpp CWorldTransManager.cpp
CRandom16.hpp CRandom16.cpp
CResFactory.hpp CResFactory.cpp
CFactoryStore.hpp CFactoryStore.cpp
CSimplePool.hpp CSimplePool.cpp
CAi.hpp CAi.cpp
CGameOptions.hpp CGameOptions.cpp
CStaticInterference.hpp CStaticInterference.cpp
CCRC32.hpp CCRC32.cpp
IFactory.hpp
GameGlobalObjects.hpp
RetroTemplates.hpp
GCNTypes.hpp)
add_subdirectory(MP1) add_subdirectory(MP1)
add_subdirectory(MP2) add_subdirectory(MP2)
add_subdirectory(MP3) add_subdirectory(MP3)

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CMapWorldInfo class CMapWorldInfo
{ {
}; };
}
} }
#endif // __RETRO_CMAPWORLDINFO_HPP__ #endif // __RETRO_CMAPWORLDINFO_HPP__

View File

@ -3,8 +3,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
static CGameAllocator GAME_ALLOCATOR; static CGameAllocator GAME_ALLOCATOR;
static IAllocator* MEMORY_ALLOCATOR = &GAME_ALLOCATOR; static IAllocator* MEMORY_ALLOCATOR = &GAME_ALLOCATOR;
@ -44,4 +42,3 @@ CMemorySys::~CMemorySys()
IAllocator& CMemorySys::GetGameAllocator() {return GAME_ALLOCATOR;} IAllocator& CMemorySys::GetGameAllocator() {return GAME_ALLOCATOR;}
} }
}

View File

@ -6,8 +6,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CMemory class CMemory
{ {
@ -25,7 +23,6 @@ public:
static IAllocator& GetGameAllocator(); static IAllocator& GetGameAllocator();
}; };
}
} }
#endif // __RETRO_CMEMORY_HPP__ #endif // __RETRO_CMEMORY_HPP__

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CMemoryCardSys class CMemoryCardSys
{ {
}; };
}
} }
#endif // __RETRO_CMEMORYCARDSYS_HPP__ #endif // __RETRO_CMEMORYCARDSYS_HPP__

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -3,8 +3,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class COsContext class COsContext
{ {
@ -13,7 +11,6 @@ public:
int OpenWindow(const char* name, int x, int y, int w, int h); int OpenWindow(const char* name, int x, int y, int w, int h);
}; };
}
} }
#endif // __RETRO_COSCONTEXT_HPP__ #endif // __RETRO_COSCONTEXT_HPP__

View File

@ -1,9 +1,8 @@
#include "COsContext.hpp" #include "COsContext.hpp"
#include <boo/boo.hpp>
namespace Retro namespace Retro
{ {
namespace Common
{
COsContext::COsContext() COsContext::COsContext()
{ {
@ -15,4 +14,3 @@ int COsContext::OpenWindow(const char* name, int x, int y, int w, int h)
} }
} }
}

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -6,8 +6,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CPlayerState class CPlayerState
{ {
@ -23,7 +21,6 @@ class CPlayerState
CPowerUp m_powerups[29]; CPowerUp m_powerups[29];
}; };
}
} }
#endif // __RETRO_CPLAYERSTATE_HPP__ #endif // __RETRO_CPLAYERSTATE_HPP__

View File

@ -2,11 +2,8 @@
namespace Retro namespace Retro
{ {
namespace Common
{
CRandom16* GLOBAL_RANDOM = nullptr; CRandom16* GLOBAL_RANDOM = nullptr;
CGlobalRandom* GLOBAL_RANDOM_TOKEN = nullptr; CGlobalRandom* GLOBAL_RANDOM_TOKEN = nullptr;
} }
}

View File

@ -5,8 +5,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
extern class CRandom16* GLOBAL_RANDOM; extern class CRandom16* GLOBAL_RANDOM;
extern class CGlobalRandom* GLOBAL_RANDOM_TOKEN; extern class CGlobalRandom* GLOBAL_RANDOM_TOKEN;
@ -77,7 +75,6 @@ public:
} }
}; };
}
} }
#endif // RETRO_CRANDOM16_HPP #endif // RETRO_CRANDOM16_HPP

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -5,14 +5,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CResFactory : public IFactory class CResFactory : public IFactory
{ {
}; };
}
} }
#endif // __RETRO_CRESFACTORY_HPP__ #endif // __RETRO_CRESFACTORY_HPP__

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CScriptMailbox class CScriptMailbox
{ {
}; };
}
} }
#endif // __RETRO_CSCRIPTMAILBOX_HPP__ #endif // __RETRO_CSCRIPTMAILBOX_HPP__

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -6,8 +6,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CSimplePool : public IObjectStore class CSimplePool : public IObjectStore
{ {
@ -17,7 +15,6 @@ public:
} }
}; };
}
} }
#endif // __RETRO_CSIMPLEPOOL_HPP__ #endif // __RETRO_CSIMPLEPOOL_HPP__

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -10,8 +10,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CStateManager class CStateManager
{ {
@ -22,7 +20,6 @@ public:
const std::weak_ptr<CWorldTransManager>&); const std::weak_ptr<CWorldTransManager>&);
}; };
}
} }
#endif #endif

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CStaticInterference class CStaticInterference
{ {
}; };
}
} }
#endif // __RETRO_CSTATICINTERFERENCE_HPP__ #endif // __RETRO_CSTATICINTERFERENCE_HPP__

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CWorldTransManager class CWorldTransManager
{ {
}; };
}
} }
#endif // __RETRO_CWORLDTRANSMANAGER_HPP__ #endif // __RETRO_CWORLDTRANSMANAGER_HPP__

View File

@ -3,8 +3,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CAnimData class CAnimData
{ {
@ -14,7 +12,6 @@ public:
} }
}; };
}
} }
#endif // __RETRO_CANIMDATA_HPP__ #endif // __RETRO_CANIMDATA_HPP__

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -5,8 +5,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CCharacterFactoryBuilder : public IFactory class CCharacterFactoryBuilder : public IFactory
{ {
@ -16,7 +14,6 @@ public:
}; };
}; };
}
} }
#endif // __RETRO_CASSETFACTORY_HPP__ #endif // __RETRO_CASSETFACTORY_HPP__

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CCharAnimTime class CCharAnimTime
{ {
}; };
}
} }
#endif // __RETRO_CCHARANIMTIME_HPP__ #endif // __RETRO_CCHARANIMTIME_HPP__

View File

@ -5,8 +5,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CCharacterFactory : public IFactory class CCharacterFactory : public IFactory
{ {
@ -16,7 +14,6 @@ public:
}; };
}; };
}
} }
#endif // __RETRO_CCHARACTERFACTORY_HPP__ #endif // __RETRO_CCHARACTERFACTORY_HPP__

View File

@ -1,35 +0,0 @@
add_subdirectory(Audio)
add_subdirectory(Character)
add_subdirectory(Graphics)
add_subdirectory(GuiSys)
add_subdirectory(Input)
add_subdirectory(Particle)
add_library(RuntimeCommon
COsContext.hpp COsContextBoo.cpp
CMainFlow.hpp CMainFlow.cpp
CMemory.hpp CMemory.cpp
CMemoryCardSys.hpp CMemoryCardSysPC.cpp
IAllocator.hpp IAllocator.cpp
CGameAllocator.hpp CGameAllocator.cpp
CBasics.hpp CBasicsPC.cpp
CIOWin.hpp CIOWin.cpp
CIOWinManager.hpp CIOWinManager.cpp
CStateManager.hpp CStateManager.cpp
CGameState.hpp CGameState.cpp
CScriptMailbox.hpp CScriptMailbox.cpp
CMapWorldInfo.hpp CMapWorldInfo.cpp
CPlayerState.hpp CPlayerState.cpp
CWorldTransManager.hpp CWorldTransManager.cpp
CRandom16.hpp CRandom16.cpp
CResFactory.hpp CResFactory.cpp
CFactoryStore.hpp CFactoryStore.cpp
CSimplePool.hpp CSimplePool.cpp
CAi.hpp CAi.cpp
CGameOptions.hpp CGameOptions.cpp
CStaticInterference.hpp CStaticInterference.cpp
CCRC32.hpp CCRC32.cpp
IFactory.hpp
GameGlobalObjects.hpp
RetroTemplates.hpp
GCNTypes.hpp)

View File

@ -3,8 +3,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
extern class CMemoryCardSys* g_MemoryCardSys; extern class CMemoryCardSys* g_MemoryCardSys;
extern class CResFactory* g_ResFactory; extern class CResFactory* g_ResFactory;
@ -15,7 +13,6 @@ extern class CGameState* g_GameState;
extern class CInGameTweakManager* g_TweakManager; extern class CInGameTweakManager* g_TweakManager;
extern class CBooRenderer* g_Renderer; extern class CBooRenderer* g_Renderer;
}
} }
#endif // __RETRO_GAMEGLOBALOBJECTS_HPP__ #endif // __RETRO_GAMEGLOBALOBJECTS_HPP__

View File

@ -8,8 +8,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CBooRenderer class CBooRenderer
{ {
@ -19,7 +17,6 @@ public:
} }
}; };
}
} }
#endif // __RETRO_CBOORENDERER_HPP__ #endif // __RETRO_CBOORENDERER_HPP__

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CConsoleOutputWindow class CConsoleOutputWindow
{ {
}; };
}
} }
#endif // __RETRO_CCONSOLEOUTPUTWINDOW_HPP__ #endif // __RETRO_CCONSOLEOUTPUTWINDOW_HPP__

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CGuiSys class CGuiSys
{ {
}; };
}
} }
#endif // __RETRO_CGUISYS_HPP__ #endif // __RETRO_CGUISYS_HPP__

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CSplashScreen class CSplashScreen
{ {
}; };
}
} }
#endif // __RETRO_CSPLASHSCREEN_HPP__ #endif // __RETRO_CSPLASHSCREEN_HPP__

View File

@ -2,8 +2,5 @@
namespace Retro namespace Retro
{ {
namespace Common
{
} }
}

View File

@ -5,8 +5,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class IAllocator class IAllocator
{ {
@ -15,7 +13,6 @@ public:
virtual void Shutdown()=0; virtual void Shutdown()=0;
}; };
}
} }
#endif // __RETRO_IALLOCATOR_HPP__ #endif // __RETRO_IALLOCATOR_HPP__

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class IFactory class IFactory
{ {
}; };
}
} }
#endif // __RETRO_IFACTORY_HPP__ #endif // __RETRO_IFACTORY_HPP__

View File

@ -3,14 +3,11 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CInputGenerator class CInputGenerator
{ {
}; };
}
} }
#endif // __RETRO_CINPUTGENERATOR_HPP__ #endif // __RETRO_CINPUTGENERATOR_HPP__

View File

@ -5,8 +5,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CInGameTweakManager class CInGameTweakManager
{ {
@ -17,7 +15,6 @@ public:
} }
}; };
}
} }
#endif // __RETRO_CINGAMETWEAKMANAGER_HPP__ #endif // __RETRO_CINGAMETWEAKMANAGER_HPP__

View File

@ -1,4 +1,4 @@
include_directories(. ../Common) include_directories(. ..)
add_executable(mp1 add_executable(mp1
CTweaks.hpp CTweaks.cpp CTweaks.hpp CTweaks.cpp
CInGameTweakManager.hpp CInGameTweakManager.cpp CInGameTweakManager.hpp CInGameTweakManager.cpp
@ -8,4 +8,6 @@ target_link_libraries(mp1
RuntimeCommonCharacter RuntimeCommonCharacter
RuntimeCommon RuntimeCommon
DNAMP1 DNAMP1
DNACommon) DNACommon
Boo
${BOO_SYS_LIBS})

View File

@ -2,8 +2,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
CTweakParticle::CTweakParticle(CInputStream&) CTweakParticle::CTweakParticle(CInputStream&)
{ {
@ -11,4 +9,3 @@ CTweakParticle::CTweakParticle(CInputStream&)
} }
} }
}

View File

@ -6,8 +6,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CTweakParticle : DNAMP1::CTweakParticle class CTweakParticle : DNAMP1::CTweakParticle
{ {
@ -15,7 +13,6 @@ public:
CTweakParticle(CInputStream&); CTweakParticle(CInputStream&);
}; };
}
} }
#endif // __RETRO_CTWEAKPARTICLE_HPP__ #endif // __RETRO_CTWEAKPARTICLE_HPP__

View File

@ -2,8 +2,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
void CTweaks::RegisterTweaks() void CTweaks::RegisterTweaks()
{ {
@ -14,4 +12,3 @@ void CTweaks::RegisterResourceTweaks()
} }
} }
}

View File

@ -5,8 +5,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CTweaks class CTweaks
{ {
@ -16,7 +14,6 @@ public:
void RegisterResourceTweaks(); void RegisterResourceTweaks();
}; };
}
} }
#endif // __RETRO_CTWEAKS_HPP__ #endif // __RETRO_CTWEAKS_HPP__

View File

@ -1,4 +1,5 @@
#include <memory> #include <memory>
#include <boo/boo.hpp>
#include "COsContext.hpp" #include "COsContext.hpp"
#include "CBasics.hpp" #include "CBasics.hpp"
#include "CTweaks.hpp" #include "CTweaks.hpp"
@ -26,8 +27,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
CMemoryCardSys* g_MemoryCardSys = nullptr; CMemoryCardSys* g_MemoryCardSys = nullptr;
CResFactory* g_ResFactory = nullptr; CResFactory* g_ResFactory = nullptr;
CSimplePool* g_SimplePool = nullptr; CSimplePool* g_SimplePool = nullptr;
@ -36,21 +35,20 @@ CAiFuncMap* g_AiFuncMap = nullptr;
CGameState* g_GameState = nullptr; CGameState* g_GameState = nullptr;
CInGameTweakManager* g_TweakManager = nullptr; CInGameTweakManager* g_TweakManager = nullptr;
CBooRenderer* g_Renderer = nullptr; CBooRenderer* g_Renderer = nullptr;
}
namespace MP1 namespace MP1
{ {
class CGameGlobalObjects class CGameGlobalObjects
{ {
Common::CMemoryCardSys m_memoryCardSys; CMemoryCardSys m_memoryCardSys;
Common::CResFactory m_resFactory; CResFactory m_resFactory;
Common::CSimplePool m_simplePool; CSimplePool m_simplePool;
Common::CCharacterFactoryBuilder m_charFactoryBuilder; CCharacterFactoryBuilder m_charFactoryBuilder;
Common::CAiFuncMap m_aiFuncMap; CAiFuncMap m_aiFuncMap;
Common::CGameState m_gameState; CGameState m_gameState;
Common::CInGameTweakManager m_tweakManager; CInGameTweakManager m_tweakManager;
std::unique_ptr<Common::CBooRenderer> m_renderer; std::unique_ptr<CBooRenderer> m_renderer;
void AddPaksAndFactories() void AddPaksAndFactories()
{ {
@ -58,28 +56,28 @@ class CGameGlobalObjects
void LoadStringTable() void LoadStringTable()
{ {
} }
static Common::CBooRenderer* static CBooRenderer*
AllocateRenderer(Common::IObjectStore& store, Common::COsContext& osctx, AllocateRenderer(IObjectStore& store, COsContext& osctx,
Common::CMemorySys& memSys, Common::CResFactory& resFactory) CMemorySys& memSys, CResFactory& resFactory)
{ {
Common::g_Renderer = new Common::CBooRenderer(store, osctx, memSys, resFactory); g_Renderer = new CBooRenderer(store, osctx, memSys, resFactory);
return Common::g_Renderer; return g_Renderer;
} }
public: public:
CGameGlobalObjects() CGameGlobalObjects()
: m_simplePool(m_resFactory) : m_simplePool(m_resFactory)
{ {
Common::g_MemoryCardSys = &m_memoryCardSys; g_MemoryCardSys = &m_memoryCardSys;
Common::g_ResFactory = &m_resFactory; g_ResFactory = &m_resFactory;
Common::g_SimplePool = &m_simplePool; g_SimplePool = &m_simplePool;
Common::g_CharFactoryBuilder = &m_charFactoryBuilder; g_CharFactoryBuilder = &m_charFactoryBuilder;
Common::g_AiFuncMap = &m_aiFuncMap; g_AiFuncMap = &m_aiFuncMap;
Common::g_GameState = &m_gameState; g_GameState = &m_gameState;
Common::g_TweakManager = &m_tweakManager; g_TweakManager = &m_tweakManager;
} }
void PostInitialize(Common::COsContext& osctx, Common::CMemorySys& memSys) void PostInitialize(COsContext& osctx, CMemorySys& memSys)
{ {
AddPaksAndFactories(); AddPaksAndFactories();
LoadStringTable(); LoadStringTable();
@ -89,37 +87,37 @@ public:
class CGameArchitectureSupport class CGameArchitectureSupport
{ {
Common::CAudioSys m_audioSys; CAudioSys m_audioSys;
Common::CInputGenerator m_inputGenerator; CInputGenerator m_inputGenerator;
Common::CGuiSys m_guiSys; CGuiSys m_guiSys;
Common::CIOWinManager m_ioWinManager; CIOWinManager m_ioWinManager;
Common::CSplashScreen m_splashScreen; CSplashScreen m_splashScreen;
Common::CMainFlow m_mainFlow; CMainFlow m_mainFlow;
Common::CConsoleOutputWindow m_consoleWindow; CConsoleOutputWindow m_consoleWindow;
Common::CAudioStateWin m_audioStateWin; CAudioStateWin m_audioStateWin;
public: public:
CGameArchitectureSupport(Common::COsContext& osctx) CGameArchitectureSupport(COsContext& osctx)
: m_audioSys(0,0,0,0,0) : m_audioSys(0,0,0,0,0)
{ {
} }
}; };
class CMain : public Common::COsContext class CMain : public COsContext
{ {
Common::CMemorySys m_memSys; CMemorySys m_memSys;
Common::CTweaks m_tweaks; CTweaks m_tweaks;
bool m_run = true; bool m_run = true;
public: public:
CMain() CMain()
: m_memSys(*this, Common::CMemorySys::GetGameAllocator()) : m_memSys(*this, CMemorySys::GetGameAllocator())
{ {
OpenWindow("", 0, 0, 640, 480); OpenWindow("", 0, 0, 640, 480);
} }
void InitializeSubsystems() void InitializeSubsystems()
{ {
Common::CElementGen::Initialize(); CElementGen::Initialize();
Common::CAnimData::InitializeCache(); CAnimData::InitializeCache();
Common::CDecalManager::Initialize(); CDecalManager::Initialize();
} }
void AddWorldPaks() void AddWorldPaks()
{ {
@ -129,14 +127,14 @@ public:
} }
int RsMain(int argc, const char* argv[]) int RsMain(int argc, const char* argv[])
{ {
Common::TOneStatic<CGameGlobalObjects> globalObjs; TOneStatic<CGameGlobalObjects> globalObjs;
InitializeSubsystems(); InitializeSubsystems();
globalObjs->PostInitialize(*this, m_memSys); globalObjs->PostInitialize(*this, m_memSys);
m_tweaks.RegisterTweaks(); m_tweaks.RegisterTweaks();
AddWorldPaks(); AddWorldPaks();
Common::g_TweakManager->ReadFromMemoryCard("AudioTweaks"); g_TweakManager->ReadFromMemoryCard("AudioTweaks");
FillInAssetIDs(); FillInAssetIDs();
Common::TOneStatic<CGameArchitectureSupport> archSupport(*this); TOneStatic<CGameArchitectureSupport> archSupport(*this);
while (m_run) while (m_run)
{ {
@ -148,8 +146,138 @@ public:
} }
} }
struct WindowCallback : boo::IWindowCallback
{
void mouseDown(const SWindowCoord& coord, EMouseButton button, EModifierKey mods)
{
fprintf(stderr, "Mouse Down %d (%f,%f)\n", button, coord.norm[0], coord.norm[1]);
}
void mouseUp(const SWindowCoord& coord, EMouseButton button, EModifierKey mods)
{
fprintf(stderr, "Mouse Up %d (%f,%f)\n", button, coord.norm[0], coord.norm[1]);
}
void mouseMove(const SWindowCoord& coord)
{
//fprintf(stderr, "Mouse Move (%f,%f)\n", coord.norm[0], coord.norm[1]);
}
void scroll(const SWindowCoord& coord, const SScrollDelta& scroll)
{
fprintf(stderr, "Mouse Scroll (%f,%f) (%f,%f)\n", coord.norm[0], coord.norm[1], scroll.delta[0], scroll.delta[1]);
}
void touchDown(const STouchCoord& coord, uintptr_t tid)
{
//fprintf(stderr, "Touch Down %16lX (%f,%f)\n", tid, coord.coord[0], coord.coord[1]);
}
void touchUp(const STouchCoord& coord, uintptr_t tid)
{
//fprintf(stderr, "Touch Up %16lX (%f,%f)\n", tid, coord.coord[0], coord.coord[1]);
}
void touchMove(const STouchCoord& coord, uintptr_t tid)
{
//fprintf(stderr, "Touch Move %16lX (%f,%f)\n", tid, coord.coord[0], coord.coord[1]);
}
void charKeyDown(unsigned long charCode, EModifierKey mods, bool isRepeat)
{
}
void charKeyUp(unsigned long charCode, EModifierKey mods)
{
}
void specialKeyDown(ESpecialKey key, EModifierKey mods, bool isRepeat)
{
}
void specialKeyUp(ESpecialKey key, EModifierKey mods)
{
}
void modKeyDown(EModifierKey mod, bool isRepeat)
{
}
void modKeyUp(EModifierKey mod)
{
}
};
struct DolphinSmashAdapterCallback : boo::IDolphinSmashAdapterCallback
{
void controllerConnected(unsigned idx, boo::EDolphinControllerType)
{
printf("CONTROLLER %u CONNECTED\n", idx);
}
void controllerDisconnected(unsigned idx, boo::EDolphinControllerType)
{
printf("CONTROLLER %u DISCONNECTED\n", idx);
}
void controllerUpdate(unsigned idx, boo::EDolphinControllerType,
const boo::DolphinControllerState& state)
{
printf("CONTROLLER %u UPDATE %d %d\n", idx, state.m_leftStick[0], state.m_leftStick[1]);
}
};
class ApplicationDeviceFinder : public boo::DeviceFinder
{
std::unique_ptr<boo::DolphinSmashAdapter> smashAdapter = NULL;
DolphinSmashAdapterCallback m_cb;
public:
ApplicationDeviceFinder()
: boo::DeviceFinder({typeid(boo::DolphinSmashAdapter)})
{}
void deviceConnected(boo::DeviceToken& tok)
{
if (!smashAdapter)
{
smashAdapter.reset(dynamic_cast<boo::DolphinSmashAdapter*>(tok.openAndGetDevice()));
smashAdapter->setCallback(&m_cb);
smashAdapter->startRumble(0);
}
}
void deviceDisconnected(boo::DeviceToken&, boo::DeviceBase* device)
{
if (smashAdapter.get() == device)
smashAdapter.reset(nullptr);
}
};
struct ApplicationCallback : boo::IApplicationCallback
{
boo::IWindow* mainWindow = NULL;
ApplicationDeviceFinder devFinder;
WindowCallback windowCallback;
void appLaunched(boo::IApplication* app)
{
mainWindow = app->newWindow("YAY!");
mainWindow->setCallback(&windowCallback);
mainWindow->showWindow();
devFinder.startScanning();
}
void appQuitting(boo::IApplication*)
{
delete mainWindow;
}
void appFilesOpen(boo::IApplication*, const std::vector<std::string>& paths)
{
fprintf(stderr, "OPENING: ");
for (const std::string& path : paths)
fprintf(stderr, "%s ", path.c_str());
fprintf(stderr, "\n");
}
};
int main(int argc, const char* argv[]) int main(int argc, const char* argv[])
{ {
ApplicationCallback appCB;
std::unique_ptr<boo::IApplication> app =
boo::ApplicationBootstrap(boo::IApplication::PLAT_AUTO, appCB,
"mp1", "MP1", argc, argv);
Retro::MP1::CMain main; Retro::MP1::CMain main;
return main.RsMain(argc, argv); return main.RsMain(argc, argv);
} }

View File

@ -3,8 +3,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CDecalManager class CDecalManager
{ {
@ -14,7 +12,6 @@ public:
} }
}; };
}
} }
#endif // __RETRO_CDECALMANAGER_HPP__ #endif // __RETRO_CDECALMANAGER_HPP__

View File

@ -3,8 +3,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
class CElementGen class CElementGen
{ {
@ -14,7 +12,6 @@ public:
} }
}; };
}
} }
#endif // __RETRO_CELEMENTGEN_HPP__ #endif // __RETRO_CELEMENTGEN_HPP__

View File

@ -6,8 +6,6 @@
namespace Retro namespace Retro
{ {
namespace Common
{
/** /**
* @brief Inheritable singleton static-allocator * @brief Inheritable singleton static-allocator
@ -43,7 +41,6 @@ public:
template<class T> u8 TOneStatic<T>::m_allocspace[sizeof(T)]; template<class T> u8 TOneStatic<T>::m_allocspace[sizeof(T)];
template<class T> u32 TOneStatic<T>::m_refCount; template<class T> u32 TOneStatic<T>::m_refCount;
}
} }
#endif // __RETRO_TEMPLATES_HPP__ #endif // __RETRO_TEMPLATES_HPP__

2
libBoo

@ -1 +1 @@
Subproject commit 395e39d63a0ed4ffd3df869d30d4ea9ba51948d9 Subproject commit 2c2991d44ec275a31974e42eadfbcdd68c32a400