Fog of War now works fairly normally, but I think I'll have to do something so people don't live in the map. Probably something like hearing distance is increased because you're louder with a map out, and you can't see enemies on the map.

This commit is contained in:
Zed A. Shaw 2025-07-21 23:21:24 -04:00
parent 2997dc363b
commit 6f91533950
6 changed files with 19 additions and 11 deletions

View file

@ -36,9 +36,14 @@ void System::lighting(GameLevel &level) {
light.path_light(map.walls());
world.query<Position, LightSource>([&](auto, auto &position, auto &lightsource) {
world.query<Position, LightSource>([&](auto ent, auto &position, auto &lightsource) {
light.render_light(lightsource, position.location);
if(ent == level.player) {
light.update_fow(position.location, lightsource);
}
});
}
void System::generate_paths(GameLevel &level) {
@ -572,15 +577,12 @@ void System::draw_map(GameLevel& level, Matrix& grid, EntityGrid& entity_map) {
});
}
void System::render_map(GameLevel& level, Matrix& tiles, EntityGrid& entity_map, sf::RenderTexture& render, int compass_dir, wchar_t player_display) {
void System::render_map(Matrix& tiles, EntityGrid& entity_map, sf::RenderTexture& render, int compass_dir, wchar_t player_display) {
sf::Vector2i tile_sprite_dim{MAP_TILE_DIM,MAP_TILE_DIM};
unsigned int width = matrix::width(tiles);
unsigned int height = matrix::height(tiles);
sf::Vector2u dim{width * tile_sprite_dim.x, height * tile_sprite_dim.y};
auto render_size = render.getSize();
Matrix &fow = level.lights->$fow;
(void)level;
(void)fow;
if(render_size.x != width || render_size.y != height) {
bool worked = render.resize(dim);