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],
|
||||
"collision": true,
|
||||
"display": 8820,
|
||||
"id": 3
|
||||
"id": 2
|
||||
},
|
||||
"WALL_VINES": {
|
||||
"texture": "assets/wall_with_vines-256.png",
|
||||
|
|
4
map.cpp
4
map.cpp
|
@ -146,10 +146,6 @@ void Map::init_tiles() {
|
|||
$tiles = $walls;
|
||||
}
|
||||
|
||||
Matrix& Map::tiles() {
|
||||
return $walls;
|
||||
}
|
||||
|
||||
void Map::enclose() {
|
||||
// wraps the outside edge with solid walls
|
||||
std::array<Point, 4> starts{{
|
||||
|
|
3
map.hpp
3
map.hpp
|
@ -37,6 +37,8 @@ public:
|
|||
Matrix& paths() { return $paths.paths(); }
|
||||
Matrix& input_map() { return $paths.input(); }
|
||||
Matrix& walls() { return $walls; }
|
||||
Matrix& tiles() { return $tiles; }
|
||||
std::vector<Room>& rooms() { return $rooms; }
|
||||
size_t width() { return $width; }
|
||||
size_t height() { return $height; }
|
||||
int distance(Point to) { return $paths.distance(to); }
|
||||
|
@ -64,7 +66,6 @@ public:
|
|||
bool INVARIANT();
|
||||
|
||||
void init_tiles();
|
||||
Matrix& tiles();
|
||||
void add_room(Room &room);
|
||||
void invert_space();
|
||||
};
|
||||
|
|
|
@ -21,6 +21,16 @@ void big_donut() {
|
|||
// 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() {
|
||||
maze::Builder maze($map);
|
||||
|
||||
|
@ -37,6 +47,8 @@ void WorldBuilder::generate_map() {
|
|||
|
||||
$map.enclose();
|
||||
$map.init_tiles();
|
||||
|
||||
stylize_rooms();
|
||||
}
|
||||
|
||||
bool WorldBuilder::find_open_spot(Point& pos_out) {
|
||||
|
|
|
@ -28,4 +28,5 @@ class WorldBuilder {
|
|||
void randomize_entities(DinkyECS::World &world, components::GameConfig &config);
|
||||
void place_stairs(DinkyECS::World& world, components::GameConfig& config);
|
||||
void configure_starting_items(DinkyECS::World &world);
|
||||
void stylize_rooms();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue