From dcde3cd3c8bd8dc545b63e2a3861689c1e85b9bc Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 31 Jan 2021 09:55:30 +0100 Subject: [PATCH] Fix old save games where some monsters hade 0 instea of NO_LIGHT --- Source/diablo.cpp | 8 +++++--- Source/player.cpp | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 1494f5081..fea461e41 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1559,15 +1559,17 @@ static void UpdateMonsterLights() for (int i = 0; i < nummonsters; i++) { MonsterStruct *mon = &monster[monstactive[i]]; if (mon->mlid != NO_LIGHT) { + if (mon->mlid == plr[myplr]._plid) { // Fix old save games where some monsters hade 0 instea of NO_LIGHT + mon->mlid = NO_LIGHT; + continue; + } + LightListStruct *lid = &LightList[mon->mlid]; if (mon->_mx != lid->_lx || mon->_my != lid->_ly) { ChangeLightXY(mon->mlid, mon->_mx, mon->_my); } } } - - // Handle save games where monster and player both hand lid = 0 - ChangeLightXY(plr[myplr]._plid, plr[myplr]._px, plr[myplr]._py); } void LoadGameLevel(BOOL firstflag, int lvldir) diff --git a/Source/player.cpp b/Source/player.cpp index 874cea664..a0c6a4b9f 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1084,6 +1084,7 @@ void InitPlayer(int pnum, BOOL FirstTime) if (pnum == myplr) { plr[pnum]._plid = AddLight(plr[pnum]._px, plr[pnum]._py, plr[pnum]._pLightRad); + ChangeLightXY(plr[myplr]._plid, plr[myplr]._px, plr[myplr]._py); // fix for a bug where old light is still visible at the entrance after reentering level } else { plr[pnum]._plid = NO_LIGHT; }