Simple styling of the rooms done.
This commit is contained in:
parent
5cb74151f5
commit
af2947c50a
5 changed files with 16 additions and 6 deletions
|
@ -21,7 +21,7 @@
|
||||||
"background": [230, 20, 120],
|
"background": [230, 20, 120],
|
||||||
"collision": true,
|
"collision": true,
|
||||||
"display": 8820,
|
"display": 8820,
|
||||||
"id": 3
|
"id": 2
|
||||||
},
|
},
|
||||||
"WALL_VINES": {
|
"WALL_VINES": {
|
||||||
"texture": "assets/wall_with_vines-256.png",
|
"texture": "assets/wall_with_vines-256.png",
|
||||||
|
|
4
map.cpp
4
map.cpp
|
@ -146,10 +146,6 @@ void Map::init_tiles() {
|
||||||
$tiles = $walls;
|
$tiles = $walls;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix& Map::tiles() {
|
|
||||||
return $walls;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Map::enclose() {
|
void Map::enclose() {
|
||||||
// wraps the outside edge with solid walls
|
// wraps the outside edge with solid walls
|
||||||
std::array<Point, 4> starts{{
|
std::array<Point, 4> starts{{
|
||||||
|
|
3
map.hpp
3
map.hpp
|
@ -37,6 +37,8 @@ public:
|
||||||
Matrix& paths() { return $paths.paths(); }
|
Matrix& paths() { return $paths.paths(); }
|
||||||
Matrix& input_map() { return $paths.input(); }
|
Matrix& input_map() { return $paths.input(); }
|
||||||
Matrix& walls() { return $walls; }
|
Matrix& walls() { return $walls; }
|
||||||
|
Matrix& tiles() { return $tiles; }
|
||||||
|
std::vector<Room>& rooms() { return $rooms; }
|
||||||
size_t width() { return $width; }
|
size_t width() { return $width; }
|
||||||
size_t height() { return $height; }
|
size_t height() { return $height; }
|
||||||
int distance(Point to) { return $paths.distance(to); }
|
int distance(Point to) { return $paths.distance(to); }
|
||||||
|
@ -64,7 +66,6 @@ public:
|
||||||
bool INVARIANT();
|
bool INVARIANT();
|
||||||
|
|
||||||
void init_tiles();
|
void init_tiles();
|
||||||
Matrix& tiles();
|
|
||||||
void add_room(Room &room);
|
void add_room(Room &room);
|
||||||
void invert_space();
|
void invert_space();
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,6 +21,16 @@ void big_donut() {
|
||||||
// maze.hunt_and_kill({11,11});
|
// maze.hunt_and_kill({11,11});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldBuilder::stylize_rooms() {
|
||||||
|
auto& tiles = $map.tiles();
|
||||||
|
|
||||||
|
for(auto& room : $map.rooms()) {
|
||||||
|
for(matrix::box it{tiles, room.x, room.y, room.width+1, room.height+1}; it.next();) {
|
||||||
|
if(tiles[it.y][it.x] == 1) tiles[it.y][it.x] = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WorldBuilder::generate_map() {
|
void WorldBuilder::generate_map() {
|
||||||
maze::Builder maze($map);
|
maze::Builder maze($map);
|
||||||
|
|
||||||
|
@ -37,6 +47,8 @@ void WorldBuilder::generate_map() {
|
||||||
|
|
||||||
$map.enclose();
|
$map.enclose();
|
||||||
$map.init_tiles();
|
$map.init_tiles();
|
||||||
|
|
||||||
|
stylize_rooms();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WorldBuilder::find_open_spot(Point& pos_out) {
|
bool WorldBuilder::find_open_spot(Point& pos_out) {
|
||||||
|
|
|
@ -28,4 +28,5 @@ class WorldBuilder {
|
||||||
void randomize_entities(DinkyECS::World &world, components::GameConfig &config);
|
void randomize_entities(DinkyECS::World &world, components::GameConfig &config);
|
||||||
void place_stairs(DinkyECS::World& world, components::GameConfig& config);
|
void place_stairs(DinkyECS::World& world, components::GameConfig& config);
|
||||||
void configure_starting_items(DinkyECS::World &world);
|
void configure_starting_items(DinkyECS::World &world);
|
||||||
|
void stylize_rooms();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue