* Initializes all the elements in the Inventory screen. * @param game Pointer to the core game. * @param tu Does Inventory use up Time Units? * @param parent Pointer to parent Battlescape. */
| 59 | * @param parent Pointer to parent Battlescape. |
| 60 | */ |
| 61 | InventoryState::InventoryState(Game *game, bool tu, BattlescapeState *parent) : State(game), _tu(tu), _parent(parent) |
| 62 | { |
| 63 | _battleGame = _game->getSavedGame()->getSavedBattle(); |
| 64 | |
| 65 | if (Options::maximizeInfoScreens) |
| 66 | { |
| 67 | Options::baseXResolution = Screen::ORIGINAL_WIDTH; |
| 68 | Options::baseYResolution = Screen::ORIGINAL_HEIGHT; |
| 69 | _game->getScreen()->resetDisplay(false); |
| 70 | } |
| 71 | else if (!_battleGame->getTileEngine()) |
| 72 | { |
| 73 | Screen::updateScale(Options::battlescapeScale, Options::battlescapeScale, Options::baseXBattlescape, Options::baseYBattlescape, true); |
| 74 | _game->getScreen()->resetDisplay(false); |
| 75 | } |
| 76 | |
| 77 | // Create objects |
| 78 | _bg = new Surface(320, 200, 0, 0); |
| 79 | _soldier = new Surface(320, 200, 0, 0); |
| 80 | _txtName = new Text(210, 17, 28, 6); |
| 81 | _txtTus = new Text(40, 9, 245, Options::showMoreStatsInInventoryView ? 32 : 24); |
| 82 | _txtWeight = new Text(70, 9, 245, 24); |
| 83 | _txtFAcc = new Text(40, 9, 245, 32); |
| 84 | _txtReact = new Text(40, 9, 245, 40); |
| 85 | _txtPSkill = new Text(40, 9, 245, 48); |
| 86 | _txtPStr = new Text(40, 9, 245, 56); |
| 87 | _txtItem = new Text(160, 9, 128, 140); |
| 88 | _txtAmmo = new Text(66, 24, 254, 64); |
| 89 | _btnOk = new InteractiveSurface(35, 22, 237, 1); |
| 90 | _btnPrev = new InteractiveSurface(23, 22, 273, 1); |
| 91 | _btnNext = new InteractiveSurface(23, 22, 297, 1); |
| 92 | _btnUnload = new InteractiveSurface(32, 25, 288, 32); |
| 93 | _btnGround = new InteractiveSurface(32, 15, 289, 137); |
| 94 | _btnRank = new InteractiveSurface(26, 23, 0, 0); |
| 95 | _selAmmo = new Surface(RuleInventory::HAND_W * RuleInventory::SLOT_W, RuleInventory::HAND_H * RuleInventory::SLOT_H, 272, 88); |
| 96 | _inv = new Inventory(_game, 320, 200, 0, 0, _parent == 0); |
| 97 | |
| 98 | // Set palette |
| 99 | setPalette("PAL_BATTLESCAPE"); |
| 100 | |
| 101 | add(_bg); |
| 102 | add(_soldier); |
| 103 | add(_txtName); |
| 104 | add(_txtTus); |
| 105 | add(_txtWeight); |
| 106 | add(_txtFAcc); |
| 107 | add(_txtReact); |
| 108 | add(_txtPSkill); |
| 109 | add(_txtPStr); |
| 110 | add(_txtItem); |
| 111 | add(_txtAmmo); |
| 112 | add(_btnOk); |
| 113 | add(_btnPrev); |
| 114 | add(_btnNext); |
| 115 | add(_btnUnload); |
| 116 | add(_btnGround); |
| 117 | add(_btnRank); |
| 118 | add(_selAmmo); |
nothing calls this directly
no test coverage detected