Devilution
Diablo devolved - magic behind the 1996 computer game
automap.cpp
Go to the documentation of this file.
1 
6 #include "all.h"
7 
9 
14 WORD automaptype[512];
15 static int AutoMapX;
16 static int AutoMapY;
19 char AmShiftTab[31];
29 int AmLine8;
30 int AmLine4;
31 
33 #define COLOR_PLAYER (PAL8_ORANGE + 1)
34 
35 #define COLOR_BRIGHT PAL8_YELLOW
36 
37 #define COLOR_DIM (PAL16_YELLOW + 8)
38 
39 #define MAPFLAG_TYPE 0x000F
40 
41 #define MAPFLAG_VERTDOOR 0x01
42 #define MAPFLAG_HORZDOOR 0x02
43 #define MAPFLAG_VERTARCH 0x04
44 #define MAPFLAG_HORZARCH 0x08
45 #define MAPFLAG_VERTGRATE 0x10
46 #define MAPFLAG_HORZGRATE 0x20
47 #define MAPFLAG_DIRT 0x40
48 #define MAPFLAG_STAIRS 0x80
49 
51 {
52  automapflag = FALSE;
53  AutoMapScale = 50;
54  AmLine64 = 32;
55  AmLine32 = 16;
56  AmLine16 = 8;
57  AmLine8 = 4;
58  AmLine4 = 2;
59 }
60 
62 {
63  BYTE b1, b2;
64  DWORD dwTiles;
65  int x, y;
66  BYTE *pAFile, *pTmp;
67  int i, j;
68  int d;
69 
70  j = 50;
71 
72  for (i = 0; i < 31; i++) {
73  d = (j << 6) / 100;
74  AmShiftTab[i] = 2 * (320 / d) + 1;
75  if (320 % d)
76  AmShiftTab[i]++;
77  if (320 % d >= (j << 5) / 100)
78  AmShiftTab[i]++;
79  j += 5;
80  }
81 
82  memset(automaptype, 0, sizeof(automaptype));
83 
84  switch (leveltype) {
85  case DTYPE_CATHEDRAL:
86  pAFile = LoadFileInMem("Levels\\L1Data\\L1.AMP", &dwTiles);
87  break;
88  case DTYPE_CATACOMBS:
89  pAFile = LoadFileInMem("Levels\\L2Data\\L2.AMP", &dwTiles);
90  break;
91  case DTYPE_CAVES:
92  pAFile = LoadFileInMem("Levels\\L3Data\\L3.AMP", &dwTiles);
93  break;
94  case DTYPE_HELL:
95  pAFile = LoadFileInMem("Levels\\L4Data\\L4.AMP", &dwTiles);
96  break;
97  default:
98  return;
99  }
100 
101  dwTiles >>= 1;
102  pTmp = pAFile;
103 
104  for (i = 1; i <= dwTiles; i++) {
105  b1 = *pTmp++;
106  b2 = *pTmp++;
107  automaptype[i] = b1 + (b2 << 8);
108  }
109 
110  mem_free_dbg(pAFile);
111  memset(automapview, 0, sizeof(automapview));
112 
113  for (y = 0; y < MAXDUNY; y++) {
114  for (x = 0; x < MAXDUNX; x++)
115  dFlags[x][y] &= ~BFLAG_EXPLORED;
116  }
117 }
118 
120 {
121  AutoMapXOfs = 0;
122  AutoMapYOfs = 0;
123  automapflag = TRUE;
124 }
125 
126 void AutomapUp()
127 {
128  AutoMapXOfs--;
129  AutoMapYOfs--;
130 }
131 
133 {
134  AutoMapXOfs++;
135  AutoMapYOfs++;
136 }
137 
139 {
140  AutoMapXOfs--;
141  AutoMapYOfs++;
142 }
143 
145 {
146  AutoMapXOfs++;
147  AutoMapYOfs--;
148 }
149 
151 {
152  if (AutoMapScale < 200) {
153  AutoMapScale += 5;
154  AmLine64 = (AutoMapScale << 6) / 100;
155  AmLine32 = AmLine64 >> 1;
156  AmLine16 = AmLine32 >> 1;
157  AmLine8 = AmLine16 >> 1;
158  AmLine4 = AmLine8 >> 1;
159  }
160 }
161 
163 {
164  if (AutoMapScale > 50) {
165  AutoMapScale -= 5;
166  AmLine64 = (AutoMapScale << 6) / 100;
167  AmLine32 = AmLine64 >> 1;
168  AmLine16 = AmLine32 >> 1;
169  AmLine8 = AmLine16 >> 1;
170  AmLine4 = AmLine8 >> 1;
171  }
172 }
173 
175 {
176  int cells;
177  int sx, sy;
178  int i, j;
179  int mapx, mapy;
180 
181  if (leveltype == DTYPE_TOWN) {
182  DrawAutomapText();
183  return;
184  }
185 
187 
188  AutoMapX = (ViewX - 16) >> 1;
189  while (AutoMapX + AutoMapXOfs < 0)
190  AutoMapXOfs++;
191  while (AutoMapX + AutoMapXOfs >= DMAXX)
192  AutoMapXOfs--;
194 
195  AutoMapY = (ViewY - 16) >> 1;
196  while (AutoMapY + AutoMapYOfs < 0)
197  AutoMapYOfs++;
198  while (AutoMapY + AutoMapYOfs >= DMAXY)
199  AutoMapYOfs--;
201 
202  cells = AmShiftTab[(AutoMapScale - 50) / 5];
204  cells++;
205  mapx = AutoMapX - cells;
206  mapy = AutoMapY - 1;
207 
208  if (cells & 1) {
209  sx = 384 - AmLine64 * ((cells - 1) >> 1);
210  sy = 336 - AmLine32 * ((cells + 1) >> 1);
211  } else {
212  sx = 384 - AmLine64 * (cells >> 1) + AmLine32;
213  sy = 336 - AmLine32 * (cells >> 1) - AmLine16;
214  }
215  if (ViewX & 1) {
216  sx -= AmLine16;
217  sy -= AmLine8;
218  }
219  if (ViewY & 1) {
220  sx += AmLine16;
221  sy -= AmLine8;
222  }
223 
224  sx += AutoMapScale * ScrollInfo._sxoff / 100 >> 1;
225  sy += AutoMapScale * ScrollInfo._syoff / 100 >> 1;
226  if (invflag || sbookflag) {
227  sx -= 160;
228  }
229  if (chrflag || questlog) {
230  sx += 160;
231  }
232 
233  for (i = 0; i <= cells + 1; i++) {
234  int x = sx;
235  int y;
236 
237  for (j = 0; j < cells; j++) {
238  WORD maptype = GetAutomapType(mapx + j, mapy - j, TRUE);
239  if (maptype)
240  DrawAutomapTile(x, sy, maptype);
241  x += AmLine64;
242  }
243  mapy++;
244  x = sx - AmLine32;
245  y = sy + AmLine16;
246  for (j = 0; j <= cells; j++) {
247  WORD maptype = GetAutomapType(mapx + j, mapy - j, TRUE);
248  if (maptype)
249  DrawAutomapTile(x, y, maptype);
250  x += AmLine64;
251  }
252  mapx++;
253  sy += AmLine32;
254  }
255  DrawAutomapPlr();
256  DrawAutomapText();
258 }
259 
260 void DrawAutomapTile(int sx, int sy, WORD automap_type)
261 {
262  BOOL do_vert;
263  BOOL do_horz;
264  BOOL do_cave_horz;
265  BOOL do_cave_vert;
266  int x1, y1, x2, y2;
267 
268  BYTE flags = automap_type >> 8;
269 
270  if (flags & MAPFLAG_DIRT) {
271  ENG_set_pixel(sx, sy, COLOR_DIM);
272  ENG_set_pixel(sx - AmLine8, sy - AmLine4, COLOR_DIM);
273  ENG_set_pixel(sx - AmLine8, sy + AmLine4, COLOR_DIM);
274  ENG_set_pixel(sx + AmLine8, sy - AmLine4, COLOR_DIM);
275  ENG_set_pixel(sx + AmLine8, sy + AmLine4, COLOR_DIM);
276  ENG_set_pixel(sx - AmLine16, sy, COLOR_DIM);
277  ENG_set_pixel(sx + AmLine16, sy, COLOR_DIM);
278  ENG_set_pixel(sx, sy - AmLine8, COLOR_DIM);
279  ENG_set_pixel(sx, sy + AmLine8, COLOR_DIM);
286  ENG_set_pixel(sx, sy + AmLine16, COLOR_DIM);
287  }
288 
289  if (flags & MAPFLAG_STAIRS) {
290  DrawLine(sx - AmLine8, sy - AmLine8 - AmLine4, sx + AmLine8 + AmLine16, sy + AmLine4, COLOR_BRIGHT);
291  DrawLine(sx - AmLine16, sy - AmLine8, sx + AmLine16, sy + AmLine8, COLOR_BRIGHT);
292  DrawLine(sx - AmLine16 - AmLine8, sy - AmLine4, sx + AmLine8, sy + AmLine8 + AmLine4, COLOR_BRIGHT);
293  DrawLine(sx - AmLine32, sy, sx, sy + AmLine16, COLOR_BRIGHT);
294  }
295 
296  do_vert = FALSE;
297  do_horz = FALSE;
298  do_cave_horz = FALSE;
299  do_cave_vert = FALSE;
300  switch (automap_type & MAPFLAG_TYPE) {
301  case 1: // stand-alone column or other unpassable object
302  x1 = sx - AmLine16;
303  y1 = sy - AmLine16;
304  x2 = x1 + AmLine32;
305  y2 = sy - AmLine8;
306  DrawLine(sx, y1, x1, y2, COLOR_DIM);
307  DrawLine(sx, y1, x2, y2, COLOR_DIM);
308  DrawLine(sx, sy, x1, y2, COLOR_DIM);
309  DrawLine(sx, sy, x2, y2, COLOR_DIM);
310  break;
311  case 2:
312  case 5:
313  do_vert = TRUE;
314  break;
315  case 3:
316  case 6:
317  do_horz = TRUE;
318  break;
319  case 4:
320  do_vert = TRUE;
321  do_horz = TRUE;
322  break;
323  case 8:
324  do_vert = TRUE;
325  do_cave_horz = TRUE;
326  break;
327  case 9:
328  do_horz = TRUE;
329  do_cave_vert = TRUE;
330  break;
331  case 10:
332  do_cave_horz = TRUE;
333  break;
334  case 11:
335  do_cave_vert = TRUE;
336  break;
337  case 12:
338  do_cave_horz = TRUE;
339  do_cave_vert = TRUE;
340  break;
341  }
342 
343  if (do_vert) { // right-facing obstacle
344  if (flags & MAPFLAG_VERTDOOR) { // two wall segments with a door in the middle
345  x1 = sx - AmLine32;
346  x2 = sx - AmLine16;
347  y1 = sy - AmLine16;
348  y2 = sy - AmLine8;
349 
350  DrawLine(sx, y1, sx - AmLine8, y1 + AmLine4, COLOR_DIM);
351  DrawLine(x1, sy, x1 + AmLine8, sy - AmLine4, COLOR_DIM);
352  DrawLine(x2, y1, x1, y2, COLOR_BRIGHT);
353  DrawLine(x2, y1, sx, y2, COLOR_BRIGHT);
354  DrawLine(x2, sy, x1, y2, COLOR_BRIGHT);
355  DrawLine(x2, sy, sx, y2, COLOR_BRIGHT);
356  }
357  if (flags & MAPFLAG_VERTGRATE) { // right-facing half-wall
358  DrawLine(sx - AmLine16, sy - AmLine8, sx - AmLine32, sy, COLOR_DIM);
359  flags |= MAPFLAG_VERTARCH;
360  }
361  if (flags & MAPFLAG_VERTARCH) { // window or passable column
362  x1 = sx - AmLine16;
363  y1 = sy - AmLine16;
364  x2 = x1 + AmLine32;
365  y2 = sy - AmLine8;
366 
367  DrawLine(sx, y1, x1, y2, COLOR_DIM);
368  DrawLine(sx, y1, x2, y2, COLOR_DIM);
369  DrawLine(sx, sy, x1, y2, COLOR_DIM);
370  DrawLine(sx, sy, x2, y2, COLOR_DIM);
371  }
373  DrawLine(sx, sy - AmLine16, sx - AmLine32, sy, COLOR_DIM);
374  }
375 
376  if (do_horz) { // left-facing obstacle
377  if (flags & MAPFLAG_HORZDOOR) {
378  x1 = sx + AmLine16;
379  x2 = sx + AmLine32;
380  y1 = sy - AmLine16;
381  y2 = sy - AmLine8;
382 
383  DrawLine(sx, y1, sx + AmLine8, y1 + AmLine4, COLOR_DIM);
384  DrawLine(x2, sy, x2 - AmLine8, sy - AmLine4, COLOR_DIM);
385  DrawLine(x1, y1, sx, y2, COLOR_BRIGHT);
386  DrawLine(x1, y1, x2, y2, COLOR_BRIGHT);
387  DrawLine(x1, sy, sx, y2, COLOR_BRIGHT);
388  DrawLine(x1, sy, x2, y2, COLOR_BRIGHT);
389  }
390  if (flags & MAPFLAG_HORZGRATE) {
391  DrawLine(sx + AmLine16, sy - AmLine8, sx + AmLine32, sy, COLOR_DIM);
392  flags |= MAPFLAG_HORZARCH;
393  }
394  if (flags & MAPFLAG_HORZARCH) {
395  x1 = sx - AmLine16;
396  y1 = sy - AmLine16;
397  x2 = x1 + AmLine32;
398  y2 = sy - AmLine8;
399 
400  DrawLine(sx, y1, x1, y2, COLOR_DIM);
401  DrawLine(sx, y1, x2, y2, COLOR_DIM);
402  DrawLine(sx, sy, x1, y2, COLOR_DIM);
403  DrawLine(sx, sy, x2, y2, COLOR_DIM);
404  }
406  DrawLine(sx, sy - AmLine16, sx + AmLine32, sy, COLOR_DIM);
407  }
408 
409  // for caves the horz/vert flags are switched
410  if (do_cave_horz) {
411  if (flags & MAPFLAG_VERTDOOR) {
412  x1 = sx - AmLine32;
413  x2 = sx - AmLine16;
414  y1 = sy + AmLine16;
415  y2 = sy + AmLine8;
416 
417  DrawLine(sx, y1, sx - AmLine8, y1 - AmLine4, COLOR_DIM);
418  DrawLine(x1, sy, x1 + AmLine8, sy + AmLine4, COLOR_DIM);
419  DrawLine(x2, y1, x1, y2, COLOR_BRIGHT);
420  DrawLine(x2, y1, sx, y2, COLOR_BRIGHT);
421  DrawLine(x2, sy, x1, y2, COLOR_BRIGHT);
422  DrawLine(x2, sy, sx, y2, COLOR_BRIGHT);
423  } else
424  DrawLine(sx, sy + AmLine16, sx - AmLine32, sy, COLOR_DIM);
425  }
426 
427  if (do_cave_vert) {
428  if (flags & MAPFLAG_HORZDOOR) {
429  x1 = sx + AmLine16;
430  x2 = sx + AmLine32;
431  y1 = sy + AmLine16;
432  y2 = sy + AmLine8;
433 
434  DrawLine(sx, y1, sx + AmLine8, y1 - AmLine4, COLOR_DIM);
435  DrawLine(x2, sy, x2 - AmLine8, sy + AmLine4, COLOR_DIM);
436  DrawLine(x1, y1, sx, y2, COLOR_BRIGHT);
437  DrawLine(x1, y1, x2, y2, COLOR_BRIGHT);
438  DrawLine(x1, sy, sx, y2, COLOR_BRIGHT);
439  DrawLine(x1, sy, x2, y2, COLOR_BRIGHT);
440  } else
441  DrawLine(sx, sy + AmLine16, sx + AmLine32, sy, COLOR_DIM);
442  }
443 }
444 
446 {
447  int px, py;
448  int x, y;
449 
450  if (plr[myplr]._pmode == PM_WALK3) {
451  x = plr[myplr]._px;
452  y = plr[myplr]._py;
453  if (plr[myplr]._pdir == DIR_W)
454  x++;
455  else
456  y++;
457  } else {
458  x = plr[myplr].WorldX;
459  y = plr[myplr].WorldY;
460  }
461  px = x - 2 * AutoMapXOfs - ViewX;
462  py = y - 2 * AutoMapYOfs - ViewY;
463 
464  x = (plr[myplr]._pxoff * AutoMapScale / 100 >> 1) + (ScrollInfo._sxoff * AutoMapScale / 100 >> 1) + (px - py) * AmLine16 + 384;
465  y = (plr[myplr]._pyoff * AutoMapScale / 100 >> 1) + (ScrollInfo._syoff * AutoMapScale / 100 >> 1) + (px + py) * AmLine8 + 336;
466 
467  if (invflag || sbookflag)
468  x -= 160;
469  if (chrflag || questlog)
470  x += 160;
471  y -= AmLine8;
472 
473  switch (plr[myplr]._pdir) {
474  case DIR_N:
475  DrawLine(x, y, x, y - AmLine16, COLOR_PLAYER);
476  DrawLine(x, y - AmLine16, x - AmLine4, y - AmLine8, COLOR_PLAYER);
477  DrawLine(x, y - AmLine16, x + AmLine4, y - AmLine8, COLOR_PLAYER);
478  break;
479  case DIR_NE:
480  DrawLine(x, y, x + AmLine16, y - AmLine8, COLOR_PLAYER);
481  DrawLine(x + AmLine16, y - AmLine8, x + AmLine8, y - AmLine8, COLOR_PLAYER);
482  DrawLine(x + AmLine16, y - AmLine8, x + AmLine8 + AmLine4, y, COLOR_PLAYER);
483  break;
484  case DIR_E:
485  DrawLine(x, y, x + AmLine16, y, COLOR_PLAYER);
486  DrawLine(x + AmLine16, y, x + AmLine8, y - AmLine4, COLOR_PLAYER);
487  DrawLine(x + AmLine16, y, x + AmLine8, y + AmLine4, COLOR_PLAYER);
488  break;
489  case DIR_SE:
490  DrawLine(x, y, x + AmLine16, y + AmLine8, COLOR_PLAYER);
491  DrawLine(x + AmLine16, y + AmLine8, x + AmLine8 + AmLine4, y, COLOR_PLAYER);
492  DrawLine(x + AmLine16, y + AmLine8, x + AmLine8, y + AmLine8, COLOR_PLAYER);
493  break;
494  case DIR_S:
495  DrawLine(x, y, x, y + AmLine16, COLOR_PLAYER);
496  DrawLine(x, y + AmLine16, x + AmLine4, y + AmLine8, COLOR_PLAYER);
497  DrawLine(x, y + AmLine16, x - AmLine4, y + AmLine8, COLOR_PLAYER);
498  break;
499  case DIR_SW:
500  DrawLine(x, y, x - AmLine16, y + AmLine8, COLOR_PLAYER);
501  DrawLine(x - AmLine16, y + AmLine8, x - AmLine4 - AmLine8, y, COLOR_PLAYER);
502  DrawLine(x - AmLine16, y + AmLine8, x - AmLine8, y + AmLine8, COLOR_PLAYER);
503  break;
504  case DIR_W:
505  DrawLine(x, y, x - AmLine16, y, COLOR_PLAYER);
506  DrawLine(x - AmLine16, y, x - AmLine8, y - AmLine4, COLOR_PLAYER);
507  DrawLine(x - AmLine16, y, x - AmLine8, y + AmLine4, COLOR_PLAYER);
508  break;
509  case DIR_NW:
510  DrawLine(x, y, x - AmLine16, y - AmLine8, COLOR_PLAYER);
511  DrawLine(x - AmLine16, y - AmLine8, x - AmLine8, y - AmLine8, COLOR_PLAYER);
512  DrawLine(x - AmLine16, y - AmLine8, x - AmLine4 - AmLine8, y, COLOR_PLAYER);
513  break;
514  }
515 }
516 
517 WORD GetAutomapType(int x, int y, BOOL view)
518 {
519  WORD rv;
520 
521  if (view && x == -1 && y >= 0 && y < DMAXY && automapview[0][y]) {
522  if (GetAutomapType(0, y, FALSE) & (MAPFLAG_DIRT << 8)) {
523  return 0;
524  } else {
525  return MAPFLAG_DIRT << 8;
526  }
527  }
528 
529  if (view && y == -1 && x >= 0 && x < DMAXY && automapview[x][0]) {
530  if (GetAutomapType(x, 0, FALSE) & (MAPFLAG_DIRT << 8)) {
531  return 0;
532  } else {
533  return MAPFLAG_DIRT << 8;
534  }
535  }
536 
537  if (x < 0 || x >= DMAXX) {
538  return 0;
539  }
540  if (y < 0 || y >= DMAXX) {
541  return 0;
542  }
543  if (!automapview[x][y] && view) {
544  return 0;
545  }
546 
547  rv = automaptype[(BYTE)dungeon[x][y]];
548  if (rv == 7) {
549  if ((GetAutomapType(x - 1, y, FALSE) >> 8) & MAPFLAG_HORZARCH) {
550  if ((GetAutomapType(x, y - 1, FALSE) >> 8) & MAPFLAG_VERTARCH) {
551  rv = 1;
552  }
553  }
554  }
555  return rv;
556 }
557 
559 {
560  char desc[256];
561  int nextline = 20;
562 
563  if (gbMaxPlayers > 1) {
564  strcat(strcpy(desc, "game: "), szPlayerName);
565  PrintGameStr(8, 20, desc, COL_GOLD);
566  nextline = 35;
567  if (szPlayerDescript[0]) {
568  strcat(strcpy(desc, "password: "), szPlayerDescript);
569  PrintGameStr(8, 35, desc, COL_GOLD);
570  nextline = 50;
571  }
572  }
573  if (setlevel)
574  PrintGameStr(8, nextline, quest_level_names[(BYTE)setlvlnum], COL_GOLD);
575  else if (currlevel) {
576  sprintf(desc, "Level: %i", currlevel);
577  PrintGameStr(8, nextline, desc, COL_GOLD);
578  }
579 }
580 
581 void SetAutomapView(int x, int y)
582 {
583  WORD maptype, solid;
584  int xx, yy;
585 
586  xx = (x - 16) >> 1;
587  yy = (y - 16) >> 1;
588 
589  if (xx < 0 || xx >= DMAXX || yy < 0 || yy >= DMAXY) {
590  return;
591  }
592 
593  automapview[xx][yy] = TRUE;
594 
595  maptype = GetAutomapType(xx, yy, FALSE);
596  solid = maptype & 0x4000;
597 
598  switch (maptype & 0xF) {
599  case 2:
600  if (solid) {
601  if (GetAutomapType(xx, yy + 1, FALSE) == 0x4007)
602  automapview[xx][yy + 1] = TRUE;
603  } else if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000) {
604  automapview[xx - 1][yy] = TRUE;
605  }
606  break;
607  case 3:
608  if (solid) {
609  if (GetAutomapType(xx + 1, yy, FALSE) == 0x4007)
610  automapview[xx + 1][yy] = TRUE;
611  } else if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000) {
612  automapview[xx][yy - 1] = TRUE;
613  }
614  break;
615  case 4:
616  if (solid) {
617  if (GetAutomapType(xx, yy + 1, FALSE) == 0x4007)
618  automapview[xx][yy + 1] = TRUE;
619  if (GetAutomapType(xx + 1, yy, FALSE) == 0x4007)
620  automapview[xx + 1][yy] = TRUE;
621  } else {
622  if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000)
623  automapview[xx - 1][yy] = TRUE;
624  if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000)
625  automapview[xx][yy - 1] = TRUE;
626  if (GetAutomapType(xx - 1, yy - 1, FALSE) & 0x4000)
627  automapview[xx - 1][yy - 1] = TRUE;
628  }
629  break;
630  case 5:
631  if (solid) {
632  if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000)
633  automapview[xx][yy - 1] = TRUE;
634  if (GetAutomapType(xx, yy + 1, FALSE) == 0x4007)
635  automapview[xx][yy + 1] = TRUE;
636  } else if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000) {
637  automapview[xx - 1][yy] = TRUE;
638  }
639  break;
640  case 6:
641  if (solid) {
642  if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000)
643  automapview[xx - 1][yy] = TRUE;
644  if (GetAutomapType(xx + 1, yy, FALSE) == 0x4007)
645  automapview[xx + 1][yy] = TRUE;
646  } else if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000) {
647  automapview[xx][yy - 1] = TRUE;
648  }
649  break;
650  }
651 }
652 
654 {
655  AutoMapXOfs = 0;
656  AutoMapYOfs = 0;
657  AmLine64 = (AutoMapScale << 6) / 100;
658  AmLine32 = AmLine64 >> 1;
659  AmLine16 = AmLine32 >> 1;
660  AmLine8 = AmLine16 >> 1;
661  AmLine4 = AmLine8 >> 1;
662 }
663 
DrawAutomapPlr
void DrawAutomapPlr()
Definition: automap.cpp:445
AutomapZoomOut
void AutomapZoomOut()
Definition: automap.cpp:162
gpBuffer
BYTE * gpBuffer
COLOR_BRIGHT
#define COLOR_BRIGHT
color for bright map lines (doors, stairs etc.)
Definition: automap.cpp:35
currlevel
BYTE currlevel
Definition: gendung.cpp:40
MAPFLAG_HORZGRATE
#define MAPFLAG_HORZGRATE
Definition: automap.cpp:46
DIR_W
@ DIR_W
Definition: enums.h:2084
PANEL_Y
#define PANEL_Y
Definition: defs.h:137
AutoMapScale
int AutoMapScale
Specifies the scale of the automap.
Definition: automap.cpp:23
PlayerStruct::_pxoff
int _pxoff
Definition: structs.h:198
COLOR_PLAYER
#define COLOR_PLAYER
color used to draw the player's arrow
Definition: automap.cpp:33
SCREEN_Y
#define SCREEN_Y
Definition: defs.h:126
dungeon
BYTE dungeon[DMAXX][DMAXY]
Definition: gendung.cpp:18
MAPFLAG_TYPE
#define MAPFLAG_TYPE
Definition: automap.cpp:39
DTYPE_CATACOMBS
@ DTYPE_CATACOMBS
Definition: enums.h:1870
PlayerStruct::WorldX
int WorldX
Definition: structs.h:188
DrawAutomapText
void DrawAutomapText()
Definition: automap.cpp:558
MAXDUNX
#define MAXDUNX
Definition: defs.h:25
MAPFLAG_VERTGRATE
#define MAPFLAG_VERTGRATE
Definition: automap.cpp:45
AutoMapX
static int AutoMapX
Definition: automap.cpp:15
MAPFLAG_VERTARCH
#define MAPFLAG_VERTARCH
Definition: automap.cpp:43
szPlayerDescript
char szPlayerDescript[128]
Definition: multi.cpp:14
MAPFLAG_HORZDOOR
#define MAPFLAG_HORZDOOR
Definition: automap.cpp:42
questlog
BOOL questlog
Definition: quests.cpp:6
DIR_N
@ DIR_N
Definition: enums.h:2086
ViewX
int ViewX
Definition: gendung.cpp:73
DIR_NW
@ DIR_NW
Definition: enums.h:2085
MAPFLAG_DIRT
#define MAPFLAG_DIRT
Definition: automap.cpp:47
COL_GOLD
@ COL_GOLD
Definition: enums.h:1996
AutomapDown
void AutomapDown()
Definition: automap.cpp:132
automapflag
BOOL automapflag
Specifies whether the automap is enabled.
Definition: automap.cpp:18
StartAutomap
void StartAutomap()
Definition: automap.cpp:119
MAPFLAG_STAIRS
#define MAPFLAG_STAIRS
Definition: automap.cpp:48
all.h
DIR_SE
@ DIR_SE
Definition: enums.h:2089
ViewY
int ViewY
Definition: gendung.cpp:74
MAPFLAG_HORZARCH
#define MAPFLAG_HORZARCH
Definition: automap.cpp:44
PM_WALK3
@ PM_WALK3
Definition: enums.h:2046
DIR_SW
@ DIR_SW
Definition: enums.h:2083
MAPFLAG_VERTDOOR
#define MAPFLAG_VERTDOOR
these are in the second byte
Definition: automap.cpp:41
gbMaxPlayers
BYTE gbMaxPlayers
Specifies the maximum number of players in a game, where 1 represents a single player game and 4 repr...
Definition: multi.cpp:34
MAXDUNY
#define MAXDUNY
Definition: defs.h:26
PlayerStruct::_px
int _px
Definition: structs.h:190
sbookflag
BOOL sbookflag
Definition: control.cpp:48
DIR_NE
@ DIR_NE
Definition: enums.h:2087
COLOR_DIM
#define COLOR_DIM
color for dim map lines/dots
Definition: automap.cpp:37
AutoMapYOfs
int AutoMapYOfs
Definition: automap.cpp:25
DrawAutomap
void DrawAutomap()
Definition: automap.cpp:174
ENG_set_pixel
void ENG_set_pixel(int sx, int sy, BYTE col)
Set the value of a single pixel in the back buffer, checks bounds.
Definition: engine.cpp:609
DIR_E
@ DIR_E
Definition: enums.h:2088
DEVILUTION_END_NAMESPACE
#define DEVILUTION_END_NAMESPACE
Definition: types.h:10
AutomapRight
void AutomapRight()
Definition: automap.cpp:144
AmLine16
int AmLine16
Definition: automap.cpp:28
AmLine4
int AmLine4
Definition: automap.cpp:30
LoadFileInMem
BYTE * LoadFileInMem(char *pszName, DWORD *pdwFileLen)
Load a file in to a buffer.
Definition: engine.cpp:801
AmLine8
int AmLine8
Definition: automap.cpp:29
AmShiftTab
char AmShiftTab[31]
Definition: automap.cpp:19
DrawLine
void DrawLine(int x0, int y0, int x1, int y1, BYTE col)
Draw a line on the back buffer.
Definition: engine.cpp:657
AutoMapXOfs
int AutoMapXOfs
Definition: automap.cpp:24
DrawAutomapTile
void DrawAutomapTile(int sx, int sy, WORD automap_type)
Definition: automap.cpp:260
gpBufEnd
BYTE * gpBufEnd
Lower bound of back buffer.
Definition: scrollrt.cpp:19
AutomapLeft
void AutomapLeft()
Definition: automap.cpp:138
setlevel
BOOLEAN setlevel
Definition: gendung.cpp:65
automapview
BOOLEAN automapview[DMAXX][DMAXY]
Tracks the explored areas of the map.
Definition: automap.cpp:21
DMAXY
#define DMAXY
Definition: defs.h:8
DTYPE_TOWN
@ DTYPE_TOWN
Definition: enums.h:1868
DTYPE_HELL
@ DTYPE_HELL
Definition: enums.h:1872
AutomapUp
void AutomapUp()
Definition: automap.cpp:126
quest_level_names
char * quest_level_names[]
Maps from quest level to quest level names.
Definition: setmaps.cpp:60
invflag
DEVILUTION_BEGIN_NAMESPACE BOOL invflag
Definition: inv.cpp:10
DTYPE_CAVES
@ DTYPE_CAVES
Definition: enums.h:1871
szPlayerName
char szPlayerName[128]
Definition: multi.cpp:36
setlvlnum
BYTE setlvlnum
Definition: gendung.cpp:58
DTYPE_CATHEDRAL
@ DTYPE_CATHEDRAL
Definition: enums.h:1869
DIR_S
@ DIR_S
Definition: enums.h:2082
AmLine32
int AmLine32
Definition: automap.cpp:27
chrflag
BOOL chrflag
Definition: control.cpp:49
PlayerStruct::_pyoff
int _pyoff
Definition: structs.h:199
myplr
int myplr
Definition: player.cpp:9
mem_free_dbg
void mem_free_dbg(void *p)
Multithreaded safe memfree.
Definition: engine.cpp:786
AutomapZoomReset
void AutomapZoomReset()
Definition: automap.cpp:653
BUFFER_WIDTH
#define BUFFER_WIDTH
Definition: defs.h:128
AmLine64
int AmLine64
Definition: automap.cpp:26
DEVILUTION_BEGIN_NAMESPACE
Definition: sha.cpp:10
GetAutomapType
WORD GetAutomapType(int x, int y, BOOL view)
Definition: automap.cpp:517
SetAutomapView
void SetAutomapView(int x, int y)
Definition: automap.cpp:581
AutomapZoomIn
void AutomapZoomIn()
Definition: automap.cpp:150
PlayerStruct::_py
int _py
Definition: structs.h:191
automaptype
DEVILUTION_BEGIN_NAMESPACE WORD automaptype[512]
Maps from tile_id to automap type.
Definition: automap.cpp:14
dFlags
char dFlags[MAXDUNX][MAXDUNY]
Definition: gendung.cpp:56
ScrollInfo
ScrollStruct ScrollInfo
Definition: gendung.cpp:46
ScrollStruct::_syoff
int _syoff
Definition: structs.h:1107
PlayerStruct::WorldY
int WorldY
Definition: structs.h:189
InitAutomapOnce
void InitAutomapOnce()
Definition: automap.cpp:50
AutoMapY
static int AutoMapY
Definition: automap.cpp:16
ScrollStruct::_sxoff
int _sxoff
Definition: structs.h:1106
BFLAG_EXPLORED
@ BFLAG_EXPLORED
Definition: enums.h:1884
SCREEN_HEIGHT
#define SCREEN_HEIGHT
Definition: defs.h:106
leveltype
BYTE leveltype
Definition: gendung.cpp:39
plr
PlayerStruct plr[MAX_PLRS]
Definition: player.cpp:10
InitAutomap
void InitAutomap()
Definition: automap.cpp:61
DMAXX
#define DMAXX
Definition: defs.h:7
PrintGameStr
void PrintGameStr(int x, int y, const char *str, int color)
Definition: control.cpp:1306