MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / drawUfo

Method drawUfo

src/Geoscape/DogfightState.cpp:1465–1498  ·  view source on GitHub ↗

* Draws the UFO blob on the radar screen. * Currently works only for original sized blobs * 13 x 13 pixels. */

Source from the content-addressed store, hash-verified

1463 * 13 x 13 pixels.
1464 */
1465void DogfightState::drawUfo()
1466{
1467 if(_ufoSize < 0 || _ufo->isDestroyed() || _minimized)
1468 {
1469 return;
1470 }
1471 int currentUfoXposition = _battle->getWidth() / 2 - 6;
1472 int currentUfoYposition = _battle->getHeight() - (_currentDist / 8) - 6;
1473 for(int y = 0; y < 13; ++y)
1474 {
1475 for(int x = 0; x < 13; ++x)
1476 {
1477 Uint8 pixelOffset = _ufoBlobs[_ufoSize + _ufo->getHitFrame()][y][x];
1478 if(pixelOffset == 0)
1479 {
1480 continue;
1481 }
1482 else
1483 {
1484 if(_ufo->isCrashed() || _ufo->getHitFrame() > 0)
1485 {
1486 pixelOffset *= 2;
1487 }
1488 Uint8 radarPixelColor = _window->getPixel(currentUfoXposition + x + 3, currentUfoYposition + y + 3); // + 3 cause of the window frame
1489 Uint8 color = radarPixelColor - pixelOffset;
1490 if(color < 108)
1491 {
1492 color = 108;
1493 }
1494 _battle->setPixel(currentUfoXposition + x, currentUfoYposition + y, color);
1495 }
1496 }
1497 }
1498}
1499
1500/*
1501 * Draws projectiles on the radar screen.

Callers

nothing calls this directly

Calls 7

getHitFrameMethod · 0.80
isCrashedMethod · 0.80
getPixelMethod · 0.80
setPixelMethod · 0.80
isDestroyedMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected