Merge pull request #196 from OpenMW/master while resolving conflicts

# Conflicts:
#	apps/openmw/mwmechanics/spellcasting.cpp
0.6.1
David Cernat 8 years ago
commit c6cd0a2953

@ -323,6 +323,9 @@ namespace MWClass
if (MWMechanics::blockMeleeAttack(ptr, victim, weapon, damage, attackStrength))
damage = 0;
if (victim == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState())
damage = 0;
MWMechanics::diseaseContact(victim, ptr);
victim.getClass().onHit(victim, damage, healthdmg, weapon, ptr, hitPosition, true);
@ -371,6 +374,11 @@ namespace MWClass
ptr.getRefData().getLocals().setVarByInt(script, "onpchitme", 1);
}
bool godmode = object == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
if (godmode)
damage = 0;
if (!successful)
{
// Missed
@ -405,7 +413,7 @@ namespace MWClass
if(ishealth)
{
if (!attacker.isEmpty())
if (!attacker.isEmpty() && !godmode)
{
damage = scaleDamage(damage, attacker, ptr);
MWBase::Environment::get().getWorld()->spawnBloodEffect(ptr, hitPosition);

@ -672,6 +672,9 @@ namespace MWClass
if (MWMechanics::blockMeleeAttack(ptr, victim, weapon, damage, attackStrength))
damage = 0;
if (victim == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState())
damage = 0;
MWMechanics::diseaseContact(victim, ptr);
othercls.onHit(victim, damage, healthdmg, weapon, ptr, hitPosition, true);
@ -738,6 +741,11 @@ namespace MWClass
if (damage < 0.001f)
damage = 0;
bool godmode = ptr == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
if (godmode)
damage = 0;
if (damage > 0.0f && !attacker.isEmpty())
{
// 'ptr' is losing health. Play a 'hit' voiced dialog entry if not already saying
@ -830,7 +838,7 @@ namespace MWClass
if (ishealth)
{
if (!attacker.isEmpty())
if (!attacker.isEmpty() && !godmode)
damage = scaleDamage(damage, attacker, ptr);
if (damage > 0.0f)

@ -17,17 +17,24 @@ namespace MWGui
}
void ConfirmationDialog::askForConfirmation(const std::string& message, const std::string& confirmMessage, const std::string& cancelMessage)
{
mCancelButton->setCaptionWithReplacing(cancelMessage);
mOkButton->setCaptionWithReplacing(confirmMessage);
askForConfirmation(message);
}
void ConfirmationDialog::askForConfirmation(const std::string& message)
{
setVisible(true);
mMessage->setCaptionWithReplacing(message);
mCancelButton->setCaptionWithReplacing(cancelMessage);
mOkButton->setCaptionWithReplacing(confirmMessage);
int height = mMessage->getTextSize().height + 60;
int height = mMessage->getTextSize().height + 72;
int width = mMessage->getTextSize().width + 24;
mMainWidget->setSize(mMainWidget->getWidth(), height);
mMainWidget->setSize(width, height);
mMessage->setSize(mMessage->getWidth(), mMessage->getTextSize().height + 24);

@ -9,7 +9,8 @@ namespace MWGui
{
public:
ConfirmationDialog();
void askForConfirmation(const std::string& message, const std::string& confirmMessage="#{sOk}", const std::string& cancelMessage="#{sCancel}");
void askForConfirmation(const std::string& message);
void askForConfirmation(const std::string& message, const std::string& confirmMessage, const std::string& cancelMessage);
virtual void exit();
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;

@ -791,6 +791,12 @@ namespace MWGui
mLastScrollWindowCoordinates = currentCoordinates;
}
void MapWindow::setVisible(bool visible)
{
WindowBase::setVisible(visible);
mButton->setVisible(visible && MWBase::Environment::get().getWindowManager()->isGuiMode());
}
void MapWindow::renderGlobalMap()
{
mGlobalMapRender->render();

@ -213,6 +213,7 @@ namespace MWGui
void setCellName(const std::string& cellName);
virtual void setAlpha(float alpha);
void setVisible(bool visible);
void renderGlobalMap();

@ -253,6 +253,21 @@ namespace MWGui
return;
}
}
else
{
MWBase::StateManager::State state = MWBase::Environment::get().getStateManager()->getState();
// If game is running, ask for confirmation first
if (state == MWBase::StateManager::State_Running && !reallySure)
{
ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
dialog->askForConfirmation("#{sMessage1}");
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &SaveGameDialog::onConfirmationGiven);
dialog->eventCancelClicked.clear();
return;
}
}
setVisible(false);
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_MainMenu);

@ -284,7 +284,7 @@ namespace MWMechanics
}
}
void Actors::engageCombat (const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, bool againstPlayer)
void Actors::engageCombat (const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, std::map<const MWWorld::Ptr, const std::set<MWWorld::Ptr> >& cachedAllies, bool againstPlayer)
{
CreatureStats& creatureStats1 = actor1.getClass().getCreatureStats(actor1);
if (creatureStats1.getAiSequence().isInCombat(actor2))
@ -310,7 +310,8 @@ namespace MWMechanics
// Get actors allied with actor1. Includes those following or escorting actor1, actors following or escorting those actors, (recursive)
// and any actor currently being followed or escorted by actor1
std::set<MWWorld::Ptr> allies1;
getActorsSidingWith(actor1, allies1);
getActorsSidingWith(actor1, allies1, cachedAllies);
// If an ally of actor1 has been attacked by actor2 or has attacked actor2, start combat between actor1 and actor2
for (std::set<MWWorld::Ptr>::const_iterator it = allies1.begin(); it != allies1.end(); ++it)
@ -332,10 +333,10 @@ namespace MWMechanics
aggressive = true;
}
std::set<MWWorld::Ptr> playerFollowersAndEscorters;
getActorsSidingWith(MWMechanics::getPlayer(), playerFollowersAndEscorters);
std::set<MWWorld::Ptr> playerAllies;
getActorsSidingWith(MWMechanics::getPlayer(), playerAllies, cachedAllies);
bool isPlayerFollowerOrEscorter = std::find(playerFollowersAndEscorters.begin(), playerFollowersAndEscorters.end(), actor1) != playerFollowersAndEscorters.end();
bool isPlayerFollowerOrEscorter = std::find(playerAllies.begin(), playerAllies.end(), actor1) != playerAllies.end();
// If actor2 and at least one actor2 are in combat with actor1, actor1 and its allies start combat with them
// Doesn't apply for player followers/escorters
@ -345,7 +346,9 @@ namespace MWMechanics
if (actor2.getClass().getCreatureStats(actor2).getAiSequence().isInCombat(actor1))
{
std::set<MWWorld::Ptr> allies2;
getActorsSidingWith(actor2, allies2);
getActorsSidingWith(actor2, allies2, cachedAllies);
// Check that an ally of actor2 is also in combat with actor1
for (std::set<MWWorld::Ptr>::const_iterator it = allies2.begin(); it != allies2.end(); ++it)
{
@ -387,11 +390,11 @@ namespace MWMechanics
// Do aggression check if actor2 is the player or a player follower or escorter
if (!aggressive)
{
if (againstPlayer || std::find(playerFollowersAndEscorters.begin(), playerFollowersAndEscorters.end(), actor2) != playerFollowersAndEscorters.end())
if (againstPlayer || std::find(playerAllies.begin(), playerAllies.end(), actor2) != playerAllies.end())
{
// Player followers and escorters with high fight should not initiate combat with the player or with
// other player followers or escorters
if (std::find(playerFollowersAndEscorters.begin(), playerFollowersAndEscorters.end(), actor1) == playerFollowersAndEscorters.end())
if (std::find(playerAllies.begin(), playerAllies.end(), actor1) == playerAllies.end())
aggressive = MWBase::Environment::get().getMechanicsManager()->isAggressive(actor1, actor2);
}
}
@ -819,7 +822,10 @@ namespace MWMechanics
timeLeft = 0.0f;
stats.setTimeToStartDrowning(timeLeft);
}
if(timeLeft == 0.0f)
bool godmode = ptr == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
if(timeLeft == 0.0f && !godmode)
{
// If drowning, apply 3 points of damage per second
static const float fSuffocationDamage = world->getStore().get<ESM::GameSetting>().find("fSuffocationDamage")->getFloat();
@ -1080,6 +1086,8 @@ namespace MWMechanics
/// \todo move update logic to Actor class where appropriate
std::map<const MWWorld::Ptr, const std::set<MWWorld::Ptr> > cachedAllies; // will be filled as engageCombat iterates
// AI and magic effects update
for(PtrActorMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
{
@ -1153,7 +1161,7 @@ namespace MWMechanics
{
if (it->first == iter->first || iter->first == player) // player is not AI-controlled
continue;
engageCombat(iter->first, it->first, it->first == player);
engageCombat(iter->first, it->first, cachedAllies, it->first == player);
}
}
if (timerUpdateHeadTrack == 0)
@ -1628,6 +1636,29 @@ namespace MWMechanics
getActorsSidingWith(*it, out);
}
void Actors::getActorsSidingWith(const MWWorld::Ptr &actor, std::set<MWWorld::Ptr>& out, std::map<const MWWorld::Ptr, const std::set<MWWorld::Ptr> >& cachedAllies) {
// If we have already found actor's allies, use the cache
std::map<const MWWorld::Ptr, const std::set<MWWorld::Ptr> >::const_iterator search = cachedAllies.find(actor);
if (search != cachedAllies.end())
out.insert(search->second.begin(), search->second.end());
else
{
std::list<MWWorld::Ptr> followers = getActorsSidingWith(actor);
for (std::list<MWWorld::Ptr>::iterator it = followers.begin(); it != followers.end(); ++it)
if (out.insert(*it).second)
getActorsSidingWith(*it, out, cachedAllies);
// Cache ptrs and their sets of allies
cachedAllies.insert(std::make_pair(actor, out));
for (std::set<MWWorld::Ptr>::const_iterator it = out.begin(); it != out.end(); ++it)
{
search = cachedAllies.find(*it);
if (search == cachedAllies.end())
cachedAllies.insert(std::make_pair(*it, out));
}
}
}
std::list<int> Actors::getActorsFollowingIndices(const MWWorld::Ptr &actor)
{
std::list<int> list;

@ -88,7 +88,7 @@ namespace MWMechanics
@Notes: If againstPlayer = true then actor2 should be the Player.
If one of the combatants is creature it should be actor1.
*/
void engageCombat(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, bool againstPlayer);
void engageCombat(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, std::map<const MWWorld::Ptr, const std::set<MWWorld::Ptr> >& cachedAllies, bool againstPlayer);
void updateHeadTracking(const MWWorld::Ptr& actor, const MWWorld::Ptr& targetActor,
MWWorld::Ptr& headTrackTarget, float& sqrHeadTrackDistance);
@ -127,6 +127,8 @@ namespace MWMechanics
void getActorsFollowing(const MWWorld::Ptr &actor, std::set<MWWorld::Ptr>& out);
/// Recursive version of getActorsSidingWith
void getActorsSidingWith(const MWWorld::Ptr &actor, std::set<MWWorld::Ptr>& out);
/// Recursive version of getActorsSidingWith that takes, adds to and returns a cache of actors mapped to their allies
void getActorsSidingWith(const MWWorld::Ptr &actor, std::set<MWWorld::Ptr>& out, std::map<const MWWorld::Ptr, const std::set<MWWorld::Ptr> >& cachedAllies);
/// Get the list of AiFollow::mFollowIndex for all actors following this target
std::list<int> getActorsFollowingIndices(const MWWorld::Ptr& actor);

@ -1614,6 +1614,8 @@ void CharacterController::update(float duration)
updateMagicEffects();
bool godmode = mPtr == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
if(!cls.isActor())
updateAnimQueue();
else if(!cls.getCreatureStats(mPtr).isDead())
@ -1731,8 +1733,12 @@ void CharacterController::update(float duration)
}
fatigueLoss *= duration;
DynamicStat<float> fatigue = cls.getCreatureStats(mPtr).getFatigue();
if (!godmode)
{
fatigue.setCurrent(fatigue.getCurrent() - fatigueLoss, fatigue.getCurrent() < 0);
cls.getCreatureStats(mPtr).setFatigue(fatigue);
}
if(sneak || inwater || flying)
vec.z() = 0.0f;
@ -1788,10 +1794,14 @@ void CharacterController::update(float duration)
if (normalizedEncumbrance > 1)
normalizedEncumbrance = 1;
const float fatigueDecrease = fatigueJumpBase + (1 - normalizedEncumbrance) * fatigueJumpMult;
if (!godmode)
{
fatigue.setCurrent(fatigue.getCurrent() - fatigueDecrease);
cls.getCreatureStats(mPtr).setFatigue(fatigue);
}
}
}
else if(mJumpState == JumpState_InAir)
{
forcestateupdate = true;
@ -1800,16 +1810,20 @@ void CharacterController::update(float duration)
float height = cls.getCreatureStats(mPtr).land();
float healthLost = getFallDamage(mPtr, height);
if (healthLost > 0.0f)
{
const float fatigueTerm = cls.getCreatureStats(mPtr).getFatigueTerm();
// inflict fall damages
if (!godmode)
{
DynamicStat<float> health = cls.getCreatureStats(mPtr).getHealth();
float realHealthLost = static_cast<float>(healthLost * (1.0f - 0.25f * fatigueTerm));
health.setCurrent(health.getCurrent() - realHealthLost);
cls.getCreatureStats(mPtr).setHealth(health);
cls.onHit(mPtr, realHealthLost, true, MWWorld::Ptr(), MWWorld::Ptr(), osg::Vec3f(), true);
}
const int acrobaticsSkill = cls.getSkill(mPtr, ESM::Skill::Acrobatics);
if (healthLost > (acrobaticsSkill * fatigueTerm))

@ -349,11 +349,17 @@ namespace MWMechanics
{
int weaphealth = weapon.getClass().getItemHealth(weapon);
bool godmode = attacker == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
// weapon condition does not degrade when godmode is on
if (!godmode)
{
const float fWeaponDamageMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fWeaponDamageMult")->getFloat();
float x = std::max(1.f, fWeaponDamageMult * damage);
weaphealth -= std::min(int(x), weaphealth);
weapon.getCellRef().setCharge(weaphealth);
}
// Weapon broken? unequip it
if (weaphealth == 0)
@ -427,12 +433,18 @@ namespace MWMechanics
CreatureStats& stats = attacker.getClass().getCreatureStats(attacker);
MWMechanics::DynamicStat<float> fatigue = stats.getFatigue();
const float normalizedEncumbrance = attacker.getClass().getNormalizedEncumbrance(attacker);
bool godmode = attacker == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
if (!godmode)
{
float fatigueLoss = fFatigueAttackBase + normalizedEncumbrance * fFatigueAttackMult;
if (!weapon.isEmpty())
fatigueLoss += weapon.getClass().getWeight(weapon) * attackStrength * fWeaponFatigueMult;
fatigue.setCurrent(fatigue.getCurrent() - fatigueLoss);
stats.setFatigue(fatigue);
}
}
bool isEnvironmentCompatible(const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim)
{

@ -50,11 +50,6 @@ namespace MWMechanics
float getSpellSuccessChance (const ESM::Spell* spell, const MWWorld::Ptr& actor, int* effectiveSchool, bool cap)
{
CreatureStats& stats = actor.getClass().getCreatureStats(actor);
if (stats.getMagicEffects().get(ESM::MagicEffect::Silence).getMagnitude())
return 0;
float y = std::numeric_limits<float>::max();
float lowestSkill = 0;
@ -84,6 +79,13 @@ namespace MWMechanics
}
}
bool godmode = actor == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
CreatureStats& stats = actor.getClass().getCreatureStats(actor);
if (stats.getMagicEffects().get(ESM::MagicEffect::Silence).getMagnitude()&& !godmode)
return 0;
if (spell->mData.mType == ESM::Spell::ST_Power)
return stats.getSpells().canUsePower(spell) ? 100 : 0;
@ -93,6 +95,11 @@ namespace MWMechanics
if (spell->mData.mFlags & ESM::Spell::F_Always)
return 100;
if (godmode)
{
return 100;
}
float castBonus = -stats.getMagicEffects().get(ESM::MagicEffect::Sound).getMagnitude();
int actorWillpower = stats.getAttribute(ESM::Attribute::Willpower).getModified();
@ -713,14 +720,19 @@ namespace MWMechanics
mStack = false;
bool godmode = mCaster == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
// Check if there's enough charge left
if (enchantment->mData.mType == ESM::Enchantment::WhenUsed || enchantment->mData.mType == ESM::Enchantment::WhenStrikes)
{
const int castCost = getEffectiveEnchantmentCastCost(static_cast<float>(enchantment->mData.mCost), mCaster);
int castCost = getEffectiveEnchantmentCastCost(static_cast<float>(enchantment->mData.mCost), mCaster);
if (item.getCellRef().getEnchantmentCharge() == -1)
item.getCellRef().setEnchantmentCharge(static_cast<float>(enchantment->mData.mCharge));
if (godmode)
castCost = 0;
if (item.getCellRef().getEnchantmentCharge() < castCost)
{
if (mCaster == getPlayer())
@ -750,8 +762,10 @@ namespace MWMechanics
if (mCaster == getPlayer())
mCaster.getClass().skillUsageSucceeded (mCaster, ESM::Skill::Enchant, 1);
}
if (enchantment->mData.mType == ESM::Enchantment::CastOnce)
if (enchantment->mData.mType == ESM::Enchantment::CastOnce && !godmode)
{
item.getContainerStore()->remove(item, 1, mCaster);
}
else if (enchantment->mData.mType != ESM::Enchantment::WhenStrikes)
{
if (mCaster == getPlayer())
@ -801,37 +815,45 @@ namespace MWMechanics
int school = 0;
bool godmode = mCaster == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
if (mCaster.getClass().isActor() && !mAlwaysSucceed)
{
school = getSpellSchool(spell, mCaster);
CreatureStats& stats = mCaster.getClass().getCreatureStats(mCaster);
if (!godmode)
{
// Reduce fatigue (note that in the vanilla game, both GMSTs are 0, and there's no fatigue loss)
static const float fFatigueSpellBase = store.get<ESM::GameSetting>().find("fFatigueSpellBase")->getFloat();
static const float fFatigueSpellMult = store.get<ESM::GameSetting>().find("fFatigueSpellMult")->getFloat();
DynamicStat<float> fatigue = stats.getFatigue();
const float normalizedEncumbrance = mCaster.getClass().getNormalizedEncumbrance(mCaster);
float fatigueLoss = spell->mData.mCost * (fFatigueSpellBase + normalizedEncumbrance * fFatigueSpellMult);
fatigue.setCurrent(fatigue.getCurrent() - fatigueLoss); stats.setFatigue(fatigue);
bool fail = false;
// Check success
// Major change done by tes3mp:
//
// Instead of checking whether the caster is a player or an NPC,
// check whether it's the LocalPlayer or a DedicatedPlayer and calculate
// first check whether it's the LocalPlayer or a DedicatedPlayer and calculate
// calculate the success chance in clients' LocalPlayer::prepareAttack()
//
// TODO: Make this make sense for NPCs too
//
// TODO: See if LocalPlayer being the target and having godmode on
// can be accounted for like it is in OpenMW's corresponding code
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::getPlayer(mCaster);
bool isDedicated = dedicatedPlayer != NULL;
if (isDedicated)
dedicatedPlayer->attack.pressed = false;
// Check success
if ((!isDedicated && !mwmp::Main::get().getLocalPlayer()->attack.success) ||
(isDedicated && dedicatedPlayer->attack.success == 0))
{
@ -841,6 +863,16 @@ namespace MWMechanics
}
fail = true;
}
else if (!(mCaster == getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState()))
{
float successChance = getSpellSuccessChance(spell, mCaster);
if (Misc::Rng::roll0to99() >= successChance)
{
if (mCaster == getPlayer())
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicSkillFail}");
fail = true;
}
}
if (fail)
{
@ -853,6 +885,7 @@ namespace MWMechanics
sndMgr->playSound3D(mCaster, "Spell Failure " + schools[school], 1.0f, 1.0f);
return false;
}
}
// A power can be used once per 24h
if (spell->mData.mType == ESM::Spell::ST_Power)
@ -1059,6 +1092,8 @@ namespace MWMechanics
bool receivedMagicDamage = false;
bool godmode = actor == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
switch (effectKey.mId)
{
case ESM::MagicEffect::DamageAttribute:
@ -1081,21 +1116,34 @@ namespace MWMechanics
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::RestoreHealth, magnitude);
break;
case ESM::MagicEffect::DamageHealth:
if (!godmode)
{
receivedMagicDamage = true;
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::DamageHealth, -magnitude);
break;
}
case ESM::MagicEffect::DamageMagicka:
case ESM::MagicEffect::DamageFatigue:
if (!godmode)
{
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::DamageHealth, -magnitude);
}
break;
case ESM::MagicEffect::AbsorbHealth:
if (!godmode)
{
if (magnitude > 0.f)
receivedMagicDamage = true;
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::AbsorbHealth, -magnitude);
break;
}
case ESM::MagicEffect::AbsorbMagicka:
case ESM::MagicEffect::AbsorbFatigue:
if (!godmode)
{
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::AbsorbHealth, -magnitude);
}
break;
case ESM::MagicEffect::DisintegrateArmor:
@ -1140,9 +1188,13 @@ namespace MWMechanics
if (weather > 1)
damageScale *= fMagicSunBlockedMult;
if (!godmode)
{
adjustDynamicStat(creatureStats, 0, -magnitude * damageScale);
if (magnitude * damageScale > 0.f)
receivedMagicDamage = true;
}
break;
}
@ -1150,9 +1202,13 @@ namespace MWMechanics
case ESM::MagicEffect::ShockDamage:
case ESM::MagicEffect::FrostDamage:
case ESM::MagicEffect::Poison:
{
if (!godmode)
{
adjustDynamicStat(creatureStats, 0, -magnitude);
receivedMagicDamage = true;
}
break;
}

