Browse Source

Rename SkipThemeRoom/invert logic to match use

pull/4775/head
ephphatha 4 years ago committed by Anders Jenbo
parent
commit
3354c57ca8
  1. 2
      Source/drlg_l3.cpp
  2. 10
      Source/gendung.cpp
  3. 8
      Source/gendung.h
  4. 2
      Source/objects.cpp

2
Source/drlg_l3.cpp

@ -1714,7 +1714,7 @@ void Fence()
for (int j = 1; j < DMAXY; j++) { // BUGFIX: Change '0' to '1' (fixed)
for (int i = 1; i < DMAXX; i++) { // BUGFIX: Change '0' to '1' (fixed)
if (dungeon[i][j] == 7 && GenerateRnd(1) == 0 && SkipThemeRoom(i, j)) {
if (dungeon[i][j] == 7 && GenerateRnd(1) == 0 && !IsNearThemeRoom({ i, j })) {
int rt = GenerateRnd(2);
if (rt == 0) {
int y1 = j;

10
Source/gendung.cpp

@ -95,7 +95,7 @@ bool WillThemeRoomFit(int floor, int x, int y, int minSize, int maxSize, int *wi
if (x + minSize > DMAXX || y + minSize > DMAXY) {
return false; // Skip definit OOB cases
}
if (!SkipThemeRoom(x, y)) {
if (IsNearThemeRoom({ x, y })) {
return false;
}
@ -750,15 +750,17 @@ void DRLG_LPass3(int lv)
}
}
bool SkipThemeRoom(int x, int y)
bool IsNearThemeRoom(Point testPosition)
{
int x = testPosition.x;
int y = testPosition.y;
for (int i = 0; i < themeCount; i++) {
if (x >= themeLoc[i].room.position.x - 2 && x <= themeLoc[i].room.position.x + themeLoc[i].room.size.width + 2
&& y >= themeLoc[i].room.position.y - 2 && y <= themeLoc[i].room.position.y + themeLoc[i].room.size.height + 2)
return false;
return true;
}
return true;
return false;
}
void InitLevels()

8
Source/gendung.h

@ -335,7 +335,13 @@ void DRLG_HoldThemeRooms();
void SetSetPieceRoom(Point position, int floorId);
void FreeQuestSetPieces();
void DRLG_LPass3(int lv);
bool SkipThemeRoom(int x, int y);
/**
* @brief Checks if a theme room is located near the target point
* @param position Target location in dungeon coordinates
* @return True if a theme room is near (within 2 tiles of) this point, false if it is free.
*/
bool IsNearThemeRoom(Point position);
void InitLevels();
void FloodTransparencyValues(uint8_t floorID);

2
Source/objects.cpp

@ -890,7 +890,7 @@ void AddHookedBodies(int freq)
continue;
if (GenerateRnd(freq) != 0)
continue;
if (!SkipThemeRoom(i, j))
if (IsNearThemeRoom({ i, j }))
continue;
if (dungeon[i][j] == 1 && dungeon[i + 1][j] == 6) {
switch (GenerateRnd(3)) {

Loading…
Cancel
Save