Browse Source

Multiplayer: Ensure monster hitpoints are calculated reproducable in quest/set-maps (#5958)

* Always use the same seed for generating set/quest maps

* Use setlvltype for loading quest/set-map (instead of leveltype)

* Ensure dungeon flags are reset when loading a quest/set-map
pull/5962/head
obligaron 3 years ago committed by GitHub
parent
commit
1a150ed193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      Source/diablo.cpp
  2. 8
      Source/levels/drlg_l1.cpp

9
Source/diablo.cpp

@ -2710,7 +2710,14 @@ void LoadGameLevel(bool firstflag, lvl_entry lvldir)
InitStores();
InitAutomapOnce();
}
SetRndSeed(glSeedTbl[currlevel]);
if (!setlevel) {
SetRndSeed(glSeedTbl[currlevel]);
} else {
// Maps are not randomly generated, but the monsters max hitpoints are.
// So we need to ensure that we have a stable seed when generating quest/set-maps.
// For this purpose we reuse the normal dungeon seeds.
SetRndSeed(glSeedTbl[static_cast<size_t>(setlvlnum)]);
}
if (leveltype == DTYPE_TOWN) {
SetupTownStores();

8
Source/levels/drlg_l1.cpp

@ -1304,12 +1304,12 @@ void CreateL5Dungeon(uint32_t rseed, lvl_entry entry)
void LoadPreL1Dungeon(const char *path)
{
memset(dungeon, Dirt, sizeof(dungeon));
InitDungeonFlags();
auto dunData = LoadFileInMem<uint16_t>(path);
PlaceDunTiles(dunData.get(), { 0, 0 }, Floor);
if (leveltype == DTYPE_CATHEDRAL)
if (setlvltype == DTYPE_CATHEDRAL)
FillFloor();
memcpy(pdungeon, dungeon, sizeof(pdungeon));
@ -1319,12 +1319,12 @@ void LoadL1Dungeon(const char *path, Point spawn)
{
LoadDungeonBase(path, spawn, Floor, Dirt);
if (leveltype == DTYPE_CATHEDRAL)
if (setlvltype == DTYPE_CATHEDRAL)
FillFloor();
Pass3();
if (leveltype == DTYPE_CRYPT)
if (setlvltype == DTYPE_CRYPT)
AddCryptObjects(0, 0, MAXDUNX, MAXDUNY);
else
AddL1Objs(0, 0, MAXDUNX, MAXDUNY);

Loading…
Cancel
Save