diff --git a/DataSpec/Blender/RetroMasterShader.py b/DataSpec/Blender/RetroMasterShader.py index ffb44b7fb..1be7e3e77 100644 --- a/DataSpec/Blender/RetroMasterShader.py +++ b/DataSpec/Blender/RetroMasterShader.py @@ -166,7 +166,7 @@ def make_uva4(): # Modulo mod1 = new_grp.nodes.new('ShaderNodeMath') mod1.operation = 'MODULO' - mod1.inputs[1].default_value = 1.0 + mod1.inputs[1].default_value = 900.0 mod1.location = (-400, 0) # Multiply3 @@ -236,7 +236,7 @@ def make_uva5(): # Modulo mod1 = new_grp.nodes.new('ShaderNodeMath') mod1.operation = 'MODULO' - mod1.inputs[1].default_value = 1.0 + mod1.inputs[1].default_value = 900.0 mod1.location = (-400, 0) # Multiply3 diff --git a/DataSpec/DNACommon/CMakeLists.txt b/DataSpec/DNACommon/CMakeLists.txt index 007329065..a19684ef0 100644 --- a/DataSpec/DNACommon/CMakeLists.txt +++ b/DataSpec/DNACommon/CMakeLists.txt @@ -14,5 +14,7 @@ add_library(DNACommon ANIM.hpp ANIM.cpp DeafBabe.hpp BabeDead.hpp + Tweaks/ITweakGame.hpp + Tweaks/ITweakParticle.hpp Tweaks/ITweakPlayer.hpp Tweaks/ITweakPlayerControl.hpp) diff --git a/DataSpec/DNACommon/Tweaks/ITweakGame.hpp b/DataSpec/DNACommon/Tweaks/ITweakGame.hpp new file mode 100644 index 000000000..4dd56e5a2 --- /dev/null +++ b/DataSpec/DNACommon/Tweaks/ITweakGame.hpp @@ -0,0 +1,16 @@ +#ifndef __DNACOMMON_ITWEAKGAME_HPP__ +#define __DNACOMMON_ITWEAKGAME_HPP__ + +#include "../DNACommon.hpp" + +namespace Retro +{ + +struct ITweakGame : BigYAML +{ + virtual const std::string& GetWorldPrefix() const=0; +}; + +} + +#endif diff --git a/DataSpec/DNACommon/Tweaks/ITweakParticle.hpp b/DataSpec/DNACommon/Tweaks/ITweakParticle.hpp new file mode 100644 index 000000000..642b3f431 --- /dev/null +++ b/DataSpec/DNACommon/Tweaks/ITweakParticle.hpp @@ -0,0 +1,15 @@ +#ifndef __DNACOMMON_ITWEAKPARTICLE_HPP__ +#define __DNACOMMON_ITWEAKPARTICLE_HPP__ + +#include "../DNACommon.hpp" + +namespace Retro +{ + +struct ITweakParticle : BigYAML +{ +}; + +} + +#endif diff --git a/DataSpec/DNAMP1/CMakeLists.txt b/DataSpec/DNAMP1/CMakeLists.txt index 670341974..f7193cd8d 100644 --- a/DataSpec/DNAMP1/CMakeLists.txt +++ b/DataSpec/DNAMP1/CMakeLists.txt @@ -13,6 +13,7 @@ make_dnalist(liblist MREA DeafBabe SCAN + Tweaks/CTweakGame Tweaks/CTweakParticle Tweaks/CTweakPlayer Tweaks/CTweakPlayerControl) diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp new file mode 100644 index 000000000..828eb4457 --- /dev/null +++ b/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp @@ -0,0 +1,23 @@ +#ifndef _DNAMP1_CTWEAKGAME_HPP_ +#define _DNAMP1_CTWEAKGAME_HPP_ + +#include "../../DNACommon/Tweaks/ITweakGame.hpp" + +namespace Retro +{ +namespace DNAMP1 +{ + +struct CTweakGame : ITweakGame +{ + DECL_YAML + String<-1> m_worldPrefix; + String<-1> m_ruinsArea; // ???? + + virtual const std::string& GetWorldPrefix() const { return m_worldPrefix; } + CTweakGame(Athena::io::IStreamReader& in) { this->read(in); } +}; +} +} + +#endif diff --git a/DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp b/DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp index 44dd4bfca..2dac790cb 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp @@ -1,14 +1,14 @@ #ifndef _DNAMP1_CTWEAKPARTICLE_HPP_ #define _DNAMP1_CTWEAKPARTICLE_HPP_ -#include "../../DNACommon/DNACommon.hpp" +#include "../../DNACommon/Tweaks/ITweakParticle.hpp" namespace Retro { namespace DNAMP1 { -struct CTweakParticle : BigYAML +struct CTweakParticle : ITweakParticle { DECL_YAML String<-1> m_particle; diff --git a/DataSpec/DNAMP2/CMakeLists.txt b/DataSpec/DNAMP2/CMakeLists.txt index 9ab5b32ef..c8ea9f18b 100644 --- a/DataSpec/DNAMP2/CMakeLists.txt +++ b/DataSpec/DNAMP2/CMakeLists.txt @@ -14,4 +14,5 @@ add_library(DNAMP2 ANCS.cpp CMDL.hpp MREA.cpp + MAPA.hpp STRG.hpp STRG.cpp) diff --git a/DataSpec/DNAMP2/DNAMP2.cpp b/DataSpec/DNAMP2/DNAMP2.cpp index 8cbbf0d4f..eb05ca440 100644 --- a/DataSpec/DNAMP2/DNAMP2.cpp +++ b/DataSpec/DNAMP2/DNAMP2.cpp @@ -5,6 +5,7 @@ #include "CMDL.hpp" #include "ANCS.hpp" #include "MREA.hpp" +#include "MAPA.hpp" #include "../DNACommon/TXTR.hpp" namespace Retro @@ -222,6 +223,8 @@ ResExtractor PAKBridge::LookupExtractor(const DNAMP1::PAK::Entry& ent return {nullptr, MREA::Extract, {_S(".blend")}, 3}; case SBIG('MLVL'): return {MLVL::Extract, nullptr, {_S(".yaml")}}; +// case SBIG('MAPA'): +// return {nullptr, MAPA::Extract, {_S(".blend")}, 4}; } return {}; } diff --git a/DataSpec/DNAMP2/MAPA.hpp b/DataSpec/DNAMP2/MAPA.hpp new file mode 100644 index 000000000..8b1ba643f --- /dev/null +++ b/DataSpec/DNAMP2/MAPA.hpp @@ -0,0 +1,16 @@ +#ifndef __DNAMP2_MAPA_HPP__ +#define __DNAMP2_MAPA_HPP__ + +#include "../DNAMP1/MAPA.hpp" + +namespace Retro +{ +namespace DNAMP2 +{ +struct MAPA : DNAMP1::MAPA +{}; + +} +} + +#endif diff --git a/MathLib b/MathLib index 2efe395f5..40ca0c321 160000 --- a/MathLib +++ b/MathLib @@ -1 +1 @@ -Subproject commit 2efe395f5003ab4afbecf965ed2d28a51ed53593 +Subproject commit 40ca0c32191ca691c8a2d8b645a22616bff751aa diff --git a/Runtime/CActor.cpp b/Runtime/CActor.cpp index e69de29bb..12965b034 100644 --- a/Runtime/CActor.cpp +++ b/Runtime/CActor.cpp @@ -0,0 +1,5 @@ +#include "CActor.hpp" + +namespace Retro +{ +} diff --git a/Runtime/CActor.hpp b/Runtime/CActor.hpp index e1a49d404..d0c9733c2 100644 --- a/Runtime/CActor.hpp +++ b/Runtime/CActor.hpp @@ -2,22 +2,80 @@ #define __RETRO_CACTOR_HPP__ #include "CEntity.hpp" +#include namespace Retro { -class CTransform; + +enum ECollisionResponseType +{ + CR_Unknown12 = 0xC, +}; + +enum EMaterialTypes +{ +}; + class CModelData; class CMaterialList; class CActorParameters; +class CWeaponMode; class CActor : public CEntity { +protected: + enum Flags + { + Unknown5 = (1 << 5), + Unknown6 = (1 << 6), + Unknown7 = (1 << 7), + }; + + Zeus::CTransform x34_transform; + float x40_unknown; + float x50_unknown; + float x60_unknown; + u32 x68_unknown; + u32 x6c_unknown; + bool xd0_b0_flags : 1; + bool xd0_b1_flags : 1; + bool xd0_b2_flags : 1; public: CActor(TUniqueId, bool, const std::string&, const CEntityInfo&, - const CTransform&, const CModelData&, const CMaterialList&, + const Zeus::CTransform&, const CModelData&, const CMaterialList&, const CActorParameters&, TUniqueId); virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {} + virtual Zeus::CVector3f GetAimPosition(const CStateManager&, float) + { return Zeus::CVector3f(x40_unknown, x50_unknown, x60_unknown); } + + virtual bool ValidAimTarget() { return true; } + virtual bool ValidOrbitTarget() { return true; } + virtual bool GetOrbitDistanceCheck() { return true; } + virtual Zeus::CVector3f GetOrbitPosition() + { return Zeus::CVector3f(x40_unknown, x50_unknown, x60_unknown); } + + virtual ECollisionResponseType GetCollisionResponseType(const Zeus::CVector3f&, const Zeus::CVector3f&, CWeaponMode&, int) { return CR_Unknown12; } + void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&){} + void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&){ } + void RemoveMaterial(EMaterialTypes, EMaterialTypes, CStateManager&){ } + void RemoveMaterial(EMaterialTypes, CStateManager&){ } + void AddMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&){ } + void AddMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&){} + void AddMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&){ } + void AddMaterial(EMaterialTypes, EMaterialTypes, CStateManager&){ } + void AddMaterial(EMaterialTypes, CStateManager&){ } + + virtual void SetActive(bool active) + { + //xd0_flags |= (Unknown5 | Unknown6 | Unknown7); + CEntity::SetActive(active); + } + + virtual void SetCallTouch(bool callTouch) + { + //xd1_flags = Unknown6 + } }; } diff --git a/Runtime/CBasicsPC.cpp b/Runtime/CBasicsPC.cpp index 673ed4deb..8e5a1e6d8 100644 --- a/Runtime/CBasicsPC.cpp +++ b/Runtime/CBasicsPC.cpp @@ -10,10 +10,9 @@ void CBasics::Init() { } -char STRINGIZE_STR[2048]; - const char* CBasics::Stringize(const char* fmt, ...) { + char STRINGIZE_STR[2048] = {0}; va_list ap; va_start(ap, fmt); vsnprintf(STRINGIZE_STR, 2048, fmt, ap); diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index bafef7cb0..b338ce9da 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -34,6 +34,7 @@ add_library(RuntimeCommon CResLoader.hpp CResLoader.cpp CDvdRequest.hpp CNODDvdRequest.cpp CDvdFile.hpp CNODDvdFile.cpp + CVirtualDvdFile.hpp CVirtualDvdFile.cpp IObjectStore.hpp CSimplePool.hpp CSimplePool.cpp CAi.hpp CAi.cpp diff --git a/Runtime/CPhysicsActor.hpp b/Runtime/CPhysicsActor.hpp index 883c372af..d0429f3c0 100644 --- a/Runtime/CPhysicsActor.hpp +++ b/Runtime/CPhysicsActor.hpp @@ -6,8 +6,115 @@ namespace Retro { +class CCollisionPrimitive +{ +public: + Zeus::CVector3f x1d8_offset; +}; + +class CCollisionInfoList +{ +}; + class CPhysicsActor : public CActor { +protected: + float xd8_mass; + float xdc_massRecip; + float xe0_inertialTensor; + float xe4_inertialTensorRecip; + Zeus::CAABox x194_baseBoundingBox; + CCollisionPrimitive x1b0_collisionPrimitive; + float x228_stepUpHeight; + float x22c_stepDownHeight; + float x230_restitutionCoefModifier; + float x234_collisionAccuracyModifier; +public: + + float GetCollisionAccuracyModifier() + { return x234_collisionAccuracyModifier; } + + void SetCollisionAccuracyModifier(float modifier) + { x234_collisionAccuracyModifier = modifier; } + + float GetCoefficientOfRestitutionModifier() + { return x230_restitutionCoefModifier; } + + void SetCoefficientOfRestitutionModifier(float modifier) + { x230_restitutionCoefModifier = modifier;} + + void DrawCollisionPrimitive() + { } + + void Render(const CStateManager&) + {} + + Zeus::CVector3f GetAimPosition(const CStateManager&, float val) + { + if (val <= 0.0) + return GetBoundingBox().center(); + //Zeus::CVector3f delta = PredictMotion(val); + return Zeus::CVector3f(); + } + + Zeus::CVector3f GetOrbitPosition(const CStateManager&) + { return GetBoundingBox().center(); } + + float GetStepUpHeight() + { return x228_stepUpHeight; } + + float GetStepDownHeight() + { return x22c_stepDownHeight; } + + void SetPrimitiveOffset(const Zeus::CVector2f& offset) + { x1b0_collisionPrimitive.x1d8_offset = offset; } + + Zeus::CVector3f GetPrimitiveOffset() + { return x1b0_collisionPrimitive.x1d8_offset; } + + float GetWeight() + { return 24.525002f * xd8_mass; } + + void SetBoundingBox(const Zeus::CAABox& box) + { x194_baseBoundingBox = box; } + + Zeus::CAABox GetMotionVolume() + { return Zeus::CAABox::skInvertedBox; } + + Zeus::CAABox GetBoundingBox() + { return Zeus::CAABox::skInvertedBox; } + + const Zeus::CAABox& GetBaseBoundingBox() const + { return x194_baseBoundingBox; } + + void CollidedWith(const TUniqueId&, const CCollisionInfoList&, CStateManager&) + {} + + Zeus::CTransform GetPrimitiveTransform() + { + } + + const CCollisionPrimitive& GetCollisionPrimitive() const + { return x1b0_collisionPrimitive; } + + void SetInterialTensorScalar(float tensor) + { + if (tensor <= 0.0f) + tensor = 1.0f; + xe0_inertialTensor = tensor; + xe4_inertialTensorRecip = 1.0f / tensor; + } + + void SetMass(float mass) + { + xd8_mass = mass; + float tensor = 1.0f; + if (mass > 0.0f) + tensor = 1.0f / mass; + + xdc_massRecip = tensor; + SetInterialTensorScalar(mass * tensor); + } }; } diff --git a/Runtime/CResLoader.hpp b/Runtime/CResLoader.hpp index ff53b61f0..2d8169234 100644 --- a/Runtime/CResLoader.hpp +++ b/Runtime/CResLoader.hpp @@ -14,6 +14,7 @@ class IDvdRequest; class CResLoader { + std::string m_loaderPath; //std::list> x4_unusedList; std::list> x1c_pakLoadedList; std::list> x34_pakLoadingList; diff --git a/Runtime/CTimeProvider.hpp b/Runtime/CTimeProvider.hpp index 9779e9276..b49104543 100644 --- a/Runtime/CTimeProvider.hpp +++ b/Runtime/CTimeProvider.hpp @@ -7,8 +7,8 @@ extern CTimeProvider* g_TimeProvider; class CTimeProvider { public: - const float& x0_currentTime; // in seconds - bool x4_first = true; + const float& x0_currentTime; // in seconds + bool x4_first = true; CTimeProvider* x8_lastProvider = nullptr; CTimeProvider(const float& time); diff --git a/Runtime/CVirtualDvdFile.cpp b/Runtime/CVirtualDvdFile.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/CVirtualDvdFile.hpp b/Runtime/CVirtualDvdFile.hpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/GameGlobalObjects.hpp b/Runtime/GameGlobalObjects.hpp index 97cef8a8d..3f02b08f5 100644 --- a/Runtime/GameGlobalObjects.hpp +++ b/Runtime/GameGlobalObjects.hpp @@ -13,6 +13,7 @@ extern class CGameState* g_GameState; extern class CInGameTweakManagerBase* g_TweakManager; extern class CBooRenderer* g_Renderer; +extern struct ITweakGame* g_tweakGame; extern struct ITweakPlayer* g_tweakPlayer; extern struct ITweakPlayerControl* g_tweakPlayerControl; diff --git a/Runtime/MP1/CMain.hpp b/Runtime/MP1/CMain.hpp index eaff979df..1f7a651be 100644 --- a/Runtime/MP1/CMain.hpp +++ b/Runtime/MP1/CMain.hpp @@ -5,6 +5,7 @@ #include "CMemory.hpp" #include "CTweaks.hpp" #include "CPlayMovie.hpp" +#include "IOStreams.hpp" namespace Retro { @@ -21,19 +22,16 @@ enum EGameplayResult GameplayResultPlaying }; +class WindowCallback : public boo::IWindowCallback +{ +}; + class CMain : public boo::IApplicationCallback { - boo::IWindow* mainWindow = NULL; -#if 0 - ApplicationDeviceFinder devFinder; + boo::IWindow* mainWindow; + //ApplicationDeviceFinder devFinder; WindowCallback windowCallback; - void appLaunched(boo::IApplication* app) - { - mainWindow = app->newWindow("YAY!"); - mainWindow->setCallback(&windowCallback); - mainWindow->showWindow(); - devFinder.startScanning(); - } + int appMain(boo::IApplication* app); void appQuitting(boo::IApplication*) {} void appFilesOpen(boo::IApplication*, const std::vector& paths) @@ -43,7 +41,6 @@ class CMain : public boo::IApplicationCallback fprintf(stderr, "%s ", path.c_str()); fprintf(stderr, "\n"); } -#endif CMemorySys x6c_memSys; CTweaks x70_tweaks; diff --git a/Runtime/MP1/CMakeLists.txt b/Runtime/MP1/CMakeLists.txt index ce56efc7e..99dcef9e5 100644 --- a/Runtime/MP1/CMakeLists.txt +++ b/Runtime/MP1/CMakeLists.txt @@ -2,7 +2,6 @@ include_directories(. ..) 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 @@ -16,6 +15,6 @@ target_link_libraries(mp1 DNAMP1 DNACommon HECLDatabase HECLBlender HECLCommon AthenaCore NOD - LogVisor AthenaLibYaml Boo ${PNG_LIB} squish xxhash + LogVisor AthenaLibYaml Boo ${PNG_LIB} squish xxhash Math ${ZLIB_LIBRARIES} ${LZO_LIB} ${BOO_SYS_LIBS}) diff --git a/Runtime/MP1/CTweakParticle.cpp b/Runtime/MP1/CTweakParticle.cpp deleted file mode 100644 index 173e8b995..000000000 --- a/Runtime/MP1/CTweakParticle.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "CTweakParticle.hpp" - -namespace Retro -{ -namespace MP1 -{ - -CTweakParticle::CTweakParticle(CInputStream& reader) - : DNAMP1::CTweakParticle(reader) -{ - -} - -} -} diff --git a/Runtime/MP1/CTweakParticle.hpp b/Runtime/MP1/CTweakParticle.hpp deleted file mode 100644 index 65d17eb52..000000000 --- a/Runtime/MP1/CTweakParticle.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __RETRO_CTWEAKPARTICLE_HPP__ -#define __RETRO_CTWEAKPARTICLE_HPP__ - -#include "IOStreams.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp" - -namespace Retro -{ -namespace MP1 -{ - -class CTweakParticle : DNAMP1::CTweakParticle -{ -public: - CTweakParticle(CInputStream& reader); -}; - -} -} - -#endif // __RETRO_CTWEAKPARTICLE_HPP__ diff --git a/Runtime/MP1/CTweaks.cpp b/Runtime/MP1/CTweaks.cpp index 216964356..af078a1c0 100644 --- a/Runtime/MP1/CTweaks.cpp +++ b/Runtime/MP1/CTweaks.cpp @@ -3,11 +3,13 @@ #include "CResFactory.hpp" #include "CResLoader.hpp" #include "GameGlobalObjects.hpp" +#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp" namespace Retro { +ITweakGame* g_tweakGame = nullptr; ITweakPlayer* g_tweakPlayer = nullptr; ITweakPlayerControl* g_tweakPlayerControl = nullptr; @@ -31,6 +33,9 @@ void CTweaks::RegisterTweaks() CResLoader& loader = factory.GetLoader(); std::unique_ptr strm; + strm.reset(loader.LoadNewResourceSync(IDFromFactory(factory, "Game"), nullptr)); + TOneStatic game(*strm); + g_tweakGame = game.GetAllocSpace(); strm.reset(loader.LoadNewResourceSync(IDFromFactory(factory, "Player"), nullptr)); TOneStatic player(*strm); g_tweakPlayer = player.GetAllocSpace(); diff --git a/Runtime/MP1/CTweaks.hpp b/Runtime/MP1/CTweaks.hpp index 717131278..b2bc3bd63 100644 --- a/Runtime/MP1/CTweaks.hpp +++ b/Runtime/MP1/CTweaks.hpp @@ -2,16 +2,15 @@ #define __RETRO_CTWEAKS_HPP__ #include "RetroTypes.hpp" -#include "CTweakParticle.hpp" namespace Retro { + namespace MP1 { class CTweaks { - TOneStatic m_particle; public: void RegisterTweaks(); void RegisterResourceTweaks(); diff --git a/Runtime/MP1/main.cpp b/Runtime/MP1/main.cpp index a9f94ea22..72b3e3825 100644 --- a/Runtime/MP1/main.cpp +++ b/Runtime/MP1/main.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "CBasics.hpp" #include "CMemoryCardSys.hpp" #include "CResFactory.hpp" @@ -33,11 +34,12 @@ #include "CMain.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp" +#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp" namespace Retro { CMemoryCardSys* g_MemoryCardSys = nullptr; -CResFactory* g_ResFactory = nullptr; +CResFactory* g_ResFactory = nullptr; CSimplePool* g_SimplePool = nullptr; CCharacterFactoryBuilder* g_CharFactoryBuilder = nullptr; CAiFuncMap* g_AiFuncMap = nullptr; @@ -132,6 +134,7 @@ void CMain::RegisterResourceTweaks() void CMain::ResetGameState() { } + void CMain::InitializeSubsystems() { CElementGen::Initialize(); @@ -140,15 +143,37 @@ void CMain::InitializeSubsystems() } void CMain::AddWorldPaks() { +#if 0 + u32 i = 0; + while (i <= 255) + { + std::string pakName = CBasics::Stringize("%s%i.pak", g_tweakGame->GetWorldPrefix().c_str(), i); + if (!CDvdFile::FileExists(pakName.c_str())) + { + i++; + continue; + } + + g_ResFactory->GetLoader().AddPakFile(pakName, false); + i++; + } +#endif } + void CMain::FillInAssetIDs() { } void CMain::LoadAudio() { } -int CMain::RsMain(int argc, const boo::SystemChar* argv[]) + +int CMain::appMain(boo::IApplication* app) { + Zeus::detectCPU(); + mainWindow = app->newWindow("Metroid Prime 1 Reimplementation vZygote"); + mainWindow->setCallback(&windowCallback); + mainWindow->showWindow(); + //devFinder.startScanning(); TOneStatic globalObjs; InitializeSubsystems(); globalObjs->PostInitialize(x6c_memSys); @@ -157,9 +182,19 @@ int CMain::RsMain(int argc, const boo::SystemChar* argv[]) g_TweakManager->ReadFromMemoryCard("AudioTweaks"); FillInAssetIDs(); TOneStatic archSupport; + + boo::IGraphicsCommandQueue* gfxQ = mainWindow->getCommandQueue(); + float rgba[4] = { 0.5f, 0.5f, 0.5f, 1.0f}; + gfxQ->setClearColor(rgba); + while (!xe8_b24_finished) { + mainWindow->waitForRetrace(); xe8_b24_finished = archSupport->Update(); + gfxQ->clearTarget(); + + gfxQ->present(); + gfxQ->execute(); } return 0; } @@ -178,11 +213,10 @@ int main(int argc, const char* argv[]) #else std::setlocale(LC_ALL, "en-US.UTF-8"); #endif - + LogVisor::RegisterConsoleLogger(); Retro::TOneStatic main; - std::unique_ptr app = - boo::ApplicationBootstrap(boo::IApplication::PLAT_AUTO, *main, + int ret = boo::ApplicationRun(boo::IApplication::PLAT_AUTO, *main, _S("mp1"), _S("MP1"), argc, argv); - return main->RsMain(argc, argv); + return ret; } diff --git a/Runtime/Particle/CElementGen.hpp b/Runtime/Particle/CElementGen.hpp index 4d3bc7d8c..da344d2c8 100644 --- a/Runtime/Particle/CElementGen.hpp +++ b/Runtime/Particle/CElementGen.hpp @@ -8,10 +8,39 @@ namespace Retro class CElementGen : public CParticleGen { + bool x68_particleEmission; + float x78_generatorRate; + Zeus::CVector3f x88_globalTranslation; + Zeus::CTransform x1d8_globalOrientation; + std::vector x238_children; + std::vector x240_children; + std::vector x254_children; public: + virtual const Zeus::CVector3f& GetGlobalTranslation() const + { return x88_globalTranslation; } + virtual const Zeus::CTransform& GetGlobalOrientation() const + { return x1d8_globalOrientation; } + virtual bool GetParticleEmission() const + { return x68_particleEmission; } + + void SetGeneratorRateScalar(float scalar) + { + if (scalar >= 0.0f) + x78_generatorRate = scalar; + else + x78_generatorRate = 0.0f; + + for (CElementGen& child : x240_children) + child.SetGeneratorRateScalar(x78_generatorRate); + + for (CElementGen& child : x254_children) + child.SetGeneratorRateScalar(x78_generatorRate); + } + static void Initialize() { } + void BuildParticleSystemBounds(); }; } diff --git a/Runtime/Particle/CParticleGen.hpp b/Runtime/Particle/CParticleGen.hpp index 50016ff2b..13eac8da6 100644 --- a/Runtime/Particle/CParticleGen.hpp +++ b/Runtime/Particle/CParticleGen.hpp @@ -11,6 +11,9 @@ namespace Retro { class CWarp; class CLight; +class CGenDescription +{ +}; class CParticleGen { diff --git a/Runtime/RetroTypes.hpp b/Runtime/RetroTypes.hpp index 6c657d37c..33a4ff5ee 100644 --- a/Runtime/RetroTypes.hpp +++ b/Runtime/RetroTypes.hpp @@ -66,6 +66,17 @@ using TAreaId = u32; } +template +T GetAverageValue(const T* v, int count) +{ + u32 unk = count * sizeof(T); +} + +template +class TReservedAverage +{ +}; + namespace std { template<> diff --git a/hecl b/hecl index 046c0194f..b2d58faae 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 046c0194f8b9d22449d4b853397e86783fa14770 +Subproject commit b2d58faae7bd32488c641474db476bb9a29411db diff --git a/libBoo b/libBoo index 55bf4bbde..4f650ce5f 160000 --- a/libBoo +++ b/libBoo @@ -1 +1 @@ -Subproject commit 55bf4bbdea051618a0a288681eb8eabed1176a91 +Subproject commit 4f650ce5f558b68e06cb120648be0b8d8619a93a