More stubs and main flow layout

This commit is contained in:
Jack Andersen 2015-08-17 19:54:43 -10:00
parent 3112addebd
commit 1b3d5e1d3c
57 changed files with 499 additions and 27 deletions

View File

@ -26,8 +26,9 @@ set(HECL_DATASPEC_PUSHES
HECL::Database::DATA_SPEC_REGISTRY.push_back(&Retro::SpecEntMP3);")
add_subdirectory(hecl)
add_subdirectory(NODLib)
set(NODLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/NODLib/include)
include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR} ${HECL_INCLUDE_DIR}
${NODLIB_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR})
set(NOD_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/NODLib/include)
add_subdirectory(DataSpec)
add_subdirectory(Runtime)

View File

@ -1,5 +1,4 @@
include_directories(${HECL_INCLUDE_DIR} ${NOD_LIB_INCLUDE_DIR} ${LIBPNG_INCLUDE_DIR}
${SQUISH_INCLUDE_DIR})
include_directories(${LIBPNG_INCLUDE_DIR} ${SQUISH_INCLUDE_DIR})
# Magic ingredient
find_package(atdna REQUIRED)

View File

@ -0,0 +1,19 @@
#ifndef _DNAMP1_CTWEAKPARTICLE_HPP_
#define _DNAMP1_CTWEAKPARTICLE_HPP_
#include "../../DNACommon/DNACommon.hpp"
namespace Retro
{
namespace DNAMP1
{
class CTweakParticle : BigYAML
{
DECL_YAML
};
}
}
#endif // _DNAMP1_CTWEAKPARTICLE_HPP_

View File

@ -0,0 +1,18 @@
#ifndef __RETRO_CAUDIOSTATEWIN_HPP__
#define __RETRO_CAUDIOSTATEWIN_HPP__
#include "../CIOWin.hpp"
namespace Retro
{
namespace Common
{
class CAudioStateWin : public CIOWin
{
};
}
}
#endif // __RETRO_CAUDIOSTATEWIN_HPP__

View File

@ -0,0 +1,22 @@
#ifndef __RETRO_CAUDIOSYS_HPP__
#define __RETRO_CAUDIOSYS_HPP__
#include "../GCNTypes.hpp"
namespace Retro
{
namespace Common
{
class CAudioSys
{
public:
CAudioSys(u8,u8,u8,u8,u32)
{
}
};
}
}
#endif // __RETRO_CAUDIOSYS_HPP__

View File

@ -0,0 +1,3 @@
add_library(RuntimeCommonAudio
CAudioSys.hpp CAudioSys.cpp
CAudioStateWin.hpp CAudioStateWin.cpp)

View File

View File

@ -0,0 +1,16 @@
#ifndef __RETRO_CFACTORYSTORE_HPP__
#define __RETRO_CFACTORYSTORE_HPP__
namespace Retro
{
namespace Common
{
class IObjectStore
{
};
}
}
#endif // __RETRO_CFACTORYSTORE_HPP__

View File

@ -12,12 +12,11 @@ namespace Common
class CGameState
{
std::unique_ptr<CPlayerState> m_playerState;
TOneStatic<CPlayerState> m_playerState;
CGameOptions m_gameOpts;
public:
CGameState()
{
m_playerState.reset(new CPlayerState);
}
};

View File

16
Runtime/Common/CIOWin.hpp Normal file
View File

@ -0,0 +1,16 @@
#ifndef __RETRO_CIOWIN_HPP__
#define __RETRO_CIOWIN_HPP__
namespace Retro
{
namespace Common
{
class CIOWin
{
};
}
}
#endif // __RETRO_CIOWIN_HPP__

View File

View File

@ -0,0 +1,16 @@
#ifndef __RETRO_CIOWINMANAGER_HPP__
#define __RETRO_CIOWINMANAGER_HPP__
namespace Retro
{
namespace Common
{
class CIOWinManager
{
};
}
}
#endif // __RETRO_CIOWINMANAGER_HPP__

