mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 14:36:39 +00:00
Merged pull request #1921
This commit is contained in:
commit
c6b62308cd
9 changed files with 41 additions and 15 deletions
|
@ -122,6 +122,7 @@
|
||||||
Bug #4622: Recharging enchanted items with Soul Gems does not award experience if it fails
|
Bug #4622: Recharging enchanted items with Soul Gems does not award experience if it fails
|
||||||
Bug #4628: NPC record reputation, disposition and faction rank should have unsigned char type
|
Bug #4628: NPC record reputation, disposition and faction rank should have unsigned char type
|
||||||
Bug #4633: Sneaking stance affects speed even if the actor is not able to crouch
|
Bug #4633: Sneaking stance affects speed even if the actor is not able to crouch
|
||||||
|
Bug #4641: GetPCJumping is handled incorrectly
|
||||||
Bug #4644: %Name should be available for all actors, not just for NPCs
|
Bug #4644: %Name should be available for all actors, not just for NPCs
|
||||||
Feature #912: Editor: Add missing icons to UniversalId tables
|
Feature #912: Editor: Add missing icons to UniversalId tables
|
||||||
Feature #1645: Casting effects from objects
|
Feature #1645: Casting effects from objects
|
||||||
|
|
|
@ -1850,7 +1850,8 @@ void CharacterController::update(float duration)
|
||||||
if (isKnockedOut())
|
if (isKnockedOut())
|
||||||
mTimeUntilWake -= duration;
|
mTimeUntilWake -= duration;
|
||||||
|
|
||||||
bool godmode = mPtr == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
|
bool isPlayer = mPtr == MWMechanics::getPlayer();
|
||||||
|
bool godmode = isPlayer && MWBase::Environment::get().getWorld()->getGodModeState();
|
||||||
|
|
||||||
if(!cls.isActor())
|
if(!cls.isActor())
|
||||||
updateAnimQueue();
|
updateAnimQueue();
|
||||||
|
@ -1915,7 +1916,7 @@ void CharacterController::update(float duration)
|
||||||
isrunning = isrunning && mHasMovedInXY;
|
isrunning = isrunning && mHasMovedInXY;
|
||||||
|
|
||||||
// advance athletics
|
// advance athletics
|
||||||
if(mHasMovedInXY && mPtr == getPlayer())
|
if(mHasMovedInXY && isPlayer)
|
||||||
{
|
{
|
||||||
if(inwater)
|
if(inwater)
|
||||||
{
|
{
|
||||||
|
@ -2011,8 +2012,12 @@ void CharacterController::update(float duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
// advance acrobatics
|
// advance acrobatics
|
||||||
if (mPtr == getPlayer())
|
// also set jumping flag to allow GetPCJumping works
|
||||||
|
if (isPlayer)
|
||||||
|
{
|
||||||
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 0);
|
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 0);
|
||||||
|
MWBase::Environment::get().getWorld()->getPlayer().setJumping(true);
|
||||||
|
}
|
||||||
|
|
||||||
// decrease fatigue
|
// decrease fatigue
|
||||||
const float fatigueJumpBase = gmst.find("fFatigueJumpBase")->mValue.getFloat();
|
const float fatigueJumpBase = gmst.find("fFatigueJumpBase")->mValue.getFloat();
|
||||||
|
@ -2035,7 +2040,7 @@ void CharacterController::update(float duration)
|
||||||
jumpstate = JumpState_Landing;
|
jumpstate = JumpState_Landing;
|
||||||
vec.z() = 0.0f;
|
vec.z() = 0.0f;
|
||||||
|
|
||||||
float height = cls.getCreatureStats(mPtr).land();
|
float height = cls.getCreatureStats(mPtr).land(isPlayer);
|
||||||
float healthLost = getFallDamage(mPtr, height);
|
float healthLost = getFallDamage(mPtr, height);
|
||||||
|
|
||||||
if (healthLost > 0.0f)
|
if (healthLost > 0.0f)
|
||||||
|
@ -2058,7 +2063,7 @@ void CharacterController::update(float duration)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// report acrobatics progression
|
// report acrobatics progression
|
||||||
if (mPtr == getPlayer())
|
if (isPlayer)
|
||||||
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 1);
|
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2080,7 +2085,7 @@ void CharacterController::update(float duration)
|
||||||
// Do not play turning animation for player if rotation speed is very slow.
|
// Do not play turning animation for player if rotation speed is very slow.
|
||||||
// Actual threshold should take framerate in account.
|
// Actual threshold should take framerate in account.
|
||||||
float rotationThreshold = 0;
|
float rotationThreshold = 0;
|
||||||
if (mPtr == getPlayer())
|
if (isPlayer)
|
||||||
rotationThreshold = 0.015 * 60 * duration;
|
rotationThreshold = 0.015 * 60 * duration;
|
||||||
|
|
||||||
if(std::abs(vec.x()/2.0f) > std::abs(vec.y()))
|
if(std::abs(vec.x()/2.0f) > std::abs(vec.y()))
|
||||||
|
@ -2109,7 +2114,7 @@ void CharacterController::update(float duration)
|
||||||
{
|
{
|
||||||
// It seems only bipedal actors use turning animations.
|
// It seems only bipedal actors use turning animations.
|
||||||
// Also do not use turning animations in the first-person view and when sneaking.
|
// Also do not use turning animations in the first-person view and when sneaking.
|
||||||
bool isFirstPlayer = mPtr == getPlayer() && MWBase::Environment::get().getWorld()->isFirstPerson();
|
bool isFirstPlayer = isPlayer && MWBase::Environment::get().getWorld()->isFirstPerson();
|
||||||
if (!sneak && !isFirstPlayer && mPtr.getClass().isBipedal(mPtr))
|
if (!sneak && !isFirstPlayer && mPtr.getClass().isBipedal(mPtr))
|
||||||
{
|
{
|
||||||
if(rot.z() > rotationThreshold)
|
if(rot.z() > rotationThreshold)
|
||||||
|
@ -2121,7 +2126,7 @@ void CharacterController::update(float duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player can not use smooth turning as NPCs, so we play turning animation a bit to avoid jittering
|
// Player can not use smooth turning as NPCs, so we play turning animation a bit to avoid jittering
|
||||||
if (mPtr == getPlayer())
|
if (isPlayer)
|
||||||
{
|
{
|
||||||
float threshold = mCurrentMovement.find("swim") == std::string::npos ? 0.4f : 0.8f;
|
float threshold = mCurrentMovement.find("swim") == std::string::npos ? 0.4f : 0.8f;
|
||||||
float complete;
|
float complete;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <components/esm/esmwriter.hpp>
|
#include <components/esm/esmwriter.hpp>
|
||||||
|
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
@ -387,8 +388,11 @@ namespace MWMechanics
|
||||||
mFallHeight += height;
|
mFallHeight += height;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CreatureStats::land()
|
float CreatureStats::land(bool isPlayer)
|
||||||
{
|
{
|
||||||
|
if (isPlayer)
|
||||||
|
MWBase::Environment::get().getWorld()->getPlayer().setJumping(false);
|
||||||
|
|
||||||
float height = mFallHeight;
|
float height = mFallHeight;
|
||||||
mFallHeight = 0;
|
mFallHeight = 0;
|
||||||
return height;
|
return height;
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
/// Reset the fall height
|
/// Reset the fall height
|
||||||
/// @return total fall height
|
/// @return total fall height
|
||||||
float land();
|
float land(bool isPlayer=false);
|
||||||
|
|
||||||
const AttributeValue & getAttribute(int index) const;
|
const AttributeValue & getAttribute(int index) const;
|
||||||
|
|
||||||
|
|
|
@ -1394,6 +1394,7 @@ namespace MWPhysics
|
||||||
mStandingCollisions.clear();
|
mStandingCollisions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
PtrVelocityList::iterator iter = mMovementQueue.begin();
|
PtrVelocityList::iterator iter = mMovementQueue.begin();
|
||||||
for(;iter != mMovementQueue.end();++iter)
|
for(;iter != mMovementQueue.end();++iter)
|
||||||
|
@ -1451,7 +1452,7 @@ namespace MWPhysics
|
||||||
|
|
||||||
MWMechanics::CreatureStats& stats = iter->first.getClass().getCreatureStats(iter->first);
|
MWMechanics::CreatureStats& stats = iter->first.getClass().getCreatureStats(iter->first);
|
||||||
if ((wasOnGround && physicActor->getOnGround()) || flying || world->isSwimming(iter->first) || slowFall < 1)
|
if ((wasOnGround && physicActor->getOnGround()) || flying || world->isSwimming(iter->first) || slowFall < 1)
|
||||||
stats.land();
|
stats.land(iter->first == player);
|
||||||
else if (heightDiff < 0)
|
else if (heightDiff < 0)
|
||||||
stats.addToFallHeight(-heightDiff);
|
stats.addToFallHeight(-heightDiff);
|
||||||
|
|
||||||
|
|
|
@ -107,8 +107,7 @@ namespace MWScript
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
MWWorld::Ptr player = world->getPlayerPtr();
|
runtime.push (world->getPlayer().getJumping());
|
||||||
runtime.push (!world->isOnGround(player) && !world->isFlying(player));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace MWWorld
|
||||||
void ActionTeleport::teleport(const Ptr &actor)
|
void ActionTeleport::teleport(const Ptr &actor)
|
||||||
{
|
{
|
||||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
actor.getClass().getCreatureStats(actor).land();
|
actor.getClass().getCreatureStats(actor).land(actor == world->getPlayerPtr());
|
||||||
if(actor == world->getPlayerPtr())
|
if(actor == world->getPlayerPtr())
|
||||||
{
|
{
|
||||||
world->getPlayer().setTeleported(true);
|
world->getPlayer().setTeleported(true);
|
||||||
|
|
|
@ -36,7 +36,8 @@ namespace MWWorld
|
||||||
mTeleported(false),
|
mTeleported(false),
|
||||||
mCurrentCrimeId(-1),
|
mCurrentCrimeId(-1),
|
||||||
mPaidCrimeId(-1),
|
mPaidCrimeId(-1),
|
||||||
mAttackingOrSpell(false)
|
mAttackingOrSpell(false),
|
||||||
|
mJumping(false)
|
||||||
{
|
{
|
||||||
ESM::CellRef cellRef;
|
ESM::CellRef cellRef;
|
||||||
cellRef.blank();
|
cellRef.blank();
|
||||||
|
@ -255,6 +256,16 @@ namespace MWWorld
|
||||||
return mAttackingOrSpell;
|
return mAttackingOrSpell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::setJumping(bool jumping)
|
||||||
|
{
|
||||||
|
mJumping = jumping;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Player::getJumping() const
|
||||||
|
{
|
||||||
|
return mJumping;
|
||||||
|
}
|
||||||
|
|
||||||
bool Player::isInCombat() {
|
bool Player::isInCombat() {
|
||||||
return MWBase::Environment::get().getMechanicsManager()->getActorsFighting(getPlayer()).size() != 0;
|
return MWBase::Environment::get().getMechanicsManager()->getActorsFighting(getPlayer()).size() != 0;
|
||||||
}
|
}
|
||||||
|
@ -286,6 +297,7 @@ namespace MWWorld
|
||||||
mForwardBackward = 0;
|
mForwardBackward = 0;
|
||||||
mTeleported = false;
|
mTeleported = false;
|
||||||
mAttackingOrSpell = false;
|
mAttackingOrSpell = false;
|
||||||
|
mJumping = false;
|
||||||
mCurrentCrimeId = -1;
|
mCurrentCrimeId = -1;
|
||||||
mPaidCrimeId = -1;
|
mPaidCrimeId = -1;
|
||||||
mPreviousItems.clear();
|
mPreviousItems.clear();
|
||||||
|
|
|
@ -56,6 +56,7 @@ namespace MWWorld
|
||||||
MWMechanics::AttributeValue mSaveAttributes[ESM::Attribute::Length];
|
MWMechanics::AttributeValue mSaveAttributes[ESM::Attribute::Length];
|
||||||
|
|
||||||
bool mAttackingOrSpell;
|
bool mAttackingOrSpell;
|
||||||
|
bool mJumping;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -111,6 +112,9 @@ namespace MWWorld
|
||||||
void setAttackingOrSpell(bool attackingOrSpell);
|
void setAttackingOrSpell(bool attackingOrSpell);
|
||||||
bool getAttackingOrSpell() const;
|
bool getAttackingOrSpell() const;
|
||||||
|
|
||||||
|
void setJumping(bool jumping);
|
||||||
|
bool getJumping() const;
|
||||||
|
|
||||||
///Checks all nearby actors to see if anyone has an aipackage against you
|
///Checks all nearby actors to see if anyone has an aipackage against you
|
||||||
bool isInCombat();
|
bool isInCombat();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue