Browse Source

Include coin flips from room gen cleanup

pull/4935/head
ephphatha 4 years ago committed by Anders Jenbo
parent
commit
7bda8dcc9a
  1. 2
      Source/levels/drlg_l1.cpp
  2. 2
      Source/levels/drlg_l4.cpp
  3. 4
      Source/levels/themes.cpp

2
Source/levels/drlg_l1.cpp

@ -449,7 +449,7 @@ bool CheckRoom(Rectangle room)
void GenerateRoom(Rectangle area, bool verticalLayout) void GenerateRoom(Rectangle area, bool verticalLayout)
{ {
bool rotate = GenerateRnd(4) == 0; bool rotate = FlipCoin(4);
verticalLayout = (!verticalLayout && rotate) || (verticalLayout && !rotate); verticalLayout = (!verticalLayout && rotate) || (verticalLayout && !rotate);
bool placeRoom1; bool placeRoom1;

2
Source/levels/drlg_l4.cpp

@ -203,7 +203,7 @@ bool CheckRoom(Rectangle room)
void GenerateRoom(Rectangle area, bool verticalLayout) void GenerateRoom(Rectangle area, bool verticalLayout)
{ {
bool rotate = GenerateRnd(4) != 0; bool rotate = !FlipCoin(4);
verticalLayout = (!verticalLayout && rotate) || (verticalLayout && !rotate); verticalLayout = (!verticalLayout && rotate) || (verticalLayout && !rotate);
bool placeRoom1; bool placeRoom1;

4
Source/levels/themes.cpp

@ -648,8 +648,8 @@ void Theme_Treasure(int t)
if (dTransVal[xp][yp] == themes[t].ttval && IsTileNotSolid({ xp, yp })) { if (dTransVal[xp][yp] == themes[t].ttval && IsTileNotSolid({ xp, yp })) {
int8_t treasureType = treasrnd[leveltype - 1]; int8_t treasureType = treasrnd[leveltype - 1];
int rv = GenerateRnd(treasureType); int rv = GenerateRnd(treasureType);
// BUGFIX: the `2*` in `2*GenerateRnd(treasrnd...) == 0` has no effect, should probably be `GenerateRnd(2*treasrnd...) == 0` // BUGFIX: this used to be `2*GenerateRnd(treasureType) == 0` however 2*0 has no effect, should probably be `FlipCoin(2*treasureType)`
if ((2 * GenerateRnd(treasureType)) == 0) { if (FlipCoin(treasureType)) {
CreateTypeItem({ xp, yp }, false, ItemType::Gold, IMISC_NONE, false, true); CreateTypeItem({ xp, yp }, false, ItemType::Gold, IMISC_NONE, false, true);
ItemNoFlippy(); ItemNoFlippy();
} }

Loading…
Cancel
Save