Browse Source

♻️ Replace 'dminx' and 'dminy' globals with single 'dminPosition'

pull/2804/head
Juliano Leal Goncalves 5 years ago committed by Anders Jenbo
parent
commit
6583410152
  1. 13
      Source/drlg_l1.cpp
  2. 3
      Source/drlg_l2.cpp
  3. 6
      Source/drlg_l3.cpp
  4. 9
      Source/drlg_l4.cpp
  5. 3
      Source/gendung.cpp
  6. 6
      Source/gendung.h
  7. 14
      Source/scrollrt.cpp
  8. 3
      Source/town.cpp

13
Source/drlg_l1.cpp

@ -2401,8 +2401,7 @@ void Pass3()
void LoadL1Dungeon(const char *path, int vx, int vy)
{
dminx = 16;
dminy = 16;
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
@ -2458,8 +2457,7 @@ void LoadPreL1Dungeon(const char *path)
}
}
dminx = 16;
dminy = 16;
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
@ -2496,8 +2494,7 @@ void CreateL5Dungeon(uint32_t rseed, lvl_entry entry)
{
SetRndSeed(rseed);
dminx = 16;
dminy = 16;
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
@ -2522,8 +2519,8 @@ void CreateL5Dungeon(uint32_t rseed, lvl_entry entry)
DRLG_SetPC();
for (int j = dminy; j < dmaxy; j++) {
for (int i = dminx; i < dmaxx; i++) {
for (int j = dminPosition.y; j < dmaxy; j++) {
for (int i = dminPosition.x; i < dmaxx; i++) {
if (dPiece[i][j] == 290) {
UberRow = i;
UberCol = j;

3
Source/drlg_l2.cpp

@ -3172,8 +3172,7 @@ void CreateL2Dungeon(uint32_t rseed, lvl_entry entry)
SetRndSeed(rseed);
dminx = 16;
dminy = 16;
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;

6
Source/drlg_l3.cpp

@ -2481,8 +2481,7 @@ void CreateL3Dungeon(uint32_t rseed, lvl_entry entry)
{
SetRndSeed(rseed);
dminx = 16;
dminy = 16;
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
@ -2518,8 +2517,7 @@ void CreateL3Dungeon(uint32_t rseed, lvl_entry entry)
void LoadL3Dungeon(const char *path, int vx, int vy)
{
dminx = 16;
dminy = 16;
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;

9
Source/drlg_l4.cpp

@ -1468,8 +1468,7 @@ void CreateL4Dungeon(uint32_t rseed, lvl_entry entry)
{
SetRndSeed(rseed);
dminx = 16;
dminy = 16;
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
@ -1485,8 +1484,7 @@ void CreateL4Dungeon(uint32_t rseed, lvl_entry entry)
void LoadL4Dungeon(const char *path, int vx, int vy)
{
dminx = 16;
dminy = 16;
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
@ -1508,8 +1506,7 @@ void LoadL4Dungeon(const char *path, int vx, int vy)
void LoadPreL4Dungeon(const char *path)
{
dminx = 16;
dminy = 16;
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;

3
Source/gendung.cpp

@ -32,8 +32,7 @@ std::array<bool, MAXTILES + 1> nSolidTable;
std::array<bool, MAXTILES + 1> nTransTable;
std::array<bool, MAXTILES + 1> nMissileTable;
std::array<bool, MAXTILES + 1> nTrapTable;
int dminx;
int dminy;
Point dminPosition;
int dmaxx;
int dmaxy;
dungeon_type leveltype;

6
Source/gendung.h

@ -165,10 +165,8 @@ extern std::array<bool, MAXTILES + 1> nTransTable;
*/
extern std::array<bool, MAXTILES + 1> nMissileTable;
extern std::array<bool, MAXTILES + 1> nTrapTable;
/** Specifies the minimum X-coordinate of the map. */
extern int dminx;
/** Specifies the minimum Y-coordinate of the map. */
extern int dminy;
/** Specifies the minimum X,Y-coordinates of the map. */
extern Point dminPosition;
/** Specifies the maximum X-coordinate of the map. */
extern int dmaxx;
/** Specifies the maximum Y-coordinate of the map. */

14
Source/scrollrt.cpp

@ -1624,12 +1624,12 @@ void ScrollView()
scroll = false;
if (MousePosition.x < 20) {
if (dmaxy - 1 <= ViewPosition.y || dminx >= ViewPosition.x) {
if (dmaxy - 1 <= ViewPosition.y || dminPosition.x >= ViewPosition.x) {
if (dmaxy - 1 > ViewPosition.y) {
ViewPosition.y++;
scroll = true;
}
if (dminx < ViewPosition.x) {
if (dminPosition.x < ViewPosition.x) {
ViewPosition.x--;
scroll = true;
}
@ -1640,12 +1640,12 @@ void ScrollView()
}
}
if (MousePosition.x > gnScreenWidth - 20) {
if (dmaxx - 1 <= ViewPosition.x || dminy >= ViewPosition.y) {
if (dmaxx - 1 <= ViewPosition.x || dminPosition.y >= ViewPosition.y) {
if (dmaxx - 1 > ViewPosition.x) {
ViewPosition.x++;
scroll = true;
}
if (dminy < ViewPosition.y) {
if (dminPosition.y < ViewPosition.y) {
ViewPosition.y--;
scroll = true;
}
@ -1656,12 +1656,12 @@ void ScrollView()
}
}
if (MousePosition.y < 20) {
if (dminy >= ViewPosition.y || dminx >= ViewPosition.x) {
if (dminy < ViewPosition.y) {
if (dminPosition.y >= ViewPosition.y || dminPosition.x >= ViewPosition.x) {
if (dminPosition.y < ViewPosition.y) {
ViewPosition.y--;
scroll = true;
}
if (dminx < ViewPosition.x) {
if (dminPosition.x < ViewPosition.x) {
ViewPosition.x--;
scroll = true;
}

3
Source/town.cpp

@ -268,8 +268,7 @@ void TownOpenGrave()
void CreateTown(lvl_entry entry)
{
dminx = 10;
dminy = 10;
dminPosition = { 10, 10 };
dmaxx = 84;
dmaxy = 84;
DRLG_InitTrans();

Loading…
Cancel
Save