1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-30 09:11:34 +00:00

Merge branch 'paralysisagainagain' into 'master'

Make paralysis cancel camera mode changes (#7997)

Closes #7997

See merge request OpenMW/openmw!4122
This commit is contained in:
psi29a 2024-05-24 23:06:35 +00:00
commit 6e0606b55b
9 changed files with 18 additions and 18 deletions

View file

@ -176,6 +176,7 @@
Bug #7943: Using "addSoulGem" and "dropSoulGem" commands to creatures works only with "Weapon & Shield" flagged ones Bug #7943: Using "addSoulGem" and "dropSoulGem" commands to creatures works only with "Weapon & Shield" flagged ones
Bug #7970: Difference of GetPCSleep (?) behavior between vanilla and OpenMW Bug #7970: Difference of GetPCSleep (?) behavior between vanilla and OpenMW
Bug #7980: Paralyzed NPCs' lips move Bug #7980: Paralyzed NPCs' lips move
Bug #7997: Can toggle perspective when paralyzed
Feature #1415: Infinite fall failsafe Feature #1415: Infinite fall failsafe
Feature #2566: Handle NAM9 records for manual cell references Feature #2566: Handle NAM9 records for manual cell references
Feature #3537: Shader-based water ripples Feature #3537: Shader-based water ripples

View file

@ -984,8 +984,7 @@ namespace MWClass
// TODO: This function is called several times per frame for each NPC. // TODO: This function is called several times per frame for each NPC.
// It would be better to calculate it only once per frame for each NPC and save the result in CreatureStats. // It would be better to calculate it only once per frame for each NPC and save the result in CreatureStats.
const MWMechanics::NpcStats& stats = getNpcStats(ptr); const MWMechanics::NpcStats& stats = getNpcStats(ptr);
bool godmode = ptr == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState(); if (stats.isParalyzed() || stats.getKnockedDown() || stats.isDead())
if ((!godmode && stats.isParalyzed()) || stats.getKnockedDown() || stats.isDead())
return 0.f; return 0.f;
const MWBase::World* world = MWBase::Environment::get().getWorld(); const MWBase::World* world = MWBase::Environment::get().getWorld();
@ -1034,8 +1033,7 @@ namespace MWClass
return 0.f; return 0.f;
const MWMechanics::NpcStats& stats = getNpcStats(ptr); const MWMechanics::NpcStats& stats = getNpcStats(ptr);
bool godmode = ptr == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState(); if (stats.isParalyzed() || stats.getKnockedDown() || stats.isDead())
if ((!godmode && stats.isParalyzed()) || stats.getKnockedDown() || stats.isDead())
return 0.f; return 0.f;
const GMST& gmst = getGmst(); const GMST& gmst = getGmst();

View file

@ -749,8 +749,7 @@ namespace MWGui
// Player must not be paralyzed, knocked down, or dead to pick up an item. // Player must not be paralyzed, knocked down, or dead to pick up an item.
const MWMechanics::NpcStats& playerStats = player.getClass().getNpcStats(player); const MWMechanics::NpcStats& playerStats = player.getClass().getNpcStats(player);
bool godmode = MWBase::Environment::get().getWorld()->getGodModeState(); if (playerStats.isParalyzed() || playerStats.getKnockedDown() || playerStats.isDead())
if ((!godmode && playerStats.isParalyzed()) || playerStats.getKnockedDown() || playerStats.isDead())
return; return;
MWBase::Environment::get().getMechanicsManager()->itemTaken(player, object, MWWorld::Ptr(), count); MWBase::Environment::get().getMechanicsManager()->itemTaken(player, object, MWWorld::Ptr(), count);
@ -789,8 +788,7 @@ namespace MWGui
return; return;
const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
bool godmode = MWBase::Environment::get().getWorld()->getGodModeState(); if (stats.isParalyzed() || stats.getKnockedDown() || stats.isDead() || stats.getHitRecovery())
if ((!godmode && stats.isParalyzed()) || stats.getKnockedDown() || stats.isDead() || stats.getHitRecovery())
return; return;
ItemModel::ModelIndex selected = -1; ItemModel::ModelIndex selected = -1;

View file

@ -353,8 +353,7 @@ namespace MWGui
bool isDelayNeeded = MWBase::Environment::get().getMechanicsManager()->isAttackingOrSpell(player) bool isDelayNeeded = MWBase::Environment::get().getMechanicsManager()->isAttackingOrSpell(player)
|| playerStats.getKnockedDown() || playerStats.getHitRecovery(); || playerStats.getKnockedDown() || playerStats.getHitRecovery();
bool godmode = MWBase::Environment::get().getWorld()->getGodModeState(); bool isReturnNeeded = playerStats.isParalyzed() || playerStats.isDead();
bool isReturnNeeded = (!godmode && playerStats.isParalyzed()) || playerStats.isDead();
if (isReturnNeeded) if (isReturnNeeded)
{ {

View file

@ -236,9 +236,8 @@ namespace MWGui
if (MWBase::Environment::get().getMechanicsManager()->isAttackingOrSpell(player)) if (MWBase::Environment::get().getMechanicsManager()->isAttackingOrSpell(player))
return; return;
bool godmode = MWBase::Environment::get().getWorld()->getGodModeState();
const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
if ((!godmode && stats.isParalyzed()) || stats.getKnockedDown() || stats.isDead() || stats.getHitRecovery()) if (stats.isParalyzed() || stats.getKnockedDown() || stats.isDead() || stats.getHitRecovery())
return; return;
mSpellView->setModel(new SpellModel(MWMechanics::getPlayer())); mSpellView->setModel(new SpellModel(MWMechanics::getPlayer()));

View file

@ -1482,7 +1482,6 @@ namespace MWMechanics
if (!playerHitAttemptActor.isInCell()) if (!playerHitAttemptActor.isInCell())
player.getClass().getCreatureStats(player).setHitAttemptActorId(-1); player.getClass().getCreatureStats(player).setHitAttemptActorId(-1);
} }
const bool godmode = MWBase::Environment::get().getWorld()->getGodModeState();
const int actorsProcessingRange = Settings::game().mActorsProcessingRange; const int actorsProcessingRange = Settings::game().mActorsProcessingRange;
// AI and magic effects update // AI and magic effects update
@ -1634,8 +1633,7 @@ namespace MWMechanics
world->setActorActive(actor.getPtr(), true); world->setActorActive(actor.getPtr(), true);
const bool isDead = actor.getPtr().getClass().getCreatureStats(actor.getPtr()).isDead(); const bool isDead = actor.getPtr().getClass().getCreatureStats(actor.getPtr()).isDead();
if (!isDead && (!godmode || !isPlayer) if (!isDead && actor.getPtr().getClass().getCreatureStats(actor.getPtr()).isParalyzed())
&& actor.getPtr().getClass().getCreatureStats(actor.getPtr()).isParalyzed())
ctrl.skipAnim(); ctrl.skipAnim();
// Handle player last, in case a cell transition occurs by casting a teleportation spell // Handle player last, in case a cell transition occurs by casting a teleportation spell

View file

@ -241,6 +241,11 @@ namespace MWMechanics
bool CreatureStats::isParalyzed() const bool CreatureStats::isParalyzed() const
{ {
MWBase::World* world = MWBase::Environment::get().getWorld();
const MWWorld::Ptr player = world->getPlayerPtr();
if (world->getGodModeState() && this == &player.getClass().getCreatureStats(player))
return false;
return mMagicEffects.getOrDefault(ESM::MagicEffect::Paralyze).getMagnitude() > 0; return mMagicEffects.getOrDefault(ESM::MagicEffect::Paralyze).getMagnitude() > 0;
} }

View file

@ -183,8 +183,7 @@ namespace MWWorld
MWWorld::Ptr player = getPlayer(); MWWorld::Ptr player = getPlayer();
const MWMechanics::NpcStats& playerStats = player.getClass().getNpcStats(player); const MWMechanics::NpcStats& playerStats = player.getClass().getNpcStats(player);
bool godmode = MWBase::Environment::get().getWorld()->getGodModeState(); if (playerStats.isParalyzed() || playerStats.getKnockedDown() || playerStats.isDead())
if ((!godmode && playerStats.isParalyzed()) || playerStats.getKnockedDown() || playerStats.isDead())
return; return;
MWWorld::Ptr toActivate = MWBase::Environment::get().getWorld()->getFacedObject(); MWWorld::Ptr toActivate = MWBase::Environment::get().getWorld()->getFacedObject();

View file

@ -1,5 +1,6 @@
local camera = require('openmw.camera') local camera = require('openmw.camera')
local core = require('openmw.core') local core = require('openmw.core')
local debug = require('openmw.debug')
local input = require('openmw.input') local input = require('openmw.input')
local util = require('openmw.util') local util = require('openmw.util')
local self = require('openmw.self') local self = require('openmw.self')
@ -207,7 +208,9 @@ local function onFrame(dt)
primaryMode = mode primaryMode = mode
end end
if mode ~= MODE.Static then if mode ~= MODE.Static then
if not next(noModeControl) then local paralysis = Actor.activeEffects(self):getEffect(core.magic.EFFECT_TYPE.Paralyze)
local paralyzed = not debug.isGodMode() and paralysis.magnitude > 0
if not next(noModeControl) and not paralyzed then
updatePOV(dt) updatePOV(dt)
updateVanity(dt) updateVanity(dt)
end end