Have a little debug minimap in the top right when autowalking with debug on.

master
Zed A. Shaw 1 week ago
parent da1e38e21c
commit 11ea08bc7f
  1. 29
      autowalker.cpp
  2. 1
      autowalker.hpp

@ -130,6 +130,32 @@ void Autowalker::rotate_player(Point current, Point target) {
"player isn't facing the correct direction");
}
void Autowalker::show_map_overlay(matrix::Matrix& map, Point current) {
auto debug = fsm.$level.world->get_the<components::Debug>();
if(!debug.FPS) {
fsm.$main_ui.$overlay_ui.close_text("top_right");
return;
}
std::string map_overlay;
for(matrix::box it{map, current.x, current.y, 6}; it.next();) {
if(it.x == it.left) map_overlay += "\n";
int cell = map[it.y][it.x];
if(it.x == current.x && it.y == current.y) {
map_overlay += fmt::format("{:x}<", cell);
} else if(cell == WALL_PATH_LIMIT) {
map_overlay += fmt::format("# ");
} else if(cell > 15) {
map_overlay += fmt::format("* ");
} else {
map_overlay += fmt::format("{:x} ", cell);
}
}
fsm.$main_ui.$overlay_ui.show_text("top_right", map_overlay);
}
void Autowalker::autowalk() {
window_events();
if(!fsm.autowalking) return;
@ -159,7 +185,8 @@ void Autowalker::autowalk() {
Point current = get_current_position();
Point target = current;
matrix::dump("AUTO PATHS", paths.$paths, current.x, current.y);
show_map_overlay(paths.$paths, current);
if(!path_player(paths, target)) {
dbc::log("no paths found, aborting autowalk");

@ -24,4 +24,5 @@ struct Autowalker {
Pathing path_to_enemies();
Pathing path_to_items();
Pathing path_to_devices();
void show_map_overlay(matrix::Matrix& map, Point current);
};

Loading…
Cancel
Save