#include "logvisor/logvisor.hpp" #include "CTweaks.hpp" #include "CResFactory.hpp" #include "CResLoader.hpp" #include "GameGlobalObjects.hpp" #include "Editor/ProjectManager.hpp" #include "Editor/ProjectResourceFactoryMP1.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakGui.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakBall.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp" #include "World/CPlayerCameraBob.hpp" namespace urde { namespace MP1 { static logvisor::Module Log("MP1::CTweaks"); static const SObjectTag& IDFromFactory(CResFactory& factory, const char* name) { const SObjectTag* tag = factory.GetResourceIdByName(name); if (!tag) Log.report(logvisor::Fatal, "Tweak Asset not found when loading... '%s'", name); return *tag; } void CTweaks::RegisterTweaks() { std::experimental::optional strm; const SObjectTag* tag; /* Particle */ tag = g_ResFactory->GetResourceIdByName("Particle"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakParticle = new DataSpec::DNAMP1::CTweakParticle(*strm); /* Player */ tag = g_ResFactory->GetResourceIdByName("Player"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakPlayer = new DataSpec::DNAMP1::CTweakPlayer(*strm); /* CameraBob */ tag = g_ResFactory->GetResourceIdByName("CameraBob"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); CPlayerCameraBob::ReadTweaks(*strm); /* Ball */ tag = g_ResFactory->GetResourceIdByName("Ball"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakBall = new DataSpec::DNAMP1::CTweakBall(*strm); /* PlayerGun */ tag = g_ResFactory->GetResourceIdByName("PlayerGun"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakPlayerGun = new DataSpec::DNAMP1::CTweakPlayerGun(*strm); /* Targeting */ tag = g_ResFactory->GetResourceIdByName("Targeting"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakTargeting = new DataSpec::DNAMP1::CTweakTargeting(*strm); /* Game */ tag = g_ResFactory->GetResourceIdByName("Game"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakGame = new DataSpec::DNAMP1::CTweakGame(*strm); /* GuiColors */ tag = g_ResFactory->GetResourceIdByName("GuiColors"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakGuiColors = new DataSpec::DNAMP1::CTweakGuiColors(*strm); /* AutoMapper */ tag = g_ResFactory->GetResourceIdByName("AutoMapper"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakAutoMapper = new DataSpec::DNAMP1::CTweakAutoMapper(*strm); CMappableObject::ReadAutoMapperTweaks(*g_tweakAutoMapper); /* Gui */ tag = g_ResFactory->GetResourceIdByName("Gui"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakGui = new DataSpec::DNAMP1::CTweakGui(*strm); /* PlayerControls */ tag = g_ResFactory->GetResourceIdByName("PlayerControls"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakPlayerControl = new DataSpec::DNAMP1::CTweakPlayerControl(*strm); /* PlayerControls2 */ tag = g_ResFactory->GetResourceIdByName("PlayerControls2"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakPlayerControlAlt = new DataSpec::DNAMP1::CTweakPlayerControl(*strm); g_currentPlayerControl = g_tweakPlayerControl; /* SlideShow */ tag = g_ResFactory->GetResourceIdByName("SlideShow"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakSlideShow = new DataSpec::DNAMP1::CTweakSlideShow(*strm); } void CTweaks::RegisterResourceTweaks() { std::experimental::optional strm; const SObjectTag* tag = g_ResFactory->GetResourceIdByName("GunRes"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakGunRes = new DataSpec::DNAMP1::CTweakGunRes(*strm); g_tweakGunRes->ResolveResources(*g_ResFactory); tag = g_ResFactory->GetResourceIdByName("PlayerRes"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); g_tweakPlayerRes = new DataSpec::DNAMP1::CTweakPlayerRes(*strm); g_tweakPlayerRes->ResolveResources(*g_ResFactory); } } }