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

Method draw

src/Battlescape/ScannerView.cpp:50–86  ·  view source on GitHub ↗

* Draws the ScannerView view. */

Source from the content-addressed store, hash-verified

48 * Draws the ScannerView view.
49 */
50void ScannerView::draw()
51{
52 SurfaceSet *set = _game->getResourcePack()->getSurfaceSet("DETBLOB.DAT");
53 Surface *surface = 0;
54
55 clear();
56
57 this->lock();
58 for (int x = -9; x < 10; x++)
59 {
60 for (int y = -9; y < 10; y++)
61 {
62 for (int z = 0; z < _game->getSavedGame()->getSavedBattle()->getMapSizeZ(); z++)
63 {
64 Tile *t = _game->getSavedGame()->getSavedBattle()->getTile(Position(x,y,z) + Position(_unit->getPosition().x, _unit->getPosition().y, 0));
65 if (t && t->getUnit() && t->getUnit()->getMotionPoints())
66 {
67 int frame = (t->getUnit()->getMotionPoints() / 5);
68 if (frame >= 0)
69 {
70 if (frame > 5) frame = 5;
71 surface = set->getFrame(frame + _frame);
72 surface->blitNShade(this, Surface::getX()+((9+x)*8)-4, Surface::getY()+((9+y)*8)-4, 0);
73 }
74 }
75 }
76 }
77 }
78
79 // the arrow of the direction the unit is pointed
80 surface = set->getFrame(7 + _unit->getDirection());
81
82 surface->blitNShade(this, Surface::getX()+(9*8)-4, Surface::getY()+(9*8)-4, 0);
83 this->unlock();
84
85
86}
87
88/**
89 * Handles clicks on the scanner view.

Callers

nothing calls this directly

Calls 15

getSurfaceSetMethod · 0.80
getMapSizeZMethod · 0.80
getSavedBattleMethod · 0.80
getSavedGameMethod · 0.80
getMotionPointsMethod · 0.80
getFrameMethod · 0.80
blitNShadeMethod · 0.80
unlockMethod · 0.80
PositionClass · 0.70
getResourcePackMethod · 0.45
lockMethod · 0.45
getTileMethod · 0.45

Tested by

no test coverage detected