Skip to content

Commit

Permalink
make chests optional
Browse files Browse the repository at this point in the history
  • Loading branch information
pionere committed Sep 11, 2023
1 parent ceba3a1 commit 228acd5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Source/objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,8 +1029,8 @@ void InitObjects()
InitRndBarrels(num / 1024, OBJ_POD);
}
#endif
assert(objectdata[OBJ_CHEST1].oLvlTypes == DTM_ANY && objectdata[OBJ_CHEST2].oLvlTypes == DTM_ANY && objectdata[OBJ_CHEST3].oLvlTypes == DTM_ANY);
{
assert(objectdata[OBJ_CHEST1].oLvlTypes == objectdata[OBJ_CHEST2].oLvlTypes && objectdata[OBJ_CHEST1].oLvlTypes == objectdata[OBJ_CHEST3].oLvlTypes);
if (lvlMask & objectdata[OBJ_TCHEST1].oLvlTypes) {
static_assert(DSIZEX * DSIZEY < 0x7FFF, "InitObjects uses RandRangeLow X.");
unsigned num = RandRangeLow(na, na * 2 + 1);
InitRndLocObj(num / 512, OBJ_CHEST1);
Expand All @@ -1043,7 +1043,10 @@ void InitObjects()
if (lvlMask & objectdata[OBJ_TRAPL].oLvlTypes) {
AddObjTraps();
}
assert(objectdata[OBJ_TCHEST1].oLvlTypes == objectdata[OBJ_TCHEST2].oLvlTypes && objectdata[OBJ_TCHEST1].oLvlTypes == objectdata[OBJ_TCHEST3].oLvlTypes);
assert(objectdata[OBJ_TCHEST1].oLvlTypes == objectdata[OBJ_TCHEST2].oLvlTypes && objectdata[OBJ_TCHEST1].oLvlTypes == objectdata[OBJ_TCHEST3].oLvlTypes); // trapped chest are placed in one place
assert((objectdata[OBJ_TCHEST1].oLvlTypes & ~objectdata[OBJ_CHEST1].oLvlTypes) == 0); // no point to place traps if there are not matching chests
assert((objectdata[OBJ_TCHEST2].oLvlTypes & ~objectdata[OBJ_CHEST2].oLvlTypes) == 0);
assert((objectdata[OBJ_TCHEST3].oLvlTypes & ~objectdata[OBJ_CHEST3].oLvlTypes) == 0);
if (lvlMask & objectdata[OBJ_TCHEST1].oLvlTypes) {
AddChestTraps();
}
Expand Down

0 comments on commit 228acd5

Please sign in to comment.