Vast improvement in the world generation, with more reliable pathing, cleaner generation code, and an ability to do a random or direct walk to create paths. This also works with enemies if I want.
This commit is contained in:
parent
c7607533ce
commit
0b4392dbcc
7 changed files with 151 additions and 77 deletions
7
map.hpp
7
map.hpp
|
@ -19,6 +19,7 @@
|
|||
using lighting::LightSource;
|
||||
|
||||
struct Room {
|
||||
int depth;
|
||||
size_t x = 0;
|
||||
size_t y = 0;
|
||||
size_t width = 0;
|
||||
|
@ -29,7 +30,7 @@ struct Room {
|
|||
DEFINE_SERIALIZABLE(Room, x, y, width, height);
|
||||
};
|
||||
|
||||
void dump_map(const std::string &msg, Matrix &map);
|
||||
void dump_map(const std::string &msg, Matrix &map, int show_x=-1, int show_y=-1);
|
||||
|
||||
class Map {
|
||||
public:
|
||||
|
@ -62,7 +63,7 @@ public:
|
|||
bool inmap(size_t x, size_t y);
|
||||
bool iswall(size_t x, size_t y);
|
||||
bool can_move(Point move_to);
|
||||
bool neighbors(Point &out, bool up);
|
||||
bool neighbors(Point &out, bool random=false);
|
||||
|
||||
void make_paths();
|
||||
void set_target(const Point &at, int value=0);
|
||||
|
@ -71,6 +72,6 @@ public:
|
|||
Point map_to_camera(const Point &loc, const Point &cam_orig);
|
||||
Point center_camera(const Point &around, size_t view_x, size_t view_y);
|
||||
|
||||
void dump();
|
||||
void dump(int show_x=-1, int show_y=-1);
|
||||
bool INVARIANT();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue