From 3e3f5d66b28b60d66793f2112935500a58458f77 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Wed, 25 Mar 2020 21:06:21 +0300 Subject: [PATCH 1/5] Don't reset dead non-werewolf vampires' vampire NPC type --- apps/openmw/mwrender/npcanimation.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 18ecd30fc..261723db5 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -269,6 +269,9 @@ void HeadAnimationTime::setBlinkStop(float value) NpcAnimation::NpcType NpcAnimation::getNpcType() { const MWWorld::Class &cls = mPtr.getClass(); + // Dead vampires should typically stay vampires. + if (mNpcType == Type_Vampire && cls.getNpcStats(mPtr).isDead() && !cls.getNpcStats(mPtr).isWerewolf()) + return mNpcType; NpcAnimation::NpcType curType = Type_Normal; if (cls.getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Vampirism).getMagnitude() > 0) curType = Type_Vampire; From 04ebe5c4c9648c570574e193ed800d5460fdf9d3 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Thu, 26 Mar 2020 15:22:31 +0300 Subject: [PATCH 2/5] Reset skills of dead actors (bug #5328) --- CHANGELOG.md | 1 + apps/openmw/mwmechanics/actors.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85fffdd1f..0101587fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -207,6 +207,7 @@ Bug #5300: NPCs don't switch from torch to shield when starting combat Bug #5308: World map copying makes save loading much slower Bug #5313: Node properties of identical type are not applied in the correct order + Bug #5328: Skills aren't properly reset for dead actors Feature #1774: Handle AvoidNode Feature #2229: Improve pathfinding AI Feature #3025: Analogue gamepad movement controls diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index bda78c0b5..29ed1a767 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1850,6 +1850,8 @@ namespace MWMechanics stats.getActiveSpells().visitEffectSources(soulTrap); } + // Magic effects will be reset later, and the magic effect that could kill the actor + // needs to be determined now calculateCreatureStatModifiers(iter->first, 0); if (cls.isEssential(iter->first)) @@ -1867,7 +1869,9 @@ namespace MWMechanics // Make sure spell effects are removed purgeSpellEffects(stats.getActorId()); + // Reset dynamic stats, attributes and skills calculateCreatureStatModifiers(iter->first, 0); + calculateNpcStatModifiers(iter->first, 0); if( iter->first == getPlayer()) { From bec5746fddcd5097f6b75d887c193a60a491af42 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Thu, 26 Mar 2020 23:30:08 +0300 Subject: [PATCH 3/5] Improve blank line handling in settings writer (bug #5326) --- CHANGELOG.md | 1 + components/settings/parser.cpp | 42 +++++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0101587fa..985c49c09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -207,6 +207,7 @@ Bug #5300: NPCs don't switch from torch to shield when starting combat Bug #5308: World map copying makes save loading much slower Bug #5313: Node properties of identical type are not applied in the correct order + Bug #5326: Formatting issues in the settings.cfg Bug #5328: Skills aren't properly reset for dead actors Feature #1774: Handle AvoidNode Feature #2229: Improve pathfinding AI diff --git a/components/settings/parser.cpp b/components/settings/parser.cpp index e256da0d6..1dcb0fd8d 100644 --- a/components/settings/parser.cpp +++ b/components/settings/parser.cpp @@ -77,6 +77,9 @@ void Settings::SettingsFileParser::saveSettingsFile(const std::string& file, con // Were there any lines at all in the file? bool existing = false; + // Is an entirely blank line queued to be added? + bool emptyLineQueued = false; + // The category/section we're currently in. std::string currentCategory; @@ -103,9 +106,19 @@ void Settings::SettingsFileParser::saveSettingsFile(const std::string& file, con // Don't add additional newlines at the end of the file. if (istream.eof()) continue; - // Copy entirely blank lines. - if (!skipWhiteSpace(i, line)) { - ostream << line << std::endl; + // An empty line was queued. + if (emptyLineQueued) + { + emptyLineQueued = false; + // We're still going through the current category, so we should copy it. + if (currentCategory.empty() || line[i] != '[') + ostream << std::endl; + } + + // Queue entirely blank lines to add them if desired. + if (!skipWhiteSpace(i, line)) + { + emptyLineQueued = true; continue; } @@ -128,15 +141,22 @@ void Settings::SettingsFileParser::saveSettingsFile(const std::string& file, con continue; } - // Ensure that all options in the current category have been written. - for (CategorySettingStatusMap::iterator mit = written.begin(); mit != written.end(); ++mit) { - if (mit->second == false && mit->first.first == currentCategory) { - Log(Debug::Verbose) << "Added new setting: [" << currentCategory << "] " - << mit->first.second << " = " << settings.at(mit->first); - ostream << mit->first.second << " = " << settings.at(mit->first) << std::endl; - mit->second = true; - changed = true; + if (!currentCategory.empty()) + { + // Ensure that all options in the current category have been written. + for (CategorySettingStatusMap::iterator mit = written.begin(); mit != written.end(); ++mit) + { + if (mit->second == false && mit->first.first == currentCategory) + { + Log(Debug::Verbose) << "Added new setting: [" << currentCategory << "] " + << mit->first.second << " = " << settings.at(mit->first); + ostream << mit->first.second << " = " << settings.at(mit->first) << std::endl; + mit->second = true; + changed = true; + } } + // Add an empty line after the last option in a category. + ostream << std::endl; } // Update the current category. From 99e89f23a6943f2030a161e59a4b60d522dd6700 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Sat, 28 Mar 2020 19:13:02 +0300 Subject: [PATCH 4/5] Fix calculateNpcStatModifiers call for non-NPCs --- apps/openmw/mwmechanics/actors.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 29ed1a767..8ee248ee5 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1871,7 +1871,8 @@ namespace MWMechanics // Reset dynamic stats, attributes and skills calculateCreatureStatModifiers(iter->first, 0); - calculateNpcStatModifiers(iter->first, 0); + if (iter->first.getClass().isNpc()) + calculateNpcStatModifiers(iter->first, 0); if( iter->first == getPlayer()) { From 69219c18a7b42fd29cbe4d8d30bcbb35edbd3c58 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Sat, 28 Mar 2020 19:15:43 +0300 Subject: [PATCH 5/5] Make sure blank lines at the end of settings.cfg don't disappear --- components/settings/parser.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/settings/parser.cpp b/components/settings/parser.cpp index 1dcb0fd8d..9693bf511 100644 --- a/components/settings/parser.cpp +++ b/components/settings/parser.cpp @@ -103,18 +103,18 @@ void Settings::SettingsFileParser::saveSettingsFile(const std::string& file, con // The current character position in the line. size_t i = 0; - // Don't add additional newlines at the end of the file. - if (istream.eof()) continue; - // An empty line was queued. if (emptyLineQueued) { emptyLineQueued = false; // We're still going through the current category, so we should copy it. - if (currentCategory.empty() || line[i] != '[') + if (currentCategory.empty() || istream.eof() || line[i] != '[') ostream << std::endl; } + // Don't add additional newlines at the end of the file otherwise. + if (istream.eof()) continue; + // Queue entirely blank lines to add them if desired. if (!skipWhiteSpace(i, line)) {