mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:53:52 +00:00
Merge pull request #2303 from Capostrophic/levitation
Fix certain levitation state inconsistencies (bug #4948)
This commit is contained in:
commit
4f6658bcb5
7 changed files with 36 additions and 6 deletions
|
@ -52,6 +52,7 @@
|
|||
Bug #4922: Werewolves can not attack if the transformation happens during attack
|
||||
Bug #4938: Strings from subrecords with actually empty headers can't be empty
|
||||
Bug #4942: Hand-to-Hand attack type is chosen randomly when "always use best attack" is turned off
|
||||
Bug #4948: Footstep sounds while levitating on ground level
|
||||
Feature #2229: Improve pathfinding AI
|
||||
Feature #3442: Default values for fallbacks from ini file
|
||||
Feature #3610: Option to invert X axis
|
||||
|
|
|
@ -459,8 +459,9 @@ namespace MWBase
|
|||
{
|
||||
Rest_Allowed = 0,
|
||||
Rest_OnlyWaiting = 1,
|
||||
Rest_PlayerIsUnderwater = 2,
|
||||
Rest_EnemiesAreNearby = 3
|
||||
Rest_PlayerIsInAir = 2,
|
||||
Rest_PlayerIsUnderwater = 3,
|
||||
Rest_EnemiesAreNearby = 4
|
||||
};
|
||||
|
||||
/// check if the player is allowed to rest
|
||||
|
|
|
@ -706,6 +706,8 @@ namespace MWClass
|
|||
if(name == "left")
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
if(world->isFlying(ptr))
|
||||
return -1;
|
||||
osg::Vec3f pos(ptr.getRefData().getPosition().asVec3());
|
||||
if(world->isUnderwater(ptr.getCell(), pos) || world->isWalkingOnWater(ptr))
|
||||
return ESM::SoundGenerator::SwimLeft;
|
||||
|
@ -716,6 +718,8 @@ namespace MWClass
|
|||
if(name == "right")
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
if(world->isFlying(ptr))
|
||||
return -1;
|
||||
osg::Vec3f pos(ptr.getRefData().getPosition().asVec3());
|
||||
if(world->isUnderwater(ptr.getCell(), pos) || world->isWalkingOnWater(ptr))
|
||||
return ESM::SoundGenerator::SwimRight;
|
||||
|
|
|
@ -1214,6 +1214,8 @@ namespace MWClass
|
|||
if(name == "left" || name == "right")
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
if(world->isFlying(ptr))
|
||||
return std::string();
|
||||
osg::Vec3f pos(ptr.getRefData().getPosition().asVec3());
|
||||
if(world->isSwimming(ptr))
|
||||
return (name == "left") ? "Swim Left" : "Swim Right";
|
||||
|
|
|
@ -80,10 +80,17 @@ namespace MWGui
|
|||
mTimeAdvancer.eventInterrupted += MyGUI::newDelegate(this, &WaitDialog::onWaitingInterrupted);
|
||||
mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &WaitDialog::onWaitingFinished);
|
||||
}
|
||||
|
||||
void WaitDialog::onReferenceUnavailable ()
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Rest);
|
||||
resetReference();
|
||||
}
|
||||
|
||||
void WaitDialog::setPtr(const MWWorld::Ptr &ptr)
|
||||
{
|
||||
setCanRest(!ptr.isEmpty() || MWBase::Environment::get().getWorld ()->canRest () == MWBase::World::Rest_Allowed);
|
||||
mPtr = ptr;
|
||||
setCanRest(!mPtr.isEmpty() || MWBase::Environment::get().getWorld ()->canRest () == MWBase::World::Rest_Allowed);
|
||||
|
||||
if (mUntilHealedButton->getVisible())
|
||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mUntilHealedButton);
|
||||
|
@ -100,6 +107,7 @@ namespace MWGui
|
|||
{
|
||||
mSleeping = false;
|
||||
mTimeAdvancer.stop();
|
||||
resetReference();
|
||||
}
|
||||
|
||||
void WaitDialog::onOpen()
|
||||
|
@ -129,7 +137,13 @@ namespace MWGui
|
|||
}
|
||||
else if (canRest == MWBase::World::Rest_PlayerIsUnderwater)
|
||||
{
|
||||
// resting underwater or mid-air not allowed
|
||||
// resting underwater not allowed
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage1}");
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode ();
|
||||
}
|
||||
else if (mPtr.isEmpty() && canRest == MWBase::World::Rest_PlayerIsInAir)
|
||||
{
|
||||
// Resting in air is not allowed either, unless you're using a bed
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage1}");
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode ();
|
||||
}
|
||||
|
@ -289,6 +303,8 @@ namespace MWGui
|
|||
|
||||
void WaitDialog::onFrame(float dt)
|
||||
{
|
||||
checkReferenceAvailable();
|
||||
|
||||
mTimeAdvancer.onFrame(dt);
|
||||
|
||||
if (mFadeTimeRemaining <= 0)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "timeadvancer.hpp"
|
||||
|
||||
#include "windowbase.hpp"
|
||||
#include "referenceinterface.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
@ -22,7 +23,7 @@ namespace MWGui
|
|||
MyGUI::TextBox* mProgressText;
|
||||
};
|
||||
|
||||
class WaitDialog : public WindowBase
|
||||
class WaitDialog : public WindowBase, public ReferenceInterface
|
||||
{
|
||||
public:
|
||||
WaitDialog();
|
||||
|
@ -63,6 +64,8 @@ namespace MWGui
|
|||
|
||||
WaitDialogProgressBar mProgressBar;
|
||||
|
||||
virtual void onReferenceUnavailable();
|
||||
|
||||
void onUntilHealedButtonClicked(MyGUI::Widget* sender);
|
||||
void onWaitButtonClicked(MyGUI::Widget* sender);
|
||||
void onCancelButtonClicked(MyGUI::Widget* sender);
|
||||
|
|
|
@ -2477,9 +2477,12 @@ namespace MWWorld
|
|||
if(mPlayer->enemiesNearby())
|
||||
return Rest_EnemiesAreNearby;
|
||||
|
||||
if ((actor->getCollisionMode() && !mPhysics->isOnSolidGround(player)) || isUnderwater(currentCell, playerPos) || isWalkingOnWater(player))
|
||||
if (isUnderwater(currentCell, playerPos) || isWalkingOnWater(player))
|
||||
return Rest_PlayerIsUnderwater;
|
||||
|
||||
if ((actor->getCollisionMode() && !mPhysics->isOnSolidGround(player)) || isFlying(player))
|
||||
return Rest_PlayerIsInAir;
|
||||
|
||||
if((currentCell->getCell()->mData.mFlags&ESM::Cell::NoSleep) || player.getClass().getNpcStats(player).isWerewolf())
|
||||
return Rest_OnlyWaiting;
|
||||
|
||||
|
|
Loading…
Reference in a new issue