Browse Source

Clean up drlg_l1.cpp

pull/100/head
Anders Jenbo 7 years ago
parent
commit
5cc368376f
  1. 106
      Source/drlg_l1.cpp
  2. 24
      Source/drlg_l1.h
  3. 2
      Source/drlg_l2.cpp
  4. 2
      Source/drlg_l3.cpp
  5. 32
      Source/drlg_l4.cpp
  6. 6
      Source/gendung.cpp
  7. 2
      Source/gendung.h

106
Source/drlg_l1.cpp

@ -1,15 +1,15 @@
#include "diablo.h" #include "diablo.h"
char L5dungeon[80][80]; char L5dungeon[80][80];
unsigned char L5dflags[DMAXX][DMAXY]; BYTE L5dflags[DMAXX][DMAXY];
int setloadflag; // weak BOOL setloadflag;
int HR1; int HR1;
int HR2; int HR2;
int HR3; int HR3;
int VR1; int VR1;
int VR2; int VR2;
int VR3; int VR3;
void *pSetPiece; // idb BYTE *pSetPiece;
const ShadowStruct SPATS[37] = { const ShadowStruct SPATS[37] = {
// clang-format off // clang-format off
@ -53,7 +53,7 @@ const ShadowStruct SPATS[37] = {
{ 3, 13, 11, 12, 150, 0, 0 } { 3, 13, 11, 12, 150, 0, 0 }
// clang-format on // clang-format on
}; };
const unsigned char BSTYPES[206] = { const BYTE BSTYPES[206] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0,
0, 0, 0, 0, 0, 1, 2, 10, 4, 5, 0, 0, 0, 0, 0, 1, 2, 10, 4, 5,
@ -76,7 +76,7 @@ const unsigned char BSTYPES[206] = {
28, 1, 2, 25, 26, 22, 22, 25, 26, 0, 28, 1, 2, 25, 26, 22, 22, 25, 26, 0,
0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0
}; };
const unsigned char L5BTYPES[206] = { const BYTE L5BTYPES[206] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0,
0, 0, 0, 0, 0, 25, 26, 0, 28, 0, 0, 0, 0, 0, 0, 25, 26, 0, 28, 0,
@ -99,14 +99,14 @@ const unsigned char L5BTYPES[206] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0
}; };
const unsigned char STAIRSUP[] = { 4, 4, 13, 13, 13, 13, 2, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 13, 0, 66, 6, 0, 63, 64, 65, 0, 0, 67, 68, 0, 0, 0, 0, 0 }; const BYTE STAIRSUP[] = { 4, 4, 13, 13, 13, 13, 2, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 13, 0, 66, 6, 0, 63, 64, 65, 0, 0, 67, 68, 0, 0, 0, 0, 0 };
const unsigned char L5STAIRSUP[] = { 4, 4, 22, 22, 22, 22, 2, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 13, 0, 66, 23, 0, 63, 64, 65, 0, 0, 67, 68, 0, 0, 0, 0, 0 }; const BYTE L5STAIRSUP[] = { 4, 4, 22, 22, 22, 22, 2, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 13, 0, 66, 23, 0, 63, 64, 65, 0, 0, 67, 68, 0, 0, 0, 0, 0 };
const unsigned char STAIRSDOWN[] = { 4, 3, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 62, 57, 58, 0, 61, 59, 60, 0, 0, 0, 0, 0 }; const BYTE STAIRSDOWN[] = { 4, 3, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 62, 57, 58, 0, 61, 59, 60, 0, 0, 0, 0, 0 };
const unsigned char LAMPS[] = { 2, 2, 13, 0, 13, 13, 129, 0, 130, 128 }; const BYTE LAMPS[] = { 2, 2, 13, 0, 13, 13, 129, 0, 130, 128 };
const unsigned char PWATERIN[] = { 6, 6, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 202, 200, 200, 84, 0, 0, 199, 203, 203, 83, 0, 0, 85, 206, 80, 81, 0, 0, 0, 134, 135, 0, 0, 0, 0, 0, 0, 0, 0 }; const BYTE PWATERIN[] = { 6, 6, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 202, 200, 200, 84, 0, 0, 199, 203, 203, 83, 0, 0, 85, 206, 80, 81, 0, 0, 0, 134, 135, 0, 0, 0, 0, 0, 0, 0, 0 };
/* data */ /* data */
unsigned char L5ConvTbl[16] = { 22u, 13u, 1u, 13u, 2u, 13u, 13u, 13u, 4u, 13u, 1u, 13u, 2u, 13u, 16u, 13u }; BYTE L5ConvTbl[16] = { 22u, 13u, 1u, 13u, 2u, 13u, 13u, 13u, 4u, 13u, 1u, 13u, 2u, 13u, 16u, 13u };
void DRLG_Init_Globals() void DRLG_Init_Globals()
{ {
@ -126,8 +126,6 @@ void DRLG_Init_Globals()
c = 0; c = 0;
memset(dLight, c, sizeof(dLight)); memset(dLight, c, sizeof(dLight));
} }
// 525728: using guessed type int light4flag;
// 646A28: using guessed type int lightflag;
void LoadL1Dungeon(char *sFileName, int vx, int vy) void LoadL1Dungeon(char *sFileName, int vx, int vy)
{ {
@ -177,10 +175,6 @@ void LoadL1Dungeon(char *sFileName, int vx, int vy)
SetMapObjects(pLevelMap, 0, 0); SetMapObjects(pLevelMap, 0, 0);
mem_free_dbg(pLevelMap); mem_free_dbg(pLevelMap);
} }
// 5CF328: using guessed type int dmaxx;
// 5CF32C: using guessed type int dmaxy;
// 5D2458: using guessed type int dminx;
// 5D245C: using guessed type int dminy;
void DRLG_L1Floor() void DRLG_L1Floor()
{ {
@ -249,7 +243,7 @@ void DRLG_L1Pass3()
for (j = 0; j < DMAXY; j++) { for (j = 0; j < DMAXY; j++) {
xx = 16; xx = 16;
for (i = 0; i < DMAXX; i++) { for (i = 0; i < DMAXX; i++) {
lv = (unsigned char)dungeon[i][j] - 1; lv = dungeon[i][j] - 1;
/// ASSERT: assert(lv >= 0); /// ASSERT: assert(lv >= 0);
#ifdef USE_ASM #ifdef USE_ASM
__asm { __asm {
@ -376,10 +370,6 @@ void LoadPreL1Dungeon(char *sFileName, int vx, int vy)
mem_free_dbg(pLevelMap); mem_free_dbg(pLevelMap);
} }
// 5CF328: using guessed type int dmaxx;
// 5CF32C: using guessed type int dmaxy;
// 5D2458: using guessed type int dminx;
// 5D245C: using guessed type int dminy;
void CreateL5Dungeon(int rseed, int entry) void CreateL5Dungeon(int rseed, int entry)
{ {
@ -399,29 +389,23 @@ void CreateL5Dungeon(int rseed, int entry)
DRLG_InitL1Vals(); DRLG_InitL1Vals();
DRLG_SetPC(); DRLG_SetPC();
} }
// 5CF328: using guessed type int dmaxx;
// 5CF32C: using guessed type int dmaxy;
// 5D2458: using guessed type int dminx;
// 5D245C: using guessed type int dminy;
void DRLG_LoadL1SP() void DRLG_LoadL1SP()
{ {
setloadflag = 0; setloadflag = FALSE;
if (QuestStatus(QTYPE_BUTCH)) { if (QuestStatus(QTYPE_BUTCH)) {
pSetPiece = LoadFileInMem("Levels\\L1Data\\rnd6.DUN", 0); pSetPiece = LoadFileInMem("Levels\\L1Data\\rnd6.DUN", 0);
setloadflag = 1; setloadflag = TRUE;
} }
if (QuestStatus(QTYPE_KING) && gbMaxPlayers == 1) { if (QuestStatus(QTYPE_KING) && gbMaxPlayers == 1) {
pSetPiece = LoadFileInMem("Levels\\L1Data\\SKngDO.DUN", 0); pSetPiece = LoadFileInMem("Levels\\L1Data\\SKngDO.DUN", 0);
setloadflag = 1; setloadflag = TRUE;
} }
if (QuestStatus(QTYPE_BOL)) { if (QuestStatus(QTYPE_BOL)) {
pSetPiece = LoadFileInMem("Levels\\L1Data\\Banner2.DUN", 0); pSetPiece = LoadFileInMem("Levels\\L1Data\\Banner2.DUN", 0);
setloadflag = 1; setloadflag = TRUE;
} }
} }
// 5276A4: using guessed type int setloadflag;
// 679660: using guessed type char gbMaxPlayers;
void DRLG_FreeL1SP() void DRLG_FreeL1SP()
{ {
@ -542,9 +526,9 @@ void DRLG_L5(int entry)
void DRLG_PlaceDoor(int x, int y) void DRLG_PlaceDoor(int x, int y)
{ {
if ((L5dflags[x][y] & 0x80) == 0) { /* todo: unsigned */ if ((L5dflags[x][y] & 0x80) == 0) {
unsigned char df = L5dflags[x][y] & 0x7F; BYTE df = L5dflags[x][y] & 0x7F;
unsigned char c = dungeon[x][y]; BYTE c = dungeon[x][y];
if (df == 1) { if (df == 1) {
if (y != 1 && c == 2) if (y != 1 && c == 2)
@ -602,16 +586,16 @@ void DRLG_PlaceDoor(int x, int y)
void DRLG_L1Shadows() void DRLG_L1Shadows()
{ {
int x, y, i; int x, y, i;
unsigned char sd[2][2]; BYTE sd[2][2];
unsigned char tnv3; BYTE tnv3;
BOOL patflag; BOOL patflag;
for (y = 1; y < DMAXY; y++) { for (y = 1; y < DMAXY; y++) {
for (x = 1; x < DMAXX; x++) { for (x = 1; x < DMAXX; x++) {
sd[0][0] = BSTYPES[(unsigned char)dungeon[x][y]]; sd[0][0] = BSTYPES[dungeon[x][y]];
sd[1][0] = BSTYPES[(unsigned char)dungeon[x - 1][y]]; sd[1][0] = BSTYPES[dungeon[x - 1][y]];
sd[0][1] = BSTYPES[(unsigned char)dungeon[x][y - 1]]; sd[0][1] = BSTYPES[dungeon[x][y - 1]];
sd[1][1] = BSTYPES[(unsigned char)dungeon[x - 1][y - 1]]; sd[1][1] = BSTYPES[dungeon[x - 1][y - 1]];
for (i = 0; i < 37; i++) { for (i = 0; i < 37; i++) {
if (SPATS[i].strig == sd[0][0]) { if (SPATS[i].strig == sd[0][0]) {
@ -639,7 +623,7 @@ void DRLG_L1Shadows()
for (y = 1; y < DMAXY; y++) { for (y = 1; y < DMAXY; y++) {
for (x = 1; x < DMAXX; x++) { for (x = 1; x < DMAXX; x++) {
if ((unsigned char)dungeon[x - 1][y] == 139 && !L5dflags[x - 1][y]) { if (dungeon[x - 1][y] == 139 && !L5dflags[x - 1][y]) {
tnv3 = 139; tnv3 = 139;
if (dungeon[x][y] == 29) if (dungeon[x][y] == 29)
tnv3 = 141; tnv3 = 141;
@ -655,7 +639,7 @@ void DRLG_L1Shadows()
tnv3 = 141; tnv3 = 141;
dungeon[x - 1][y] = tnv3; dungeon[x - 1][y] = tnv3;
} }
if ((unsigned char)dungeon[x - 1][y] == 149 && !L5dflags[x - 1][y]) { if (dungeon[x - 1][y] == 149 && !L5dflags[x - 1][y]) {
tnv3 = 149; tnv3 = 149;
if (dungeon[x][y] == 29) if (dungeon[x][y] == 29)
tnv3 = 153; tnv3 = 153;
@ -671,7 +655,7 @@ void DRLG_L1Shadows()
tnv3 = 153; tnv3 = 153;
dungeon[x - 1][y] = tnv3; dungeon[x - 1][y] = tnv3;
} }
if ((unsigned char)dungeon[x - 1][y] == 148 && !L5dflags[x - 1][y]) { if (dungeon[x - 1][y] == 148 && !L5dflags[x - 1][y]) {
tnv3 = 148; tnv3 = 148;
if (dungeon[x][y] == 29) if (dungeon[x][y] == 29)
tnv3 = 154; tnv3 = 154;
@ -691,7 +675,7 @@ void DRLG_L1Shadows()
} }
} }
int DRLG_PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int noquad, int ldir) int DRLG_PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int noquad, int ldir)
{ {
int xx, yy, sx, sy; int xx, yy, sx, sy;
int ii, i, t, found; int ii, i, t, found;
@ -746,7 +730,7 @@ int DRLG_PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int cx,
for (yy = 0; yy < sh && abort == TRUE; yy++) { for (yy = 0; yy < sh && abort == TRUE; yy++) {
for (xx = 0; xx < sw && abort == TRUE; xx++) { for (xx = 0; xx < sw && abort == TRUE; xx++) {
if (miniset[ii] && (unsigned char)dungeon[xx + sx][sy + yy] != miniset[ii]) if (miniset[ii] && dungeon[xx + sx][sy + yy] != miniset[ii])
abort = FALSE; abort = FALSE;
if (L5dflags[xx + sx][sy + yy]) if (L5dflags[xx + sx][sy + yy])
abort = FALSE; abort = FALSE;
@ -805,9 +789,6 @@ int DRLG_PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int cx,
else else
return 3; return 3;
} }
// 5A5590: using guessed type char TransVal;
// 5CF320: using guessed type int LvlViewY;
// 5CF324: using guessed type int LvlViewX;
void InitL5Dungeon() void InitL5Dungeon()
{ {
@ -1114,9 +1095,9 @@ int L5HWallOk(int i, int j)
} }
wallok = FALSE; wallok = FALSE;
if ((unsigned char)dungeon[i + x][j] >= 3 && (unsigned char)dungeon[i + x][j] <= 7) /* todo: unsigned */ if (dungeon[i + x][j] >= 3 && dungeon[i + x][j] <= 7)
wallok = TRUE; wallok = TRUE;
if ((unsigned char)dungeon[i + x][j] >= 16 && (unsigned char)dungeon[i + x][j] <= 24) if (dungeon[i + x][j] >= 16 && dungeon[i + x][j] <= 24)
wallok = TRUE; wallok = TRUE;
if (dungeon[i + x][j] == 22) if (dungeon[i + x][j] == 22)
wallok = FALSE; wallok = FALSE;
@ -1140,9 +1121,9 @@ int L5VWallOk(int i, int j)
} }
wallok = FALSE; wallok = FALSE;
if ((unsigned char)dungeon[i][j + y] >= 3 && (unsigned char)dungeon[i][j + y] <= 7) /* todo: unsigned */ if (dungeon[i][j + y] >= 3 && dungeon[i][j + y] <= 7)
wallok = TRUE; wallok = TRUE;
if ((unsigned char)dungeon[i][j + y] >= 16 && (unsigned char)dungeon[i][j + y] <= 24) if (dungeon[i][j + y] >= 16 && dungeon[i][j + y] <= 24)
wallok = TRUE; wallok = TRUE;
if (dungeon[i][j + y] == 22) if (dungeon[i][j + y] == 22)
wallok = FALSE; wallok = FALSE;
@ -1368,7 +1349,7 @@ void DRLG_L5Subs()
for (y = 0; y < DMAXY; y++) { for (y = 0; y < DMAXY; y++) {
for (x = 0; x < DMAXX; x++) { for (x = 0; x < DMAXX; x++) {
if (!random(0, 4)) { if (!random(0, 4)) {
unsigned char c = L5BTYPES[(unsigned char)dungeon[x][y]]; /* todo: changed to unsigned */ BYTE c = L5BTYPES[dungeon[x][y]];
if (c && !L5dflags[x][y]) { if (c && !L5dflags[x][y]) {
rv = random(0, 16); rv = random(0, 16);
@ -1382,13 +1363,13 @@ void DRLG_L5Subs()
} }
if (i == 89) { if (i == 89) {
if (L5BTYPES[(unsigned char)dungeon[x][y - 1]] != 79 || L5dflags[x][y - 1]) if (L5BTYPES[dungeon[x][y - 1]] != 79 || L5dflags[x][y - 1])
i = 79; i = 79;
else else
dungeon[x][y - 1] = 90; dungeon[x][y - 1] = 90;
} }
if (i == 91) { if (i == 91) {
if (L5BTYPES[(unsigned char)dungeon[x + 1][y]] != 80 || L5dflags[x + 1][y]) if (L5BTYPES[dungeon[x + 1][y]] != 80 || L5dflags[x + 1][y])
i = 80; i = 80;
else else
dungeon[x + 1][y] = 92; dungeon[x + 1][y] = 92;
@ -1509,7 +1490,6 @@ void L5FillChambers()
} }
} }
} }
// 5276A4: using guessed type int setloadflag;
void DRLG_L5GChamber(int sx, int sy, BOOL topflag, BOOL bottomflag, BOOL leftflag, BOOL rightflag) void DRLG_L5GChamber(int sx, int sy, BOOL topflag, BOOL bottomflag, BOOL leftflag, BOOL rightflag)
{ {
@ -1589,17 +1569,17 @@ void DRLG_L5GHall(int x1, int y1, int x2, int y2)
void DRLG_L5SetRoom(int rx1, int ry1) void DRLG_L5SetRoom(int rx1, int ry1)
{ {
int rw, rh, i, j; int rw, rh, i, j;
unsigned char *sp; BYTE *sp;
rw = *(unsigned char *)pSetPiece; /* todo: BYTE */ rw = *pSetPiece;
rh = *((unsigned char *)pSetPiece + 2); rh = *(pSetPiece + 2);
setpc_x = rx1; setpc_x = rx1;
setpc_y = ry1; setpc_y = ry1;
setpc_w = rw; setpc_w = rw;
setpc_h = rh; setpc_h = rh;
sp = (unsigned char *)pSetPiece + 4; sp = pSetPiece + 4;
for (j = 0; j < rh; j++) { for (j = 0; j < rh; j++) {
for (i = 0; i < rw; i++) { for (i = 0; i < rw; i++) {
@ -1613,8 +1593,6 @@ void DRLG_L5SetRoom(int rx1, int ry1)
} }
} }
} }
// 5CF330: using guessed type int setpc_h;
// 5CF334: using guessed type int setpc_w;
void DRLG_L5FloodTVal() void DRLG_L5FloodTVal()
{ {
@ -1635,7 +1613,6 @@ void DRLG_L5FloodTVal()
yy += 2; yy += 2;
} }
} }
// 5A5590: using guessed type char TransVal;
void DRLG_L5FTVR(int i, int j, int x, int y, int d) void DRLG_L5FTVR(int i, int j, int x, int y, int d)
{ {
@ -1679,7 +1656,6 @@ void DRLG_L5FTVR(int i, int j, int x, int y, int d)
DRLG_L5FTVR(i + 1, j + 1, x + 2, y + 2, 8); DRLG_L5FTVR(i + 1, j + 1, x + 2, y + 2, 8);
} }
} }
// 5A5590: using guessed type char TransVal;
void DRLG_L5TransFix() void DRLG_L5TransFix()
{ {

24
Source/drlg_l1.h

@ -3,15 +3,15 @@
#define __DRLG_L1_H__ #define __DRLG_L1_H__
extern char L5dungeon[80][80]; extern char L5dungeon[80][80];
extern unsigned char L5dflags[40][40]; extern BYTE L5dflags[40][40];
extern int setloadflag; // weak extern BOOL setloadflag;
extern int HR1; extern int HR1;
extern int HR2; extern int HR2;
extern int HR3; extern int HR3;
extern int VR1; extern int VR1;
extern int VR2; extern int VR2;
extern int VR3; extern int VR3;
extern void *pSetPiece; // idb extern BYTE *pSetPiece;
void DRLG_Init_Globals(); void DRLG_Init_Globals();
void LoadL1Dungeon(char *sFileName, int vx, int vy); void LoadL1Dungeon(char *sFileName, int vx, int vy);
@ -25,7 +25,7 @@ void DRLG_FreeL1SP();
void DRLG_L5(int entry); void DRLG_L5(int entry);
void DRLG_PlaceDoor(int x, int y); void DRLG_PlaceDoor(int x, int y);
void DRLG_L1Shadows(); void DRLG_L1Shadows();
int DRLG_PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int noquad, int ldir); int DRLG_PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int noquad, int ldir);
void InitL5Dungeon(); void InitL5Dungeon();
void L5ClearFlags(); void L5ClearFlags();
void L5firstRoom(); void L5firstRoom();
@ -54,15 +54,15 @@ void DRLG_L5CornerFix();
/* rdata */ /* rdata */
extern const ShadowStruct SPATS[37]; extern const ShadowStruct SPATS[37];
extern const unsigned char BSTYPES[206]; extern const BYTE BSTYPES[206];
extern const unsigned char L5BTYPES[206]; extern const BYTE L5BTYPES[206];
extern const unsigned char STAIRSUP[]; extern const BYTE STAIRSUP[];
extern const unsigned char L5STAIRSUP[]; extern const BYTE L5STAIRSUP[];
extern const unsigned char STAIRSDOWN[]; extern const BYTE STAIRSDOWN[];
extern const unsigned char LAMPS[]; extern const BYTE LAMPS[];
extern const unsigned char PWATERIN[]; extern const BYTE PWATERIN[];
/* data */ /* data */
extern unsigned char L5ConvTbl[16]; extern BYTE L5ConvTbl[16];
#endif /* __DRLG_L1_H__ */ #endif /* __DRLG_L1_H__ */

2
Source/drlg_l2.cpp

@ -465,7 +465,7 @@ void DRLG_L2Pass3()
for (j = 0; j < DMAXY; j++) { for (j = 0; j < DMAXY; j++) {
xx = 16; xx = 16;
for (i = 0; i < DMAXX; i++) { for (i = 0; i < DMAXX; i++) {
lv = (unsigned char)dungeon[i][j] - 1; lv = dungeon[i][j] - 1;
#ifdef USE_ASM #ifdef USE_ASM
__asm { __asm {
mov esi, pMegaTiles mov esi, pMegaTiles

2
Source/drlg_l3.cpp

@ -1678,7 +1678,7 @@ void DRLG_L3Pass3()
for (j = 0; j < DMAXY; j++) { for (j = 0; j < DMAXY; j++) {
xx = 16; xx = 16;
for (i = 0; i < DMAXX; i++) { for (i = 0; i < DMAXX; i++) {
lv = (unsigned char)dungeon[i][j] - 1; lv = dungeon[i][j] - 1;
#ifdef USE_ASM #ifdef USE_ASM
if (lv >= 0) { if (lv >= 0) {
__asm { __asm {

32
Source/drlg_l4.cpp

@ -384,10 +384,10 @@ void L4SaveQuads()
// 528A34: using guessed type int l4holdx; // 528A34: using guessed type int l4holdx;
// 528A38: using guessed type int l4holdy; // 528A38: using guessed type int l4holdy;
void DRLG_L4SetRoom(unsigned char *pSetPiece, int rx1, int ry1) void DRLG_L4SetRoom(BYTE *pSetPiece, int rx1, int ry1)
{ {
int rw, rh, i, j; int rw, rh, i, j;
unsigned char *sp; BYTE *sp;
rw = pSetPiece[0]; rw = pSetPiece[0];
rh = pSetPiece[2]; rh = pSetPiece[2];
@ -446,10 +446,6 @@ void DRLG_LoadDiabQuads(BOOL preflag)
DRLG_L4SetRoom(lpSetPiece, diabquad4x, diabquad4y); DRLG_L4SetRoom(lpSetPiece, diabquad4x, diabquad4y);
mem_free_dbg(lpSetPiece); mem_free_dbg(lpSetPiece);
} }
// 5289C4: using guessed type int diabquad1x;
// 5289C8: using guessed type int diabquad1y;
// 528A34: using guessed type int l4holdx;
// 528A38: using guessed type int l4holdy;
BOOL IsDURWall(char d) BOOL IsDURWall(char d)
{ {
@ -492,7 +488,6 @@ void L4FixRim()
dung[0][j] = 0; dung[0][j] = 0;
} }
} }
// 52A4DC: using guessed type int dword_52A4DC;
void DRLG_L4GeneralFix() void DRLG_L4GeneralFix()
{ {
@ -526,10 +521,6 @@ void CreateL4Dungeon(unsigned int rseed, int entry)
DRLG_FreeL4SP(); DRLG_FreeL4SP();
DRLG_SetPC(); DRLG_SetPC();
} }
// 5CF328: using guessed type int dmaxx;
// 5CF32C: using guessed type int dmaxy;
// 5D2458: using guessed type int dminx;
// 5D245C: using guessed type int dminy;
void DRLG_L4(int entry) void DRLG_L4(int entry)
{ {
@ -683,10 +674,6 @@ void DRLG_L4(int entry)
DRLG_LoadDiabQuads(FALSE); DRLG_LoadDiabQuads(FALSE);
} }
} }
// 528A40: using guessed type int SP4x2;
// 528A48: using guessed type int SP4y2;
// 5B50D8: using guessed type int setloadflag_2;
// 679660: using guessed type char gbMaxPlayers;
void DRLG_L4Shadows() void DRLG_L4Shadows()
{ {
@ -1399,7 +1386,7 @@ void L4tileFix()
void DRLG_L4Subs() void DRLG_L4Subs()
{ {
int x, y, i, rv; int x, y, i, rv;
unsigned char c; BYTE c;
for(y = 0; y < 40; y++) { for(y = 0; y < 40; y++) {
for(x = 0; x < 40; x++) { for(x = 0; x < 40; x++) {
@ -1636,11 +1623,6 @@ void L4firstRoom()
L4drawRoom(x, y, w, h); L4drawRoom(x, y, w, h);
L4roomGen(x, y, w, h, random(0, 2)); L4roomGen(x, y, w, h, random(0, 2));
} }
// 528A34: using guessed type int l4holdx;
// 528A38: using guessed type int l4holdy;
// 528A40: using guessed type int SP4x2;
// 528A48: using guessed type int SP4y2;
// 679660: using guessed type char gbMaxPlayers;
void L4drawRoom(int x, int y, int width, int height) void L4drawRoom(int x, int y, int width, int height)
{ {
@ -1818,10 +1800,6 @@ BOOL DRLG_L4PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int c
return TRUE; return TRUE;
} }
// 528A40: using guessed type int SP4x2;
// 528A48: using guessed type int SP4y2;
// 5CF320: using guessed type int LvlViewY;
// 5CF324: using guessed type int LvlViewX;
void DRLG_L4FloodTVal() void DRLG_L4FloodTVal()
{ {
@ -1840,7 +1818,6 @@ void DRLG_L4FloodTVal()
yy += 2; yy += 2;
} }
} }
// 5A5590: using guessed type char TransVal;
void DRLG_L4FTVR(int i, int j, int x, int y, int d) void DRLG_L4FTVR(int i, int j, int x, int y, int d)
{ {
@ -1888,7 +1865,6 @@ void DRLG_L4FTVR(int i, int j, int x, int y, int d)
DRLG_L4FTVR(i + 1, j + 1, x + 2, y + 2, 8); DRLG_L4FTVR(i + 1, j + 1, x + 2, y + 2, 8);
} }
} }
// 5A5590: using guessed type char TransVal;
void DRLG_L4TransFix() void DRLG_L4TransFix()
{ {
@ -1998,7 +1974,7 @@ void DRLG_L4Pass3()
for (j = 0; j < DMAXY; j++) { for (j = 0; j < DMAXY; j++) {
xx = 16; xx = 16;
for (i = 0; i < DMAXX; i++) { for (i = 0; i < DMAXX; i++) {
lv = (unsigned char)dungeon[i][j] - 1; lv = dungeon[i][j] - 1;
#ifdef USE_ASM #ifdef USE_ASM
if (lv >= 0) { if (lv >= 0) {
__asm { __asm {

6
Source/gendung.cpp

@ -5,7 +5,7 @@ int themeCount;
char nTransTable[2049]; char nTransTable[2049];
//int dword_52D204; //int dword_52D204;
int dMonster[MAXDUNX][MAXDUNY]; int dMonster[MAXDUNX][MAXDUNY];
unsigned char dungeon[40][40]; BYTE dungeon[40][40];
char dObject[MAXDUNX][MAXDUNY]; char dObject[MAXDUNX][MAXDUNY];
BYTE *pSpeedCels; BYTE *pSpeedCels;
int nlevel_frames; // weak int nlevel_frames; // weak
@ -709,7 +709,7 @@ BOOL DRLG_WillThemeRoomFit(int floor, int x, int y, int minSize, int maxSize, in
for (ii = 0; ii < maxSize; ii++) { for (ii = 0; ii < maxSize; ii++) {
if (xFlag) { if (xFlag) {
for (xx = x; xx < x + maxSize; xx++) { for (xx = x; xx < x + maxSize; xx++) {
if ((unsigned char)dungeon[xx][y + ii] != floor) { if (dungeon[xx][y + ii] != floor) {
if (xx >= minSize) { if (xx >= minSize) {
break; break;
} }
@ -725,7 +725,7 @@ BOOL DRLG_WillThemeRoomFit(int floor, int x, int y, int minSize, int maxSize, in
} }
if (yFlag) { if (yFlag) {
for (yy = y; yy < y + maxSize; yy++) { for (yy = y; yy < y + maxSize; yy++) {
if ((unsigned char)dungeon[x + ii][yy] != floor) { if (dungeon[x + ii][yy] != floor) {
if (yy >= minSize) { if (yy >= minSize) {
break; break;
} }

2
Source/gendung.h

@ -7,7 +7,7 @@ extern int themeCount;
extern char nTransTable[2049]; extern char nTransTable[2049];
//int dword_52D204; //int dword_52D204;
extern int dMonster[MAXDUNX][MAXDUNY]; extern int dMonster[MAXDUNX][MAXDUNY];
extern unsigned char dungeon[40][40]; extern BYTE dungeon[40][40];
extern char dObject[MAXDUNX][MAXDUNY]; extern char dObject[MAXDUNX][MAXDUNY];
extern BYTE *pSpeedCels; extern BYTE *pSpeedCels;
extern int nlevel_frames; // weak extern int nlevel_frames; // weak

Loading…
Cancel
Save