Initial string fixes

This commit is contained in:
Phillip Stephens 2020-04-15 23:57:04 -07:00
parent 582d8a6999
commit c64e3d2ba7
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
8 changed files with 104 additions and 32 deletions

View File

@ -49,6 +49,37 @@ constexpr std::array<SGameOption, 4> ControllerOpts{{
{EGameOption::RestoreDefaults, 35, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
}};
constexpr std::array<SGameOption, 5> VisorOptsNew{{
{EGameOption::VisorOpacity, 23, 0.f, 255.f, 1.f, EOptionType::Float},
{EGameOption::HelmetOpacity, 24, 0.f, 255.f, 1.f, EOptionType::Float},
{EGameOption::HUDLag, 25, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
{EGameOption::HintSystem, 26, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
{EGameOption::RestoreDefaults, 38, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
}};
constexpr std::array<SGameOption, 5> DisplayOptsNew{{
//{EGameOption::ScreenBrightness, 25, 0.f, 8.f, 1.f, EOptionType::Float},
{EGameOption::ScreenBrightness, 28, -100.f, 100.f, 1.f, EOptionType::Float},
{EGameOption::ScreenOffsetX, 29, -30.f, 30.f, 1.f, EOptionType::Float},
{EGameOption::ScreenOffsetY, 30, -30.f, 30.f, 1.f, EOptionType::Float},
{EGameOption::ScreenStretch, 31, -10.f, 10.f, 1.f, EOptionType::Float},
{EGameOption::RestoreDefaults, 38, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
}};
constexpr std::array<SGameOption, 4> SoundOptsNew{{
{EGameOption::SFXVolume, 32, 0.f, 127.f, 1.f, EOptionType::Float},
{EGameOption::MusicVolume, 33, 0.f, 127.f, 1.f, EOptionType::Float},
{EGameOption::SoundMode, 34, 0.f, 1.f, 1.f, EOptionType::TripleEnum},
{EGameOption::RestoreDefaults, 38, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
}};
constexpr std::array<SGameOption, 4> ControllerOptsNew{{
{EGameOption::ReverseYAxis, 35, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
{EGameOption::Rumble, 37, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
{EGameOption::SwapBeamControls, 37, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
{EGameOption::RestoreDefaults, 38, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
}};
constexpr std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistry{{
{VisorOpts.size(), VisorOpts.data()},
{DisplayOpts.size(), DisplayOpts.data()},
@ -57,6 +88,14 @@ constexpr std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegist
{0, nullptr},
}};
constexpr std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistryNew{{
{VisorOptsNew.size(), VisorOptsNew.data()},
{DisplayOptsNew.size(), DisplayOptsNew.data()},
{SoundOptsNew.size(), SoundOptsNew.data()},
{ControllerOptsNew.size(), ControllerOptsNew.data()},
{0, nullptr},
}};
CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) {
for (u8& entry : x0_nesState) {
entry = stream.ReadEncoded(8);
@ -229,7 +268,8 @@ CGameOptions::CGameOptions()
float CGameOptions::TuneScreenBrightness() { return (0.375f * 1.f) + (float(x48_screenBrightness) * 0.25f); }
void CGameOptions::InitSoundMode() { /* If system is mono, force x44 to mono, otherwise honor user preference */ }
void CGameOptions::InitSoundMode() { /* If system is mono, force x44 to mono, otherwise honor user preference */
}
static float BrightnessCopyFilter = 0.f;
void CGameOptions::SetScreenBrightness(s32 val, bool apply) {
x48_screenBrightness = zeus::clamp(0, val, 8);

View File

@ -44,6 +44,7 @@ struct SGameOption {
/** Static registry of Option UI presentation information */
extern const std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistry;
extern const std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistryNew;
/** Options tracked persistently between game sessions */
class CPersistentOptions {

View File

@ -104,7 +104,7 @@ CPlayerState::CPlayerState(CBitStreamReader& stream)
const auto& scanStates = g_MemoryCardSys->GetScanStates();
x170_scanTimes.reserve(scanStates.size());
for (const auto& state : scanStates) {
float time = stream.ReadEncoded(1) ? 1.f : 0.f;
float time = stream.ReadEncoded(1) ? 1.f : 1.f;
x170_scanTimes.emplace_back(state.first, time);
}

View File

@ -7,6 +7,7 @@
#include "Runtime/GuiSys/CGuiTableGroup.hpp"
#include "Runtime/GuiSys/CGuiTextPane.hpp"
#include "Runtime/Input/ControlMapper.hpp"
#include "Runtime/IMain.hpp"
namespace urde::MP1 {
namespace {
@ -285,14 +286,22 @@ bool CInventoryScreen::HasLeftInventoryItem(int idx) const {
void CInventoryScreen::VActivate() {
for (int i = 0; i < 5; ++i) {
if (HasLeftInventoryItem(i)) {
xa8_textpane_categories[i]->TextSupport().SetText(xc_pauseStrg.GetString(i + 10));
if (g_Main->IsUSA()) {
xa8_textpane_categories[i]->TextSupport().SetText(xc_pauseStrg.GetString(i + 10));
} else {
xa8_textpane_categories[i]->TextSupport().SetText(xc_pauseStrg.GetString(i + 12));
}
} else {
xa8_textpane_categories[i]->TextSupport().SetText(u"??????");
x70_tablegroup_leftlog->GetWorkerWidget(i)->SetIsSelectable(false);
}
}
x178_textpane_title->TextSupport().SetText(xc_pauseStrg.GetString(9));
if (g_Main->IsUSA()) {
x178_textpane_title->TextSupport().SetText(xc_pauseStrg.GetString(9));
} else {
x178_textpane_title->TextSupport().SetText(xc_pauseStrg.GetString(11));
}
x180_basewidget_yicon->SetVisibility(true, ETraversalMode::Children);
}
@ -302,15 +311,22 @@ void CInventoryScreen::UpdateTextBody() {
x1ac_textLeaveRequested = false;
const SInventoryItem& sel = InventoryRegistry[x70_tablegroup_leftlog->GetUserSelection()].second[x1c_rightSel];
std::u16string entryText = xc_pauseStrg.GetString(sel.entryStrIdx);
std::u16string entryText = xc_pauseStrg.GetString(g_Main->IsUSA() ? sel.entryStrIdx : sel.entryStrIdx + 3);
if (sel.idx == 23) // Beam combo
{
CPlayerState& playerState = *x4_mgr.GetPlayerState();
entryText += xc_pauseStrg.GetString(playerState.HasPowerUp(CPlayerState::EItemType::SuperMissile) ? 71 : 65);
entryText += xc_pauseStrg.GetString(playerState.HasPowerUp(CPlayerState::EItemType::IceSpreader) ? 73 : 65);
entryText += xc_pauseStrg.GetString(playerState.HasPowerUp(CPlayerState::EItemType::Wavebuster) ? 75 : 65);
entryText += xc_pauseStrg.GetString(playerState.HasPowerUp(CPlayerState::EItemType::Flamethrower) ? 77 : 65);
if (g_Main->IsUSA()) {
entryText += xc_pauseStrg.GetString(playerState.HasPowerUp(CPlayerState::EItemType::SuperMissile) ? 71 : 65);
entryText += xc_pauseStrg.GetString(playerState.HasPowerUp(CPlayerState::EItemType::IceSpreader) ? 73 : 65);
entryText += xc_pauseStrg.GetString(playerState.HasPowerUp(CPlayerState::EItemType::Wavebuster) ? 75 : 65);
entryText += xc_pauseStrg.GetString(playerState.HasPowerUp(CPlayerState::EItemType::Flamethrower) ? 77 : 65);
} else {
entryText += xc_pauseStrg.GetString(playerState.HasPowerUp(CPlayerState::EItemType::SuperMissile) ? 73 : 68);
entryText += xc_pauseStrg.GetString(playerState.HasPowerUp(CPlayerState::EItemType::IceSpreader) ? 75 : 68);
entryText += xc_pauseStrg.GetString(playerState.HasPowerUp(CPlayerState::EItemType::Wavebuster) ? 78 : 68);
entryText += xc_pauseStrg.GetString(playerState.HasPowerUp(CPlayerState::EItemType::Flamethrower) ? 79 : 68);
}
}
x174_textpane_body->TextSupport().SetText(entryText, true);
@ -451,7 +467,7 @@ void CInventoryScreen::UpdateRightTable() {
CGuiTextPane* title = xd8_textpane_titles[i];
if (i < int(size)) {
if (HasRightInventoryItem(data[i].idx)) {
title->TextSupport().SetText(xc_pauseStrg.GetString(data[i].nameStrIdx));
title->TextSupport().SetText(xc_pauseStrg.GetString(g_Main->IsUSA() ? data[i].nameStrIdx : data[i].nameStrIdx + 3));
x84_tablegroup_rightlog->GetWorkerWidget(i + 1)->SetIsSelectable(true);
if (i < minSel)
minSel = i;

View File

@ -200,7 +200,10 @@ void CLogBookScreen::UpdateBodyText() {
if (IsArtifactCategorySelected()) {
const int headIdx = GetSelectedArtifactHeadScanIndex();
if (headIdx >= 0 && g_GameState->GetPlayerState()->HasPowerUp(CPlayerState::EItemType(headIdx + 29))) {
accumStr = std::u16string(u"\n\n\n\n\n\n").append(g_MainStringTable->GetString(105));
if (g_Main->IsUSA())
accumStr = std::u16string(u"\n\n\n\n\n\n").append(g_MainStringTable->GetString(105));
else
accumStr = std::u16string(u"\n\n\n\n\n\n").append(g_MainStringTable->GetString(107));
}
}

View File

@ -1,5 +1,6 @@
#include "Runtime/MP1/COptionsScreen.hpp"
#include "Runtime/IMain.hpp"
#include "Runtime/CArchitectureQueue.hpp"
#include "Runtime/GuiSys/CGuiSliderGroup.hpp"
#include "Runtime/GuiSys/CGuiTableGroup.hpp"
@ -154,8 +155,8 @@ void COptionsScreen::ProcessControllerInput(const CFinalInput& input) {
CPauseScreenBase::ProcessControllerInput(input);
CGameOptions::TryRestoreDefaults(input, x70_tablegroup_leftlog->GetUserSelection(), x1c_rightSel, false,
rightClicked);
if (x70_tablegroup_leftlog->GetUserSelection() == 4 && (input.PA() || leftClicked ||
input.PSpecialKey(boo::ESpecialKey::Enter)))
if (x70_tablegroup_leftlog->GetUserSelection() == 4 &&
(input.PA() || leftClicked || input.PSpecialKey(boo::ESpecialKey::Enter)))
x19c_quitGame = std::make_unique<CQuitGameScreen>(EQuitType::QuitGame);
} else {
CPauseScreenBase::ResetMouseState();
@ -177,10 +178,15 @@ void COptionsScreen::Draw(float transInterp, float totalAlpha, float yOff) {
bool COptionsScreen::VReady() const { return true; }
void COptionsScreen::VActivate() {
for (int i = 0; i < 5; ++i)
xa8_textpane_categories[i]->TextSupport().SetText(xc_pauseStrg.GetString(i + 16));
for (int i = 0; i < 5; ++i) {
if (g_Main->IsUSA()) {
xa8_textpane_categories[i]->TextSupport().SetText(xc_pauseStrg.GetString(i + 16));
} else {
xa8_textpane_categories[i]->TextSupport().SetText(xc_pauseStrg.GetString(i + 18));
}
}
x178_textpane_title->TextSupport().SetText(xc_pauseStrg.GetString(15));
x178_textpane_title->TextSupport().SetText(xc_pauseStrg.GetString(g_Main->IsUSA() ? 15 : 17));
#if 0
for (int i=5 ; i<5 ; ++i)
@ -190,22 +196,23 @@ void COptionsScreen::VActivate() {
x174_textpane_body->TextSupport().SetJustification(EJustification::Center);
x174_textpane_body->TextSupport().SetVerticalJustification(EVerticalJustification::Bottom);
int stringOffset = g_Main->IsUSA() ? 0 : 3;
static_cast<CGuiTextPane*>(x190_tablegroup_double->GetWorkerWidget(0))
->TextSupport()
.SetText(xc_pauseStrg.GetString(95));
.SetText(xc_pauseStrg.GetString(95 + stringOffset));
static_cast<CGuiTextPane*>(x190_tablegroup_double->GetWorkerWidget(1))
->TextSupport()
.SetText(xc_pauseStrg.GetString(94));
.SetText(xc_pauseStrg.GetString(94 + stringOffset));
static_cast<CGuiTextPane*>(x194_tablegroup_triple->GetWorkerWidget(0))
->TextSupport()
.SetText(xc_pauseStrg.GetString(96));
.SetText(xc_pauseStrg.GetString(96 + stringOffset));
static_cast<CGuiTextPane*>(x194_tablegroup_triple->GetWorkerWidget(1))
->TextSupport()
.SetText(xc_pauseStrg.GetString(97));
.SetText(xc_pauseStrg.GetString(97 + stringOffset));
static_cast<CGuiTextPane*>(x194_tablegroup_triple->GetWorkerWidget(2))
->TextSupport()
.SetText(xc_pauseStrg.GetString(98));
.SetText(xc_pauseStrg.GetString(98 + stringOffset));
x18c_slidergroup_slider->SetSelectionChangedCallback(
[this](CGuiSliderGroup* caller, float value) { OnSliderChanged(caller, value); });
@ -229,12 +236,15 @@ void COptionsScreen::ChangedMode(EMode oldMode) {
void COptionsScreen::UpdateRightTable() {
CPauseScreenBase::UpdateRightTable();
const std::pair<int, const SGameOption*>& category = GameOptionsRegistry[x70_tablegroup_leftlog->GetUserSelection()];
const std::pair<int, const SGameOption*>& category =
g_Main->IsUSA() ? GameOptionsRegistry[x70_tablegroup_leftlog->GetUserSelection()]
: GameOptionsRegistryNew[x70_tablegroup_leftlog->GetUserSelection()];
for (int i = 0; i < 5; ++i) {
if (i < category.first)
if (i < category.first) {
xd8_textpane_titles[i]->TextSupport().SetText(xc_pauseStrg.GetString(category.second[i].stringId));
else
} else {
xd8_textpane_titles[i]->TextSupport().SetText(u"");
}
}
}

View File

@ -13,6 +13,7 @@
#include "Runtime/GuiSys/CGuiTextPane.hpp"
#include "Runtime/GuiSys/CGuiWidgetDrawParms.hpp"
#include "Runtime/GuiSys/CStringTable.hpp"
#include "Runtime/IMain.hpp"
namespace urde::MP1 {
@ -80,7 +81,7 @@ void CPauseScreenBase::InitializeFrameGlue() {
x184_textpane_yicon = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_yicon"));
x188_textpane_ytext = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_ytext"));
x184_textpane_yicon->TextSupport().SetText(fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->xbc_yButton[0]));
x188_textpane_ytext->TextSupport().SetText(xc_pauseStrg.GetString(99));
x188_textpane_ytext->TextSupport().SetText(xc_pauseStrg.GetString(g_Main->IsUSA() ? 99 : 102));
x188_textpane_ytext->SetColor(g_tweakGuiColors->GetPauseItemAmberColor());
x18c_slidergroup_slider = static_cast<CGuiSliderGroup*>(x8_frame.FindWidget("slidergroup_slider"));
x18c_slidergroup_slider->SetMouseActive(true);

View File

@ -769,13 +769,6 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarMana
[this](hecl::Console* console, const std::vector<std::string>& args) { Warp(console, args); },
hecl::SConsoleCommand::ECommandFlags::Normal);
InitializeSubsystems();
AddOverridePaks();
x128_globalObjects.PostInitialize();
x70_tweaks.RegisterTweaks(m_cvarMgr);
x70_tweaks.RegisterResourceTweaks(m_cvarMgr);
AddWorldPaks();
bool loadedVersion = false;
if (CDvdFile::FileExists("version.yaml")) {
CDvdFile file("version.yaml");
@ -790,6 +783,14 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarMana
}
}
}
InitializeSubsystems();
AddOverridePaks();
x128_globalObjects.PostInitialize();
x70_tweaks.RegisterTweaks(m_cvarMgr);
x70_tweaks.RegisterResourceTweaks(m_cvarMgr);
AddWorldPaks();
if (loadedVersion) {
if (GetGame() != EGame::MetroidPrime1) {
MainLog.report(logvisor::Level::Fatal,