enableRestMenu & enableLevelupMenu

This commit is contained in:
scrawl 2012-09-15 20:18:41 +02:00
parent 9cf1cbc89b
commit 896428c129
5 changed files with 25 additions and 7 deletions

View file

@ -219,6 +219,9 @@ namespace MWBase
virtual void setLoadingProgress (const std::string& stage, int depth, int current, int total) = 0;
virtual void loadingDone() = 0;
virtual void enableRest() = 0;
virtual bool getRestEnabled() = 0;
};
}

View file

@ -85,6 +85,7 @@ WindowManager::WindowManager(
, mGarbageDialogs()
, mShown(GW_ALL)
, mAllowed(newGame ? GW_None : GW_ALL)
, mRestAllowed(newGame ? false : true)
, mShowFPSLevel(fpsLevel)
, mFPS(0.0f)
, mTriangleCount(0)

View file

@ -200,6 +200,9 @@ namespace MWGui
virtual void setLoadingProgress (const std::string& stage, int depth, int current, int total);
virtual void loadingDone();
virtual void enableRest() { mRestAllowed = true; }
virtual bool getRestEnabled() { return mRestAllowed; }
private:
OEngine::GUI::MyGUIManager *mGuiManager;
HUD *mHud;
@ -260,6 +263,8 @@ namespace MWGui
allow() and disableAll().
*/
GuiWindow mAllowed;
// is the rest window allowed?
bool mRestAllowed;
void updateVisible(); // Update visibility of all windows based on mode, shown and allowed settings

View file

@ -548,8 +548,11 @@ namespace MWInput
void InputManager::rest()
{
if (!mWindows.isGuiMode ())
mWindows.pushGuiMode (MWGui::GM_Rest);
if (!mWindows.getRestEnabled () || mWindows.isGuiMode ())
return;
/// \todo check if resting is currently allowed (enemies nearby?)
mWindows.pushGuiMode (MWGui::GM_Rest);
}
void InputManager::screenshot()

View file

@ -30,6 +30,16 @@ namespace MWScript
}
};
class OpEnableRest : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
MWBase::Environment::get().getWindowManager()->enableRest();
}
};
class OpShowDialogue : public Interpreter::Opcode0
{
MWGui::GuiMode mDialogue;
@ -146,12 +156,8 @@ opcodeEnableStatsReviewMenu);
interpreter.installSegment5 (opcodeEnableStatsMenu,
new OpEnableWindow (MWGui::GW_Stats));
/* Not done yet. Enabling rest mode is not really a gui
issue, it's a gameplay issue.
interpreter.installSegment5 (opcodeEnableRest,
new OpEnableDialogue (MWGui::GM_Rest));
*/
new OpEnableRest ());
interpreter.installSegment5 (opcodeShowRestMenu,
new OpShowDialogue (MWGui::GM_Rest));