From e0e561a105538b064d324a2ff970c5b6a1d87b4a Mon Sep 17 00:00:00 2001 From: cc9cii Date: Fri, 5 Sep 2014 07:17:31 +1000 Subject: [PATCH 1/4] Add icon to windows exe --- apps/openmw/CMakeLists.txt | 2 ++ files/openmw/openmw.rc | 1 + 2 files changed, 3 insertions(+) create mode 100644 files/openmw/openmw.rc diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index babde8ff2f..e2c1ef5c96 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -2,6 +2,8 @@ set(GAME main.cpp engine.cpp + + ${CMAKE_SOURCE_DIR}/files/openmw/openmw.rc ) if (ANDROID) diff --git a/files/openmw/openmw.rc b/files/openmw/openmw.rc new file mode 100644 index 0000000000..325c182c36 --- /dev/null +++ b/files/openmw/openmw.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "../launcher/images/openmw.ico" From 1c178768f54e1d988b471a98dbee1e269b0ff68e Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 5 Sep 2014 16:43:20 +0200 Subject: [PATCH 2/4] Allow Script records with missing SCDT (precompiled code, not used anyway) Not sure on the exact conditions, but this was missing in a plugin that I made in the TES-CS, while vanilla MW would load it just fine. --- components/esm/loadscpt.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/esm/loadscpt.cpp b/components/esm/loadscpt.cpp index fff68962fe..f3813adca6 100644 --- a/components/esm/loadscpt.cpp +++ b/components/esm/loadscpt.cpp @@ -64,8 +64,11 @@ void Script::load(ESMReader &esm) } // Script mData - mScriptData.resize(mData.mScriptDataSize); - esm.getHNExact(&mScriptData[0], mScriptData.size(), "SCDT"); + if (esm.isNextSub("SCDT")) + { + mScriptData.resize(mData.mScriptDataSize); + esm.getHExact(&mScriptData[0], mScriptData.size()); + } // Script text mScriptText = esm.getHNOString("SCTX"); From 282c93ccc543584e66505d23632416ea4d0f687f Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 5 Sep 2014 17:17:45 +0200 Subject: [PATCH 3/4] Handle death in actor update rather than instantly (Fixes #1866) --- apps/openmw/mwbase/mechanicsmanager.hpp | 5 ++--- apps/openmw/mwmechanics/actors.cpp | 17 ++------------ apps/openmw/mwmechanics/actors.hpp | 5 ++--- apps/openmw/mwmechanics/creaturestats.cpp | 15 ++++++------- apps/openmw/mwmechanics/creaturestats.hpp | 2 ++ .../mwmechanics/mechanicsmanagerimp.cpp | 22 ++++++++++++++----- .../mwmechanics/mechanicsmanagerimp.hpp | 4 +--- 7 files changed, 33 insertions(+), 37 deletions(-) diff --git a/apps/openmw/mwbase/mechanicsmanager.hpp b/apps/openmw/mwbase/mechanicsmanager.hpp index 532c1c3faa..e99f4ca3cd 100644 --- a/apps/openmw/mwbase/mechanicsmanager.hpp +++ b/apps/openmw/mwbase/mechanicsmanager.hpp @@ -198,9 +198,8 @@ namespace MWBase /// making it more likely for the function to return true. virtual bool isAggressive (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, int bias=0, bool ignoreDistance=false) = 0; - /// Usually done once a frame, but can be invoked manually in time-critical situations. - /// This will increase the death count for any actors that were killed. - virtual void killDeadActors() = 0; + /// Resurrects the player if necessary + virtual void keepPlayerAlive() = 0; }; } diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 0ac21f3353..9e11529dd3 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1292,23 +1292,10 @@ namespace MWMechanics continue; } - // If it's the player and God Mode is turned on, keep it alive - if (iter->first.getRefData().getHandle()=="player" && - MWBase::Environment::get().getWorld()->getGodModeState()) - { - MWMechanics::DynamicStat stat (stats.getHealth()); - - if (stat.getModified()<1) - { - stat.setModified(1, 0); - stats.setHealth(stat); - } - stats.resurrect(); - continue; - } - if (iter->second->kill()) { + iter->first.getClass().getCreatureStats(iter->first).notifyDied(); + ++mDeathCount[Misc::StringUtils::lowerCase(iter->first.getCellRef().getRefId())]; // Make sure spell effects with CasterLinked flag are removed diff --git a/apps/openmw/mwmechanics/actors.hpp b/apps/openmw/mwmechanics/actors.hpp index f893f7596a..55f1719f62 100644 --- a/apps/openmw/mwmechanics/actors.hpp +++ b/apps/openmw/mwmechanics/actors.hpp @@ -44,6 +44,8 @@ namespace MWMechanics void updateCrimePersuit (const MWWorld::Ptr& ptr, float duration); + void killDeadActors (); + public: Actors(); @@ -98,9 +100,6 @@ namespace MWMechanics int countDeaths (const std::string& id) const; ///< Return the number of deaths for actors with the given ID. - ///@see MechanicsManager::killDeadActors - void killDeadActors (); - void forceStateUpdate(const MWWorld::Ptr &ptr); void playAnimationGroup(const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number); diff --git a/apps/openmw/mwmechanics/creaturestats.cpp b/apps/openmw/mwmechanics/creaturestats.cpp index 6c0356a040..7a2ece6cad 100644 --- a/apps/openmw/mwmechanics/creaturestats.cpp +++ b/apps/openmw/mwmechanics/creaturestats.cpp @@ -188,16 +188,10 @@ namespace MWMechanics if (index==0 && mDynamic[index].getCurrent()<1) { - if (!mDead) - mDied = true; - mDead = true; - if (mDied) - // Must increase death count immediately. There are scripts that use getDeadCount as reaction to onDeath - // and rely on the increased value. - // Would be more appropriate to use a killActor(actor) function, but we don't have access to the Ptr in CreatureStats. - MWBase::Environment::get().getMechanicsManager()->killDeadActors(); + if (MWBase::Environment::get().getWorld()->getGodModeState()) + MWBase::Environment::get().getMechanicsManager()->keepPlayerAlive(); } } @@ -242,6 +236,11 @@ namespace MWMechanics return mDead; } + void CreatureStats::notifyDied() + { + mDied = true; + } + bool CreatureStats::hasDied() const { return mDied; diff --git a/apps/openmw/mwmechanics/creaturestats.hpp b/apps/openmw/mwmechanics/creaturestats.hpp index 037f37cc91..827408e111 100644 --- a/apps/openmw/mwmechanics/creaturestats.hpp +++ b/apps/openmw/mwmechanics/creaturestats.hpp @@ -168,6 +168,8 @@ namespace MWMechanics bool isDead() const; + void notifyDied(); + bool hasDied() const; void clearHasDied(); diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index b6b2c213d6..8547188637 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -664,11 +664,6 @@ namespace MWMechanics return mActors.countDeaths (id); } - void MechanicsManager::killDeadActors() - { - mActors.killDeadActors(); - } - void MechanicsManager::getPersuasionDispositionChange (const MWWorld::Ptr& npc, PersuasionType type, float currentTemporaryDispositionDelta, bool& success, float& tempChange, float& permChange) { @@ -1303,4 +1298,21 @@ namespace MWMechanics return (fight >= 100); } + + void MechanicsManager::keepPlayerAlive() + { + MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); + CreatureStats& stats = player.getClass().getCreatureStats(player); + if (stats.isDead()) + { + MWMechanics::DynamicStat stat (stats.getHealth()); + + if (stat.getModified()<1) + { + stat.setModified(1, 0); + stats.setHealth(stat); + } + stats.resurrect(); + } + } } diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp index 7dbc6da74f..48553e099f 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp @@ -162,9 +162,7 @@ namespace MWMechanics /// making it more likely for the function to return true. virtual bool isAggressive (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, int bias=0, bool ignoreDistance=false); - /// Usually done once a frame, but can be invoked manually in time-critical situations. - /// This will increase the death count for any actors that were killed. - virtual void killDeadActors(); + virtual void keepPlayerAlive(); }; } From ab8403192cf0dd838e8f62cf0d5acc4fe56b1305 Mon Sep 17 00:00:00 2001 From: cc9cii Date: Sat, 6 Sep 2014 08:00:48 +1000 Subject: [PATCH 4/4] Fix typo. --- apps/opencs/model/world/data.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index d3562c0f7b..8045d77f67 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -186,7 +186,7 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc mJournalInfos.addColumn (new StringIdColumn (true)); mJournalInfos.addColumn (new RecordStateColumn); - mJournalInfos.addColumn (new FixedRecordTypeColumn (UniversalId::Type_Journal)); + mJournalInfos.addColumn (new FixedRecordTypeColumn (UniversalId::Type_JournalInfo)); mJournalInfos.addColumn (new TopicColumn (true)); mJournalInfos.addColumn (new QuestStatusTypeColumn); mJournalInfos.addColumn (new QuestIndexColumn);