mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 09:45:35 +00:00
Merge remote-tracking branch 'zini/master' into misc-cleanup
This commit is contained in:
commit
000128d084
5 changed files with 35 additions and 5 deletions
|
@ -198,7 +198,7 @@ namespace MWBase
|
|||
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
|
||||
///< Hides dialog and schedules dialog to be deleted.
|
||||
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons) = 0;
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons = std::vector<std::string>()) = 0;
|
||||
virtual void enterPressed () = 0;
|
||||
virtual int readPressedButton() = 0;
|
||||
///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||
|
|
|
@ -188,7 +188,7 @@ namespace MWGui
|
|||
|
||||
virtual void removeDialog(OEngine::GUI::Layout* dialog); ///< Hides dialog and schedules dialog to be deleted.
|
||||
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons = std::vector<std::string>());
|
||||
virtual void enterPressed ();
|
||||
virtual int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "../engine.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
@ -51,6 +52,7 @@ namespace MWInput
|
|||
, mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
|
||||
, mPreviewPOVDelay(0.f)
|
||||
, mTimeIdle(0.f)
|
||||
, mOverencumberedMessageDelay(0.f)
|
||||
{
|
||||
Ogre::RenderWindow* window = ogre.getWindow ();
|
||||
size_t windowHnd;
|
||||
|
@ -268,13 +270,16 @@ namespace MWInput
|
|||
// be done in the physics system.
|
||||
if (mControlSwitch["playercontrols"])
|
||||
{
|
||||
bool triedToMove = false;
|
||||
if (actionIsActive(A_MoveLeft))
|
||||
{
|
||||
triedToMove = true;
|
||||
mPlayer.setAutoMove (false);
|
||||
mPlayer.setLeftRight (-1);
|
||||
}
|
||||
else if (actionIsActive(A_MoveRight))
|
||||
{
|
||||
triedToMove = true;
|
||||
mPlayer.setAutoMove (false);
|
||||
mPlayer.setLeftRight (1);
|
||||
}
|
||||
|
@ -283,11 +288,13 @@ namespace MWInput
|
|||
|
||||
if (actionIsActive(A_MoveForward))
|
||||
{
|
||||
triedToMove = true;
|
||||
mPlayer.setAutoMove (false);
|
||||
mPlayer.setForwardBackward (1);
|
||||
}
|
||||
else if (actionIsActive(A_MoveBackward))
|
||||
{
|
||||
triedToMove = true;
|
||||
mPlayer.setAutoMove (false);
|
||||
mPlayer.setForwardBackward (-1);
|
||||
}
|
||||
|
@ -295,7 +302,10 @@ namespace MWInput
|
|||
mPlayer.setForwardBackward (0);
|
||||
|
||||
if (actionIsActive(A_Jump) && mControlSwitch["playerjumping"])
|
||||
{
|
||||
mPlayer.setUpDown (1);
|
||||
triedToMove = true;
|
||||
}
|
||||
else if (actionIsActive(A_Crouch))
|
||||
mPlayer.setUpDown (-1);
|
||||
else
|
||||
|
@ -306,6 +316,21 @@ namespace MWInput
|
|||
else
|
||||
mPlayer.setRunState(false);
|
||||
|
||||
// if player tried to start moving, but can't (due to being overencumbered), display a notification.
|
||||
if (triedToMove)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
|
||||
mOverencumberedMessageDelay -= dt;
|
||||
if (MWWorld::Class::get(player).getEncumbrance(player) >= MWWorld::Class::get(player).getCapacity(player))
|
||||
{
|
||||
if (mOverencumberedMessageDelay <= 0)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox("#{sNotifyMessage59}");
|
||||
mOverencumberedMessageDelay = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mControlSwitch["playerviewswitch"]) {
|
||||
|
||||
// work around preview mode toggle when pressing Alt+Tab
|
||||
|
|
|
@ -145,6 +145,8 @@ namespace MWInput
|
|||
bool mMouseLookEnabled;
|
||||
bool mGuiCursorEnabled;
|
||||
|
||||
float mOverencumberedMessageDelay;
|
||||
|
||||
float mMouseX;
|
||||
float mMouseY;
|
||||
int mMouseWheel;
|
||||
|
|
|
@ -491,8 +491,10 @@ namespace MWMechanics
|
|||
if(buying) x = buyTerm;
|
||||
else x = std::min(buyTerm, sellTerm);
|
||||
int offerPrice;
|
||||
if (x < 1) offerPrice = int(x * basePrice);
|
||||
if (x >= 1) offerPrice = basePrice + int((x - 1) * basePrice);
|
||||
if (x < 1)
|
||||
offerPrice = int(x * basePrice);
|
||||
else
|
||||
offerPrice = basePrice + int((x - 1) * basePrice);
|
||||
offerPrice = std::max(1, offerPrice);
|
||||
return offerPrice;
|
||||
}
|
||||
|
@ -555,7 +557,8 @@ namespace MWMechanics
|
|||
float fPerDieRollMult = gmst.find("fPerDieRollMult")->getFloat();
|
||||
float fPerTempMult = gmst.find("fPerTempMult")->getFloat();
|
||||
|
||||
float x,y;
|
||||
float x = 0;
|
||||
float y = 0;
|
||||
|
||||
float roll = static_cast<float> (std::rand()) / RAND_MAX * 100;
|
||||
|
||||
|
|
Loading…
Reference in a new issue