This commit is contained in:
Jack Andersen 2016-08-03 13:47:21 -10:00
commit 76a6b51d14
11 changed files with 562 additions and 4 deletions

View File

@ -44,11 +44,15 @@ void CMapArea::PostConstruct()
(reinterpret_cast<CMapAreaSurface*>(x40_surfaceStart + j))->PostConstruct(x44_buf.get());
}
void CMapArea::CMapAreaSurface::PostConstruct(const void *)
{
}
CFactoryFnReturn FMapAreaFactory(const SObjectTag& objTag, CInputStream& in, const CVParamTransfer&)
{
u32 size = g_ResFactory->ResourceSize(objTag);
return TToken<CMapArea>::GetIObjObjectFor(std::unique_ptr<CMapArea>
(new CMapArea(in, size)));
return TToken<CMapArea>::GetIObjObjectFor(std::make_unique<CMapArea>(in, size));
}
}

View File

@ -53,7 +53,7 @@ CFactoryFnReturn FMapUniverseFactory(const SObjectTag&, CInputStream& in, const
in.readUint32Big();
u32 version = in.readUint32Big();
return TToken<CMapUniverse>::GetIObjObjectFor(std::unique_ptr<CMapUniverse>(new CMapUniverse(in, version)));
return TToken<CMapUniverse>::GetIObjObjectFor(std::make_unique<CMapUniverse>(in, version));
}
}

View File

@ -48,6 +48,7 @@ add_library(RuntimeCommon
#CMemory.hpp CMemory.cpp
ITweak.hpp
CMemoryCardSys.hpp
CScannableObjectInfo.hpp CScannableObjectInfo.cpp
CSaveWorld.hpp CSaveWorld.cpp
IAllocator.hpp IAllocator.cpp
CGameAllocator.hpp CGameAllocator.cpp

View File

@ -0,0 +1,74 @@
#include "CScannableObjectInfo.hpp"
#include "GameGlobalObjects.hpp"
#include "GuiSys/ITweakGui.hpp"
namespace urde
{
CScannableObjectInfo::CScannableObjectInfo(CInputStream& in, ResId resId)
: x0_scannableObjectId(resId)
{
u32 version = in.readUint32Big();
Load(in, version);
}
ResId CScannableObjectInfo::GetScannableObjectId() const
{
return x0_scannableObjectId;
}
ResId CScannableObjectInfo::GetStringTableId() const
{
return x4_stringId;
}
float CScannableObjectInfo::GetTotalDownloadTime() const
{
return x8_totalDownloadTime;
}
const CScannableObjectInfo::SBucket& CScannableObjectInfo::GetBucket(s32 idx) const
{
return x14_buckets[idx];
}
void CScannableObjectInfo::Load(CInputStream& in, u32 version)
{
in.readUint32Big();
in.readUint32Big();
x4_stringId = in.readUint32Big();
if (version < 4)
x8_totalDownloadTime = in.readFloatBig();
else
{
u32 scanSpeed = in.readUint32Big();
x8_totalDownloadTime = g_tweakGui->GetScanSpeed(scanSpeed);
}
xc_category = in.readUint32Big();
if (version > 4)
x10_important = in.readBool();
for (u32 i = 0 ; i<4 ; i++)
x14_buckets.emplace_back(in, version);
}
CScannableObjectInfo::SBucket::SBucket(CInputStream& in, u32 version)
{
x0_texture = in.readUint32Big();
x4_appearanceRange = in.readFloatBig();
x8_imagePos = in.readUint32Big();
if (version > 1)
{
xc_size.x = in.readUint32Big();
xc_size.y = in.readUint32Big();
x14_interval = in.readFloatBig();
if (version >= 3)
x18_fadeDuration = in.readFloatBig();
}
}
CFactoryFnReturn FScannableObjectInfoFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer &)
{
return TToken<CScannableObjectInfo>::GetIObjObjectFor(std::make_unique<CScannableObjectInfo>(in, tag.id));
}
}

