Did a full code coverage review and improved many of the tests and a bunch of code. I'll do one more final walk through all the code before getting back to work on the new combat system.

This commit is contained in:
Zed A. Shaw 2025-03-17 15:23:47 -04:00
parent 113a4a3b3e
commit d3158291f7
29 changed files with 119 additions and 1218 deletions

View file

@ -16,7 +16,6 @@ using std::string;
using namespace fmt;
using namespace components;
using lighting::LightSource;
using ftxui::Color;
void System::lighting(GameLevel &level) {
auto &light = *level.lights;
@ -331,11 +330,9 @@ void System::plan_motion(DinkyECS::World& world, Point move_to) {
/*
* This one is called inside the MapViewUI very often so
* just avoide GameMap unlike the others.
*
* BUG: Just get rid of this and use the new UI to do the map
* just avoid GameMap unlike the others.
*/
void System::draw_entities(DinkyECS::World &world, Map &map, const Matrix &lights, ftxui::Canvas &canvas, const Point &cam_orig, size_t view_x, size_t view_y) {
void System::draw_entities(DinkyECS::World &world, Map &map, const Matrix &lights, const Point &cam_orig, size_t view_x, size_t view_y) {
auto &tiles = map.tiles();
world.query<Position, Tile>([&](auto, auto &pos, auto &tile) {
@ -346,11 +343,10 @@ void System::draw_entities(DinkyECS::World &world, Map &map, const Matrix &light
float light_value = lights[pos.location.y][pos.location.x] * PERCENT;
const Tile& cell = tiles.at(pos.location.x, pos.location.y);
// the 2 and 4 are from ftxui::Canvas since it does a kind of "subpixel" drawing
canvas.DrawText(loc.x*2, loc.y*4, tile.display, [tile, light_value, cell](auto &pixel) {
pixel.foreground_color = Color::HSV(tile.foreground[0], tile.foreground[1], tile.foreground[2] * light_value);
pixel.background_color = Color::HSV(cell.background[0], cell.background[1], cell.background[2] * light_value);
});
(void)loc; // not used yet, this after ripping out map so needs rewrite
(void)light_value;
(void)cell;
(void)tile;
}
});
}