MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / DoVision

Function DoVision

Source/lighting.cpp:284–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282}
283
284void 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
320void MakeLightTable()
321{

Callers 3

ProcessVisionListFunction · 0.85
DiabloDeathFunction · 0.85
InitMonstersFunction · 0.85

Calls 4

DoVisionFlagsFunction · 0.85
InDungeonBoundsFunction · 0.85
TileHasAnyFunction · 0.85
TileAllowsLightFunction · 0.85

Tested by

no test coverage detected