mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-22 22:40:12 +00:00
Merge branch 'rename-drawstate' into 'master'
Rename DrawState_ to DrawState and use enum class See merge request OpenMW/openmw!2151
This commit is contained in:
commit
79cc55b2a3
27 changed files with 67 additions and 67 deletions
|
@ -234,7 +234,7 @@ namespace MWClass
|
||||||
const MWWorld::Store<ESM::GameSetting> &gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
const MWWorld::Store<ESM::GameSetting> &gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
MWMechanics::CreatureStats &stats = getCreatureStats(ptr);
|
MWMechanics::CreatureStats &stats = getCreatureStats(ptr);
|
||||||
|
|
||||||
if (stats.getDrawState() != MWMechanics::DrawState_Weapon)
|
if (stats.getDrawState() != MWMechanics::DrawState::Weapon)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get the weapon used (if hand-to-hand, weapon = inv.end())
|
// Get the weapon used (if hand-to-hand, weapon = inv.end())
|
||||||
|
|
|
@ -995,7 +995,7 @@ namespace MWClass
|
||||||
else
|
else
|
||||||
moveSpeed = getWalkSpeed(ptr);
|
moveSpeed = getWalkSpeed(ptr);
|
||||||
|
|
||||||
if(stats.isWerewolf() && running && stats.getDrawState() == MWMechanics::DrawState_Nothing)
|
if(stats.isWerewolf() && running && stats.getDrawState() == MWMechanics::DrawState::Nothing)
|
||||||
moveSpeed *= gmst.fWereWolfRunMult->mValue.getFloat();
|
moveSpeed *= gmst.fWereWolfRunMult->mValue.getFloat();
|
||||||
|
|
||||||
return moveSpeed;
|
return moveSpeed;
|
||||||
|
|
|
@ -416,7 +416,7 @@ namespace MWGui
|
||||||
// change draw state only if the item is in player's right hand
|
// change draw state only if the item is in player's right hand
|
||||||
if (rightHand != store.end() && item == *rightHand)
|
if (rightHand != store.end() && item == *rightHand)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Weapon);
|
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState::Weapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (key->type == Type_MagicItem)
|
else if (key->type == Type_MagicItem)
|
||||||
|
@ -432,7 +432,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
store.setSelectedEnchantItem(it);
|
store.setSelectedEnchantItem(it);
|
||||||
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Spell);
|
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState::Spell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (key->type == Type_Magic)
|
else if (key->type == Type_Magic)
|
||||||
|
@ -452,12 +452,12 @@ namespace MWGui
|
||||||
store.setSelectedEnchantItem(store.end());
|
store.setSelectedEnchantItem(store.end());
|
||||||
MWBase::Environment::get().getWindowManager()
|
MWBase::Environment::get().getWindowManager()
|
||||||
->setSelectedSpell(spellId, int(MWMechanics::getSpellSuccessChance(spellId, player)));
|
->setSelectedSpell(spellId, int(MWMechanics::getSpellSuccessChance(spellId, player)));
|
||||||
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Spell);
|
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState::Spell);
|
||||||
}
|
}
|
||||||
else if (key->type == Type_HandToHand)
|
else if (key->type == Type_HandToHand)
|
||||||
{
|
{
|
||||||
store.unequipSlot(MWWorld::InventoryStore::Slot_CarriedRight, player);
|
store.unequipSlot(MWWorld::InventoryStore::Slot_CarriedRight, player);
|
||||||
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Weapon);
|
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState::Weapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1376,8 +1376,8 @@ namespace MWGui
|
||||||
mHud->unsetSelectedSpell();
|
mHud->unsetSelectedSpell();
|
||||||
|
|
||||||
MWWorld::Player* player = &MWBase::Environment::get().getWorld()->getPlayer();
|
MWWorld::Player* player = &MWBase::Environment::get().getWorld()->getPlayer();
|
||||||
if (player->getDrawState() == MWMechanics::DrawState_Spell)
|
if (player->getDrawState() == MWMechanics::DrawState::Spell)
|
||||||
player->setDrawState(MWMechanics::DrawState_Nothing);
|
player->setDrawState(MWMechanics::DrawState::Nothing);
|
||||||
|
|
||||||
mSpellWindow->setTitle("#{sNone}");
|
mSpellWindow->setTitle("#{sNone}");
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,11 +355,11 @@ namespace MWInput
|
||||||
if (MWBase::Environment::get().getMechanicsManager()->isAttackingOrSpell(player.getPlayer()))
|
if (MWBase::Environment::get().getMechanicsManager()->isAttackingOrSpell(player.getPlayer()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MWMechanics::DrawState_ state = player.getDrawState();
|
MWMechanics::DrawState state = player.getDrawState();
|
||||||
if (state == MWMechanics::DrawState_Weapon || state == MWMechanics::DrawState_Nothing)
|
if (state == MWMechanics::DrawState::Weapon || state == MWMechanics::DrawState::Nothing)
|
||||||
player.setDrawState(MWMechanics::DrawState_Spell);
|
player.setDrawState(MWMechanics::DrawState::Spell);
|
||||||
else
|
else
|
||||||
player.setDrawState(MWMechanics::DrawState_Nothing);
|
player.setDrawState(MWMechanics::DrawState::Nothing);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionManager::quickLoad()
|
void ActionManager::quickLoad()
|
||||||
|
@ -390,11 +390,11 @@ namespace MWInput
|
||||||
else if (MWBase::Environment::get().getMechanicsManager()->isAttackingOrSpell(player.getPlayer()))
|
else if (MWBase::Environment::get().getMechanicsManager()->isAttackingOrSpell(player.getPlayer()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MWMechanics::DrawState_ state = player.getDrawState();
|
MWMechanics::DrawState state = player.getDrawState();
|
||||||
if (state == MWMechanics::DrawState_Spell || state == MWMechanics::DrawState_Nothing)
|
if (state == MWMechanics::DrawState::Spell || state == MWMechanics::DrawState::Nothing)
|
||||||
player.setDrawState(MWMechanics::DrawState_Weapon);
|
player.setDrawState(MWMechanics::DrawState::Weapon);
|
||||||
else
|
else
|
||||||
player.setDrawState(MWMechanics::DrawState_Nothing);
|
player.setDrawState(MWMechanics::DrawState::Nothing);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionManager::rest()
|
void ActionManager::rest()
|
||||||
|
|
|
@ -709,8 +709,8 @@ namespace MWInput
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MWWorld::Player& player = MWBase::Environment::get().getWorld()->getPlayer();
|
MWWorld::Player& player = MWBase::Environment::get().getWorld()->getPlayer();
|
||||||
MWMechanics::DrawState_ state = player.getDrawState();
|
MWMechanics::DrawState state = player.getDrawState();
|
||||||
player.setAttackingOrSpell(currentValue != 0 && state != MWMechanics::DrawState_Nothing);
|
player.setAttackingOrSpell(currentValue != 0 && state != MWMechanics::DrawState::Nothing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (action == A_Jump)
|
else if (action == A_Jump)
|
||||||
|
|
|
@ -114,10 +114,10 @@ namespace MWLua
|
||||||
|
|
||||||
void addActorBindings(sol::table actor, const Context& context)
|
void addActorBindings(sol::table actor, const Context& context)
|
||||||
{
|
{
|
||||||
actor["STANCE"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs<std::string_view, int>({
|
actor["STANCE"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs<std::string_view, MWMechanics::DrawState>({
|
||||||
{"Nothing", MWMechanics::DrawState_Nothing},
|
{"Nothing", MWMechanics::DrawState::Nothing},
|
||||||
{"Weapon", MWMechanics::DrawState_Weapon},
|
{"Weapon", MWMechanics::DrawState::Weapon},
|
||||||
{"Spell", MWMechanics::DrawState_Spell},
|
{"Spell", MWMechanics::DrawState::Spell},
|
||||||
}));
|
}));
|
||||||
actor["EQUIPMENT_SLOT"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs<std::string_view, int>({
|
actor["EQUIPMENT_SLOT"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs<std::string_view, int>({
|
||||||
{"Helmet", MWWorld::InventoryStore::Slot_Helmet},
|
{"Helmet", MWWorld::InventoryStore::Slot_Helmet},
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
const MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtr(mObjectId, false); //The target to follow
|
const MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtr(mObjectId, false); //The target to follow
|
||||||
|
|
||||||
actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing);
|
actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Nothing);
|
||||||
|
|
||||||
// Stop if the target doesn't exist
|
// Stop if the target doesn't exist
|
||||||
// Really we should be checking whether the target is currently registered with the MechanicsManager
|
// Really we should be checking whether the target is currently registered with the MechanicsManager
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace MWMechanics
|
||||||
void ActionSpell::prepare(const MWWorld::Ptr &actor)
|
void ActionSpell::prepare(const MWWorld::Ptr &actor)
|
||||||
{
|
{
|
||||||
actor.getClass().getCreatureStats(actor).getSpells().setSelectedSpell(mSpellId);
|
actor.getClass().getCreatureStats(actor).getSpells().setSelectedSpell(mSpellId);
|
||||||
actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Spell);
|
actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Spell);
|
||||||
if (actor.getClass().hasInventoryStore(actor))
|
if (actor.getClass().hasInventoryStore(actor))
|
||||||
{
|
{
|
||||||
MWWorld::InventoryStore& inv = actor.getClass().getInventoryStore(actor);
|
MWWorld::InventoryStore& inv = actor.getClass().getInventoryStore(actor);
|
||||||
|
@ -64,7 +64,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
actor.getClass().getCreatureStats(actor).getSpells().setSelectedSpell(std::string());
|
actor.getClass().getCreatureStats(actor).getSpells().setSelectedSpell(std::string());
|
||||||
actor.getClass().getInventoryStore(actor).setSelectedEnchantItem(mItem);
|
actor.getClass().getInventoryStore(actor).setSelectedEnchantItem(mItem);
|
||||||
actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Spell);
|
actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Spell);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ActionEnchantedItem::getCombatRange(bool& isRanged) const
|
float ActionEnchantedItem::getCombatRange(bool& isRanged) const
|
||||||
|
@ -106,7 +106,7 @@ namespace MWMechanics
|
||||||
equip.execute(actor);
|
equip.execute(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Weapon);
|
actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Weapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ActionWeapon::getCombatRange(bool& isRanged) const
|
float ActionWeapon::getCombatRange(bool& isRanged) const
|
||||||
|
@ -324,7 +324,7 @@ namespace MWMechanics
|
||||||
static const float fHandToHandReach = gmst.find("fHandToHandReach")->mValue.getFloat();
|
static const float fHandToHandReach = gmst.find("fHandToHandReach")->mValue.getFloat();
|
||||||
dist = fHandToHandReach;
|
dist = fHandToHandReach;
|
||||||
}
|
}
|
||||||
else if (stats.getDrawState() == MWMechanics::DrawState_Spell)
|
else if (stats.getDrawState() == MWMechanics::DrawState::Spell)
|
||||||
{
|
{
|
||||||
dist = 1.0f;
|
dist = 1.0f;
|
||||||
if (!selectedSpellId.empty())
|
if (!selectedSpellId.empty())
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace MWMechanics
|
||||||
if (!mCellId.empty() && mCellId != actor.getCell()->getCell()->getCellId().mWorldspace)
|
if (!mCellId.empty() && mCellId != actor.getCell()->getCell()->getCellId().mWorldspace)
|
||||||
return false; // Not in the correct cell, pause and rely on the player to go back through a teleport door
|
return false; // Not in the correct cell, pause and rely on the player to go back through a teleport door
|
||||||
|
|
||||||
actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing);
|
actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Nothing);
|
||||||
actor.getClass().getCreatureStats(actor).setMovementFlag(CreatureStats::Flag_Run, false);
|
actor.getClass().getCreatureStats(actor).setMovementFlag(CreatureStats::Flag_Run, false);
|
||||||
|
|
||||||
const MWWorld::Ptr follower = MWBase::Environment::get().getWorld()->getPtr(mTargetActorRefId, false);
|
const MWWorld::Ptr follower = MWBase::Environment::get().getWorld()->getPtr(mTargetActorRefId, false);
|
||||||
|
|
|
@ -72,7 +72,7 @@ bool AiFollow::execute (const MWWorld::Ptr& actor, CharacterController& characte
|
||||||
if (target == MWWorld::Ptr() || !target.getRefData().getCount() || !target.getRefData().isEnabled())
|
if (target == MWWorld::Ptr() || !target.getRefData().getCount() || !target.getRefData().isEnabled())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing);
|
actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Nothing);
|
||||||
|
|
||||||
AiFollowStorage& storage = state.get<AiFollowStorage>();
|
AiFollowStorage& storage = state.get<AiFollowStorage>();
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ bool AiPursue::execute (const MWWorld::Ptr& actor, CharacterController& characte
|
||||||
if (target.getClass().getCreatureStats(target).isDead())
|
if (target.getClass().getCreatureStats(target).isDead())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing);
|
actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Nothing);
|
||||||
|
|
||||||
//Set the target destination
|
//Set the target destination
|
||||||
const osg::Vec3f dest = target.getRefData().getPosition().asVec3();
|
const osg::Vec3f dest = target.getRefData().getPosition().asVec3();
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace MWMechanics
|
||||||
const osg::Vec3f targetPos(mX, mY, mZ);
|
const osg::Vec3f targetPos(mX, mY, mZ);
|
||||||
|
|
||||||
stats.setMovementFlag(CreatureStats::Flag_Run, false);
|
stats.setMovementFlag(CreatureStats::Flag_Run, false);
|
||||||
stats.setDrawState(DrawState_Nothing);
|
stats.setDrawState(DrawState::Nothing);
|
||||||
|
|
||||||
// Note: we should cancel internal "return after combat" package, if original location is too far away
|
// Note: we should cancel internal "return after combat" package, if original location is too far away
|
||||||
if (!isWithinMaxRange(targetPos, actorPos))
|
if (!isWithinMaxRange(targetPos, actorPos))
|
||||||
|
|
|
@ -196,7 +196,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
mRemainingDuration -= ((duration*MWBase::Environment::get().getWorld()->getTimeScaleFactor()) / 3600);
|
mRemainingDuration -= ((duration*MWBase::Environment::get().getWorld()->getTimeScaleFactor()) / 3600);
|
||||||
|
|
||||||
cStats.setDrawState(DrawState_Nothing);
|
cStats.setDrawState(DrawState::Nothing);
|
||||||
cStats.setMovementFlag(CreatureStats::Flag_Run, false);
|
cStats.setMovementFlag(CreatureStats::Flag_Run, false);
|
||||||
|
|
||||||
ESM::Position pos = actor.getRefData().getPosition();
|
ESM::Position pos = actor.getRefData().getPosition();
|
||||||
|
|
|
@ -1104,9 +1104,9 @@ bool CharacterController::updateState(CharacterState idle)
|
||||||
const MWWorld::Class &cls = mPtr.getClass();
|
const MWWorld::Class &cls = mPtr.getClass();
|
||||||
CreatureStats &stats = cls.getCreatureStats(mPtr);
|
CreatureStats &stats = cls.getCreatureStats(mPtr);
|
||||||
int weaptype = ESM::Weapon::None;
|
int weaptype = ESM::Weapon::None;
|
||||||
if(stats.getDrawState() == DrawState_Weapon)
|
if(stats.getDrawState() == DrawState::Weapon)
|
||||||
weaptype = ESM::Weapon::HandToHand;
|
weaptype = ESM::Weapon::HandToHand;
|
||||||
else if (stats.getDrawState() == DrawState_Spell)
|
else if (stats.getDrawState() == DrawState::Spell)
|
||||||
weaptype = ESM::Weapon::Spell;
|
weaptype = ESM::Weapon::Spell;
|
||||||
|
|
||||||
const bool isWerewolf = cls.isNpc() && cls.getNpcStats(mPtr).isWerewolf();
|
const bool isWerewolf = cls.isNpc() && cls.getNpcStats(mPtr).isWerewolf();
|
||||||
|
@ -1118,7 +1118,7 @@ bool CharacterController::updateState(CharacterState idle)
|
||||||
{
|
{
|
||||||
MWWorld::InventoryStore &inv = cls.getInventoryStore(mPtr);
|
MWWorld::InventoryStore &inv = cls.getInventoryStore(mPtr);
|
||||||
MWWorld::ContainerStoreIterator weapon = getActiveWeapon(mPtr, &weaptype);
|
MWWorld::ContainerStoreIterator weapon = getActiveWeapon(mPtr, &weaptype);
|
||||||
if(stats.getDrawState() == DrawState_Spell)
|
if(stats.getDrawState() == DrawState::Spell)
|
||||||
weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||||
|
|
||||||
if(weapon != inv.end() && mWeaponType != ESM::Weapon::HandToHand && weaptype != ESM::Weapon::HandToHand && weaptype != ESM::Weapon::Spell && weaptype != ESM::Weapon::None)
|
if(weapon != inv.end() && mWeaponType != ESM::Weapon::HandToHand && weaptype != ESM::Weapon::HandToHand && weaptype != ESM::Weapon::Spell && weaptype != ESM::Weapon::None)
|
||||||
|
@ -1910,7 +1910,7 @@ void CharacterController::update(float duration)
|
||||||
else if (canMove)
|
else if (canMove)
|
||||||
{
|
{
|
||||||
float targetMovementAngle = vec.y() >= 0 ? std::atan2(-vec.x(), vec.y()) : std::atan2(vec.x(), -vec.y());
|
float targetMovementAngle = vec.y() >= 0 ? std::atan2(-vec.x(), vec.y()) : std::atan2(vec.x(), -vec.y());
|
||||||
movementSettings.mIsStrafing = (stats.getDrawState() != MWMechanics::DrawState_Nothing || inwater)
|
movementSettings.mIsStrafing = (stats.getDrawState() != MWMechanics::DrawState::Nothing || inwater)
|
||||||
&& std::abs(targetMovementAngle) > osg::DegreesToRadians(60.0f);
|
&& std::abs(targetMovementAngle) > osg::DegreesToRadians(60.0f);
|
||||||
if (movementSettings.mIsStrafing)
|
if (movementSettings.mIsStrafing)
|
||||||
targetMovementAngle = 0;
|
targetMovementAngle = 0;
|
||||||
|
@ -1929,7 +1929,7 @@ void CharacterController::update(float duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
mAnimation->setLegsYawRadians(stats.getSideMovementAngle());
|
mAnimation->setLegsYawRadians(stats.getSideMovementAngle());
|
||||||
if (stats.getDrawState() == MWMechanics::DrawState_Nothing || inwater)
|
if (stats.getDrawState() == MWMechanics::DrawState::Nothing || inwater)
|
||||||
mAnimation->setUpperBodyYawRadians(stats.getSideMovementAngle() / 2);
|
mAnimation->setUpperBodyYawRadians(stats.getSideMovementAngle() / 2);
|
||||||
else
|
else
|
||||||
mAnimation->setUpperBodyYawRadians(stats.getSideMovementAngle() / 4);
|
mAnimation->setUpperBodyYawRadians(stats.getSideMovementAngle() / 4);
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace MWMechanics
|
||||||
int CreatureStats::sActorId = 0;
|
int CreatureStats::sActorId = 0;
|
||||||
|
|
||||||
CreatureStats::CreatureStats()
|
CreatureStats::CreatureStats()
|
||||||
: mDrawState (DrawState_Nothing), mDead (false), mDeathAnimationFinished(false), mDied (false), mMurdered(false), mFriendlyHits (0),
|
: mDrawState (DrawState::Nothing), mDead (false), mDeathAnimationFinished(false), mDied (false), mMurdered(false), mFriendlyHits (0),
|
||||||
mTalkedTo (false), mAlarmed (false), mAttacked (false),
|
mTalkedTo (false), mAlarmed (false), mAttacked (false),
|
||||||
mKnockdown(false), mKnockdownOneFrame(false), mKnockdownOverOneFrame(false),
|
mKnockdown(false), mKnockdownOneFrame(false), mKnockdownOverOneFrame(false),
|
||||||
mHitRecovery(false), mBlock(false), mMovementFlags(0),
|
mHitRecovery(false), mBlock(false), mMovementFlags(0),
|
||||||
|
@ -499,12 +499,12 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawState_ CreatureStats::getDrawState() const
|
DrawState CreatureStats::getDrawState() const
|
||||||
{
|
{
|
||||||
return mDrawState;
|
return mDrawState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatureStats::setDrawState(DrawState_ state)
|
void CreatureStats::setDrawState(DrawState state)
|
||||||
{
|
{
|
||||||
mDrawState = state;
|
mDrawState = state;
|
||||||
}
|
}
|
||||||
|
@ -542,7 +542,7 @@ namespace MWMechanics
|
||||||
state.mLastHitObject = mLastHitObject;
|
state.mLastHitObject = mLastHitObject;
|
||||||
state.mLastHitAttemptObject = mLastHitAttemptObject;
|
state.mLastHitAttemptObject = mLastHitAttemptObject;
|
||||||
state.mRecalcDynamicStats = false;
|
state.mRecalcDynamicStats = false;
|
||||||
state.mDrawState = mDrawState;
|
state.mDrawState = static_cast<int>(mDrawState);
|
||||||
state.mLevel = mLevel;
|
state.mLevel = mLevel;
|
||||||
state.mActorId = mActorId;
|
state.mActorId = mActorId;
|
||||||
state.mDeathAnimation = mDeathAnimation;
|
state.mDeathAnimation = mDeathAnimation;
|
||||||
|
@ -596,7 +596,7 @@ namespace MWMechanics
|
||||||
mFallHeight = state.mFallHeight;
|
mFallHeight = state.mFallHeight;
|
||||||
mLastHitObject = state.mLastHitObject;
|
mLastHitObject = state.mLastHitObject;
|
||||||
mLastHitAttemptObject = state.mLastHitAttemptObject;
|
mLastHitAttemptObject = state.mLastHitAttemptObject;
|
||||||
mDrawState = DrawState_(state.mDrawState);
|
mDrawState = DrawState(state.mDrawState);
|
||||||
mLevel = state.mLevel;
|
mLevel = state.mLevel;
|
||||||
mActorId = state.mActorId;
|
mActorId = state.mActorId;
|
||||||
mDeathAnimation = state.mDeathAnimation;
|
mDeathAnimation = state.mDeathAnimation;
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace MWMechanics
|
||||||
class CreatureStats
|
class CreatureStats
|
||||||
{
|
{
|
||||||
static int sActorId;
|
static int sActorId;
|
||||||
DrawState_ mDrawState;
|
DrawState mDrawState;
|
||||||
AttributeValue mAttributes[ESM::Attribute::Length];
|
AttributeValue mAttributes[ESM::Attribute::Length];
|
||||||
DynamicStat<float> mDynamic[3]; // health, magicka, fatigue
|
DynamicStat<float> mDynamic[3]; // health, magicka, fatigue
|
||||||
Spells mSpells;
|
Spells mSpells;
|
||||||
|
@ -98,8 +98,8 @@ namespace MWMechanics
|
||||||
public:
|
public:
|
||||||
CreatureStats();
|
CreatureStats();
|
||||||
|
|
||||||
DrawState_ getDrawState() const;
|
DrawState getDrawState() const;
|
||||||
void setDrawState(DrawState_ state);
|
void setDrawState(DrawState state);
|
||||||
|
|
||||||
void recalculateMagicka();
|
void recalculateMagicka();
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
/// \note The _ suffix is required to avoid a collision with a Windoze macro. Die, Microsoft! Die!
|
|
||||||
enum DrawState_
|
enum class DrawState
|
||||||
{
|
{
|
||||||
DrawState_Nothing = 0,
|
Nothing = 0,
|
||||||
DrawState_Weapon = 1,
|
Weapon = 1,
|
||||||
DrawState_Spell = 2
|
Spell = 2
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -571,7 +571,7 @@ namespace MWMechanics
|
||||||
x += fDispDiseaseMod;
|
x += fDispDiseaseMod;
|
||||||
|
|
||||||
static const float fDispWeaponDrawn = gmst.find("fDispWeaponDrawn")->mValue.getFloat();
|
static const float fDispWeaponDrawn = gmst.find("fDispWeaponDrawn")->mValue.getFloat();
|
||||||
if (playerStats.getDrawState() == MWMechanics::DrawState_Weapon)
|
if (playerStats.getDrawState() == MWMechanics::DrawState::Weapon)
|
||||||
x += fDispWeaponDrawn;
|
x += fDispWeaponDrawn;
|
||||||
|
|
||||||
x += ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Charm).getMagnitude();
|
x += ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Charm).getMagnitude();
|
||||||
|
@ -1789,8 +1789,8 @@ namespace MWMechanics
|
||||||
MWWorld::Player* player = &MWBase::Environment::get().getWorld()->getPlayer();
|
MWWorld::Player* player = &MWBase::Environment::get().getWorld()->getPlayer();
|
||||||
|
|
||||||
// Werewolfs can not cast spells, so we need to unset the prepared spell if there is one.
|
// Werewolfs can not cast spells, so we need to unset the prepared spell if there is one.
|
||||||
if (npcStats.getDrawState() == MWMechanics::DrawState_Spell)
|
if (npcStats.getDrawState() == MWMechanics::DrawState::Spell)
|
||||||
npcStats.setDrawState(MWMechanics::DrawState_Nothing);
|
npcStats.setDrawState(MWMechanics::DrawState::Nothing);
|
||||||
|
|
||||||
npcStats.setWerewolf(werewolf);
|
npcStats.setWerewolf(werewolf);
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ namespace
|
||||||
|
|
||||||
// change draw state only if the item is in player's right hand
|
// change draw state only if the item is in player's right hand
|
||||||
if (slot == MWWorld::InventoryStore::Slot_CarriedRight)
|
if (slot == MWWorld::InventoryStore::Slot_CarriedRight)
|
||||||
player.setDrawState(MWMechanics::DrawState_Weapon);
|
player.setDrawState(MWMechanics::DrawState::Weapon);
|
||||||
|
|
||||||
if (prevItem != store.end())
|
if (prevItem != store.end())
|
||||||
player.setPreviousItem(itemId, prevItem->getCellRef().getRefId());
|
player.setPreviousItem(itemId, prevItem->getCellRef().getRefId());
|
||||||
|
|
|
@ -249,7 +249,7 @@ namespace MWMechanics
|
||||||
return 0.f;
|
return 0.f;
|
||||||
|
|
||||||
// Enemy doesn't attack
|
// Enemy doesn't attack
|
||||||
if (stats.getDrawState() != MWMechanics::DrawState_Weapon)
|
if (stats.getDrawState() != MWMechanics::DrawState::Weapon)
|
||||||
return 0.f;
|
return 0.f;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -270,7 +270,7 @@ namespace MWMechanics
|
||||||
return 0.f;
|
return 0.f;
|
||||||
|
|
||||||
// Enemy doesn't cast spells
|
// Enemy doesn't cast spells
|
||||||
if (stats.getDrawState() != MWMechanics::DrawState_Spell)
|
if (stats.getDrawState() != MWMechanics::DrawState::Spell)
|
||||||
return 0.f;
|
return 0.f;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -288,7 +288,7 @@ namespace MWMechanics
|
||||||
return 0.f;
|
return 0.f;
|
||||||
|
|
||||||
// Enemy doesn't cast spells
|
// Enemy doesn't cast spells
|
||||||
if (stats.getDrawState() != MWMechanics::DrawState_Spell)
|
if (stats.getDrawState() != MWMechanics::DrawState::Spell)
|
||||||
return 0.f;
|
return 0.f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,13 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
MWWorld::InventoryStore &inv = actor.getClass().getInventoryStore(actor);
|
MWWorld::InventoryStore &inv = actor.getClass().getInventoryStore(actor);
|
||||||
CreatureStats &stats = actor.getClass().getCreatureStats(actor);
|
CreatureStats &stats = actor.getClass().getCreatureStats(actor);
|
||||||
if(stats.getDrawState() == MWMechanics::DrawState_Spell)
|
if(stats.getDrawState() == MWMechanics::DrawState::Spell)
|
||||||
{
|
{
|
||||||
*weaptype = ESM::Weapon::Spell;
|
*weaptype = ESM::Weapon::Spell;
|
||||||
return inv.end();
|
return inv.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stats.getDrawState() == MWMechanics::DrawState_Weapon)
|
if(stats.getDrawState() == MWMechanics::DrawState::Weapon)
|
||||||
{
|
{
|
||||||
MWWorld::ContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
MWWorld::ContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||||
if(weapon == inv.end())
|
if(weapon == inv.end())
|
||||||
|
|
|
@ -178,7 +178,7 @@ bool ActorAnimation::updateCarriedLeftVisible(const int weaptype) const
|
||||||
const MWWorld::ConstContainerStoreIterator shield = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
|
const MWWorld::ConstContainerStoreIterator shield = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
|
||||||
if (shield != inv.end() && shield->getType() == ESM::Armor::sRecordId && !getSheathedShieldMesh(*shield).empty())
|
if (shield != inv.end() && shield->getType() == ESM::Armor::sRecordId && !getSheathedShieldMesh(*shield).empty())
|
||||||
{
|
{
|
||||||
if(stats.getDrawState() != MWMechanics::DrawState_Weapon)
|
if(stats.getDrawState() != MWMechanics::DrawState::Weapon)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (weapon != inv.end())
|
if (weapon != inv.end())
|
||||||
|
|
|
@ -783,7 +783,7 @@ namespace MWScript
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
runtime.push((ptr.getClass().hasInventoryStore(ptr) || ptr.getClass().isBipedal(ptr)) &&
|
runtime.push((ptr.getClass().hasInventoryStore(ptr) || ptr.getClass().isBipedal(ptr)) &&
|
||||||
ptr.getClass().getCreatureStats (ptr).getDrawState () == MWMechanics::DrawState_Weapon);
|
ptr.getClass().getCreatureStats (ptr).getDrawState () == MWMechanics::DrawState::Weapon);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -796,7 +796,7 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
runtime.push(ptr.getClass().getCreatureStats (ptr).getDrawState () == MWMechanics::DrawState_Spell);
|
runtime.push(ptr.getClass().getCreatureStats (ptr).getDrawState () == MWMechanics::DrawState::Spell);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ namespace MWWorld
|
||||||
return mSign;
|
return mSign;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::setDrawState (MWMechanics::DrawState_ state)
|
void Player::setDrawState (MWMechanics::DrawState state)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = getPlayer();
|
MWWorld::Ptr ptr = getPlayer();
|
||||||
ptr.getClass().getNpcStats(ptr).setDrawState (state);
|
ptr.getClass().getNpcStats(ptr).setDrawState (state);
|
||||||
|
@ -229,7 +229,7 @@ namespace MWWorld
|
||||||
ptr.getClass().getMovementSettings(ptr).mRotation[1] += roll;
|
ptr.getClass().getMovementSettings(ptr).mRotation[1] += roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWMechanics::DrawState_ Player::getDrawState()
|
MWMechanics::DrawState Player::getDrawState()
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = getPlayer();
|
MWWorld::Ptr ptr = getPlayer();
|
||||||
return ptr.getClass().getNpcStats(ptr).getDrawState();
|
return ptr.getClass().getNpcStats(ptr).getDrawState();
|
||||||
|
|
|
@ -86,8 +86,8 @@ namespace MWWorld
|
||||||
void setBirthSign(const std::string &sign);
|
void setBirthSign(const std::string &sign);
|
||||||
const std::string &getBirthSign() const;
|
const std::string &getBirthSign() const;
|
||||||
|
|
||||||
void setDrawState (MWMechanics::DrawState_ state);
|
void setDrawState (MWMechanics::DrawState state);
|
||||||
MWMechanics::DrawState_ getDrawState(); /// \todo constness
|
MWMechanics::DrawState getDrawState(); /// \todo constness
|
||||||
|
|
||||||
/// Activate the object under the crosshair, if any
|
/// Activate the object under the crosshair, if any
|
||||||
void activate();
|
void activate();
|
||||||
|
|
|
@ -3619,7 +3619,7 @@ namespace MWWorld
|
||||||
mPlayer->setAttackingOrSpell(false);
|
mPlayer->setAttackingOrSpell(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mPlayer->setDrawState(MWMechanics::DrawState_Nothing);
|
mPlayer->setDrawState(MWMechanics::DrawState::Nothing);
|
||||||
mGoToJail = false;
|
mGoToJail = false;
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue);
|
||||||
|
|
Loading…
Reference in a new issue