MCPcopy Create free account
hub / github.com/assaultcube/AC / preparedynlight

Function preparedynlight

source/src/worldlight.cpp:243–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243void preparedynlight(dlight &d)
244{
245 block area = { (int)d.o.x-d.reach, (int)d.o.y-d.reach, d.reach*2+1, d.reach*2+1 };
246
247 if(area.x<1) { area.xs = max(area.xs - (1 - area.x), 0); area.x = 1; }
248 else if(area.x>ssize-2) { area.x = ssize-2; area.xs = 0; }
249 if(area.y<1) { area.ys = max(area.ys - (1 - area.y), 0); area.y = 1; }
250 else if(area.y>ssize-2) { area.y = ssize-2; area.ys = 0; }
251 if(area.x+area.xs>ssize-2) area.xs = ssize-2-area.x;
252 if(area.y+area.ys>ssize-2) area.ys = ssize-2-area.y;
253
254 if(d.area)
255 {
256 if(insidearea(*d.area, area)) return;
257
258 freeblock(d.area);
259 }
260 d.area = blockcopy(area); // backup area before rendering in dynlight
261}
262
263void adddynlight(physent *owner, const vec &o, int reach, int expire, int fade, uchar r, uchar g, uchar b)
264{

Callers 2

adddynlightFunction · 0.85
loopvFunction · 0.85

Calls 4

maxFunction · 0.85
insideareaFunction · 0.85
freeblockFunction · 0.85
blockcopyFunction · 0.85

Tested by

no test coverage detected