Get MP1 Trilogy loading, implement version difference in CGuiTextPane, harden FrontEnd for Trilogy missing files

This commit is contained in:
Phillip Stephens 2022-02-23 00:18:50 -08:00
parent 0108ae12b5
commit 1685489303
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
10 changed files with 84 additions and 57 deletions

View File

@ -163,13 +163,13 @@ void CGuiFrame::Initialize() {
xc_headWidget->DispatchInitialize(); xc_headWidget->DispatchInitialize();
} }
void CGuiFrame::LoadWidgetsInGame(CInputStream& in, CSimplePool* sp) { void CGuiFrame::LoadWidgetsInGame(CInputStream& in, CSimplePool* sp, u32 version) {
u32 count = in.ReadLong(); u32 count = in.ReadLong();
x2c_widgets.reserve(count); x2c_widgets.reserve(count);
for (u32 i = 0; i < count; ++i) { for (u32 i = 0; i < count; ++i) {
FourCC type; FourCC type;
in.Get(reinterpret_cast<u8*>(&type), 4); in.Get(reinterpret_cast<u8*>(&type), 4);
std::shared_ptr<CGuiWidget> widget = CGuiSys::CreateWidgetInGame(type.toUint32(), in, this, sp); std::shared_ptr<CGuiWidget> widget = CGuiSys::CreateWidgetInGame(type.toUint32(), in, this, sp, version);
switch (widget->GetWidgetTypeID().toUint32()) { switch (widget->GetWidgetTypeID().toUint32()) {
case SBIG('CAMR'): case SBIG('CAMR'):
case SBIG('LITE'): case SBIG('LITE'):
@ -263,13 +263,13 @@ void CGuiFrame::ResetMouseState() {
} }
std::unique_ptr<CGuiFrame> CGuiFrame::CreateFrame(CAssetId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp) { std::unique_ptr<CGuiFrame> CGuiFrame::CreateFrame(CAssetId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp) {
in.ReadLong(); u32 version = in.ReadLong();
int a = in.ReadLong(); int a = in.ReadLong();
int b = in.ReadLong(); int b = in.ReadLong();
int c = in.ReadLong(); int c = in.ReadLong();
std::unique_ptr<CGuiFrame> ret = std::make_unique<CGuiFrame>(frmeId, sys, a, b, c, sp); std::unique_ptr<CGuiFrame> ret = std::make_unique<CGuiFrame>(frmeId, sys, a, b, c, sp);
ret->LoadWidgetsInGame(in, sp); ret->LoadWidgetsInGame(in, sp, version);
return ret; return ret;
} }

View File

@ -94,7 +94,7 @@ public:
void Draw(const CGuiWidgetDrawParms& parms) const; void Draw(const CGuiWidgetDrawParms& parms) const;
CGuiWidget* BestCursorHit(const zeus::CVector2f& point, const CGuiWidgetDrawParms& parms) const; CGuiWidget* BestCursorHit(const zeus::CVector2f& point, const CGuiWidgetDrawParms& parms) const;
void Initialize(); void Initialize();
void LoadWidgetsInGame(CInputStream& in, CSimplePool* sp); void LoadWidgetsInGame(CInputStream& in, CSimplePool* sp, u32 version);
void ProcessUserInput(const CFinalInput& input) const; void ProcessUserInput(const CFinalInput& input) const;
bool ProcessMouseInput(const CFinalInput& input, const CGuiWidgetDrawParms& parms); bool ProcessMouseInput(const CFinalInput& input, const CGuiWidgetDrawParms& parms);
void ResetMouseState(); void ResetMouseState();

View File

@ -25,7 +25,7 @@ CTextExecuteBuffer* g_TextExecuteBuf = nullptr;
CTextParser* g_TextParser = nullptr; CTextParser* g_TextParser = nullptr;
std::shared_ptr<CGuiWidget> CGuiSys::CreateWidgetInGame(FourCC type, CInputStream& in, CGuiFrame* frame, std::shared_ptr<CGuiWidget> CGuiSys::CreateWidgetInGame(FourCC type, CInputStream& in, CGuiFrame* frame,
CSimplePool* sp) { CSimplePool* sp, u32 version) {
switch (type.toUint32()) { switch (type.toUint32()) {
case SBIG('BWIG'): case SBIG('BWIG'):
return CGuiWidget::Create(frame, in, sp); return CGuiWidget::Create(frame, in, sp);
@ -50,7 +50,7 @@ std::shared_ptr<CGuiWidget> CGuiSys::CreateWidgetInGame(FourCC type, CInputStrea
case SBIG('SLGP'): case SBIG('SLGP'):
return CGuiSliderGroup::Create(frame, in, sp); return CGuiSliderGroup::Create(frame, in, sp);
case SBIG('TXPN'): case SBIG('TXPN'):
return CGuiTextPane::Create(frame, in, sp); return CGuiTextPane::Create(frame, in, sp, version);
case SBIG('ENRG'): case SBIG('ENRG'):
return CAuiEnergyBarT01::Create(frame, in, sp); return CAuiEnergyBarT01::Create(frame, in, sp);
default: default:

View File

@ -34,7 +34,7 @@ private:
std::unordered_set<CGuiFrame*> m_registeredFrames; std::unordered_set<CGuiFrame*> m_registeredFrames;
static std::shared_ptr<CGuiWidget> CreateWidgetInGame(FourCC type, CInputStream& in, CGuiFrame* frame, static std::shared_ptr<CGuiWidget> CreateWidgetInGame(FourCC type, CInputStream& in, CGuiFrame* frame,
CSimplePool* sp); CSimplePool* sp, u32 version);
public: public:
CGuiSys(IFactory& resFactory, CSimplePool& resStore, EUsageMode mode); CGuiSys(IFactory& resFactory, CSimplePool& resStore, EUsageMode mode);

View File

@ -26,7 +26,8 @@ bool testProjectedLine(const zeus::CVector2f& a, const zeus::CVector2f& b, const
bool CGuiTextPane::sDrawPaneRects = true; bool CGuiTextPane::sDrawPaneRects = true;
CGuiTextPane::CGuiTextPane(const CGuiWidgetParms& parms, CSimplePool* sp, const zeus::CVector2f& dim, CGuiTextPane::CGuiTextPane(const CGuiWidgetParms& parms, CSimplePool* sp, const zeus::CVector2f& dim,
const zeus::CVector3f& vec, CAssetId fontId, const CGuiTextProperties& props, const zeus::CVector3f& vec, CAssetId fontId, const CGuiTextProperties& props,
const zeus::CColor& fontCol, const zeus::CColor& outlineCol, s32 extentX, s32 extentY) const zeus::CColor& fontCol, const zeus::CColor& outlineCol, s32 extentX, s32 extentY,
CAssetId jpFontId, s32 jpExtentX, s32 jpExtentY)
: CGuiPane(parms, dim, vec) : CGuiPane(parms, dim, vec)
, xd4_textSupport(fontId, props, fontCol, outlineCol, zeus::skWhite, extentX, extentY, sp, xac_drawFlags) {} , xd4_textSupport(fontId, props, fontCol, outlineCol, zeus::skWhite, extentX, extentY, sp, xac_drawFlags) {}
@ -133,7 +134,7 @@ bool CGuiTextPane::TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2
return j == 3 && testProjectedLine(projPoints[3], projPoints[0], point); return j == 3 && testProjectedLine(projPoints[3], projPoints[0], point);
} }
std::shared_ptr<CGuiWidget> CGuiTextPane::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { std::shared_ptr<CGuiWidget> CGuiTextPane::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp, u32 version) {
const CGuiWidgetParms parms = ReadWidgetHeader(frame, in); const CGuiWidgetParms parms = ReadWidgetHeader(frame, in);
const zeus::CVector2f dim = in.Get<zeus::CVector2f>(); const zeus::CVector2f dim = in.Get<zeus::CVector2f>();
const zeus::CVector3f vec = in.Get<zeus::CVector3f>(); const zeus::CVector3f vec = in.Get<zeus::CVector3f>();
@ -147,7 +148,16 @@ std::shared_ptr<CGuiWidget> CGuiTextPane::Create(CGuiFrame* frame, CInputStream&
const zeus::CColor outlineCol = in.Get<zeus::CColor>(); const zeus::CColor outlineCol = in.Get<zeus::CColor>();
const int extentX = static_cast<int>(in.ReadFloat()); const int extentX = static_cast<int>(in.ReadFloat());
const int extentY = static_cast<int>(in.ReadFloat()); const int extentY = static_cast<int>(in.ReadFloat());
auto ret = std::make_shared<CGuiTextPane>(parms, sp, dim, vec, fontId, props, fontCol, outlineCol, extentX, extentY); int jpExtentX = extentX;
int jpExtentY = extentY;
CAssetId jpFontId = fontId;
if (version != 0) {
jpFontId = in.Get<CAssetId>();
jpExtentX = in.ReadLong();
jpExtentY = in.ReadLong();
}
auto ret = std::make_shared<CGuiTextPane>(parms, sp, dim, vec, fontId, props, fontCol, outlineCol, extentX, extentY,
jpFontId, jpExtentY, jpExtentY);
ret->ParseBaseInfo(frame, in, parms); ret->ParseBaseInfo(frame, in, parms);
ret->InitializeBuffers(); ret->InitializeBuffers();
ret->TextSupport().SetText(u""); ret->TextSupport().SetText(u"");

View File

@ -15,7 +15,7 @@ class CGuiTextPane : public CGuiPane {
public: public:
CGuiTextPane(const CGuiWidgetParms& parms, CSimplePool* sp, const zeus::CVector2f& dim, const zeus::CVector3f& vec, CGuiTextPane(const CGuiWidgetParms& parms, CSimplePool* sp, const zeus::CVector2f& dim, const zeus::CVector3f& vec,
CAssetId fontId, const CGuiTextProperties& props, const zeus::CColor& col1, const zeus::CColor& col2, CAssetId fontId, const CGuiTextProperties& props, const zeus::CColor& col1, const zeus::CColor& col2,
s32 padX, s32 padY); s32 padX, s32 padY, CAssetId jpFontId, s32 jpExtentX, s32 jpExtentY);
FourCC GetWidgetTypeID() const override { return FOURCC('TXPN'); } FourCC GetWidgetTypeID() const override { return FOURCC('TXPN'); }
CGuiTextSupport& TextSupport() { return xd4_textSupport; } CGuiTextSupport& TextSupport() { return xd4_textSupport; }
@ -28,7 +28,7 @@ public:
void Draw(const CGuiWidgetDrawParms& parms) override; void Draw(const CGuiWidgetDrawParms& parms) override;
bool TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2f& point) const override; bool TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2f& point) const override;
static std::shared_ptr<CGuiWidget> Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp); static std::shared_ptr<CGuiWidget> Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp, u32 version);
}; };
} // namespace metaforce } // namespace metaforce

View File

@ -713,9 +713,11 @@ void CFrontEndUI::SNewFileSelectFrame::StartTextAnimating(CGuiTextPane* text, st
} }
CFrontEndUI::SFusionBonusFrame::SFusionBonusFrame(CFrontEndUITouchBar& touchBar) : m_touchBar(touchBar) { CFrontEndUI::SFusionBonusFrame::SFusionBonusFrame(CFrontEndUITouchBar& touchBar) : m_touchBar(touchBar) {
x4_gbaSupport = std::make_unique<CGBASupport>(); if (!g_Main->IsTrilogy()) {
xc_gbaScreen = g_SimplePool->GetObj("FRME_GBAScreen"); x4_gbaSupport = std::make_unique<CGBASupport>();
x18_gbaLink = g_SimplePool->GetObj("FRME_GBALink"); xc_gbaScreen = g_SimplePool->GetObj("FRME_GBAScreen");
x18_gbaLink = g_SimplePool->GetObj("FRME_GBALink");
}
} }
void CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::SetUIText(EUIType tp) { void CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::SetUIText(EUIType tp) {
@ -1871,19 +1873,20 @@ void CFrontEndUI::SetCurrentMovie(EMenuMovie movie) {
} }
StopAttractMovie(); StopAttractMovie();
if (!g_Main->IsTrilogy()) {
if (xb8_curMovie != EMenuMovie::Stopped) {
xcc_curMoviePtr->SetPlayMode(CMoviePlayer::EPlayMode::Stopped);
xcc_curMoviePtr->Rewind();
}
if (xb8_curMovie != EMenuMovie::Stopped) { xb8_curMovie = movie;
xcc_curMoviePtr->SetPlayMode(CMoviePlayer::EPlayMode::Stopped);
xcc_curMoviePtr->Rewind();
}
xb8_curMovie = movie; if (xb8_curMovie != EMenuMovie::Stopped) {
xcc_curMoviePtr = x70_menuMovies[size_t(xb8_curMovie)].get();
if (xb8_curMovie != EMenuMovie::Stopped) { xcc_curMoviePtr->SetPlayMode(CMoviePlayer::EPlayMode::Playing);
xcc_curMoviePtr = x70_menuMovies[size_t(xb8_curMovie)].get(); } else {
xcc_curMoviePtr->SetPlayMode(CMoviePlayer::EPlayMode::Playing); xcc_curMoviePtr = nullptr;
} else { }
xcc_curMoviePtr = nullptr;
} }
} }
@ -1908,15 +1911,15 @@ void CFrontEndUI::StartStateTransition(EScreen screen) {
if (screen != EScreen::FileSelect) if (screen != EScreen::FileSelect)
break; break;
SetCurrentMovie(EMenuMovie::StartFileSelectA); SetCurrentMovie(EMenuMovie::StartFileSelectA);
SetFadeBlackTimer(xcc_curMoviePtr->GetTotalSeconds()); SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5);
break; break;
case EScreen::FileSelect: case EScreen::FileSelect:
if (screen == EScreen::ToPlayGame) { if (screen == EScreen::ToPlayGame) {
SetCurrentMovie(EMenuMovie::FileSelectPlayGameA); SetCurrentMovie(EMenuMovie::FileSelectPlayGameA);
SetFadeBlackTimer(xcc_curMoviePtr->GetTotalSeconds()); SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5);
} else if (screen == EScreen::FusionBonus) { } else if (screen == EScreen::FusionBonus) {
SetCurrentMovie(EMenuMovie::FileSelectGBA); SetCurrentMovie(EMenuMovie::FileSelectGBA);
SetFadeBlackTimer(xcc_curMoviePtr->GetTotalSeconds()); SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5);
CSfxManager::SfxStart(SFXfnt_tofusion_L, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(SFXfnt_tofusion_L, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
CSfxManager::SfxStart(SFXfnt_tofusion_R, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(SFXfnt_tofusion_R, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
} }
@ -1924,10 +1927,10 @@ void CFrontEndUI::StartStateTransition(EScreen screen) {
case EScreen::FusionBonus: case EScreen::FusionBonus:
if (screen == EScreen::ToPlayGame) { if (screen == EScreen::ToPlayGame) {
SetCurrentMovie(EMenuMovie::GBAFileSelectB); SetCurrentMovie(EMenuMovie::GBAFileSelectB);
SetFadeBlackTimer(xcc_curMoviePtr->GetTotalSeconds()); SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5);
} else if (screen == EScreen::FileSelect) { } else if (screen == EScreen::FileSelect) {
SetCurrentMovie(EMenuMovie::GBAFileSelectA); SetCurrentMovie(EMenuMovie::GBAFileSelectA);
SetFadeBlackTimer(xcc_curMoviePtr->GetTotalSeconds()); SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5);
CSfxManager::SfxStart(SFXfnt_fromfusion_L, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(SFXfnt_fromfusion_L, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
CSfxManager::SfxStart(SFXfnt_fromfusion_R, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(SFXfnt_fromfusion_R, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
} }
@ -1940,7 +1943,7 @@ void CFrontEndUI::StartStateTransition(EScreen screen) {
case EScreen::OpenCredits: case EScreen::OpenCredits:
case EScreen::Title: case EScreen::Title:
SetCurrentMovie(EMenuMovie::FirstStart); SetCurrentMovie(EMenuMovie::FirstStart);
SetFadeBlackTimer(xcc_curMoviePtr->GetTotalSeconds()); SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5);
break; break;
case EScreen::AttractMovie: case EScreen::AttractMovie:
StartAttractMovie(); StartAttractMovie();
@ -2136,6 +2139,9 @@ bool CFrontEndUI::PumpMovieLoad() {
if (xd1_moviesLoaded) { if (xd1_moviesLoaded) {
return true; return true;
} }
if (g_Main->IsTrilogy()) {
return true;
}
for (size_t i = 0; i < x70_menuMovies.size(); ++i) { for (size_t i = 0; i < x70_menuMovies.size(); ++i) {
if (x70_menuMovies[i] != nullptr) { if (x70_menuMovies[i] != nullptr) {
@ -2156,8 +2162,10 @@ bool CFrontEndUI::PumpMovieLoad() {
} }
} }
x70_menuMovies[i] = std::make_unique<CMoviePlayer>(path.c_str(), 0.05f, movie.loop, false); if (CDvdFile::FileExists(path)) {
x70_menuMovies[i]->SetPlayMode(CMoviePlayer::EPlayMode::Stopped); x70_menuMovies[i] = std::make_unique<CMoviePlayer>(path.c_str(), 0.05f, movie.loop, false);
x70_menuMovies[i]->SetPlayMode(CMoviePlayer::EPlayMode::Stopped);
}
return false; return false;
} }
@ -2348,7 +2356,9 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue)
/* Poll loading DGRP resources */ /* Poll loading DGRP resources */
if (PumpLoad()) { if (PumpLoad()) {
xe0_frontendCardFrme = std::make_unique<SNewFileSelectFrame>(xdc_saveUI.get(), x1c_rndB, *m_touchBar); xe0_frontendCardFrme = std::make_unique<SNewFileSelectFrame>(xdc_saveUI.get(), x1c_rndB, *m_touchBar);
xe4_fusionBonusFrme = std::make_unique<SFusionBonusFrame>(*m_touchBar); if (!g_Main->IsTrilogy()) {
xe4_fusionBonusFrme = std::make_unique<SFusionBonusFrame>(*m_touchBar);
}
xe8_frontendNoCardFrme = std::make_unique<SFrontEndFrame>(x1c_rndB, *m_touchBar); xe8_frontendNoCardFrme = std::make_unique<SFrontEndFrame>(x1c_rndB, *m_touchBar);
x38_pressStart.GetObj(); x38_pressStart.GetObj();
CAudioSys::AddAudioGroup(x44_frontendAudioGrp->GetAudioGroupData()); CAudioSys::AddAudioGroup(x44_frontendAudioGrp->GetAudioGroupData());
@ -2361,9 +2371,12 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue)
[[fallthrough]]; [[fallthrough]];
case EPhase::LoadFrames: case EPhase::LoadFrames:
if (!g_Main->IsTrilogy() && !xe4_fusionBonusFrme->PumpLoad()) {
return EMessageReturn::Exit;
}
/* Poll loading music and FRME resources */ /* Poll loading music and FRME resources */
if (!xd4_audio1->IsReady() || !xd8_audio2->IsReady() || !xe0_frontendCardFrme->PumpLoad() || if (!xd4_audio1->IsReady() || !xd8_audio2->IsReady() || !xe0_frontendCardFrme->PumpLoad() ||
!xe4_fusionBonusFrme->PumpLoad() || !xe8_frontendNoCardFrme->PumpLoad() || !xdc_saveUI->PumpLoad()) !xe8_frontendNoCardFrme->PumpLoad() || !xdc_saveUI->PumpLoad())
return EMessageReturn::Exit; return EMessageReturn::Exit;
xf4_curAudio = xd4_audio1.get(); xf4_curAudio = xd4_audio1.get();
xf4_curAudio->StartMixing(); xf4_curAudio->StartMixing();
@ -2377,8 +2390,12 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue)
/* Prime first frame of movies */ /* Prime first frame of movies */
UpdateMovies(dt); UpdateMovies(dt);
moviesReady = std::all_of(x70_menuMovies.cbegin(), x70_menuMovies.cend(), if (!g_Main->IsTrilogy()) {
[](const auto& movie) { return movie->GetIsFullyCached(); }); moviesReady = std::all_of(x70_menuMovies.cbegin(), x70_menuMovies.cend(),
[](const auto& movie) { return movie->GetIsFullyCached(); });
} else {
moviesReady = true;
}
} else { } else {
moviesReady = false; moviesReady = false;
} }
@ -2487,15 +2504,23 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue)
if (x50_curScreen == EScreen::Title && x54_nextScreen == EScreen::FileSelect) { if (x50_curScreen == EScreen::Title && x54_nextScreen == EScreen::FileSelect) {
/* Fade out title music */ /* Fade out title music */
x68_musicVol = if (!g_Main->IsTrilogy()) {
1.f - zeus::clamp(0.f, (xcc_curMoviePtr->GetPlayedSeconds() - AudioFadeTimeA[x18_rndA]) / 2.5f, 1.f); x68_musicVol =
1.f - zeus::clamp(0.f, (xcc_curMoviePtr->GetPlayedSeconds() - AudioFadeTimeA[x18_rndA]) / 2.5f, 1.f);
} else {
x68_musicVol -= dt;
}
} else if (x54_nextScreen == EScreen::ToPlayGame) { } else if (x54_nextScreen == EScreen::ToPlayGame) {
/* Fade out menu music */ /* Fade out menu music */
float delay = AudioFadeTimeB[x1c_rndB]; if (!g_Main->IsTrilogy()) {
x68_musicVol = float delay = AudioFadeTimeB[x1c_rndB];
1.f - x68_musicVol =
zeus::clamp(0.f, (xcc_curMoviePtr->GetPlayedSeconds() - delay) / (xcc_curMoviePtr->GetTotalSeconds() - delay), 1.f -
1.f); zeus::clamp(
0.f, (xcc_curMoviePtr->GetPlayedSeconds() - delay) / (xcc_curMoviePtr->GetTotalSeconds() - delay), 1.f);
} else {
x68_musicVol -= dt;
}
} else { } else {
/* Full music volume */ /* Full music volume */
x68_musicVol = 1.f; x68_musicVol = 1.f;

View File

@ -68,7 +68,7 @@ void CTweaks::RegisterTweaks(CVarManager* cvarMgr) {
u8* Args = g_ResFactory->LoadResourceSync(*tag).release(); u8* Args = g_ResFactory->LoadResourceSync(*tag).release();
u32 size = g_ResFactory->ResourceSize(*tag); u32 size = g_ResFactory->ResourceSize(*tag);
strm.emplace(Args, size, CMemoryInStream::EOwnerShip::Owned); strm.emplace(Args, size, CMemoryInStream::EOwnerShip::Owned);
g_tweakTargeting = new MP1::CTweakTargeting(*strm, g_Main->IsTrilogy() || g_Main->IsPAL() || g_Main->IsJapanese()); g_tweakTargeting = new MP1::CTweakTargeting(*strm);
g_tweakTargeting->initCVars(cvarMgr); g_tweakTargeting->initCVars(cvarMgr);
/* Game */ /* Game */
tag = g_ResFactory->GetResourceIdByName("Game"); tag = g_ResFactory->GetResourceIdByName("Game");

View File

@ -2,7 +2,7 @@
#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Streams/IOStreams.hpp"
namespace metaforce::MP1 { namespace metaforce::MP1 {
CTweakTargeting::CTweakTargeting(CInputStream& in, bool hasNewFields) { CTweakTargeting::CTweakTargeting(CInputStream& in) {
x4_targetRadiusMode = in.ReadLong(); x4_targetRadiusMode = in.ReadLong();
x8_currLockOnExitDuration = in.ReadFloat(); x8_currLockOnExitDuration = in.ReadFloat();
xc_currLockOnEnterDuration = in.ReadFloat(); xc_currLockOnEnterDuration = in.ReadFloat();
@ -127,11 +127,6 @@ CTweakTargeting::CTweakTargeting(CInputStream& in, bool hasNewFields) {
x220_scanTargetClampMax = in.ReadFloat(); x220_scanTargetClampMax = in.ReadFloat();
x224_angularLagSpeed = in.ReadFloat(); x224_angularLagSpeed = in.ReadFloat();
if (hasNewFields) {
x218_ = in.ReadFloat();
x21c_ = in.ReadFloat();
}
x124_chargeTickAnglePitch = -zeus::degToRad(x124_chargeTickAnglePitch); x124_chargeTickAnglePitch = -zeus::degToRad(x124_chargeTickAnglePitch);
x140_lockDaggerAngle0 = zeus::degToRad(x140_lockDaggerAngle0); x140_lockDaggerAngle0 = zeus::degToRad(x140_lockDaggerAngle0);
x144_lockDaggerAngle1 = zeus::degToRad(x144_lockDaggerAngle1); x144_lockDaggerAngle1 = zeus::degToRad(x144_lockDaggerAngle1);

View File

@ -125,9 +125,6 @@ struct CTweakTargeting final : public Tweaks::ITweakTargeting {
float x220_scanTargetClampMax{}; float x220_scanTargetClampMax{};
float x224_angularLagSpeed{}; float x224_angularLagSpeed{};
// RS5
float x218_{};
float x21c_{};
bool x224_ = true; bool x224_ = true;
bool x225_ = false; bool x225_ = false;
bool x226_ = true; bool x226_ = true;
@ -189,7 +186,7 @@ struct CTweakTargeting final : public Tweaks::ITweakTargeting {
zeus::CColor x380_ = static_cast<zeus::Comp32>(0xff6b60ff); zeus::CColor x380_ = static_cast<zeus::Comp32>(0xff6b60ff);
CTweakTargeting() = default; CTweakTargeting() = default;
CTweakTargeting(CInputStream& r, bool hasNewFields); CTweakTargeting(CInputStream& r);
u32 GetTargetRadiusMode() const override { return x4_targetRadiusMode; } u32 GetTargetRadiusMode() const override { return x4_targetRadiusMode; }
float GetCurrLockOnExitDuration() const override { return x8_currLockOnExitDuration; } float GetCurrLockOnExitDuration() const override { return x8_currLockOnExitDuration; }
float GetCurrLockOnEnterDuration() const override { return xc_currLockOnEnterDuration; } float GetCurrLockOnEnterDuration() const override { return xc_currLockOnEnterDuration; }