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

Method draw

src/Battlescape/Map.cpp:164–204  ·  view source on GitHub ↗

* Draws the whole map, part by part. */

Source from the content-addressed store, hash-verified

162 * Draws the whole map, part by part.
163 */
164void Map::draw()
165{
166 if (!_redraw)
167 {
168 return;
169 }
170 Surface::draw();
171 Tile *t;
172
173 _projectileInFOV = _save->getDebugMode();
174 if (_projectile)
175 {
176 t = _save->getTile(Position(_projectile->getPosition(0).x/16, _projectile->getPosition(0).y/16, _projectile->getPosition(0).z/24));
177 if (_save->getSide() == FACTION_PLAYER || (t && t->getVisible()))
178 {
179 _projectileInFOV = true;
180 }
181 }
182 _explosionInFOV = _save->getDebugMode();
183 if (!_explosions.empty())
184 {
185 for (std::list<Explosion*>::iterator i = _explosions.begin(); i != _explosions.end(); ++i)
186 {
187 t = _save->getTile(Position((*i)->getPosition().x/16, (*i)->getPosition().y/16, (*i)->getPosition().z/24));
188 if (t && ((*i)->isBig() || t->getVisible()))
189 {
190 _explosionInFOV = true;
191 break;
192 }
193 }
194 }
195
196 if ((_save->getSelectedUnit() && _save->getSelectedUnit()->getVisible()) || _unitDying || _save->getSelectedUnit() == 0 || _save->getDebugMode() || _projectileInFOV || _explosionInFOV)
197 {
198 drawTerrain(this);
199 }
200 else
201 {
202 _message->blit(this);
203 }
204}
205
206/**
207 * Replaces a certain amount of colors in the surface's palette.

Callers 10

drawTerrainMethod · 0.45
InventoryStateMethod · 0.45
MiniMapStateMethod · 0.45
upMethod · 0.45
downMethod · 0.45
setViewLevelMethod · 0.45
centerOnPositionMethod · 0.45
initMethod · 0.45
btnLeftHandItemClickMethod · 0.45
btnRightHandItemClickMethod · 0.45

Calls 10

getSideMethod · 0.80
isBigMethod · 0.80
getSelectedUnitMethod · 0.80
PositionClass · 0.70
getDebugModeMethod · 0.45
getTileMethod · 0.45
getPositionMethod · 0.45
getVisibleMethod · 0.45
emptyMethod · 0.45
blitMethod · 0.45

Tested by

no test coverage detected