Browse Source

♻️ Replace 'dmaxx' and 'dmaxy' globals with single 'dmaxPosition'

pull/2804/head
Juliano Leal Goncalves 5 years ago committed by Anders Jenbo
parent
commit
ba66a9dc87
  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

@ -2402,8 +2402,7 @@ void Pass3()
void LoadL1Dungeon(const char *path, int vx, int vy)
{
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
dmaxPosition = { 96, 96 };
DRLG_InitTrans();
@ -2458,8 +2457,7 @@ void LoadPreL1Dungeon(const char *path)
}
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
dmaxPosition = { 96, 96 };
auto dunData = LoadFileInMem<uint16_t>(path);
@ -2495,8 +2493,7 @@ void CreateL5Dungeon(uint32_t rseed, lvl_entry entry)
SetRndSeed(rseed);
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
dmaxPosition = { 96, 96 };
UberRow = 0;
UberCol = 0;
@ -2519,8 +2516,8 @@ void CreateL5Dungeon(uint32_t rseed, lvl_entry entry)
DRLG_SetPC();
for (int j = dminPosition.y; j < dmaxy; j++) {
for (int i = dminPosition.x; i < dmaxx; i++) {
for (int j = dminPosition.y; j < dmaxPosition.y; j++) {
for (int i = dminPosition.x; i < dmaxPosition.x; i++) {
if (dPiece[i][j] == 290) {
UberRow = i;
UberCol = j;

3
Source/drlg_l2.cpp

@ -3173,8 +3173,7 @@ void CreateL2Dungeon(uint32_t rseed, lvl_entry entry)
SetRndSeed(rseed);
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
dmaxPosition = { 96, 96 };
DRLG_InitTrans();
DRLG_InitSetPC();

6
Source/drlg_l3.cpp

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

9
Source/drlg_l4.cpp

@ -1469,8 +1469,7 @@ void CreateL4Dungeon(uint32_t rseed, lvl_entry entry)
SetRndSeed(rseed);
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
dmaxPosition = { 96, 96 };
ViewPosition = { 40, 40 };
@ -1485,8 +1484,7 @@ void CreateL4Dungeon(uint32_t rseed, lvl_entry entry)
void LoadL4Dungeon(const char *path, int vx, int vy)
{
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
dmaxPosition = { 96, 96 };
DRLG_InitTrans();
InitDungeonFlags();
@ -1507,8 +1505,7 @@ void LoadL4Dungeon(const char *path, int vx, int vy)
void LoadPreL4Dungeon(const char *path)
{
dminPosition = { 16, 16 };
dmaxx = 96;
dmaxy = 96;
dmaxPosition = { 96, 96 };
InitDungeonFlags();

3
Source/gendung.cpp

@ -33,8 +33,7 @@ std::array<bool, MAXTILES + 1> nTransTable;
std::array<bool, MAXTILES + 1> nMissileTable;
std::array<bool, MAXTILES + 1> nTrapTable;
Point dminPosition;
int dmaxx;
int dmaxy;
Point dmaxPosition;
dungeon_type leveltype;
BYTE currlevel;
bool setlevel;

6
Source/gendung.h

@ -167,10 +167,8 @@ extern std::array<bool, MAXTILES + 1> nMissileTable;
extern std::array<bool, MAXTILES + 1> nTrapTable;
/** 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. */
extern int dmaxy;
/** Specifies the maximum X,Y-coordinates of the map. */
extern Point dmaxPosition;
/** Specifies the active dungeon type of the current game. */
extern dungeon_type leveltype;
/** Specifies the active dungeon level of the current game. */

14
Source/scrollrt.cpp

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

3
Source/town.cpp

@ -269,8 +269,7 @@ void TownOpenGrave()
void CreateTown(lvl_entry entry)
{
dminPosition = { 10, 10 };
dmaxx = 84;
dmaxy = 84;
dmaxPosition = { 84, 84 };
DRLG_InitTrans();
DRLG_Init_Globals();

Loading…
Cancel
Save