mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-20 13:23:45 -07:00
Merge ea1c741fe7
into 7b4df9bdb2
This commit is contained in:
commit
2a8f6c5aa9
4 changed files with 96 additions and 2 deletions
|
@ -549,7 +549,7 @@ void AudioEditor::DrawElement() {
|
|||
UIWidgets::CVarSliderInt("Overlay Duration: %d seconds", CVAR_AUDIO("SeqNameOverlayDuration"),
|
||||
UIWidgets::IntSliderOptions()
|
||||
.Min(1)
|
||||
.Max(10)
|
||||
.Max(20)
|
||||
.DefaultValue(5)
|
||||
.Size(ImVec2(300.0f, 0.0f))
|
||||
.Color(THEME_COLOR));
|
||||
|
|
|
@ -345,9 +345,17 @@ void OTRGlobals::Initialize() {
|
|||
context->InitWindow(sohFast3dWindow);
|
||||
|
||||
auto overlay = context->GetInstance()->GetWindow()->GetGui()->GetGameOverlay();
|
||||
// Currently, differently sized fonts require preloading
|
||||
// (loading a font at any point after here crashes the game with "INVALID ACCESS TO STORAGE")
|
||||
overlay->LoadFont("Press Start 2P", 12.0f, "fonts/PressStart2P-Regular.ttf");
|
||||
overlay->LoadFont("Press Start 2P Normal", 24.0f, "fonts/PressStart2P-Regular.ttf");
|
||||
overlay->LoadFont("Press Start 2P Large", 32.0f, "fonts/PressStart2P-Regular.ttf");
|
||||
overlay->LoadFont("Press Start 2P X-Large", 40.0f, "fonts/PressStart2P-Regular.ttf");
|
||||
overlay->LoadFont("Fipps", 32.0f, "fonts/Fipps-Regular.otf");
|
||||
overlay->SetCurrentFont(CVarGetString(CVAR_GAME_OVERLAY_FONT, "Press Start 2P"));
|
||||
overlay->LoadFont("Fipps Normal", 40.0f, "fonts/Fipps-Regular.otf");
|
||||
overlay->LoadFont("Fipps Large", 48.0f, "fonts/Fipps-Regular.otf");
|
||||
overlay->LoadFont("Fipps X-Large", 52.0f, "fonts/Fipps-Regular.otf");
|
||||
LoadOverlayTextFont();
|
||||
|
||||
context->InitAudio({ .SampleRate = 32000, .SampleLength = 1024, .DesiredBuffered = 1680 });
|
||||
|
||||
|
@ -513,6 +521,48 @@ void OTRGlobals::ScaleImGui() {
|
|||
previousImGuiScale = scale;
|
||||
}
|
||||
|
||||
void OTRGlobals::LoadOverlayTextFont() {
|
||||
auto overlay = context->GetInstance()->GetWindow()->GetGui()->GetGameOverlay();
|
||||
|
||||
switch (CVarGetInteger(CVAR_SETTING("OverlayTextFont"), 0)) {
|
||||
case 0:
|
||||
default:
|
||||
switch (CVarGetInteger(CVAR_SETTING("OverlayTextScale"), 0)) {
|
||||
case 0:
|
||||
default:
|
||||
overlay->SetCurrentFont("Press Start 2P");
|
||||
break;
|
||||
case 1:
|
||||
overlay->SetCurrentFont("Press Start 2P Normal");
|
||||
break;
|
||||
case 2:
|
||||
overlay->SetCurrentFont("Press Start 2P Large");
|
||||
break;
|
||||
case 3:
|
||||
overlay->SetCurrentFont("Press Start 2P X-Large");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
switch (CVarGetInteger(CVAR_SETTING("OverlayTextScale"), 0)) {
|
||||
case 0:
|
||||
default:
|
||||
overlay->SetCurrentFont("Fipps");
|
||||
break;
|
||||
case 1:
|
||||
overlay->SetCurrentFont("Fipps Normal");
|
||||
break;
|
||||
case 2:
|
||||
overlay->SetCurrentFont("Fipps Large");
|
||||
break;
|
||||
case 3:
|
||||
overlay->SetCurrentFont("Fipps X-Large");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ImFont* OTRGlobals::CreateDefaultFontWithSize(float size) {
|
||||
auto mImGuiIo = &ImGui::GetIO();
|
||||
ImFontConfig fontCfg = ImFontConfig();
|
||||
|
|
|
@ -72,6 +72,8 @@ class OTRGlobals {
|
|||
|
||||
void ScaleImGui();
|
||||
void Initialize();
|
||||
void LoadOverlayTextFont();
|
||||
|
||||
bool HasMasterQuest();
|
||||
bool HasOriginal();
|
||||
uint32_t GetInterpolationFPS();
|
||||
|
|
|
@ -59,6 +59,18 @@ static const std::unordered_map<int32_t, const char*> bootSequenceLabels = {
|
|||
{ BOOTSEQUENCE_FILESELECT, "File Select" },
|
||||
};
|
||||
|
||||
static std::unordered_map<int32_t, const char*> overlayTextScaleOptions = {
|
||||
{ 0, "Small" },
|
||||
{ 1, "Normal" },
|
||||
{ 2, "Large" },
|
||||
{ 3, "X-Large" },
|
||||
};
|
||||
|
||||
static std::unordered_map<int32_t, const char*> overlayTextFontOptions = {
|
||||
{ 0, "Press Start 2P" },
|
||||
{ 1, "Fipps" },
|
||||
};
|
||||
|
||||
const char* GetGameVersionString(uint32_t index) {
|
||||
uint32_t gameVersion = ResourceMgr_GetGameVersion(index);
|
||||
switch (gameVersion) {
|
||||
|
@ -106,6 +118,8 @@ extern "C" MessageTableEntry* sGerMessageEntryTablePtr;
|
|||
extern "C" MessageTableEntry* sFraMessageEntryTablePtr;
|
||||
extern "C" MessageTableEntry* sJpnMessageEntryTablePtr;
|
||||
|
||||
extern "C" void Overlay_DisplayText_Seconds(int seconds, const char* text);
|
||||
|
||||
static const std::array<MessageTableEntry**, LANGUAGE_MAX> messageTables = {
|
||||
&sNesMessageEntryTablePtr, &sGerMessageEntryTablePtr, &sFraMessageEntryTablePtr, &sJpnMessageEntryTablePtr
|
||||
};
|
||||
|
@ -456,6 +470,7 @@ void SohMenu::AddMenuSettings() {
|
|||
path.sidebarName = "Notifications";
|
||||
path.column = SECTION_COLUMN_1;
|
||||
AddSidebarEntry("Settings", path.sidebarName, 3);
|
||||
AddWidget(path, "Notifications Settings", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Position", WIDGET_CVAR_COMBOBOX)
|
||||
.CVar(CVAR_SETTING("Notifications.Position"))
|
||||
.RaceDisable(false)
|
||||
|
@ -501,6 +516,33 @@ void SohMenu::AddMenuSettings() {
|
|||
});
|
||||
})
|
||||
.Options(ButtonOptions().Tooltip("Displays a test notification."));
|
||||
|
||||
AddWidget(path, "Overlay Text Settings", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Overlay Text Size:", WIDGET_CVAR_COMBOBOX)
|
||||
.CVar(CVAR_SETTING("OverlayTextScale"))
|
||||
.RaceDisable(false)
|
||||
.Options(ComboboxOptions()
|
||||
.ComboMap(overlayTextScaleOptions)
|
||||
.Tooltip("Changes the font size of Overlay Text.")
|
||||
.DefaultIndex(0)
|
||||
.ComponentAlignment(ComponentAlignments::Right)
|
||||
.LabelPosition(LabelPositions::Far))
|
||||
.Callback([](WidgetInfo& info) { OTRGlobals::Instance->LoadOverlayTextFont(); });
|
||||
AddWidget(path, "Overlay Text Font:", WIDGET_CVAR_COMBOBOX)
|
||||
.CVar(CVAR_SETTING("OverlayTextFont"))
|
||||
.RaceDisable(false)
|
||||
.Options(
|
||||
ComboboxOptions()
|
||||
.ComboMap(overlayTextFontOptions)
|
||||
.Tooltip("Changes the font type of Overlay Text.\nNote: Fipps is generally smaller than Press Start 2P")
|
||||
.DefaultIndex(0)
|
||||
.ComponentAlignment(ComponentAlignments::Right)
|
||||
.LabelPosition(LabelPositions::Far))
|
||||
.Callback([](WidgetInfo& info) { OTRGlobals::Instance->LoadOverlayTextFont(); });
|
||||
AddWidget(path, "Test Overlay Text", WIDGET_BUTTON)
|
||||
.RaceDisable(false)
|
||||
.Callback([](WidgetInfo& info) { Overlay_DisplayText_Seconds(5, "Overlay Text Test"); })
|
||||
.Options(ButtonOptions().Tooltip("Displays a test Overlay Text."));
|
||||
}
|
||||
|
||||
} // namespace SohGui
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue