|
|
|
@ -337,7 +337,7 @@ void System::plan_motion(DinkyECS::World& world, Point move_to) { |
|
|
|
|
* 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, Point aim) { |
|
|
|
|
std::wstring System::draw_map(GameLevel level, size_t view_x, size_t view_y, int compass_dir) { |
|
|
|
|
DinkyECS::World &world = *level.world; |
|
|
|
|
Map &map = *level.map; |
|
|
|
|
|
|
|
|
@ -361,19 +361,17 @@ std::wstring System::draw_map(GameLevel level, size_t view_x, size_t view_y, Poi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(aim.x >= cam_orig.x && aim.x <= cam_orig.x + view_x |
|
|
|
|
&& aim.y >= cam_orig.y && aim.y <= cam_orig.y + view_y) |
|
|
|
|
{ |
|
|
|
|
Point aim_at = map.map_to_camera(aim, cam_orig); |
|
|
|
|
grid[aim_at.y][aim_at.x] = '*'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// then get the enemy/item/device tiles and fill those in
|
|
|
|
|
world.query<Position, Tile>([&](auto, auto &pos, auto &entity_glyph) { |
|
|
|
|
world.query<Position, Tile>([&](auto ent, auto &pos, auto &entity_glyph) { |
|
|
|
|
if(pos.location.x >= cam_orig.x && pos.location.x <= cam_orig.x + view_x |
|
|
|
|
&& pos.location.y >= cam_orig.y && pos.location.y <= cam_orig.y + view_y) { |
|
|
|
|
Point view_pos = map.map_to_camera(pos.location, cam_orig); |
|
|
|
|
grid[view_pos.y][view_pos.x] = entity_glyph.display; |
|
|
|
|
|
|
|
|
|
if(ent == level.player) { |
|
|
|
|
grid[view_pos.y][view_pos.x] = COMPASS[compass_dir][0]; |
|
|
|
|
} else { |
|
|
|
|
grid[view_pos.y][view_pos.x] = entity_glyph.display; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|