diff --git a/apps/esmtool/esmtool.cpp b/apps/esmtool/esmtool.cpp index 4888d3ceb..ac2746a89 100644 --- a/apps/esmtool/esmtool.cpp +++ b/apps/esmtool/esmtool.cpp @@ -226,7 +226,7 @@ int main(int argc, char**argv) case REC_BOOK: { Book b; - b.load(esm); + b.load(esm, id); if(quiet) break; cout << " Name: " << b.name << endl; cout << " Mesh: " << b.model << endl; diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index fabbf3749..bc4e10501 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -30,6 +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 ) add_openmw_dir (mwdialogue diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp index 9f251476a..d86a9416c 100644 --- a/apps/openmw/mwbase/windowmanager.hpp +++ b/apps/openmw/mwbase/windowmanager.hpp @@ -228,6 +228,7 @@ namespace MWBase virtual bool getPlayerSleeping() = 0; virtual void startSpellMaking(MWWorld::Ptr actor) = 0; + virtual void startEnchanting(MWWorld::Ptr actor) = 0; }; } diff --git a/apps/openmw/mwclass/apparatus.cpp b/apps/openmw/mwclass/apparatus.cpp index 3d362e8c8..7c20eadec 100644 --- a/apps/openmw/mwclass/apparatus.cpp +++ b/apps/openmw/mwclass/apparatus.cpp @@ -128,12 +128,10 @@ namespace MWClass info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); info.icon = ref->base->icon; - const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); - std::string text; - text += "\n" + store.gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality); - text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight); - text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str); + text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->data.quality); + text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight); + text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}"); if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); diff --git a/apps/openmw/mwclass/armor.cpp b/apps/openmw/mwclass/armor.cpp index f1400dc01..93d481e93 100644 --- a/apps/openmw/mwclass/armor.cpp +++ b/apps/openmw/mwclass/armor.cpp @@ -152,13 +152,13 @@ namespace MWClass if (typeGmst.empty()) return -1; - float iWeight = MWBase::Environment::get().getWorld()->getStore().gameSettings.find (typeGmst)->i; + float iWeight = MWBase::Environment::get().getWorld()->getStore().gameSettings.find (typeGmst)->getInt(); - if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fLightMaxMod")->f>= + if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fLightMaxMod")->getFloat()>= ref->base->data.weight) return ESM::Skill::LightArmor; - if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMedMaxMod")->f>= + if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMedMaxMod")->getFloat()>= ref->base->data.weight) return ESM::Skill::MediumArmor; @@ -229,25 +229,23 @@ namespace MWClass std::string text; - const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); - // get armor type string (light/medium/heavy) int armorType = getEquipmentSkill(ptr); std::string typeText; if (armorType == ESM::Skill::LightArmor) - typeText = store.gameSettings.search("sLight")->str; + typeText = "#{sLight}"; else if (armorType == ESM::Skill::MediumArmor) - typeText = store.gameSettings.search("sMedium")->str; + typeText = "#{sMedium}"; else - typeText = store.gameSettings.search("sHeavy")->str; + typeText = "#{sHeavy}"; - text += "\n" + store.gameSettings.search("sArmorRating")->str + ": " + MWGui::ToolTips::toString(ref->base->data.armor); + text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(ref->base->data.armor); /// \todo store the current armor health somewhere - text += "\n" + store.gameSettings.search("sCondition")->str + ": " + MWGui::ToolTips::toString(ref->base->data.health); + text += "\n#{sCondition}: " + MWGui::ToolTips::toString(ref->base->data.health); - text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight) + " (" + typeText + ")"; - text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str); + text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight) + " (" + typeText + ")"; + text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}"); if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); diff --git a/apps/openmw/mwclass/book.cpp b/apps/openmw/mwclass/book.cpp index 1e187342d..3653ad901 100644 --- a/apps/openmw/mwclass/book.cpp +++ b/apps/openmw/mwclass/book.cpp @@ -124,12 +124,10 @@ namespace MWClass info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); info.icon = ref->base->icon; - const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); - std::string text; - text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight); - text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str); + text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight); + text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}"); if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp index 21069e667..3dee0df89 100644 --- a/apps/openmw/mwclass/clothing.cpp +++ b/apps/openmw/mwclass/clothing.cpp @@ -193,12 +193,10 @@ namespace MWClass info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); info.icon = ref->base->icon; - const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); - std::string text; - text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight); - text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str); + text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight); + text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}"); if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index 1164873a0..be88dd631 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -185,13 +185,11 @@ namespace MWClass MWGui::ToolTipInfo info; info.caption = ref->base->name; - const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); - std::string text; if (ref->ref.lockLevel > 0) - text += "\n" + store.gameSettings.search("sLockLevel")->str + ": " + MWGui::ToolTips::toString(ref->ref.lockLevel); + text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ref->ref.lockLevel); if (ref->ref.trap != "") - text += "\n" + store.gameSettings.search("sTrapped")->str; + text += "\n#{sTrapped}"; if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 96c6eba5f..ffa901fe4 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -223,14 +223,14 @@ namespace MWClass dest = region->name; } } - text += "\n" + store.gameSettings.search("sTo")->str; + text += "\n#{sTo}"; text += "\n"+dest; } if (ref->ref.lockLevel > 0) - text += "\n" + store.gameSettings.search("sLockLevel")->str + ": " + MWGui::ToolTips::toString(ref->ref.lockLevel); + text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ref->ref.lockLevel); if (ref->ref.trap != "") - text += "\n" + store.gameSettings.search("sTrapped")->str; + text += "\n#{sTrapped}"; if (MWBase::Environment::get().getWindowManager()->getFullHelp()) text += MWGui::ToolTips::getMiscString(ref->base->script, "Script"); diff --git a/apps/openmw/mwclass/ingredient.cpp b/apps/openmw/mwclass/ingredient.cpp index bdeb0e82b..5d621caf7 100644 --- a/apps/openmw/mwclass/ingredient.cpp +++ b/apps/openmw/mwclass/ingredient.cpp @@ -145,12 +145,10 @@ namespace MWClass info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); info.icon = ref->base->icon; - const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); - std::string text; - text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight); - text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str); + text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight); + text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}"); if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp index 570221503..560bdd71d 100644 --- a/apps/openmw/mwclass/light.cpp +++ b/apps/openmw/mwclass/light.cpp @@ -173,12 +173,10 @@ namespace MWClass info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); info.icon = ref->base->icon; - const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); - std::string text; - text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight); - text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str); + text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight); + text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}"); if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); diff --git a/apps/openmw/mwclass/lockpick.cpp b/apps/openmw/mwclass/lockpick.cpp index 44498e479..d4c9a01d0 100644 --- a/apps/openmw/mwclass/lockpick.cpp +++ b/apps/openmw/mwclass/lockpick.cpp @@ -137,16 +137,14 @@ namespace MWClass info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); info.icon = ref->base->icon; - const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); - std::string text; /// \todo store remaining uses somewhere - text += "\n" + store.gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses); - text += "\n" + store.gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality); - text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight); - text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str); + text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->base->data.uses); + text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->data.quality); + text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight); + text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}"); if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index eb44b8103..a2d868a6e 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -101,7 +101,7 @@ namespace MWClass MWWorld::LiveCellRef *ref = ptr.get(); - if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str) + if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString()) { return std::string("Item Gold Up"); } @@ -113,7 +113,7 @@ namespace MWClass MWWorld::LiveCellRef *ref = ptr.get(); - if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str) + if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString()) { return std::string("Item Gold Down"); } @@ -147,7 +147,7 @@ namespace MWClass int count = ptr.getRefData().getCount(); - bool isGold = (ref->base->name == store.gameSettings.search("sGold")->str); + bool isGold = (ref->base->name == store.gameSettings.find("sGold")->getString()); if (isGold && count == 1) count = ref->base->data.value; @@ -170,8 +170,8 @@ namespace MWClass if (!isGold) { - text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight); - text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str); + text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight); + text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}"); } if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { @@ -192,7 +192,7 @@ namespace MWClass const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); - if (MWWorld::Class::get(ptr).getName(ptr) == store.gameSettings.search("sGold")->str) { + if (MWWorld::Class::get(ptr).getName(ptr) == store.gameSettings.find("sGold")->getString()) { int goldAmount = ptr.getRefData().getCount(); std::string base = "Gold_001"; diff --git a/apps/openmw/mwclass/potion.cpp b/apps/openmw/mwclass/potion.cpp index 0b79e11ca..259406b37 100644 --- a/apps/openmw/mwclass/potion.cpp +++ b/apps/openmw/mwclass/potion.cpp @@ -129,12 +129,10 @@ namespace MWClass info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); info.icon = ref->base->icon; - const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); - std::string text; - text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight); - text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str); + text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight); + text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}"); info.effects = MWGui::Widgets::MWEffectList::effectListFromESM(&ref->base->effects); info.isPotion = true; diff --git a/apps/openmw/mwclass/probe.cpp b/apps/openmw/mwclass/probe.cpp index 73258e528..15ef2c1ad 100644 --- a/apps/openmw/mwclass/probe.cpp +++ b/apps/openmw/mwclass/probe.cpp @@ -136,16 +136,14 @@ namespace MWClass info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); info.icon = ref->base->icon; - const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); - std::string text; /// \todo store remaining uses somewhere - text += "\n" + store.gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses); - text += "\n" + store.gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality); - text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight); - text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str); + text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->base->data.uses); + text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->data.quality); + text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight); + text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}"); if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); diff --git a/apps/openmw/mwclass/repair.cpp b/apps/openmw/mwclass/repair.cpp index a4240d0c4..7de3b3476 100644 --- a/apps/openmw/mwclass/repair.cpp +++ b/apps/openmw/mwclass/repair.cpp @@ -130,11 +130,10 @@ namespace MWClass /// \todo store remaining uses somewhere - const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); - text += "\n" + store.gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses); - text += "\n" + store.gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality); - text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight); - text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str); + text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->base->data.uses); + text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->data.quality); + text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight); + text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}"); if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index b2397f4af..a0ec16369 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -284,7 +284,7 @@ namespace MWClass // weapon type & damage. arrows / bolts don't have his info. if (ref->base->data.type < 12) { - text += "\n" + store.gameSettings.search("sType")->str + " "; + text += "\n#{sType} "; std::map > mapping; mapping[ESM::Weapon::ShortBladeOneHand] = std::make_pair("sSkillShortblade", "sOneHanded"); @@ -303,29 +303,29 @@ namespace MWClass std::string type = mapping[ref->base->data.type].first; std::string oneOrTwoHanded = mapping[ref->base->data.type].second; - text += store.gameSettings.search(type)->str + - ((oneOrTwoHanded != "") ? ", " + store.gameSettings.search(oneOrTwoHanded)->str : ""); + text += store.gameSettings.find(type)->getString() + + ((oneOrTwoHanded != "") ? ", " + store.gameSettings.find(oneOrTwoHanded)->getString() : ""); // weapon damage if (ref->base->data.type >= 9) { // marksman - text += "\n" + store.gameSettings.search("sAttack")->str + ": " + text += "\n#{sAttack}: " + MWGui::ToolTips::toString(static_cast(ref->base->data.chop[0])) + " - " + MWGui::ToolTips::toString(static_cast(ref->base->data.chop[1])); } else { // Chop - text += "\n" + store.gameSettings.search("sChop")->str + ": " + text += "\n#{sChop}: " + MWGui::ToolTips::toString(static_cast(ref->base->data.chop[0])) + " - " + MWGui::ToolTips::toString(static_cast(ref->base->data.chop[1])); // Slash - text += "\n" + store.gameSettings.search("sSlash")->str + ": " + text += "\n#{sSlash}: " + MWGui::ToolTips::toString(static_cast(ref->base->data.slash[0])) + " - " + MWGui::ToolTips::toString(static_cast(ref->base->data.slash[1])); // Thrust - text += "\n" + store.gameSettings.search("sThrust")->str + ": " + text += "\n#{sThrust}: " + MWGui::ToolTips::toString(static_cast(ref->base->data.thrust[0])) + " - " + MWGui::ToolTips::toString(static_cast(ref->base->data.thrust[1])); } @@ -333,10 +333,10 @@ namespace MWClass /// \todo store the current weapon health somewhere if (ref->base->data.type < 11) // thrown weapons and arrows/bolts don't have health, only quantity - text += "\n" + store.gameSettings.search("sCondition")->str + ": " + MWGui::ToolTips::toString(ref->base->data.health); + text += "\n#{sCondition}: " + MWGui::ToolTips::toString(ref->base->data.health); - text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight); - text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str); + text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight); + text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}"); info.enchant = ref->base->enchant; diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index daff8c67a..033e96120 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -801,6 +801,9 @@ namespace MWDialogue if (services & ESM::NPC::Spellmaking) windowServices |= MWGui::DialogueWindow::Service_CreateSpells; + if (services & ESM::NPC::Enchanting) + windowServices |= MWGui::DialogueWindow::Service_Enchant; + win->setServices (windowServices); // sort again, because the previous sort was case-sensitive diff --git a/apps/openmw/mwdialogue/journalimp.cpp b/apps/openmw/mwdialogue/journalimp.cpp index d626cd315..ac4b7a6de 100644 --- a/apps/openmw/mwdialogue/journalimp.cpp +++ b/apps/openmw/mwdialogue/journalimp.cpp @@ -40,7 +40,7 @@ namespace MWDialogue quest.addEntry (entry); // we are doing slicing on purpose here std::vector empty; - std::string notification = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sJournalEntry")->str; + std::string notification = "#{sJournalEntry}"; MWBase::Environment::get().getWindowManager()->messageBox (notification, empty); } diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 93ec71343..e20cf5914 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -110,7 +110,7 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender) } else { - std::string message = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sTake")->str; + std::string message = "#{sTake}"; CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog(); dialog->open(MWWorld::Class::get(object).getName(object), message, count); dialog->eventOkClicked.clear(); @@ -130,18 +130,17 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender) // the player is trying to sell an item, check if the merchant accepts it // also, don't allow selling gold (let's be better than Morrowind at this, can we?) if (!MWBase::Environment::get().getWindowManager()->getTradeWindow()->npcAcceptsItem(object) - || MWWorld::Class::get(object).getName(object) == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str) + || MWWorld::Class::get(object).getName(object) == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString()) { // user notification "i don't buy this item" MWBase::Environment::get().getWindowManager()-> - messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog4")->str, std::vector()); + messageBox("#{sBarterDialog4}", std::vector()); return; } } bool buying = isTradeWindow(); // buying or selling? - std::string message = buying ? MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sQuanityMenuMessage02")->str - : MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sQuanityMenuMessage01")->str; + std::string message = buying ? "#{sQuanityMenuMessage02}" : "#{sQuanityMenuMessage01}"; if (std::find(mBoughtItems.begin(), mBoughtItems.end(), object) != mBoughtItems.end()) { @@ -279,7 +278,7 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender) { // user notification MWBase::Environment::get().getWindowManager()-> - messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sContentsMessage2")->str, std::vector()); + messageBox("#{sContentsMessage2}", std::vector()); return; } } @@ -302,7 +301,7 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender) object.getRefData().setCount(origCount); // user notification MWBase::Environment::get().getWindowManager()-> - messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sContentsMessage3")->str, std::vector()); + messageBox("#{sContentsMessage3}", std::vector()); return; } else @@ -363,7 +362,7 @@ void ContainerBase::drawItems() int maxHeight = mItemView->getSize().height - 58; bool onlyMagic = false; - int categories; + int categories = 0; if (mFilter == Filter_All) categories = MWWorld::ContainerStore::Type_All; else if (mFilter == Filter_Weapon) diff --git a/apps/openmw/mwgui/countdialog.cpp b/apps/openmw/mwgui/countdialog.cpp index baf14e3fb..61c3c358a 100644 --- a/apps/openmw/mwgui/countdialog.cpp +++ b/apps/openmw/mwgui/countdialog.cpp @@ -27,7 +27,7 @@ namespace MWGui { setVisible(true); - mLabelText->setCaption(message); + mLabelText->setCaptionWithReplacing(message); MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize(); diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index 476379c5d..d03724628 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -126,22 +126,27 @@ void DialogueWindow::onSelectTopic(std::string topic) { if (!mEnabled) return; - if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarter")->str) + if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sBarter")->getString()) { /// \todo check if the player is allowed to trade with this actor (e.g. faction rank high enough)? mWindowManager.pushGuiMode(GM_Barter); mWindowManager.getTradeWindow()->startTrade(mPtr); } - else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSpells")->str) + else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sSpells")->getString()) { mWindowManager.pushGuiMode(GM_SpellBuying); mWindowManager.getSpellBuyingWindow()->startSpellBuying(mPtr); } - else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSpellMakingMenuTitle")->str) + else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sSpellMakingMenuTitle")->getString()) { mWindowManager.pushGuiMode(GM_SpellCreation); mWindowManager.startSpellMaking (mPtr); } + else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sEnchanting")->getString()) + { + mWindowManager.pushGuiMode(GM_Enchanting); + mWindowManager.startEnchanting (mPtr); + } else MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(topic)); } @@ -165,13 +170,16 @@ void DialogueWindow::setKeywords(std::list keyWords) bool anyService = mServices > 0; if (mServices & Service_Trade) - mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarter")->str); + mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sBarter")->getString()); if (mServices & Service_BuySpells) - mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSpells")->str); + mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sSpells")->getString()); if (mServices & Service_CreateSpells) - mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSpellmakingMenuTitle")->str); + mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sSpellmakingMenuTitle")->getString()); + + if (mServices & Service_Enchant) + mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sEnchanting")->getString()); if (anyService) mTopicsList->addSeparator(); @@ -276,7 +284,7 @@ void DialogueWindow::updateOptions() void DialogueWindow::goodbye() { - mHistory->addDialogText("\n#572D21" + MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGoodbye")->str); + mHistory->addDialogText("\n#572D21" + MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGoodbye")->getString()); mTopicsList->setEnabled(false); mEnabled = false; } diff --git a/apps/openmw/mwgui/dialogue.hpp b/apps/openmw/mwgui/dialogue.hpp index 8074d9b86..acbe75eed 100644 --- a/apps/openmw/mwgui/dialogue.hpp +++ b/apps/openmw/mwgui/dialogue.hpp @@ -56,7 +56,8 @@ namespace MWGui { Service_Trade = 0x01, Service_BuySpells = 0x02, - Service_CreateSpells = 0x04 + Service_CreateSpells = 0x04, + Service_Enchant = 0x08 }; protected: diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp new file mode 100644 index 000000000..990d4d06e --- /dev/null +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -0,0 +1,30 @@ +#include "enchantingdialog.hpp" + + +namespace MWGui +{ + + + EnchantingDialog::EnchantingDialog(MWBase::WindowManager &parWindowManager) + : WindowBase("openmw_enchanting_dialog.layout", parWindowManager) + { + + } + + void EnchantingDialog::open() + { + center(); + } + + void EnchantingDialog::startEnchanting (MWWorld::Ptr actor) + { + mPtr = actor; + } + + void EnchantingDialog::onReferenceUnavailable () + { + mWindowManager.removeGuiMode (GM_Dialogue); + mWindowManager.removeGuiMode (GM_Enchanting); + } + +} diff --git a/apps/openmw/mwgui/enchantingdialog.hpp b/apps/openmw/mwgui/enchantingdialog.hpp new file mode 100644 index 000000000..c6f0a72db --- /dev/null +++ b/apps/openmw/mwgui/enchantingdialog.hpp @@ -0,0 +1,26 @@ +#ifndef MWGUI_ENCHANTINGDIALOG_H +#define MWGUI_ENCHANTINGDIALOG_H + +#include "window_base.hpp" +#include "referenceinterface.hpp" + +#include "../mwbase/windowmanager.hpp" + +namespace MWGui +{ + + class EnchantingDialog : public WindowBase, public ReferenceInterface + { + public: + EnchantingDialog(MWBase::WindowManager& parWindowManager); + + virtual void open(); + void startEnchanting(MWWorld::Ptr actor); + + protected: + virtual void onReferenceUnavailable(); + }; + +} + +#endif diff --git a/apps/openmw/mwgui/map_window.cpp b/apps/openmw/mwgui/map_window.cpp index 0fc4233b6..8b1de6258 100644 --- a/apps/openmw/mwgui/map_window.cpp +++ b/apps/openmw/mwgui/map_window.cpp @@ -224,6 +224,9 @@ void LocalMapBase::setPlayerPos(const float x, const float y) { if (x == mLastPositionX && y == mLastPositionY) return; + + notifyPlayerUpdate (); + MyGUI::IntSize size = mLocalMap->getCanvasSize(); MyGUI::IntPoint middle = MyGUI::IntPoint((1/3.f + x/3.f)*size.width,(1/3.f + y/3.f)*size.height); MyGUI::IntCoord viewsize = mLocalMap->getCoord(); @@ -239,6 +242,9 @@ void LocalMapBase::setPlayerDir(const float x, const float y) { if (x == mLastDirectionX && y == mLastDirectionY) return; + + notifyPlayerUpdate (); + MyGUI::ISubWidget* main = mCompass->getSubWidgetMain(); MyGUI::RotatingSkin* rotatingSubskin = main->castType(); rotatingSubskin->setCenter(MyGUI::IntPoint(16,16)); @@ -407,3 +413,9 @@ void MapWindow::globalMapUpdatePlayer () MyGUI::IntPoint viewoffs(0.5*viewsize.width - worldX, 0.5*viewsize.height - worldY); mGlobalMap->setViewOffset(viewoffs); } + +void MapWindow::notifyPlayerUpdate () +{ + if (mGlobal) + globalMapUpdatePlayer (); +} diff --git a/apps/openmw/mwgui/map_window.hpp b/apps/openmw/mwgui/map_window.hpp index 042e6c8ec..73eaad1cd 100644 --- a/apps/openmw/mwgui/map_window.hpp +++ b/apps/openmw/mwgui/map_window.hpp @@ -49,6 +49,8 @@ namespace MWGui void onMarkerFocused(MyGUI::Widget* w1, MyGUI::Widget* w2); void onMarkerUnfocused(MyGUI::Widget* w1, MyGUI::Widget* w2); + virtual void notifyPlayerUpdate() {} + OEngine::GUI::Layout* mLayout; bool mMapDragAndDrop; @@ -93,6 +95,8 @@ namespace MWGui protected: virtual void onPinToggled(); + + virtual void notifyPlayerUpdate(); }; } #endif diff --git a/apps/openmw/mwgui/mode.hpp b/apps/openmw/mwgui/mode.hpp index 042505209..7fd033f5e 100644 --- a/apps/openmw/mwgui/mode.hpp +++ b/apps/openmw/mwgui/mode.hpp @@ -23,6 +23,7 @@ namespace MWGui GM_RestBed, GM_SpellBuying, GM_SpellCreation, + GM_Enchanting, GM_Levelup, diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index 5cb73e682..4b74ee2c8 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -33,11 +33,6 @@ RaceDialog::RaceDialog(MWBase::WindowManager& parWindowManager) setText("AppearanceT", mWindowManager.getGameSettingString("sRaceMenu1", "Appearance")); getWidget(mPreviewImage, "PreviewImage"); - MWBase::Environment::get().getWorld ()->setupExternalRendering (mPreview); - mPreview.update (0); - - mPreviewImage->setImageTexture ("CharacterHeadPreview"); - getWidget(mHeadRotate, "HeadRotate"); mHeadRotate->setScrollRange(50); mHeadRotate->setScrollPosition(25); @@ -107,6 +102,12 @@ void RaceDialog::open() updateRaces(); updateSkills(); updateSpellPowers(); + + mPreview = new MWRender::RaceSelectionPreview(); + MWBase::Environment::get().getWorld ()->setupExternalRendering (*mPreview); + mPreview->update (0); + + mPreviewImage->setImageTexture ("CharacterHeadPreview"); } @@ -138,6 +139,12 @@ int wrap(int index, int max) return index; } +void RaceDialog::close() +{ + delete mPreview; + mPreview = 0; +} + // widget controls void RaceDialog::onOkClicked(MyGUI::Widget* _sender) @@ -154,7 +161,7 @@ void RaceDialog::onHeadRotate(MyGUI::ScrollBar*, size_t _position) { float angle = (float(_position) / 49.f - 0.5) * 3.14 * 2; float diff = angle - mCurrentAngle; - mPreview.update (diff); + mPreview->update (diff); mCurrentAngle += diff; } diff --git a/apps/openmw/mwgui/race.hpp b/apps/openmw/mwgui/race.hpp index 0505e58e1..c4734eae8 100644 --- a/apps/openmw/mwgui/race.hpp +++ b/apps/openmw/mwgui/race.hpp @@ -46,6 +46,7 @@ namespace MWGui void setNextButtonShow(bool shown); virtual void open(); + virtual void close(); // Events typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void; @@ -94,7 +95,7 @@ namespace MWGui float mCurrentAngle; - MWRender::RaceSelectionPreview mPreview; + MWRender::RaceSelectionPreview* mPreview; }; } #endif diff --git a/apps/openmw/mwgui/spellbuyingwindow.cpp b/apps/openmw/mwgui/spellbuyingwindow.cpp index 3a492ce90..88efaee84 100644 --- a/apps/openmw/mwgui/spellbuyingwindow.cpp +++ b/apps/openmw/mwgui/spellbuyingwindow.cpp @@ -50,12 +50,12 @@ namespace MWGui void SpellBuyingWindow::addSpell(const std::string& spellId) { const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId); - int price = spell->data.cost*MWBase::Environment::get().getWorld()->getStore().gameSettings.search("fSpellValueMult")->f; + int price = spell->data.cost*MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fSpellValueMult")->getFloat(); MyGUI::Button* toAdd = mSpellsView->createWidget((price>mWindowManager.getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SpellText", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default); mCurrentY += sLineHeight; /// \todo price adjustment depending on merchantile skill toAdd->setUserData(price); - toAdd->setCaption(spell->name+" - "+boost::lexical_cast(price)+MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sgp")->str); + toAdd->setCaptionWithReplacing(spell->name+" - "+boost::lexical_cast(price)+"#{sgp}"); toAdd->setSize(toAdd->getTextSize().width,sLineHeight); toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel); toAdd->setUserString("ToolTipType", "Spell"); @@ -126,8 +126,7 @@ namespace MWGui void SpellBuyingWindow::updateLabels() { - mPlayerGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str - + ": " + boost::lexical_cast(mWindowManager.getInventoryWindow()->getPlayerGold())); + mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast(mWindowManager.getInventoryWindow()->getPlayerGold())); mPlayerGold->setCoord(8, mPlayerGold->getTop(), mPlayerGold->getTextSize().width, diff --git a/apps/openmw/mwgui/stats_window.cpp b/apps/openmw/mwgui/stats_window.cpp index 701c39b0d..9a23082e6 100644 --- a/apps/openmw/mwgui/stats_window.cpp +++ b/apps/openmw/mwgui/stats_window.cpp @@ -57,7 +57,7 @@ StatsWindow::StatsWindow (MWBase::WindowManager& parWindowManager) const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); for (int i=0; names[i][0]; ++i) { - setText (names[i][0], store.gameSettings.find (names[i][1])->str); + setText (names[i][0], store.gameSettings.find (names[i][1])->getString()); } getWidget(mSkillView, "SkillView"); @@ -475,8 +475,6 @@ void StatsWindow::updateSkillArea() text += "\n#BF9959"; for (int i=0; i<6; ++i) { - const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(faction->data.skillID[i]); - assert(skill); text += "#{"+ESM::Skill::sSkillNameIds[faction->data.skillID[i]]+"}"; if (i<5) text += ", "; diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 9beca795e..a9fb6869d 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -368,19 +368,19 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info) if (text.size() > 0 && text[0] == '\n') text.erase(0, 1); - const ESM::Enchantment* enchant; + const ESM::Enchantment* enchant = 0; const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); if (info.enchant != "") { enchant = store.enchants.search(info.enchant); if (enchant->data.type == ESM::Enchantment::CastOnce) - text += "\n" + store.gameSettings.search("sItemCastOnce")->str; + text += "\n#{sItemCastOnce}"; else if (enchant->data.type == ESM::Enchantment::WhenStrikes) - text += "\n" + store.gameSettings.search("sItemCastWhenStrikes")->str; + text += "\n#{sItemCastWhenStrikes}"; else if (enchant->data.type == ESM::Enchantment::WhenUsed) - text += "\n" + store.gameSettings.search("sItemCastWhenUsed")->str; + text += "\n#{sItemCastWhenUsed}"; else if (enchant->data.type == ESM::Enchantment::ConstantEffect) - text += "\n" + store.gameSettings.search("sItemCastConstant")->str; + text += "\n#{sItemCastConstant}"; } // this the maximum width of the tooltip before it starts word-wrapping @@ -405,7 +405,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info) textWidget->setProperty("Static", "true"); textWidget->setProperty("MultiLine", "true"); textWidget->setProperty("WordWrap", "true"); - textWidget->setCaption(text); + textWidget->setCaptionWithReplacing(text); textWidget->setTextAlign(Align::HCenter | Align::Top); IntSize textSize = textWidget->getTextSize(); @@ -440,6 +440,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info) if (info.enchant != "") { + assert(enchant); Widget* enchantArea = mDynamicToolTipBox->createWidget("", IntCoord(0, totalSize.height, 300, 300-totalSize.height), Align::Stretch, "ToolTipEnchantArea"); @@ -466,7 +467,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info) const int chargeWidth = 204; TextBox* chargeText = enchantArea->createWidget("SandText", IntCoord(0, 0, 10, 18), Align::Default, "ToolTipEnchantChargeText"); - chargeText->setCaption(store.gameSettings.search("sCharges")->str); + chargeText->setCaptionWithReplacing("#{sCharges}"); const int chargeTextWidth = chargeText->getTextSize().width + 5; const int chargeAndTextWidth = chargeWidth + chargeTextWidth; diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index 27a24c22c..fc4220fc3 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -110,7 +110,7 @@ namespace MWGui for (MWWorld::ContainerStoreIterator it = playerStore.begin(); it != playerStore.end(); ++it) { - if (MWWorld::Class::get(*it).getName(*it) == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str) + if (MWWorld::Class::get(*it).getName(*it) == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString()) { goldFound = true; gold = *it; @@ -138,7 +138,7 @@ namespace MWGui { // user notification MWBase::Environment::get().getWindowManager()-> - messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog11")->str, std::vector()); + messageBox("#{sBarterDialog11}", std::vector()); return; } @@ -147,7 +147,7 @@ namespace MWGui { // user notification MWBase::Environment::get().getWindowManager()-> - messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog1")->str, std::vector()); + messageBox("#{sBarterDialog1}", std::vector()); return; } @@ -170,7 +170,7 @@ namespace MWGui { // user notification MWBase::Environment::get().getWindowManager()-> - messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog2")->str, std::vector()); + messageBox("#{sBarterDialog2}", std::vector()); return; } @@ -200,17 +200,16 @@ namespace MWGui void TradeWindow::updateLabels() { - mPlayerGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sYourGold")->str - + " " + boost::lexical_cast(mWindowManager.getInventoryWindow()->getPlayerGold())); + mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + boost::lexical_cast(mWindowManager.getInventoryWindow()->getPlayerGold())); if (mCurrentBalance > 0) { - mTotalBalanceLabel->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sTotalSold")->str); + mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalSold}"); mTotalBalance->setCaption(boost::lexical_cast(mCurrentBalance)); } else { - mTotalBalanceLabel->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sTotalCost")->str); + mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalCost}"); mTotalBalance->setCaption(boost::lexical_cast(-mCurrentBalance)); } @@ -229,8 +228,7 @@ namespace MWGui merchantgold = ref->base->data.gold; } - mMerchantGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSellerGold")->str - + " " + boost::lexical_cast(merchantgold)); + mMerchantGold->setCaptionWithReplacing("#{sSellerGold} " + boost::lexical_cast(merchantgold)); } std::vector TradeWindow::getEquippedItems() diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 890b3bc13..079ebf688 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -47,6 +47,7 @@ #include "levelupdialog.hpp" #include "waitdialog.hpp" #include "spellcreationdialog.hpp" +#include "enchantingdialog.hpp" using namespace MWGui; @@ -77,6 +78,7 @@ WindowManager::WindowManager( , mLevelupDialog(NULL) , mWaitDialog(NULL) , mSpellCreationDialog(NULL) + , mEnchantingDialog(NULL) , mPlayerClass() , mPlayerName() , mPlayerRaceId() @@ -158,6 +160,7 @@ WindowManager::WindowManager( mLevelupDialog = new LevelupDialog(*this); mWaitDialog = new WaitDialog(*this); mSpellCreationDialog = new SpellCreationDialog(*this); + mEnchantingDialog = new EnchantingDialog(*this); mLoadingScreen = new LoadingScreen(mOgre->getScene (), mOgre->getWindow (), *this); mLoadingScreen->onResChange (w,h); @@ -214,6 +217,7 @@ WindowManager::~WindowManager() delete mLevelupDialog; delete mWaitDialog; delete mSpellCreationDialog; + delete mEnchantingDialog; cleanupGarbage(); @@ -264,6 +268,7 @@ void WindowManager::updateVisible() mLevelupDialog->setVisible(false); mWaitDialog->setVisible(false); mSpellCreationDialog->setVisible(false); + mEnchantingDialog->setVisible(false); mHud->setVisible(true); @@ -367,6 +372,9 @@ void WindowManager::updateVisible() case GM_SpellCreation: mSpellCreationDialog->setVisible(true); break; + case GM_Enchanting: + mEnchantingDialog->setVisible(true); + break; case GM_InterMessageBox: break; case GM_Journal: @@ -530,7 +538,7 @@ int WindowManager::readPressedButton () const std::string &WindowManager::getGameSettingString(const std::string &id, const std::string &default_) { - const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.search(id); + const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.find(id); if (setting && setting->type == ESM::VT_String) return setting->str; return default_; @@ -689,7 +697,7 @@ void WindowManager::setDragDrop(bool dragDrop) void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result) { - const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.search(_tag); + const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.find(_tag); if (setting && setting->type == ESM::VT_String) _result = setting->str; else @@ -974,3 +982,8 @@ void WindowManager::startSpellMaking(MWWorld::Ptr actor) { mSpellCreationDialog->startSpellMaking (actor); } + +void WindowManager::startEnchanting (MWWorld::Ptr actor) +{ + mEnchantingDialog->startEnchanting (actor); +} diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index ec9fe8fae..05ef2280b 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -65,7 +65,7 @@ namespace MWGui class LevelupDialog; class WaitDialog; class SpellCreationDialog; - + class EnchantingDialog; class WindowManager : public MWBase::WindowManager { @@ -213,6 +213,7 @@ namespace MWGui virtual bool getPlayerSleeping(); virtual void startSpellMaking(MWWorld::Ptr actor); + virtual void startEnchanting(MWWorld::Ptr actor); private: OEngine::GUI::MyGUIManager *mGuiManager; @@ -242,6 +243,7 @@ namespace MWGui LevelupDialog* mLevelupDialog; WaitDialog* mWaitDialog; SpellCreationDialog* mSpellCreationDialog; + EnchantingDialog* mEnchantingDialog; CharacterCreation* mCharGen; diff --git a/apps/openmw/mwmechanics/npcstats.cpp b/apps/openmw/mwmechanics/npcstats.cpp index 5e3896af2..5367d3110 100644 --- a/apps/openmw/mwmechanics/npcstats.cpp +++ b/apps/openmw/mwmechanics/npcstats.cpp @@ -97,13 +97,13 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla } float typeFactor = - MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMiscSkillBonus")->f; + MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMiscSkillBonus")->getFloat(); for (int i=0; i<5; ++i) if (class_.data.skills[i][0]==skillIndex) { typeFactor = - MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMinorSkillBonus")->f; + MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMinorSkillBonus")->getFloat(); break; } @@ -112,7 +112,7 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla if (class_.data.skills[i][1]==skillIndex) { typeFactor = - MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMajorSkillBonus")->f; + MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMajorSkillBonus")->getFloat(); break; } @@ -125,7 +125,7 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla if (skill->data.specialization==class_.data.specialization) { specialisationFactor = - MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fSpecialSkillBonus")->f; + MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fSpecialSkillBonus")->getFloat(); if (specialisationFactor<=0) throw std::runtime_error ("invalid skill specialisation factor"); @@ -227,3 +227,13 @@ int MWMechanics::NpcStats::getLevelupAttributeMultiplier(int attribute) const else return 5; } + +void MWMechanics::NpcStats::flagAsUsed (const std::string& id) +{ + mUsedIds.insert (id); +} + +bool MWMechanics::NpcStats::hasBeenUsed (const std::string& id) const +{ + return mUsedIds.find (id)!=mUsedIds.end(); +} diff --git a/apps/openmw/mwmechanics/npcstats.hpp b/apps/openmw/mwmechanics/npcstats.hpp index 7c3055783..48e63d7b6 100644 --- a/apps/openmw/mwmechanics/npcstats.hpp +++ b/apps/openmw/mwmechanics/npcstats.hpp @@ -50,6 +50,8 @@ namespace MWMechanics std::vector mSkillIncreases; // number of skill increases for each attribute + std::set mUsedIds; + public: NpcStats(); @@ -86,6 +88,10 @@ namespace MWMechanics int getLevelupAttributeMultiplier(int attribute) const; void levelUp(); + + void flagAsUsed (const std::string& id); + + bool hasBeenUsed (const std::string& id) const; }; } diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index c8852bff5..f755f34ef 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -25,6 +25,7 @@ namespace MWRender , mPosition(position) , mLookAt(lookAt) , mCharacter(character) + , mAnimation(NULL) { } @@ -53,10 +54,13 @@ namespace MWRender mCamera->setNearClipDistance (0.01); mCamera->setFarClipDistance (1000); - mTexture = Ogre::TextureManager::getSingleton().createManual(mName, - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, mSizeX, mSizeY, 0, Ogre::PF_A8R8G8B8, Ogre::TU_RENDERTARGET); + mTexture = Ogre::TextureManager::getSingleton().getByName (mName); + if (mTexture.isNull ()) + mTexture = Ogre::TextureManager::getSingleton().createManual(mName, + Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, mSizeX, mSizeY, 0, Ogre::PF_A8R8G8B8, Ogre::TU_RENDERTARGET); mRenderTarget = mTexture->getBuffer()->getRenderTarget(); + mRenderTarget->removeAllViewports (); mViewport = mRenderTarget->addViewport(mCamera); mViewport->setOverlaysEnabled(false); mViewport->setBackgroundColour(Ogre::ColourValue(0, 0, 0, 0)); @@ -71,7 +75,7 @@ namespace MWRender CharacterPreview::~CharacterPreview () { - Ogre::TextureManager::getSingleton().remove(mName); + //Ogre::TextureManager::getSingleton().remove(mName); mSceneMgr->destroyCamera (mName); delete mAnimation; } diff --git a/apps/openmw/mwrender/player.cpp b/apps/openmw/mwrender/player.cpp index 297cb8d7a..8c8bbb86f 100644 --- a/apps/openmw/mwrender/player.cpp +++ b/apps/openmw/mwrender/player.cpp @@ -323,6 +323,7 @@ namespace MWRender bool Player::getPosition(Ogre::Vector3 &player, Ogre::Vector3 &camera) { float xch; + mCamera->getParentSceneNode ()->needUpdate(true); camera = mCamera->getRealPosition(); xch = camera.z, camera.z = camera.y, camera.y = -xch; player = mPlayerNode->getPosition(); diff --git a/apps/openmw/mwworld/actionread.cpp b/apps/openmw/mwworld/actionread.cpp index fe5e2d58f..ed118d9b8 100644 --- a/apps/openmw/mwworld/actionread.cpp +++ b/apps/openmw/mwworld/actionread.cpp @@ -35,22 +35,21 @@ namespace MWWorld MWBase::Environment::get().getWindowManager()->getBookWindow()->open(getTarget()); } - /* + MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer(); + MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); + // Skill gain from books - if (ref->base->data.skillID >= 0 && ref->base->data.skillID < ESM::Skill::Length) + if (ref->base->data.skillID >= 0 && ref->base->data.skillID < ESM::Skill::Length + && !npcStats.hasBeenUsed (ref->base->id)) { - MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer(); - MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); MWWorld::LiveCellRef *playerRef = player.get(); const ESM::Class *class_ = MWBase::Environment::get().getWorld()->getStore().classes.find ( playerRef->base->cls); npcStats.increaseSkill (ref->base->data.skillID, *class_, true); - /// \todo Remove skill from the book. Right now you can read as many times as you want - /// and the skill will still increase. + npcStats.flagAsUsed (ref->base->id); } - */ } } diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 1d473246c..ed7336e97 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -76,7 +76,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr) // gold needs special handling: when it is inserted into a container, the base object automatically becomes Gold_001 // this ensures that gold piles of different sizes stack with each other (also, several scripts rely on Gold_001 for detecting player gold) - if (MWWorld::Class::get(ptr).getName(ptr) == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str) + if (MWWorld::Class::get(ptr).getName(ptr) == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString()) { MWWorld::LiveCellRef *gold = ptr.get(); diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 0adf87dae..74c9cc9cd 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -41,7 +41,8 @@ const float WeatherGlobals::mThunderSoundDelay = 0.25; WeatherManager::WeatherManager(MWRender::RenderingManager* rendering) : mHour(14), mCurrentWeather("clear"), mFirstUpdate(true), mWeatherUpdateTime(0), mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50), mThunderSoundDelay(0), - mRemainingTransitionTime(0), mMonth(0), mDay(0) + mRemainingTransitionTime(0), mMonth(0), mDay(0), + mTimePassed(0) { mRendering = rendering; @@ -487,7 +488,10 @@ WeatherResult WeatherManager::transition(float factor) void WeatherManager::update(float duration) { - mWeatherUpdateTime -= duration * MWBase::Environment::get().getWorld()->getTimeScaleFactor(); + float timePassed = mTimePassed; + mTimePassed = 0; + + mWeatherUpdateTime -= timePassed; bool exterior = (MWBase::Environment::get().getWorld()->isCellExterior() || MWBase::Environment::get().getWorld()->isCellQuasiExterior()); @@ -558,7 +562,7 @@ void WeatherManager::update(float duration) if (mNextWeather != "") { - mRemainingTransitionTime -= duration * MWBase::Environment::get().getWorld()->getTimeScaleFactor(); + mRemainingTransitionTime -= timePassed; if (mRemainingTransitionTime < 0) { mCurrentWeather = mNextWeather; diff --git a/apps/openmw/mwworld/weather.hpp b/apps/openmw/mwworld/weather.hpp index 5e0388751..589dff3eb 100644 --- a/apps/openmw/mwworld/weather.hpp +++ b/apps/openmw/mwworld/weather.hpp @@ -231,6 +231,11 @@ namespace MWWorld void setDate(const int day, const int month); + void advanceTime(double hours) + { + mTimePassed += hours*3600; + } + unsigned int getWeatherID() const; private: @@ -261,6 +266,8 @@ namespace MWWorld float mThunderChanceNeeded; float mThunderSoundDelay; + double mTimePassed; // time passed since last update + WeatherResult transition(const float factor); WeatherResult getResult(const Ogre::String& weather); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index e9b6e6d12..38063b051 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -366,6 +366,8 @@ namespace MWWorld void World::advanceTime (double hours) { + mWeatherManager->advanceTime (hours); + hours += mGlobalVariables->getFloat ("gamehour"); setHour (hours); @@ -526,7 +528,7 @@ namespace MWWorld std::pair result = mPhysics->getFacedHandle (*this); if (result.first.empty() || - result.second>getStore().gameSettings.find ("iMaxActivateDist")->i) + result.second>getStore().gameSettings.find ("iMaxActivateDist")->getInt()) return ""; return result.first; diff --git a/components/esm/loadbook.cpp b/components/esm/loadbook.cpp index ffa958e14..48d9aed0d 100644 --- a/components/esm/loadbook.cpp +++ b/components/esm/loadbook.cpp @@ -3,7 +3,7 @@ namespace ESM { -void Book::load(ESMReader &esm) +void Book::load(ESMReader &esm, const std::string& recordId) { model = esm.getHNString("MODL"); name = esm.getHNOString("FNAM"); @@ -12,6 +12,7 @@ void Book::load(ESMReader &esm) icon = esm.getHNOString("ITEX"); text = esm.getHNOString("TEXT"); enchant = esm.getHNOString("ENAM"); + id = recordId; } } diff --git a/components/esm/loadbook.hpp b/components/esm/loadbook.hpp index 3a4ab441e..525c21d33 100644 --- a/components/esm/loadbook.hpp +++ b/components/esm/loadbook.hpp @@ -20,8 +20,9 @@ struct Book BKDTstruct data; std::string name, model, icon, script, enchant, text; + std::string id; - void load(ESMReader &esm); + void load(ESMReader &esm, const std::string& recordId); }; } #endif diff --git a/components/esm_store/store.hpp b/components/esm_store/store.hpp index 991925bd4..7329386d4 100644 --- a/components/esm_store/store.hpp +++ b/components/esm_store/store.hpp @@ -34,7 +34,7 @@ namespace ESMS RecListT appas; RecListT armors; RecListT bodyParts; - RecListT books; + RecListWithIDT books; RecListT birthSigns; RecListT classes; RecListT clothes; diff --git a/components/nifbullet/bullet_nif_loader.cpp b/components/nifbullet/bullet_nif_loader.cpp index a70eb7629..6449ad246 100644 --- a/components/nifbullet/bullet_nif_loader.cpp +++ b/components/nifbullet/bullet_nif_loader.cpp @@ -193,7 +193,8 @@ void ManualBulletShapeLoader::handleNode(Nif::Node *node, int flags, // affecting the entire subtree of this node Nif::NiStringExtraData *sd = (Nif::NiStringExtraData*)e; - if (sd->string == "NCO") + // not sure what the difference between NCO and NCC is, or if there even is one + if (sd->string == "NCO" || sd->string == "NCC") { // No collision. Use an internal flag setting to mark this. flags |= 0x800; diff --git a/files/mygui/CMakeLists.txt b/files/mygui/CMakeLists.txt index d948a4cf7..a33d59ef6 100644 --- a/files/mygui/CMakeLists.txt +++ b/files/mygui/CMakeLists.txt @@ -77,6 +77,7 @@ set(MYGUI_FILES openmw_wait_dialog_progressbar.layout openmw_spellcreation_dialog.layout openmw_edit_effect.layout + openmw_enchanting_dialog.layout smallbars.png VeraMono.ttf markers.png diff --git a/files/mygui/openmw_enchanting_dialog.layout b/files/mygui/openmw_enchanting_dialog.layout new file mode 100644 index 000000000..1d622244a --- /dev/null +++ b/files/mygui/openmw_enchanting_dialog.layout @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/libs/openengine/bullet/physic.cpp b/libs/openengine/bullet/physic.cpp index 74352b358..b42ffb84c 100644 --- a/libs/openengine/bullet/physic.cpp +++ b/libs/openengine/bullet/physic.cpp @@ -303,16 +303,11 @@ namespace Physic + boost::lexical_cast(y); // find the minimum and maximum heights (needed for bullet) - float minh; - float maxh; + float minh = heights[0]; + float maxh = heights[0]; for (int i=0; imaxh) maxh = h; if (h