Fixed up the map generator so that it's placing entities in non-overlapping tiles and adapting the style for the size. It can also deal with maps that have no rooms better and places the stairs better.

This commit is contained in:
Zed A. Shaw 2025-05-22 12:24:59 -04:00
parent 5f1a453fb4
commit 4eaf3c35d6
11 changed files with 55 additions and 45 deletions

View file

@ -152,11 +152,11 @@ namespace gui {
try_move(1, true);
break;
case ROTATE_LEFT:
$main_ui.plan_rotate(-1);
$main_ui.plan_rotate(-1, 0.5f);
state(State::ROTATING);
break;
case ROTATE_RIGHT:
$main_ui.plan_rotate(1);
$main_ui.plan_rotate(1, 0.5f);
state(State::ROTATING);
break;
case MAP_OPEN:
@ -356,7 +356,7 @@ namespace gui {
if($map_open) {
$map_ui.render($window, $main_ui.$compass_dir);
} else {
// $mini_map.render($window, $main_ui.$compass_dir);
$mini_map.render($window, $main_ui.$compass_dir);
}
}
}

View file

@ -77,10 +77,11 @@ namespace gui {
}
}
void MainUI::plan_rotate(int dir) {
void MainUI::plan_rotate(int dir, float amount) {
// -1 is left, 1 is right
$compass_dir = ($compass_dir + dir) % COMPASS.size();
$camera.plan_rotate(dir);
int extra = (amount == 0.5) * dir;
$compass_dir = ($compass_dir + dir + extra) % COMPASS.size();
$camera.plan_rotate(dir, amount);
}
Point MainUI::plan_move(int dir, bool strafe) {

View file

@ -29,7 +29,7 @@ namespace gui {
void debug();
void render_debug();
void plan_rotate(int dir);
void plan_rotate(int dir, float amount=0.5f);
bool play_rotate();
std::optional<Point> play_move();
Point plan_move(int dir, bool strafe);