Use i1stPersonSneakDelta + some cleanup

actorid
scrawl 11 years ago
parent 2744cde40f
commit 15e48107f7

@ -19,12 +19,12 @@ namespace MWMechanics
inline int spellSchoolToSkill(int school)
{
std::map<int, int> schoolSkillMap; // maps spell school to skill id
schoolSkillMap[0] = 11; // alteration
schoolSkillMap[1] = 13; // conjuration
schoolSkillMap[3] = 12; // illusion
schoolSkillMap[2] = 10; // destruction
schoolSkillMap[4] = 14; // mysticism
schoolSkillMap[5] = 15; // restoration
schoolSkillMap[0] = ESM::Skill::Alteration;
schoolSkillMap[1] = ESM::Skill::Conjuration;
schoolSkillMap[3] = ESM::Skill::Illusion;
schoolSkillMap[2] = ESM::Skill::Destruction;
schoolSkillMap[4] = ESM::Skill::Mysticism;
schoolSkillMap[5] = ESM::Skill::Restoration;
assert(schoolSkillMap.find(school) != schoolSkillMap.end());
return schoolSkillMap[school];
}

@ -226,11 +226,10 @@ namespace MWRender
mCamera->setPosition(0.f, 0.f, offset);
}
void Camera::setSneakOffset()
void Camera::setSneakOffset(float offset)
{
// TODO: iFirstPersonSneakDelta
if(mAnimation)
mAnimation->addFirstPersonOffset(Ogre::Vector3(0.f, 0.f, -9.8f));
mAnimation->addFirstPersonOffset(Ogre::Vector3(0.f, 0.f, -offset));
}
float Camera::getYaw()

@ -87,7 +87,7 @@ namespace MWRender
/// As animation is tied to the camera, this needs
/// to be set each frame after the animation is
/// applied.
void setSneakOffset();
void setSneakOffset(float offset);
bool isFirstPerson() const
{ return !(mVanity.enabled || mPreviewMode || !mFirstPersonView); }

@ -351,8 +351,10 @@ void RenderingManager::update (float duration, bool paused)
bool isInAir = !world->isOnGround(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))
mCamera->setSneakOffset();
mCamera->setSneakOffset(i1stPersonSneakDelta);
mOcclusionQuery->update(duration);

Loading…
Cancel
Save