24 { 7, 13, 0, 13, 144, 0, 142 },
25 { 16, 13, 0, 13, 144, 0, 142 },
26 { 15, 13, 0, 13, 145, 0, 142 },
27 { 5, 13, 13, 13, 152, 140, 139 },
28 { 5, 13, 1, 13, 143, 146, 139 },
29 { 5, 13, 13, 2, 143, 140, 148 },
30 { 5, 0, 1, 2, 0, 146, 148 },
31 { 5, 13, 11, 13, 143, 147, 139 },
32 { 5, 13, 13, 12, 143, 140, 149 },
33 { 5, 13, 11, 12, 150, 147, 149 },
34 { 5, 13, 1, 12, 143, 146, 149 },
35 { 5, 13, 11, 2, 143, 147, 148 },
36 { 9, 13, 13, 13, 144, 140, 142 },
37 { 9, 13, 1, 13, 144, 146, 142 },
38 { 9, 13, 11, 13, 151, 147, 142 },
39 { 8, 13, 0, 13, 144, 0, 139 },
40 { 8, 13, 0, 12, 143, 0, 149 },
41 { 8, 0, 0, 2, 0, 0, 148 },
42 { 11, 0, 0, 13, 0, 0, 139 },
43 { 11, 13, 0, 13, 139, 0, 139 },
44 { 11, 2, 0, 13, 148, 0, 139 },
45 { 11, 12, 0, 13, 149, 0, 139 },
46 { 11, 13, 11, 12, 139, 0, 149 },
47 { 14, 0, 0, 13, 0, 0, 139 },
48 { 14, 13, 0, 13, 139, 0, 139 },
49 { 14, 2, 0, 13, 148, 0, 139 },
50 { 14, 12, 0, 13, 149, 0, 139 },
51 { 14, 13, 11, 12, 139, 0, 149 },
52 { 10, 0, 13, 0, 0, 140, 0 },
53 { 10, 13, 13, 0, 140, 140, 0 },
54 { 10, 0, 1, 0, 0, 146, 0 },
55 { 10, 13, 11, 0, 140, 147, 0 },
56 { 12, 0, 13, 0, 0, 140, 0 },
57 { 12, 13, 13, 0, 140, 140, 0 },
58 { 12, 0, 1, 0, 0, 146, 0 },
59 { 12, 13, 11, 0, 140, 147, 0 },
60 { 3, 13, 11, 12, 150, 0, 0 }
66 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
67 10, 11, 12, 13, 14, 15, 16, 17, 0, 0,
68 0, 0, 0, 0, 0, 1, 2, 10, 4, 5,
69 6, 7, 8, 9, 10, 11, 12, 14, 5, 14,
70 10, 4, 14, 4, 5, 0, 0, 0, 0, 0,
71 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
72 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
73 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
74 2, 3, 4, 1, 6, 7, 16, 17, 2, 1,
75 1, 2, 2, 1, 1, 2, 2, 2, 2, 2,
76 1, 1, 11, 1, 13, 13, 13, 1, 2, 1,
77 2, 1, 2, 1, 2, 2, 2, 2, 12, 0,
78 0, 11, 1, 11, 1, 13, 0, 0, 0, 0,
79 0, 0, 0, 13, 13, 13, 13, 13, 13, 13,
80 13, 13, 13, 13, 13, 13, 1, 11, 2, 12,
81 13, 13, 13, 12, 2, 1, 2, 2, 4, 14,
82 4, 10, 13, 13, 4, 4, 1, 1, 4, 2,
83 2, 13, 13, 13, 13, 25, 26, 28, 30, 31,
84 41, 43, 40, 41, 42, 43, 25, 41, 43, 28,
85 28, 1, 2, 25, 26, 22, 22, 25, 26, 0,
91 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
92 10, 11, 12, 13, 14, 15, 16, 17, 0, 0,
93 0, 0, 0, 0, 0, 25, 26, 0, 28, 0,
94 30, 31, 0, 0, 0, 0, 0, 0, 0, 0,
95 40, 41, 42, 43, 0, 0, 0, 0, 0, 0,
96 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
97 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
98 0, 0, 0, 0, 0, 0, 0, 0, 0, 79,
99 80, 0, 82, 0, 0, 0, 0, 0, 0, 79,
100 0, 80, 0, 0, 79, 80, 0, 2, 2, 2,
101 1, 1, 11, 25, 13, 13, 13, 1, 2, 1,
102 2, 1, 2, 1, 2, 2, 2, 2, 12, 0,
103 0, 11, 1, 11, 1, 13, 0, 0, 0, 0,
104 0, 0, 0, 13, 13, 13, 13, 13, 13, 0,
105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
107 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
108 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
113 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 };
114 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 };
115 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 };
116 const BYTE
LAMPS[] = { 2, 2, 13, 0, 13, 13, 129, 0, 130, 128 };
117 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 };
120 BYTE
L5ConvTbl[16] = { 22, 13, 1, 13, 2, 13, 13, 13, 4, 13, 1, 13, 2, 13, 16, 13 };
129 if (y != 1 && c == 2)
131 if (y != 1 && c == 7)
133 if (y != 1 && c == 14)
135 if (y != 1 && c == 4)
137 if (x != 1 && c == 1)
139 if (x != 1 && c == 10)
141 if (x != 1 && c == 6)
145 if (x != 1 && c == 1)
147 if (x != 1 && c == 6)
149 if (x != 1 && c == 10)
151 if (x != 1 && c == 4)
153 if (y != 1 && c == 2)
155 if (y != 1 && c == 14)
157 if (y != 1 && c == 7)
161 if (x != 1 && y != 1 && c == 4)
163 if (x != 1 && c == 10)
165 if (y != 1 && c == 14)
167 if (y != 1 && c == 2)
169 if (x != 1 && c == 1)
171 if (y != 1 && c == 7)
173 if (x != 1 && c == 6)
188 for (y = 1; y <
DMAXY; y++) {
189 for (x = 1; x <
DMAXX; x++) {
195 for (i = 0; i < 37; i++) {
196 if (
SPATS[i].strig == sd[0][0]) {
204 if (patflag == TRUE) {
217 for (y = 1; y <
DMAXY; y++) {
218 for (x = 1; x <
DMAXX; x++) {
271 static int DRLG_PlaceMiniSet(
const BYTE *miniset,
int tmin,
int tmax,
int cx,
int cy, BOOL setview,
int noquad,
int ldir)
273 int sx, sy, sw, sh, xx, yy, i, ii, numt, found, t;
279 if (tmax - tmin == 0)
282 numt =
random_(0, tmax - tmin) + tmin;
284 for (i = 0; i < numt; i++) {
290 while (abort == FALSE) {
292 if (cx != -1 && sx >= cx - sw && sx <= cx + 12) {
296 if (cy != -1 && sy >= cy - sh && sy <= cy + 12) {
303 if (sx < cx && sy < cy)
307 if (sx > cx && sy < cy)
311 if (sx < cx && sy > cy)
315 if (sx > cx && sy > cy)
322 for (yy = 0; yy < sh && abort == TRUE; yy++) {
323 for (xx = 0; xx < sw && abort == TRUE; xx++) {
324 if (miniset[ii] &&
dungeon[xx + sx][sy + yy] != miniset[ii])
332 if (abort == FALSE) {
333 if (++sx ==
DMAXX - sw) {
335 if (++sy ==
DMAXY - sh)
345 for (yy = 0; yy < sh; yy++) {
346 for (xx = 0; xx < sw; xx++) {
348 dungeon[xx + sx][sy + yy] = miniset[ii];
364 if (setview == TRUE) {
374 if (sx < cx && sy < cy)
376 if (sx > cx && sy < cy)
378 if (sx < cx && sy > cy)
389 for (j = 0; j <
DMAXY; j++) {
390 for (i = 0; i <
DMAXX; i++) {
406 long v1, v2, v3, v4, lv;
412 v1 = SDL_SwapLE16(*(MegaTiles + 0)) + 1;
413 v2 = SDL_SwapLE16(*(MegaTiles + 1)) + 1;
414 v3 = SDL_SwapLE16(*(MegaTiles + 2)) + 1;
415 v4 = SDL_SwapLE16(*(MegaTiles + 3)) + 1;
417 for (j = 0; j <
MAXDUNY; j += 2)
419 for (i = 0; i <
MAXDUNX; i += 2) {
423 dPiece[i + 1][j + 1] = v4;
428 for (j = 0; j <
DMAXY; j++) {
430 for (i = 0; i <
DMAXX; i++) {
434 v1 = SDL_SwapLE16(*(MegaTiles + 0)) + 1;
435 v2 = SDL_SwapLE16(*(MegaTiles + 1)) + 1;
436 v3 = SDL_SwapLE16(*(MegaTiles + 2)) + 1;
437 v4 = SDL_SwapLE16(*(MegaTiles + 3)) + 1;
441 dPiece[xx + 1][yy + 1] = v4;
497 for (j = 0; j <
MAXDUNY; j++) {
498 for (i = 0; i <
MAXDUNX; i++) {
501 }
else if (
dPiece[i][j] == 11) {
503 }
else if (
dPiece[i][j] == 71) {
505 }
else if (
dPiece[i][j] == 259) {
507 }
else if (
dPiece[i][j] == 249) {
509 }
else if (
dPiece[i][j] == 325) {
511 }
else if (
dPiece[i][j] == 321) {
513 }
else if (
dPiece[i][j] == 255) {
515 }
else if (
dPiece[i][j] == 211) {
517 }
else if (
dPiece[i][j] == 344) {
519 }
else if (
dPiece[i][j] == 341) {
521 }
else if (
dPiece[i][j] == 331) {
523 }
else if (
dPiece[i][j] == 418) {
525 }
else if (
dPiece[i][j] == 421) {
539 BYTE *pLevelMap, *lm;
549 for (j = 0; j <
DMAXY; j++) {
550 for (i = 0; i <
DMAXX; i++) {
562 for (j = 0; j < rh; j++) {
563 for (i = 0; i < rw; i++) {
588 BYTE *pLevelMap, *lm;
597 for (j = 0; j <
DMAXY; j++) {
598 for (i = 0; i <
DMAXX; i++) {
610 for (j = 0; j < rh; j++) {
611 for (i = 0; i < rw; i++) {
624 for (j = 0; j <
DMAXY; j++) {
625 for (i = 0; i <
DMAXX; i++) {
638 for (j = 0; j <
DMAXY; j++) {
639 for (i = 0; i <
DMAXX; i++) {
650 for (j = 0; j <
DMAXY; j++) {
651 for (i = 0; i <
DMAXX; i++) {
661 for (j = 0; j < h; j++) {
662 for (i = 0; i < w; i++) {
672 for (j = 0; j < height; j++) {
673 for (i = 0; i < width; i++) {
674 if (i + x < 0 || i + x >=
DMAXX || j + y < 0 || j + y >=
DMAXY)
684 static void L5roomGen(
int x,
int y,
int w,
int h,
int dir)
688 int width, height, rx, ry, ry2;
689 int cw, ch, cx1, cy1, cx2;
693 switch (dir == 1 ? dirProb != 0 : dirProb == 0) {
697 cw = (
random_(0, 5) + 2) & 0xFFFFFFFE;
698 ch = (
random_(0, 5) + 2) & 0xFFFFFFFE;
699 cy1 = h / 2 + y - ch / 2;
701 ran =
L5checkRoom(cx1 - 1, cy1 - 1, ch + 2, cw + 1);
703 }
while (ran == FALSE && num < 20);
719 width = (
random_(0, 5) + 2) & 0xFFFFFFFE;
720 height = (
random_(0, 5) + 2) & 0xFFFFFFFE;
721 rx = w / 2 + x - width / 2;
723 ran =
L5checkRoom(rx - 1, ry - 1, width + 2, height + 1);
725 }
while (ran == FALSE && num < 20);
730 ran2 =
L5checkRoom(rx - 1, ry2, width + 2, height + 1);
768 for (y = ys; y < ye; y++) {
809 for (x = xs; x < xe; x++) {
838 for (j = 0; j <
DMAXY; j++) {
839 for (i = 0; i <
DMAXX; i++) {
853 for (j = 0; j <
DMAXY; j++) {
854 for (i = 0; i <
DMAXX; i++) {
867 int i, j, idx, val, dmtx, dmty;
869 for (j = 0; j <
DMAXY; j++) {
870 for (i = 0; i <
DMAXX; i++) {
875 for (j = 0, dmty = 1; dmty <= 77; j++, dmty += 2) {
876 for (i = 0, dmtx = 1; dmtx <= 77; i++, dmtx += 2) {
892 for (x = 1;
dungeon[i + x][j] == 13; x++) {
918 for (y = 1;
dungeon[i][j + y] == 13; y++) {
974 for (xx = 1; xx < dx; xx++) {
1023 for (yy = 1; yy < dy; yy++) {
1041 for (j = 0; j <
DMAXY; j++) {
1042 for (i = 0; i <
DMAXX; i++) {
1079 static void DRLG_L5GChamber(
int sx,
int sy, BOOL topflag, BOOL bottomflag, BOOL leftflag, BOOL rightflag)
1083 if (topflag == TRUE) {
1091 if (bottomflag == TRUE) {
1098 if (
dungeon[sx + 9][sy] != 4) {
1103 if (leftflag == TRUE) {
1111 if (rightflag == TRUE) {
1118 if (
dungeon[sx][sy + 9] != 4) {
1124 for (j = 1; j < 11; j++) {
1125 for (i = 1; i < 11; i++) {
1142 for (i = x1; i < x2; i++) {
1147 for (i = y1; i < y2; i++) {
1161 for (j = 0; j <
DMAXY; j++) {
1162 for (i = 0; i <
DMAXX; i++) {
1163 if (i + 1 <
DMAXX) {
1173 if (j + 1 <
DMAXY) {
1184 for (j = 0; j <
DMAXY; j++) {
1185 for (i = 0; i <
DMAXX; i++) {
1186 if (i + 1 <
DMAXX) {
1232 if (j + 1 <
DMAXY) {
1265 for (j = 0; j <
DMAXY; j++) {
1266 for (i = 0; i <
DMAXX; i++) {
1281 for (y = 0; y <
DMAXY; y++) {
1282 for (x = 0; x <
DMAXX; x++) {
1298 if (i == 89 && y > 0) {
1305 if (i == 91 && x + 1 <
DMAXX) {
1333 for (j = 0; j < rh; j++) {
1334 for (i = 0; i < rw; i++) {
1336 dungeon[rx1 + i][ry1 + j] = *sp;
1339 dungeon[rx1 + i][ry1 + j] = 13;
1505 for (j = 0; j <
DMAXY; j++) {
1508 for (i = 0; i <
DMAXX; i++) {
1525 for (j = 0; j <
DMAXY; j++) {
1528 for (i = 0; i <
DMAXX; i++) {
1562 for (j = 0; j <
DMAXY; j++) {
1563 for (i = 0; i <
DMAXX; i++) {
1584 for (j = 1; j <
DMAXY - 1; j++) {
1585 for (i = 1; i <
DMAXX - 1; i++) {
1658 }
else if (entry == 0) {
1670 }
while (doneflag == FALSE);
1672 for (j = 0; j <
DMAXY; j++) {
1673 for (i = 0; i <
DMAXX; i++) {
1675 int xx = 2 * i + 16;
1676 int yy = 2 * j + 16;
1687 for (j = 0; j <
DMAXY; j++) {
1688 for (i = 0; i <
DMAXX; i++) {
1699 for (j = 0; j <
DMAXY; j++) {
1700 for (i = 0; i <
DMAXX; i++) {