1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-13 12:40:04 +00:00

Merge branch 'master' into graphics

This commit is contained in:
scrawl 2013-02-25 17:36:33 +01:00
commit b1fc68d44d
9 changed files with 42 additions and 13 deletions

View File

@ -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)

View File

@ -288,7 +288,7 @@ namespace MWBase
virtual bool isFlying(const MWWorld::Ptr &ptr) const = 0;
virtual bool isSwimming(const MWWorld::Ptr &object) const = 0;
virtual bool isUnderwater(const ESM::Cell &cell, const Ogre::Vector3 &pos) const = 0;
virtual bool isUnderwater(const MWWorld::Ptr::CellStore* cell, const Ogre::Vector3 &pos) const = 0;
virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0;
virtual void togglePOV() = 0;

View File

@ -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)

View File

@ -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"
@ -53,6 +54,7 @@ namespace MWInput
, mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
, mPreviewPOVDelay(0.f)
, mTimeIdle(0.f)
, mOverencumberedMessageDelay(0.f)
{
Ogre::RenderWindow* window = mOgre.getWindow ();
size_t windowHnd;
@ -270,13 +272,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);
}
@ -285,11 +290,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);
}
@ -297,7 +304,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
@ -308,6 +318,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

View File

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

View File

@ -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,7 @@ namespace MWMechanics
float fPerDieRollMult = gmst.find("fPerDieRollMult")->getFloat();
float fPerTempMult = gmst.find("fPerTempMult")->getFloat();
float x,y;
float x,y = 0;
float roll = static_cast<float> (std::rand()) / RAND_MAX * 100;

View File

@ -389,7 +389,7 @@ void RenderingManager::update (float duration, bool paused)
mWater->updateUnderwater(
world->isUnderwater(
*world->getPlayer().getPlayer().getCell()->mCell,
world->getPlayer().getPlayer().getCell(),
Ogre::Vector3(cam.x, -cam.z, cam.y))
);

View File

@ -1411,16 +1411,16 @@ namespace MWWorld
const OEngine::Physic::PhysicActor *actor = mPhysEngine->getCharacter(object.getRefData().getHandle());
if(actor) pos.z += actor->getHalfExtents().z * 1.5;
return isUnderwater(*object.getCell()->mCell, pos);
return isUnderwater(object.getCell(), pos);
}
bool
World::isUnderwater(const ESM::Cell &cell, const Ogre::Vector3 &pos) const
World::isUnderwater(const MWWorld::Ptr::CellStore* cell, const Ogre::Vector3 &pos) const
{
if (!(cell.mData.mFlags & ESM::Cell::HasWater)) {
if (!(cell->mCell->mData.mFlags & ESM::Cell::HasWater)) {
return false;
}
return pos.z < cell.mWater;
return pos.z < cell->mWaterLevel;
}
bool World::isOnGround(const MWWorld::Ptr &ptr) const
@ -1448,7 +1448,7 @@ namespace MWWorld
Ogre::Vector3 playerPos(refdata.getPosition().pos);
const OEngine::Physic::PhysicActor *physactor = mPhysEngine->getCharacter(refdata.getHandle());
if(!physactor->getOnGround() || isUnderwater(*currentCell->mCell, playerPos))
if(!physactor->getOnGround() || isUnderwater(currentCell, playerPos))
return 2;
if((currentCell->mCell->mData.mFlags&ESM::Cell::NoSleep))
return 1;

View File

@ -316,7 +316,7 @@ namespace MWWorld
virtual bool isFlying(const MWWorld::Ptr &ptr) const;
virtual bool isSwimming(const MWWorld::Ptr &object) const;
virtual bool isUnderwater(const ESM::Cell &cell, const Ogre::Vector3 &pos) const;
virtual bool isUnderwater(const MWWorld::Ptr::CellStore* cell, const Ogre::Vector3 &pos) const;
virtual bool isOnGround(const MWWorld::Ptr &ptr) const;
virtual void togglePOV() {