mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 22:36:43 +00:00
Merge pull request #64 from OpenMW/master
Add OpenMW commits up to 24 Sep
This commit is contained in:
commit
7e4543ffcb
11 changed files with 60 additions and 28 deletions
|
@ -175,6 +175,12 @@ namespace CSMWorld
|
||||||
{
|
{
|
||||||
mContainer[index].setModified(record);
|
mContainer[index].setModified(record);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Overwrite
|
||||||
|
mContainer[index].setModified(record);
|
||||||
|
mContainer[index].merge();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
|
|
|
@ -173,6 +173,16 @@ namespace MWClass
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Light::showsInInventory (const MWWorld::ConstPtr& ptr) const
|
||||||
|
{
|
||||||
|
const ESM::Light* light = ptr.get<ESM::Light>()->mBase;
|
||||||
|
|
||||||
|
if (!(light->mData.mFlags & ESM::Light::Carry))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return Class::showsInInventory(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Light::use (const MWWorld::Ptr& ptr) const
|
boost::shared_ptr<MWWorld::Action> Light::use (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr));
|
||||||
|
|
|
@ -26,6 +26,8 @@ namespace MWClass
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
|
virtual bool showsInInventory (const MWWorld::ConstPtr& ptr) const;
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
|
@ -77,10 +77,8 @@ void InventoryItemModel::update()
|
||||||
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
|
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr item = *it;
|
MWWorld::Ptr item = *it;
|
||||||
// NOTE: Don't show WerewolfRobe objects in the inventory, or allow them to be taken.
|
|
||||||
// Vanilla likely uses a hack like this since there's no other way to prevent it from
|
if (!item.getClass().showsInInventory(item))
|
||||||
// being shown or taken.
|
|
||||||
if(item.getCellRef().getRefId() == "werewolfrobe")
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ItemStack newItem (item, this, item.getRefData().getCount());
|
ItemStack newItem (item, this, item.getRefData().getCount());
|
||||||
|
|
|
@ -545,10 +545,7 @@ namespace MWGui
|
||||||
if(invStore.getSlot(slot) != invStore.end())
|
if(invStore.getSlot(slot) != invStore.end())
|
||||||
{
|
{
|
||||||
MWWorld::Ptr item = *invStore.getSlot(slot);
|
MWWorld::Ptr item = *invStore.getSlot(slot);
|
||||||
// NOTE: Don't allow users to select WerewolfRobe objects in the inventory. Vanilla
|
if (!item.getClass().showsInInventory(item))
|
||||||
// likely uses a hack like this since there's no other way to prevent it from being
|
|
||||||
// taken.
|
|
||||||
if(item.getCellRef().getRefId() == "werewolfrobe")
|
|
||||||
return MWWorld::Ptr();
|
return MWWorld::Ptr();
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,6 +163,10 @@ namespace MWGui
|
||||||
MWWorld::Ptr base = item.mBase;
|
MWWorld::Ptr base = item.mBase;
|
||||||
if(Misc::StringUtils::ciEqual(base.getCellRef().getRefId(), MWWorld::ContainerStore::sGoldId))
|
if(Misc::StringUtils::ciEqual(base.getCellRef().getRefId(), MWWorld::ContainerStore::sGoldId))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!base.getClass().showsInInventory(base))
|
||||||
|
return;
|
||||||
|
|
||||||
if(!base.getClass().canSell(base, services))
|
if(!base.getClass().canSell(base, services))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -362,9 +362,9 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Original engine behavior seems to be to back up during ranged combat
|
// Below behavior for backing up during ranged combat differs from vanilla.
|
||||||
// according to fCombatDistance or opponent's weapon range, unless opponent
|
// Vanilla is observed as backing up only as far as fCombatDistance or
|
||||||
// is also using a ranged weapon
|
// opponent's weapon range, or not backing up if opponent is also using a ranged weapon
|
||||||
if (isDistantCombat && distToTarget < rangeAttack / 4)
|
if (isDistantCombat && distToTarget < rangeAttack / 4)
|
||||||
{
|
{
|
||||||
mMovement.mPosition[1] = -1;
|
mMovement.mPosition[1] = -1;
|
||||||
|
@ -468,6 +468,8 @@ std::string chooseBestAttack(const ESM::Weapon* weapon)
|
||||||
else
|
else
|
||||||
attackType = "chop";
|
attackType = "chop";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
MWMechanics::CharacterController::setAttackTypeRandomly(attackType);
|
||||||
|
|
||||||
return attackType;
|
return attackType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1312,9 +1312,9 @@ bool CharacterController::updateWeaponState()
|
||||||
mAttackType = "shoot";
|
mAttackType = "shoot";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isWeapon)
|
if(mPtr == getPlayer())
|
||||||
{
|
{
|
||||||
if(mPtr == getPlayer())
|
if (isWeapon)
|
||||||
{
|
{
|
||||||
if (Settings::Manager::getBool("best attack", "Game"))
|
if (Settings::Manager::getBool("best attack", "Game"))
|
||||||
{
|
{
|
||||||
|
@ -1324,10 +1324,10 @@ bool CharacterController::updateWeaponState()
|
||||||
else
|
else
|
||||||
setAttackTypeBasedOnMovement();
|
setAttackTypeBasedOnMovement();
|
||||||
}
|
}
|
||||||
// else if (mPtr != getPlayer()) use mAttackType already set by AiCombat
|
else
|
||||||
|
setAttackTypeRandomly(mAttackType);
|
||||||
}
|
}
|
||||||
else
|
// else if (mPtr != getPlayer()) use mAttackType set by AiCombat
|
||||||
setAttackTypeRandomly();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mAnimation->play(mCurrentWeapon, priorityWeapon,
|
mAnimation->play(mCurrentWeapon, priorityWeapon,
|
||||||
|
@ -2188,17 +2188,6 @@ void CharacterController::updateMagicEffects()
|
||||||
mAnimation->setLightEffect(light);
|
mAnimation->setLightEffect(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterController::setAttackTypeRandomly()
|
|
||||||
{
|
|
||||||
float random = Misc::Rng::rollProbability();
|
|
||||||
if (random >= 2/3.f)
|
|
||||||
mAttackType = "thrust";
|
|
||||||
else if (random >= 1/3.f)
|
|
||||||
mAttackType = "slash";
|
|
||||||
else
|
|
||||||
mAttackType = "chop";
|
|
||||||
}
|
|
||||||
|
|
||||||
void CharacterController::setAttackTypeBasedOnMovement()
|
void CharacterController::setAttackTypeBasedOnMovement()
|
||||||
{
|
{
|
||||||
float *move = mPtr.getClass().getMovementSettings(mPtr).mPosition;
|
float *move = mPtr.getClass().getMovementSettings(mPtr).mPosition;
|
||||||
|
@ -2240,6 +2229,17 @@ void CharacterController::setAIAttackType(std::string attackType)
|
||||||
mAttackType = attackType;
|
mAttackType = attackType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CharacterController::setAttackTypeRandomly(std::string& attackType)
|
||||||
|
{
|
||||||
|
float random = Misc::Rng::rollProbability();
|
||||||
|
if (random >= 2/3.f)
|
||||||
|
attackType = "thrust";
|
||||||
|
else if (random >= 1/3.f)
|
||||||
|
attackType = "slash";
|
||||||
|
else
|
||||||
|
attackType = "chop";
|
||||||
|
}
|
||||||
|
|
||||||
bool CharacterController::readyToPrepareAttack() const
|
bool CharacterController::readyToPrepareAttack() const
|
||||||
{
|
{
|
||||||
return (mHitState == CharState_None || mHitState == CharState_Block)
|
return (mHitState == CharState_None || mHitState == CharState_Block)
|
||||||
|
|
|
@ -198,7 +198,6 @@ class CharacterController : public MWRender::Animation::TextKeyListener
|
||||||
bool mAttackingOrSpell;
|
bool mAttackingOrSpell;
|
||||||
|
|
||||||
void setAttackTypeBasedOnMovement();
|
void setAttackTypeBasedOnMovement();
|
||||||
void setAttackTypeRandomly();
|
|
||||||
|
|
||||||
void refreshCurrentAnims(CharacterState idle, CharacterState movement, JumpingState jump, bool force=false);
|
void refreshCurrentAnims(CharacterState idle, CharacterState movement, JumpingState jump, bool force=false);
|
||||||
void refreshHitRecoilAnims();
|
void refreshHitRecoilAnims();
|
||||||
|
@ -270,6 +269,7 @@ public:
|
||||||
|
|
||||||
void setAttackingOrSpell(bool attackingOrSpell);
|
void setAttackingOrSpell(bool attackingOrSpell);
|
||||||
void setAIAttackType(std::string attackType); // set and used by AiCombat
|
void setAIAttackType(std::string attackType); // set and used by AiCombat
|
||||||
|
static void setAttackTypeRandomly(std::string& attackType);
|
||||||
|
|
||||||
bool readyToPrepareAttack() const;
|
bool readyToPrepareAttack() const;
|
||||||
bool readyToStartAttack() const;
|
bool readyToStartAttack() const;
|
||||||
|
|
|
@ -277,6 +277,14 @@ namespace MWWorld
|
||||||
throw std::runtime_error ("class does not have a tool tip");
|
throw std::runtime_error ("class does not have a tool tip");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Class::showsInInventory (const ConstPtr& ptr) const
|
||||||
|
{
|
||||||
|
// NOTE: Don't show WerewolfRobe objects in the inventory, or allow them to be taken.
|
||||||
|
// Vanilla likely uses a hack like this since there's no other way to prevent it from
|
||||||
|
// being shown or taken.
|
||||||
|
return (ptr.getCellRef().getRefId() != "werewolfrobe");
|
||||||
|
}
|
||||||
|
|
||||||
bool Class::hasToolTip (const ConstPtr& ptr) const
|
bool Class::hasToolTip (const ConstPtr& ptr) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -98,6 +98,11 @@ namespace MWWorld
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const ConstPtr& ptr, int count) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const ConstPtr& ptr, int count) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
|
virtual bool showsInInventory (const ConstPtr& ptr) const;
|
||||||
|
///< Return whether ptr shows in inventory views.
|
||||||
|
/// Hidden items are not displayed and cannot be (re)moved by the user.
|
||||||
|
/// \return True if shown, false if hidden.
|
||||||
|
|
||||||
virtual MWMechanics::NpcStats& getNpcStats (const Ptr& ptr) const;
|
virtual MWMechanics::NpcStats& getNpcStats (const Ptr& ptr) const;
|
||||||
///< Return NPC stats or throw an exception, if class does not have NPC stats
|
///< Return NPC stats or throw an exception, if class does not have NPC stats
|
||||||
/// (default implementation: throw an exception)
|
/// (default implementation: throw an exception)
|
||||||
|
|
Loading…
Reference in a new issue