From 652113c46da069bc9ec74eb53c15e683cd6942d4 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Mon, 24 Mar 2025 21:26:37 +0300 Subject: [PATCH] Don't enable water collision when collision is disabled (#8414) --- apps/openmw/mwphysics/physicssystem.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index e236db4633..5e7c70788d 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -656,20 +656,18 @@ namespace MWPhysics auto ptr = physicActor->getPtr(); if (!ptr.getClass().isMobile(ptr)) continue; - float waterlevel = -std::numeric_limits::max(); - const MWWorld::CellStore* cell = ptr.getCell(); - if (cell->getCell()->hasWater()) - waterlevel = cell->getWaterLevel(); + const MWWorld::CellStore& cell = *ptr.getCell(); const auto& stats = ptr.getClass().getCreatureStats(ptr); const MWMechanics::MagicEffects& effects = stats.getMagicEffects(); + float waterlevel = -std::numeric_limits::max(); bool waterCollision = false; - if (cell->getCell()->hasWater() && effects.getOrDefault(ESM::MagicEffect::WaterWalking).getMagnitude()) + if (cell.getCell()->hasWater()) { - if (physicActor->getCollisionMode() - || !world->isUnderwater(ptr.getCell(), ptr.getRefData().getPosition().asVec3())) - waterCollision = true; + waterlevel = cell.getWaterLevel(); + if (physicActor->getCollisionMode()) + waterCollision = effects.getOrDefault(ESM::MagicEffect::WaterWalking).getMagnitude(); } physicActor->setCanWaterWalk(waterCollision);