From c1dcf01e26882cd137a1a2db73926980b5f7cb93 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Wed, 27 Dec 2023 01:35:37 -0500 Subject: [PATCH] Add options to disable mouselook instructions and overlays --- .../newview/app_settings/settings_alchemy.xml | 22 ++++ indra/newview/llviewerwindow.cpp | 124 ++++++++++-------- .../xui/en/panel_preferences_move_mlook.xml | 28 +++- 3 files changed, 115 insertions(+), 59 deletions(-) diff --git a/indra/newview/app_settings/settings_alchemy.xml b/indra/newview/app_settings/settings_alchemy.xml index 5066ad5b6f5..268a4d2cdb1 100644 --- a/indra/newview/app_settings/settings_alchemy.xml +++ b/indra/newview/app_settings/settings_alchemy.xml @@ -1723,5 +1723,27 @@ <key>Value</key> <integer>0</integer> </map> + <key>AlchemyMouselookInstructions</key> + <map> + <key>Comment</key> + <string>Draw instructional overlay for mouselook - Press esc to leave</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>AlchemyMouselookPosition</key> + <map> + <key>Comment</key> + <string>Draw position and health in mouselook</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> </map> </llsd> diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index b968a34e4f9..bd87170a773 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -5869,65 +5869,77 @@ void LLViewerWindow::destroyWindow() void LLViewerWindow::drawMouselookInstructions() { - // Draw information for mouselook (pos, health) - const LLFontGL* font = LLFontGL::getFontSansSerifBig(); - const LLVector3& vec = gAgent.getPositionAgent(); - - //to be at top of viewer - const S32 INSTRUCTIONS_TOP_PAD = getWorldViewRectScaled().mTop - 15; - const S32 text_pos_start = getWorldViewRectScaled().getCenterX() - 150; - font->renderUTF8( - llformat("X: %.2f", vec.mV[VX]), 0, - text_pos_start, - INSTRUCTIONS_TOP_PAD, - LLColor4(1.0f, 0.5f, 0.5f, 0.5f), - LLFontGL::HCENTER, LLFontGL::TOP, - LLFontGL::BOLD, LLFontGL::DROP_SHADOW); - font->renderUTF8( - llformat("Y: %.2f", vec.mV[VY]), 0, - text_pos_start + 100, - INSTRUCTIONS_TOP_PAD, - LLColor4(0.5f, 1.0f, 0.5f, 0.5f), - LLFontGL::HCENTER, LLFontGL::TOP, - LLFontGL::BOLD, LLFontGL::DROP_SHADOW); - font->renderUTF8( - llformat("Z: %.2f", vec.mV[VZ]), 0, - text_pos_start + 200, - INSTRUCTIONS_TOP_PAD, - LLColor4(0.5f, 0.5f, 1.0f, 0.5f), - LLFontGL::HCENTER, LLFontGL::TOP, - LLFontGL::BOLD, LLFontGL::DROP_SHADOW); - LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); - const bool allow_damage = vpm->allowAgentDamage(gAgent.getRegion(), vpm->getAgentParcel()); - if (allow_damage) - { - S32 health = -1; - if (gStatusBar) + static LLCachedControl<bool> draw_mouselook_instructions(gSavedSettings, "AlchemyMouselookInstructions", true); + static LLCachedControl<bool> draw_mouselook_position(gSavedSettings, "AlchemyMouselookPosition", true); + if (draw_mouselook_position || draw_mouselook_instructions) + { + // Draw information for mouselook (pos, health) + const LLFontGL* font = LLFontGL::getFontSansSerifBig(); + + if (draw_mouselook_position) { - health = gStatusBar->getHealth(); + //to be at top of viewer + const S32 INSTRUCTIONS_TOP_PAD = getWorldViewRectScaled().mTop - 15; + const S32 text_pos_start = getWorldViewRectScaled().getCenterX() - 150; + const LLVector3& vec = gAgent.getPositionAgent(); + + font->renderUTF8( + llformat("X: %.2f", vec.mV[VX]), 0, + text_pos_start, + INSTRUCTIONS_TOP_PAD, + LLColor4(1.0f, 0.5f, 0.5f, 0.5f), + LLFontGL::HCENTER, LLFontGL::TOP, + LLFontGL::BOLD, LLFontGL::DROP_SHADOW); + font->renderUTF8( + llformat("Y: %.2f", vec.mV[VY]), 0, + text_pos_start + 100, + INSTRUCTIONS_TOP_PAD, + LLColor4(0.5f, 1.0f, 0.5f, 0.5f), + LLFontGL::HCENTER, LLFontGL::TOP, + LLFontGL::BOLD, LLFontGL::DROP_SHADOW); + font->renderUTF8( + llformat("Z: %.2f", vec.mV[VZ]), 0, + text_pos_start + 200, + INSTRUCTIONS_TOP_PAD, + LLColor4(0.5f, 0.5f, 1.0f, 0.5f), + LLFontGL::HCENTER, LLFontGL::TOP, + LLFontGL::BOLD, LLFontGL::DROP_SHADOW); + LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); + const bool allow_damage = vpm->allowAgentDamage(gAgent.getRegion(), vpm->getAgentParcel()); + if (allow_damage) + { + S32 health = -1; + if (gStatusBar) + { + health = gStatusBar->getHealth(); + } + font->renderUTF8( + llformat("HP: %d%%", health), 0, + text_pos_start + 300, + INSTRUCTIONS_TOP_PAD, + LLColor4(1.0f, 1.0f, 1.0f, 0.5f), + LLFontGL::HCENTER, LLFontGL::TOP, + LLFontGL::BOLD, LLFontGL::DROP_SHADOW); + } } - font->renderUTF8( - llformat("HP: %d%%", health), 0, - text_pos_start + 300, - INSTRUCTIONS_TOP_PAD, - LLColor4(1.0f, 1.0f, 1.0f, 0.5f), - LLFontGL::HCENTER, LLFontGL::TOP, - LLFontGL::BOLD, LLFontGL::DROP_SHADOW); - } - // Draw instructions for mouselook ("Press ESC to return to World View" partially transparent at the bottom of the screen.) - static const std::string instructions = LLTrans::getString("LeaveMouselook"); - - //to be on top of Bottom bar when it is opened - const S32 INSTRUCTIONS_BOTTOM_PAD = 50; - - font->renderUTF8( - instructions, 0, - getWorldViewRectScaled().getCenterX(), - getWorldViewRectScaled().mBottom + INSTRUCTIONS_BOTTOM_PAD, - LLColor4( 1.0f, 1.0f, 1.0f, 0.5f ), - LLFontGL::HCENTER, LLFontGL::TOP, - LLFontGL::BOLD, LLFontGL::DROP_SHADOW); + if (draw_mouselook_instructions) + { + // Draw instructions for mouselook ("Press ESC to return to World View" partially transparent at the bottom of the screen.) + static const std::string instructions = LLTrans::getString("LeaveMouselook"); + + //to be on top of Bottom bar when it is opened + const S32 INSTRUCTIONS_BOTTOM_PAD = 50; + + font->renderUTF8( + instructions, 0, + getWorldViewRectScaled().getCenterX(), + getWorldViewRectScaled().mBottom + INSTRUCTIONS_BOTTOM_PAD, + LLColor4(1.0f, 1.0f, 1.0f, 0.5f), + LLFontGL::HCENTER, LLFontGL::TOP, + LLFontGL::BOLD, LLFontGL::DROP_SHADOW); + } + } } void* LLViewerWindow::getPlatformWindow() const diff --git a/indra/newview/skins/default/xui/en/panel_preferences_move_mlook.xml b/indra/newview/skins/default/xui/en/panel_preferences_move_mlook.xml index d0c9b47e668..2d4194aeb06 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_move_mlook.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_move_mlook.xml @@ -15,7 +15,7 @@ length="1" height="10" layout="topleft" - left="78" + left="75" name="mouse_lbl" width="270" top_pad="15"> @@ -98,15 +98,37 @@ top_pad="10" width="160" wrap="true"> - Combat Features: + Gameplay Features: </text> + <check_box + control_name="AlchemyMouselookInstructions" + follows="left|top" + height="20" + label="Show Mouselook Instructions" + layout="topleft" + left_delta="5" + name="alchemy_mlook_instructions" + tool_tip="Shows instructional text in mouselook overlay." + top_pad="0" + width="256" /> + <check_box + control_name="AlchemyMouselookPosition" + follows="left|top" + height="20" + label="Show Position and Health in Mouselook" + layout="topleft" + left_delta="0" + name="alchemy_mlook_iff" + tool_tip="Shows user's current position and health in mouselook overlay." + top_pad="0" + width="256" /> <check_box control_name="AlchemyMouselookIFF" follows="left|top" height="20" label="Show User In Crosshairs" layout="topleft" - left_delta="5" + left_delta="0" name="alchemy_mlook_iff" tool_tip="Shows user's name and distance in mouselook's crosshairs." top_pad="0" -- GitLab