Simple styling of the rooms done.

master
Zed A. Shaw 6 days ago
parent 5cb74151f5
commit af2947c50a
  1. 2
      assets/tiles.json
  2. 4
      map.cpp
  3. 3
      map.hpp
  4. 12
      worldbuilder.cpp
  5. 1
      worldbuilder.hpp

@ -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",

@ -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{{

@ -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…
Cancel
Save