Allow binding Hand To Hand in quick keys menu (Fixes #2024)

celladd
scrawl 10 years ago
parent 7fd1c2c2e2
commit f603a68144

@ -94,12 +94,24 @@ namespace MWGui
while (key->getChildCount()) // Destroy number label
MyGUI::Gui::getInstance().destroyWidget(key->getChildAt(0));
mAssigned[index] = Type_Unassigned;
if (index == 9)
{
mAssigned[index] = Type_HandToHand;
MyGUI::ImageBox* image = key->createWidget<MyGUI::ImageBox>("ImageBox",
MyGUI::IntCoord(14, 13, 32, 32), MyGUI::Align::Default);
image->setImageTexture("icons\\k\\stealth_handtohand.dds");
image->setNeedMouseFocus(false);
}
else
{
mAssigned[index] = Type_Unassigned;
MyGUI::TextBox* textBox = key->createWidgetReal<MyGUI::TextBox>("SandText", MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default);
textBox->setTextAlign (MyGUI::Align::Center);
textBox->setCaption (MyGUI::utility::toString(index+1));
textBox->setNeedMouseFocus (false);
MyGUI::TextBox* textBox = key->createWidgetReal<MyGUI::TextBox>("SandText", MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default);
textBox->setTextAlign (MyGUI::Align::Center);
textBox->setCaption (MyGUI::utility::toString(index+1));
textBox->setNeedMouseFocus (false);
}
}
void QuickKeysMenu::onQuickKeyButtonClicked(MyGUI::Widget* sender)
@ -338,6 +350,11 @@ namespace MWGui
store.setSelectedEnchantItem(it);
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Spell);
}
else if (type == Type_HandToHand)
{
store.unequipSlot(MWWorld::InventoryStore::Slot_CarriedRight, player);
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Weapon);
}
}
// ---------------------------------------------------------------------------------------------------------
@ -409,6 +426,7 @@ namespace MWGui
switch (type)
{
case Type_Unassigned:
case Type_HandToHand:
break;
case Type_Item:
case Type_MagicItem:
@ -489,6 +507,7 @@ namespace MWGui
break;
}
case Type_Unassigned:
case Type_HandToHand:
unassign(button, i);
break;
}

@ -37,15 +37,16 @@ namespace MWGui
void activateQuickKey(int index);
/// @note This enum is serialized, so don't move the items around!
enum QuickKeyType
{
Type_Item,
Type_Magic,
Type_MagicItem,
Type_Unassigned
Type_Unassigned,
Type_HandToHand
};
void write (ESM::ESMWriter& writer);
void readRecord (ESM::ESMReader& reader, uint32_t type);
void clear();

Loading…
Cancel
Save