* Animates the window with a palette effect. */
| 662 | * Animates the window with a palette effect. |
| 663 | */ |
| 664 | void DogfightState::animate() |
| 665 | { |
| 666 | if(_minimized) |
| 667 | { |
| 668 | return; |
| 669 | } |
| 670 | // Animate radar waves and other stuff. |
| 671 | for(int x = 0; x < _window->getWidth(); ++x) |
| 672 | { |
| 673 | for(int y = 0; y < _window->getHeight(); ++y) |
| 674 | { |
| 675 | Uint8 radarPixelColor = _window->getPixel(x, y); |
| 676 | if(radarPixelColor >= Palette::blockOffset(7) && radarPixelColor < Palette::blockOffset(7) + 16) |
| 677 | { |
| 678 | ++radarPixelColor; |
| 679 | if(radarPixelColor >= Palette::blockOffset(7) + 16) |
| 680 | { |
| 681 | radarPixelColor = Palette::blockOffset(7); |
| 682 | } |
| 683 | _window->setPixel(x, y, radarPixelColor); |
| 684 | } |
| 685 | } |
| 686 | } |
| 687 | |
| 688 | _battle->clear(); |
| 689 | |
| 690 | // Draw UFO. |
| 691 | if(!_ufo->isDestroyed()) |
| 692 | { |
| 693 | drawUfo(); |
| 694 | } |
| 695 | |
| 696 | // Draw projectiles. |
| 697 | for(std::vector<CraftWeaponProjectile*>::iterator it = _projectiles.begin(); it != _projectiles.end(); ++it) |
| 698 | { |
| 699 | drawProjectile((*it)); |
| 700 | } |
| 701 | |
| 702 | // Clears text after a while |
| 703 | if (_timeout == 0) |
| 704 | { |
| 705 | _txtStatus->setText(L""); |
| 706 | } |
| 707 | else |
| 708 | { |
| 709 | _timeout--; |
| 710 | } |
| 711 | |
| 712 | // Animate UFO hit. |
| 713 | bool lastHitAnimFrame = false; |
| 714 | if(_animatingHit && _ufo->getHitFrame() > 0) |
| 715 | { |
| 716 | _ufo->setHitFrame(_ufo->getHitFrame() - 1); |
| 717 | if(_ufo->getHitFrame() == 0) |
| 718 | { |
| 719 | _animatingHit = false; |
| 720 | lastHitAnimFrame = true; |
| 721 | } |
nothing calls this directly
no test coverage detected