// map.cpp
void Map::drawLight(const LightInfo& lightInfo) {
for (const auto& tile : tiles) {
if (tile->allowsLightToPass()) {
// Draw light on the current floor
drawTileLight(tile, lightInfo);
// Draw light on the floor below
Position belowPos = tile->getPosition();
belowPos.z += 1;
Tile* belowTile = getTile(belowPos);
if (belowTile) {
drawTileLight(belowTile, lightInfo);
}
}
}
}
void Map::drawTileLight(Tile* tile, const LightInfo& lightInfo) {
// Custom drawing logic for a tile
if (!tile) return;
// Determine the light intensity and color
int lightLevel = lightInfo.level;
int lightColor = lightInfo.color;
// Adjust light based on the position and level
int x = tile->getPosition().x;
int y = tile->getPosition().y;
int z = tile->getPosition().z;
// Draw the light
g_drawLight(x, y, z, lightLevel, lightColor);
}