mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
Merge remote-tracking branch 'rainChu/master'
This commit is contained in:
commit
608d154ad7
@ -61,7 +61,7 @@ void CSVDoc::AdjusterWidget::setName (const QString& name, bool addon)
|
||||
if (path.parent_path().string()==mLocalData.string())
|
||||
{
|
||||
// path already points to the local data directory
|
||||
message = QString::fromUtf8 (("Will be saved as: " + path.native()).c_str());
|
||||
message = QString::fromUtf8 (("Will be saved as: " + path.string()).c_str());
|
||||
mResultPath = path;
|
||||
mValid = true;
|
||||
}
|
||||
@ -70,7 +70,7 @@ void CSVDoc::AdjusterWidget::setName (const QString& name, bool addon)
|
||||
// path points somewhere else or is a leaf name.
|
||||
path = mLocalData / path.filename();
|
||||
|
||||
message = QString::fromUtf8 (("Will be saved as: " + path.native()).c_str());
|
||||
message = QString::fromUtf8 (("Will be saved as: " + path.string()).c_str());
|
||||
mResultPath = path;
|
||||
mValid = true;
|
||||
|
||||
|
@ -187,6 +187,12 @@ namespace MWRender
|
||||
rotateCamera(Ogre::Vector3(getPitch(), 0.f, getYaw()), false);
|
||||
}
|
||||
|
||||
void Camera::setSneakOffset()
|
||||
{
|
||||
if(mAnimation)
|
||||
mAnimation->addFirstPersonOffset(Ogre::Vector3(0.f, 0.f, -9.8f));
|
||||
}
|
||||
|
||||
float Camera::getYaw()
|
||||
{
|
||||
if(mVanity.enabled || mPreviewMode)
|
||||
|
@ -79,6 +79,12 @@ namespace MWRender
|
||||
|
||||
void togglePreviewMode(bool enable);
|
||||
|
||||
/// \brief Lowers the camera for sneak.
|
||||
/// As animation is tied to the camera, this needs
|
||||
/// to be set each frame after the animation is
|
||||
/// applied.
|
||||
void setSneakOffset();
|
||||
|
||||
bool isFirstPerson() const
|
||||
{ return !(mVanity.enabled || mPreviewMode || !mFirstPersonView); }
|
||||
|
||||
|
@ -84,7 +84,8 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
|
||||
mWeapon(inv.end()),
|
||||
mShield(inv.end()),
|
||||
mViewMode(viewMode),
|
||||
mShowWeapons(false)
|
||||
mShowWeapons(false),
|
||||
mFirstPersonOffset(0.f, 0.f, 0.f)
|
||||
{
|
||||
mNpc = mPtr.get<ESM::NPC>()->mBase;
|
||||
|
||||
@ -392,6 +393,11 @@ void NpcAnimation::updateParts(bool forceupdate)
|
||||
}
|
||||
}
|
||||
|
||||
void NpcAnimation::addFirstPersonOffset(const Ogre::Vector3 &offset)
|
||||
{
|
||||
mFirstPersonOffset += offset;
|
||||
}
|
||||
|
||||
class SetObjectGroup {
|
||||
int mGroup;
|
||||
|
||||
@ -448,7 +454,12 @@ Ogre::Vector3 NpcAnimation::runAnimation(float timepassed)
|
||||
float pitch = mCamera->getPitch();
|
||||
Ogre::Node *node = baseinst->getBone("Bip01 Neck");
|
||||
node->pitch(Ogre::Radian(pitch*0.75f), Ogre::Node::TS_WORLD);
|
||||
|
||||
// This has to be done before this function ends;
|
||||
// updateSkeletonInstance, below, touches the hands.
|
||||
node->translate(mFirstPersonOffset, Ogre::Node::TS_WORLD);
|
||||
}
|
||||
mFirstPersonOffset = 0.f; // reset the X, Y, Z offset for the next frame.
|
||||
|
||||
for(size_t i = 0;i < ESM::PRT_Count;i++)
|
||||
{
|
||||
|
@ -64,6 +64,8 @@ private:
|
||||
int mPartslots[ESM::PRT_Count]; //Each part slot is taken by clothing, armor, or is empty
|
||||
int mPartPriorities[ESM::PRT_Count];
|
||||
|
||||
Ogre::Vector3 mFirstPersonOffset;
|
||||
|
||||
void updateNpcBase();
|
||||
|
||||
NifOgre::ObjectList insertBoundedPart(const std::string &model, int group, const std::string &bonename);
|
||||
@ -89,6 +91,11 @@ public:
|
||||
|
||||
void updateParts(bool forceupdate = false);
|
||||
|
||||
/// \brief Applies a translation to the arms and hands.
|
||||
/// This may be called multiple times before the animation
|
||||
/// is updated to add additional offsets.
|
||||
void addFirstPersonOffset(const Ogre::Vector3 &offset);
|
||||
|
||||
/// Rebuilds the NPC, updating their root model, animation sources, and equipment.
|
||||
void rebuild();
|
||||
};
|
||||
|
@ -354,6 +354,15 @@ void RenderingManager::update (float duration, bool paused)
|
||||
mCamera->setCameraDistance(test.second * orig.distance(dest), false, false);
|
||||
}
|
||||
|
||||
// Sink the camera while sneaking
|
||||
bool isSneaking = MWWorld::Class::get(player).getStance(player, MWWorld::Class::Sneak);
|
||||
bool isInAir = !world->isOnGround(player);
|
||||
bool isSwimming = world->isSwimming(player);
|
||||
|
||||
if(isSneaking && !(isSwimming || isInAir))
|
||||
mCamera->setSneakOffset();
|
||||
|
||||
|
||||
mOcclusionQuery->update(duration);
|
||||
|
||||
mVideoPlayer->update ();
|
||||
|
@ -225,8 +225,8 @@ namespace MWWorld
|
||||
if (mEsm[0].getFormat() == 0)
|
||||
ensureNeededRecords();
|
||||
|
||||
mStore.movePlayerRecord();
|
||||
mStore.setUp();
|
||||
mStore.movePlayerRecord();
|
||||
|
||||
mGlobalVariables = new Globals (mStore);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user