2020-01-15 12:07:48 +00:00
|
|
|
#include "Runtime/MP1/CTweaks.hpp"
|
|
|
|
|
2022-02-19 13:04:45 +00:00
|
|
|
#include "Runtime/MP1/Tweaks/CTweakGame.hpp"
|
|
|
|
#include "Runtime/MP1/Tweaks/CTweakPlayer.hpp"
|
|
|
|
#include "Runtime/MP1/Tweaks/CTweakPlayerControl.hpp"
|
|
|
|
#include "Runtime/MP1/Tweaks/CTweakGunRes.hpp"
|
|
|
|
#include "Runtime/MP1/Tweaks/CTweakPlayerRes.hpp"
|
|
|
|
#include "Runtime/MP1/Tweaks/CTweakSlideShow.hpp"
|
|
|
|
#include "Runtime/MP1/Tweaks/CTweakAutoMapper.hpp"
|
|
|
|
#include "Runtime/MP1/Tweaks/CTweakTargeting.hpp"
|
|
|
|
#include "Runtime/MP1/Tweaks/CTweakGui.hpp"
|
|
|
|
#include "Runtime/MP1/Tweaks/CTweakParticle.hpp"
|
|
|
|
#include "Runtime/MP1/Tweaks/CTweakBall.hpp"
|
|
|
|
#include "Runtime/MP1/Tweaks/CTweakGuiColors.hpp"
|
|
|
|
#include "Runtime/MP1/Tweaks/CTweakPlayerGun.hpp"
|
2020-01-15 12:07:48 +00:00
|
|
|
|
2021-05-24 05:06:51 +00:00
|
|
|
#include "Runtime/IMain.hpp"
|
2020-01-15 12:07:48 +00:00
|
|
|
#include "Runtime/GameGlobalObjects.hpp"
|
2021-05-24 05:06:51 +00:00
|
|
|
#include "Runtime/AutoMapper/CMappableObject.hpp"
|
2020-01-15 12:07:48 +00:00
|
|
|
#include "Runtime/World/CPlayerCameraBob.hpp"
|
|
|
|
|
|
|
|
#include <logvisor/logvisor.hpp>
|
2015-08-17 05:26:58 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce::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
|
|
|
|
2022-02-21 02:28:07 +00:00
|
|
|
void CTweaks::RegisterTweaks(CVarManager* cvarMgr) {
|
2019-06-12 02:05:17 +00:00
|
|
|
std::optional<CMemoryInStream> strm;
|
2018-12-08 05:30:43 +00:00
|
|
|
const SObjectTag* tag;
|
|
|
|
|
|
|
|
/* Particle */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("Particle");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakParticle = new MP1::CTweakParticle(*strm);
|
2018-12-08 05:30:43 +00:00
|
|
|
g_tweakParticle->initCVars(cvarMgr);
|
|
|
|
|
|
|
|
/* Player */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("Player");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakPlayer = new MP1::CTweakPlayer(*strm);
|
2018-12-08 05:30:43 +00:00
|
|
|
g_tweakPlayer->initCVars(cvarMgr);
|
|
|
|
|
|
|
|
/* CameraBob */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("CameraBob");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2018-12-08 05:30:43 +00:00
|
|
|
CPlayerCameraBob::ReadTweaks(*strm);
|
|
|
|
|
|
|
|
/* Ball */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("Ball");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakBall = new MP1::CTweakBall(*strm);
|
2018-12-08 05:30:43 +00:00
|
|
|
g_tweakBall->initCVars(cvarMgr);
|
|
|
|
|
|
|
|
/* PlayerGun */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("PlayerGun");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakPlayerGun = new MP1::CTweakPlayerGun(*strm);
|
2018-12-08 05:30:43 +00:00
|
|
|
g_tweakPlayerGun->initCVars(cvarMgr);
|
|
|
|
|
|
|
|
/* Targeting */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("Targeting");
|
2022-02-01 00:06:54 +00:00
|
|
|
u8* Args = g_ResFactory->LoadResourceSync(*tag).release();
|
|
|
|
u32 size = g_ResFactory->ResourceSize(*tag);
|
2022-02-19 13:04:45 +00:00
|
|
|
strm.emplace(Args, size, CMemoryInStream::EOwnerShip::Owned);
|
2022-02-23 08:18:50 +00:00
|
|
|
g_tweakTargeting = new MP1::CTweakTargeting(*strm);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakTargeting->initCVars(cvarMgr);
|
2018-12-08 05:30:43 +00:00
|
|
|
/* Game */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("Game");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakGame = new MP1::CTweakGame(*strm);
|
2018-12-08 05:30:43 +00:00
|
|
|
g_tweakGame->initCVars(cvarMgr);
|
|
|
|
|
|
|
|
/* GuiColors */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("GuiColors");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakGuiColors = new MP1::CTweakGuiColors(*strm);
|
2018-12-08 05:30:43 +00:00
|
|
|
g_tweakGuiColors->initCVars(cvarMgr);
|
|
|
|
|
|
|
|
/* AutoMapper */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("AutoMapper");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakAutoMapper = new MP1::CTweakAutoMapper(*strm);
|
2018-12-08 05:30:43 +00:00
|
|
|
CMappableObject::ReadAutoMapperTweaks(*g_tweakAutoMapper);
|
2019-10-05 14:07:13 +00:00
|
|
|
g_tweakAutoMapper->initCVars(cvarMgr);
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
/* Gui */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("Gui");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakGui = new MP1::CTweakGui(*strm);
|
2018-12-08 05:30:43 +00:00
|
|
|
g_tweakPlayerGun->initCVars(cvarMgr);
|
|
|
|
|
|
|
|
/* PlayerControls */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("PlayerControls");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakPlayerControl = new MP1::CTweakPlayerControl(*strm);
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
/* PlayerControls2 */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("PlayerControls2");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakPlayerControlAlt = new MP1::CTweakPlayerControl(*strm);
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
g_currentPlayerControl = g_tweakPlayerControl;
|
|
|
|
|
|
|
|
/* SlideShow */
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("SlideShow");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakSlideShow = new MP1::CTweakSlideShow(*strm);
|
2018-12-08 05:30:43 +00:00
|
|
|
g_tweakSlideShow->initCVars(cvarMgr);
|
2015-08-17 05:26:58 +00:00
|
|
|
}
|
|
|
|
|
2022-02-21 02:28:07 +00:00
|
|
|
void CTweaks::RegisterResourceTweaks(CVarManager* cvarMgr) {
|
2019-06-12 02:05:17 +00:00
|
|
|
std::optional<CMemoryInStream> strm;
|
2015-08-17 22:05:00 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
const SObjectTag* tag = g_ResFactory->GetResourceIdByName("GunRes");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakGunRes = new MP1::CTweakGunRes(*strm);
|
2018-12-08 05:30:43 +00:00
|
|
|
g_tweakGunRes->ResolveResources(*g_ResFactory);
|
|
|
|
g_tweakGunRes->initCVars(cvarMgr);
|
|
|
|
|
|
|
|
tag = g_ResFactory->GetResourceIdByName("PlayerRes");
|
2022-02-18 07:37:54 +00:00
|
|
|
strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag),
|
|
|
|
CMemoryInStream::EOwnerShip::Owned);
|
2022-02-19 13:04:45 +00:00
|
|
|
g_tweakPlayerRes = new MP1::CTweakPlayerRes(*strm, g_Main->IsTrilogy() || g_Main->IsPAL() || g_Main->IsJapanese());
|
2018-12-08 05:30:43 +00:00
|
|
|
g_tweakPlayerRes->ResolveResources(*g_ResFactory);
|
|
|
|
g_tweakPlayerRes->initCVars(cvarMgr);
|
2015-08-17 22:05:00 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce::MP1
|