From 43d63929217c43092a56f7a07d1c78c6f15728d2 Mon Sep 17 00:00:00 2001 From: Emanuel Guevel Date: Sat, 16 Feb 2013 20:56:17 +0100 Subject: [PATCH 01/30] Change the way pinnable window are made visible This ensure pinned window are not displayed in main menu, dialogue and container mode. --- apps/openmw/mwgui/window_pinnable_base.cpp | 10 ---------- apps/openmw/mwgui/window_pinnable_base.hpp | 1 - apps/openmw/mwgui/windowmanagerimp.cpp | 15 ++++++++++++++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwgui/window_pinnable_base.cpp b/apps/openmw/mwgui/window_pinnable_base.cpp index 4ddf49d27b..2e66a4805c 100644 --- a/apps/openmw/mwgui/window_pinnable_base.cpp +++ b/apps/openmw/mwgui/window_pinnable_base.cpp @@ -11,16 +11,6 @@ WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::Win t->eventWindowButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onWindowButtonPressed); } -void WindowPinnableBase::setVisible(bool b) -{ - // Pinned windows can not be hidden - if (mPinned && !b) - return; - - WindowBase::setVisible(b); - mVisible = b; -} - void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName) { if ("PinToggle" == eventName) diff --git a/apps/openmw/mwgui/window_pinnable_base.hpp b/apps/openmw/mwgui/window_pinnable_base.hpp index 250dde1f85..c577564c79 100644 --- a/apps/openmw/mwgui/window_pinnable_base.hpp +++ b/apps/openmw/mwgui/window_pinnable_base.hpp @@ -11,7 +11,6 @@ namespace MWGui { public: WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager); - void setVisible(bool b); bool pinned() { return mPinned; } private: diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index e03b91216d..39f7d07767 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -310,9 +310,16 @@ void WindowManager::updateVisible() setSpellVisibility((mAllowed & GW_Magic) && !mSpellWindow->pinned()); setHMSVisibility((mAllowed & GW_Stats) && !mStatsWindow->pinned()); - // If in game mode, don't show anything. + // If in game mode, show only the pinned windows if (gameMode) + { + mMap->setVisible(mMap->pinned()); + mStatsWindow->setVisible(mStatsWindow->pinned()); + mInventoryWindow->setVisible(mInventoryWindow->pinned()); + mSpellWindow->setVisible(mSpellWindow->pinned()); + return; + } GuiMode mode = mGuiModes.back(); @@ -327,6 +334,12 @@ void WindowManager::updateVisible() mSettingsWindow->setVisible(true); break; case GM_Console: + // Show the pinned windows + mMap->setVisible(mMap->pinned()); + mStatsWindow->setVisible(mStatsWindow->pinned()); + mInventoryWindow->setVisible(mInventoryWindow->pinned()); + mSpellWindow->setVisible(mSpellWindow->pinned()); + mConsole->enable(); break; case GM_Scroll: From 3ba3c71556d4e9b8abeb0fab8c329c86bec81082 Mon Sep 17 00:00:00 2001 From: Emanuel Guevel Date: Sun, 17 Feb 2013 02:56:07 +0100 Subject: [PATCH 02/30] Make the "lock window" button to change state visually --- apps/openmw/CMakeLists.txt | 2 +- apps/openmw/mwgui/exposedwindow.cpp | 26 ++++++++++++++++++++++ apps/openmw/mwgui/exposedwindow.hpp | 26 ++++++++++++++++++++++ apps/openmw/mwgui/window_pinnable_base.cpp | 11 +++++++++ apps/openmw/mwgui/window_pinnable_base.hpp | 1 + apps/openmw/mwgui/windowmanagerimp.cpp | 2 ++ files/mygui/openmw_inventory_window.layout | 2 +- files/mygui/openmw_map_window.layout | 2 +- files/mygui/openmw_spell_window.layout | 2 +- files/mygui/openmw_stats_window.layout | 2 +- files/mygui/openmw_windows.skin.xml | 14 +++++++++++- 11 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 apps/openmw/mwgui/exposedwindow.cpp create mode 100644 apps/openmw/mwgui/exposedwindow.hpp diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index df679d4cbc..3dd5ed45d5 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -30,7 +30,7 @@ add_openmw_dir (mwgui formatting inventorywindow container hud countdialog tradewindow settingswindow confirmationdialog alchemywindow referenceinterface spellwindow mainmenu quickkeysmenu itemselection spellbuyingwindow loadingscreen levelupdialog waitdialog spellcreationdialog - enchantingdialog trainingwindow travelwindow imagebutton + enchantingdialog trainingwindow travelwindow imagebutton exposedwindow ) add_openmw_dir (mwdialogue diff --git a/apps/openmw/mwgui/exposedwindow.cpp b/apps/openmw/mwgui/exposedwindow.cpp new file mode 100644 index 0000000000..fa37568d7b --- /dev/null +++ b/apps/openmw/mwgui/exposedwindow.cpp @@ -0,0 +1,26 @@ +#include "exposedwindow.hpp" + +#include "MyGUI_Window.h" + +namespace MWGui +{ + MyGUI::VectorWidgetPtr ExposedWindow::getSkinWidgetsByName (const std::string &name) + { + return MyGUI::Widget::getSkinWidgetsByName (name); + } + + MyGUI::Widget* ExposedWindow::getSkinWidget(const std::string & _name, bool _throw) + { + MyGUI::VectorWidgetPtr widgets = getSkinWidgetsByName (_name); + + if (widgets.empty()) + { + MYGUI_ASSERT( ! _throw, "widget name '" << _name << "' not found in skin of layout '" << getName() << "'"); + return nullptr; + } + else + { + return widgets[0]; + } + } +} diff --git a/apps/openmw/mwgui/exposedwindow.hpp b/apps/openmw/mwgui/exposedwindow.hpp new file mode 100644 index 0000000000..906d0b4065 --- /dev/null +++ b/apps/openmw/mwgui/exposedwindow.hpp @@ -0,0 +1,26 @@ +#ifndef MWGUI_EXPOSEDWINDOW_H +#define MWGUI_EXPOSEDWINDOW_H + +#include "MyGUI_Window.h" + +namespace MWGui +{ + + /** + * @brief subclass to provide access to some Widget internals. + */ + class ExposedWindow : public MyGUI::Window + { + MYGUI_RTTI_DERIVED(ExposedWindow) + + public: + MyGUI::VectorWidgetPtr getSkinWidgetsByName (const std::string &name); + + MyGUI::Widget* getSkinWidget(const std::string & _name, bool _throw = true); + ///< Get a widget defined in the inner skin of this window. + }; + +} + +#endif + diff --git a/apps/openmw/mwgui/window_pinnable_base.cpp b/apps/openmw/mwgui/window_pinnable_base.cpp index 2e66a4805c..781c427ef4 100644 --- a/apps/openmw/mwgui/window_pinnable_base.cpp +++ b/apps/openmw/mwgui/window_pinnable_base.cpp @@ -2,6 +2,8 @@ #include "../mwbase/windowmanager.hpp" +#include "exposedwindow.hpp" + using namespace MWGui; WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager) @@ -9,6 +11,9 @@ WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::Win { MyGUI::WindowPtr t = static_cast(mMainWidget); t->eventWindowButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onWindowButtonPressed); + + ExposedWindow* window = static_cast(mMainWidget); + mPinButton = window->getSkinWidget ("Button"); } void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName) @@ -16,6 +21,12 @@ void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std: if ("PinToggle" == eventName) { mPinned = !mPinned; + + if (mPinned) + mPinButton->changeWidgetSkin ("PinDown"); + else + mPinButton->changeWidgetSkin ("PinUp"); + onPinToggled(); } diff --git a/apps/openmw/mwgui/window_pinnable_base.hpp b/apps/openmw/mwgui/window_pinnable_base.hpp index c577564c79..7426b16fcf 100644 --- a/apps/openmw/mwgui/window_pinnable_base.hpp +++ b/apps/openmw/mwgui/window_pinnable_base.hpp @@ -19,6 +19,7 @@ namespace MWGui protected: virtual void onPinToggled() = 0; + MyGUI::Widget* mPinButton; bool mPinned; bool mVisible; }; diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 39f7d07767..1dc11f2c44 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -52,6 +52,7 @@ #include "enchantingdialog.hpp" #include "trainingwindow.hpp" #include "imagebutton.hpp" +#include "exposedwindow.hpp" using namespace MWGui; @@ -127,6 +128,7 @@ WindowManager::WindowManager( MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); + MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::LanguageManager::getInstance().eventRequestTag = MyGUI::newDelegate(this, &WindowManager::onRetrieveTag); diff --git a/files/mygui/openmw_inventory_window.layout b/files/mygui/openmw_inventory_window.layout index 3a60916f7f..88cc5638d3 100644 --- a/files/mygui/openmw_inventory_window.layout +++ b/files/mygui/openmw_inventory_window.layout @@ -1,7 +1,7 @@ - + diff --git a/files/mygui/openmw_map_window.layout b/files/mygui/openmw_map_window.layout index b5479b6761..d4b87e60d1 100644 --- a/files/mygui/openmw_map_window.layout +++ b/files/mygui/openmw_map_window.layout @@ -1,7 +1,7 @@ - + diff --git a/files/mygui/openmw_spell_window.layout b/files/mygui/openmw_spell_window.layout index d489f41b8a..6c6629605b 100644 --- a/files/mygui/openmw_spell_window.layout +++ b/files/mygui/openmw_spell_window.layout @@ -1,7 +1,7 @@ - + diff --git a/files/mygui/openmw_stats_window.layout b/files/mygui/openmw_stats_window.layout index c2c8a5daea..55ee7b9dac 100644 --- a/files/mygui/openmw_stats_window.layout +++ b/files/mygui/openmw_stats_window.layout @@ -1,7 +1,7 @@ - + diff --git a/files/mygui/openmw_windows.skin.xml b/files/mygui/openmw_windows.skin.xml index a9eb23d68a..72b6861254 100644 --- a/files/mygui/openmw_windows.skin.xml +++ b/files/mygui/openmw_windows.skin.xml @@ -8,6 +8,18 @@ + + + + + + + + + + + + @@ -473,7 +485,7 @@ - + From 2dea86bbc7cb8b95415d626d1a8b90de894e1416 Mon Sep 17 00:00:00 2001 From: Emanuel Guevel Date: Sun, 17 Feb 2013 03:04:38 +0100 Subject: [PATCH 03/30] Make the "lock window" button appealing --- files/mygui/openmw_windows.skin.xml | 116 ++++++++++++++++++++++++++-- 1 file changed, 108 insertions(+), 8 deletions(-) diff --git a/files/mygui/openmw_windows.skin.xml b/files/mygui/openmw_windows.skin.xml index 72b6861254..93aa8fd209 100644 --- a/files/mygui/openmw_windows.skin.xml +++ b/files/mygui/openmw_windows.skin.xml @@ -8,17 +8,117 @@ - - - - + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -485,7 +585,7 @@ - + From 3dc28baa287dd9d2169bace23bf89d2cb792e084 Mon Sep 17 00:00:00 2001 From: Emanuel Guevel Date: Sun, 17 Feb 2013 16:29:38 +0100 Subject: [PATCH 04/30] Remove "PinToggle" event from layout file --- apps/openmw/mwgui/window_pinnable_base.cpp | 24 ++++++++-------------- apps/openmw/mwgui/window_pinnable_base.hpp | 2 +- files/mygui/openmw_windows.skin.xml | 4 +--- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/apps/openmw/mwgui/window_pinnable_base.cpp b/apps/openmw/mwgui/window_pinnable_base.cpp index 781c427ef4..651b3a1e98 100644 --- a/apps/openmw/mwgui/window_pinnable_base.cpp +++ b/apps/openmw/mwgui/window_pinnable_base.cpp @@ -9,26 +9,20 @@ using namespace MWGui; WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager) : WindowBase(parLayout, parWindowManager), mPinned(false), mVisible(false) { - MyGUI::WindowPtr t = static_cast(mMainWidget); - t->eventWindowButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onWindowButtonPressed); - ExposedWindow* window = static_cast(mMainWidget); mPinButton = window->getSkinWidget ("Button"); + + mPinButton->eventMouseButtonClick += MyGUI::newDelegate(this, &WindowPinnableBase::onPinButtonClicked); } -void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName) +void WindowPinnableBase::onPinButtonClicked(MyGUI::Widget* _sender) { - if ("PinToggle" == eventName) - { - mPinned = !mPinned; + mPinned = !mPinned; - if (mPinned) - mPinButton->changeWidgetSkin ("PinDown"); - else - mPinButton->changeWidgetSkin ("PinUp"); + if (mPinned) + mPinButton->changeWidgetSkin ("PinDown"); + else + mPinButton->changeWidgetSkin ("PinUp"); - onPinToggled(); - } - - eventDone(this); + onPinToggled(); } diff --git a/apps/openmw/mwgui/window_pinnable_base.hpp b/apps/openmw/mwgui/window_pinnable_base.hpp index 7426b16fcf..50259858e2 100644 --- a/apps/openmw/mwgui/window_pinnable_base.hpp +++ b/apps/openmw/mwgui/window_pinnable_base.hpp @@ -14,7 +14,7 @@ namespace MWGui bool pinned() { return mPinned; } private: - void onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName); + void onPinButtonClicked(MyGUI::Widget* _sender); protected: virtual void onPinToggled() = 0; diff --git a/files/mygui/openmw_windows.skin.xml b/files/mygui/openmw_windows.skin.xml index 93aa8fd209..73f68e80dc 100644 --- a/files/mygui/openmw_windows.skin.xml +++ b/files/mygui/openmw_windows.skin.xml @@ -585,9 +585,7 @@ - - - + From f4749f10dadaf119fad8b3b85e0d74a23d72e781 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 20 Feb 2013 05:35:52 +0100 Subject: [PATCH 05/30] NIF bullet loader fix for incorrect collision shapes (credit goes to Chris, he asked me to push this) --- components/nifbullet/bullet_nif_loader.cpp | 134 ++++++--------------- components/nifbullet/bullet_nif_loader.hpp | 18 +-- 2 files changed, 46 insertions(+), 106 deletions(-) diff --git a/components/nifbullet/bullet_nif_loader.cpp b/components/nifbullet/bullet_nif_loader.cpp index 9c6dafa34a..a619bdda23 100644 --- a/components/nifbullet/bullet_nif_loader.cpp +++ b/components/nifbullet/bullet_nif_loader.cpp @@ -43,25 +43,14 @@ http://www.gnu.org/licenses/ . typedef unsigned char ubyte; -using namespace NifBullet; - +namespace NifBullet +{ ManualBulletShapeLoader::~ManualBulletShapeLoader() { } -btQuaternion ManualBulletShapeLoader::getbtQuat(Ogre::Matrix3 const &m) -{ - Ogre::Quaternion oquat(m); - btQuaternion quat; - quat.setW(oquat.w); - quat.setX(oquat.x); - quat.setY(oquat.y); - quat.setZ(oquat.z); - return quat; -} - btVector3 ManualBulletShapeLoader::getbtVector(Ogre::Vector3 const &v) { return btVector3(v[0], v[1], v[2]); @@ -90,7 +79,6 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource) return; } - // The first record is assumed to be the root node Nif::Record *r = nif.getRecord(0); assert(r != NULL); @@ -106,13 +94,11 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource) bool hasCollisionNode = hasRootCollisionNode(node); //do a first pass - handleNode(node,0,NULL,hasCollisionNode,false,false); + handleNode(node,0,hasCollisionNode,false,false); //if collide = false, then it does a second pass which create a shape for raycasting. if(cShape->mCollide == false) - { - handleNode(node,0,NULL,hasCollisionNode,false,true); - } + handleNode(node,0,hasCollisionNode,false,true); //cShape->collide = hasCollisionNode&&cShape->collide; @@ -129,9 +115,9 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource) delete m_meshInterface; } }; + if(mBoundingBox != NULL) cShape->Shape = mBoundingBox; - else { currentShape = new TriangleMeshShape(mTriMesh,true); @@ -141,34 +127,30 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource) bool ManualBulletShapeLoader::hasRootCollisionNode(Nif::Node const * node) { - if (node->recType == Nif::RC_NiNode) + if(node->recType == Nif::RC_RootCollisionNode) + return true; + + const Nif::NiNode *ninode = dynamic_cast(node); + if(ninode) { - Nif::NodeList &list = ((Nif::NiNode*)node)->children; - int n = list.length(); - for (int i=0; ichildren; + for(size_t i = 0;i < list.length();i++) { - if (!list[i].empty()) + if(!list[i].empty()) { - if(hasRootCollisionNode(list[i].getPtr())) return true;; + if(hasRootCollisionNode(list[i].getPtr())) + return true; } } } - else if (node->recType == Nif::RC_NiTriShape) - { - return false; - } - else if(node->recType == Nif::RC_RootCollisionNode) - { - return true; - } return false; } -void ManualBulletShapeLoader::handleNode(Nif::Node const *node, int flags, - const Nif::Transformation *parentTrafo,bool hasCollisionNode,bool isCollisionNode,bool raycastingOnly) +void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags, + bool hasCollisionNode, bool isCollisionNode, + bool raycastingOnly) { - // Accumulate the flags from all the child nodes. This works for all // the flags we currently use, at least. flags |= node->flags; @@ -209,70 +191,36 @@ void ManualBulletShapeLoader::handleNode(Nif::Node const *node, int flags, } } - Nif::Transformation childTrafo = node->trafo; - - if (parentTrafo) - { - - // Get a non-const reference to the node's data, since we're - // overwriting it. TODO: Is this necessary? - - // For both position and rotation we have that: - // final_vector = old_vector + old_rotation*new_vector*old_scale - childTrafo.pos = parentTrafo->pos + parentTrafo->rotation*childTrafo.pos*parentTrafo->scale; - - // Merge the rotations together - childTrafo.rotation = parentTrafo->rotation * childTrafo.rotation; - - // Scale - childTrafo.scale *= parentTrafo->scale; - - } - if(node->hasBounds) { - - - btVector3 boxsize = getbtVector(node->boundXYZ); cShape->boxTranslation = node->boundPos; cShape->boxRotation = node->boundRot; - - mBoundingBox = new btBoxShape(boxsize); + mBoundingBox = new btBoxShape(getbtVector(node->boundXYZ)); } - - // For NiNodes, loop through children - if (node->recType == Nif::RC_NiNode) - { - Nif::NodeList const &list = ((Nif::NiNode const *)node)->children; - int n = list.length(); - for (int i=0; irecType == Nif::RC_NiTriShape && (isCollisionNode || !hasCollisionNode)) + if(node->recType == Nif::RC_NiTriShape && (isCollisionNode || !hasCollisionNode)) { cShape->mCollide = !(flags&0x800); - handleNiTriShape(dynamic_cast(node), flags,childTrafo.rotation,childTrafo.pos,childTrafo.scale,raycastingOnly); + handleNiTriShape(static_cast(node), flags, node->getWorldTransform(), raycastingOnly); } - else if(node->recType == Nif::RC_RootCollisionNode) + + // For NiNodes, loop through children + const Nif::NiNode *ninode = dynamic_cast(node); + if(ninode) { - Nif::NodeList &list = ((Nif::NiNode*)node)->children; - int n = list.length(); - for (int i=0; irecType == Nif::RC_RootCollisionNode); + + const Nif::NodeList &list = ninode->children; + for(size_t i = 0;i < list.length();i++) { - if (!list[i].empty()) - handleNode(list[i].getPtr(), flags,&childTrafo, hasCollisionNode,true,raycastingOnly); + if(!list[i].empty()) + handleNode(list[i].getPtr(), flags, hasCollisionNode, isCollisionNode, raycastingOnly); } } } -void ManualBulletShapeLoader::handleNiTriShape(Nif::NiTriShape const *shape, int flags,Ogre::Matrix3 parentRot,Ogre::Vector3 parentPos,float parentScale, - bool raycastingOnly) +void ManualBulletShapeLoader::handleNiTriShape(const Nif::NiTriShape *shape, int flags, const Ogre::Matrix4 &transform, + bool raycastingOnly) { assert(shape != NULL); @@ -296,18 +244,14 @@ void ManualBulletShapeLoader::handleNiTriShape(Nif::NiTriShape const *shape, int return; - Nif::NiTriShapeData *data = shape->data.getPtr(); - + const Nif::NiTriShapeData *data = shape->data.getPtr(); const std::vector &vertices = data->vertices; - const Ogre::Matrix3 &rot = shape->trafo.rotation; - const Ogre::Vector3 &pos = shape->trafo.pos; - float scale = shape->trafo.scale * parentScale; - short* triangles = &data->triangles[0]; + const short *triangles = &data->triangles[0]; for(size_t i = 0;i < data->triangles.size();i+=3) { - Ogre::Vector3 b1 = pos + rot*vertices[triangles[i+0]]*scale; - Ogre::Vector3 b2 = pos + rot*vertices[triangles[i+1]]*scale; - Ogre::Vector3 b3 = pos + rot*vertices[triangles[i+2]]*scale; + Ogre::Vector3 b1 = transform*vertices[triangles[i+0]]; + Ogre::Vector3 b2 = transform*vertices[triangles[i+1]]; + Ogre::Vector3 b3 = transform*vertices[triangles[i+2]]; mTriMesh->addTriangle(btVector3(b1.x,b1.y,b1.z),btVector3(b2.x,b2.y,b2.z),btVector3(b3.x,b3.y,b3.z)); } } @@ -320,3 +264,5 @@ void ManualBulletShapeLoader::load(const std::string &name,const std::string &gr return; OEngine::Physic::BulletShapeManager::getSingleton().create(name,group,true,this); } + +} // namespace NifBullet diff --git a/components/nifbullet/bullet_nif_loader.hpp b/components/nifbullet/bullet_nif_loader.hpp index 520878ce1c..0629b208de 100644 --- a/components/nifbullet/bullet_nif_loader.hpp +++ b/components/nifbullet/bullet_nif_loader.hpp @@ -51,19 +51,18 @@ namespace NifBullet class ManualBulletShapeLoader : public OEngine::Physic::BulletShapeLoader { public: - ManualBulletShapeLoader():resourceGroup("General"){} virtual ~ManualBulletShapeLoader(); - void warn(std::string msg) + void warn(const std::string &msg) { std::cerr << "NIFLoader: Warn:" << msg << "\n"; } - void fail(std::string msg) + void fail(const std::string &msg) { std::cerr << "NIFLoader: Fail: "<< msg << std::endl; - assert(1); + abort(); } /** @@ -79,31 +78,26 @@ public: void load(const std::string &name,const std::string &group); private: - btQuaternion getbtQuat(Ogre::Matrix3 const &m); - btVector3 getbtVector(Ogre::Vector3 const &v); /** *Parse a node. */ - void handleNode(Nif::Node const *node, int flags, - const Nif::Transformation *trafo, bool hasCollisionNode,bool isCollisionNode,bool raycastingOnly); + void handleNode(Nif::Node const *node, int flags, bool hasCollisionNode, bool isCollisionNode, bool raycastingOnly); /** *Helper function */ - bool hasRootCollisionNode(Nif::Node const * node); + bool hasRootCollisionNode(const Nif::Node *node); /** *convert a NiTriShape to a bullet trishape. */ - void handleNiTriShape(Nif::NiTriShape const *shape, int flags,Ogre::Matrix3 parentRot,Ogre::Vector3 parentPos,float parentScales,bool raycastingOnly); + void handleNiTriShape(const Nif::NiTriShape *shape, int flags, const Ogre::Matrix4 &transform, bool raycastingOnly); std::string resourceName; std::string resourceGroup; - - OEngine::Physic::BulletShape* cShape;//current shape btTriangleMesh *mTriMesh; btBoxShape *mBoundingBox; From ccf5c04706100de9a163b75ec1a4612f5cfcb29c Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 21 Feb 2013 12:10:56 +0100 Subject: [PATCH 06/30] updated credits files --- credits.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/credits.txt b/credits.txt index 936f3efd9b..5c966d86b2 100644 --- a/credits.txt +++ b/credits.txt @@ -16,6 +16,7 @@ Alexander Olofsson (Ace) Artem Kotsynyak (greye) athile BrotherBrick +Chris Robinson Cory F. Cohen (cfcohen) Cris Mihalache (Mirceam) Douglas Diniz (Dgdiniz) From 56468eaecf475a14c60c8975149281e656878b3b Mon Sep 17 00:00:00 2001 From: hasufell Date: Thu, 21 Feb 2013 19:19:53 +0100 Subject: [PATCH 07/30] Add install rule for opencs --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfd1c7dd39..0ef85e34dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -660,6 +660,7 @@ if (NOT WIN32 AND NOT DPKG_PROGRAM AND NOT APPLE) INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/omwlauncher" DESTINATION "${BINDIR}" ) INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/esmtool" DESTINATION "${BINDIR}" ) INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/mwiniimport" DESTINATION "${BINDIR}" ) + INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/opencs" DESTINATION "${BINDIR}" ) # Install icon and .desktop INSTALL(FILES "${OpenMW_SOURCE_DIR}/apps/launcher/resources/images/openmw.png" DESTINATION "${ICONDIR}") From 9b7957cf20c12c82c62c4dc7575376dd363d4c83 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 21 Feb 2013 19:27:07 +0100 Subject: [PATCH 08/30] fixed a missing inlcude --- components/bsa/bsa_file.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/bsa/bsa_file.cpp b/components/bsa/bsa_file.cpp index 5e529e18e8..8db4fa8888 100644 --- a/components/bsa/bsa_file.cpp +++ b/components/bsa/bsa_file.cpp @@ -23,9 +23,7 @@ #include "bsa_file.hpp" -//#include -//#include -//#include +#include #include "../files/constrainedfiledatastream.hpp" From 82595e66b2eec8f02557d8d01162327ddaa2ef86 Mon Sep 17 00:00:00 2001 From: greye Date: Thu, 21 Feb 2013 22:47:18 +0400 Subject: [PATCH 09/30] another missing header for #576 --- components/nif/nif_file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/nif/nif_file.cpp b/components/nif/nif_file.cpp index e6d3182eda..58d1bc9b85 100644 --- a/components/nif/nif_file.cpp +++ b/components/nif/nif_file.cpp @@ -37,7 +37,7 @@ //TODO: when threading is needed, enable these //#include -//#include +#include namespace Nif { From 71e5369f0457f4313be33c055886334f4ca59a07 Mon Sep 17 00:00:00 2001 From: lazydev Date: Fri, 22 Feb 2013 02:18:54 +0400 Subject: [PATCH 10/30] Loading translation data for all the plugin files, not only for the first one --- apps/openmw/engine.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index cb93968638..48206ba237 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -215,7 +215,7 @@ void OMW::Engine::addMaster (const std::string& master) { mMaster.push_back(master); std::string &str = mMaster.back(); - + // Append .esm if not already there std::string::size_type sep = str.find_last_of ("."); if (sep == std::string::npos) @@ -303,7 +303,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) } mOgre = new OEngine::Render::OgreRenderer; - + mOgre->configure( mCfgMgr.getLogPath().string(), renderSystem, @@ -345,7 +345,8 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) //Load translation data mTranslationDataStorage.setEncoder(mEncoder); - mTranslationDataStorage.loadTranslationData(mFileCollections, mMaster[0]); + for (size_t i = 0; i < mMaster.size(); i++) + mTranslationDataStorage.loadTranslationData(mFileCollections, mMaster[i]); // Create window manager - this manages all the MW-specific GUI windows MWScript::registerExtensions (mExtensions); From 5e1ec9e128599ee95664799f871122e9db745eff Mon Sep 17 00:00:00 2001 From: Nathan Jeffords Date: Fri, 22 Feb 2013 08:27:00 -0800 Subject: [PATCH 11/30] improved book window layout --- files/mygui/openmw_book.layout | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/files/mygui/openmw_book.layout b/files/mygui/openmw_book.layout index 894c1dbeb7..96d1153f0e 100644 --- a/files/mygui/openmw_book.layout +++ b/files/mygui/openmw_book.layout @@ -2,41 +2,45 @@ - + - + + - + + - + - + + - + - + + - + - + - - + + From 6f89d453a5213a04eab4c168d495ea71e838a082 Mon Sep 17 00:00:00 2001 From: graffy76 Date: Fri, 22 Feb 2013 21:53:32 -0600 Subject: [PATCH 12/30] Operations widget height fix and abort button feature. Successfully tested resizing of Operations QDockWidget for multiple concurrent operations. --- apps/opencs/model/doc/document.cpp | 3 +- apps/opencs/view/doc/operation.cpp | 55 ++++++++++++++++++++++------ apps/opencs/view/doc/operation.hpp | 24 ++++++++++-- apps/opencs/view/doc/operations.cpp | 34 +++++++++++++---- apps/opencs/view/doc/operations.hpp | 6 ++- apps/opencs/view/doc/subview.cpp | 1 - apps/opencs/view/doc/view.cpp | 29 ++++++++++++--- apps/opencs/view/doc/view.hpp | 10 ++++- apps/opencs/view/doc/viewmanager.cpp | 6 ++- 9 files changed, 132 insertions(+), 36 deletions(-) diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index da29f6c687..d63aaeccb2 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -249,6 +249,7 @@ void CSMDoc::Document::abortOperation (int type) if (type==State_Saving) { + mSaveCount=0; mSaveTimer.stop(); emit stateChanged (getState(), this); } @@ -297,4 +298,4 @@ CSMTools::ReportModel *CSMDoc::Document::getReport (const CSMWorld::UniversalId& void CSMDoc::Document::progress (int current, int max, int type) { emit progress (current, max, type, 1, this); -} \ No newline at end of file +} diff --git a/apps/opencs/view/doc/operation.cpp b/apps/opencs/view/doc/operation.cpp index c301195bc7..6977d79535 100644 --- a/apps/opencs/view/doc/operation.cpp +++ b/apps/opencs/view/doc/operation.cpp @@ -1,8 +1,11 @@ - #include "operation.hpp" #include +#include +#include +#include + #include "../../model/doc/document.hpp" void CSVDoc::Operation::updateLabel (int threads) @@ -28,24 +31,44 @@ void CSVDoc::Operation::updateLabel (int threads) stream << name << " (%p%)"; } - setFormat (stream.str().c_str()); + mProgressBar->setFormat (stream.str().c_str()); } } -CSVDoc::Operation::Operation (int type) : mType (type), mStalling (false) +CSVDoc::Operation::Operation (int type, QWidget* parent) : mType (type), mStalling (false) { /// \todo Add a cancel button or a pop up menu with a cancel item + initWidgets(); setBarColor( type); updateLabel(); /// \todo assign different progress bar colours to allow the user to distinguish easily between operation types } +CSVDoc::Operation::~Operation() +{ + delete mLayout; + delete mProgressBar; + delete mAbortButton; +} + +void CSVDoc::Operation::initWidgets() +{ + mProgressBar = new QProgressBar (); + mAbortButton = new QPushButton("Abort"); + mLayout = new QHBoxLayout(); + + mLayout->addWidget (mProgressBar); + mLayout->addWidget (mAbortButton); + + connect (mAbortButton, SIGNAL (clicked()), this, SLOT (abortOperation())); +} + void CSVDoc::Operation::setProgress (int current, int max, int threads) { updateLabel (threads); - setRange (0, max); - setValue (current); + mProgressBar->setRange (0, max); + mProgressBar->setValue (current); } int CSVDoc::Operation::getType() const @@ -64,8 +87,6 @@ void CSVDoc::Operation::setBarColor (int type) "margin: 2px 1px 1p 2px;" "}"; - // "QProgressBar::chunk {background-color: %1;}"; - QString topColor = "#F2F6F8"; QString bottomColor = "#E0EFF9"; QString midTopColor = "#D8E1E7"; @@ -82,7 +103,7 @@ void CSVDoc::Operation::setBarColor (int type) midTopColor = "#F17432"; midBottomColor = "#EA5507"; bottomColor = "#FB955E"; // red gloss #2 - //break; + break; case CSMDoc::State_Searching: @@ -90,7 +111,7 @@ void CSVDoc::Operation::setBarColor (int type) midTopColor = "#ABD3EE"; midBottomColor = "#89C3EB"; bottomColor = "#D5EBFB"; //blue gloss #4 - //break; + break; case CSMDoc::State_Verifying: @@ -98,7 +119,7 @@ void CSVDoc::Operation::setBarColor (int type) midTopColor = "#8EB92A"; midBottomColor = "#72AA00"; bottomColor = "#9ECB2D"; //green gloss - //break; + break; case CSMDoc::State_Compiling: @@ -106,7 +127,7 @@ void CSVDoc::Operation::setBarColor (int type) midTopColor = "#C19E67"; midBottomColor = "#B68D4C"; bottomColor = "#E9D4B3"; //l Brown 3D - //break; + break; default: @@ -116,5 +137,15 @@ void CSVDoc::Operation::setBarColor (int type) midBottomColor = "#B5C6D0"; // gray gloss for undefined ops } - setStyleSheet(style.arg(topColor).arg(midTopColor).arg(midBottomColor).arg(bottomColor)); + mProgressBar->setStyleSheet(style.arg(topColor).arg(midTopColor).arg(midBottomColor).arg(bottomColor)); +} + +QHBoxLayout *CSVDoc::Operation::getLayout() const +{ + return mLayout; +} + +void CSVDoc::Operation::abortOperation() +{ + emit abortOperation (mType); } diff --git a/apps/opencs/view/doc/operation.hpp b/apps/opencs/view/doc/operation.hpp index a5abf73b79..48839fada4 100644 --- a/apps/opencs/view/doc/operation.hpp +++ b/apps/opencs/view/doc/operation.hpp @@ -1,16 +1,23 @@ #ifndef CSV_DOC_OPERATION_H #define CSV_DOC_OPERATION_H -#include +#include + +class QHBoxLayout; +class QPushButton; +class QProgressBar; namespace CSVDoc { - class Operation : public QProgressBar + class Operation : public QObject { Q_OBJECT int mType; bool mStalling; + QProgressBar *mProgressBar; + QPushButton *mAbortButton; + QHBoxLayout *mLayout; // not implemented Operation (const Operation&); @@ -20,15 +27,26 @@ namespace CSVDoc public: - Operation (int type); + Operation (int type, QWidget *parent); + ~Operation(); void setProgress (int current, int max, int threads); int getType() const; + QHBoxLayout *getLayout() const; private: void setBarColor (int type); + void initWidgets(); + + signals: + + void abortOperation (int type); + + private slots: + + void abortOperation(); }; } diff --git a/apps/opencs/view/doc/operations.cpp b/apps/opencs/view/doc/operations.cpp index ba444a119a..71cacbe17e 100644 --- a/apps/opencs/view/doc/operations.cpp +++ b/apps/opencs/view/doc/operations.cpp @@ -1,7 +1,7 @@ - #include "operations.hpp" #include +#include #include "operation.hpp" @@ -11,12 +11,14 @@ CSVDoc::Operations::Operations() setFeatures (QDockWidget::NoDockWidgetFeatures); - QWidget *widget = new QWidget; - setWidget (widget); - + QWidget *widgetContainer = new QWidget (this); mLayout = new QVBoxLayout; - widget->setLayout (mLayout); + widgetContainer->setLayout (mLayout); + setWidget (widgetContainer); + + setFixedHeight (widgetContainer->height()); + setTitleBarWidget (new QWidget (this)); } void CSVDoc::Operations::setProgress (int current, int max, int type, int threads) @@ -28,11 +30,18 @@ void CSVDoc::Operations::setProgress (int current, int max, int type, int thread return; } - Operation *operation = new Operation (type); + int oldCount = mOperations.size(); + int newCount = oldCount + 1; - mLayout->addWidget (operation); + Operation *operation = new Operation (type, this); + connect (operation, SIGNAL (abortOperation (int)), this, SIGNAL (abortOperation (int))); + + mLayout->addLayout (operation->getLayout()); mOperations.push_back (operation); operation->setProgress (current, max, threads); + + if ( oldCount > 0) + setFixedHeight (height()/oldCount * newCount); } void CSVDoc::Operations::quitOperation (int type) @@ -40,8 +49,17 @@ void CSVDoc::Operations::quitOperation (int type) for (std::vector::iterator iter (mOperations.begin()); iter!=mOperations.end(); ++iter) if ((*iter)->getType()==type) { + int oldCount = mOperations.size(); + int newCount = oldCount - 1; + + mLayout->removeItem ((*iter)->getLayout()); + delete *iter; mOperations.erase (iter); + + if (oldCount > 1) + setFixedHeight (height() / oldCount * newCount); + break; } -} \ No newline at end of file +} diff --git a/apps/opencs/view/doc/operations.hpp b/apps/opencs/view/doc/operations.hpp index b966774502..71c595f66b 100644 --- a/apps/opencs/view/doc/operations.hpp +++ b/apps/opencs/view/doc/operations.hpp @@ -31,7 +31,11 @@ namespace CSVDoc void quitOperation (int type); ///< Calling this function for an operation that is not running is a no-op. + + signals: + + void abortOperation (int type); }; } -#endif \ No newline at end of file +#endif diff --git a/apps/opencs/view/doc/subview.cpp b/apps/opencs/view/doc/subview.cpp index 1c356fa736..affada0124 100644 --- a/apps/opencs/view/doc/subview.cpp +++ b/apps/opencs/view/doc/subview.cpp @@ -1,4 +1,3 @@ - #include "subview.hpp" CSVDoc::SubView::SubView (const CSMWorld::UniversalId& id) : mUniversalId (id) diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index 4fd03041f8..6aafef4ed0 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -1,4 +1,3 @@ - #include "view.hpp" #include @@ -7,6 +6,7 @@ #include #include #include +#include #include "../../model/doc/document.hpp" @@ -117,13 +117,16 @@ void CSVDoc::View::updateActions() mVerify->setEnabled (!(mDocument->getState() & CSMDoc::State_Verifying)); } -CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews) -: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews) +CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews, QMainWindow *viewParent) + : mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews), QMainWindow (viewParent) { setDockOptions (QMainWindow::AllowNestedDocks); resize (300, 300); /// \todo get default size from settings and set reasonable minimal size + mSubViewWindow = new QMainWindow(); + setCentralWidget (mSubViewWindow); + mOperations = new Operations; addDockWidget (Qt::BottomDockWidgetArea, mOperations); @@ -133,6 +136,8 @@ CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int to CSVWorld::addSubViewFactories (mSubViewFactory); CSVTools::addSubViewFactories (mSubViewFactory); + + connect (mOperations, SIGNAL (abortOperation (int)), this, SLOT (abortOperation (int))); } CSVDoc::View::~View() @@ -171,7 +176,7 @@ void CSVDoc::View::updateDocumentState() for (int i=0; operations[i]!=-1; ++i) if (!(state & operations[i])) - mOperations->quitOperation (operations[i]); + mOperations->quitOperation (operations[i]); QList subViews = findChildren(); @@ -195,7 +200,7 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id) /// \todo add an user setting to reuse sub views (on a per document basis or on a per top level view basis) SubView *view = mSubViewFactory.makeSubView (id, *mDocument); - addDockWidget (Qt::TopDockWidgetArea, view); + mSubViewWindow->addDockWidget (Qt::TopDockWidgetArea, view); connect (view, SIGNAL (focusId (const CSMWorld::UniversalId&)), this, SLOT (addSubView (const CSMWorld::UniversalId&))); @@ -226,4 +231,16 @@ void CSVDoc::View::addGlobalsSubView() void CSVDoc::View::addGmstsSubView() { addSubView (CSMWorld::UniversalId::Type_Gmsts); -} \ No newline at end of file +} + +void CSVDoc::View::abortOperation (int type) +{ + mDocument->abortOperation (type); + mOperations->quitOperation (type); + updateActions(); +} + +QDockWidget *CSVDoc::View::getOperations() const +{ + return mOperations; +} diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp index 6bdd54e6bf..28ab24b744 100644 --- a/apps/opencs/view/doc/view.hpp +++ b/apps/opencs/view/doc/view.hpp @@ -9,6 +9,7 @@ #include "subviewfactory.hpp" class QAction; +class QDockWidget; namespace CSMDoc { @@ -40,6 +41,7 @@ namespace CSVDoc std::vector mEditingActions; Operations *mOperations; SubViewFactoryManager mSubViewFactory; + QMainWindow* mSubViewWindow; // not implemented View (const View&); @@ -65,7 +67,7 @@ namespace CSVDoc public: - View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews); + View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews, QMainWindow *viewParent); ///< The ownership of \a document is not transferred to *this. virtual ~View(); @@ -80,6 +82,8 @@ namespace CSVDoc void updateProgress (int current, int max, int type, int threads); + QDockWidget *getOperations() const; + signals: void newDocumentRequest(); @@ -101,7 +105,9 @@ namespace CSVDoc void addGlobalsSubView(); void addGmstsSubView(); + + void abortOperation (int type); }; } -#endif \ No newline at end of file +#endif diff --git a/apps/opencs/view/doc/viewmanager.cpp b/apps/opencs/view/doc/viewmanager.cpp index 473049999c..a8faefb970 100644 --- a/apps/opencs/view/doc/viewmanager.cpp +++ b/apps/opencs/view/doc/viewmanager.cpp @@ -59,7 +59,9 @@ CSVDoc::View *CSVDoc::ViewManager::addView (CSMDoc::Document *document) this, SLOT (progress (int, int, int, int, CSMDoc::Document *))); } - View *view = new View (*this, document, countViews (document)+1); + QMainWindow *mainWindow = new QMainWindow; + + View *view = new View (*this, document, countViews (document)+1, mainWindow); mViews.push_back (view); @@ -119,4 +121,4 @@ void CSVDoc::ViewManager::progress (int current, int max, int type, int threads, for (std::vector::const_iterator iter (mViews.begin()); iter!=mViews.end(); ++iter) if ((*iter)->getDocument()==document) (*iter)->updateProgress (current, max, type, threads); -} \ No newline at end of file +} From c9ca565462b599356e1681bb769218eeda3da411 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 23 Feb 2013 12:05:09 +0100 Subject: [PATCH 13/30] removed a redundant function call --- apps/opencs/view/doc/view.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index 6aafef4ed0..286d7a6ed6 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -236,7 +236,6 @@ void CSVDoc::View::addGmstsSubView() void CSVDoc::View::abortOperation (int type) { mDocument->abortOperation (type); - mOperations->quitOperation (type); updateActions(); } From 6f5a772d02d886d3777de0b25f45db878f636aad Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 23 Feb 2013 12:35:05 +0100 Subject: [PATCH 14/30] fixed another case handling problem --- apps/opencs/model/world/idcollection.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/opencs/model/world/idcollection.hpp b/apps/opencs/model/world/idcollection.hpp index 5a1d21ae4c..9b69dfb889 100644 --- a/apps/opencs/model/world/idcollection.hpp +++ b/apps/opencs/model/world/idcollection.hpp @@ -171,7 +171,7 @@ namespace CSMWorld record2.mModified = record; mRecords.push_back (record2); - mIndex.insert (std::make_pair (id, mRecords.size()-1)); + mIndex.insert (std::make_pair (Misc::StringUtils::lowerCase (id), mRecords.size()-1)); } else { @@ -306,7 +306,7 @@ namespace CSMWorld void IdCollection::appendRecord (const RecordBase& record) { mRecords.push_back (dynamic_cast&> (record)); - mIndex.insert (std::make_pair (getId (record), mRecords.size()-1)); + mIndex.insert (std::make_pair (Misc::StringUtils::lowerCase (getId (record)), mRecords.size()-1)); } template From 868916a9a22d0dd9f8713b6ea57206d6ee689d52 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 23 Feb 2013 12:51:45 +0100 Subject: [PATCH 15/30] added add-on global variables in the same way add-on GMSTs were added --- apps/opencs/model/doc/document.cpp | 32 ++++++++++++++++++++++++++++++ apps/opencs/model/doc/document.hpp | 5 +++++ 2 files changed, 37 insertions(+) diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index d63aaeccb2..b361577bec 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -20,6 +20,7 @@ void CSMDoc::Document::load (const std::vector::const_i getData().loadFile (*end2, false); addOptionalGmsts(); + addOptionalGlobals(); } void CSMDoc::Document::addOptionalGmsts() @@ -139,6 +140,26 @@ void CSMDoc::Document::addOptionalGmsts() } } +void CSMDoc::Document::addOptionalGlobals() +{ + static const char *sGlobals[] = + { + "dayspassed", + "pcwerewolf", + "pcyear", + 0 + }; + + for (int i=0; sGlobals[i]; ++i) + { + ESM::Global global; + global.mId = sGlobals[i]; + global.mType = ESM::VT_Int; + global.mValue = 0; + addOptionalGlobal (global); + } +} + void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst) { if (getData().getGmsts().searchId (gmst.mId)==-1) @@ -150,6 +171,17 @@ void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst) } } +void CSMDoc::Document::addOptionalGlobal (const ESM::Global& global) +{ + if (getData().getGlobals().searchId (global.mId)==-1) + { + CSMWorld::Record record; + record.mBase = global; + record.mState = CSMWorld::RecordBase::State_BaseOnly; + getData().getGlobals().appendRecord (record); + } +} + void CSMDoc::Document::createBase() { static const char *sGlobals[] = diff --git a/apps/opencs/model/doc/document.hpp b/apps/opencs/model/doc/document.hpp index 413e840d37..a7b198689e 100644 --- a/apps/opencs/model/doc/document.hpp +++ b/apps/opencs/model/doc/document.hpp @@ -20,6 +20,7 @@ class QAbstractItemModel; namespace ESM { struct GameSetting; + struct Global; } namespace CSMDoc @@ -53,8 +54,12 @@ namespace CSMDoc void addOptionalGmsts(); + void addOptionalGlobals(); + void addOptionalGmst (const ESM::GameSetting& gmst); + void addOptionalGlobal (const ESM::Global& global); + public: Document (const std::vector& files, bool new_); From 9659b4a95e1d4bb40560046b288173ec54f07ab2 Mon Sep 17 00:00:00 2001 From: greye Date: Thu, 21 Feb 2013 23:56:34 +0400 Subject: [PATCH 16/30] update NpcAnimation inventory reference on cell change --- apps/openmw/mwrender/actors.cpp | 4 ++- apps/openmw/mwrender/npcanimation.cpp | 52 +++++++++++++-------------- apps/openmw/mwrender/npcanimation.hpp | 8 ++++- 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/apps/openmw/mwrender/actors.cpp b/apps/openmw/mwrender/actors.cpp index 92f5cbe28d..e886f3a093 100644 --- a/apps/openmw/mwrender/actors.cpp +++ b/apps/openmw/mwrender/actors.cpp @@ -163,7 +163,9 @@ void Actors::updateObjectCell(const MWWorld::Ptr &ptr) { /// \note Update key (Ptr's are compared only with refdata so mCell /// on key is outdated), maybe redundant - Animation *anim = iter->second; + NpcAnimation *anim = static_cast(iter->second); + anim->updateParts(MWWorld::Class::get(ptr).getInventoryStore(ptr)); + mAllActors.erase(iter); mAllActors[ptr] = anim; } diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index d33bdda91d..6f6c9e740f 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -48,21 +48,21 @@ NpcAnimation::~NpcAnimation() NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWorld::InventoryStore& inv, int visibilityFlags) : Animation(), mStateID(-1), - mInv(inv), + mInv(&inv), mTimeToChange(0), mVisibilityFlags(visibilityFlags), - mRobe(mInv.end()), - mHelmet(mInv.end()), - mShirt(mInv.end()), - mCuirass(mInv.end()), - mGreaves(mInv.end()), - mPauldronL(mInv.end()), - mPauldronR(mInv.end()), - mBoots(mInv.end()), - mPants(mInv.end()), - mGloveL(mInv.end()), - mGloveR(mInv.end()), - mSkirtIter(mInv.end()) + mRobe(mInv->end()), + mHelmet(mInv->end()), + mShirt(mInv->end()), + mCuirass(mInv->end()), + mGreaves(mInv->end()), + mPauldronL(mInv->end()), + mPauldronR(mInv->end()), + mBoots(mInv->end()), + mPants(mInv->end()), + mGloveL(mInv->end()), + mGloveR(mInv->end()), + mSkirtIter(mInv->end()) { mNpc = ptr.get()->mBase; @@ -160,7 +160,7 @@ void NpcAnimation::updateParts() }; for(size_t i = 0;i < sizeof(slotlist)/sizeof(slotlist[0]);i++) { - MWWorld::ContainerStoreIterator iter = mInv.getSlot(slotlist[i].slot); + MWWorld::ContainerStoreIterator iter = mInv->getSlot(slotlist[i].slot); if(*slotlist[i].iter != iter) { *slotlist[i].iter = iter; @@ -171,7 +171,7 @@ void NpcAnimation::updateParts() if(apparelChanged) { - if(mRobe != mInv.end()) + if(mRobe != mInv->end()) { MWWorld::Ptr ptr = *mRobe; @@ -191,7 +191,7 @@ void NpcAnimation::updateParts() reserveIndividualPart(ESM::PRT_RPauldron, MWWorld::InventoryStore::Slot_Robe, 5); reserveIndividualPart(ESM::PRT_LPauldron, MWWorld::InventoryStore::Slot_Robe, 5); } - if(mSkirtIter != mInv.end()) + if(mSkirtIter != mInv->end()) { MWWorld::Ptr ptr = *mSkirtIter; @@ -203,39 +203,39 @@ void NpcAnimation::updateParts() reserveIndividualPart(ESM::PRT_LLeg, MWWorld::InventoryStore::Slot_Skirt, 4); } - if(mHelmet != mInv.end()) + if(mHelmet != mInv->end()) { removeIndividualPart(ESM::PRT_Hair); const ESM::Armor *armor = (mHelmet->get())->mBase; std::vector parts = armor->mParts.mParts; addPartGroup(MWWorld::InventoryStore::Slot_Helmet, 3, parts); } - if(mCuirass != mInv.end()) + if(mCuirass != mInv->end()) { const ESM::Armor *armor = (mCuirass->get())->mBase; std::vector parts = armor->mParts.mParts; addPartGroup(MWWorld::InventoryStore::Slot_Cuirass, 3, parts); } - if(mGreaves != mInv.end()) + if(mGreaves != mInv->end()) { const ESM::Armor *armor = (mGreaves->get())->mBase; std::vector parts = armor->mParts.mParts; addPartGroup(MWWorld::InventoryStore::Slot_Greaves, 3, parts); } - if(mPauldronL != mInv.end()) + if(mPauldronL != mInv->end()) { const ESM::Armor *armor = (mPauldronL->get())->mBase; std::vector parts = armor->mParts.mParts; addPartGroup(MWWorld::InventoryStore::Slot_LeftPauldron, 3, parts); } - if(mPauldronR != mInv.end()) + if(mPauldronR != mInv->end()) { const ESM::Armor *armor = (mPauldronR->get())->mBase; std::vector parts = armor->mParts.mParts; addPartGroup(MWWorld::InventoryStore::Slot_RightPauldron, 3, parts); } - if(mBoots != mInv.end()) + if(mBoots != mInv->end()) { if(mBoots->getTypeName() == typeid(ESM::Clothing).name()) { @@ -250,7 +250,7 @@ void NpcAnimation::updateParts() addPartGroup(MWWorld::InventoryStore::Slot_Boots, 3, parts); } } - if(mGloveL != mInv.end()) + if(mGloveL != mInv->end()) { if(mGloveL->getTypeName() == typeid(ESM::Clothing).name()) { @@ -265,7 +265,7 @@ void NpcAnimation::updateParts() addPartGroup(MWWorld::InventoryStore::Slot_LeftGauntlet, 3, parts); } } - if(mGloveR != mInv.end()) + if(mGloveR != mInv->end()) { if(mGloveR->getTypeName() == typeid(ESM::Clothing).name()) { @@ -282,13 +282,13 @@ void NpcAnimation::updateParts() } - if(mShirt != mInv.end()) + if(mShirt != mInv->end()) { const ESM::Clothing *clothes = (mShirt->get())->mBase; std::vector parts = clothes->mParts.mParts; addPartGroup(MWWorld::InventoryStore::Slot_Shirt, 2, parts); } - if(mPants != mInv.end()) + if(mPants != mInv->end()) { const ESM::Clothing *clothes = (mPants->get())->mBase; std::vector parts = clothes->mParts.mParts; diff --git a/apps/openmw/mwrender/npcanimation.hpp b/apps/openmw/mwrender/npcanimation.hpp index ca76dcc222..fd1a96aa3e 100644 --- a/apps/openmw/mwrender/npcanimation.hpp +++ b/apps/openmw/mwrender/npcanimation.hpp @@ -17,7 +17,7 @@ namespace MWRender{ class NpcAnimation: public Animation{ private: - MWWorld::InventoryStore& mInv; + MWWorld::InventoryStore *mInv; int mStateID; int mPartslots[27]; //Each part slot is taken by clothing, armor, or is empty @@ -78,7 +78,13 @@ public: virtual ~NpcAnimation(); NifOgre::EntityList insertBoundedPart(const std::string &mesh, int group, const std::string &bonename); virtual void runAnimation(float timepassed); + void updateParts(); + void updateParts(MWWorld::InventoryStore &inventory) { + mInv = &inventory; + updateParts(); + } + void removeEntities(NifOgre::EntityList &entities); void removeIndividualPart(int type); void reserveIndividualPart(int type, int group, int priority); From d983ed5c7819046ad4c0166c61f6cc47575196f7 Mon Sep 17 00:00:00 2001 From: greye Date: Fri, 22 Feb 2013 11:14:14 +0400 Subject: [PATCH 17/30] fix invalid SceneNode pointer on cell change --- apps/openmw/mwworld/worldimp.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index ca054e776b..12193de408 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -746,7 +746,11 @@ namespace MWWorld copyObjectToCell(ptr, newCell, pos); else if (!mWorldScene->isCellActive(newCell)) { - MWWorld::Class::get(ptr).copyToCell(ptr, newCell); + MWWorld::Class::get(ptr) + .copyToCell(ptr, newCell) + .getRefData() + .setBaseNode(0); + mWorldScene->removeObjectFromScene(ptr); mLocalScripts.remove(ptr); removeContainerScripts (ptr); From ac7095537f9626f62ee9437b241371356b92526e Mon Sep 17 00:00:00 2001 From: greye Date: Sat, 23 Feb 2013 16:50:37 +0400 Subject: [PATCH 18/30] remove insertMesh() call on object cell change --- apps/openmw/mwrender/objects.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index ee36126f8d..16ac163ecc 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -514,9 +514,5 @@ void Objects::updateObjectCell(const MWWorld::Ptr &ptr) node = mCellSceneNodes[newCell]; } node->addChild(ptr.getRefData().getBaseNode()); - - /// \note Still unaware how to move aabb and static w/o full rebuild, - /// moving static objects may cause problems - insertMesh(ptr, MWWorld::Class::get(ptr).getModel(ptr)); } From a3adcf752d9796279f175d7fbd01080ac53b227f Mon Sep 17 00:00:00 2001 From: Sergey Shambir Date: Fri, 22 Feb 2013 21:33:23 +0400 Subject: [PATCH 19/30] TradeWindow: fixed coding style Mentioned here: https://github.com/zinnschlag/openmw/pull/554 --- apps/openmw/mwgui/tradewindow.cpp | 12 ++++++------ apps/openmw/mwgui/tradewindow.hpp | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index 2cc8ff4443..290310760e 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -19,11 +19,11 @@ #include "inventorywindow.hpp" -static const float BALANCE_CHANGE_INITIAL_PAUSE = 0.5; // in seconds -static const float BALANCE_CHANGE_INTERVAL = 0.1; // in seconds - namespace MWGui { + const float TradeWindow::sBalanceChangeInitialPause = 0.5; + const float TradeWindow::sBalanceChangeInterval = 0.1; + TradeWindow::TradeWindow(MWBase::WindowManager& parWindowManager) : WindowBase("openmw_trade_window.layout", parWindowManager) , ContainerBase(NULL) // no drag&drop @@ -157,7 +157,7 @@ namespace MWGui mBalanceChangePause -= frameDuration; if (mBalanceChangePause < 0.0) { - mBalanceChangePause += BALANCE_CHANGE_INTERVAL; + mBalanceChangePause += sBalanceChangeInterval; if (mBalanceButtonsState == BBS_Increase) onIncreaseButtonTriggered(); else if (mBalanceButtonsState == BBS_Decrease) @@ -296,14 +296,14 @@ namespace MWGui void TradeWindow::onIncreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id) { mBalanceButtonsState = BBS_Increase; - mBalanceChangePause = BALANCE_CHANGE_INITIAL_PAUSE; + mBalanceChangePause = sBalanceChangeInitialPause; onIncreaseButtonTriggered(); } void TradeWindow::onDecreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id) { mBalanceButtonsState = BBS_Decrease; - mBalanceChangePause = BALANCE_CHANGE_INITIAL_PAUSE; + mBalanceChangePause = sBalanceChangeInitialPause; onDecreaseButtonTriggered(); } diff --git a/apps/openmw/mwgui/tradewindow.hpp b/apps/openmw/mwgui/tradewindow.hpp index 20d9b60691..c1d31917ba 100644 --- a/apps/openmw/mwgui/tradewindow.hpp +++ b/apps/openmw/mwgui/tradewindow.hpp @@ -37,6 +37,9 @@ namespace MWGui void onFrame(float frameDuration); protected: + static const float sBalanceChangeInitialPause; // in seconds + static const float sBalanceChangeInterval; // in seconds + MyGUI::Button* mFilterAll; MyGUI::Button* mFilterWeapon; MyGUI::Button* mFilterApparel; From 3472a6f180e81ab510026b4b96760adf4d145181 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 23 Feb 2013 14:40:56 +0100 Subject: [PATCH 20/30] workaround for infinite recursion during local variable access --- apps/openmw/mwscript/scriptmanagerimp.cpp | 42 +++++++++++++++-------- apps/openmw/mwscript/scriptmanagerimp.hpp | 1 + 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/apps/openmw/mwscript/scriptmanagerimp.cpp b/apps/openmw/mwscript/scriptmanagerimp.cpp index 1f338edbd3..e8489e3cd0 100644 --- a/apps/openmw/mwscript/scriptmanagerimp.cpp +++ b/apps/openmw/mwscript/scriptmanagerimp.cpp @@ -140,25 +140,37 @@ namespace MWScript Compiler::Locals& ScriptManager::getLocals (const std::string& name) { - ScriptCollection::iterator iter = mScripts.find (name); - - if (iter==mScripts.end()) { - if (!compile (name)) - { - /// \todo Handle case of cyclic member variable access. Currently this could look up - /// the whole application in an endless recursion. + ScriptCollection::iterator iter = mScripts.find (name); - // failed -> ignore script from now on. - std::vector empty; - mScripts.insert (std::make_pair (name, std::make_pair (empty, Compiler::Locals()))); - throw std::runtime_error ("failed to compile script " + name); - } - - iter = mScripts.find (name); + if (iter!=mScripts.end()) + return iter->second.second; } - return iter->second.second; + { + std::map::iterator iter = mOtherLocals.find (name); + + if (iter!=mOtherLocals.end()) + return iter->second; + } + + Compiler::Locals locals; + + if (const ESM::Script *script = mStore.get().find (name)) + { + int index = 0; + + for (int i=0; imData.mNumShorts; ++i) + locals.declare ('s', script->mVarNames[index++]); + + for (int i=0; imData.mNumLongs; ++i) + locals.declare ('l', script->mVarNames[index++]); + + for (int i=0; imData.mNumFloats; ++i) + locals.declare ('f', script->mVarNames[index++]); + } + + throw std::logic_error ("script " + name + " does not exist"); } GlobalScripts& ScriptManager::getGlobalScripts() diff --git a/apps/openmw/mwscript/scriptmanagerimp.hpp b/apps/openmw/mwscript/scriptmanagerimp.hpp index c4a016eb79..1a856e0c58 100644 --- a/apps/openmw/mwscript/scriptmanagerimp.hpp +++ b/apps/openmw/mwscript/scriptmanagerimp.hpp @@ -47,6 +47,7 @@ namespace MWScript ScriptCollection mScripts; GlobalScripts mGlobalScripts; + std::map mOtherLocals; public: From 89dace3cc3bea36c7fec02b7b5bba629ab5e8e89 Mon Sep 17 00:00:00 2001 From: graffy76 Date: Sat, 23 Feb 2013 09:07:13 -0600 Subject: [PATCH 21/30] Fix for operations widget - hides when no operations are running. --- apps/opencs/view/doc/operations.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/opencs/view/doc/operations.cpp b/apps/opencs/view/doc/operations.cpp index 71cacbe17e..ce001afaa9 100644 --- a/apps/opencs/view/doc/operations.cpp +++ b/apps/opencs/view/doc/operations.cpp @@ -16,7 +16,7 @@ CSVDoc::Operations::Operations() widgetContainer->setLayout (mLayout); setWidget (widgetContainer); - + setVisible (false); setFixedHeight (widgetContainer->height()); setTitleBarWidget (new QWidget (this)); } @@ -42,6 +42,8 @@ void CSVDoc::Operations::setProgress (int current, int max, int type, int thread if ( oldCount > 0) setFixedHeight (height()/oldCount * newCount); + + setVisible (true); } void CSVDoc::Operations::quitOperation (int type) @@ -59,6 +61,8 @@ void CSVDoc::Operations::quitOperation (int type) if (oldCount > 1) setFixedHeight (height() / oldCount * newCount); + else + setVisible (false); break; } From 61fc8ad6e4bed33473c891b3268d91bc2168a56e Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 23 Feb 2013 18:56:07 +0100 Subject: [PATCH 22/30] updated credits files --- credits.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/credits.txt b/credits.txt index 5c966d86b2..8b396aad0a 100644 --- a/credits.txt +++ b/credits.txt @@ -40,6 +40,7 @@ Nikolay Kasyanov (corristo) Pieter van der Kloet (pvdk) Roman Melnik (Kromgart) Sebastian Wick (swick) +Sergey Shambir Sylvain T. (Garvek) Tom Mason (wheybags) From 44b1c66c4b1a976024ac1f664793d80737cd27ce Mon Sep 17 00:00:00 2001 From: Nathan Jeffords Date: Thu, 14 Feb 2013 21:38:27 -0800 Subject: [PATCH 23/30] fixed various warnings about converting size_t to int --- apps/openmw/mwworld/scene.cpp | 2 +- apps/openmw/mwworld/store.hpp | 16 ++++++++-------- components/esm/esmwriter.cpp | 10 +++++----- components/esm/esmwriter.hpp | 8 ++++---- components/to_utf8/to_utf8.cpp | 4 ++-- components/to_utf8/to_utf8.hpp | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index b917a89168..254e05e7f6 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -25,7 +25,7 @@ namespace const MWWorld::Class& class_ = MWWorld::Class::get (MWWorld::Ptr (&*cellRefList.mList.begin(), &cell)); - int numRefs = cellRefList.mList.size(); + size_t numRefs = cellRefList.mList.size(); int current = 0; for (typename T::List::iterator it = cellRefList.mList.begin(); it != cellRefList.mList.end(); it++) diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index cb18873cc4..c05e372838 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -17,7 +17,7 @@ namespace MWWorld virtual void setUp() {} virtual void listIdentifier(std::vector &list) const {} - virtual int getSize() const = 0; + virtual size_t getSize() const = 0; virtual void load(ESM::ESMReader &esm, const std::string &id) = 0; virtual bool eraseStatic(const std::string &id) {return false;} @@ -158,7 +158,7 @@ namespace MWWorld return mShared.end(); } - int getSize() const { + size_t getSize() const { return mShared.size(); } @@ -269,11 +269,11 @@ namespace MWWorld return ptr; } - int getSize() const { + size_t getSize() const { return mStatic.size(); } - int getSize(size_t plugin) const { + size_t getSize(size_t plugin) const { assert(plugin < mStatic.size()); return mStatic[plugin].size(); } @@ -338,7 +338,7 @@ namespace MWWorld } - int getSize() const { + size_t getSize() const { return mStatic.size(); } @@ -567,7 +567,7 @@ namespace MWWorld return 0; } - int getSize() const { + size_t getSize() const { return mSharedInt.size() + mSharedExt.size(); } @@ -701,7 +701,7 @@ namespace MWWorld mStatic.back().load(esm); } - int getSize() const { + size_t getSize() const { return mStatic.size(); } @@ -930,7 +930,7 @@ namespace MWWorld } } - int getSize() const { + size_t getSize() const { return mStatic.size(); } diff --git a/components/esm/esmwriter.cpp b/components/esm/esmwriter.cpp index e2f878a257..b9dd5b57b6 100644 --- a/components/esm/esmwriter.cpp +++ b/components/esm/esmwriter.cpp @@ -136,15 +136,15 @@ void ESMWriter::writeHNString(const std::string& name, const std::string& data) endRecord(name); } -void ESMWriter::writeHNString(const std::string& name, const std::string& data, int size) +void ESMWriter::writeHNString(const std::string& name, const std::string& data, size_t size) { - assert(static_cast (data.size()) <= size); + assert(data.size() <= size); startSubRecord(name); writeHString(data); - if (static_cast (data.size()) < size) + if (data.size() < size) { - for (int i = data.size(); i < size; ++i) + for (size_t i = data.size(); i < size; ++i) write("\0",1); } @@ -177,7 +177,7 @@ void ESMWriter::writeName(const std::string& name) write(name.c_str(), name.size()); } -void ESMWriter::write(const char* data, int size) +void ESMWriter::write(const char* data, size_t size) { if (count && !m_records.empty()) { diff --git a/components/esm/esmwriter.hpp b/components/esm/esmwriter.hpp index b557a29ad8..94e173b4ce 100644 --- a/components/esm/esmwriter.hpp +++ b/components/esm/esmwriter.hpp @@ -16,7 +16,7 @@ class ESMWriter { std::string name; std::streampos position; - int size; + size_t size; }; public: @@ -35,7 +35,7 @@ public: void close(); void writeHNString(const std::string& name, const std::string& data); - void writeHNString(const std::string& name, const std::string& data, int size); + void writeHNString(const std::string& name, const std::string& data, size_t size); void writeHNCString(const std::string& name, const std::string& data) { startSubRecord(name); @@ -76,7 +76,7 @@ public: } template - void writeT(const T& data, int size) + void writeT(const T& data, size_t size) { write((char*)&data, size); } @@ -87,7 +87,7 @@ public: void writeHString(const std::string& data); void writeHCString(const std::string& data); void writeName(const std::string& data); - void write(const char* data, int size); + void write(const char* data, size_t size); private: std::list m_masters; diff --git a/components/to_utf8/to_utf8.cpp b/components/to_utf8/to_utf8.cpp index e2a1b1220f..1de15d79c4 100644 --- a/components/to_utf8/to_utf8.cpp +++ b/components/to_utf8/to_utf8.cpp @@ -70,7 +70,7 @@ Utf8Encoder::Utf8Encoder(const FromType sourceEncoding): } } -std::string Utf8Encoder::getUtf8(const char* input, int size) +std::string Utf8Encoder::getUtf8(const char* input, size_t size) { // Double check that the input string stops at some point (it might // contain zero terminators before this, inside its own data, which @@ -111,7 +111,7 @@ std::string Utf8Encoder::getUtf8(const char* input, int size) return std::string(&mOutput[0], outlen); } -std::string Utf8Encoder::getLegacyEnc(const char *input, int size) +std::string Utf8Encoder::getLegacyEnc(const char *input, size_t size) { // Double check that the input string stops at some point (it might // contain zero terminators before this, inside its own data, which diff --git a/components/to_utf8/to_utf8.hpp b/components/to_utf8/to_utf8.hpp index d975b3e4d0..839aa36aa3 100644 --- a/components/to_utf8/to_utf8.hpp +++ b/components/to_utf8/to_utf8.hpp @@ -27,13 +27,13 @@ namespace ToUTF8 Utf8Encoder(FromType sourceEncoding); // Convert to UTF8 from the previously given code page. - std::string getUtf8(const char *input, int size); + std::string getUtf8(const char *input, size_t size); inline std::string getUtf8(const std::string &str) { return getUtf8(str.c_str(), str.size()); } - std::string getLegacyEnc(const char *input, int size); + std::string getLegacyEnc(const char *input, size_t size); inline std::string getLegacyEnc(const std::string &str) { return getLegacyEnc(str.c_str(), str.size()); From 1af4e11414c94e4691acefb2fe987790570ae8b4 Mon Sep 17 00:00:00 2001 From: Nathan Jeffords Date: Sat, 23 Feb 2013 10:24:18 -0800 Subject: [PATCH 24/30] apply MSVC warning settings to shiny projects --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ef85e34dd..95d54fed1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -529,6 +529,8 @@ if (WIN32) set(WARNINGS "${WARNINGS} /wd${d}") endforeach(d) + set_target_properties(shiny PROPERTIES COMPILE_FLAGS ${WARNINGS}) + set_target_properties(shiny.OgrePlatform PROPERTIES COMPILE_FLAGS ${WARNINGS}) set_target_properties(components PROPERTIES COMPILE_FLAGS ${WARNINGS}) if (BUILD_LAUNCHER) set_target_properties(omwlauncher PROPERTIES COMPILE_FLAGS ${WARNINGS}) From a95431c387258d0f3862a9e8a5345336602a4cb2 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 23 Feb 2013 20:20:40 +0100 Subject: [PATCH 25/30] fix --- apps/openmw/mwscript/scriptmanagerimp.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/openmw/mwscript/scriptmanagerimp.cpp b/apps/openmw/mwscript/scriptmanagerimp.cpp index e8489e3cd0..fed5877c4b 100644 --- a/apps/openmw/mwscript/scriptmanagerimp.cpp +++ b/apps/openmw/mwscript/scriptmanagerimp.cpp @@ -168,6 +168,11 @@ namespace MWScript for (int i=0; imData.mNumFloats; ++i) locals.declare ('f', script->mVarNames[index++]); + + std::map::iterator iter = + mOtherLocals.insert (std::make_pair (name, locals)).first; + + return iter->second; } throw std::logic_error ("script " + name + " does not exist"); From a5ff8181b737b91f096b1182f03066ac14ef0e06 Mon Sep 17 00:00:00 2001 From: lazydev Date: Sun, 24 Feb 2013 03:35:43 +0400 Subject: [PATCH 26/30] fix for https://bugs.openmw.org/issues/569 --- apps/openmw/mwworld/store.hpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index cb18873cc4..3eec052347 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -19,7 +19,7 @@ namespace MWWorld virtual int getSize() const = 0; virtual void load(ESM::ESMReader &esm, const std::string &id) = 0; - + virtual bool eraseStatic(const std::string &id) {return false;} }; @@ -110,7 +110,7 @@ namespace MWWorld item.mId = Misc::StringUtils::lowerCase(id); typename std::map::const_iterator it = mStatic.find(item.mId); - + if (it != mStatic.end() && Misc::StringUtils::ciEqual(it->second.mId, id)) { return &(it->second); } @@ -188,14 +188,14 @@ namespace MWWorld item.mId = Misc::StringUtils::lowerCase(id); typename std::map::iterator it = mStatic.find(item.mId); - + if (it != mStatic.end() && Misc::StringUtils::ciEqual(it->second.mId, id)) { mStatic.erase(it); } return true; } - + bool erase(const std::string &id) { std::string key = Misc::StringUtils::lowerCase(id); typename Dynamic::iterator it = mDynamic.find(key); @@ -220,9 +220,15 @@ namespace MWWorld template <> inline void Store::load(ESM::ESMReader &esm, const std::string &id) { std::string idLower = Misc::StringUtils::lowerCase(id); - mStatic[idLower] = ESM::Dialogue(); - mStatic[idLower].mId = id; // don't smash case here, as this line is printed... I think - mStatic[idLower].load(esm); + + std::map::iterator it = mStatic.find(idLower); + if (it == mStatic.end()) { + it = mStatic.insert( std::make_pair( idLower, ESM::Dialogue() ) ).first; + it->second.mId = id; // don't smash case here, as this line is printed... I think + } + + //I am not sure is it need to load the dialog from a plugin if it was already loaded from prevois plugins + it->second.load(esm); } template <> @@ -409,7 +415,7 @@ namespace MWWorld DynamicInt mDynamicInt; DynamicExt mDynamicExt; - + const ESM::Cell *search(const ESM::Cell &cell) const { if (cell.isExterior()) { return search(cell.getGridX(), cell.getGridY()); @@ -481,7 +487,7 @@ namespace MWWorld newCell->mData.mY = y; mExt[std::make_pair(x, y)] = *newCell; delete newCell; - + return &mExt[std::make_pair(x, y)]; } @@ -528,7 +534,7 @@ namespace MWWorld // There some nasty three-way cyclic header dependency involved, which I could only fix by moving // this method. void load(ESM::ESMReader &esm, const std::string &id); - + iterator intBegin() const { return iterator(mSharedInt.begin()); } From 62c5568ed9138eb679f0427a2ea655af872303eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20S=C3=B6derberg?= Date: Sun, 24 Feb 2013 16:57:07 +0100 Subject: [PATCH 27/30] Fix for the loadingbar to resemble vanilla Morrowind. --- files/mygui/openmw_loading_screen.layout | 4 ++-- files/mygui/openmw_progress.skin.xml | 13 +++++++++++++ files/mygui/smallbars.png | Bin 246 -> 3205 bytes 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/files/mygui/openmw_loading_screen.layout b/files/mygui/openmw_loading_screen.layout index 6862702ca1..4b6861151a 100644 --- a/files/mygui/openmw_loading_screen.layout +++ b/files/mygui/openmw_loading_screen.layout @@ -6,12 +6,12 @@ - + - + diff --git a/files/mygui/openmw_progress.skin.xml b/files/mygui/openmw_progress.skin.xml index c4b94e28e2..4666be2217 100644 --- a/files/mygui/openmw_progress.skin.xml +++ b/files/mygui/openmw_progress.skin.xml @@ -17,6 +17,11 @@ + + + + + @@ -51,4 +56,12 @@ + + + + + + + + diff --git a/files/mygui/smallbars.png b/files/mygui/smallbars.png index a9ed572ef6dd53092f3e35dd1fc871a60686e91d..f938412c259c540d8e085a339fa0d94c4294a361 100644 GIT binary patch literal 3205 zcmYjTc|6o>7k`GyzGatm$(rnIc4q8r7#UHv7$u?HY>_2fx+Gbr5tV&O)MzYaCo)3T zv1Ch#Zk9%vnRndoeRDpa=X-wNv;Lm*{Bx4dTAQ#k9b*Cju$q|~+EF!>dW0Ehs90ZR z%}7;@0j5qj0AS`iI1rHgh#vqZo6B(c*|R?WLH;*<`~!r|;Beu9>;B%CuX+IxGJ&y2 zA?%lVb%@hjFpI>fhZg>JJPg8iu;eK2Gzn=DMh^2tk%Dm^+m@q7Mo_`-{6yN6l&E_= zwlXYtna1cBM4qI?K25yavo{<5)OVzj__>e#YE*ZrViQx_Pv6YIl4+`Js~W{p3OjN1 zQ*2jz=j?)F_jo_I*hxb=E^%!9MCz)kY@=OGY<*~tlq0OyAy zJdpe}Ak5{JXb60?Kt=z#yG8)10Jyy^+BLwKEKo3W^fm?6b)Xr~!CV6vSb&0UV%#YJ z4F_)BqM{+-P7dHU-f-0Ze!7ZdNt!yToEmMMn1)fbGlOg(y`!Vt2`Ri8-)U|&cN+Ix zeYw`q908?h74}b??*Yh9fz$6cgo3IktG+>S_#DU>r=O!!?Qx9v%b zG*weYySoTs2UDR9o$E9j2`y2 z`dkHVL(;Zq|BGNKXS7i>qZ%|AChUH~z!YhTv>r1p5k4-aa&&@GosssAZL8$T^b(7g z67@%aw)1-^DJCFIWkg3fQ@P|h!V}@`>SCNpa3x9HeHybD&k%#0gT{l`>_nGkO3^B& z$3)ZLOkz-M1kUmgY0oLxhZ9)l`%AdI!eX+b|7KN2hGKP-%@c9rgKmQU`e{?G2 zgmu;j$HCrZlP_6cXt#n{SmSwOyAn}S0%(4Eew08k|MP6iB7vb~fi8rCy5ef~QVx5L zzXMVlD}9S6t%oVYJVPQwP+A^QT2@pxUB>LN>ClTvExl+TQDy9)Y(HPh_%XBGp$v0& z)n3pZRjO5zP=+e;N9a9^bRs3uIkj1~*}$LK=D%>AZ|oFi_7tcMkrDA_Esy^*TD4u` zMc??Xo6-&0B%y|6owCvb4Y;zovSY2?=0k5i`uXg@oku~|j7w6*S(}k}r@6nKnmZ*} zq+*Fv^m6en%go9|mYbH_mYb|Lsa35NV~U!L8l3i`*$leOC0!&A54 zVqPm9&Fw0=GT%bMf(FCjx7Ui-v-93ujLNh0FP;uPywE+vJ!|$(8g4-Q>9Fx%#_ablce>1r&HHuwbv~7# zlMs=xuv)QN&$Y9{6`d;5vedHd>U-b!q;Dig6|JKfFwUoR`6tU|)Ng z)hwJZa$3hWUW+@g;Z%rpIDetmxDrz-KGIOxP<*r)XPs_co;QMOtNxCChb^rWs9qeS zBUEAiuo3Pk4?a{~M^)Q;dQ*BteZ*fR9eUP;akg@y^Fom~US8+cJf}IGi+{AP7tyhm zxh#)D_H*=)DbHiMdQY`q#@M5WOi+9%+>O}H#N;H4m|nRoT{*O1=Tvvof_cz(;Dy<+ z!EFq>7Tvm5LU_Kewtjg%Ve;{NmB**@oRn{TXzPZ5vRxd|V}6{W;5$cvV;jUq(;WQeh zXru95)?8Iuw@mJe_Jn%9O1)mEoVU~aVI&4=cGcpzhMaVj+O?~1X7<-M6Xq~;%=6)V z+49{N0zwP$ty^)$yrpuSGMbtCmWkG99{z2>Azi|IPke(bSUiO(v{k4Tby9vnZ6I+B z?jn7{dc#!OD(u16v_{oXu@2=znMK?k$%JKeYTzP5*OU;WXy$CNeBR?gW6*ur=VM_D1{=cbA)8a3L1p#-LRo+GE@&(T$A zzrKr=_8Yb-Uvtc=ifobyv+|9;*wPcz@(SX+%Iv_j7#FcRIl6Yi1}X0}^U8fU9wVsB zlXSO=o4}XFb9+o`GGtLO!N2Ei&g8?FrRD9oOa0!1-pik-W%HcbGRv|)XR%#l9iMo~ zI&<#j+V&44f_zq=6rmv&3&%ZutNpsstN0zhPfHK+46%jSMX0S0PQ7v;-MKcfE*ReU zL*?r*!MTx0(tY=a-~e&38ulLc+B4g$CF)frl`ZdN?)hD)wDt>J>!KZ`CDDtrVMlQv zhlK`p5O%2}r&mqby8d`W#(WEwWmRK!`0G*UoM?by=)y9QafWz;RdeFzz3_@z`k_B= z3ZaDLufTFQa*fgUxqHqY&h<9$bq7XPro;A42!F6YQqgt_HQz+MyF9TRGn9_n=)Z@_ zz(hpK{hV|oJi&%9dE#fTu={_j=Lnh|G@>LgX*Fu$T{d0^ZPXAJxg1|R=04YS^;-#A z(I%%4*>p8LYRIj^x%lGN!ca&lF-&0wZaIk!On%Y?b5GD>lR4f2LDO9}-z@G{LthfQ7nGFD+{{z0IKN#_sIty(mx2@{Kfu>g|6+9{+|S0+dV|S z9wtMA*M5fq$ib@oOP~-M2n0eyp^&L~V5X1`YETinzq|Es5cPNVcE2AYJBP{c-@iS} z4y(Tj_}zxOqSHeFwKCO2rot|DLICU?AQb%AKa{h%dx-qKcZh5p@}Soa-SpSoNDyiV zGPFpdlA1%EB(*k_g&ok+P$vi>lK^y^2q*^)|7l91u5|wibnE+}Y8zjvFZZt;l%XW^ V+qrc3Ge{oT%#5rJt6*+1{{u-NeNq4b delta 212 zcmV;_04x868TJ8?7Z(}`0ssI2A5Ut+00001b5ch_0Itp)>5(B9e*gz`Nliru*#ZX- z6CpS#nr{FA0EkIMK~xyiZP3990znLg;Xh%(5~&##IK14YFH6+F=H0OkN?-L%E#W(hUno^d&x2M`?)6%mba5mg|}wqAOD zjaaLXgil6Y2Ck=DGTNi*9(IC(f}_*`XaN-7J;m0Vu(X6{noP6(|JxT0PCY1eTX63H O0000 Date: Sun, 24 Feb 2013 16:57:40 +0100 Subject: [PATCH 28/30] Prettier repeated borders. --- files/mygui/openmw_hud_box.skin.xml | 88 +++++++++++++++-------------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/files/mygui/openmw_hud_box.skin.xml b/files/mygui/openmw_hud_box.skin.xml index ce231e5bb9..464b6343aa 100644 --- a/files/mygui/openmw_hud_box.skin.xml +++ b/files/mygui/openmw_hud_box.skin.xml @@ -2,76 +2,78 @@ - - - + + + + - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + - - - + + + + - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - From 7ea1f6a02a06e83a153ff85c7f3b5ab210c37ca7 Mon Sep 17 00:00:00 2001 From: Nathan Jeffords Date: Sun, 27 Jan 2013 00:23:10 -0800 Subject: [PATCH 29/30] fixes for using FFMPEG on windows --- apps/openmw/mwsound/ffmpeg_decoder.cpp | 4 ++++ cmake/FindFFmpeg.cmake | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/apps/openmw/mwsound/ffmpeg_decoder.cpp b/apps/openmw/mwsound/ffmpeg_decoder.cpp index 00530a9628..54df45ff4c 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.cpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.cpp @@ -153,6 +153,10 @@ void FFmpeg_Decoder::open(const std::string &fname) try { + for(size_t j = 0;j < mFormatCtx->nb_streams;j++) + if(mFormatCtx->streams[j]->codec->codec_type == AVMEDIA_TYPE_AUDIO) + mFormatCtx->streams[j]->codec->request_sample_fmt = AV_SAMPLE_FMT_S16; + if(avformat_find_stream_info(mFormatCtx, NULL) < 0) fail("Failed to find stream info in "+fname); diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake index c80203a25b..4147590d60 100644 --- a/cmake/FindFFmpeg.cmake +++ b/cmake/FindFFmpeg.cmake @@ -68,6 +68,7 @@ macro(find_component _component _pkgconfig _library _header) find_path(${_component}_INCLUDE_DIRS ${_header} HINTS + ${FFMPEGSDK_INC} ${PC_LIB${_component}_INCLUDEDIR} ${PC_LIB${_component}_INCLUDE_DIRS} PATH_SUFFIXES @@ -76,6 +77,7 @@ macro(find_component _component _pkgconfig _library _header) find_library(${_component}_LIBRARIES NAMES ${_library} HINTS + ${FFMPEGSDK_LIB} ${PC_LIB${_component}_LIBDIR} ${PC_LIB${_component}_LIBRARY_DIRS} ) @@ -97,6 +99,12 @@ endmacro() # Check for cached results. If there are skip the costly part. if (NOT FFMPEG_LIBRARIES) + set (FFMPEGSDK ENV${FFMPEG_HOME}) + if (FFMPEGSDK) + set (FFMPEGSDK_INC "${FFMPEGSDK}/include") + set (FFMPEGSDK_LIB "${FFMPEGSDK}/lib") + endif () + # Check for all possible component. find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h) find_component(AVFORMAT libavformat avformat libavformat/avformat.h) From e060713aa350b110c7b9e55f768c558048727d48 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 24 Feb 2013 20:37:29 +0100 Subject: [PATCH 30/30] updated credits file --- credits.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/credits.txt b/credits.txt index 8b396aad0a..535e922ae1 100644 --- a/credits.txt +++ b/credits.txt @@ -29,6 +29,7 @@ Jannik Heller (scrawl) Jason Hooks (jhooks) Joel Graff (graffy) Karl-Felix Glatzer (k1ll) +Lars Söderberg (Lazaroth) lazydev Leon Saunders (emoose) Lukasz Gromanowski (lgro)