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

Method Map

src/Battlescape/Map.cpp:80–108  ·  view source on GitHub ↗

* Sets up a map with the specified size and position. * @param game Pointer to the core game. * @param width Width in pixels. * @param height Height in pixels. * @param x X position in pixels. * @param y Y position in pixels. * @param visibleMapHeight Current visible map height. */

Source from the content-addressed store, hash-verified

78 * @param visibleMapHeight Current visible map height.
79 */
80Map::Map(Game *game, int width, int height, int x, int y, int visibleMapHeight) : InteractiveSurface(width, height, x, y), _game(game), _arrow(0), _selectorX(0), _selectorY(0), _mouseX(0), _mouseY(0), _cursorType(CT_NORMAL), _cursorSize(1), _animFrame(0), _projectile(0), _projectileInFOV(false), _explosionInFOV(false), _launch(false), _visibleMapHeight(visibleMapHeight), _unitDying(false), _smoothingEngaged(false)
81{
82 _previewSetting = Options::battleNewPreviewPath;
83 _smoothCamera = Options::battleSmoothCamera;
84 if (Options::traceAI)
85 {
86 // turn everything on because we want to see the markers.
87 _previewSetting = PATH_FULL;
88 }
89 _res = _game->getResourcePack();
90 _spriteWidth = _res->getSurfaceSet("BLANKS.PCK")->getFrame(0)->getWidth();
91 _spriteHeight = _res->getSurfaceSet("BLANKS.PCK")->getFrame(0)->getHeight();
92 _save = _game->getSavedGame()->getSavedBattle();
93 _message = new BattlescapeMessage(320, (visibleMapHeight < 200)? visibleMapHeight : 200, 0, 0);
94 _message->setX(_game->getScreen()->getDX());
95 _message->setY((visibleMapHeight - _message->getHeight()) / 2);
96 _camera = new Camera(_spriteWidth, _spriteHeight, _save->getMapSizeX(), _save->getMapSizeY(), _save->getMapSizeZ(), this, visibleMapHeight);
97 _scrollMouseTimer = new Timer(SCROLL_INTERVAL);
98 _scrollMouseTimer->onTimer((SurfaceHandler)&Map::scrollMouse);
99 _scrollKeyTimer = new Timer(SCROLL_INTERVAL);
100 _scrollKeyTimer->onTimer((SurfaceHandler)&Map::scrollKey);
101 _camera->setScrollTimer(_scrollMouseTimer, _scrollKeyTimer);
102
103 _txtAccuracy = new Text(24, 9, 0, 0);
104 _txtAccuracy->setSmall();
105 _txtAccuracy->setPalette(_game->getScreen()->getPalette());
106 _txtAccuracy->setHighContrast(true);
107 _txtAccuracy->initText(_res->getFont("FONT_BIG"), _res->getFont("FONT_SMALL"), _game->getLanguage());
108}
109
110/**
111 * Deletes the map.

Callers

nothing calls this directly

Calls 15

getFrameMethod · 0.80
getSurfaceSetMethod · 0.80
getSavedBattleMethod · 0.80
getSavedGameMethod · 0.80
getDXMethod · 0.80
getScreenMethod · 0.80
getMapSizeZMethod · 0.80
onTimerMethod · 0.80
setScrollTimerMethod · 0.80
getLanguageMethod · 0.80
getResourcePackMethod · 0.45
getWidthMethod · 0.45

Tested by

no test coverage detected