Browse Source

Use theme room attributes directly instead of recalculating

pull/4775/head
ephphatha 4 years ago committed by Anders Jenbo
parent
commit
de05ce6562
  1. 11
      Source/engine/size.hpp
  2. 9
      Source/gendung.cpp

11
Source/engine/size.hpp

@ -41,6 +41,11 @@ struct Size {
return *this;
}
constexpr Size &operator-=(const int factor)
{
return *this += -factor;
}
constexpr Size &operator*=(const int factor)
{
width *= factor;
@ -68,6 +73,12 @@ struct Size {
return a;
}
constexpr friend Size operator-(Size a, const int factor)
{
a -= factor;
return a;
}
constexpr friend Size operator*(Size a, const int factor)
{
a *= factor;

9
Source/gendung.cpp

@ -670,13 +670,14 @@ void DRLG_PlaceThemeRooms(int minSize, int maxSize, int floor, int freq, bool rn
if (themeH < min || themeH > max)
themeH = min;
}
themeLoc[themeCount].room = { { i + 1, j + 1 }, { themeW, themeH } };
THEME_LOC &theme = themeLoc[themeCount];
theme.room = { Point { i, j } + Direction::South, Size { themeW, themeH } };
if (IsAnyOf(leveltype, DTYPE_CAVES, DTYPE_NEST)) {
DRLG_RectTrans({ Point(i + 2, j + 2).megaToWorld(), { themeW * 2 - 5, themeH * 2 - 5 } });
DRLG_RectTrans({ (theme.room.position + Direction::South).megaToWorld(), theme.room.size * 2 - 5 });
} else {
DRLG_MRectTrans({ { i + 1, j + 1 }, { themeW - 1, themeH - 1 } });
DRLG_MRectTrans({ theme.room.position, theme.room.size - 1 });
}
themeLoc[themeCount].ttval = TransVal - 1;
theme.ttval = TransVal - 1;
CreateThemeRoom(themeCount);
themeCount++;
}

Loading…
Cancel
Save