Add an enhancement for a minimal ui. (#102)

This removes the button backgrounds, hides the hearts when they are full and the magic when its not in use. It also hides the rupee / key counters. All this is still visible on the pause screen or when the minimap is visible. It also changes the minimap behavior to be hidden by default on a zone change.
This commit is contained in:
Andrew Piper 2022-03-31 18:32:32 -04:00 committed by GitHub
parent e7e80c2c95
commit 572e9fb9d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 129 additions and 95 deletions

View File

@ -58,6 +58,9 @@ namespace Game {
Settings.enhancements.animated_pause_menu = stob(Conf[EnhancementSection]["animated_pause_menu"]); Settings.enhancements.animated_pause_menu = stob(Conf[EnhancementSection]["animated_pause_menu"]);
CVar_SetS32(const_cast<char*>("gPauseLiveLink"), Settings.enhancements.animated_pause_menu); CVar_SetS32(const_cast<char*>("gPauseLiveLink"), Settings.enhancements.animated_pause_menu);
Settings.enhancements.minimal_ui = stob(Conf[EnhancementSection]["minimal_ui"]);
CVar_SetS32(const_cast<char*>("gMinimalUI"), Settings.enhancements.minimal_ui);
// Audio // Audio
Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]); Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]);
CVar_SetFloat(const_cast<char*>("gGameMasterVolume"), Settings.audio.master); CVar_SetFloat(const_cast<char*>("gGameMasterVolume"), Settings.audio.master);
@ -139,7 +142,7 @@ namespace Game {
Conf[EnhancementSection]["fast_text"] = std::to_string(Settings.enhancements.fast_text); Conf[EnhancementSection]["fast_text"] = std::to_string(Settings.enhancements.fast_text);
Conf[EnhancementSection]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod); Conf[EnhancementSection]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod);
Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu); Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu);
Conf[EnhancementSection]["minimal_ui"] = std::to_string(Settings.enhancements.minimal_ui);
// Controllers // Controllers
Conf[ControllerSection]["gyro_sensitivity"] = std::to_string(Settings.controller.gyro_sensitivity); Conf[ControllerSection]["gyro_sensitivity"] = std::to_string(Settings.controller.gyro_sensitivity);

View File

@ -23,6 +23,7 @@ struct SoHConfigType {
bool fast_text = false; bool fast_text = false;
bool disable_lod = false; bool disable_lod = false;
bool animated_pause_menu = false; bool animated_pause_menu = false;
bool minimal_ui = false;
} enhancements; } enhancements;
// Controller // Controller

View File

@ -341,6 +341,11 @@ namespace SohImGui {
needs_save = true; needs_save = true;
} }
if (ImGui::Checkbox("Minimal UI", &Game::Settings.enhancements.minimal_ui)) {
CVar_SetS32(const_cast<char*>("gMinimalUI"), Game::Settings.enhancements.minimal_ui);
needs_save = true;
}
ImGui::Text("Graphics"); ImGui::Text("Graphics");
ImGui::Separator(); ImGui::Separator();

View File

@ -24,6 +24,7 @@ void BootCommands_Init()
CVar_RegisterS32("gDisableLOD", 0); CVar_RegisterS32("gDisableLOD", 0);
CVar_RegisterS32("gDebugEnabled", 0); CVar_RegisterS32("gDebugEnabled", 0);
CVar_RegisterS32("gPauseLiveLink", 0); CVar_RegisterS32("gPauseLiveLink", 0);
CVar_RegisterS32("gMinimalUI", 0);
} }
//void BootCommands_ParseBootArgs(char* str) //void BootCommands_ParseBootArgs(char* str)

View File

