From f7ed2ef55fbae53e346668969e3e9780bc88aae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20S=C3=B6derberg?= Date: Wed, 7 Aug 2013 21:43:19 +0200 Subject: [PATCH 1/8] Standardize align values Updates all align attributes, so all layout files uses the same (new) system plus fixes a couple of misspellings. --- files/mygui/openmw_box.skin.xml | 16 +- files/mygui/openmw_button.skin.xml | 28 +-- files/mygui/openmw_chargen_birth.layout | 6 +- files/mygui/openmw_chargen_class.layout | 50 ++-- .../openmw_chargen_class_description.layout | 2 +- .../mygui/openmw_chargen_create_class.layout | 52 ++--- ...penmw_chargen_generate_class_result.layout | 12 +- files/mygui/openmw_chargen_race.layout | 28 +-- files/mygui/openmw_chargen_review.layout | 4 +- .../openmw_chargen_select_attribute.layout | 22 +- .../mygui/openmw_chargen_select_skill.layout | 72 +++--- ...penmw_chargen_select_specialization.layout | 18 +- files/mygui/openmw_console.skin.xml | 4 +- files/mygui/openmw_dialogue_window.layout | 6 +- files/mygui/openmw_dialogue_window_skin.xml | 2 +- files/mygui/openmw_edit.skin.xml | 6 +- files/mygui/openmw_hud.layout | 2 +- files/mygui/openmw_hud_box.skin.xml | 10 +- files/mygui/openmw_hud_energybar.skin.xml | 32 +-- files/mygui/openmw_infobox.layout | 6 +- .../openmw_interactive_messagebox.layout | 6 +- files/mygui/openmw_list.skin.xml | 76 +++---- files/mygui/openmw_map_window.layout | 14 +- files/mygui/openmw_map_window_skin.xml | 4 +- files/mygui/openmw_messagebox.layout | 4 +- files/mygui/openmw_progress.skin.xml | 28 +-- files/mygui/openmw_resources.xml | 8 +- files/mygui/openmw_scroll_skin.xml | 4 +- files/mygui/openmw_spell_buying_window.layout | 4 +- files/mygui/openmw_stats_window.layout | 4 +- files/mygui/openmw_text.skin.xml | 82 +++---- files/mygui/openmw_text_input.layout | 6 +- files/mygui/openmw_tooltips.layout | 2 +- files/mygui/openmw_travel_window.layout | 4 +- files/mygui/openmw_windows.skin.xml | 214 +++++++++--------- 35 files changed, 419 insertions(+), 419 deletions(-) diff --git a/files/mygui/openmw_box.skin.xml b/files/mygui/openmw_box.skin.xml index 2a54edd60..09665a4ee 100644 --- a/files/mygui/openmw_box.skin.xml +++ b/files/mygui/openmw_box.skin.xml @@ -64,13 +64,13 @@ as around the sections of the stats window, or around popup info windows --> - - - - - - - - + + + + + + + + diff --git a/files/mygui/openmw_button.skin.xml b/files/mygui/openmw_button.skin.xml index 2895d52cc..c66105f35 100644 --- a/files/mygui/openmw_button.skin.xml +++ b/files/mygui/openmw_button.skin.xml @@ -3,7 +3,7 @@ - + @@ -12,7 +12,7 @@ - + @@ -21,7 +21,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -62,18 +62,18 @@ - + - - - - - - - - + + + + + + + + - + diff --git a/files/mygui/openmw_chargen_birth.layout b/files/mygui/openmw_chargen_birth.layout index f4b8c518d..75f741271 100644 --- a/files/mygui/openmw_chargen_birth.layout +++ b/files/mygui/openmw_chargen_birth.layout @@ -5,12 +5,12 @@ - - + + - + diff --git a/files/mygui/openmw_chargen_class.layout b/files/mygui/openmw_chargen_class.layout index 00e3793bc..6d159fe61 100644 --- a/files/mygui/openmw_chargen_class.layout +++ b/files/mygui/openmw_chargen_class.layout @@ -6,56 +6,56 @@ - - + + - + - + - + - - + + - + - + - - + + - - + + - - - - - + + + + + - + - + - - - - - + + + + + diff --git a/files/mygui/openmw_chargen_class_description.layout b/files/mygui/openmw_chargen_class_description.layout index 8823e1e76..46fa410d1 100644 --- a/files/mygui/openmw_chargen_class_description.layout +++ b/files/mygui/openmw_chargen_class_description.layout @@ -7,7 +7,7 @@ - + diff --git a/files/mygui/openmw_chargen_create_class.layout b/files/mygui/openmw_chargen_create_class.layout index 54f73f221..9677f438f 100644 --- a/files/mygui/openmw_chargen_create_class.layout +++ b/files/mygui/openmw_chargen_create_class.layout @@ -2,58 +2,58 @@ - + - + - + - + - + - + - - + + - + - + - - + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + diff --git a/files/mygui/openmw_chargen_generate_class_result.layout b/files/mygui/openmw_chargen_generate_class_result.layout index aa4a89d28..9ee3e0701 100644 --- a/files/mygui/openmw_chargen_generate_class_result.layout +++ b/files/mygui/openmw_chargen_generate_class_result.layout @@ -3,20 +3,20 @@ - - + + - - + + - + - + diff --git a/files/mygui/openmw_chargen_race.layout b/files/mygui/openmw_chargen_race.layout index 55dbe3218..0f63ba700 100644 --- a/files/mygui/openmw_chargen_race.layout +++ b/files/mygui/openmw_chargen_race.layout @@ -4,9 +4,9 @@ - + - + @@ -19,57 +19,57 @@ - + - + - + - + - + - + - - + + - - + + - - + + diff --git a/files/mygui/openmw_chargen_review.layout b/files/mygui/openmw_chargen_review.layout index 97e32cfe2..84b105bd0 100644 --- a/files/mygui/openmw_chargen_review.layout +++ b/files/mygui/openmw_chargen_review.layout @@ -106,8 +106,8 @@ - - + + diff --git a/files/mygui/openmw_chargen_select_attribute.layout b/files/mygui/openmw_chargen_select_attribute.layout index 09c2a4aae..b847bcd3b 100644 --- a/files/mygui/openmw_chargen_select_attribute.layout +++ b/files/mygui/openmw_chargen_select_attribute.layout @@ -1,23 +1,23 @@ - + - + - + - - - - - - - - + + + + + + + + diff --git a/files/mygui/openmw_chargen_select_skill.layout b/files/mygui/openmw_chargen_select_skill.layout index 2cf81e6c6..90ae477e5 100644 --- a/files/mygui/openmw_chargen_select_skill.layout +++ b/files/mygui/openmw_chargen_select_skill.layout @@ -1,58 +1,58 @@ - + - + - + - + - + - - - - - - - - - + + + + + + + + + - + - + - - - - - - - - - + + + + + + + + + - + - + - - - - - - - - - + + + + + + + + + diff --git a/files/mygui/openmw_chargen_select_specialization.layout b/files/mygui/openmw_chargen_select_specialization.layout index e9cb76825..7f8b5e02b 100644 --- a/files/mygui/openmw_chargen_select_specialization.layout +++ b/files/mygui/openmw_chargen_select_specialization.layout @@ -2,23 +2,23 @@ - + - + - + - - + + - - + + - - + + diff --git a/files/mygui/openmw_console.skin.xml b/files/mygui/openmw_console.skin.xml index 1758c728d..647cf0615 100644 --- a/files/mygui/openmw_console.skin.xml +++ b/files/mygui/openmw_console.skin.xml @@ -13,12 +13,12 @@ - + - + diff --git a/files/mygui/openmw_dialogue_window.layout b/files/mygui/openmw_dialogue_window.layout index a314ba312..c42ea8d7d 100644 --- a/files/mygui/openmw_dialogue_window.layout +++ b/files/mygui/openmw_dialogue_window.layout @@ -5,12 +5,12 @@ - - + + - + diff --git a/files/mygui/openmw_dialogue_window_skin.xml b/files/mygui/openmw_dialogue_window_skin.xml index 31ce626be..59ff1dc8b 100644 --- a/files/mygui/openmw_dialogue_window_skin.xml +++ b/files/mygui/openmw_dialogue_window_skin.xml @@ -13,7 +13,7 @@ - + diff --git a/files/mygui/openmw_edit.skin.xml b/files/mygui/openmw_edit.skin.xml index 1f14f6f66..3307beb77 100644 --- a/files/mygui/openmw_edit.skin.xml +++ b/files/mygui/openmw_edit.skin.xml @@ -22,7 +22,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -39,7 +39,7 @@ - + diff --git a/files/mygui/openmw_hud.layout b/files/mygui/openmw_hud.layout index 9faa931c6..2dcb27d2a 100644 --- a/files/mygui/openmw_hud.layout +++ b/files/mygui/openmw_hud.layout @@ -109,7 +109,7 @@ - + diff --git a/files/mygui/openmw_hud_box.skin.xml b/files/mygui/openmw_hud_box.skin.xml index f847ca51a..dd8172661 100644 --- a/files/mygui/openmw_hud_box.skin.xml +++ b/files/mygui/openmw_hud_box.skin.xml @@ -8,27 +8,27 @@ - + - + - + - + - + diff --git a/files/mygui/openmw_hud_energybar.skin.xml b/files/mygui/openmw_hud_energybar.skin.xml index 9ec065e36..556732df1 100644 --- a/files/mygui/openmw_hud_energybar.skin.xml +++ b/files/mygui/openmw_hud_energybar.skin.xml @@ -20,30 +20,30 @@ - - - - + + + + - + - + - + - + @@ -54,32 +54,32 @@ - - + + - - + + - - + + - - + + diff --git a/files/mygui/openmw_infobox.layout b/files/mygui/openmw_infobox.layout index 89031a616..4e70cd2c4 100644 --- a/files/mygui/openmw_infobox.layout +++ b/files/mygui/openmw_infobox.layout @@ -4,13 +4,13 @@ - - + + - + diff --git a/files/mygui/openmw_interactive_messagebox.layout b/files/mygui/openmw_interactive_messagebox.layout index b8a71c670..f92af813c 100644 --- a/files/mygui/openmw_interactive_messagebox.layout +++ b/files/mygui/openmw_interactive_messagebox.layout @@ -2,16 +2,16 @@ - + - + - + diff --git a/files/mygui/openmw_list.skin.xml b/files/mygui/openmw_list.skin.xml index d680f80d2..54143f270 100644 --- a/files/mygui/openmw_list.skin.xml +++ b/files/mygui/openmw_list.skin.xml @@ -12,22 +12,22 @@ - + - - + + - - + + - - + + - + @@ -49,24 +49,24 @@ - + - - + + - - + + - - + + - + @@ -89,19 +89,19 @@ - + - + - + - + @@ -113,50 +113,50 @@ - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + @@ -164,15 +164,15 @@ - + - + - + diff --git a/files/mygui/openmw_map_window.layout b/files/mygui/openmw_map_window.layout index d4b87e60d..b1b0ef733 100644 --- a/files/mygui/openmw_map_window.layout +++ b/files/mygui/openmw_map_window.layout @@ -4,34 +4,34 @@ - + - + - + - + - + - + - + diff --git a/files/mygui/openmw_map_window_skin.xml b/files/mygui/openmw_map_window_skin.xml index 2f5bb4faf..887e33293 100644 --- a/files/mygui/openmw_map_window_skin.xml +++ b/files/mygui/openmw_map_window_skin.xml @@ -5,7 +5,7 @@ - - + + diff --git a/files/mygui/openmw_messagebox.layout b/files/mygui/openmw_messagebox.layout index c5a7464ef..f90ffc636 100644 --- a/files/mygui/openmw_messagebox.layout +++ b/files/mygui/openmw_messagebox.layout @@ -5,9 +5,9 @@ - + - + diff --git a/files/mygui/openmw_progress.skin.xml b/files/mygui/openmw_progress.skin.xml index 4666be221..fa0501b73 100644 --- a/files/mygui/openmw_progress.skin.xml +++ b/files/mygui/openmw_progress.skin.xml @@ -3,32 +3,32 @@ - + - + - + - + - + - + @@ -37,31 +37,31 @@ - - + + - - + + - - + + - - + + diff --git a/files/mygui/openmw_resources.xml b/files/mygui/openmw_resources.xml index e47ff6386..75569eda4 100644 --- a/files/mygui/openmw_resources.xml +++ b/files/mygui/openmw_resources.xml @@ -263,10 +263,10 @@ - + - + @@ -275,7 +275,7 @@ - + @@ -283,7 +283,7 @@ - + diff --git a/files/mygui/openmw_scroll_skin.xml b/files/mygui/openmw_scroll_skin.xml index 76e22c69f..b6ed9155f 100644 --- a/files/mygui/openmw_scroll_skin.xml +++ b/files/mygui/openmw_scroll_skin.xml @@ -4,12 +4,12 @@ - + - + diff --git a/files/mygui/openmw_spell_buying_window.layout b/files/mygui/openmw_spell_buying_window.layout index c55cd0e22..1510372dd 100644 --- a/files/mygui/openmw_spell_buying_window.layout +++ b/files/mygui/openmw_spell_buying_window.layout @@ -15,8 +15,8 @@ - - + + diff --git a/files/mygui/openmw_stats_window.layout b/files/mygui/openmw_stats_window.layout index 55ee7b9da..d1c89593c 100644 --- a/files/mygui/openmw_stats_window.layout +++ b/files/mygui/openmw_stats_window.layout @@ -217,8 +217,8 @@ - - + + diff --git a/files/mygui/openmw_text.skin.xml b/files/mygui/openmw_text.skin.xml index b2a15b503..5e07665e6 100644 --- a/files/mygui/openmw_text.skin.xml +++ b/files/mygui/openmw_text.skin.xml @@ -5,45 +5,45 @@ - + - + - + - + - + - + - + - + - + - - + + @@ -52,25 +52,25 @@ - + - + - + - + - + - + @@ -80,7 +80,7 @@ - + @@ -94,8 +94,8 @@ - - + + @@ -109,8 +109,8 @@ - - + + @@ -124,8 +124,8 @@ - - + + @@ -144,40 +144,40 @@ - - + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + diff --git a/files/mygui/openmw_text_input.layout b/files/mygui/openmw_text_input.layout index a2ed94c67..012b0a82b 100644 --- a/files/mygui/openmw_text_input.layout +++ b/files/mygui/openmw_text_input.layout @@ -4,10 +4,10 @@ - - + + - + diff --git a/files/mygui/openmw_tooltips.layout b/files/mygui/openmw_tooltips.layout index 7291f2ca2..bec6dd87c 100644 --- a/files/mygui/openmw_tooltips.layout +++ b/files/mygui/openmw_tooltips.layout @@ -200,7 +200,7 @@ - + diff --git a/files/mygui/openmw_travel_window.layout b/files/mygui/openmw_travel_window.layout index 07a6daf48..db3fa24a0 100644 --- a/files/mygui/openmw_travel_window.layout +++ b/files/mygui/openmw_travel_window.layout @@ -15,8 +15,8 @@ - - + + diff --git a/files/mygui/openmw_windows.skin.xml b/files/mygui/openmw_windows.skin.xml index 73f68e80d..fd898ad3c 100644 --- a/files/mygui/openmw_windows.skin.xml +++ b/files/mygui/openmw_windows.skin.xml @@ -97,27 +97,27 @@ - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + @@ -319,36 +319,36 @@ - - - - - - - - - + + + + + + + + + - + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + From 0fabf1fe2eb465d2fe65d35e352b3dab828dd458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20S=C3=B6derberg?= Date: Thu, 8 Aug 2013 01:47:19 +0200 Subject: [PATCH 2/8] Updated Alchemy Window --- files/mygui/openmw_alchemy_window.layout | 57 ++++++++++++++++-------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/files/mygui/openmw_alchemy_window.layout b/files/mygui/openmw_alchemy_window.layout index 076a9293a..e8a617ff9 100644 --- a/files/mygui/openmw_alchemy_window.layout +++ b/files/mygui/openmw_alchemy_window.layout @@ -1,22 +1,27 @@ - + - + + + - + - + - + + + + - - + + @@ -32,15 +37,19 @@ + - + + + + - - + + @@ -56,32 +65,44 @@ + - - - - - + + + + + + + + - - + + + + - + + + + + + + From ab44cd63a1d093acc314832df68bf6e61c400ee3 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 7 Aug 2013 15:05:48 -0700 Subject: [PATCH 3/8] Remove unused function --- apps/openmw/mwrender/animation.cpp | 8 -------- apps/openmw/mwrender/animation.hpp | 3 --- 2 files changed, 11 deletions(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 055d14ecb..37cebcf0b 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -951,14 +951,6 @@ Ogre::AxisAlignedBox Animation::getWorldBounds() } -bool Animation::isPriorityActive(int priority) const -{ - for (AnimStateMap::const_iterator it = mStates.begin(); it != mStates.end(); ++it) - if (it->second.mPriority == priority) - return true; - return false; -} - Ogre::TagPoint *Animation::attachObjectToBone(const Ogre::String &bonename, Ogre::MovableObject *obj) { Ogre::TagPoint *tag = NULL; diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index b0e4f6dbd..2215fc582 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -177,9 +177,6 @@ public: bool hasAnimation(const std::string &anim); - bool isPriorityActive (int priority) const; - ///< Is there an animation playing with the given priority? - // Specifies the axis' to accumulate on. Non-accumulated axis will just // move visually, but not affect the actual movement. Each x/y/z value // should be on the scale of 0 to 1. From deee14ccfd6115d4812f2e42d33f07c34d1c9389 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 7 Aug 2013 16:03:37 -0700 Subject: [PATCH 4/8] Handle NPCs being a werewolf in NpcAnimation Note that the body mesh comes from having a WerewolfRobe force-equipped. --- apps/openmw/mwrender/npcanimation.cpp | 85 ++++++++++++++++++++------- 1 file changed, 63 insertions(+), 22 deletions(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 24f77a512..5a794e743 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -9,6 +9,8 @@ #include "../mwworld/inventorystore.hpp" #include "../mwworld/class.hpp" +#include "../mwmechanics/npcstats.hpp" + #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/mechanicsmanager.hpp" @@ -92,20 +94,32 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor mPartPriorities[i] = 0; } - const MWWorld::ESMStore &store = - MWBase::Environment::get().getWorld()->getStore(); + const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Race *race = store.get().find(mNpc->mRace); + bool isWerewolf = MWWorld::Class::get(mPtr).getNpcStats(mPtr).isWerewolf(); - mHeadModel = "meshes\\" + store.get().find(mNpc->mHead)->mModel; - mHairModel = "meshes\\" + store.get().find(mNpc->mHair)->mModel; + if(!isWerewolf) + { + mHeadModel = "meshes\\" + store.get().find(mNpc->mHead)->mModel; + mHairModel = "meshes\\" + store.get().find(mNpc->mHair)->mModel; + } + else + { + mHeadModel = "meshes\\" + store.get().find("WerewolfHead")->mModel; + mHairModel = "meshes\\" + store.get().find("WerewolfHair")->mModel; + } mBodyPrefix = "b_n_" + mNpc->mRace; Misc::StringUtils::toLower(mBodyPrefix); bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0; std::string smodel = (viewMode != VM_FirstPerson) ? - (!isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif") : - (!isBeast ? "meshes\\base_anim.1st.nif" : "meshes\\base_animkna.1st.nif") ; + (!isWerewolf ? (!isBeast ? "meshes\\base_anim.nif" + : "meshes\\base_animkna.nif") + : "meshes\\wolf\\skin.nif") : + (!isWerewolf ? (!isBeast ? "meshes\\base_anim.1st.nif" + : "meshes\\base_animkna.1st.nif") + : "meshes\\wolf\\skin.1st.nif"); setObjectRoot(smodel, true); if(mViewMode != VM_FirstPerson) @@ -142,33 +156,60 @@ void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode) const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Race *race = store.get().find(mNpc->mRace); + bool isWerewolf = MWWorld::Class::get(mPtr).getNpcStats(mPtr).isWerewolf(); + + if(!isWerewolf) + { + mHeadModel = "meshes\\" + store.get().find(mNpc->mHead)->mModel; + mHairModel = "meshes\\" + store.get().find(mNpc->mHair)->mModel; + } + else + { + mHeadModel = "meshes\\" + store.get().find("WerewolfHead")->mModel; + mHairModel = "meshes\\" + store.get().find("WerewolfHair")->mModel; + } + + mBodyPrefix = "b_n_" + mNpc->mRace; + Misc::StringUtils::toLower(mBodyPrefix); bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0; std::string smodel = (viewMode != VM_FirstPerson) ? - (!isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif") : - (!isBeast ? "meshes\\base_anim.1st.nif" : "meshes\\base_animkna.1st.nif") ; + (!isWerewolf ? !isBeast ? "meshes\\base_anim.nif" + : "meshes\\base_animkna.nif" + : "meshes\\wolf\\skin.nif") : + (!isWerewolf ? !isBeast ? "meshes\\base_anim.1st.nif" + : "meshes\\base_animkna.1st.nif" + : "meshes\\wolf\\skin.1st.nif"); setObjectRoot(smodel, true); if(mViewMode != VM_FirstPerson) { addAnimSource(smodel); - if(mBodyPrefix.find("argonian") != std::string::npos) - addAnimSource("meshes\\argonian_swimkna.nif"); - else if(!mNpc->isMale() && !isBeast) - addAnimSource("meshes\\base_anim_female.nif"); - if(mNpc->mModel.length() > 0) - addAnimSource("meshes\\"+mNpc->mModel); + if(!isWerewolf) + { + if(mBodyPrefix.find("argonian") != std::string::npos) + addAnimSource("meshes\\argonian_swimkna.nif"); + else if(!mNpc->isMale() && !isBeast) + addAnimSource("meshes\\base_anim_female.nif"); + if(mNpc->mModel.length() > 0) + addAnimSource("meshes\\"+mNpc->mModel); + } } else { - /* A bit counter-intuitive, but unlike third-person anims, it seems - * beast races get both base_anim.1st.nif and base_animkna.1st.nif. - */ - addAnimSource("meshes\\base_anim.1st.nif"); - if(isBeast) - addAnimSource("meshes\\base_animkna.1st.nif"); - if(!mNpc->isMale() && !isBeast) - addAnimSource("meshes\\base_anim_female.1st.nif"); + if(isWerewolf) + addAnimSource(smodel); + else + { + /* A bit counter-intuitive, but unlike third-person anims, it seems + * beast races get both base_anim.1st.nif and base_animkna.1st.nif. + */ + addAnimSource("meshes\\base_anim.1st.nif"); + if(isBeast) + addAnimSource("meshes\\base_animkna.1st.nif"); + if(!mNpc->isMale() && !isBeast) + addAnimSource("meshes\\base_anim_female.1st.nif"); + } } MWBase::Environment::get().getMechanicsManager()->forceStateUpdate(mPtr); From 0f52ed9a9be331b6c81ec2aefe3c4b1afabda786 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 7 Aug 2013 16:21:57 -0700 Subject: [PATCH 5/8] Remove some duplicate code --- apps/openmw/mwrender/npcanimation.cpp | 62 ++++----------------------- apps/openmw/mwrender/npcanimation.hpp | 2 + 2 files changed, 11 insertions(+), 53 deletions(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 5a794e743..01b69459c 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -94,57 +94,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor mPartPriorities[i] = 0; } - const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); - const ESM::Race *race = store.get().find(mNpc->mRace); - bool isWerewolf = MWWorld::Class::get(mPtr).getNpcStats(mPtr).isWerewolf(); - - if(!isWerewolf) - { - mHeadModel = "meshes\\" + store.get().find(mNpc->mHead)->mModel; - mHairModel = "meshes\\" + store.get().find(mNpc->mHair)->mModel; - } - else - { - mHeadModel = "meshes\\" + store.get().find("WerewolfHead")->mModel; - mHairModel = "meshes\\" + store.get().find("WerewolfHair")->mModel; - } - - mBodyPrefix = "b_n_" + mNpc->mRace; - Misc::StringUtils::toLower(mBodyPrefix); - - bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0; - std::string smodel = (viewMode != VM_FirstPerson) ? - (!isWerewolf ? (!isBeast ? "meshes\\base_anim.nif" - : "meshes\\base_animkna.nif") - : "meshes\\wolf\\skin.nif") : - (!isWerewolf ? (!isBeast ? "meshes\\base_anim.1st.nif" - : "meshes\\base_animkna.1st.nif") - : "meshes\\wolf\\skin.1st.nif"); - setObjectRoot(smodel, true); - - if(mViewMode != VM_FirstPerson) - { - addAnimSource(smodel); - if(mBodyPrefix.find("argonian") != std::string::npos) - addAnimSource("meshes\\argonian_swimkna.nif"); - else if(!mNpc->isMale() && !isBeast) - addAnimSource("meshes\\base_anim_female.nif"); - if(mNpc->mModel.length() > 0) - addAnimSource("meshes\\"+mNpc->mModel); - } - else - { - /* A bit counter-intuitive, but unlike third-person anims, it seems - * beast races get both base_anim.1st.nif and base_animkna.1st.nif. - */ - addAnimSource("meshes\\base_anim.1st.nif"); - if(isBeast) - addAnimSource("meshes\\base_animkna.1st.nif"); - if(!mNpc->isMale() && !isBeast) - addAnimSource("meshes\\base_anim_female.1st.nif"); - } - - forceUpdate(); + updateNpcBase(); } void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode) @@ -152,6 +102,13 @@ void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode) assert(viewMode != VM_HeadOnly); mViewMode = viewMode; + updateNpcBase(); + + MWBase::Environment::get().getMechanicsManager()->forceStateUpdate(mPtr); +} + +void NpcAnimation::updateNpcBase() +{ clearAnimSources(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); @@ -173,7 +130,7 @@ void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode) Misc::StringUtils::toLower(mBodyPrefix); bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0; - std::string smodel = (viewMode != VM_FirstPerson) ? + std::string smodel = (mViewMode != VM_FirstPerson) ? (!isWerewolf ? !isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif" : "meshes\\wolf\\skin.nif") : @@ -211,7 +168,6 @@ void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode) addAnimSource("meshes\\base_anim_female.1st.nif"); } } - MWBase::Environment::get().getMechanicsManager()->forceStateUpdate(mPtr); for(size_t i = 0;i < ESM::PRT_Count;i++) removeIndividualPart((ESM::PartReferenceType)i); diff --git a/apps/openmw/mwrender/npcanimation.hpp b/apps/openmw/mwrender/npcanimation.hpp index aa51ffbe9..d8f9246cb 100644 --- a/apps/openmw/mwrender/npcanimation.hpp +++ b/apps/openmw/mwrender/npcanimation.hpp @@ -65,6 +65,8 @@ private: int mPartslots[ESM::PRT_Count]; //Each part slot is taken by clothing, armor, or is empty int mPartPriorities[ESM::PRT_Count]; + void updateNpcBase(); + NifOgre::ObjectList insertBoundedPart(const std::string &model, int group, const std::string &bonename); void updateParts(bool forceupdate = false); From dc0360b1f6ccb82bc38eb34a9379189e2310539f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 7 Aug 2013 16:45:29 -0700 Subject: [PATCH 6/8] Remove unnecessary mBodyPrefix field --- apps/openmw/mwrender/npcanimation.cpp | 5 +---- apps/openmw/mwrender/npcanimation.hpp | 9 ++++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 01b69459c..e8777b565 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -126,9 +126,6 @@ void NpcAnimation::updateNpcBase() mHairModel = "meshes\\" + store.get().find("WerewolfHair")->mModel; } - mBodyPrefix = "b_n_" + mNpc->mRace; - Misc::StringUtils::toLower(mBodyPrefix); - bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0; std::string smodel = (mViewMode != VM_FirstPerson) ? (!isWerewolf ? !isBeast ? "meshes\\base_anim.nif" @@ -144,7 +141,7 @@ void NpcAnimation::updateNpcBase() addAnimSource(smodel); if(!isWerewolf) { - if(mBodyPrefix.find("argonian") != std::string::npos) + if(Misc::StringUtils::lowerCase(mNpc->mRace).find("argonian") != std::string::npos) addAnimSource("meshes\\argonian_swimkna.nif"); else if(!mNpc->isMale() && !isBeast) addAnimSource("meshes\\base_anim_female.nif"); diff --git a/apps/openmw/mwrender/npcanimation.hpp b/apps/openmw/mwrender/npcanimation.hpp index d8f9246cb..88e4a9e04 100644 --- a/apps/openmw/mwrender/npcanimation.hpp +++ b/apps/openmw/mwrender/npcanimation.hpp @@ -37,11 +37,10 @@ private: // Bounded Parts NifOgre::ObjectList mObjectParts[ESM::PRT_Count]; - const ESM::NPC *mNpc; - std::string mHeadModel; - std::string mHairModel; - std::string mBodyPrefix; - ViewMode mViewMode; + const ESM::NPC *mNpc; + std::string mHeadModel; + std::string mHairModel; + ViewMode mViewMode; bool mShowWeapons; float mTimeToChange; From 4641737fc4b6cc96544cca469efd2b7db920a760 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 7 Aug 2013 17:23:53 -0700 Subject: [PATCH 7/8] Update part skeletons immediately when added --- apps/openmw/mwrender/npcanimation.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index e8777b565..36f5886fd 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -493,20 +493,25 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g mPartPriorities[type] = priority; mObjectParts[type] = insertBoundedPart(mesh, group, sPartList.at(type)); - if(mObjectParts[type].mSkelBase && mObjectParts[type].mSkelBase->isParentTagPoint()) + if(mObjectParts[type].mSkelBase) { - Ogre::Node *root = mObjectParts[type].mSkelBase->getParentNode(); Ogre::SkeletonInstance *skel = mObjectParts[type].mSkelBase->getSkeleton(); - if(skel->hasBone("BoneOffset")) + if(mObjectParts[type].mSkelBase->isParentTagPoint()) { - Ogre::Bone *offset = skel->getBone("BoneOffset"); - root->translate(offset->getPosition()); - root->rotate(offset->getOrientation()); - // HACK: Why an extra -90 degree rotation? - root->pitch(Ogre::Degree(-90.0f)); - root->scale(offset->getScale()); - root->setInitialState(); + Ogre::Node *root = mObjectParts[type].mSkelBase->getParentNode(); + if(skel->hasBone("BoneOffset")) + { + Ogre::Bone *offset = skel->getBone("BoneOffset"); + root->translate(offset->getPosition()); + root->rotate(offset->getOrientation()); + // HACK: Why an extra -90 degree rotation? + root->pitch(Ogre::Degree(-90.0f)); + root->scale(offset->getScale()); + root->setInitialState(); + } } + + updateSkeletonInstance(mSkelBase->getSkeleton(), skel); } // TODO: @@ -521,7 +526,7 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g ctrl->setSource(mNullAnimationValuePtr); } - return true; + return true; } void NpcAnimation::addPartGroup(int group, int priority, const std::vector &parts) From 4985e1786519acd886f92fd0606a5d36a840c40d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 7 Aug 2013 18:51:57 -0700 Subject: [PATCH 8/8] Fix werewolf claw damage multiplier --- apps/openmw/mwclass/npc.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index b9c463432..29302768c 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -412,7 +412,14 @@ namespace MWClass MWBase::Environment::get().getSoundManager()->playSound3D(victim, "critical damage", 1.0f, 1.0f); } - healthdmg = (otherstats.getFatigue().getCurrent() < 1.0f || npcstats.isWerewolf()); + healthdmg = (otherstats.getFatigue().getCurrent() < 1.0f); + if(npcstats.isWerewolf()) + { + healthdmg = true; + // GLOB instead of GMST because it gets updated during a quest + const MWWorld::Store &glob = world->getStore().get(); + damage *= glob.find("WerewolfClawMult")->mValue.getFloat(); + } if(healthdmg) damage *= gmst.find("fHandtoHandHealthPer")->getFloat(); }