forked from teamnwah/openmw-tes3coop
Use i1stPersonSneakDelta + some cleanup
This commit is contained in:
parent
2744cde40f
commit
15e48107f7
4 changed files with 12 additions and 11 deletions
|
@ -19,12 +19,12 @@ namespace MWMechanics
|
||||||
inline int spellSchoolToSkill(int school)
|
inline int spellSchoolToSkill(int school)
|
||||||
{
|
{
|
||||||
std::map<int, int> schoolSkillMap; // maps spell school to skill id
|
std::map<int, int> schoolSkillMap; // maps spell school to skill id
|
||||||
schoolSkillMap[0] = 11; // alteration
|
schoolSkillMap[0] = ESM::Skill::Alteration;
|
||||||
schoolSkillMap[1] = 13; // conjuration
|
schoolSkillMap[1] = ESM::Skill::Conjuration;
|
||||||
schoolSkillMap[3] = 12; // illusion
|
schoolSkillMap[3] = ESM::Skill::Illusion;
|
||||||
schoolSkillMap[2] = 10; // destruction
|
schoolSkillMap[2] = ESM::Skill::Destruction;
|
||||||
schoolSkillMap[4] = 14; // mysticism
|
schoolSkillMap[4] = ESM::Skill::Mysticism;
|
||||||
schoolSkillMap[5] = 15; // restoration
|
schoolSkillMap[5] = ESM::Skill::Restoration;
|
||||||
assert(schoolSkillMap.find(school) != schoolSkillMap.end());
|
assert(schoolSkillMap.find(school) != schoolSkillMap.end());
|
||||||
return schoolSkillMap[school];
|
return schoolSkillMap[school];
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,11 +226,10 @@ namespace MWRender
|
||||||
mCamera->setPosition(0.f, 0.f, offset);
|
mCamera->setPosition(0.f, 0.f, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::setSneakOffset()
|
void Camera::setSneakOffset(float offset)
|
||||||
{
|
{
|
||||||
// TODO: iFirstPersonSneakDelta
|
|
||||||
if(mAnimation)
|
if(mAnimation)
|
||||||
mAnimation->addFirstPersonOffset(Ogre::Vector3(0.f, 0.f, -9.8f));
|
mAnimation->addFirstPersonOffset(Ogre::Vector3(0.f, 0.f, -offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
float Camera::getYaw()
|
float Camera::getYaw()
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace MWRender
|
||||||
/// As animation is tied to the camera, this needs
|
/// As animation is tied to the camera, this needs
|
||||||
/// to be set each frame after the animation is
|
/// to be set each frame after the animation is
|
||||||
/// applied.
|
/// applied.
|
||||||
void setSneakOffset();
|
void setSneakOffset(float offset);
|
||||||
|
|
||||||
bool isFirstPerson() const
|
bool isFirstPerson() const
|
||||||
{ return !(mVanity.enabled || mPreviewMode || !mFirstPersonView); }
|
{ return !(mVanity.enabled || mPreviewMode || !mFirstPersonView); }
|
||||||
|
|
|
@ -351,8 +351,10 @@ void RenderingManager::update (float duration, bool paused)
|
||||||
bool isInAir = !world->isOnGround(player);
|
bool isInAir = !world->isOnGround(player);
|
||||||
bool isSwimming = world->isSwimming(player);
|
bool isSwimming = world->isSwimming(player);
|
||||||
|
|
||||||
|
static const int i1stPersonSneakDelta = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
||||||
|
.find("i1stPersonSneakDelta")->getInt();
|
||||||
if(isSneaking && !(isSwimming || isInAir))
|
if(isSneaking && !(isSwimming || isInAir))
|
||||||
mCamera->setSneakOffset();
|
mCamera->setSneakOffset(i1stPersonSneakDelta);
|
||||||
|
|
||||||
|
|
||||||
mOcclusionQuery->update(duration);
|
mOcclusionQuery->update(duration);
|
||||||
|
|
Loading…
Reference in a new issue