Skip to content

Commit

Permalink
fix #1410 - make light objects unseen when saving level change data, …
Browse files Browse the repository at this point in the history
…because level change data (instead of real save data) does not save light source and if the light objects will be marked as seen there lights won't be created and they stay dark
  • Loading branch information
ThomasChr committed Nov 12, 2021
1 parent f090da3 commit a59d912
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Source/loadsave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2086,8 +2086,23 @@ void SaveLevel()
file.WriteLE<int8_t>(objectId);
for (int objectId : AvailableObjects)
file.WriteLE<int8_t>(objectId);
for (int i = 0; i < ActiveObjectCount; i++)
for (int i = 0; i < ActiveObjectCount; i++) {
/* make dynamic light sources unseen when saving level data for level change */
switch (Objects[ActiveObjects[i]]._otype) {
case OBJ_L1LIGHT:
case OBJ_SKFIRE:
case OBJ_CANDLE1:
case OBJ_CANDLE2:
case OBJ_BOOKCANDLE:
case OBJ_STORYCANDLE:
case OBJ_TORCHL:
case OBJ_TORCHR:
case OBJ_TORCHL2:
case OBJ_TORCHR2:
Objects[ActiveObjects[i]]._oVar1 = 0;
}
SaveObject(file, Objects[ActiveObjects[i]]);
}
}

for (int itemId : ActiveItems)
Expand Down

0 comments on commit a59d912

Please sign in to comment.