|
|
|
@ -407,22 +407,17 @@ void System::plan_motion(World& world, Position move_to) { |
|
|
|
|
motion.dy = move_to.location.y - player_position.location.y; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This one is called inside the MapViewUI very often so |
|
|
|
|
* just avoid GameMap unlike the others. |
|
|
|
|
*/ |
|
|
|
|
std::wstring System::draw_map(GameLevel& level, size_t view_x, size_t view_y, int compass_dir) { |
|
|
|
|
void System::draw_map(GameLevel& level, Matrix& grid, int compass_dir) { |
|
|
|
|
World &world = *level.world; |
|
|
|
|
Map &map = *level.map; |
|
|
|
|
size_t view_x = matrix::width(grid); |
|
|
|
|
size_t view_y = matrix::height(grid); |
|
|
|
|
|
|
|
|
|
auto player_pos = world.get<Position>(level.player).location; |
|
|
|
|
Point cam_orig = map.center_camera(player_pos, view_x, view_y); |
|
|
|
|
auto &tiles = map.tiles(); |
|
|
|
|
auto &tile_set = textures::get_map_tile_set(); |
|
|
|
|
|
|
|
|
|
// make a grid of chars to work with
|
|
|
|
|
auto grid = shiterator::make<wchar_t>(view_x+1, view_y+1); |
|
|
|
|
|
|
|
|
|
// first fill it with the map cells
|
|
|
|
|
for(shiterator::each_cell_t it{grid}; it.next();) { |
|
|
|
|
size_t tile_y = size_t(it.y) + cam_orig.y; |
|
|
|
@ -449,16 +444,6 @@ std::wstring System::draw_map(GameLevel& level, size_t view_x, size_t view_y, in |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// then generate the string to display, but this goes away soon
|
|
|
|
|
std::wstring result; |
|
|
|
|
|
|
|
|
|
for(shiterator::each_row_t it{grid}; it.next();) { |
|
|
|
|
result += grid[it.y][it.x]; |
|
|
|
|
if(it.row) result += '\n'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void System::player_status(GameLevel &level) { |
|
|
|
|