From 1286754fb3c8b6f25bb3b8c56b2d1aacd5f2e137 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 18 Mar 2017 08:07:36 +0400 Subject: [PATCH 1/3] Add a new option to show arrow damage (feature #2923) --- apps/openmw/mwclass/weapon.cpp | 7 +++++-- files/settings-default.cfg | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index 470c7040d..952464eec 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -1,6 +1,7 @@ #include "weapon.hpp" #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -261,8 +262,8 @@ namespace MWClass std::string text; - // weapon type & damage. arrows / bolts don't have his info. - if (ref->mBase->mData.mType < 12) + // weapon type & damage + if ((ref->mBase->mData.mType < 12 || Settings::Manager::getBool("show projectile damage", "Game")) && ref->mBase->mData.mType < 14) { text += "\n#{sType} "; @@ -279,6 +280,8 @@ namespace MWClass mapping[ESM::Weapon::MarksmanBow] = std::make_pair("sSkillMarksman", ""); mapping[ESM::Weapon::MarksmanCrossbow] = std::make_pair("sSkillMarksman", ""); mapping[ESM::Weapon::MarksmanThrown] = std::make_pair("sSkillMarksman", ""); + mapping[ESM::Weapon::Arrow] = std::make_pair("sSkillMarksman", ""); + mapping[ESM::Weapon::Bolt] = std::make_pair("sSkillMarksman", ""); std::string type = mapping[ref->mBase->mData.mType].first; std::string oneOrTwoHanded = mapping[ref->mBase->mData.mType].second; diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 55f550d5a..472e9c596 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -146,6 +146,9 @@ crosshair = true # no color, 1 is tool tip only, 2 is crosshair only, and 3 is both). show owned = 0 +# Show damage bonus of arrow and bolts. +show projectile damage = false + # Always use the best mode of attack: e.g. chop, slash or thrust. best attack = false From 506cc47c9d9db2a39c9eb2724b48f273d24a3691 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 18 Mar 2017 19:23:19 +0400 Subject: [PATCH 2/3] Add option to show reach and attack speed for melee weapons --- apps/openmw/mwclass/weapon.cpp | 8 ++++++++ apps/openmw/mwgui/tooltips.cpp | 8 ++++++++ apps/openmw/mwgui/tooltips.hpp | 1 + files/settings-default.cfg | 3 +++ 4 files changed, 20 insertions(+) diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index 952464eec..575accaba 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -321,6 +321,14 @@ namespace MWClass + MWGui::ToolTips::toString(ref->mBase->mData.mHealth); } + // add reach and attack speed for melee weapon + if (ref->mBase->mData.mType < 9 && Settings::Manager::getBool("show melee info", "Game")) + { + text += MWGui::ToolTips::getPercentString(ref->mBase->mData.mReach, "#{sRange}"); + + text += MWGui::ToolTips::getPercentString(ref->mBase->mData.mSpeed, "#{sAttributeSpeed}"); + } + text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}"); text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}"); diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index b3cc19a64..e25981a62 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -594,6 +594,14 @@ namespace MWGui return "\n" + prefix + ": " + toString(weight); } + std::string ToolTips::getPercentString(const float value, const std::string& prefix) + { + if (value == 0) + return ""; + else + return "\n" + prefix + ": " + toString(value*100) +"%"; + } + std::string ToolTips::getValueString(const int value, const std::string& prefix) { if (value == 0) diff --git a/apps/openmw/mwgui/tooltips.hpp b/apps/openmw/mwgui/tooltips.hpp index de5b89b7f..2db5fce34 100644 --- a/apps/openmw/mwgui/tooltips.hpp +++ b/apps/openmw/mwgui/tooltips.hpp @@ -63,6 +63,7 @@ namespace MWGui ///< set the screen-space position of the tooltip for focused object static std::string getWeightString(const float weight, const std::string& prefix); + static std::string getPercentString(const float value, const std::string& prefix); static std::string getValueString(const int value, const std::string& prefix); ///< @return "prefix: value" or "" if value is 0 diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 472e9c596..da0cbd285 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -149,6 +149,9 @@ show owned = 0 # Show damage bonus of arrow and bolts. show projectile damage = false +# Show additional melee weapon info: reach and attack speed +show melee info = false + # Always use the best mode of attack: e.g. chop, slash or thrust. best attack = false From 00e06095c10b2c67fa2e91c299b2ba7f722953a5 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 14 Apr 2017 21:49:15 +0400 Subject: [PATCH 3/3] Updated documentation for new weapon tooltips options --- .../reference/modding/settings/game.rst | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/source/reference/modding/settings/game.rst b/docs/source/reference/modding/settings/game.rst index 1eaa22db4..31ff3dd8c 100644 --- a/docs/source/reference/modding/settings/game.rst +++ b/docs/source/reference/modding/settings/game.rst @@ -12,6 +12,28 @@ Enable visual clues for items owned by NPCs when the crosshair is on the object. The default value is 0 (no clues). This setting can only be configured by editing the settings configuration file. +show projectile damage +---------------------- + +:Type: boolean +:Range: True/False +:Default: False + +If this setting is true, damage bonus of arrows and bolts will be showed on item tooltip. + +The default value is false. This setting can only be configured by editing the settings configuration file. + +show melee info +--------------- + +:Type: boolean +:Range: True/False +:Default: False + +If this setting is true, melee weapons reach and speed will be showed on item tooltip. + +The default value is false. This setting can only be configured by editing the settings configuration file. + best attack -----------