@ -2423,12 +2423,16 @@ namespace MWWorld
MWMechanics::CreatureStats& stats = actor.getClass().getCreatureStats(actor);
if (stats.isDead())
continue;
mPhysics->markAsNonSolid (object);
if (actor == getPlayerPtr() && MWBase::Environment::get().getWorld()->getGodModeState())
return;
MWMechanics::DynamicStat<float> health = stats.getHealth();
health.setCurrent(health.getCurrent()-healthPerSecond*MWBase::Environment::get().getFrameDuration());
stats.setHealth(health);
mPhysics->markAsNonSolid (object);
if (healthPerSecond > 0.0f)
{
if (actor == getPlayerPtr())
@ -2456,12 +2460,16 @@ namespace MWWorld
MWMechanics::CreatureStats& stats = actor.getClass().getCreatureStats(actor);
if (stats.isDead())
continue;
mPhysics->markAsNonSolid (object);
if (actor == getPlayerPtr() && MWBase::Environment::get().getWorld()->getGodModeState())
return;
MWMechanics::DynamicStat<float> health = stats.getHealth();
health.setCurrent(health.getCurrent()-healthPerSecond*MWBase::Environment::get().getFrameDuration());
stats.setHealth(health);
mPhysics->markAsNonSolid (object);
if (healthPerSecond > 0.0f)
{
if (actor == getPlayerPtr())

@ -111,7 +111,7 @@
<Child type="Widget" skin="BTN_BottomRight" offset="132 20 4 4" align="Bottom Right"/>
<Child type="Widget" skin="BTN_BottomRight" offset="132 20 4 4" align="Bottom Right"/>
<BasisSkin type="SimpleText" offset="4 4 128 16" align="Stretch">
<BasisSkin type="SimpleText" offset="4 3 128 16" align="Stretch">
<State name="disabled" colour="#{fontcolour=disabled}" shift="0"/>
<State name="normal" colour="#{fontcolour=normal}" shift="0"/>
<State name="highlighted" colour="#{fontcolour=normal_over}" shift="0"/>

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 300 130" align="Center" name="_Main">
<Widget type="Window" skin="MW_DialogNoTransp" layer="Windows" position="0 0 360 130" align="Center" name="_Main">
<Property key="Visible" value="false"/>
<Widget type="EditBox" skin="MW_TextEditClient" position="16 8 268 130" name="Message" align="Center Top">
<Widget type="EditBox" skin="MW_TextEditClient" position="16 8 338 130" name="Message" align="Center Top">
<Property key="FontName" value="Default"/>
<Property key="TextAlign" value="Top HCenter"/>
<Property key="Static" value="true"/>
@ -12,14 +12,14 @@
<Property key="MultiLine" value="true"/>
</Widget>
<Widget type="VBox" position="0 89 292 24" align="Right Bottom">
<Widget type="VBox" position="0 89 352 24" align="Center Bottom">
<Widget type="HBox">
<Property key="Spacing" value="8"/>
<Widget type="AutoSizedButton" skin="MW_Button" name="OkButton" align="Right Bottom">
<Widget type="AutoSizedButton" skin="MW_Button" name="OkButton" align="Center Bottom">
<Property key="Caption" value="#{sYes}"/>
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" name="CancelButton" align="Right Bottom">
<Widget type="AutoSizedButton" skin="MW_Button" name="CancelButton" align="Center Bottom">
<Property key="Caption" value="#{sNo}"/>
</Widget>
</Widget>

@ -1,29 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout" version="3.2.0">
<Widget type="Window" skin="MW_Dialog" position="0 0 600 128" align="Center" layer="Windows" name="_Main">
<Widget type="Window" skin="MW_DialogNoTransp" position="0 0 600 128" align="Center" layer="Windows" name="_Main">
<Property key="Visible" value="false"/>
<Widget type="TextBox" skin="SandText" position="4 4 592 24" align="Left Top HStretch" name="LabelText">
<Widget type="TextBox" skin="SandText" position="0 4 592 24" align="Left Top HStretch" name="LabelText">
<Property key="TextAlign" value="Center"/>
</Widget>
<Widget type="TextBox" skin="SandText" position="4 30 521 24" align="Left Top HStretch" name="ItemText">
<Property key="TextAlign" value="Right"/>
<Widget type="TextBox" skin="SandText" position="12 36 521 24" align="Left Top HStretch" name="ItemText">
<Property key="TextAlign" value="Left"/>
</Widget>
<Widget type="NumericEditBox" skin="MW_TextEdit" position="535 30 50 24" align="Right Top" name="ItemEdit">
<Widget type="NumericEditBox" skin="MW_TextEdit" position="535 36 50 24" align="Right Top" name="ItemEdit">
<Property key="TextAlign" value="Center"/>
</Widget>
<Widget type="MWScrollBar" skin="MW_HScroll" position="7 61 578 18" align="Left Top HStretch" name="CountSlider">
<Widget type="MWScrollBar" skin="MW_HScroll" position="7 67 578 18" align="Left Top HStretch" name="CountSlider">
<Property key="MoveToClick" value="true"/>
<Property key="Page" value="1"/>
<Property key="WheelPage" value="1"/>
</Widget>
<Widget type="HBox" skin="" position="0 88 585 24" align="Right Bottom">
<Widget type="Widget" skin="" position="0 12 0 0">
<UserString key="HStretch" value="true"/>
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" position="4 0 53 24" align="Right Top" name="OkButton">
<Widget type="HBox" skin="" position="0 91 140 24" align="Center Bottom">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 53 24" align="Center Top" name="OkButton">
<Property key="Caption" value="#{sOk}"/>
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" position="61 0 78 24" align="Right Top" name="CancelButton">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 86 24" align="Center Top" name="CancelButton">
<Property key="Caption" value="#{sCancel}"/>
</Widget>
</Widget>

@ -131,9 +131,9 @@
<Child type="Widget" skin="MW_Box" offset="0 0 516 516" align="Stretch"/>
<Child type="MWScrollBar" skin="MW_VScroll" offset="498 3 14 509" align="Right VStretch" name="VScroll"/>
<Child type="MWScrollBar" skin="MW_VScroll" offset="498 4 14 508" align="Right VStretch" name="VScroll"/>
<Child type="Widget" skin="" offset="3 3 493 509" align="Stretch" name="Client"/>
<Child type="Widget" skin="" offset="3 4 493 508" align="Stretch" name="Client"/>
</Resource>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="VBox" skin="MW_Dialog" layer="Windows" position="0 0 600 400" align="Center" name="_Main">
<Widget type="VBox" skin="MW_DialogNoTransp" layer="Windows" position="0 0 600 400" align="Center" name="_Main">
<Property key="Padding" value="12"/>
<Property key="Spacing" value="8"/>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Resource" version="1.1">
<!-- Defines a transparent background -->
<!-- Defines a partially transparent background -->
<Resource type="ResourceSkin" name="BlackBG" size="8 8" texture="transparent">
<Property key="Colour" value="#{fontcolour=background}"/>
<BasisSkin type="MainSkin" offset="0 0 8 8">
@ -9,6 +9,14 @@
</BasisSkin>
</Resource>
<!-- Defines a non-transparent background -->
<Resource type="ResourceSkin" name="FullBlackBG" size="8 8" texture="black">
<BasisSkin type="MainSkin" offset="0 0 8 8">
<State name="normal" offset="0 0 8 8"/>
</BasisSkin>
</Resource>
<!-- Defines a non-transparent background -->
<Resource type="ResourceSkin" name="TransparentBG" size="8 8" texture="transparent">
<Property key="Colour" value="#{fontcolour=background}"/>
</Resource>
@ -883,4 +891,35 @@
<Property key="Scale" value="1 1 -1 -1"/>
</Child>
</Resource>
<Resource type="ResourceSkin" name="MW_DialogNoTransp" size="256 54">
<Child type="Widget" skin="FullBlackBG" offset="4 4 248 46" align="Stretch" name="Client"/>
<!-- Outer borders -->
<Child type="Widget" skin="DB_T" offset="4 0 248 4" align="Top HStretch" name="Border">
<Property key="Scale" value="0 1 0 -1"/>
</Child>
<Child type="Widget" skin="DB_L" offset="0 4 4 46" align="Left VStretch" name="Border">
<Property key="Scale" value="1 0 -1 0"/>
</Child>
<Child type="Widget" skin="DB_B" offset="4 50 248 4" align="Bottom HStretch" name="Border">
<Property key="Scale" value="0 0 0 1"/>
</Child>
<Child type="Widget" skin="DB_R" offset="252 4 4 46" align="Right VStretch" name="Border">
<Property key="Scale" value="0 0 1 0"/>
</Child>
<Child type="Widget" skin="DB_BR" offset="252 50 4 4" align="Right Bottom" name="Border">
<Property key="Scale" value="0 0 1 1"/>
</Child>
<Child type="Widget" skin="DB_BL" offset="0 50 4 4" align="Left Bottom" name="Border">
<Property key="Scale" value="1 0 -1 1"/>
</Child>
<Child type="Widget" skin="DB_TR" offset="252 0 4 4" align="Right Top" name="Border">
<Property key="Scale" value="0 1 1 -1"/>
</Child>
<Child type="Widget" skin="DB_TL" offset="0 0 4 4" align="Left Top" name="Border">
<Property key="Scale" value="1 1 -1 -1"/>
</Child>
</Resource>
</MyGUI>

Loading…
Cancel
Save