Skip to content

Commit

Permalink
Merge branch 'visual_keys' into enhancement_mods
Browse files Browse the repository at this point in the history
  • Loading branch information
lilDavid committed Jul 19, 2023
2 parents 95243c0 + c0ad1ca commit 72ec72c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions soh/soh/Enhancements/presets.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ const std::vector<const char*> enhancementsCvars = {
"gFPSGauntlets",
"gSceneSpecificDirtPathFix",
"gZFightingMode",
"gVisualKeys",
"gSmallKeySpacing",
"gRightAlignKeys",
"gAuthenticLogo",
"gPauseLiveLinkRotationSpeed",
"gBowReticle",
Expand Down
5 changes: 5 additions & 0 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,11 @@ void DrawEnhancementsMenu() {
"Consistent: Certain paths vanish the same way in all resolutions\n"
"No Vanish: Paths do not vanish, Link seems to sink in to some paths\n"
"This might affect other decal effects\n");
UIWidgets::PaddedEnhancementCheckbox("Visual Small Key display", "gVisualKeys", true, false);
UIWidgets::Tooltip("Displays Small Key count using multiple icons rather than a numeric counter");
const bool disableKeySpacing = !CVarGetInteger("gVisualKeys", 0);
static const char* disableKeySpacingTooltip = "This option is disabled because \"Visual Small Key display\" is turned off";
UIWidgets::EnhancementSliderInt("Small Key icon spacing: %d", "##SmallKeySpacing", "gSmallKeySpacing", 1, 16, "", 8, true, disableKeySpacing, disableKeySpacingTooltip);
UIWidgets::PaddedEnhancementSliderInt("Text Spacing: %d", "##TEXTSPACING", "gTextSpacing", 4, 6, "", 6, true, true, true);
UIWidgets::Tooltip("Space between text characters (useful for HD font textures)");
ImGui::EndMenu();
Expand Down
15 changes: 15 additions & 0 deletions soh/src/code/z_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -5003,6 +5003,21 @@ void Interface_Draw(PlayState* play) {

gDPSetPrimColor(OVERLAY_DISP++, 0, 0, keyCountColor.r,keyCountColor.g,keyCountColor.b, interfaceCtx->magicAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 20, 255); //We reset this here so it match user color :)

if (CVarGetInteger("gVisualKeys", 0)) {
s8 keyCount = gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex];
s16 rectLeft = PosX_SKC;
s16 keyOffset = CVarGetInteger("gSmallKeySpacing", 8);
if (CVarGetInteger("gRightAlignKeys", 0)) {
keyOffset = -keyOffset;
}
for (int i = 0; i < keyCount; i++, rectLeft += keyOffset) {
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gSmallKeyCounterIconTex, 16, 16, rectLeft, PosY_SKC, 16, 16,
1 << 10, 1 << 10);
}
break;
}

OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gSmallKeyCounterIconTex, 16, 16, PosX_SKC, PosY_SKC, 16, 16,
1 << 10, 1 << 10);

Expand Down

0 comments on commit 72ec72c

Please sign in to comment.