mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +00:00
Merge remote-tracking branch 'rainChu/master'
This commit is contained in:
commit
608d154ad7
7 changed files with 43 additions and 4 deletions
|
@ -61,7 +61,7 @@ void CSVDoc::AdjusterWidget::setName (const QString& name, bool addon)
|
||||||
if (path.parent_path().string()==mLocalData.string())
|
if (path.parent_path().string()==mLocalData.string())
|
||||||
{
|
{
|
||||||
// path already points to the local data directory
|
// 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;
|
mResultPath = path;
|
||||||
mValid = true;
|
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 points somewhere else or is a leaf name.
|
||||||
path = mLocalData / path.filename();
|
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;
|
mResultPath = path;
|
||||||
mValid = true;
|
mValid = true;
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,12 @@ namespace MWRender
|
||||||
rotateCamera(Ogre::Vector3(getPitch(), 0.f, getYaw()), false);
|
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()
|
float Camera::getYaw()
|
||||||
{
|
{
|
||||||
if(mVanity.enabled || mPreviewMode)
|
if(mVanity.enabled || mPreviewMode)
|
||||||
|
|
|
@ -79,6 +79,12 @@ namespace MWRender
|
||||||
|
|
||||||
void togglePreviewMode(bool enable);
|
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
|
bool isFirstPerson() const
|
||||||
{ return !(mVanity.enabled || mPreviewMode || !mFirstPersonView); }
|
{ return !(mVanity.enabled || mPreviewMode || !mFirstPersonView); }
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,8 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
|
||||||
mWeapon(inv.end()),
|
mWeapon(inv.end()),
|
||||||
mShield(inv.end()),
|
mShield(inv.end()),
|
||||||
mViewMode(viewMode),
|
mViewMode(viewMode),
|
||||||
mShowWeapons(false)
|
mShowWeapons(false),
|
||||||
|
mFirstPersonOffset(0.f, 0.f, 0.f)
|
||||||
{
|
{
|
||||||
mNpc = mPtr.get<ESM::NPC>()->mBase;
|
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 {
|
class SetObjectGroup {
|
||||||
int mGroup;
|
int mGroup;
|
||||||
|
|
||||||
|
@ -448,7 +454,12 @@ Ogre::Vector3 NpcAnimation::runAnimation(float timepassed)
|
||||||
float pitch = mCamera->getPitch();
|
float pitch = mCamera->getPitch();
|
||||||
Ogre::Node *node = baseinst->getBone("Bip01 Neck");
|
Ogre::Node *node = baseinst->getBone("Bip01 Neck");
|
||||||
node->pitch(Ogre::Radian(pitch*0.75f), Ogre::Node::TS_WORLD);
|
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++)
|
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 mPartslots[ESM::PRT_Count]; //Each part slot is taken by clothing, armor, or is empty
|
||||||
int mPartPriorities[ESM::PRT_Count];
|
int mPartPriorities[ESM::PRT_Count];
|
||||||
|
|
||||||
|
Ogre::Vector3 mFirstPersonOffset;
|
||||||
|
|
||||||
void updateNpcBase();
|
void updateNpcBase();
|
||||||
|
|
||||||
NifOgre::ObjectList insertBoundedPart(const std::string &model, int group, const std::string &bonename);
|
NifOgre::ObjectList insertBoundedPart(const std::string &model, int group, const std::string &bonename);
|
||||||
|
@ -89,6 +91,11 @@ public:
|
||||||
|
|
||||||
void updateParts(bool forceupdate = false);
|
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.
|
/// Rebuilds the NPC, updating their root model, animation sources, and equipment.
|
||||||
void rebuild();
|
void rebuild();
|
||||||
};
|
};
|
||||||
|
|
|
@ -354,6 +354,15 @@ void RenderingManager::update (float duration, bool paused)
|
||||||
mCamera->setCameraDistance(test.second * orig.distance(dest), false, false);
|
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);
|
mOcclusionQuery->update(duration);
|
||||||
|
|
||||||
mVideoPlayer->update ();
|
mVideoPlayer->update ();
|
||||||
|
|
|
@ -225,8 +225,8 @@ namespace MWWorld
|
||||||
if (mEsm[0].getFormat() == 0)
|
if (mEsm[0].getFormat() == 0)
|
||||||
ensureNeededRecords();
|
ensureNeededRecords();
|
||||||
|
|
||||||
mStore.movePlayerRecord();
|
|
||||||
mStore.setUp();
|
mStore.setUp();
|
||||||
|
mStore.movePlayerRecord();
|
||||||
|
|
||||||
mGlobalVariables = new Globals (mStore);
|
mGlobalVariables = new Globals (mStore);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue