mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 16:06:43 +00:00
Merge branch 'master' into graphics
This commit is contained in:
commit
b1fc68d44d
9 changed files with 42 additions and 13 deletions
|
@ -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)
|
||||||
|
|
|
@ -288,7 +288,7 @@ namespace MWBase
|
||||||
|
|
||||||
virtual bool isFlying(const MWWorld::Ptr &ptr) const = 0;
|
virtual bool isFlying(const MWWorld::Ptr &ptr) const = 0;
|
||||||
virtual bool isSwimming(const MWWorld::Ptr &object) 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 bool isOnGround(const MWWorld::Ptr &ptr) const = 0;
|
||||||
|
|
||||||
virtual void togglePOV() = 0;
|
virtual void togglePOV() = 0;
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -53,6 +54,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 = mOgre.getWindow ();
|
Ogre::RenderWindow* window = mOgre.getWindow ();
|
||||||
size_t windowHnd;
|
size_t windowHnd;
|
||||||
|
@ -270,13 +272,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);
|
||||||
}
|
}
|
||||||
|
@ -285,11 +290,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);
|
||||||
}
|
}
|
||||||
|
@ -297,7 +304,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
|
||||||
|
@ -308,6 +318,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,7 @@ 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,y = 0;
|
||||||
|
|
||||||
float roll = static_cast<float> (std::rand()) / RAND_MAX * 100;
|
float roll = static_cast<float> (std::rand()) / RAND_MAX * 100;
|
||||||
|
|
||||||
|
|
|
@ -389,7 +389,7 @@ void RenderingManager::update (float duration, bool paused)
|
||||||
|
|
||||||
mWater->updateUnderwater(
|
mWater->updateUnderwater(
|
||||||
world->isUnderwater(
|
world->isUnderwater(
|
||||||
*world->getPlayer().getPlayer().getCell()->mCell,
|
world->getPlayer().getPlayer().getCell(),
|
||||||
Ogre::Vector3(cam.x, -cam.z, cam.y))
|
Ogre::Vector3(cam.x, -cam.z, cam.y))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1411,16 +1411,16 @@ namespace MWWorld
|
||||||
const OEngine::Physic::PhysicActor *actor = mPhysEngine->getCharacter(object.getRefData().getHandle());
|
const OEngine::Physic::PhysicActor *actor = mPhysEngine->getCharacter(object.getRefData().getHandle());
|
||||||
if(actor) pos.z += actor->getHalfExtents().z * 1.5;
|
if(actor) pos.z += actor->getHalfExtents().z * 1.5;
|
||||||
|
|
||||||
return isUnderwater(*object.getCell()->mCell, pos);
|
return isUnderwater(object.getCell(), pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
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 false;
|
||||||
}
|
}
|
||||||
return pos.z < cell.mWater;
|
return pos.z < cell->mWaterLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool World::isOnGround(const MWWorld::Ptr &ptr) const
|
bool World::isOnGround(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -1448,7 +1448,7 @@ namespace MWWorld
|
||||||
Ogre::Vector3 playerPos(refdata.getPosition().pos);
|
Ogre::Vector3 playerPos(refdata.getPosition().pos);
|
||||||
|
|
||||||
const OEngine::Physic::PhysicActor *physactor = mPhysEngine->getCharacter(refdata.getHandle());
|
const OEngine::Physic::PhysicActor *physactor = mPhysEngine->getCharacter(refdata.getHandle());
|
||||||
if(!physactor->getOnGround() || isUnderwater(*currentCell->mCell, playerPos))
|
if(!physactor->getOnGround() || isUnderwater(currentCell, playerPos))
|
||||||
return 2;
|
return 2;
|
||||||
if((currentCell->mCell->mData.mFlags&ESM::Cell::NoSleep))
|
if((currentCell->mCell->mData.mFlags&ESM::Cell::NoSleep))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -316,7 +316,7 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual bool isFlying(const MWWorld::Ptr &ptr) const;
|
virtual bool isFlying(const MWWorld::Ptr &ptr) const;
|
||||||
virtual bool isSwimming(const MWWorld::Ptr &object) 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 bool isOnGround(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
||||||
virtual void togglePOV() {
|
virtual void togglePOV() {
|
||||||
|
|
Loading…
Reference in a new issue