diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 0fe03706a..4ed52f880 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -1560,7 +1560,7 @@ void __fastcall DRLG_L5GChamber(int sx, int sy, BOOLEAN topflag, BOOLEAN bottomf dungeon[4][v8] = 8; dungeon[7][v8] = 5; dungeon[8][v8] = 12; - v9 = &dungeon[9][v8]; + v9 = (char *)&dungeon[9][v8]; if (*v9 != 4) *v9 = 21; sy = v7 - 11; @@ -1582,7 +1582,7 @@ void __fastcall DRLG_L5GChamber(int sx, int sy, BOOLEAN topflag, BOOLEAN bottomf dungeon[0][v12 + 4] = 9; dungeon[0][v12 + 7] = 5; dungeon[0][v12 + 8] = 11; - v13 = &dungeon[0][v12 + 9]; + v13 = (char *)&dungeon[0][v12 + 9]; if (*v13 != 4) *v13 = 21; sx = v11 - 11; diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index db9aa5ae3..8dbe47572 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -292,7 +292,7 @@ void __cdecl L2LockoutFix() do { v5 = v4; if (dflags[v4][v3] >= 0) { - v6 = &dungeon[v5][v3]; + v6 = (char *)&dungeon[v5][v3]; if ((*v6 == 2 || *v6 == 5) && *(v6 - 1) == 3 && dungeon[v5][v3 + 1] == 3) { v7 = 0; while (1) { @@ -328,7 +328,7 @@ void __cdecl L2LockoutFix() v13 = dungeon[v9][v10]; if (v13 != 1 && v13 != 4) break; - v14 = &dungeon[v9 + 1][v10]; + v14 = (char *)&dungeon[v9 + 1][v10]; if (*(v14 - 80) != 3 || *v14 != 3) break; if (v13 == 4) @@ -353,7 +353,7 @@ void __cdecl L2DoorFix() v0 = 1; do { - v1 = &dungeon[1][v0]; + v1 = (char *)&dungeon[1][v0]; v2 = 39; do { if (*v1 == 4 && *(v1 - 1) == 3) @@ -989,7 +989,7 @@ BOOLEAN __fastcall DRLG_L2PlaceMiniSet(unsigned char *miniset, int tmin, int tma for (miniset = (unsigned char *)(v34 * v35 + 2); v24 < v35; ++v24) { v25 = v34; if (v34 > 0) { - v26 = &dungeon[v13][v24 + v14]; + v26 = (char *)&dungeon[v13][v24 + v14]; do { v27 = v29[(_DWORD)miniset]; if (v27) @@ -1187,7 +1187,7 @@ void __cdecl DRLG_L2Subs() v7 = 3; do { v10 = 0; - v8 = &dungeon[0][v9 + 2]; + v8 = (char *)&dungeon[0][v9 + 2]; do { if ((v10 < nSx1 || v10 > nSx2) && (v0 - 3 < nSy1 || v0 - 3 > nSy2) && !random(0, 4)) { v1 = BTYPESL2[(unsigned char)*v8]; @@ -1244,7 +1244,7 @@ void __cdecl DRLG_L2Shadows() v10 = 1; do { v9 = 39; - v0 = &dungeon[0][v10 + 39]; + v0 = (char *)&dungeon[0][v10 + 39]; do { v1 = &SPATSL2[0].s1; v2 = BSTYPESL2[(unsigned char)v0[1]]; diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 7c7517859..a6c98eccd 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -70,9 +70,6 @@ const unsigned char L3ANVIL[244] = { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -const unsigned char L3SpawnTbl1[15] = { 0u, 10u, 67u, 5u, 44u, 6u, 9u, 0u, 0u, 28u, 131u, 6u, 9u, 10u, 5u }; /* local spawntable? */ -const unsigned char L3SpawnTbl2[15] = { 0u, 10u, 3u, 5u, 12u, 6u, 9u, 0u, 0u, 12u, 3u, 6u, 9u, 10u, 5u }; /* local spawntable? */ -const unsigned char L3PoolSub[15] = { 0u, 35u, 26u, 36u, 25u, 29u, 34u, 7u, 33u, 28u, 27u, 37u, 32u, 31u, 30u }; /* local poolsub? */ void __cdecl AddFenceDoors() { @@ -85,7 +82,7 @@ void __cdecl AddFenceDoors() v0 = 0; do { - v1 = &dungeon[-1][v0 + 39]; + v1 = (char *)&dungeon[-1][v0 + 39]; v2 = 40; do { if (v1[1] == 7) { @@ -125,7 +122,7 @@ void __cdecl FenceDoorFix() v0 = 0; do { - v1 = &dungeon[-1][v0 + 39]; + v1 = (char *)&dungeon[-1][v0 + 39]; v2 = 40; do { v3 = v1[1]; @@ -272,7 +269,7 @@ void __cdecl FixL3Warp() v0 = 0; while (2) { v1 = 0; - v2 = &dungeon[1][v0 + 1]; + v2 = (char *)&dungeon[1][v0 + 1]; do { v3 = *(v2 - 41); if (v3 == 125 && *(v2 - 1) == 125 && *(v2 - 40) == 125 && *v2 == 125) { @@ -637,7 +634,7 @@ int __fastcall DRLG_L3FillRoom(int x1, int y1, int x2, int y2) if (v5 <= y2) { do { if (v4 <= v6) { - v9 = &dungeon[v4][v8]; + v9 = (char *)&dungeon[v4][v8]; v10 = v6 - v4 + 1; do { v7 += (unsigned char)*v9; @@ -659,7 +656,7 @@ LABEL_12: v8 = v4 + 1; do { if (v8 < v6) { - v12 = &dungeon[v8][v11]; + v12 = (char *)&dungeon[v8][v11]; v13 = v6 - v8; do { *v12 = 1; @@ -679,7 +676,7 @@ LABEL_12: } if (v4 <= v6) { v16 = y2; - v17 = &dungeon[v4][y2]; + v17 = (char *)&dungeon[v4][y2]; v18 = v6 - v4 + 1; y2a = v21 - y2; do { @@ -797,7 +794,7 @@ void __fastcall DRLG_L3FloorArea(int x1, int y1, int x2, int y2) for (i = y1; i <= y2; ++i) { if (x1 <= x2) { - v5 = &dungeon[x1][i]; + v5 = (char *)&dungeon[x1][i]; v6 = x2 - x1 + 1; do { *v5 = 1; @@ -818,7 +815,7 @@ void __cdecl DRLG_L3FillDiags() v0 = 0; do { - v1 = &dungeon[1][v0 + 1]; + v1 = (char *)&dungeon[1][v0 + 1]; v2 = 39; do { v3 = (unsigned char)*v1; @@ -853,7 +850,7 @@ void __cdecl DRLG_L3FillSingles() v0 = 1; do { - v1 = &dungeon[0][v0 + 39]; + v1 = (char *)&dungeon[0][v0 + 39]; v2 = 38; do { if (!v1[1] @@ -909,10 +906,10 @@ void __cdecl DRLG_L3FillStraights() v1 = (char *)v27; v2 = 0; v29 = 0; - v3 = &dungeon[0][v27 + 1]; + v3 = (char *)&dungeon[0][v27 + 1]; v4 = 40 * v0; v25 = 0; - v22 = &dungeon[0][v27 + 1]; + v22 = (char *)&dungeon[0][v27 + 1]; do { if (*(v3 - 1) || *v3 != 1) { if (v2 > 3) { @@ -951,17 +948,17 @@ void __cdecl DRLG_L3FillStraights() v7 = (char *)v28; v8 = 0; v30 = 0; - v9 = &dungeon[0][v28 + 1]; + v9 = (char *)&dungeon[0][v28 + 1]; v26 = 0; v10 = 40 * v0; - v23 = &dungeon[0][v28 + 1]; + v23 = (char *)&dungeon[0][v28 + 1]; do { if (*(v9 - 1) != 1 || *v9) { if (v8 > 3) { if (random(0, 2)) { if (v0 < v30) { v11 = v30 - v0; - v24 = &dungeon[0][v10 + 1 + v28]; + v24 = (char *)&dungeon[0][v10 + 1 + v28]; do { v12 = random(0, 2); v7 = v24; @@ -1041,7 +1038,7 @@ void __cdecl DRLG_L3Edges() char *v0; // eax memset(dungeon[39], 0, sizeof(char[40])); - v0 = &dungeon[0][39]; + v0 = (char *)&dungeon[0][39]; do { *v0 = 0; v0 += 40; @@ -1075,7 +1072,7 @@ void __cdecl DRLG_L3MakeMegas() v0 = 0; do { - v1 = &dungeon[0][v0 + 1]; + v1 = (char *)&dungeon[0][v0 + 1]; v2 = 39; do { v3 = (unsigned char)v1[40]; @@ -1097,7 +1094,7 @@ void __cdecl DRLG_L3MakeMegas() } while (v2); dungeon[39][v0++] = 8; } while (v0 < 39); - v5 = &dungeon[0][39]; + v5 = (char *)&dungeon[0][39]; do { *v5 = 8; v5 += 40; @@ -1356,7 +1353,7 @@ void __cdecl DRLG_L3River() v13 = v40; goto LABEL_94; } - v11 = &dungeon[v1][v2]; + v11 = (char *)&dungeon[v1][v2]; if (*(v11 - 1) == 10 && *(v11 - 2) == 8) { v12 = v5; river[1][v12] = v2 - 1; @@ -1494,180 +1491,159 @@ void __cdecl DRLG_L3River() void __cdecl DRLG_L3Pool() { - int v0; // ebx - _BYTE *v1; // ecx - int v2; // esi - int v3; // ecx - signed int v4; // eax - signed int v5; // eax - signed int v6; // eax - int v7; // eax - int v8; // edi - int v9; // ecx - int v10; // eax - int v11; // esi - char *v12; // edx - unsigned char v13; // al - unsigned char v14; // al - signed int v15; // [esp+Ch] [ebp-18h] - char *v16; // [esp+10h] [ebp-14h] - signed int v17; // [esp+14h] [ebp-10h] - int v18; // [esp+18h] [ebp-Ch] - int totarea; // [esp+1Ch] [ebp-8h] - int x; // [esp+20h] [ebp-4h] - - v0 = 0; - v18 = 0; - do { - x = 0; - v1 = (unsigned char *)dungeon + v0; - v16 = (char *)dungeon + v0; - do { - if (*v1 == 8) { - *v1 = -120; - v2 = x - 1; - totarea = 1; - v3 = x - 1 + 2; - v4 = v3 >= 40 ? 1 : DRLG_L3SpawnEdge(v3, v0, &totarea); - v5 = v2 <= 0 || v4 ? 1 : DRLG_L3SpawnEdge(v2, v0, &totarea); - v6 = v0 + 1 >= 40 || v5 ? 1 : DRLG_L3SpawnEdge(x, v0 + 1, &totarea); - v17 = v0 - 1 <= 0 || v6 ? 1 : DRLG_L3SpawnEdge(x, v0 - 1, &totarea); - v7 = random(0, 100); - v8 = totarea; - v15 = v7; - v9 = v0 - totarea; - if (v0 - totarea < totarea + v0) { - totarea = x - totarea; - v10 = v8 + x; - do { - v11 = totarea; - if (totarea < v10) { - v12 = &dungeon[totarea][v9]; - do { - if (*v12 < 0 && v9 >= 0 && v9 < 40 && v11 >= 0 && v11 < 40) { - v13 = *v12 & 0x7F; - *v12 = v13; - if (v8 > 4) { - if (v15 < 25 && !v17) { - v14 = L3PoolSub[v13]; - if (v14) { - if (v14 <= 0x25u) - *v12 = v14; - } - lavapool = 1; - } - v0 = v18; - } - } - ++v11; - v10 = v8 + x; - v12 += 40; - } while (v11 < v8 + x); - } - ++v9; - } while (v9 < v8 + v0); - } + int i, j, dunx, duny, totarea, poolchance; + BOOL found; + unsigned char k; + static unsigned char poolsub[15] = { 0, 35, 26, 36, 25, 29, 34, 7, 33, 28, 27, 37, 32, 31, 30 }; + + for(duny = 0; duny < 40; duny++) { + for(dunx = 0; dunx < 40; dunx++) { + if(dungeon[dunx][duny] != 8) { + continue; } - ++x; - v1 = (unsigned char *)v16 + 40; - v16 += 40; - } while (x < 40); - v18 = ++v0; - } while (v0 < 40); -} -// 528378: using guessed type char lavapool; - -int __fastcall DRLG_L3SpawnEdge(int x, int y, int *totarea) -{ - int *v3; // ebp - int v4; // edi - int v5; // esi - char *v6; // ecx - int *v7; // eax - int v8; // eax - int *totareaa; // [esp+14h] [ebp+4h] - - v3 = totarea; - v4 = y; - v5 = x; - if (*totarea <= 40 && x >= 0 && y >= 0 && x < 40 && y < 40) { - v6 = &dungeon[x][y]; - _LOBYTE(v7) = *v6; - if (*v6 < 0) - return 0; - if ((unsigned char)v7 <= 0xFu) { - *v6 = (unsigned char)v7 | 0x80; - ++*totarea; - if ((_BYTE)v7 == 8) { - if (DRLG_L3SpawnEdge(v5 + 1, y, totarea) == 1 - || DRLG_L3SpawnEdge(v5 - 1, v4, totarea) == 1 - || DRLG_L3SpawnEdge(v5, v4 + 1, totarea) == 1) { - return 1; - } - v8 = DRLG_L3SpawnEdge(v5, v4 - 1, totarea); - LABEL_24: - if (v8 == 1) - return 1; - return 0; + dungeon[dunx][duny] |= 0x80; + totarea = 1; + if(dunx + 1 < 40) { + found = DRLG_L3SpawnEdge(dunx + 1, duny, &totarea); + } else { + found = TRUE; } - v7 = (int *)(unsigned char)v7; - totareaa = v7; - if (L3SpawnTbl2[(unsigned char)v7] & 8) { - if (DRLG_L3Spawn(v5, y - 1, v3) == 1) - return 1; - v7 = totareaa; + if(dunx - 1 > 0 && !found) { + found = DRLG_L3SpawnEdge(dunx - 1, duny, &totarea); + } else { + found = TRUE; } - if (L3SpawnTbl2[(_DWORD)v7] & 4) { - if (DRLG_L3Spawn(v5, v4 + 1, v3) == 1) - return 1; - v7 = totareaa; + if(duny + 1 < 40 && !found) { + found = DRLG_L3SpawnEdge(dunx, duny + 1, &totarea); + } else { + found = TRUE; } - if (!(L3SpawnTbl2[(_DWORD)v7] & 2)) - goto LABEL_18; - if (DRLG_L3Spawn(v5 + 1, v4, v3) != 1) { - v7 = totareaa; - LABEL_18: - if (L3SpawnTbl2[(_DWORD)v7] & 1) { - v8 = DRLG_L3Spawn(v5 - 1, v4, v3); - goto LABEL_24; + if(duny - 1 > 0 && !found) { + found = DRLG_L3SpawnEdge(dunx, duny - 1, &totarea); + } else { + found = TRUE; + } + poolchance = random(0, 100); + for(j = duny - totarea; j < duny + totarea; j++) { + for(i = dunx - totarea; i < dunx + totarea; i++) { + if(dungeon[i][j] & 0x80 && j >= 0 && j < 40 && i >= 0 && i < 40) { + dungeon[i][j] &= ~0x80; + if(totarea > 4 && poolchance < 25 && !found) { + k = poolsub[dungeon[i][j]]; + if(k != 0 && k <= 37) { + dungeon[i][j] = k; + } + lavapool = 1; + } + } } - return 0; } - return 1; } } - return 1; } +// 528378: using guessed type char lavapool; -int __fastcall DRLG_L3Spawn(int x, int y, int *totarea) +BOOL __fastcall DRLG_L3SpawnEdge(int x, int y, int *totarea) { - int v3; // edi - int v4; // esi - char *v5; // eax - unsigned char v6; // cl - int v7; // ebx - int result; // eax + unsigned char i; + static unsigned char spawntable[15] = { 0, 10, 3, 5, 12, 6, 9, 0, 0, 12, 3, 6, 9, 10, 5 }; - v3 = y; - v4 = x; - result = 1; - if (*totarea <= 40 && x >= 0 && y >= 0 && x < 40 && y < 40) { - v5 = &dungeon[x][y]; - v6 = *v5; - if (*v5 < 0 - || v6 <= 0xFu - && ((v7 = v6, *v5 = v6 | 0x80, ++*totarea, !(L3SpawnTbl1[v6] & 8)) || DRLG_L3Spawn(v4, y - 1, totarea) != 1) - && (!(L3SpawnTbl1[v7] & 4) || DRLG_L3Spawn(v4, v3 + 1, totarea) != 1) - && (!(L3SpawnTbl1[v7] & 2) || DRLG_L3Spawn(v4 + 1, v3, totarea) != 1) - && (!(L3SpawnTbl1[v7] & 1) || DRLG_L3Spawn(v4 - 1, v3, totarea) != 1) - && ((L3SpawnTbl1[v7] & 0x80u) == 0 || DRLG_L3SpawnEdge(v4, v3 - 1, totarea) != 1) - && (!(L3SpawnTbl1[v7] & 0x40) || DRLG_L3SpawnEdge(v4, v3 + 1, totarea) != 1) - && (!(L3SpawnTbl1[v7] & 0x20) || DRLG_L3SpawnEdge(v4 + 1, v3, totarea) != 1) - && (!(L3SpawnTbl1[v7] & 0x10) || DRLG_L3SpawnEdge(v4 - 1, v3, totarea) != 1)) { - result = 0; + if(*totarea > 40) { + return TRUE; + } + if(x < 0 || y < 0 || x >= 40 || y >= 40) { + return TRUE; + } + if(dungeon[x][y] & 0x80) { + return FALSE; + } + if(dungeon[x][y] > 15) { + return TRUE; + } + + i = dungeon[x][y]; + dungeon[x][y] |= 0x80; + *totarea += 1; + + if(i != 8) { + if(spawntable[i] & 8 && DRLG_L3Spawn(x, y - 1, totarea) == TRUE) { + return TRUE; + } + if(spawntable[i] & 4 && DRLG_L3Spawn(x, y + 1, totarea) == TRUE) { + return TRUE; + } + if(spawntable[i] & 2 && DRLG_L3Spawn(x + 1, y, totarea) == TRUE) { + return TRUE; + } + if(spawntable[i] & 1 && DRLG_L3Spawn(x - 1, y, totarea) == TRUE) { + return TRUE; + } + } else { + if(DRLG_L3SpawnEdge(x + 1, y, totarea) == TRUE) { + return TRUE; + } + if(DRLG_L3SpawnEdge(x - 1, y, totarea) == TRUE) { + return TRUE; + } + if(DRLG_L3SpawnEdge(x, y + 1, totarea) == TRUE) { + return TRUE; + } + if(DRLG_L3SpawnEdge(x, y - 1, totarea) == TRUE) { + return TRUE; } } - return result; + + return FALSE; +} + +BOOL __fastcall DRLG_L3Spawn(int x, int y, int *totarea) +{ + unsigned char i; + static unsigned char spawntable[15] = { 0, 10, 67, 5, 44, 6, 9, 0, 0, 28, 131, 6, 9, 10, 5 }; + + if(*totarea > 40) { + return TRUE; + } + if(x < 0 || y < 0 || x >= 40 || y >= 40) { + return TRUE; + } + if(dungeon[x][y] & 0x80) { + return FALSE; + } + if(dungeon[x][y] > 15) { + return TRUE; + } + + i = dungeon[x][y]; + dungeon[x][y] |= 0x80; + *totarea += 1; + + if(spawntable[i] & 8 && DRLG_L3Spawn(x, y - 1, totarea) == TRUE) { + return TRUE; + } + if(spawntable[i] & 4 && DRLG_L3Spawn(x, y + 1, totarea) == TRUE) { + return TRUE; + } + if(spawntable[i] & 2 && DRLG_L3Spawn(x + 1, y, totarea) == TRUE) { + return TRUE; + } + if(spawntable[i] & 1 && DRLG_L3Spawn(x - 1, y, totarea) == TRUE) { + return TRUE; + } + if(spawntable[i] & 0x80 && DRLG_L3SpawnEdge(x, y - 1, totarea) == TRUE) { + return TRUE; + } + if(spawntable[i] & 0x40 && DRLG_L3SpawnEdge(x, y + 1, totarea) == TRUE) { + return TRUE; + } + if(spawntable[i] & 0x20 && DRLG_L3SpawnEdge(x + 1, y, totarea) == TRUE) { + return TRUE; + } + if(spawntable[i] & 0x10 && DRLG_L3SpawnEdge(x - 1, y, totarea) == TRUE) { + return TRUE; + } + + return FALSE; } void __cdecl DRLG_L3PoolFix() @@ -1687,7 +1663,7 @@ void __cdecl DRLG_L3PoolFix() v0 = 0; do { - v1 = &dungeon[-1][v0]; + v1 = (char *)&dungeon[-1][v0]; v11 = 40; do { v2 = v1 + 40; @@ -1821,7 +1797,7 @@ int __fastcall DRLG_L3PlaceMiniSet(const unsigned char *miniset, int tmin, int t do { v19 = v28; if (v28 > 0) { - v20 = &dungeon[v11][v17 + tmax]; + v20 = (char *)&dungeon[v11][v17 + tmax]; do { v21 = v23[v18]; if (v21) @@ -1891,7 +1867,7 @@ void __fastcall DRLG_L3PlaceRndSet(const unsigned char *miniset, int rndper) v24 = 0; if (40 - v3 > 0) { v22 = 40 - *v2; - v21 = dungeon[-1]; + v21 = (char *)dungeon[-1]; while (v22 <= 0) { LABEL_44: v4 = v24++ + 1; @@ -2158,7 +2134,7 @@ void __cdecl DRLG_L3Wood() goto LABEL_112; do { if (v26 != v40) { - v27 = &dungeon[v45][v26]; + v27 = (char *)&dungeon[v45][v26]; if (*v27 == 7) *v27 = random(0, 2) != 0 ? -121 : -119; if (*v27 == 10) @@ -2188,7 +2164,7 @@ void __cdecl DRLG_L3Wood() while (WoodHorizR(v30, ya)) v30 = ++v32; v33 = v32 - 1; - v34 = &dungeon[v31][ya]; + v34 = (char *)&dungeon[v31][ya]; v35 = 1; if (*v34 == 7) v35 = 0; @@ -2249,7 +2225,7 @@ BOOLEAN __fastcall WoodVertU(int i, int y) v3 = dungeon[i + 1][y]; result = 0; if ((unsigned char)v3 > 0x98u || (unsigned char)v3 < 0x82u) { - v4 = &dungeon[v2][y]; + v4 = (char *)&dungeon[v2][y]; v5 = *(v4 - 40); if (v5 > 0x98u || v5 < 0x82u) { v6 = *v4; @@ -2273,7 +2249,7 @@ BOOLEAN __fastcall WoodVertD(int i, int y) v3 = dungeon[i + 1][y]; result = 0; if ((unsigned char)v3 > 0x98u || (unsigned char)v3 < 0x82u) { - v4 = &dungeon[v2][y]; + v4 = (char *)&dungeon[v2][y]; v5 = *(v4 - 40); if (v5 > 0x98u || v5 < 0x82u) { v6 = *v4; @@ -2297,7 +2273,7 @@ BOOLEAN __fastcall WoodHorizL(int x, int j) v3 = dungeon[x][j + 1]; result = 0; if ((unsigned char)v3 > 0x98u || (unsigned char)v3 < 0x82u) { - v4 = &dungeon[v2][j]; + v4 = (char *)&dungeon[v2][j]; v5 = *(v4 - 1); if (v5 > 0x98u || v5 < 0x82u) { v6 = *v4; @@ -2321,7 +2297,7 @@ BOOLEAN __fastcall WoodHorizR(int x, int j) v3 = dungeon[x][j + 1]; result = 0; if ((unsigned char)v3 > 0x98u || (unsigned char)v3 < 0x82u) { - v4 = &dungeon[v2][j]; + v4 = (char *)&dungeon[v2][j]; v5 = *(v4 - 1); if (v5 > 0x98u || v5 < 0x82u) { v6 = *v4; diff --git a/Source/drlg_l3.h b/Source/drlg_l3.h index 729b01577..75209cffd 100644 --- a/Source/drlg_l3.h +++ b/Source/drlg_l3.h @@ -28,8 +28,8 @@ int __cdecl DRLG_L3GetFloorArea(); void __cdecl DRLG_L3MakeMegas(); void __cdecl DRLG_L3River(); void __cdecl DRLG_L3Pool(); -int __fastcall DRLG_L3SpawnEdge(int x, int y, int *totarea); -int __fastcall DRLG_L3Spawn(int x, int y, int *totarea); +BOOL __fastcall DRLG_L3SpawnEdge(int x, int y, int *totarea); +BOOL __fastcall DRLG_L3Spawn(int x, int y, int *totarea); void __cdecl DRLG_L3PoolFix(); int __fastcall DRLG_L3PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOLEAN setview, int ldir); void __fastcall DRLG_L3PlaceRndSet(const unsigned char *miniset, int rndper); @@ -80,8 +80,5 @@ extern const unsigned char L3XTRA3[4]; extern const unsigned char L3XTRA4[4]; extern const unsigned char L3XTRA5[4]; extern const unsigned char L3ANVIL[244]; -extern const unsigned char L3SpawnTbl1[15]; /* local spawntable? */ -extern const unsigned char L3SpawnTbl2[15]; /* local spawntable? */ -extern const unsigned char L3PoolSub[15]; /* local poolsub? */ #endif /* __DRLG_L3_H__ */ diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index c098944c1..23d285439 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -731,7 +731,7 @@ void __fastcall DRLG_L4(int entry) v16 = -1; do { v17 = -1; - v18 = &dungeon[0][v16 + 1]; + v18 = (char *)&dungeon[0][v16 + 1]; do { if (*v18 == 98) Make_SetPC(v17, v16, 5, 5); @@ -773,7 +773,7 @@ void __cdecl DRLG_L4Shadows() v0 = 1; do { - v1 = &dungeon[1][v0]; + v1 = (char *)&dungeon[1][v0]; v2 = 39; do { v3 = *v1; @@ -832,7 +832,7 @@ void __cdecl L4makeDmt() int v6; // ebx v0 = 1; - v1 = dungeon; + v1 = (char (*)[40])dungeon; do { v2 = v1; v3 = &L4dungeon[1][v0 + 1]; @@ -975,7 +975,7 @@ int __fastcall L4HWallOk(int i, int j) v8 = 1; if (dungeon[0][v2 + j] == 6) { v3 = 8 * (5 * i + 5); - v4 = &dungeon[i + 1][j]; + v4 = (char *)&dungeon[i + 1][j]; do { if (dflags[0][v3 + j]) break; @@ -1027,7 +1027,7 @@ int __fastcall L4VWallOk(int i, int j) do { if (dflags[v2][j + result]) break; - v4 = &dungeon[v2][j]; + v4 = (char *)&dungeon[v2][j]; if (v4[result - 40] != 6) break; if (dungeon[v2 + 1][result + j] != 6) @@ -1084,7 +1084,7 @@ void __fastcall L4HorizWall(int i, int j, int dx) dungeon[0][v5] = 14; v6 = dx; if (dx > 1) { - v7 = &dungeon[1][v5]; + v7 = (char *)&dungeon[1][v5]; v8 = dx - 1; do { *v7 = 2; @@ -1092,7 +1092,7 @@ void __fastcall L4HorizWall(int i, int j, int dx) --v8; } while (v8); } - v9 = &dungeon[v3 + dx][v4]; + v9 = (char *)&dungeon[v3 + dx][v4]; if (*v9 == 15) *v9 = 14; if (*v9 == 10) @@ -1108,7 +1108,7 @@ void __fastcall L4HorizWall(int i, int j, int dx) dungeon[0][v10] = 57; if (v11) dungeon[0][v10 - 1] = 58; - v12 = &dungeon[0][v10 + 39]; + v12 = (char *)&dungeon[0][v10 + 39]; if (*v12 == 6) *v12 = 59; } @@ -2329,7 +2329,7 @@ void __cdecl DRLG_L4Corners() v0 = 1; do { - v1 = &dungeon[1][v0]; + v1 = (char *)&dungeon[1][v0]; v2 = 38; do { v3 = *v1; diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 07e75abfa..bced1b1b5 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -7,7 +7,7 @@ int themeCount; char nTransTable[2049]; //int dword_52D204; int dMonster[MAXDUNX][MAXDUNY]; -char dungeon[40][40]; +unsigned char dungeon[40][40]; char dObject[MAXDUNX][MAXDUNY]; BYTE *pSpeedCels; int nlevel_frames; // weak @@ -845,7 +845,7 @@ void __fastcall DRLG_CreateThemeRoom(int themeIndex) if (v4 >= v3 + v2) goto LABEL_53; } - v21 = &dungeon[v6][v4]; + v21 = (char *)&dungeon[v6][v4]; while (1) { if (leveltype != DTYPE_CATACOMBS) goto LABEL_21; diff --git a/Source/gendung.h b/Source/gendung.h index b7f4f53b7..f5bec755b 100644 --- a/Source/gendung.h +++ b/Source/gendung.h @@ -7,7 +7,7 @@ extern int themeCount; extern char nTransTable[2049]; //int dword_52D204; extern int dMonster[MAXDUNX][MAXDUNY]; -extern char dungeon[40][40]; +extern unsigned char dungeon[40][40]; extern char dObject[MAXDUNX][MAXDUNY]; extern BYTE *pSpeedCels; extern int nlevel_frames; // weak diff --git a/Source/quests.cpp b/Source/quests.cpp index 9d848c144..2aaaeed84 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -451,7 +451,7 @@ void __fastcall DrawWarLord(int x, int y) do { if (v3 < v13) { v9 = v13 - v3; - v10 = &dungeon[v3][v14]; + v10 = (char *)&dungeon[v3][v14]; do { v11 = *v8; if (!*v8) @@ -505,7 +505,7 @@ void __fastcall DrawSChamber(int q, int x, int y) do { if (v3 < v16) { v9 = v16 - v3; - v10 = &dungeon[v3][v6]; + v10 = (char *)&dungeon[v3][v6]; do { v11 = *v8; if (!*v8) @@ -668,7 +668,7 @@ void __fastcall DrawBlood(int x, int y) do { if (v6 > 0) { v13 = v6; - v10 = &dungeon[v3][v14 + v12]; + v10 = (char *)&dungeon[v3][v14 + v12]; do { if (*v9) *v10 = *v9;