2016-03-04 23:04:53 +00:00
|
|
|
#include "logvisor/logvisor.hpp"
|
2015-08-17 05:26:58 +00:00
|
|
|
#include "CTweaks.hpp"
|
2015-08-28 00:11:31 +00:00
|
|
|
#include "CResFactory.hpp"
|
|
|
|
#include "CResLoader.hpp"
|
|
|
|
#include "GameGlobalObjects.hpp"
|
2016-08-31 20:43:41 +00:00
|
|
|
#include "Editor/ProjectManager.hpp"
|
|
|
|
#include "Editor/ProjectResourceFactoryMP1.hpp"
|
2015-11-02 18:45:39 +00:00
|
|
|
#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp"
|
2015-08-29 01:30:47 +00:00
|
|
|
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp"
|
2015-08-28 00:11:31 +00:00
|
|
|
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp"
|
2016-08-31 20:43:41 +00:00
|
|
|
#include "DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp"
|
|
|
|
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp"
|
2016-09-16 20:18:03 +00:00
|
|
|
#include "DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp"
|
2016-09-15 07:26:35 +00:00
|
|
|
#include "World/CPlayerCameraBob.hpp"
|
2015-08-17 05:26:58 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-17 22:05:00 +00:00
|
|
|
{
|
2015-08-28 00:11:31 +00:00
|
|
|
|
2015-08-27 00:23:46 +00:00
|
|
|
namespace MP1
|
|
|
|
{
|
2015-08-17 22:05:00 +00:00
|
|
|
|
2016-03-05 00:03:41 +00:00
|
|
|
static logvisor::Module Log("MP1::CTweaks");
|
2015-08-28 00:11:31 +00:00
|
|
|
|
|
|
|
static const SObjectTag& IDFromFactory(CResFactory& factory, const char* name)
|
|
|
|
{
|
|
|
|
const SObjectTag* tag = factory.GetResourceIdByName(name);
|
|
|
|
if (!tag)
|
2016-03-04 23:04:53 +00:00
|
|
|
Log.report(logvisor::Fatal, "Tweak Asset not found when loading... '%s'", name);
|
2015-08-28 00:11:31 +00:00
|
|
|
return *tag;
|
|
|
|
}
|
|
|
|
|
2015-08-17 05:26:58 +00:00
|
|
|
void CTweaks::RegisterTweaks()
|
|
|
|
{
|
2016-09-16 20:18:03 +00:00
|
|
|
ProjectResourceFactoryMP1& factory = ProjectManager::g_SharedManager->resourceFactoryMP1();
|
|
|
|
std::experimental::optional<CMemoryInStream> strm;
|
2015-08-29 01:30:47 +00:00
|
|
|
|
2016-09-17 21:33:32 +00:00
|
|
|
const SObjectTag* tag = factory.GetResourceIdByName("SlideShow");
|
|
|
|
strm.emplace(factory.LoadResourceSync(*tag).release(), factory.ResourceSize(*tag));
|
2016-09-16 20:18:03 +00:00
|
|
|
g_tweakSlideShow = new DataSpec::DNAMP1::CTweakSlideShow(*strm);
|
2016-09-16 20:21:43 +00:00
|
|
|
|
2016-09-17 21:33:32 +00:00
|
|
|
tag = factory.GetResourceIdByName("Player");
|
|
|
|
strm.emplace(factory.LoadResourceSync(*tag).release(), factory.ResourceSize(*tag));
|
2016-09-15 07:26:35 +00:00
|
|
|
g_tweakPlayer = new DataSpec::DNAMP1::CTweakPlayer(*strm);
|
2015-08-29 01:30:47 +00:00
|
|
|
|
2016-09-17 21:33:32 +00:00
|
|
|
tag = factory.GetResourceIdByName("CameraBob");
|
|
|
|
strm.emplace(factory.LoadResourceSync(*tag).release(), factory.ResourceSize(*tag));
|
2016-09-15 07:26:35 +00:00
|
|
|
CPlayerCameraBob::ReadTweaks(*strm);
|
2015-08-17 05:26:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CTweaks::RegisterResourceTweaks()
|
|
|
|
{
|
2016-08-31 20:43:41 +00:00
|
|
|
ProjectResourceFactoryMP1& factory = ProjectManager::g_SharedManager->resourceFactoryMP1();
|
2016-09-02 21:39:46 +00:00
|
|
|
std::experimental::optional<CMemoryInStream> strm;
|
|
|
|
|
2016-09-17 21:33:32 +00:00
|
|
|
const SObjectTag* tag = factory.GetResourceIdByName("GunRes");
|
|
|
|
strm.emplace(factory.LoadResourceSync(*tag).release(), factory.ResourceSize(*tag));
|
2016-08-31 20:43:41 +00:00
|
|
|
g_tweakGunRes = new DataSpec::DNAMP1::CTweakGunRes(*strm);
|
2016-09-18 23:47:48 +00:00
|
|
|
g_tweakGunRes->ResolveResources(factory);
|
|
|
|
|
2016-09-17 21:33:32 +00:00
|
|
|
tag = factory.GetResourceIdByName("PlayerRes");
|
|
|
|
strm.emplace(factory.LoadResourceSync(*tag).release(), factory.ResourceSize(*tag));
|
2016-08-31 20:43:41 +00:00
|
|
|
g_tweakPlayerRes = new DataSpec::DNAMP1::CTweakPlayerRes(*strm);
|
2016-09-18 23:47:48 +00:00
|
|
|
g_tweakPlayerRes->ResolveResources(factory);
|
2015-08-17 05:26:58 +00:00
|
|
|
}
|
2015-08-17 22:05:00 +00:00
|
|
|
|
|
|
|
}
|
2015-08-27 00:23:46 +00:00
|
|
|
}
|