-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_dng.c
109 lines (100 loc) · 2.63 KB
/
main_dng.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include <stdio.h>
#include "dm_algorithm.h"
#include "dm_dungeon.h"
int main(void)
{
int seed = 1501131732;
do {
char *red = "\033[0;31m";
char *green = "\033[0;32m";
char *blue = "\033[0;34m";
char *def = "\033[0m";
printf("SEED %d\n", seed);
struct dng_dungeon *dungeon = dng_gendungeon(seed, 16, true);
for (int i=0; i < dungeon->maps_length; i++) {
printf("MAP %d\n", i);
struct dng_cellmap* cellmap = dungeon->maps[i];
// top ruler
printf(" ");
for (int c=0; c < cellmap->width; c++) {
if (c % 10 == 0)
if (c == 0)
printf("%d ", c / 10);
else
printf("%19d ", c / 10);
}
printf("\n");
printf(" ");
for (int c=0; c < cellmap->width; c++) {
printf("%d ", c %10);
}
printf("\n");
for (int r=0; r < cellmap->height; r++) {
printf("%3d-", r);
for (int c=0; c < cellmap->width; c++) {
int index = r * cellmap->width + c;
struct dng_cell *cell = cellmap->cells[index];
//if (cell->is_room_perimeter)
// printf("P ");
if (false)
printf("skip");
else if (cell->tile_style == DNG_TILE_STYLE_SUMMONCIRCLE)
printf("S ");
// else if (cell->temp_wall)
// printf("w ");
else if (cell->has_mob)
printf("m ");
else if (cell->has_item) {
if (cell->item_style == DNG_ITEM_KEY)
printf("k ");
else
printf("i ");
}
else if (cell->is_tag_unreachable)
printf("U ");
else if (cell->is_entrance_transition)
printf("E ");
else if (cell->is_tutorial)
printf("* ");
else if (cell->is_entrance)
printf("e ");
else if (cell->is_exit_transition)
printf("X ");
else if (cell->is_door)
printf("+ ");
//else if (cell->was_room_fix_tunnel)
// printf("F ");
else if (cell->is_tunnel)
printf(" ");
// printf("T ");
//else if (cell->was_corridor_tunnel)
// printf("t ");
//else if (cell->was_door)
// printf("d ");
//else if (cell->is_sill)
// printf("S ");
else if (cell->is_wall)
printf(". ");
else if (cell->room != NULL && cell->room->is_room_isolated)
printf("%s. %s", blue, def);
else {
// cell rooms, cellular openings, default
if (cell->tile_style == DNG_TILE_STYLE_GRASS)
printf("%s\" %s", green, def);
else if (cell->tile_style == DNG_TILE_STYLE_WATER)
printf("%s~ %s", blue, def);
else if (cell->tile_style == DNG_TILE_STYLE_DEEPWATER)
printf("%sW %s", blue, def);
else
printf(" ");
}
}
printf("\n");
}
getchar();
}
dng_deldungeon(dungeon);
seed++;
} while(true);
return 0;
}