diff --git a/Runtime/GuiSys/CGuiFrame.cpp b/Runtime/GuiSys/CGuiFrame.cpp index a74136f40..1b9c8c2bb 100644 --- a/Runtime/GuiSys/CGuiFrame.cpp +++ b/Runtime/GuiSys/CGuiFrame.cpp @@ -163,13 +163,13 @@ void CGuiFrame::Initialize() { xc_headWidget->DispatchInitialize(); } -void CGuiFrame::LoadWidgetsInGame(CInputStream& in, CSimplePool* sp) { +void CGuiFrame::LoadWidgetsInGame(CInputStream& in, CSimplePool* sp, u32 version) { u32 count = in.ReadLong(); x2c_widgets.reserve(count); for (u32 i = 0; i < count; ++i) { FourCC type; in.Get(reinterpret_cast(&type), 4); - std::shared_ptr widget = CGuiSys::CreateWidgetInGame(type.toUint32(), in, this, sp); + std::shared_ptr widget = CGuiSys::CreateWidgetInGame(type.toUint32(), in, this, sp, version); switch (widget->GetWidgetTypeID().toUint32()) { case SBIG('CAMR'): case SBIG('LITE'): @@ -263,13 +263,13 @@ void CGuiFrame::ResetMouseState() { } std::unique_ptr CGuiFrame::CreateFrame(CAssetId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp) { - in.ReadLong(); + u32 version = in.ReadLong(); int a = in.ReadLong(); int b = in.ReadLong(); int c = in.ReadLong(); std::unique_ptr ret = std::make_unique(frmeId, sys, a, b, c, sp); - ret->LoadWidgetsInGame(in, sp); + ret->LoadWidgetsInGame(in, sp, version); return ret; } diff --git a/Runtime/GuiSys/CGuiFrame.hpp b/Runtime/GuiSys/CGuiFrame.hpp index eca6e83f7..dc4a9c358 100644 --- a/Runtime/GuiSys/CGuiFrame.hpp +++ b/Runtime/GuiSys/CGuiFrame.hpp @@ -94,7 +94,7 @@ public: void Draw(const CGuiWidgetDrawParms& parms) const; CGuiWidget* BestCursorHit(const zeus::CVector2f& point, const CGuiWidgetDrawParms& parms) const; void Initialize(); - void LoadWidgetsInGame(CInputStream& in, CSimplePool* sp); + void LoadWidgetsInGame(CInputStream& in, CSimplePool* sp, u32 version); void ProcessUserInput(const CFinalInput& input) const; bool ProcessMouseInput(const CFinalInput& input, const CGuiWidgetDrawParms& parms); void ResetMouseState(); diff --git a/Runtime/GuiSys/CGuiSys.cpp b/Runtime/GuiSys/CGuiSys.cpp index 6010d6527..d033f8cf9 100644 --- a/Runtime/GuiSys/CGuiSys.cpp +++ b/Runtime/GuiSys/CGuiSys.cpp @@ -25,7 +25,7 @@ CTextExecuteBuffer* g_TextExecuteBuf = nullptr; CTextParser* g_TextParser = nullptr; std::shared_ptr CGuiSys::CreateWidgetInGame(FourCC type, CInputStream& in, CGuiFrame* frame, - CSimplePool* sp) { + CSimplePool* sp, u32 version) { switch (type.toUint32()) { case SBIG('BWIG'): return CGuiWidget::Create(frame, in, sp); @@ -50,7 +50,7 @@ std::shared_ptr CGuiSys::CreateWidgetInGame(FourCC type, CInputStrea case SBIG('SLGP'): return CGuiSliderGroup::Create(frame, in, sp); case SBIG('TXPN'): - return CGuiTextPane::Create(frame, in, sp); + return CGuiTextPane::Create(frame, in, sp, version); case SBIG('ENRG'): return CAuiEnergyBarT01::Create(frame, in, sp); default: diff --git a/Runtime/GuiSys/CGuiSys.hpp b/Runtime/GuiSys/CGuiSys.hpp index d14e50246..ea0e217f4 100644 --- a/Runtime/GuiSys/CGuiSys.hpp +++ b/Runtime/GuiSys/CGuiSys.hpp @@ -34,7 +34,7 @@ private: std::unordered_set m_registeredFrames; static std::shared_ptr CreateWidgetInGame(FourCC type, CInputStream& in, CGuiFrame* frame, - CSimplePool* sp); + CSimplePool* sp, u32 version); public: CGuiSys(IFactory& resFactory, CSimplePool& resStore, EUsageMode mode); diff --git a/Runtime/GuiSys/CGuiTextPane.cpp b/Runtime/GuiSys/CGuiTextPane.cpp index 9667c6395..1126adb08 100644 --- a/Runtime/GuiSys/CGuiTextPane.cpp +++ b/Runtime/GuiSys/CGuiTextPane.cpp @@ -26,7 +26,8 @@ bool testProjectedLine(const zeus::CVector2f& a, const zeus::CVector2f& b, const bool CGuiTextPane::sDrawPaneRects = true; CGuiTextPane::CGuiTextPane(const CGuiWidgetParms& parms, CSimplePool* sp, const zeus::CVector2f& dim, 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) , 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); } -std::shared_ptr CGuiTextPane::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { +std::shared_ptr CGuiTextPane::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp, u32 version) { const CGuiWidgetParms parms = ReadWidgetHeader(frame, in); const zeus::CVector2f dim = in.Get(); const zeus::CVector3f vec = in.Get(); @@ -147,7 +148,16 @@ std::shared_ptr CGuiTextPane::Create(CGuiFrame* frame, CInputStream& const zeus::CColor outlineCol = in.Get(); const int extentX = static_cast(in.ReadFloat()); const int extentY = static_cast(in.ReadFloat()); - auto ret = std::make_shared(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(); + jpExtentX = in.ReadLong(); + jpExtentY = in.ReadLong(); + } + auto ret = std::make_shared(parms, sp, dim, vec, fontId, props, fontCol, outlineCol, extentX, extentY, + jpFontId, jpExtentY, jpExtentY); ret->ParseBaseInfo(frame, in, parms); ret->InitializeBuffers(); ret->TextSupport().SetText(u""); diff --git a/Runtime/GuiSys/CGuiTextPane.hpp b/Runtime/GuiSys/CGuiTextPane.hpp index b84dc243e..0a15ca1d4 100644 --- a/Runtime/GuiSys/CGuiTextPane.hpp +++ b/Runtime/GuiSys/CGuiTextPane.hpp @@ -15,7 +15,7 @@ class CGuiTextPane : public CGuiPane { public: 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, - s32 padX, s32 padY); + s32 padX, s32 padY, CAssetId jpFontId, s32 jpExtentX, s32 jpExtentY); FourCC GetWidgetTypeID() const override { return FOURCC('TXPN'); } CGuiTextSupport& TextSupport() { return xd4_textSupport; } @@ -28,7 +28,7 @@ public: void Draw(const CGuiWidgetDrawParms& parms) override; bool TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2f& point) const override; - static std::shared_ptr Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp); + static std::shared_ptr Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp, u32 version); }; } // namespace metaforce diff --git a/Runtime/MP1/CFrontEndUI.cpp b/Runtime/MP1/CFrontEndUI.cpp index 60032e524..8ba1a112c 100644 --- a/Runtime/MP1/CFrontEndUI.cpp +++ b/Runtime/MP1/CFrontEndUI.cpp @@ -713,9 +713,11 @@ void CFrontEndUI::SNewFileSelectFrame::StartTextAnimating(CGuiTextPane* text, st } CFrontEndUI::SFusionBonusFrame::SFusionBonusFrame(CFrontEndUITouchBar& touchBar) : m_touchBar(touchBar) { - x4_gbaSupport = std::make_unique(); - xc_gbaScreen = g_SimplePool->GetObj("FRME_GBAScreen"); - x18_gbaLink = g_SimplePool->GetObj("FRME_GBALink"); + if (!g_Main->IsTrilogy()) { + x4_gbaSupport = std::make_unique(); + xc_gbaScreen = g_SimplePool->GetObj("FRME_GBAScreen"); + x18_gbaLink = g_SimplePool->GetObj("FRME_GBALink"); + } } void CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::SetUIText(EUIType tp) { @@ -1871,19 +1873,20 @@ void CFrontEndUI::SetCurrentMovie(EMenuMovie movie) { } StopAttractMovie(); + if (!g_Main->IsTrilogy()) { + if (xb8_curMovie != EMenuMovie::Stopped) { + xcc_curMoviePtr->SetPlayMode(CMoviePlayer::EPlayMode::Stopped); + xcc_curMoviePtr->Rewind(); + } - if (xb8_curMovie != EMenuMovie::Stopped) { - xcc_curMoviePtr->SetPlayMode(CMoviePlayer::EPlayMode::Stopped); - xcc_curMoviePtr->Rewind(); - } + xb8_curMovie = movie; - xb8_curMovie = movie; - - if (xb8_curMovie != EMenuMovie::Stopped) { - xcc_curMoviePtr = x70_menuMovies[size_t(xb8_curMovie)].get(); - xcc_curMoviePtr->SetPlayMode(CMoviePlayer::EPlayMode::Playing); - } else { - xcc_curMoviePtr = nullptr; + if (xb8_curMovie != EMenuMovie::Stopped) { + xcc_curMoviePtr = x70_menuMovies[size_t(xb8_curMovie)].get(); + xcc_curMoviePtr->SetPlayMode(CMoviePlayer::EPlayMode::Playing); + } else { + xcc_curMoviePtr = nullptr; + } } } @@ -1908,15 +1911,15 @@ void CFrontEndUI::StartStateTransition(EScreen screen) { if (screen != EScreen::FileSelect) break; SetCurrentMovie(EMenuMovie::StartFileSelectA); - SetFadeBlackTimer(xcc_curMoviePtr->GetTotalSeconds()); + SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5); break; case EScreen::FileSelect: if (screen == EScreen::ToPlayGame) { SetCurrentMovie(EMenuMovie::FileSelectPlayGameA); - SetFadeBlackTimer(xcc_curMoviePtr->GetTotalSeconds()); + SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5); } else if (screen == EScreen::FusionBonus) { 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_R, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); } @@ -1924,10 +1927,10 @@ void CFrontEndUI::StartStateTransition(EScreen screen) { case EScreen::FusionBonus: if (screen == EScreen::ToPlayGame) { SetCurrentMovie(EMenuMovie::GBAFileSelectB); - SetFadeBlackTimer(xcc_curMoviePtr->GetTotalSeconds()); + SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5); } else if (screen == EScreen::FileSelect) { 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_R, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); } @@ -1940,7 +1943,7 @@ void CFrontEndUI::StartStateTransition(EScreen screen) { case EScreen::OpenCredits: case EScreen::Title: SetCurrentMovie(EMenuMovie::FirstStart); - SetFadeBlackTimer(xcc_curMoviePtr->GetTotalSeconds()); + SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5); break; case EScreen::AttractMovie: StartAttractMovie(); @@ -2136,6 +2139,9 @@ bool CFrontEndUI::PumpMovieLoad() { if (xd1_moviesLoaded) { return true; } + if (g_Main->IsTrilogy()) { + return true; + } for (size_t i = 0; i < x70_menuMovies.size(); ++i) { if (x70_menuMovies[i] != nullptr) { @@ -2156,8 +2162,10 @@ bool CFrontEndUI::PumpMovieLoad() { } } - x70_menuMovies[i] = std::make_unique(path.c_str(), 0.05f, movie.loop, false); - x70_menuMovies[i]->SetPlayMode(CMoviePlayer::EPlayMode::Stopped); + if (CDvdFile::FileExists(path)) { + x70_menuMovies[i] = std::make_unique(path.c_str(), 0.05f, movie.loop, false); + x70_menuMovies[i]->SetPlayMode(CMoviePlayer::EPlayMode::Stopped); + } return false; } @@ -2348,7 +2356,9 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue) /* Poll loading DGRP resources */ if (PumpLoad()) { xe0_frontendCardFrme = std::make_unique(xdc_saveUI.get(), x1c_rndB, *m_touchBar); - xe4_fusionBonusFrme = std::make_unique(*m_touchBar); + if (!g_Main->IsTrilogy()) { + xe4_fusionBonusFrme = std::make_unique(*m_touchBar); + } xe8_frontendNoCardFrme = std::make_unique(x1c_rndB, *m_touchBar); x38_pressStart.GetObj(); CAudioSys::AddAudioGroup(x44_frontendAudioGrp->GetAudioGroupData()); @@ -2361,9 +2371,12 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue) [[fallthrough]]; case EPhase::LoadFrames: + if (!g_Main->IsTrilogy() && !xe4_fusionBonusFrme->PumpLoad()) { + return EMessageReturn::Exit; + } /* Poll loading music and FRME resources */ 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; xf4_curAudio = xd4_audio1.get(); xf4_curAudio->StartMixing(); @@ -2377,8 +2390,12 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue) /* Prime first frame of movies */ UpdateMovies(dt); - moviesReady = std::all_of(x70_menuMovies.cbegin(), x70_menuMovies.cend(), - [](const auto& movie) { return movie->GetIsFullyCached(); }); + if (!g_Main->IsTrilogy()) { + moviesReady = std::all_of(x70_menuMovies.cbegin(), x70_menuMovies.cend(), + [](const auto& movie) { return movie->GetIsFullyCached(); }); + } else { + moviesReady = true; + } } else { moviesReady = false; } @@ -2487,15 +2504,23 @@ CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue) if (x50_curScreen == EScreen::Title && x54_nextScreen == EScreen::FileSelect) { /* Fade out title music */ - x68_musicVol = - 1.f - zeus::clamp(0.f, (xcc_curMoviePtr->GetPlayedSeconds() - AudioFadeTimeA[x18_rndA]) / 2.5f, 1.f); + if (!g_Main->IsTrilogy()) { + 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) { /* Fade out menu music */ - float delay = AudioFadeTimeB[x1c_rndB]; - x68_musicVol = - 1.f - - zeus::clamp(0.f, (xcc_curMoviePtr->GetPlayedSeconds() - delay) / (xcc_curMoviePtr->GetTotalSeconds() - delay), - 1.f); + if (!g_Main->IsTrilogy()) { + float delay = AudioFadeTimeB[x1c_rndB]; + x68_musicVol = + 1.f - + zeus::clamp( + 0.f, (xcc_curMoviePtr->GetPlayedSeconds() - delay) / (xcc_curMoviePtr->GetTotalSeconds() - delay), 1.f); + } else { + x68_musicVol -= dt; + } } else { /* Full music volume */ x68_musicVol = 1.f; diff --git a/Runtime/MP1/CTweaks.cpp b/Runtime/MP1/CTweaks.cpp index 7a8485c5e..2317b818c 100644 --- a/Runtime/MP1/CTweaks.cpp +++ b/Runtime/MP1/CTweaks.cpp @@ -68,7 +68,7 @@ void CTweaks::RegisterTweaks(CVarManager* cvarMgr) { u8* Args = g_ResFactory->LoadResourceSync(*tag).release(); u32 size = g_ResFactory->ResourceSize(*tag); 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); /* Game */ tag = g_ResFactory->GetResourceIdByName("Game"); diff --git a/Runtime/MP1/Tweaks/CTweakTargeting.cpp b/Runtime/MP1/Tweaks/CTweakTargeting.cpp index 43c56a90f..a34ea4273 100644 --- a/Runtime/MP1/Tweaks/CTweakTargeting.cpp +++ b/Runtime/MP1/Tweaks/CTweakTargeting.cpp @@ -2,7 +2,7 @@ #include "Runtime/Streams/IOStreams.hpp" namespace metaforce::MP1 { -CTweakTargeting::CTweakTargeting(CInputStream& in, bool hasNewFields) { +CTweakTargeting::CTweakTargeting(CInputStream& in) { x4_targetRadiusMode = in.ReadLong(); x8_currLockOnExitDuration = in.ReadFloat(); xc_currLockOnEnterDuration = in.ReadFloat(); @@ -127,11 +127,6 @@ CTweakTargeting::CTweakTargeting(CInputStream& in, bool hasNewFields) { x220_scanTargetClampMax = in.ReadFloat(); x224_angularLagSpeed = in.ReadFloat(); - if (hasNewFields) { - x218_ = in.ReadFloat(); - x21c_ = in.ReadFloat(); - } - x124_chargeTickAnglePitch = -zeus::degToRad(x124_chargeTickAnglePitch); x140_lockDaggerAngle0 = zeus::degToRad(x140_lockDaggerAngle0); x144_lockDaggerAngle1 = zeus::degToRad(x144_lockDaggerAngle1); diff --git a/Runtime/MP1/Tweaks/CTweakTargeting.hpp b/Runtime/MP1/Tweaks/CTweakTargeting.hpp index b85df050e..9d01ebbd3 100644 --- a/Runtime/MP1/Tweaks/CTweakTargeting.hpp +++ b/Runtime/MP1/Tweaks/CTweakTargeting.hpp @@ -125,9 +125,6 @@ struct CTweakTargeting final : public Tweaks::ITweakTargeting { float x220_scanTargetClampMax{}; float x224_angularLagSpeed{}; - // RS5 - float x218_{}; - float x21c_{}; bool x224_ = true; bool x225_ = false; bool x226_ = true; @@ -189,7 +186,7 @@ struct CTweakTargeting final : public Tweaks::ITweakTargeting { zeus::CColor x380_ = static_cast(0xff6b60ff); CTweakTargeting() = default; - CTweakTargeting(CInputStream& r, bool hasNewFields); + CTweakTargeting(CInputStream& r); u32 GetTargetRadiusMode() const override { return x4_targetRadiusMode; } float GetCurrLockOnExitDuration() const override { return x8_currLockOnExitDuration; } float GetCurrLockOnEnterDuration() const override { return xc_currLockOnEnterDuration; }