diff options
author | Peter Kohaut | 2019-10-13 14:08:49 +0200 |
---|---|---|
committer | Peter Kohaut | 2019-10-13 14:09:47 +0200 |
commit | cd7e44f9f92c3aee7b99ecf44e8dbfbb252904d0 (patch) | |
tree | 2fb470e0166eaf4f125778b1675b4a49c20232e4 /engines/bladerunner/dialogue_menu.cpp | |
parent | 2b0bce60908ec7fb2d1e2c950d4a967bc16e158a (diff) | |
download | scummvm-rg350-cd7e44f9f92c3aee7b99ecf44e8dbfbb252904d0.tar.gz scummvm-rg350-cd7e44f9f92c3aee7b99ecf44e8dbfbb252904d0.tar.bz2 scummvm-rg350-cd7e44f9f92c3aee7b99ecf44e8dbfbb252904d0.zip |
BLADERUNNER: Group shapes loading
Diffstat (limited to 'engines/bladerunner/dialogue_menu.cpp')
-rw-r--r-- | engines/bladerunner/dialogue_menu.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/engines/bladerunner/dialogue_menu.cpp b/engines/bladerunner/dialogue_menu.cpp index 1ef19dd680..6198f214bf 100644 --- a/engines/bladerunner/dialogue_menu.cpp +++ b/engines/bladerunner/dialogue_menu.cpp @@ -41,13 +41,7 @@ DialogueMenu::DialogueMenu(BladeRunnerEngine *vm) { _vm = vm; reset(); _textResource = new TextResource(_vm); - _shapes.reserve(8); - for (int i = 0; i != 8; ++i) { - _shapes.push_back(Shape(_vm)); - bool r = _shapes[i].open("DIALOG.SHP", i); - assert(r); - (void)r; - } + _shapes = new Shapes(_vm); _screenX = 0; _screenY = 0; @@ -57,13 +51,18 @@ DialogueMenu::DialogueMenu(BladeRunnerEngine *vm) { DialogueMenu::~DialogueMenu() { delete _textResource; + delete _shapes; } -bool DialogueMenu::loadText(const Common::String &name) { - bool r = _textResource->open(name); +bool DialogueMenu::loadResources() { + bool r = _textResource->open("DLGMENU"); if (!r) { error("Failed to load dialogue menu text"); } + r = _shapes->load("DIALOG.SHP"); + if (!r) { + error("Failed to load dialogue menu shapes"); + } return r; } @@ -372,21 +371,21 @@ void DialogueMenu::draw(Graphics::Surface &s) { s.hLine(x1 + 8, mouse.y, x2 + 2, s.format.RGBToColor(64, 64, 64)); } - _shapes[0].draw(s, x1, y1); - _shapes[3].draw(s, x2, y1); - _shapes[2].draw(s, x1, y2); - _shapes[5].draw(s, x2, y2); + _shapes->get(0)->draw(s, x1, y1); + _shapes->get(3)->draw(s, x2, y1); + _shapes->get(2)->draw(s, x1, y2); + _shapes->get(5)->draw(s, x2, y2); for (int i = 0; i != _listSize; ++i) { - _shapes[1].draw(s, x1, y); - _shapes[4].draw(s, x2, y); + _shapes->get(1)->draw(s, x1, y); + _shapes->get(4)->draw(s, x2, y); uint32 color = s.format.RGBToColor((_items[i].colorIntensity / 2) * (256 / 32), (_items[i].colorIntensity / 2) * (256 / 32), _items[i].colorIntensity * (256 / 32)); _vm->_mainFont->drawString(&s, _items[i].text, x, y, s.w, color); y += kLineHeight; } for (; x != x2; ++x) { - _shapes[6].draw(s, x, y1); - _shapes[7].draw(s, x, y2); + _shapes->get(6)->draw(s, x, y1); + _shapes->get(7)->draw(s, x, y2); } } @@ -411,8 +410,8 @@ void DialogueMenu::calculatePosition(int unusedX, int unusedY) { } _maxItemWidth += 2; - int w = kBorderSize + _shapes[4].getWidth() + _maxItemWidth; - int h = kBorderSize + _shapes[7].getHeight() + kLineHeight * _listSize; + int w = kBorderSize + _shapes->get(4)->getWidth() + _maxItemWidth; + int h = kBorderSize + _shapes->get(7)->getHeight() + kLineHeight * _listSize; _screenX = _centerX - w / 2; _screenY = _centerY - h / 2; |