| 241 | } |
| 242 | |
| 243 | void 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 | |
| 263 | void adddynlight(physent *owner, const vec &o, int reach, int expire, int fade, uchar r, uchar g, uchar b) |
| 264 | { |
no test coverage detected