Disable Ready Magic and Cycle Weapon/Spell hotkeys for werewolves (Fixes #3100)

openmw-38
scrawl 9 years ago
parent a7c886721c
commit 53334d08a2

@ -302,15 +302,19 @@ namespace MWInput
quickLoad();
break;
case A_CycleSpellLeft:
if (checkAllowedToUseItems())
MWBase::Environment::get().getWindowManager()->cycleSpell(false);
break;
case A_CycleSpellRight:
if (checkAllowedToUseItems())
MWBase::Environment::get().getWindowManager()->cycleSpell(true);
break;
case A_CycleWeaponLeft:
if (checkAllowedToUseItems())
MWBase::Environment::get().getWindowManager()->cycleWeapon(false);
break;
case A_CycleWeaponRight:
if (checkAllowedToUseItems())
MWBase::Environment::get().getWindowManager()->cycleWeapon(true);
break;
case A_Sneak:
@ -346,6 +350,18 @@ namespace MWInput
}
}
bool InputManager::checkAllowedToUseItems() const
{
MWWorld::Ptr player = MWMechanics::getPlayer();
if (player.getClass().getNpcStats(player).isWerewolf())
{
// Cannot use items or spells while in werewolf form
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
return false;
}
return true;
}
void InputManager::update(float dt, bool disableControls, bool disableEvents)
{
mControlsDisabled = disableControls;
@ -902,6 +918,9 @@ namespace MWInput
if (!mControlSwitch["playermagic"] || !mControlSwitch["playercontrols"])
return;
if (!checkAllowedToUseItems())
return;
// Not allowed if no spell selected
MWWorld::InventoryStore& inventory = mPlayer->getPlayer().getClass().getInventoryStore(mPlayer->getPlayer());
if (MWBase::Environment::get().getWindowManager()->getSelectedSpell().empty() &&
@ -1016,13 +1035,8 @@ namespace MWInput
{
if (!mControlSwitch["playercontrols"])
return;
MWWorld::Ptr player = MWMechanics::getPlayer();
if (player.getClass().getNpcStats(player).isWerewolf())
{
// Cannot use items or spells while in werewolf form
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
if (!checkAllowedToUseItems())
return;
}
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
MWBase::Environment::get().getWindowManager()->activateQuickKey (index);
@ -1033,13 +1047,8 @@ namespace MWInput
if (!MWBase::Environment::get().getWindowManager()->isGuiMode ()
&& MWBase::Environment::get().getWorld()->getGlobalFloat ("chargenstate")==-1)
{
MWWorld::Ptr player = MWMechanics::getPlayer();
if (player.getClass().getNpcStats(player).isWerewolf())
{
// Cannot use items or spells while in werewolf form
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
if (!checkAllowedToUseItems())
return;
}
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_QuickKeysMenu);

@ -213,6 +213,8 @@ namespace MWInput
void updateCursorMode();
bool checkAllowedToUseItems() const;
private:
void toggleMainMenu();
void toggleSpell();

Loading…
Cancel
Save