View File

@ -0,0 +1,44 @@
#ifndef __URDE_CSCANNABLEOBJECTINFO_HPP__
#define __URDE_CSCANNABLEOBJECTINFO_HPP__
#include "RetroTypes.hpp"
#include "IFactory.hpp"
#include "CToken.hpp"
#include "zeus/CVector2i.hpp"
namespace urde
{
class CScannableObjectInfo
{
public:
struct SBucket
{
ResId x0_texture = -1;
float x4_appearanceRange = 0.f;
u32 x8_imagePos = 0;
zeus::CVector2i xc_size;
float x14_interval = 0.f;
float x18_fadeDuration = 0.f;
SBucket(CInputStream&, u32 version);
};
private:
void Load(CInputStream&, u32);
ResId x0_scannableObjectId;
u32 x4_stringId = -1;
float x8_totalDownloadTime = 0.f;
u32 xc_category = 0;
bool x10_important = false;
rstl::reserved_vector<SBucket, 4> x14_buckets;
public:
CScannableObjectInfo(CInputStream&, ResId);
ResId GetStringTableId() const;
ResId GetScannableObjectId() const;
float GetTotalDownloadTime() const;
const SBucket& GetBucket(s32) const;
bool IsImportant() const;
};
CFactoryFnReturn FScannableObjectInfoFactory(const SObjectTag&, CInputStream&, const CVParamTransfer&);
}
#endif // __URDE_CSCANNABLEOBJECTINFO_HPP__

View File

@ -4,6 +4,7 @@
#include "../DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp"
#include "../DataSpec/DNACommon/Tweaks/ITweakPlayerControl.hpp"
#include "AutoMapper/ITweakAutoMapper.hpp"
#include "GuiSys/ITweakGui.hpp"
namespace urde
{
@ -21,6 +22,7 @@ extern DataSpec::ITweakGame* g_tweakGame;
extern DataSpec::ITweakPlayer* g_tweakPlayer;
extern DataSpec::ITweakPlayerControl* g_tweakPlayerControl;
extern ITweakAutoMapper* g_tweakAutoMapper;
extern ITweakGui* g_tweakGui;
}

View File

@ -92,6 +92,7 @@ set(GUISYS_SOURCES
CWordBreakTables.cpp
CWordBreakTables.hpp
CFontImageDef.cpp
CFontImageDef.hpp)
CFontImageDef.hpp
ITweakGui.hpp)
runtime_add_list(GuiSys GUISYS_SOURCES)

View File

@ -0,0 +1,18 @@
#ifndef __URDE_ITWEAKGUI_HPP__
#define __URDE_ITWEAKGUI_HPP__
#include "RetroTypes.hpp"
#include "ITweak.hpp"
namespace urde
{
class ITweakGui : public ITweak
{
public:
virtual ~ITweakGui() {}
virtual float GetScanSpeed(s32) const=0;
};
}
#endif // __URDE_ITWEAKGUI_HPP__

View File

