summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp index 1b7d198..7be82d1 100644 --- a/src/main.cpp +++ b/src/main.cpp
@@ -40,7 +40,6 @@ using renderer_ptr = std::unique_ptr<SDL_Renderer, renderer_deleter>;
40enum class Tile { 40enum class Tile {
41 Floor, 41 Floor,
42 Wall, 42 Wall,
43 Dark,
44 Dust, 43 Dust,
45 Lamp 44 Lamp
46}; 45};
@@ -104,7 +103,6 @@ void render(
104 } 103 }
105 104
106 case Tile::Wall: 105 case Tile::Wall:
107 case Tile::Dark:
108 { 106 {
109 SDL_SetRenderDrawColor(ren, 100, 100, 100, 255); 107 SDL_SetRenderDrawColor(ren, 100, 100, 100, 255);
110 break; 108 break;
@@ -135,7 +133,7 @@ void render(
135 SDL_RenderPresent(ren); 133 SDL_RenderPresent(ren);
136} 134}
137 135
138void incrementIfSet(Map& map, int& count, int x, int y, int w, int h, Tile val = Tile::Dark) 136void incrementIfSet(Map& map, int& count, int x, int y, int w, int h, Tile val = Tile::Wall)
139{ 137{
140 if ((x >= 0) && (x < w) && (y >= 0) && (y < h) && (map.tiles[x+w*y] == val)) 138 if ((x >= 0) && (x < w) && (y >= 0) && (y < h) && (map.tiles[x+w*y] == val))
141 { 139 {
@@ -170,7 +168,7 @@ void tick(Map& map, int x1 = 0, int y1 = 0, int x2 = VIEW_WIDTH, int y2 = VIEW_H
170 168
171 if (count >= 5) 169 if (count >= 5)
172 { 170 {
173 temp[x+VIEW_WIDTH*y] = Tile::Dark; 171 temp[x+VIEW_WIDTH*y] = Tile::Wall;
174 } else { 172 } else {
175 temp[x+VIEW_WIDTH*y] = Tile::Floor; 173 temp[x+VIEW_WIDTH*y] = Tile::Floor;
176 } 174 }
@@ -216,7 +214,7 @@ void recalculateLighting(Map& map, fov_settings_type* fov)
216 x < VIEW_WIDTH && 214 x < VIEW_WIDTH &&
217 y >= 0 && 215 y >= 0 &&
218 y < VIEW_HEIGHT && 216 y < VIEW_HEIGHT &&
219 static_cast<Map*>(map)->tiles.at(x+VIEW_WIDTH*y) == Tile::Dark; 217 static_cast<Map*>(map)->tiles.at(x+VIEW_WIDTH*y) == Tile::Wall;
220 }); 218 });
221 219
222 fov_settings_set_apply_lighting_function( 220 fov_settings_set_apply_lighting_function(
@@ -317,7 +315,7 @@ int main(int, char**)
317 { 315 {
318 if (std::bernoulli_distribution(0.5)(rng)) 316 if (std::bernoulli_distribution(0.5)(rng))
319 { 317 {
320 map.tiles[x+y*VIEW_WIDTH] = Tile::Dark; 318 map.tiles[x+y*VIEW_WIDTH] = Tile::Wall;
321 } 319 }
322 } 320 }
323 } 321 }
@@ -388,7 +386,7 @@ int main(int, char**)
388 x < VIEW_WIDTH && 386 x < VIEW_WIDTH &&
389 y >= 0 && 387 y >= 0 &&
390 y < VIEW_HEIGHT && 388 y < VIEW_HEIGHT &&
391 static_cast<Map*>(map)->tiles.at(x+VIEW_WIDTH*y) == Tile::Dark; 389 static_cast<Map*>(map)->tiles.at(x+VIEW_WIDTH*y) == Tile::Wall;
392 }); 390 });
393 391
394 fov_settings_set_apply_lighting_function( 392 fov_settings_set_apply_lighting_function(