| 510 | } |
| 511 | |
| 512 | void DoLighting(int nXPos, int nYPos, int nRadius, int Lnum) |
| 513 | { |
| 514 | int x, y, v, xoff, yoff, mult, radius_block; |
| 515 | int min_x, max_x, min_y, max_y; |
| 516 | int dist_x, dist_y, light_x, light_y, block_x, block_y, temp_x, temp_y; |
| 517 | |
| 518 | xoff = 0; |
| 519 | yoff = 0; |
| 520 | light_x = 0; |
| 521 | light_y = 0; |
| 522 | block_x = 0; |
| 523 | block_y = 0; |
| 524 | |
| 525 | if (Lnum >= 0) { |
| 526 | xoff = LightList[Lnum]._xoff; |
| 527 | yoff = LightList[Lnum]._yoff; |
| 528 | if (xoff < 0) { |
| 529 | xoff += 8; |
| 530 | nXPos--; |
| 531 | } |
| 532 | if (yoff < 0) { |
| 533 | yoff += 8; |
| 534 | nYPos--; |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | dist_x = xoff; |
| 539 | dist_y = yoff; |
| 540 | |
| 541 | if (nXPos - 15 < 0) { |
| 542 | min_x = nXPos + 1; |
| 543 | } else { |
| 544 | min_x = 15; |
| 545 | } |
| 546 | if (nXPos + 15 > MAXDUNX) { |
| 547 | max_x = MAXDUNX - nXPos; |
| 548 | } else { |
| 549 | max_x = 15; |
| 550 | } |
| 551 | if (nYPos - 15 < 0) { |
| 552 | min_y = nYPos + 1; |
| 553 | } else { |
| 554 | min_y = 15; |
| 555 | } |
| 556 | if (nYPos + 15 > MAXDUNY) { |
| 557 | max_y = MAXDUNY - nYPos; |
| 558 | } else { |
| 559 | max_y = 15; |
| 560 | } |
| 561 | |
| 562 | if (nXPos >= 0 && nXPos < MAXDUNX && nYPos >= 0 && nYPos < MAXDUNY) { |
| 563 | dLight[nXPos][nYPos] = 0; |
| 564 | } |
| 565 | |
| 566 | mult = xoff + 8 * yoff; |
| 567 | for (y = 0; y < min_y; y++) { |
| 568 | for (x = 1; x < max_x; x++) { |
| 569 | radius_block = lightblock[mult][y][x]; |
no test coverage detected