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

Method MiniMapState

src/Battlescape/MiniMapState.cpp:42–92  ·  view source on GitHub ↗

* Initializes all the elements in the MiniMapState screen. * @param game Pointer to the core game. * @param camera The Battlescape camera. * @param battleGame The Battlescape save. */

Source from the content-addressed store, hash-verified

40 * @param battleGame The Battlescape save.
41 */
42MiniMapState::MiniMapState (Game * game, Camera * camera, SavedBattleGame * battleGame) : State(game)
43{
44 if (Options::maximizeInfoScreens)
45 {
46 Options::baseXResolution = Screen::ORIGINAL_WIDTH;
47 Options::baseYResolution = Screen::ORIGINAL_HEIGHT;
48 _game->getScreen()->resetDisplay(false);
49 }
50
51 _bg = new Surface(320, 200);
52 _miniMapView = new MiniMapView(221, 148, 48, 16, game, camera, battleGame);
53 _btnLvlUp = new InteractiveSurface(18, 20, 24, 62);
54 _btnLvlDwn = new InteractiveSurface(18, 20, 24, 88);
55 _btnOk = new InteractiveSurface(32, 32, 275, 145);
56 _txtLevel = new Text(20, 25, 281, 75);
57
58 // Set palette
59 setPalette("PAL_BATTLESCAPE");
60
61 add(_bg);
62 add(_miniMapView);
63 add(_btnLvlUp);
64 add(_btnLvlDwn);
65 add(_btnOk);
66 add(_txtLevel);
67
68 centerAllSurfaces();
69
70 if (_game->getScreen()->getDY() > 50)
71 {
72 _screen = false;
73 _bg->drawRect(46, 14, 223, 151, Palette::blockOffset(15)+15);
74 }
75
76 _game->getResourcePack()->getSurface("SCANBORD.PCK")->blit(_bg);
77 _btnLvlUp->onMouseClick((ActionHandler)&MiniMapState::btnLevelUpClick);
78 _btnLvlDwn->onMouseClick((ActionHandler)&MiniMapState::btnLevelDownClick);
79 _btnOk->onMouseClick((ActionHandler)&MiniMapState::btnOkClick);
80 _btnOk->onKeyboardPress((ActionHandler)&MiniMapState::btnOkClick, Options::keyCancel);
81 _btnOk->onKeyboardPress((ActionHandler)&MiniMapState::btnOkClick, Options::keyBattleMap);
82 _txtLevel->setBig();
83 _txtLevel->setColor(Palette::blockOffset(4));
84 _txtLevel->setHighContrast(true);
85 std::wostringstream s;
86 s << camera->getViewLevel();
87 _txtLevel->setText(s.str());
88 _timerAnimate = new Timer(125);
89 _timerAnimate->onTimer((StateHandler)&MiniMapState::animate);
90 _timerAnimate->start();
91 _miniMapView->draw();
92}
93
94/**
95 *

Callers

nothing calls this directly

Calls 15

resetDisplayMethod · 0.80
getScreenMethod · 0.80
getDYMethod · 0.80
drawRectMethod · 0.80
onMouseClickMethod · 0.80
onKeyboardPressMethod · 0.80
getViewLevelMethod · 0.80
onTimerMethod · 0.80
blitMethod · 0.45
getSurfaceMethod · 0.45
getResourcePackMethod · 0.45
setBigMethod · 0.45

Tested by

no test coverage detected