Merge remote-tracking branch 'zini/master' into misc-cleanup

actorid
Chris Robinson 12 years ago
commit 000128d084

@ -198,7 +198,7 @@ namespace MWBase
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0; virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
///< Hides dialog and schedules dialog to be deleted. ///< 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 void enterPressed () = 0;
virtual int readPressedButton() = 0; virtual int readPressedButton() = 0;
///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox) ///< 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 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 void enterPressed ();
virtual int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox) 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 "../engine.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwworld/class.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
@ -51,6 +52,7 @@ namespace MWInput
, mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input")) , mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
, mPreviewPOVDelay(0.f) , mPreviewPOVDelay(0.f)
, mTimeIdle(0.f) , mTimeIdle(0.f)
, mOverencumberedMessageDelay(0.f)
{ {
Ogre::RenderWindow* window = ogre.getWindow (); Ogre::RenderWindow* window = ogre.getWindow ();
size_t windowHnd; size_t windowHnd;
@ -268,13 +270,16 @@ namespace MWInput
// be done in the physics system. // be done in the physics system.
if (mControlSwitch["playercontrols"]) if (mControlSwitch["playercontrols"])
{ {
bool triedToMove = false;
if (actionIsActive(A_MoveLeft)) if (actionIsActive(A_MoveLeft))
{ {
triedToMove = true;
mPlayer.setAutoMove (false); mPlayer.setAutoMove (false);
mPlayer.setLeftRight (-1); mPlayer.setLeftRight (-1);
} }
else if (actionIsActive(A_MoveRight)) else if (actionIsActive(A_MoveRight))
{ {
triedToMove = true;
mPlayer.setAutoMove (false); mPlayer.setAutoMove (false);
mPlayer.setLeftRight (1); mPlayer.setLeftRight (1);
} }
@ -283,11 +288,13 @@ namespace MWInput
if (actionIsActive(A_MoveForward)) if (actionIsActive(A_MoveForward))
{ {
triedToMove = true;
mPlayer.setAutoMove (false); mPlayer.setAutoMove (false);
mPlayer.setForwardBackward (1); mPlayer.setForwardBackward (1);
} }
else if (actionIsActive(A_MoveBackward)) else if (actionIsActive(A_MoveBackward))
{ {
triedToMove = true;
mPlayer.setAutoMove (false); mPlayer.setAutoMove (false);
mPlayer.setForwardBackward (-1); mPlayer.setForwardBackward (-1);
} }
@ -295,7 +302,10 @@ namespace MWInput
mPlayer.setForwardBackward (0); mPlayer.setForwardBackward (0);
if (actionIsActive(A_Jump) && mControlSwitch["playerjumping"]) if (actionIsActive(A_Jump) && mControlSwitch["playerjumping"])
{
mPlayer.setUpDown (1); mPlayer.setUpDown (1);
triedToMove = true;
}
else if (actionIsActive(A_Crouch)) else if (actionIsActive(A_Crouch))
mPlayer.setUpDown (-1); mPlayer.setUpDown (-1);
else else
@ -306,6 +316,21 @@ namespace MWInput
else else
mPlayer.setRunState(false); 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"]) { if (mControlSwitch["playerviewswitch"]) {
// work around preview mode toggle when pressing Alt+Tab // work around preview mode toggle when pressing Alt+Tab

@ -145,6 +145,8 @@ namespace MWInput
bool mMouseLookEnabled; bool mMouseLookEnabled;
bool mGuiCursorEnabled; bool mGuiCursorEnabled;
float mOverencumberedMessageDelay;
float mMouseX; float mMouseX;
float mMouseY; float mMouseY;
int mMouseWheel; int mMouseWheel;

@ -491,8 +491,10 @@ namespace MWMechanics
if(buying) x = buyTerm; if(buying) x = buyTerm;
else x = std::min(buyTerm, sellTerm); else x = std::min(buyTerm, sellTerm);
int offerPrice; int offerPrice;
if (x < 1) offerPrice = int(x * basePrice); if (x < 1)
if (x >= 1) offerPrice = basePrice + int((x - 1) * basePrice); offerPrice = int(x * basePrice);
else
offerPrice = basePrice + int((x - 1) * basePrice);
offerPrice = std::max(1, offerPrice); offerPrice = std::max(1, offerPrice);
return offerPrice; return offerPrice;
} }
@ -555,7 +557,8 @@ namespace MWMechanics
float fPerDieRollMult = gmst.find("fPerDieRollMult")->getFloat(); float fPerDieRollMult = gmst.find("fPerDieRollMult")->getFloat();
float fPerTempMult = gmst.find("fPerTempMult")->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; float roll = static_cast<float> (std::rand()) / RAND_MAX * 100;

Loading…
Cancel
Save