From 39a231233c2036d4972bf1c1f0ac37edd2602ebe Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Tue, 11 Jun 2024 11:28:43 +0300 Subject: [PATCH] Fully reset the player's cell reference when the player is reset (#8021) --- CHANGELOG.md | 1 + apps/openmw/mwworld/player.cpp | 5 +++++ apps/openmw/mwworld/worldimp.cpp | 2 -- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f89bb609a7..ce530dfe3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -181,6 +181,7 @@ Bug #7997: Can toggle perspective when paralyzed Bug #8002: Portable light sources held by creatures do not emit lighting Bug #8018: Potion effects should never explode and always apply on self + Bug #8021: Player's scale doesn't reset when starting a new game Feature #1415: Infinite fall failsafe Feature #2566: Handle NAM9 records for manual cell references Feature #3537: Shader-based water ripples diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index f32009c035..f5d38e8686 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -242,6 +242,11 @@ namespace MWWorld void Player::clear() { + ESM::CellRef cellRef; + cellRef.blank(); + cellRef.mRefID = ESM::RefId::stringRefId("Player"); + cellRef.mRefNum = mPlayer.mRef.getRefNum(); + mPlayer = LiveCellRef(cellRef, mPlayer.mBase); mCellStore = nullptr; mSign = ESM::RefId(); mMarkedCell = nullptr; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 6ba8cee6ea..77bf039276 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -426,8 +426,6 @@ namespace MWWorld if (mPlayer) { mPlayer->clear(); - mPlayer->setCell(nullptr); - mPlayer->getPlayer().getRefData() = RefData(); mPlayer->set(mStore.get().find(ESM::RefId::stringRefId("Player"))); }