@ -4,6 +4,7 @@ set(MP1_SOURCES
CInGameTweakManager.hpp CInGameTweakManager.cpp
Tweaks/CTweakAutoMapper.hpp Tweaks/CTweakAutoMapper.cpp
Tweaks/CTweakPlayer.hpp Tweaks/CTweakPlayer.cpp
Tweaks/CTweakGui.hpp Tweaks/CTweakGui.cpp
CMainFlow.hpp CMainFlow.cpp
CMFGame.hpp CMFGame.cpp
CPlayMovie.hpp CPlayMovie.cpp

View File

@ -0,0 +1,215 @@
#include "CTweakGui.hpp"
namespace urde
{
u32 ReadUnknownValx27c(CInputStream& in)
{
u32 tmp = in.readUint32Big();
if (tmp == 1)
return 2;
else if (tmp == 2)
return 4;
else if (tmp == 3)
return 5;
return 0;
}
std::vector<float> ReadScanSpeeds(CInputStream& in)
{
u32 count = in.readUint32Big();
std::vector<float> ret;
ret.reserve(count);
for (u32 i = 0 ; i<count ; ++i)
ret.push_back(in.readFloatBig());
return ret;
}
CTweakGui::CTweakGui(CInputStream& in)
: x4_(in.readBool()),
x8_(in.readFloatBig()),
xc_(in.readFloatBig()),
x10_(in.readFloatBig()),
x14_(in.readFloatBig()),
x18_(in.readFloatBig()),
x1c_(in.readFloatBig()),
x20_(in.readFloatBig()),
x24_(in.readFloatBig()),
x28_(in.readFloatBig()),
x30_(in.readFloatBig()),
x34_(in.readFloatBig()),
x38_(in.readFloatBig()),
x3c_(in.readFloatBig()),
x40_(in.readBool()),
x44_(in.readFloatBig()),
x48_(in.readFloatBig()),
x4c_(in.readFloatBig()),
x50_(in.readFloatBig()),
x54_(in.readFloatBig()),
x58_(in.readFloatBig()),
x5c_(in.readFloatBig()),
x60_(in.readFloatBig()),
x64_(in.readVec3fBig()),
x70_(in.readVec3fBig()),
x7c_(in.readFloatBig()),
x80_(in.readFloatBig()),
x84_(in.readFloatBig()),
x88_(in.readFloatBig()),
x8c_(in.readFloatBig()),
x90_(in.readFloatBig()),
x94_(in.readFloatBig()),
x98_(in.readFloatBig()),
x9c_(in.readFloatBig()),
xa0_(in.readFloatBig()),
xa4_(in.readFloatBig()),
xa8_(in.readUint32Big()),
xac_(in.readUint32Big()),
xb0_(in.readUint32Big()),
xb4_(in.readFloatBig()),
xb8_(in.readFloatBig()),
xbc_(in.readFloatBig()),
xc0_(in.readFloatBig()),
xc4_(in.readFloatBig()),
xc8_(in.readFloatBig()),
xcc_(in.readFloatBig()),
xd0_(in.readFloatBig()),
xd4_(in.readUint32Big()),
xd8_(6.2831855f * (0.0027777778f * in.readFloatBig())),
xdc_(6.2831855f * (0.0027777778f * in.readFloatBig())),
xe0_(in.readFloatBig()),
xe4_(in.readFloatBig()),
xe8_(in.readFloatBig()),
xec_(in.readFloatBig()),
xf0_(in.readFloatBig()),
xf4_(in.readFloatBig()),
xf8_(in.readUint32Big()),
xfc_(in.readUint32Big()),
x100_(in.readUint32Big()),
x104_(in.readUint32Big()),
x108_(in.readUint32Big()),
x10c_(in.readUint32Big()),
x110_(in.readFloatBig()),
x114_(in.readFloatBig()),
x11c_(in.readFloatBig()),
x120_(in.readFloatBig()),
x124_(in.readFloatBig()),
x128_(in.readFloatBig()),
x12c_(in.readFloatBig()),
x130_(in.readBool()),
x134_(in.readFloatBig()),
x138_(in.readFloatBig()),
x13c_(float(in.readUint32Big())),
x140_(float(in.readUint32Big())),
x144_(float(in.readUint32Big())),
x148_(float(in.readUint32Big())),
x14c_(float(in.readUint32Big())),
x150_(in.readString()),
x160_(in.readString()),
x170_(in.readString()),
x180_(in.readString()),
x190_(in.readString()),
x1a0_(in.readFloatBig()),
x1a4_(in.readFloatBig()),
x1a8_(in.readFloatBig()),
x1ac_(in.readFloatBig()),
x1b0_(in.readFloatBig()),
x1b4_(in.readFloatBig()),
x1b8_(in.readFloatBig()),
x1bc_(in.readFloatBig()),
x1c0_(in.readFloatBig()),
x1c4_(in.readFloatBig()),
x1c8_(in.readFloatBig()),
x1cc_(in.readBool()),
x1cd_(in.readBool()),
x1d0_(in.readFloatBig()),
x1d4_(in.readFloatBig()),
x1d8_(in.readFloatBig()),
x1dc_(in.readFloatBig()),
x1e0_(in.readFloatBig()),
x1e4_(in.readFloatBig()),
x1e8_(in.readFloatBig()),
x1ec_(in.readFloatBig()),
x1f0_(in.readFloatBig()),
x1f4_(in.readFloatBig()),
x1f8_(in.readFloatBig()),
x1fc_(in.readFloatBig()),
x200_(x1f4_ * 0.25f, x1f8_ * 0.25f, x1fc_ * 0.25f, 1.0f),
x20c_(in.readFloatBig()),
x210_(6.2831855f * (0.0027777778f * in.readFloatBig())),
x214_(in.readFloatBig()),
x218_(in.readFloatBig()),
x21c_(in.readFloatBig()),
x220_(in.readFloatBig()),
x224_(in.readFloatBig()),
x228_(x220_ + x224_),
x22c_(in.readFloatBig()),
x230_(in.readFloatBig()),
x234_(in.readFloatBig()),
x238_(in.readFloatBig()),
x23c_(in.readFloatBig()),
x240_(in.readFloatBig()),
x244_(in.readFloatBig()),
x248_(in.readFloatBig()),
x24c_(in.readFloatBig()),
x250_(in.readFloatBig()),
x254_(in.readFloatBig()),
x258_(in.readFloatBig()),
x25c_(in.readFloatBig()),
x260_(in.readFloatBig()),
x264_(in.readFloatBig()),
x268_(in.readFloatBig()),
x26c_(in.readFloatBig()),
x270_(in.readFloatBig()),
x274_(in.readBool()),
x278_(in.readFloatBig()),
x27c_(ReadUnknownValx27c(in)),
x280_(in.readFloatBig()),
x284_(in.readUint32Big()),
x288_(in.readVec4fBig()),
x28c_(in.readFloatBig()),
x290_(in.readVec4fBig()),
x294_(in.readVec4fBig()),
x298_(in.readVec4fBig()),
x29c_(in.readVec4fBig()),
x2a0_(in.readVec4fBig()),
x2a4_(in.readVec4fBig()),
x2a8_(in.readVec4fBig()),
x2ac_(in.readVec4fBig()),
x2b0_(in.readVec4fBig()),
x2b4_(in.readVec4fBig()),
x2b8_(in.readFloatBig()),
x2bc_(in.readFloatBig()),
x2c0_(in.readFloatBig()),
x2c4_scanSpeeds(ReadScanSpeeds(in)),
x2d0_(in.readString()),
x2e0_(in.readString()),
x2f0_(in.readString()),
x300_(in.readVec4fBig()),
x304_(in.readVec4fBig()),
x308_(in.readFloatBig()),
x30c_(in.readFloatBig()),
x310_(in.readFloatBig()),
x314_(in.readString()),
x324_(in.readString()),
x334_(in.readString()),
x344_(in.readVec4fBig()),
x348_(in.readVec4fBig()),
x34c_(in.readVec4fBig()),
x350_(in.readVec4fBig()),
x354_(in.readVec4fBig()),
x358_(in.readVec4fBig()),
x35c_(in.readFloatBig()),
x360_(in.readFloatBig()),
x364_(in.readFloatBig())
{
x84_ *= 2.0f;
}
float CTweakGui::GetScanSpeed(s32 idx) const
{
if (idx < 0 || idx >= x2c4_scanSpeeds.size())
return 0.f;
return x2c4_scanSpeeds[idx];
}
}

View File

@ -0,0 +1,198 @@
#ifndef __URDE_MP1_CTWEAKGUI_HPP__
#define __URDE_MP1_CTWEAKGUI_HPP__
#include "GuiSys/ITweakGui.hpp"
#include "zeus/CVector3f.hpp"
#include "zeus/CColor.hpp"
namespace urde
{
class CTweakGui : public ITweakGui
{
bool x4_;
float x8_;
float xc_;
float x10_;
float x14_;
float x18_;
float x1c_;
float x20_;
float x24_;
float x28_;
u32 x2c_ = 0;
float x30_;
float x34_;
float x38_;
float x3c_;
bool x40_;
float x44_;
float x48_;
float x4c_;
float x50_;
float x54_;
float x58_;
float x5c_;
float x60_;
zeus::CVector3f x64_;
zeus::CVector3f x70_;
float x7c_;
float x80_;
float x84_;
float x88_;
float x8c_;
float x90_;
float x94_;
float x98_;
float x9c_;
float xa0_;
float xa4_;
u32 xa8_;
u32 xac_;
u32 xb0_;
float xb4_;
float xb8_;
float xbc_;
float xc0_;
float xc4_;
float xc8_;
float xcc_;
float xd0_;
u32 xd4_;
float xd8_;
float xdc_;
float xe0_;
float xe4_;
float xe8_;
float xec_;
float xf0_;
float xf4_;
u32 xf8_;
u32 xfc_;
u32 x100_;
u32 x104_;
u32 x108_;
u32 x10c_;
float x110_;
float x114_;
float x118_;
float x11c_;
float x120_;
float x124_;
float x128_;
float x12c_;
bool x130_;
float x134_;
float x138_;
float x13c_;
float x140_;
float x144_;
float x148_;
float x14c_;
std::string x150_;
std::string x160_;
std::string x170_;
std::string x180_;
std::string x190_;
float x1a0_;
float x1a4_;
float x1a8_;
float x1ac_;
float x1b0_;
float x1b4_;
float x1b8_;
float x1bc_;
float x1c0_;
float x1c4_;
float x1c8_;
bool x1cc_;
bool x1cd_;
float x1d0_;
float x1d4_;
float x1d8_;
float x1dc_;
float x1e0_;
float x1e4_;
float x1e8_;
float x1ec_;
float x1f0_;
float x1f4_;
float x1f8_;
float x1fc_;
zeus::CColor x200_;
float x204_ = 0.0014f;
float x208_ = 0.0000525f;
float x20c_;
float x210_;
float x214_;
float x218_;
float x21c_;
float x220_;
float x224_;
float x228_;
float x22c_;
float x230_;
float x234_;
float x238_;
float x23c_;
float x240_;
float x244_;
float x248_;
float x24c_;
float x250_;
float x254_;
float x258_;
float x25c_;
float x260_;
float x264_;
float x268_;
float x26c_;
float x270_;
bool x274_;
bool x275_ = true;
float x278_;
u32 x27c_;
float x280_;
float x284_;
zeus::CColor x288_;
float x28c_;
zeus::CColor x290_;
zeus::CColor x294_;
zeus::CColor x298_;
zeus::CColor x29c_;
zeus::CColor x2a0_;
zeus::CColor x2a4_;
zeus::CColor x2a8_;
zeus::CColor x2ac_;
zeus::CColor x2b0_;
zeus::CColor x2b4_;
float x2b8_;
float x2bc_;
float x2c0_;
std::vector<float> x2c4_scanSpeeds;
std::string x2d0_;
std::string x2e0_;
std::string x2f0_;
zeus::CColor x300_;
zeus::CColor x304_;
float x308_;
float x30c_;
float x310_;
std::string x314_;
std::string x324_;
std::string x334_;
zeus::CColor x344_;
zeus::CColor x348_;
zeus::CColor x34c_;
zeus::CColor x350_;
zeus::CColor x354_;
zeus::CColor x358_;
float x35c_;
float x360_;
float x364_;
public:
CTweakGui(CInputStream&);
float GetScanSpeed(s32) const;
};
}
#endif // __URDE_MP1_CTWEAKGUI_HPP__