* Initializes the Medikit State. * @param game Pointer to the core game. * @param targetUnit The wounded unit. * @param action The healing action. */
| 119 | * @param action The healing action. |
| 120 | */ |
| 121 | MedikitState::MedikitState (Game * game, BattleUnit * targetUnit, BattleAction *action) : State (game), _targetUnit(targetUnit), _action(action) |
| 122 | { |
| 123 | if (Options::maximizeInfoScreens) |
| 124 | { |
| 125 | Options::baseXResolution = Screen::ORIGINAL_WIDTH; |
| 126 | Options::baseYResolution = Screen::ORIGINAL_HEIGHT; |
| 127 | _game->getScreen()->resetDisplay(false); |
| 128 | } |
| 129 | |
| 130 | _unit = action->actor; |
| 131 | _item = action->weapon; |
| 132 | _bg = new Surface(320, 200); |
| 133 | |
| 134 | // Set palette |
| 135 | setPalette("PAL_BATTLESCAPE"); |
| 136 | |
| 137 | if (_game->getScreen()->getDY() > 50) |
| 138 | { |
| 139 | _screen = false; |
| 140 | _bg->drawRect(67, 44, 190, 100, Palette::blockOffset(15)+15); |
| 141 | } |
| 142 | _partTxt = new Text(62, 9, 82, 120); |
| 143 | _woundTxt = new Text(14, 9, 145, 120); |
| 144 | _medikitView = new MedikitView(52, 58, 95, 60, _game, _targetUnit, _partTxt, _woundTxt); |
| 145 | _endButton = new InteractiveSurface(20, 20, 220, 140); |
| 146 | _stimulantButton = new MedikitButton(84); |
| 147 | _pkButton = new MedikitButton(48); |
| 148 | _healButton = new MedikitButton(120); |
| 149 | _pkText = new MedikitTxt (52); |
| 150 | _stimulantTxt = new MedikitTxt (88); |
| 151 | _healTxt = new MedikitTxt (124); |
| 152 | add(_bg); |
| 153 | add(_medikitView); |
| 154 | add(_endButton); |
| 155 | add(new MedikitTitle (37, tr("STR_PAIN_KILLER"))); |
| 156 | add(new MedikitTitle (73, tr("STR_STIMULANT"))); |
| 157 | add(new MedikitTitle (109, tr("STR_HEAL"))); |
| 158 | add(_healButton); |
| 159 | add(_stimulantButton); |
| 160 | add(_pkButton); |
| 161 | add(_pkText); |
| 162 | add(_stimulantTxt); |
| 163 | add(_healTxt); |
| 164 | add(_partTxt); |
| 165 | add(_woundTxt); |
| 166 | |
| 167 | centerAllSurfaces(); |
| 168 | |
| 169 | _game->getResourcePack()->getSurface("MEDIBORD.PCK")->blit(_bg); |
| 170 | _pkText->setBig(); |
| 171 | _stimulantTxt->setBig(); |
| 172 | _healTxt->setBig(); |
| 173 | _partTxt->setColor(Palette::blockOffset(2)); |
| 174 | _partTxt->setHighContrast(true); |
| 175 | _woundTxt->setColor(Palette::blockOffset(2)); |
| 176 | _woundTxt->setHighContrast(true); |
| 177 | _endButton->onMouseClick((ActionHandler)&MedikitState::onEndClick); |
| 178 | _endButton->onKeyboardPress((ActionHandler)&MedikitState::onEndClick, Options::keyCancel); |
nothing calls this directly
no test coverage detected