View File

View File

@ -0,0 +1,16 @@
#ifndef __RETRO_CMAINFLOW_HPP__
#define __RETRO_CMAINFLOW_HPP__
namespace Retro
{
namespace Common
{
class CMainFlow
{
};
}
}
#endif // __RETRO_CMAINFLOW_HPP__

View File

@ -1,18 +1,20 @@
add_subdirectory(Graphics)
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
CTweaks.hpp CTweaks.cpp
CInGameTweakManager.hpp CInGameTweakManager.cpp
CTweakParticle.hpp CTweakParticle.cpp
CIOWin.hpp CIOWin.cpp
CIOWinManager.hpp CIOWinManager.cpp
CStateManager.hpp CStateManager.cpp
CGameState.hpp CGameState.cpp
CScriptMailbox.hpp CScriptMailbox.cpp
@ -21,11 +23,13 @@ add_library(RuntimeCommon
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
CElementGen.hpp CElementGen.cpp
CCRC32.hpp CCRC32.cpp
IFactory.hpp
GameGlobalObjects.hpp
RetroTemplates.hpp
GCNTypes.hpp)

View File

@ -9,7 +9,7 @@ namespace Retro
namespace Common
{
class CPlayerState : public TOneStatic<CPlayerState>
class CPlayerState
{
CStaticInterference m_staticIntf;
class CPowerUp

View File

@ -1,12 +1,14 @@
#ifndef __RETRO_CRESFACTORY_HPP__
#define __RETRO_CRESFACTORY_HPP__
#include "IFactory.hpp"
namespace Retro
{
namespace Common
{
class CResFactory
class CResFactory : public IFactory
{
};

View File

@ -1,13 +1,20 @@
#ifndef __RETRO_CSIMPLEPOOL_HPP__
#define __RETRO_CSIMPLEPOOL_HPP__
#include "IFactory.hpp"
#include "CFactoryStore.hpp"
namespace Retro
{
namespace Common
{
class CSimplePool
class CSimplePool : public IObjectStore
{
public:
CSimplePool(IFactory&)
{
}
};
}

View File

@ -13,7 +13,7 @@ namespace Retro
namespace Common
{
class CStateManager : public TOneStatic<CStateManager>
class CStateManager
{
public:
CStateManager(const std::weak_ptr<CScriptMailbox>&,

View File

@ -0,0 +1,20 @@
#ifndef __RETRO_CANIMDATA_HPP__
#define __RETRO_CANIMDATA_HPP__
namespace Retro
{
namespace Common
{
class CAnimData
{
public:
static void InitializeCache()
{
}
};
}
}
#endif // __RETRO_CANIMDATA_HPP__

View File

@ -1,13 +1,19 @@
#ifndef __RETRO_CASSETFACTORY_HPP__
#define __RETRO_CASSETFACTORY_HPP__
#include "../IFactory.hpp"
namespace Retro
{
namespace Common
{
class CCharacterFactoryBuilder
class CCharacterFactoryBuilder : public IFactory
{
public:
class CDummyFactory : public IFactory
{
};
};
}

View File

@ -0,0 +1,16 @@
#ifndef __RETRO_CCHARANIMTIME_HPP__
#define __RETRO_CCHARANIMTIME_HPP__
namespace Retro
{
namespace Common
{
class CCharAnimTime
{
};
}
}
#endif // __RETRO_CCHARANIMTIME_HPP__

View File

@ -1,8 +1,22 @@
#ifndef __RETRO_CCHARACTERFACTORY_HPP__
#define __RETRO_CCHARACTERFACTORY_HPP__
class CCharacterFactory
#include "../IFactory.hpp"
namespace Retro
{
namespace Common
{
class CCharacterFactory : public IFactory
{
public:
class CDummyFactory : public IFactory
{
};
};
}
}
#endif // __RETRO_CCHARACTERFACTORY_HPP__

View File

@ -1,4 +1,5 @@
add_library(RuntimeCommonCharacter
CAssetFactory.hpp CAssetFactory.cpp
CCharacterFactory.hpp CCharacterFactory.cpp
CAnimData.hpp CAnimData.cpp)
CAnimData.hpp CAnimData.cpp
CCharAnimTime.hpp CCharAnimTime.cpp)

View File

@ -0,0 +1,21 @@
#ifndef __RETRO_GAMEGLOBALOBJECTS_HPP__
#define __RETRO_GAMEGLOBALOBJECTS_HPP__
namespace Retro
{
namespace Common
{
extern class CMemoryCardSys* g_MemoryCardSys;
extern class CResFactory* g_ResFactory;
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 CBooRenderer* g_Renderer;
}
}
#endif // __RETRO_GAMEGLOBALOBJECTS_HPP__

View File

View File

@ -0,0 +1,25 @@
#ifndef __RETRO_CBOORENDERER_HPP__
#define __RETRO_CBOORENDERER_HPP__
#include "../CFactoryStore.hpp"
#include "../COsContext.hpp"
#include "../CMemory.hpp"
#include "../CResFactory.hpp"
namespace Retro
{
namespace Common
{
class CBooRenderer
{
public:
CBooRenderer(IObjectStore&, COsContext&, CMemorySys&, CResFactory&)
{
}
};
}
}
#endif // __RETRO_CBOORENDERER_HPP__

View File

@ -0,0 +1,2 @@
add_library(RuntimeCommonGraphics
CBooRenderer.hpp CBooRenderer.cpp)

View File

@ -0,0 +1,16 @@
#ifndef __RETRO_CCONSOLEOUTPUTWINDOW_HPP__
#define __RETRO_CCONSOLEOUTPUTWINDOW_HPP__
namespace Retro
{
namespace Common
{
class CConsoleOutputWindow
{
};
}
}
#endif // __RETRO_CCONSOLEOUTPUTWINDOW_HPP__

View File

View File

@ -0,0 +1,16 @@
#ifndef __RETRO_CGUISYS_HPP__
#define __RETRO_CGUISYS_HPP__
namespace Retro
{
namespace Common
{
class CGuiSys
{
};
}
}
#endif // __RETRO_CGUISYS_HPP__

View File

@ -0,0 +1,4 @@
add_library(RuntimeCommonGuiSys
CGuiSys.hpp CGuiSys.cpp
CSplashScreen.hpp CSplashScreen.cpp
CConsoleOutputWindow.hpp CConsoleOutputWindow.cpp)

View File

View File

@ -0,0 +1,16 @@
#ifndef __RETRO_CSPLASHSCREEN_HPP__
#define __RETRO_CSPLASHSCREEN_HPP__
namespace Retro
{
namespace Common
{
class CSplashScreen
{
};
}
}
#endif // __RETRO_CSPLASHSCREEN_HPP__

View File

@ -0,0 +1,16 @@
#ifndef __RETRO_IFACTORY_HPP__
#define __RETRO_IFACTORY_HPP__
namespace Retro
{
namespace Common
{
class IFactory
{
};
}
}
#endif // __RETRO_IFACTORY_HPP__

View File

View File

@ -0,0 +1,16 @@
#ifndef __RETRO_CINPUTGENERATOR_HPP__
#define __RETRO_CINPUTGENERATOR_HPP__
namespace Retro
{
namespace Common
{
class CInputGenerator
{
};
}
}
#endif // __RETRO_CINPUTGENERATOR_HPP__

View File

@ -0,0 +1,2 @@
add_library(RuntimeCommonInput
CInputGenerator.hpp CInputGenerator.cpp)

View File

@ -0,0 +1,20 @@
#ifndef __RETRO_CDECALMANAGER_HPP__
#define __RETRO_CDECALMANAGER_HPP__
namespace Retro
{
namespace Common
{
class CDecalManager
{
public:
static void Initialize()
{
}
};
}
}
#endif // __RETRO_CDECALMANAGER_HPP__

View File

View File

@ -8,6 +8,10 @@ namespace Common
class CElementGen
{
public:
static void Initialize()
{
}
};
}

View File

@ -0,0 +1,3 @@
add_library(RuntimeCommonParticle
CElementGen.hpp CElementGen.cpp
CDecalManager.hpp CDecalManager.cpp)

View File

@ -1,6 +1,7 @@
#ifndef __RETRO_TEMPLATES_HPP__
#define __RETRO_TEMPLATES_HPP__
#include <utility>
#include "GCNTypes.hpp"
namespace Retro
@ -14,15 +15,32 @@ namespace Common
template<class T>
class TOneStatic
{
static T m_allocspace;
static u8 m_allocspace[sizeof(T)];
static uint32_t m_refCount;
public:
static T* GetAllocSpace() {return &m_allocspace;}
static T* GetAllocSpace() {return (T*)m_allocspace;}
static u32& ReferenceCount() {return m_refCount;}
void* operator new(size_t) {++ReferenceCount(); return GetAllocSpace();}
void operator delete(void*) {--ReferenceCount();}
T* operator->() const {return (T*)m_allocspace;}
void* operator new(size_t) = delete;
void operator delete(void*) = delete;
template<typename U = T>
TOneStatic(typename std::enable_if<!std::is_default_constructible<U>::value>::type* = 0)
{++ReferenceCount();}
template<typename U = T>
TOneStatic(typename std::enable_if<std::is_default_constructible<U>::value>::type* = 0)
{++ReferenceCount(); new (GetAllocSpace()) T();}
template<typename... Args> TOneStatic(Args&&... args)
{++ReferenceCount(); new (GetAllocSpace()) T(std::forward<Args>(args)...);}
~TOneStatic() {--ReferenceCount();}
template<typename... Args> void reset(Args&&... args)
{new (GetAllocSpace()) T(std::forward<Args>(args)...);}
};
template<class T> T TOneStatic<T>::m_allocspace;
template<class T> u8 TOneStatic<T>::m_allocspace[sizeof(T)];
template<class T> u32 TOneStatic<T>::m_refCount;
}

View File

View File

@ -1,6 +1,8 @@
#ifndef __RETRO_CINGAMETWEAKMANAGER_HPP__
#define __RETRO_CINGAMETWEAKMANAGER_HPP__
#include <string>
namespace Retro
{
namespace Common
@ -8,6 +10,11 @@ namespace Common
class CInGameTweakManager
{
public:
bool ReadFromMemoryCard(const std::string& name)
{
return true;
}
};
}

View File

@ -1,6 +1,11 @@
include_directories(. ../Common)
add_executable(mp1
CTweaks.hpp CTweaks.cpp
CInGameTweakManager.hpp CInGameTweakManager.cpp
CTweakParticle.hpp CTweakParticle.cpp
main.cpp)
target_link_libraries(mp1
RuntimeCommonCharacter
RuntimeCommon)
RuntimeCommon
DNAMP1
DNACommon)

View File

@ -2,13 +2,14 @@
#define __RETRO_CTWEAKPARTICLE_HPP__
#include "CBasics.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp"
namespace Retro
{
namespace Common
{
class CTweakParticle : TOneStatic<CTweakParticle>
class CTweakParticle : DNAMP1::CTweakParticle
{
public:
CTweakParticle(CInputStream&);

View File

@ -1,7 +1,6 @@
#ifndef __RETRO_CTWEAKS_HPP__
#define __RETRO_CTWEAKS_HPP__
#include <memory>
#include "CTweakParticle.hpp"
namespace Retro

View File

@ -10,13 +10,38 @@
#include "CAi.hpp"
#include "CGameState.hpp"
#include "CInGameTweakManager.hpp"
#include "Particle/CElementGen.hpp"
#include "Character/CAnimData.hpp"
#include "Particle/CDecalManager.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "Audio/CAudioSys.hpp"
#include "Input/CInputGenerator.hpp"
#include "GuiSys/CGuiSys.hpp"
#include "CIOWinManager.hpp"
#include "GuiSys/CSplashScreen.hpp"
#include "CMainFlow.hpp"
#include "GuiSys/CConsoleOutputWindow.hpp"
#include "Audio/CAudioStateWin.hpp"
#include "GameGlobalObjects.hpp"
namespace Retro
{
namespace Common
{
CMemoryCardSys* g_MemoryCardSys = nullptr;
CResFactory* g_ResFactory = nullptr;
CSimplePool* g_SimplePool = nullptr;
CCharacterFactoryBuilder* g_CharFactoryBuilder = nullptr;
CAiFuncMap* g_AiFuncMap = nullptr;
CGameState* g_GameState = nullptr;
CInGameTweakManager* g_TweakManager = nullptr;
CBooRenderer* g_Renderer = nullptr;
}
namespace MP1
{
class CGameGlobalObjects : public Common::TOneStatic<CGameGlobalObjects>
class CGameGlobalObjects
{
Common::CMemoryCardSys m_memoryCardSys;
Common::CResFactory m_resFactory;
@ -25,9 +50,56 @@ class CGameGlobalObjects : public Common::TOneStatic<CGameGlobalObjects>
Common::CAiFuncMap m_aiFuncMap;
Common::CGameState m_gameState;
Common::CInGameTweakManager m_tweakManager;
std::unique_ptr<Common::CBooRenderer> m_renderer;
void AddPaksAndFactories()
{
}
void LoadStringTable()
{
}
static Common::CBooRenderer*
AllocateRenderer(Common::IObjectStore& store, Common::COsContext& osctx,
Common::CMemorySys& memSys, Common::CResFactory& resFactory)
{
Common::g_Renderer = new Common::CBooRenderer(store, osctx, memSys, resFactory);
return Common::g_Renderer;
}
public:
CGameGlobalObjects()
: m_simplePool(m_resFactory)
{
Common::g_MemoryCardSys = &m_memoryCardSys;
Common::g_ResFactory = &m_resFactory;
Common::g_SimplePool = &m_simplePool;
Common::g_CharFactoryBuilder = &m_charFactoryBuilder;
Common::g_AiFuncMap = &m_aiFuncMap;
Common::g_GameState = &m_gameState;
Common::g_TweakManager = &m_tweakManager;
}
void PostInitialize(Common::COsContext& osctx, Common::CMemorySys& memSys)
{
AddPaksAndFactories();
LoadStringTable();
m_renderer.reset(AllocateRenderer(m_simplePool, osctx, memSys, m_resFactory));
}
};
class CGameArchitectureSupport
{
Common::CAudioSys m_audioSys;
Common::CInputGenerator m_inputGenerator;
Common::CGuiSys m_guiSys;
Common::CIOWinManager m_ioWinManager;
Common::CSplashScreen m_splashScreen;
Common::CMainFlow m_mainFlow;
Common::CConsoleOutputWindow m_consoleWindow;
Common::CAudioStateWin m_audioStateWin;
public:
CGameArchitectureSupport(Common::COsContext& osctx)
: m_audioSys(0,0,0,0,0)
{
}
};
@ -44,13 +116,27 @@ public:
OpenWindow("", 0, 0, 640, 480);
}
void InitializeSubsystems()
{
Common::CElementGen::Initialize();
Common::CAnimData::InitializeCache();
Common::CDecalManager::Initialize();
}
void AddWorldPaks()
{
}
void FillInAssetIDs()
{
}
int RsMain(int argc, const char* argv[])
{
CGameGlobalObjects* globalObjs = new CGameGlobalObjects;
Common::TOneStatic<CGameGlobalObjects> globalObjs;
InitializeSubsystems();
globalObjs->PostInitialize(*this, m_memSys);
m_tweaks.RegisterTweaks();
AddWorldPaks();
Common::g_TweakManager->ReadFromMemoryCard("AudioTweaks");
FillInAssetIDs();
Common::TOneStatic<CGameArchitectureSupport> archSupport(*this);
while (m_run)
{