@ -462,7 +462,7 @@ void func_80111070(void) {
WREG(28) = 0; WREG(28) = 0;
R_OW_MINIMAP_X = 238; R_OW_MINIMAP_X = 238;
R_OW_MINIMAP_Y = 164; R_OW_MINIMAP_Y = 164;
R_MINIMAP_DISABLED = false; R_MINIMAP_DISABLED = CVar_GetS32("gMinimalUI", 0);
WREG(32) = 122; WREG(32) = 122;
WREG(33) = 60; WREG(33) = 60;
WREG(35) = 0; WREG(35) = 0;

View File

@ -3143,6 +3143,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
s16 svar4; s16 svar4;
s16 svar5; s16 svar5;
s16 svar6; s16 svar6;
bool fullUi = !CVar_GetS32("gMinimalUI", 0) || !R_MINIMAP_DISABLED || globalCtx->pauseCtx.state != 0;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3405); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3405);
@ -3158,10 +3159,13 @@ void Interface_Draw(GlobalContext* globalCtx) {
if (pauseCtx->debugState == 0) { if (pauseCtx->debugState == 0) {
Interface_InitVertices(globalCtx); Interface_InitVertices(globalCtx);
func_8008A994(interfaceCtx); func_8008A994(interfaceCtx);
if (fullUi || gSaveContext.health != gSaveContext.healthCapacity) {
HealthMeter_Draw(globalCtx); HealthMeter_Draw(globalCtx);
}
func_80094520(globalCtx->state.gfxCtx); func_80094520(globalCtx->state.gfxCtx);
if (fullUi) {
// Rupee Icon // Rupee Icon
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 255, 100, interfaceCtx->magicAlpha); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 255, 100, interfaceCtx->magicAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 80, 0, 255); gDPSetEnvColor(OVERLAY_DISP++, 0, 80, 0, 255);
@ -3261,8 +3265,17 @@ void Interface_Draw(GlobalContext* globalCtx) {
Gfx_TextureI8(OVERLAY_DISP, ((u8*)digitTextures[interfaceCtx->counterDigits[svar2]]), 8, 16, Gfx_TextureI8(OVERLAY_DISP, ((u8*)digitTextures[interfaceCtx->counterDigits[svar2]]), 8, 16,
OTRGetRectDimensionFromLeftEdge(svar3), 206, 8, 16, 1 << 10, 1 << 10); OTRGetRectDimensionFromLeftEdge(svar3), 206, 8, 16, 1 << 10, 1 << 10);
} }
}
else {
// Make sure item counts have black backgrounds
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->magicAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0);
}
if (fullUi || gSaveContext.unk_13F0 > 0) {
Interface_DrawMagicBar(globalCtx); Interface_DrawMagicBar(globalCtx);
}
Minimap_Draw(globalCtx); Minimap_Draw(globalCtx);
if ((R_PAUSE_MENU_MODE != 2) && (R_PAUSE_MENU_MODE != 3)) { if ((R_PAUSE_MENU_MODE != 2) && (R_PAUSE_MENU_MODE != 3)) {
@ -3271,7 +3284,9 @@ void Interface_Draw(GlobalContext* globalCtx) {
func_80094520(globalCtx->state.gfxCtx); func_80094520(globalCtx->state.gfxCtx);
if (fullUi) {
Interface_DrawItemButtons(globalCtx); Interface_DrawItemButtons(globalCtx);
}
gDPPipeSync(OVERLAY_DISP++); gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha);
@ -3281,10 +3296,17 @@ void Interface_Draw(GlobalContext* globalCtx) {
// B Button Icon & Ammo Count // B Button Icon & Ammo Count
if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) if (gSaveContext.equips.buttonItems[0] != ITEM_NONE)
{ {
if (fullUi) {
Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[0]], 0); Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[0]], 0);
}
if ((player->stateFlags1 & 0x00800000) || (globalCtx->shootingGalleryStatus > 1) || if ((player->stateFlags1 & 0x00800000) || (globalCtx->shootingGalleryStatus > 1) ||
((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) {
if (!fullUi) {
Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[0]], 0);
}
gDPPipeSync(OVERLAY_DISP++); gDPPipeSync(OVERLAY_DISP++);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE,
0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
@ -3357,7 +3379,9 @@ void Interface_Draw(GlobalContext* globalCtx) {
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2), gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2),
interfaceCtx->aAlpha); interfaceCtx->aAlpha);
if (fullUi) {
Interface_DrawActionButton(globalCtx, rABtnX, R_A_BTN_Y); Interface_DrawActionButton(globalCtx, rABtnX, R_A_BTN_Y);
}
gDPPipeSync(OVERLAY_DISP++); gDPPipeSync(OVERLAY_DISP++);
const f32 rAIconX = OTRGetDimensionFromRightEdge(R_A_ICON_X); const f32 rAIconX = OTRGetDimensionFromRightEdge(R_A_ICON_X);
//func_8008A8B8(globalCtx, R_A_ICON_Y, R_A_ICON_Y + 45, rAIconX, rAIconX + 45); //func_8008A8B8(globalCtx, R_A_ICON_Y, R_A_ICON_Y + 45, rAIconX, rAIconX + 45);