Various stubs, and starting on core functionality

This commit is contained in:
Phillip Stephens 2015-11-02 10:45:39 -08:00
parent 1e55a59568
commit b261e09f51
33 changed files with 360 additions and 70 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -0,0 +1,15 @@
#ifndef __DNACOMMON_ITWEAKPARTICLE_HPP__
#define __DNACOMMON_ITWEAKPARTICLE_HPP__
#include "../DNACommon.hpp"
namespace Retro
{
struct ITweakParticle : BigYAML
{
};
}
#endif

View File

@ -13,6 +13,7 @@ make_dnalist(liblist
MREA
DeafBabe
SCAN
Tweaks/CTweakGame
Tweaks/CTweakParticle
Tweaks/CTweakPlayer
Tweaks/CTweakPlayerControl)

View File

@ -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

View File

@ -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;

View File

@ -14,4 +14,5 @@ add_library(DNAMP2
ANCS.cpp
CMDL.hpp
MREA.cpp
MAPA.hpp
STRG.hpp STRG.cpp)

View File

@ -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> 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 {};
}

16
DataSpec/DNAMP2/MAPA.hpp Normal file
View File

@ -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

@ -1 +1 @@
Subproject commit 2efe395f5003ab4afbecf965ed2d28a51ed53593
Subproject commit 40ca0c32191ca691c8a2d8b645a22616bff751aa

View File

@ -0,0 +1,5 @@
#include "CActor.hpp"
namespace Retro
{
}

View File

@ -2,22 +2,80 @@
#define __RETRO_CACTOR_HPP__
#include "CEntity.hpp"
#include <MathLib.hpp>
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
}
};
}

View File

@ -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);

View File

@ -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

View File

@ -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);
}
};
}

View File

@ -14,6 +14,7 @@ class IDvdRequest;
class CResLoader
{
std::string m_loaderPath;
//std::list<std::unique_ptr<CPakFile>> x4_unusedList;
std::list<std::unique_ptr<CPakFile>> x1c_pakLoadedList;
std::list<std::unique_ptr<CPakFile>> x34_pakLoadingList;

View File

@ -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);

View File

View File

View File

@ -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;

View File

@ -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<std::string>& 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;

View File

@ -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})

View File

@ -1,15 +0,0 @@
#include "CTweakParticle.hpp"
namespace Retro
{
namespace MP1
{
CTweakParticle::CTweakParticle(CInputStream& reader)
: DNAMP1::CTweakParticle(reader)
{
}
}
}

View File

@ -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__

View File

@ -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<CInputStream> strm;
strm.reset(loader.LoadNewResourceSync(IDFromFactory(factory, "Game"), nullptr));
TOneStatic<DNAMP1::CTweakGame> game(*strm);
g_tweakGame = game.GetAllocSpace();
strm.reset(loader.LoadNewResourceSync(IDFromFactory(factory, "Player"), nullptr));
TOneStatic<DNAMP1::CTweakPlayer> player(*strm);
g_tweakPlayer = player.GetAllocSpace();

View File

@ -2,16 +2,15 @@
#define __RETRO_CTWEAKS_HPP__
#include "RetroTypes.hpp"
#include "CTweakParticle.hpp"
namespace Retro
{
namespace MP1
{
class CTweaks
{
TOneStatic<CTweakParticle> m_particle;
public:
void RegisterTweaks();
void RegisterResourceTweaks();

View File

@ -8,6 +8,7 @@
#include <clocale>
#include <memory>
#include <boo/boo.hpp>
#include <boo/graphicsdev/GL.hpp>
#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<CGameGlobalObjects> 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<CGameArchitectureSupport> 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<Retro::MP1::CMain> main;
std::unique_ptr<boo::IApplication> 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;
}

View File

@ -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<CElementGen> x238_children;
std::vector<CElementGen> x240_children;
std::vector<CElementGen> 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();
};
}

View File

@ -11,6 +11,9 @@ namespace Retro
{
class CWarp;
class CLight;
class CGenDescription
{
};
class CParticleGen
{

View File

@ -66,6 +66,17 @@ using TAreaId = u32;
}
template <typename T>
T GetAverageValue(const T* v, int count)
{
u32 unk = count * sizeof(T);
}
template <typename T, int Count>
class TReservedAverage
{
};
namespace std
{
template<>

2
hecl

@ -1 +1 @@
Subproject commit 046c0194f8b9d22449d4b853397e86783fa14770
Subproject commit b2d58faae7bd32488c641474db476bb9a29411db

2
libBoo

@ -1 +1 @@
Subproject commit 55bf4bbdea051618a0a288681eb8eabed1176a91
Subproject commit 4f650ce5f558b68e06cb120648be0b8d8619a93a