| 282 | } |
| 283 | |
| 284 | void DoVision(Point position, uint8_t radius, MapExplorationType doAutomap, bool visible) |
| 285 | { |
| 286 | DoVisionFlags(position, doAutomap, visible); |
| 287 | |
| 288 | static const Displacement factors[] = { { 1, 1 }, { -1, 1 }, { 1, -1 }, { -1, -1 } }; |
| 289 | for (auto factor : factors) { |
| 290 | for (int j = 0; j < 23; j++) { |
| 291 | int lineLen = radius - RadiusAdj[j]; |
| 292 | for (int k = 0; k < lineLen; k++) { |
| 293 | Point crawl = position + VisionCrawlTable[j][k] * factor; |
| 294 | if (!InDungeonBounds(crawl)) |
| 295 | break; |
| 296 | bool blockerFlag = TileHasAny(dPiece[crawl.x][crawl.y], TileProperties::BlockLight); |
| 297 | bool tileOK = !blockerFlag; |
| 298 | |
| 299 | if (VisionCrawlTable[j][k].deltaX > 0 && VisionCrawlTable[j][k].deltaY > 0) { |
| 300 | tileOK = tileOK || TileAllowsLight(crawl + Displacement { -factor.deltaX, 0 }); |
| 301 | tileOK = tileOK || TileAllowsLight(crawl + Displacement { 0, -factor.deltaY }); |
| 302 | } |
| 303 | |
| 304 | if (!tileOK) |
| 305 | break; |
| 306 | |
| 307 | DoVisionFlags(crawl, doAutomap, visible); |
| 308 | |
| 309 | if (blockerFlag) |
| 310 | break; |
| 311 | |
| 312 | int8_t trans = dTransVal[crawl.x][crawl.y]; |
| 313 | if (trans != 0) |
| 314 | TransList[trans] = true; |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | void MakeLightTable() |
| 321 | { |
no test coverage detected