diff -ur ScummVM-cvs20020821/scummvm/gfx.cpp ScummVM-cvs20020821+hack/scummvm/gfx.cpp
old
|
new
|
|
643 | 643 | |
644 | 644 | blit(flashBuffer, bgbak, flashW*8, flashH); |
645 | 645 | |
646 | | // TODO - flashlight should have round corners |
| 646 | // Round the corners. This may need some tuning. I have no idea how |
| 647 | // the original interpreters did it. |
647 | 648 | |
| 649 | int r = (_flashlightXStrips < _flashlightYStrips) ? |
| 650 | _flashlightXStrips : _flashlightYStrips; |
| 651 | |
| 652 | if (r > 0) { |
| 653 | // At first I thought I could do this by using the Pythagorean |
| 654 | // relation to draw circles, but the code got pretty ugly, and |
| 655 | // the results were even worse. Rounding errors, I guess. |
| 656 | // |
| 657 | // Instead, we hard-code a set of nicely rounded corners. |
| 658 | |
| 659 | int corner_data[] = { |
| 660 | 1, |
| 661 | 2, 1, |
| 662 | 3, 2, 1, |
| 663 | 4, 2, 1, 1, |
| 664 | 5, 3, 2, 1, 1, |
| 665 | 6, 4, 3, 2, 1, 1, |
| 666 | 7, 5, 4, 3, 2, 1, 1, |
| 667 | 8, 6, 4, 3, 2, 2, 1, 1 |
| 668 | }; |
| 669 | |
| 670 | if (r > 8) |
| 671 | r = 8; |
| 672 | |
| 673 | int *ptr = &corner_data[(r * (r - 1)) / 2]; |
| 674 | |
| 675 | for (i = 0; i < r; i++) { |
| 676 | int minrow = i * 320; |
| 677 | int maxrow = (flashH - i - 1) * 320; |
| 678 | int maxcol = flashW * 8 - 1; |
| 679 | int d = ptr[i]; |
| 680 | |
| 681 | for (j = 0; j < d; j++) { |
| 682 | flashBuffer[minrow + j] = 0; |
| 683 | flashBuffer[minrow + maxcol - j] = 0; |
| 684 | flashBuffer[maxrow + j] = 0; |
| 685 | flashBuffer[maxrow + maxcol - j] = 0; |
| 686 | } |
| 687 | } |
| 688 | } |
| 689 | |
648 | 690 | _flashlightIsDrawn = true; |
649 | 691 | } |
650 | 692 | |