forked from teamnwah/openmw-tes3coop
Bug #1005: Hide torches/shields during spellcasting and hand-to-hand combat
This commit is contained in:
parent
7265b427fe
commit
85ec80100c
4 changed files with 18 additions and 25 deletions
|
@ -425,10 +425,10 @@ bool CharacterController::updateNpcState(bool onground, bool inwater, bool isrun
|
|||
{
|
||||
forcestateupdate = true;
|
||||
|
||||
// Shields shouldn't be visible during spellcasting
|
||||
// Shields/torches shouldn't be visible during spellcasting or hand-to-hand
|
||||
// There seems to be no text keys for this purpose, except maybe for "[un]equip start/stop",
|
||||
// but they are also present in weapon drawing animation.
|
||||
mAnimation->showShield(weaptype != WeapType_Spell);
|
||||
mAnimation->showCarriedLeft(weaptype != WeapType_Spell && weaptype != WeapType_HandToHand);
|
||||
|
||||
std::string weapgroup;
|
||||
if(weaptype == WeapType_None)
|
||||
|
@ -719,7 +719,8 @@ bool CharacterController::updateNpcState(bool onground, bool inwater, bool isrun
|
|||
|
||||
|
||||
MWWorld::ContainerStoreIterator torch = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
|
||||
if(torch != inv.end() && torch->getTypeName() == typeid(ESM::Light).name())
|
||||
if(torch != inv.end() && torch->getTypeName() == typeid(ESM::Light).name()
|
||||
&& mWeaponType != WeapType_Spell && mWeaponType != WeapType_HandToHand)
|
||||
{
|
||||
if(!mAnimation->isPlaying("torch"))
|
||||
mAnimation->play("torch", Priority_Torch,
|
||||
|
|
|
@ -279,7 +279,7 @@ public:
|
|||
virtual Ogre::Vector3 runAnimation(float duration);
|
||||
|
||||
virtual void showWeapons(bool showWeapon);
|
||||
virtual void showShield(bool show) {}
|
||||
virtual void showCarriedLeft(bool show) {}
|
||||
|
||||
void enableLights(bool enable);
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, int v
|
|||
mListenerDisabled(disableListener),
|
||||
mViewMode(viewMode),
|
||||
mShowWeapons(false),
|
||||
mShowShield(true),
|
||||
mShowCarriedLeft(true),
|
||||
mFirstPersonOffset(0.f, 0.f, 0.f),
|
||||
mAlpha(1.f)
|
||||
{
|
||||
|
@ -319,7 +319,7 @@ void NpcAnimation::updateParts()
|
|||
}
|
||||
|
||||
showWeapons(mShowWeapons);
|
||||
showShield(mShowShield);
|
||||
showCarriedLeft(mShowCarriedLeft);
|
||||
|
||||
// Remember body parts so we only have to search through the store once for each race/gender/viewmode combination
|
||||
static std::map< std::pair<std::string,int>,std::vector<const ESM::BodyPart*> > sRaceMapping;
|
||||
|
@ -654,32 +654,24 @@ void NpcAnimation::showWeapons(bool showWeapon)
|
|||
mAlpha = 1.f;
|
||||
}
|
||||
|
||||
void NpcAnimation::showShield(bool show)
|
||||
void NpcAnimation::showCarriedLeft(bool show)
|
||||
{
|
||||
mShowShield = show;
|
||||
mShowCarriedLeft = show;
|
||||
MWWorld::InventoryStore &inv = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
|
||||
MWWorld::ContainerStoreIterator shield = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
|
||||
MWWorld::ContainerStoreIterator iter = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
|
||||
|
||||
if (shield != inv.end() && shield->getTypeName() == typeid(ESM::Light).name())
|
||||
if(show && iter != inv.end())
|
||||
{
|
||||
// ... Except for lights, which are still shown during spellcasting since they
|
||||
// have their own (one-handed) casting animations
|
||||
show = true;
|
||||
}
|
||||
if(show && shield != inv.end())
|
||||
{
|
||||
Ogre::Vector3 glowColor = getEnchantmentColor(*shield);
|
||||
std::string mesh = MWWorld::Class::get(*shield).getModel(*shield);
|
||||
Ogre::Vector3 glowColor = getEnchantmentColor(*iter);
|
||||
std::string mesh = MWWorld::Class::get(*iter).getModel(*iter);
|
||||
addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1,
|
||||
mesh, !shield->getClass().getEnchantment(*shield).empty(), &glowColor);
|
||||
mesh, !iter->getClass().getEnchantment(*iter).empty(), &glowColor);
|
||||
|
||||
if (shield->getTypeName() == typeid(ESM::Light).name())
|
||||
addExtraLight(mInsert->getCreator(), mObjectParts[ESM::PRT_Shield], shield->get<ESM::Light>()->mBase);
|
||||
if (iter->getTypeName() == typeid(ESM::Light).name())
|
||||
addExtraLight(mInsert->getCreator(), mObjectParts[ESM::PRT_Shield], iter->get<ESM::Light>()->mBase);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeIndividualPart(ESM::PRT_Shield);
|
||||
}
|
||||
}
|
||||
|
||||
void NpcAnimation::permanentEffectAdded(const ESM::MagicEffect *magicEffect, bool isNew, bool playSound)
|
||||
|
|
|
@ -53,7 +53,7 @@ private:
|
|||
std::string mHairModel;
|
||||
ViewMode mViewMode;
|
||||
bool mShowWeapons;
|
||||
bool mShowShield;
|
||||
bool mShowCarriedLeft;
|
||||
|
||||
int mVisibilityFlags;
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
virtual Ogre::Vector3 runAnimation(float timepassed);
|
||||
|
||||
virtual void showWeapons(bool showWeapon);
|
||||
virtual void showShield(bool showShield);
|
||||
virtual void showCarriedLeft(bool showa);
|
||||
|
||||
void setViewMode(ViewMode viewMode);
|
||||
|
||||
|
|
Loading…
Reference in a new issue