mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 20:53:50 +00:00
Implement toggleMenus
This commit is contained in:
parent
ad0a182b7e
commit
9a26cf22e6
8 changed files with 37 additions and 3 deletions
|
@ -228,6 +228,7 @@ namespace MWBase
|
|||
virtual void showCrosshair(bool show) = 0;
|
||||
virtual bool getSubtitlesEnabled() = 0;
|
||||
virtual void toggleHud() = 0;
|
||||
virtual bool toggleGui() = 0;
|
||||
|
||||
virtual void disallowMouse() = 0;
|
||||
virtual void allowMouse() = 0;
|
||||
|
|
|
@ -118,6 +118,7 @@ namespace MWGui
|
|||
, mCrosshairEnabled(Settings::Manager::getBool ("crosshair", "HUD"))
|
||||
, mSubtitlesEnabled(Settings::Manager::getBool ("subtitles", "GUI"))
|
||||
, mHudEnabled(true)
|
||||
, mGuiEnabled(true)
|
||||
, mCursorVisible(true)
|
||||
, mPlayerName()
|
||||
, mPlayerRaceId()
|
||||
|
@ -420,7 +421,7 @@ namespace MWGui
|
|||
mRecharge->setVisible(false);
|
||||
mVideoBackground->setVisible(false);
|
||||
|
||||
mHud->setVisible(mHudEnabled);
|
||||
mHud->setVisible(mHudEnabled && mGuiEnabled);
|
||||
|
||||
bool gameMode = !isGuiMode();
|
||||
|
||||
|
@ -430,6 +431,13 @@ namespace MWGui
|
|||
if (gameMode)
|
||||
setKeyFocusWidget (NULL);
|
||||
|
||||
if (!mGuiEnabled)
|
||||
{
|
||||
if (containsMode(GM_Console))
|
||||
mConsole->setVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Icons of forced hidden windows are displayed
|
||||
setMinimapVisibility((mAllowed & GW_Map) && (!mMap->pinned() || (mForceHidden & GW_Map)));
|
||||
setWeaponVisibility((mAllowed & GW_Inventory) && (!mInventoryWindow->pinned() || (mForceHidden & GW_Inventory)));
|
||||
|
@ -1345,6 +1353,13 @@ namespace MWGui
|
|||
mHud->setVisible (mHudEnabled);
|
||||
}
|
||||
|
||||
bool WindowManager::toggleGui()
|
||||
{
|
||||
mGuiEnabled = !mGuiEnabled;
|
||||
updateVisible();
|
||||
return mGuiEnabled;
|
||||
}
|
||||
|
||||
bool WindowManager::getRestEnabled()
|
||||
{
|
||||
//Enable rest dialogue if character creation finished
|
||||
|
|
|
@ -223,6 +223,9 @@ namespace MWGui
|
|||
virtual bool getSubtitlesEnabled();
|
||||
virtual void toggleHud();
|
||||
|
||||
/// Turn visibility of *all* GUI elements on or off (HUD and all windows, except the console)
|
||||
virtual bool toggleGui();
|
||||
|
||||
virtual void disallowMouse();
|
||||
virtual void allowMouse();
|
||||
virtual void notifyInputActionBound();
|
||||
|
@ -381,6 +384,7 @@ namespace MWGui
|
|||
bool mCrosshairEnabled;
|
||||
bool mSubtitlesEnabled;
|
||||
bool mHudEnabled;
|
||||
bool mGuiEnabled;
|
||||
bool mCursorVisible;
|
||||
|
||||
void setCursorVisible(bool visible);
|
||||
|
|
|
@ -277,7 +277,7 @@ namespace MWInput
|
|||
showQuickKeysMenu();
|
||||
break;
|
||||
case A_ToggleHUD:
|
||||
MWBase::Environment::get().getWindowManager()->toggleHud();
|
||||
MWBase::Environment::get().getWindowManager()->toggleGui();
|
||||
break;
|
||||
case A_QuickSave:
|
||||
quickSave();
|
||||
|
|
|
@ -400,5 +400,6 @@ op 0x2000247: BetaComment
|
|||
op 0x2000248: BetaComment, explicit
|
||||
op 0x2000249: OnMurder
|
||||
op 0x200024a: OnMurder, explicit
|
||||
op 0x200024b: ToggleMenus
|
||||
|
||||
opcodes 0x200024b-0x3ffffff unused
|
||||
opcodes 0x200024c-0x3ffffff unused
|
||||
|
|
|
@ -203,6 +203,15 @@ namespace MWScript
|
|||
}
|
||||
};
|
||||
|
||||
class OpToggleMenus : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
virtual void execute(Interpreter::Runtime &runtime)
|
||||
{
|
||||
bool state = MWBase::Environment::get().getWindowManager()->toggleGui();
|
||||
runtime.getContext().report(state ? "GUI -> On" : "GUI -> Off");
|
||||
}
|
||||
};
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
{
|
||||
|
@ -242,6 +251,7 @@ namespace MWScript
|
|||
interpreter.installSegment5 (Compiler::Gui::opcodeShowMap, new OpShowMap);
|
||||
interpreter.installSegment5 (Compiler::Gui::opcodeFillMap, new OpFillMap);
|
||||
interpreter.installSegment3 (Compiler::Gui::opcodeMenuTest, new OpMenuTest);
|
||||
interpreter.installSegment5 (Compiler::Gui::opcodeToggleMenus, new OpToggleMenus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,6 +216,8 @@ namespace Compiler
|
|||
extensions.registerInstruction ("showmap", "S", opcodeShowMap);
|
||||
extensions.registerInstruction ("fillmap", "", opcodeFillMap);
|
||||
extensions.registerInstruction ("menutest", "/l", opcodeMenuTest);
|
||||
extensions.registerInstruction ("togglemenus", "", opcodeToggleMenus);
|
||||
extensions.registerInstruction ("tm", "", opcodeToggleMenus);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -178,6 +178,7 @@ namespace Compiler
|
|||
const int opcodeShowMap = 0x20001a0;
|
||||
const int opcodeFillMap = 0x20001a1;
|
||||
const int opcodeMenuTest = 0x2002c;
|
||||
const int opcodeToggleMenus = 0x200024b;
|
||||
}
|
||||
|
||||
namespace Misc
|
||||
|
|
Loading…
Reference in a new issue