-
Notifications
You must be signed in to change notification settings - Fork 0
/
tile.hpp
172 lines (169 loc) · 4.09 KB
/
tile.hpp
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#pragma once
#include "color.hpp"
#include <_main.hpp>
struct tile {
struct flag_bits {
static sig const none = 0b0, passable = 0b1, interactable = 0b10,
transporting = 0b100, shape_changing = 0b1000,
damaging = 1 << 4;
flag_bits() = delete;
};
struct attr_bits {
static sig const none = 0b0;
attr_bits() = delete;
};
enum class idents : char {
nil = 0,
wall,
doorway,
doorway_sigil,
sliding_door,
chest,
stone_rubble_pile,
stone_flooring,
cracked_stone_flooring,
decorated_stone_flooring,
burned_rubble_pile,
burned_rubble_piece,
stone_pillar,
player,
dart_trap,
propelled_dart,
bomb_trap,
propelled_bomb,
blazing_fire,
};
char symbol;
sig flags;
string description;
pair<SDL_Color, SDL_Color> color = color_idents::WHITE_ON_BLACK;
sig attr = attr_bits::none;
};
vector<pair<tile::idents, double>> const ROOM_TILE_WEIGHTS = {
{tile::idents::stone_rubble_pile, 60},
{tile::idents::stone_flooring, 100},
{tile::idents::cracked_stone_flooring, 40},
{tile::idents::decorated_stone_flooring, 30},
{tile::idents::stone_pillar, 2},
{tile::idents::dart_trap, 2},
{tile::idents::bomb_trap, 2},
};
map<tile::idents, tile> const ALL_TILES = {
{tile::idents::stone_rubble_pile,
{
'"',
tile::flag_bits::passable,
"small pile of rubble",
}},
{tile::idents::stone_flooring,
{
'.',
tile::flag_bits::passable,
"stone floor",
}},
{tile::idents::cracked_stone_flooring,
{
',',
tile::flag_bits::passable,
"cracked stone floor",
}},
{tile::idents::decorated_stone_flooring,
{
'~',
tile::flag_bits::passable,
"decorated stone floor",
}},
{tile::idents::burned_rubble_pile,
{
'"',
tile::flag_bits::passable,
"burned stone pile",
color_idents::GRAY_ON_BLACK,
}},
{tile::idents::burned_rubble_piece,
{
'\'',
tile::flag_bits::passable,
"burned piece of rubble",
}},
{tile::idents::stone_pillar,
{
'O',
tile::flag_bits::none,
"stone pillar",
color_idents::CYAN_ON_BLACK,
}},
{tile::idents::wall,
{
'#',
tile::flag_bits::none,
}},
{tile::idents::doorway,
{
' ',
tile::flag_bits::passable | tile::flag_bits::transporting,
}},
{tile::idents::doorway_sigil,
{
'D',
tile::flag_bits::passable | tile::flag_bits::shape_changing,
"",
color_idents::RED_ON_BLACK,
}},
{tile::idents::dart_trap,
{
'#',
tile::flag_bits::none,
"A devious trap",
color_idents::WHITE_ON_BLACK,
}},
{tile::idents::bomb_trap,
{
'#',
tile::flag_bits::none,
"A devious trap",
color_idents::GRAY_ON_BLACK,
}},
{tile::idents::sliding_door,
{
'#',
tile::flag_bits::interactable,
"sliding door",
color_idents::RED_ON_BLACK,
}},
{tile::idents::chest,
{
'?',
tile::flag_bits::interactable,
"mysterious chest",
color_idents::MAGENTA_ON_BLUE,
}},
{tile::idents::player,
{
'*',
tile::flag_bits::none,
"Player character",
color_idents::GREEN_ON_WHITE,
}},
{tile::idents::propelled_dart,
{
'`',
tile::flag_bits::damaging,
"Shot by dart traps",
color_idents::RED_ON_BLACK,
}},
{tile::idents::propelled_bomb,
{
'@',
tile::flag_bits::damaging,
"Lobbed by bomb traps",
color_idents::GRAY_ON_BLACK,
}},
{tile::idents::blazing_fire,
{
'~',
tile::flag_bits::damaging,
"Fire produced by explosions",
color_idents::ORANGE_ON_BLACK,
}},
};