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"]);
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
Settings.audio.master = Ship::stof(Conf[AudioSection]["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]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod);
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
Conf[ControllerSection]["gyro_sensitivity"] = std::to_string(Settings.controller.gyro_sensitivity);

View File

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

View File

@ -341,6 +341,11 @@ namespace SohImGui {
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::Separator();

View File

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

View File

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

View File

@ -3143,6 +3143,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
s16 svar4;
s16 svar5;
s16 svar6;
bool fullUi = !CVar_GetS32("gMinimalUI", 0) || !R_MINIMAP_DISABLED || globalCtx->pauseCtx.state != 0;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3405);
@ -3158,111 +3159,123 @@ void Interface_Draw(GlobalContext* globalCtx) {
if (pauseCtx->debugState == 0) {
Interface_InitVertices(globalCtx);
func_8008A994(interfaceCtx);
HealthMeter_Draw(globalCtx);
if (fullUi || gSaveContext.health != gSaveContext.healthCapacity) {
HealthMeter_Draw(globalCtx);
}
func_80094520(globalCtx->state.gfxCtx);
// Rupee Icon
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 255, 100, interfaceCtx->magicAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 80, 0, 255);
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, OTRGetRectDimensionFromLeftEdge(26),
206, 16, 16, 1 << 10, 1 << 10);
if (fullUi) {
// Rupee Icon
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 255, 100, interfaceCtx->magicAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 80, 0, 255);
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, OTRGetRectDimensionFromLeftEdge(26),
206, 16, 16, 1 << 10, 1 << 10);
switch (globalCtx->sceneNum) {
case SCENE_BMORI1:
case SCENE_HIDAN:
case SCENE_MIZUSIN:
case SCENE_JYASINZOU:
case SCENE_HAKADAN:
case SCENE_HAKADANCH:
case SCENE_ICE_DOUKUTO:
case SCENE_GANON:
case SCENE_MEN:
case SCENE_GERUDOWAY:
case SCENE_GANONTIKA:
case SCENE_GANON_SONOGO:
case SCENE_GANONTIKA_SONOGO:
case SCENE_TAKARAYA:
if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] >= 0) {
// Small Key Icon
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 230, 255, interfaceCtx->magicAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 20, 255);
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gSmallKeyCounterIconTex, 16, 16, OTRGetRectDimensionFromLeftEdge(26), 190, 16, 16,
1 << 10, 1 << 10);
switch (globalCtx->sceneNum) {
case SCENE_BMORI1:
case SCENE_HIDAN:
case SCENE_MIZUSIN:
case SCENE_JYASINZOU:
case SCENE_HAKADAN:
case SCENE_HAKADANCH:
case SCENE_ICE_DOUKUTO:
case SCENE_GANON:
case SCENE_MEN:
case SCENE_GERUDOWAY:
case SCENE_GANONTIKA:
case SCENE_GANON_SONOGO:
case SCENE_GANONTIKA_SONOGO:
case SCENE_TAKARAYA:
if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] >= 0) {
// Small Key Icon
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 230, 255, interfaceCtx->magicAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 20, 255);
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gSmallKeyCounterIconTex, 16, 16, OTRGetRectDimensionFromLeftEdge(26), 190, 16, 16,
1 << 10, 1 << 10);
// Small Key Counter
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE,
TEXEL0, 0, PRIMITIVE, 0);
// Small Key Counter
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE,
TEXEL0, 0, PRIMITIVE, 0);
interfaceCtx->counterDigits[2] = 0;
interfaceCtx->counterDigits[3] = gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex];
interfaceCtx->counterDigits[2] = 0;
interfaceCtx->counterDigits[3] = gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex];
while (interfaceCtx->counterDigits[3] >= 10) {
interfaceCtx->counterDigits[2]++;
interfaceCtx->counterDigits[3] -= 10;
while (interfaceCtx->counterDigits[3] >= 10) {
interfaceCtx->counterDigits[2]++;
interfaceCtx->counterDigits[3] -= 10;
}
svar3 = OTRGetRectDimensionFromLeftEdge(42);
if (interfaceCtx->counterDigits[2] != 0) {
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, ((u8*)((u8*)digitTextures[interfaceCtx->counterDigits[2]])), 8,
16, svar3, 190, 8, 16, 1 << 10, 1 << 10);
svar3 += 8;
}
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP,
((u8*)digitTextures[interfaceCtx->counterDigits[3]]), 8, 16,
svar3, 190, 8, 16, 1 << 10, 1 << 10);
}
break;
default:
break;
}
svar3 = OTRGetRectDimensionFromLeftEdge(42);
// Rupee Counter
gDPPipeSync(OVERLAY_DISP++);
if (interfaceCtx->counterDigits[2] != 0) {
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, ((u8*)((u8*)digitTextures[interfaceCtx->counterDigits[2]])), 8,
16, svar3, 190, 8, 16, 1 << 10, 1 << 10);
svar3 += 8;
}
if (gSaveContext.rupees == CUR_CAPACITY(UPG_WALLET)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 255, 0, interfaceCtx->magicAlpha);
} else if (gSaveContext.rupees != 0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 100, 100, interfaceCtx->magicAlpha);
}
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP,
((u8*)digitTextures[interfaceCtx->counterDigits[3]]), 8, 16,
svar3, 190, 8, 16, 1 << 10, 1 << 10);
}
break;
default:
break;
gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
PRIMITIVE, 0);
interfaceCtx->counterDigits[0] = interfaceCtx->counterDigits[1] = 0;
interfaceCtx->counterDigits[2] = gSaveContext.rupees;
if ((interfaceCtx->counterDigits[2] > 9999) || (interfaceCtx->counterDigits[2] < 0)) {
interfaceCtx->counterDigits[2] &= 0xDDD;
}
while (interfaceCtx->counterDigits[2] >= 100) {
interfaceCtx->counterDigits[0]++;
interfaceCtx->counterDigits[2] -= 100;
}
while (interfaceCtx->counterDigits[2] >= 10) {
interfaceCtx->counterDigits[1]++;
interfaceCtx->counterDigits[2] -= 10;
}
svar2 = rupeeDigitsFirst[CUR_UPG_VALUE(UPG_WALLET)];
svar5 = rupeeDigitsCount[CUR_UPG_VALUE(UPG_WALLET)];
for (svar1 = 0, svar3 = 42; svar1 < svar5; svar1++, svar2++, svar3 += 8) {
OVERLAY_DISP =
Gfx_TextureI8(OVERLAY_DISP, ((u8*)digitTextures[interfaceCtx->counterDigits[svar2]]), 8, 16,
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);
}
// Rupee Counter
gDPPipeSync(OVERLAY_DISP++);
if (gSaveContext.rupees == CUR_CAPACITY(UPG_WALLET)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 255, 0, interfaceCtx->magicAlpha);
} else if (gSaveContext.rupees != 0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 100, 100, interfaceCtx->magicAlpha);
if (fullUi || gSaveContext.unk_13F0 > 0) {
Interface_DrawMagicBar(globalCtx);
}
gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
PRIMITIVE, 0);
interfaceCtx->counterDigits[0] = interfaceCtx->counterDigits[1] = 0;
interfaceCtx->counterDigits[2] = gSaveContext.rupees;
if ((interfaceCtx->counterDigits[2] > 9999) || (interfaceCtx->counterDigits[2] < 0)) {
interfaceCtx->counterDigits[2] &= 0xDDD;
}
while (interfaceCtx->counterDigits[2] >= 100) {
interfaceCtx->counterDigits[0]++;
interfaceCtx->counterDigits[2] -= 100;
}
while (interfaceCtx->counterDigits[2] >= 10) {
interfaceCtx->counterDigits[1]++;
interfaceCtx->counterDigits[2] -= 10;
}
svar2 = rupeeDigitsFirst[CUR_UPG_VALUE(UPG_WALLET)];
svar5 = rupeeDigitsCount[CUR_UPG_VALUE(UPG_WALLET)];
for (svar1 = 0, svar3 = 42; svar1 < svar5; svar1++, svar2++, svar3 += 8) {
OVERLAY_DISP =
Gfx_TextureI8(OVERLAY_DISP, ((u8*)digitTextures[interfaceCtx->counterDigits[svar2]]), 8, 16,
OTRGetRectDimensionFromLeftEdge(svar3), 206, 8, 16, 1 << 10, 1 << 10);
}
Interface_DrawMagicBar(globalCtx);
Minimap_Draw(globalCtx);
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);
Interface_DrawItemButtons(globalCtx);
if (fullUi) {
Interface_DrawItemButtons(globalCtx);
}
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha);
@ -3281,10 +3296,17 @@ void Interface_Draw(GlobalContext* globalCtx) {
// B Button Icon & Ammo Count
if (gSaveContext.equips.buttonItems[0] != ITEM_NONE)
{
Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[0]], 0);
if (fullUi) {
Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[0]], 0);
}
if ((player->stateFlags1 & 0x00800000) || (globalCtx->shootingGalleryStatus > 1) ||
((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) {
if (!fullUi) {
Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[0]], 0);
}
gDPPipeSync(OVERLAY_DISP++);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE,
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);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2),
interfaceCtx->aAlpha);
Interface_DrawActionButton(globalCtx, rABtnX, R_A_BTN_Y);
if (fullUi) {
Interface_DrawActionButton(globalCtx, rABtnX, R_A_BTN_Y);
}
gDPPipeSync(OVERLAY_DISP++);
const f32 rAIconX = OTRGetDimensionFromRightEdge(R_A_ICON_X);
//func_8008A8B8(globalCtx, R_A_ICON_Y, R_A_ICON_Y + 45, rAIconX, rAIconX + 45);