Fixes #1270, Fixes #1201: Update active weapon/spell icons every frame

actorid
scrawl 11 years ago
parent d5dd864404
commit 04964595ef

@ -325,7 +325,6 @@ namespace MWGui
}
store.setSelectedEnchantItem(it);
MWBase::Environment::get().getWindowManager()->setSelectedEnchantItem(item);
}
}

@ -322,7 +322,6 @@ namespace MWGui
}
store.setSelectedEnchantItem(it);
MWBase::Environment::get().getWindowManager()->setSelectedEnchantItem(item);
updateSpells();
}

@ -740,10 +740,6 @@ bool CharacterController::updateWeaponState()
MWBase::Environment::get().getWindowManager()->messageBox(resultMessage);
if(!resultSound.empty())
MWBase::Environment::get().getSoundManager()->playSound(resultSound, 1.0f, 1.0f);
// Set again, just to update the charge bar
if(item.getRefData().getCount())
MWBase::Environment::get().getWindowManager()->setSelectedWeapon(item);
}
else if (ammunition)
{

@ -325,6 +325,19 @@ namespace MWMechanics
winMgr->updateSkillArea();
winMgr->setValue("level", stats.getLevel());
// Update the equipped weapon icon
MWWorld::InventoryStore& inv = mWatched.getClass().getInventoryStore(mWatched);
MWWorld::ContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
if (weapon == inv.end())
winMgr->unsetSelectedWeapon();
else
winMgr->setSelectedWeapon(*weapon);
// Update the selected spell icon
MWWorld::ContainerStoreIterator enchantItem = inv.getSelectedEnchantItem();
if (enchantItem != inv.end())
winMgr->setSelectedEnchantItem(*enchantItem);
}
if (mUpdatePlayer)

@ -575,7 +575,6 @@ namespace MWMechanics
{
if (mCaster.getRefData().getHandle() == "player")
{
MWBase::Environment::get().getWindowManager()->setSelectedEnchantItem(item); // Set again to show the modified charge
mCaster.getClass().skillUsageSucceeded (mCaster, ESM::Skill::Enchant, 3);
}
}

@ -335,13 +335,6 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
//Update the weapon icon in the hud with whatever the player is currently holding.
MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore(ptr);
MWWorld::ContainerStoreIterator item = invStore.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
if (item != invStore.end())
MWBase::Environment::get().getWindowManager()->setSelectedWeapon(*item);
ESM::CellId cellId = ptr.getCell()->getCell()->getCellId();
MWBase::Environment::get().getWorld()->changeToCell (cellId, ptr.getRefData().getPosition());

@ -8,7 +8,6 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwmechanics/npcstats.hpp"
@ -150,10 +149,6 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite
fireEquipmentChangedEvent();
updateMagicEffects(actor);
// Update HUD icon for player weapon
if (slot == MWWorld::InventoryStore::Slot_CarriedRight)
MWBase::Environment::get().getWindowManager()->setSelectedWeapon(*getSlot(slot));
}
void MWWorld::InventoryStore::unequipAll(const MWWorld::Ptr& actor)
@ -494,7 +489,6 @@ int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor
&& *mSelectedEnchantItem == item && actor.getRefData().getHandle() == "player")
{
mSelectedEnchantItem = end();
MWBase::Environment::get().getWindowManager()->unsetSelectedSpell();
}
updateRechargingItems();
@ -532,18 +526,9 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::unequipSlot(int slot, c
if (script != "")
(*it).getRefData().getLocals().setVarByInt(script, "onpcequip", 0);
// Update HUD icon when removing player weapon or selected enchanted item.
// We have to check for both as the weapon could also be the enchanted item.
if (slot == MWWorld::InventoryStore::Slot_CarriedRight)
{
// weapon
MWBase::Environment::get().getWindowManager()->unsetSelectedWeapon();
}
if ((mSelectedEnchantItem != end()) && (mSelectedEnchantItem == it))
{
// enchanted item
mSelectedEnchantItem = end();
MWBase::Environment::get().getWindowManager()->unsetSelectedSpell();
}
}

@ -2056,7 +2056,6 @@ namespace MWWorld
{
// Update the GUI only when called on the player
MWBase::WindowManager* windowManager = MWBase::Environment::get().getWindowManager();
windowManager->unsetSelectedWeapon();
if (werewolf)
{

Loading…
Cancel
Save