aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/ui
diff options
context:
space:
mode:
authorPeter Kohaut2019-10-13 14:08:49 +0200
committerPeter Kohaut2019-10-13 14:09:47 +0200
commitcd7e44f9f92c3aee7b99ecf44e8dbfbb252904d0 (patch)
tree2fb470e0166eaf4f125778b1675b4a49c20232e4 /engines/bladerunner/ui
parent2b0bce60908ec7fb2d1e2c950d4a967bc16e158a (diff)
downloadscummvm-rg350-cd7e44f9f92c3aee7b99ecf44e8dbfbb252904d0.tar.gz
scummvm-rg350-cd7e44f9f92c3aee7b99ecf44e8dbfbb252904d0.tar.bz2
scummvm-rg350-cd7e44f9f92c3aee7b99ecf44e8dbfbb252904d0.zip
BLADERUNNER: Group shapes loading
Diffstat (limited to 'engines/bladerunner/ui')
-rw-r--r--engines/bladerunner/ui/elevator.cpp48
-rw-r--r--engines/bladerunner/ui/elevator.h20
-rw-r--r--engines/bladerunner/ui/esper.cpp87
-rw-r--r--engines/bladerunner/ui/esper.h7
-rw-r--r--engines/bladerunner/ui/kia.cpp44
-rw-r--r--engines/bladerunner/ui/kia.h6
-rw-r--r--engines/bladerunner/ui/kia_section_clues.cpp2
-rw-r--r--engines/bladerunner/ui/kia_section_crimes.cpp26
-rw-r--r--engines/bladerunner/ui/kia_section_crimes.h12
-rw-r--r--engines/bladerunner/ui/kia_section_help.cpp2
-rw-r--r--engines/bladerunner/ui/kia_section_load.cpp2
-rw-r--r--engines/bladerunner/ui/kia_section_save.cpp2
-rw-r--r--engines/bladerunner/ui/kia_section_settings.cpp2
-rw-r--r--engines/bladerunner/ui/kia_section_suspects.cpp26
-rw-r--r--engines/bladerunner/ui/kia_section_suspects.h8
-rw-r--r--engines/bladerunner/ui/kia_shapes.cpp72
-rw-r--r--engines/bladerunner/ui/kia_shapes.h52
-rw-r--r--engines/bladerunner/ui/spinner.cpp103
-rw-r--r--engines/bladerunner/ui/spinner.h28
-rw-r--r--engines/bladerunner/ui/ui_check_box.cpp4
-rw-r--r--engines/bladerunner/ui/ui_scroll_box.cpp1
-rw-r--r--engines/bladerunner/ui/vk.cpp60
-rw-r--r--engines/bladerunner/ui/vk.h8
23 files changed, 202 insertions, 420 deletions
diff --git a/engines/bladerunner/ui/elevator.cpp b/engines/bladerunner/ui/elevator.cpp
index cff2a16ab7..2e8d70d06a 100644
--- a/engines/bladerunner/ui/elevator.cpp
+++ b/engines/bladerunner/ui/elevator.cpp
@@ -44,9 +44,13 @@ Elevator::Elevator(BladeRunnerEngine *vm) {
_vm = vm;
reset();
_imagePicker = new UIImagePicker(vm, 8);
+ _shapes = new Shapes(vm);
}
Elevator::~Elevator() {
+ delete _shapes;
+ _shapes = nullptr;
+
delete _imagePicker;
_imagePicker = nullptr;
}
@@ -76,10 +80,7 @@ int Elevator::activate(int elevatorId) {
_vqaPlayer->setLoop(1, -1, kLoopSetModeJustStart, nullptr, nullptr);
_vm->_mouse->setCursor(0);
- for (int i = 0; i != 16; ++i) {
- _shapes.push_back(new Shape(_vm));
- _shapes[i]->open("ELEVATOR.SHP", i);
- }
+ _shapes->load("ELEVATOR.SHP");
_imagePicker->resetImages();
@@ -88,62 +89,62 @@ int Elevator::activate(int elevatorId) {
0,
Common::Rect(220, 298, 308, 392),
nullptr,
- _shapes[11],
- _shapes[14],
+ _shapes->get(11),
+ _shapes->get(14),
nullptr);
_imagePicker->defineImage(
1,
Common::Rect(259, 259, 302, 292),
nullptr,
- _shapes[10],
- _shapes[13],
+ _shapes->get(10),
+ _shapes->get(13),
nullptr);
_imagePicker->defineImage(
2,
Common::Rect(227, 398, 301, 434),
nullptr,
- _shapes[12],
- _shapes[15],
+ _shapes->get(12),
+ _shapes->get(15),
nullptr);
} else { // kElevatorPS
_imagePicker->defineImage(
4,
Common::Rect(395, 131, 448, 164),
nullptr,
- _shapes[0],
- _shapes[5],
+ _shapes->get(0),
+ _shapes->get(5),
nullptr
);
_imagePicker->defineImage(
3,
Common::Rect(395, 165, 448, 198),
nullptr,
- _shapes[1],
- _shapes[6],
+ _shapes->get(1),
+ _shapes->get(6),
nullptr
);
_imagePicker->defineImage(
5,
Common::Rect(395, 199, 448, 232),
nullptr,
- _shapes[2],
- _shapes[7],
+ _shapes->get(2),
+ _shapes->get(7),
nullptr
);
_imagePicker->defineImage(
6,
Common::Rect(395, 233, 448, 264),
nullptr,
- _shapes[3],
- _shapes[8],
+ _shapes->get(3),
+ _shapes->get(8),
nullptr
);
_imagePicker->defineImage(
7,
Common::Rect(395, 265, 448, 295),
nullptr,
- _shapes[4],
- _shapes[9],
+ _shapes->get(4),
+ _shapes->get(9),
nullptr
);
}
@@ -167,13 +168,10 @@ int Elevator::activate(int elevatorId) {
_imagePicker->deactivate();
- _vqaPlayer->close();
delete _vqaPlayer;
+ _vqaPlayer = nullptr;
- for (int i = 0; i != (int)_shapes.size(); ++i) {
- delete _shapes[i];
- }
- _shapes.clear();
+ _shapes->unload();
_vm->closeArchive("MODE.MIX");
diff --git a/engines/bladerunner/ui/elevator.h b/engines/bladerunner/ui/elevator.h
index 6ed91ce799..f2cdd8c745 100644
--- a/engines/bladerunner/ui/elevator.h
+++ b/engines/bladerunner/ui/elevator.h
@@ -28,20 +28,20 @@
namespace BladeRunner {
class BladeRunnerEngine;
-class Shape;
+class Shapes;
class VQAPlayer;
class UIImagePicker;
class Elevator {
- BladeRunnerEngine *_vm;
- bool _isOpen;
- VQAPlayer *_vqaPlayer;
- int _buttonClicked;
- Common::Array<Shape *> _shapes;
- UIImagePicker *_imagePicker;
- int _actorId;
- int _sentenceId;
- uint32 _timeSpeakDescriptionStart;
+ BladeRunnerEngine *_vm;
+ bool _isOpen;
+ VQAPlayer *_vqaPlayer;
+ int _buttonClicked;
+ Shapes *_shapes;
+ UIImagePicker *_imagePicker;
+ int _actorId;
+ int _sentenceId;
+ uint32 _timeSpeakDescriptionStart;
public:
Elevator(BladeRunnerEngine *vm);
diff --git a/engines/bladerunner/ui/esper.cpp b/engines/bladerunner/ui/esper.cpp
index 2290cdb121..987b2afd9c 100644
--- a/engines/bladerunner/ui/esper.cpp
+++ b/engines/bladerunner/ui/esper.cpp
@@ -51,26 +51,28 @@ ESPER::ESPER(BladeRunnerEngine *vm) {
_screen = Common::Rect(135, 123, 435, 387);
_isWaiting = false;
- _shapeButton = nullptr;
- _shapeThumbnail = nullptr;
_regionSelectedAck = false;
_isDrawingSelection = false;
_isOpen = false;
- _shapeButton = nullptr;
+ _shapesButtons = new Shapes(vm);
+ _shapesPhotos = new Shapes(vm);
_shapeThumbnail = nullptr;
_vqaPlayerMain = nullptr;
_vqaPlayerPhoto = nullptr;
_script = nullptr;
- reset();
-
_buttons = new UIImagePicker(vm, kPhotoCount + 4);
+
+ reset();
}
ESPER::~ESPER() {
- delete _buttons;
reset();
+
+ delete _buttons;
+ delete _shapesPhotos;
+ delete _shapesButtons;
}
void ESPER::open(Graphics::Surface *surface) {
@@ -96,17 +98,17 @@ void ESPER::open(Graphics::Surface *surface) {
}
_surfacePhoto.create(kPhotoWidth, kPhotoHeight, gameDataPixelFormat());
-
_surfaceViewport.create(_screen.width(), _screen.height(), screenPixelFormat());
_viewportNext = _viewport;
- _shapeButton = new Shape(_vm);
- if (!_shapeButton->open("ESPBUTTN.SHP", 0)) {
+ if (!_shapesButtons->load("ESPBUTTN.SHP")) {
return;
}
- _shapesPhotos.resize(10);
+ if (!_shapesPhotos->load("ESPTHUMB.SHP")) {
+ return;
+ }
_vqaPlayerMain = new VQAPlayer(_vm, &_vm->_surfaceBack, "ESPER.VQA");
if (!_vqaPlayerMain->open()) {
@@ -118,6 +120,7 @@ void ESPER::open(Graphics::Surface *surface) {
_flash = false;
_script = new ESPERScript(_vm);
+
activate(true);
}
@@ -129,26 +132,18 @@ void ESPER::close() {
_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(kSfxBR035_7B), 25, 0, 0, 50, 0);
unloadPhotos();
- _shapesPhotos.clear();
-
- delete _shapeThumbnail;
- _shapeThumbnail = nullptr;
_buttons->deactivate();
_buttons->resetImages();
- delete _shapeButton;
- _shapeButton = nullptr;
+ _shapesButtons->unload();
+ _shapesPhotos->unload();
_surfacePhoto.free();
-
_surfaceViewport.free();
- if (_vqaPlayerMain) {
- _vqaPlayerMain->close();
- delete _vqaPlayerMain;
- _vqaPlayerMain= nullptr;
- }
+ delete _vqaPlayerMain;
+ _vqaPlayerMain = nullptr;
_vm->closeArchive("MODE.MIX");
@@ -156,6 +151,7 @@ void ESPER::close() {
_vm->_ambientSounds->setVolume(_ambientVolume);
_vm->_scene->resume();
+
reset();
}
@@ -248,11 +244,6 @@ void ESPER::addPhoto(const char *name, int photoId, int shapeId) {
_photos[i].photoId = photoId;
_photos[i].name = name;
- assert((uint)shapeId < _shapesPhotos.size());
-
- _shapesPhotos[shapeId] = new Shape(_vm);
- _shapesPhotos[shapeId]->open("ESPTHUMB.SHP", shapeId);
-
_buttons->defineImage(i,
Common::Rect(
100 * (i % 3) + _screen.left + 3,
@@ -260,9 +251,9 @@ void ESPER::addPhoto(const char *name, int photoId, int shapeId) {
100 * (i % 3) + _screen.left + 100 - 3,
66 * (i / 3) + _screen.top + 66 - 3
),
- _shapesPhotos[shapeId],
- _shapesPhotos[shapeId],
- _shapesPhotos[shapeId],
+ _shapesPhotos->get(shapeId),
+ _shapesPhotos->get(shapeId),
+ _shapesPhotos->get(shapeId),
nullptr);
}
playSound(kSfxBR028_2A, 25);
@@ -304,14 +295,10 @@ void ESPER::mouseUpCallback(int buttonId, void *callbackData) {
void ESPER::reset() {
_surfacePhoto.free();
-
_surfaceViewport.free();
- delete _shapeButton;
- _shapeButton = nullptr;
-
- delete _shapeThumbnail;
- _shapeThumbnail = nullptr;
+ _shapesButtons->unload();
+ _shapesPhotos->unload();
delete _vqaPlayerMain;
_vqaPlayerMain = nullptr;
@@ -324,21 +311,14 @@ void ESPER::reset() {
_isOpen = false;
- _shapesPhotos.clear();
resetData();
}
void ESPER::resetData() {
- if (_vqaPlayerPhoto) {
- _vqaPlayerPhoto->close();
- delete _vqaPlayerPhoto;
- _vqaPlayerPhoto = nullptr;
- }
+ delete _vqaPlayerPhoto;
+ _vqaPlayerPhoto = nullptr;
- if (_shapeThumbnail) {
- delete _shapeThumbnail;
- _shapeThumbnail = nullptr;
- }
+ _shapeThumbnail = nullptr;
_viewport = Common::Rect();
_viewportNext = Common::Rect();
@@ -500,7 +480,7 @@ void ESPER::activate(bool withOpening) {
}
_buttons->activate(nullptr, nullptr, mouseDownCallback, mouseUpCallback, this);
- _buttons->defineImage(kPhotoCount + 3, Common::Rect(42, 403, 76, 437), nullptr, nullptr, _shapeButton, nullptr);
+ _buttons->defineImage(kPhotoCount + 3, Common::Rect(42, 403, 76, 437), nullptr, nullptr, _shapesButtons->get(0), nullptr);
playSound(kSfxBR024_4B, 25);
wait(1000);
@@ -1446,10 +1426,6 @@ void ESPER::selectPhoto(int photoId) {
Common::ScopedPtr<Common::SeekableReadStream> s(_vm->getResourceStream(_photos[photoId].name));
- if (!s) {
- reset();
- }
-
uint photoSize = _surfacePhoto.w * _surfacePhoto.h * _surfacePhoto.format.bytesPerPixel;
s->skip(3); // not used, but there is compression type
@@ -1473,11 +1449,10 @@ void ESPER::selectPhoto(int photoId) {
// _surfacePhoto[j] = Palette[_surfacePhoto[j]];
}
- _shapeThumbnail = new Shape(_vm);
- _shapeThumbnail->open("ESPTHUMB.SHP", _photos[photoId].shapeId);
+ _shapeThumbnail = _shapesPhotos->get(_photos[photoId].shapeId);
_buttons->resetImages();
_buttons->defineImage(kPhotoCount + 2, Common::Rect(480, 350, 578, 413), _shapeThumbnail, _shapeThumbnail, _shapeThumbnail, nullptr);
- _buttons->defineImage(kPhotoCount + 3, Common::Rect(42, 403, 76, 437), nullptr, nullptr, _shapeButton, nullptr);
+ _buttons->defineImage(kPhotoCount + 3, Common::Rect(42, 403, 76, 437), nullptr, nullptr, _shapesButtons->get(0), nullptr);
resetPhotoOpening();
resetViewport();
@@ -1490,10 +1465,8 @@ void ESPER::selectPhoto(int photoId) {
void ESPER::unloadPhotos() {
for (int i = 0; i < kPhotoCount; ++i) {
if (_photos[i].isPresent) {
- _buttons->resetImage(i);
- delete _shapesPhotos[i];
- _shapesPhotos[i] = nullptr;
_photos[i].isPresent = false;
+ _buttons->resetImage(i);
}
}
}
diff --git a/engines/bladerunner/ui/esper.h b/engines/bladerunner/ui/esper.h
index 0c1c6a86e8..61f8d2d3ec 100644
--- a/engines/bladerunner/ui/esper.h
+++ b/engines/bladerunner/ui/esper.h
@@ -33,6 +33,7 @@ namespace BladeRunner {
class BladeRunnerEngine;
class Font;
class Shape;
+class Shapes;
class VQAPlayer;
class UIImagePicker;
class ESPERScript;
@@ -101,9 +102,9 @@ class ESPER {
VQAPlayer *_vqaPlayerPhoto;
int _vqaLastFrame;
- Shape *_shapeButton;
- Common::Array<Shape *> _shapesPhotos;
- Shape *_shapeThumbnail;
+ Shapes *_shapesButtons;
+ Shapes *_shapesPhotos;
+ const Shape *_shapeThumbnail;
Photo _photos[kPhotoCount];
int _photoIdSelected;
diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp
index 65e3e84c40..54b481a997 100644
--- a/engines/bladerunner/ui/kia.cpp
+++ b/engines/bladerunner/ui/kia.cpp
@@ -50,7 +50,6 @@
#include "bladerunner/ui/kia_section_pogo.h"
#include "bladerunner/ui/kia_section_save.h"
#include "bladerunner/ui/kia_section_suspects.h"
-#include "bladerunner/ui/kia_shapes.h"
#include "bladerunner/ui/ui_image_picker.h"
#include "bladerunner/vqa_player.h"
#include "bladerunner/subtitles.h"
@@ -67,7 +66,8 @@ KIA::KIA(BladeRunnerEngine *vm) {
_script = new KIAScript(_vm);
_log = new KIALog(_vm);
- _shapes = new KIAShapes(_vm);
+ _shapes = new Shapes(_vm);
+ _playerPhotographs = new Shapes(_vm);
_forceOpen = false;
_currentSectionId = kKIASectionNone;
@@ -77,7 +77,6 @@ KIA::KIA(BladeRunnerEngine *vm) {
_playerVqaFrame = 0;
_playerVisualizerState = 0;
_playerPhotographId = -1;
- _playerPhotograph = nullptr;
_playerSliceModelId = -1;
_playerSliceModelAngle = 0.0f;
_timeLast = _vm->_time->currentSystem();
@@ -128,9 +127,9 @@ KIA::~KIA() {
delete _diagnosticSection;
delete _pogoSection;
_playerImage.free();
- delete _playerPhotograph;
delete _buttons;
delete _shapes;
+ delete _playerPhotographs;
delete _log;
delete _script;
}
@@ -332,9 +331,10 @@ void KIA::tick() {
if (_playerSliceModelId != -1) {
_vm->_sliceRenderer->drawOnScreen(_playerSliceModelId, 0, 585, 80, _playerSliceModelAngle, 100.0, _vm->_surfaceFront);
} else if (_playerPhotographId != -1) {
- int width = _playerPhotograph->getWidth();
- int height = _playerPhotograph->getHeight();
- _playerPhotograph->draw(_vm->_surfaceFront, 590 - width / 2, 80 - height / 2);
+ const Shape *playerPhotograph = _playerPhotographs->get(_playerPhotographId);
+ int width = playerPhotograph->getWidth();
+ int height = playerPhotograph->getHeight();
+ playerPhotograph->draw(_vm->_surfaceFront, 590 - width / 2, 80 - height / 2);
} else if (_playerImage.getPixels() != nullptr) {
_vm->_surfaceFront.fillRect(Common::Rect(549, 49, 631, 111), _vm->_surfaceFront.format.RGBToColor(255, 255, 255));
_vm->_surfaceFront.copyRectToSurface(_playerImage.getPixels(), _playerImage.pitch, 550, 50, _playerImage.w, _playerImage.h);
@@ -550,10 +550,6 @@ void KIA::playerReset() {
_playerActorDialogueQueueSize = _playerActorDialogueQueuePosition;
_playerSliceModelId = -1;
- if (_playerPhotographId != -1) {
- delete _playerPhotograph;
- _playerPhotograph = nullptr;
- }
_playerPhotographId = -1;
_playerImage.free();
_playerActorDialogueState = 0;
@@ -582,16 +578,10 @@ void KIA::playSliceModel(int sliceModelId) {
}
void KIA::playPhotograph(int photographId) {
- if (_playerPhotographId != -1) {
- delete _playerPhotograph;
- _playerPhotograph = nullptr;
- }
if (_playerVqaFrame == 8) {
_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(kSfxBEEP1), 70, 0, 0, 50, 0);
}
_playerPhotographId = photographId;
- _playerPhotograph = new Shape(_vm);
- _playerPhotograph->open("photos.shp", photographId);
}
void KIA::playImage(const Graphics::Surface &image) {
@@ -740,11 +730,12 @@ void KIA::init() {
playPrivateAddon();
}
- _shapes->load();
+ _shapes->load("kiaopt.shp");
+ _playerPhotographs->load("photos.shp");
+
_buttons->activate(nullptr, nullptr, mouseDownCallback, mouseUpCallback, this);
_vm->_mouse->setCursor(0);
if (_playerVqaPlayer == nullptr) {
-
_playerVqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceFront, "kiaover.vqa");
_playerVqaPlayer->open();
_playerVqaPlayer->setLoop(0, -1, kLoopSetModeJustStart, nullptr, nullptr);
@@ -772,18 +763,13 @@ void KIA::unload() {
_buttons->deactivate();
_shapes->unload();
+ _playerPhotographs->unload();
- if (_mainVqaPlayer) {
- _mainVqaPlayer->close();
- delete _mainVqaPlayer;
- _mainVqaPlayer = nullptr;
- }
+ delete _mainVqaPlayer;
+ _mainVqaPlayer = nullptr;
- if (_playerVqaPlayer) {
- _playerVqaPlayer->close();
- delete _playerVqaPlayer;
- _playerVqaPlayer = nullptr;
- }
+ delete _playerVqaPlayer;
+ _playerVqaPlayer = nullptr;
_vm->closeArchive("MODE.MIX");
diff --git a/engines/bladerunner/ui/kia.h b/engines/bladerunner/ui/kia.h
index dc106234d5..fc3984edc1 100644
--- a/engines/bladerunner/ui/kia.h
+++ b/engines/bladerunner/ui/kia.h
@@ -46,8 +46,8 @@ class KIASectionSettings;
class KIASectionPogo;
class KIASectionSave;
class KIASectionSuspects;
-class KIAShapes;
class Shape;
+class Shapes;
class UIImagePicker;
class VQAPlayer;
@@ -83,7 +83,7 @@ class KIA {
uint32 _playerVqaFrame;
uint32 _playerVisualizerState;
int _playerPhotographId;
- Shape *_playerPhotograph;
+ Shapes *_playerPhotographs;
int _playerSliceModelId;
float _playerSliceModelAngle;
Graphics::Surface _playerImage;
@@ -121,7 +121,7 @@ public:
KIALog *_log;
KIAScript *_script;
- KIAShapes *_shapes;
+ Shapes *_shapes;
Graphics::Surface _thumbnail;
diff --git a/engines/bladerunner/ui/kia_section_clues.cpp b/engines/bladerunner/ui/kia_section_clues.cpp
index ce14b9450d..c24bc7cc7c 100644
--- a/engines/bladerunner/ui/kia_section_clues.cpp
+++ b/engines/bladerunner/ui/kia_section_clues.cpp
@@ -29,11 +29,11 @@
#include "bladerunner/game_flags.h"
#include "bladerunner/game_info.h"
#include "bladerunner/font.h"
+#include "bladerunner/shape.h"
#include "bladerunner/script/kia_script.h"
#include "bladerunner/text_resource.h"
#include "bladerunner/ui/kia.h"
#include "bladerunner/ui/kia_log.h"
-#include "bladerunner/ui/kia_shapes.h"
#include "bladerunner/ui/ui_container.h"
#include "bladerunner/ui/ui_image_picker.h"
#include "bladerunner/ui/ui_scroll_box.h"
diff --git a/engines/bladerunner/ui/kia_section_crimes.cpp b/engines/bladerunner/ui/kia_section_crimes.cpp
index 4eedd8c284..325139f2e7 100644
--- a/engines/bladerunner/ui/kia_section_crimes.cpp
+++ b/engines/bladerunner/ui/kia_section_crimes.cpp
@@ -36,7 +36,6 @@
#include "bladerunner/ui/kia.h"
#include "bladerunner/ui/kia_log.h"
#include "bladerunner/ui/kia_section_suspects.h"
-#include "bladerunner/ui/kia_shapes.h"
#include "bladerunner/ui/ui_container.h"
#include "bladerunner/ui/ui_image_picker.h"
#include "bladerunner/ui/ui_scroll_box.h"
@@ -71,14 +70,14 @@ KIASectionCrimes::KIASectionCrimes(BladeRunnerEngine *vm, ActorClues *clues) : K
_suspectSelected = -1;
_suspectPhotoShapeId = -1;
_suspectPhotoNotUsed = -1;
- _suspectPhotoShape = nullptr;
+ _suspectPhotoShapes = new Shapes(vm);
_suspectsFoundCount = 0;
_suspectsFound.resize(_vm->_gameInfo->getSuspectCount());
_suspectsWithIdentity.resize(_vm->_gameInfo->getSuspectCount());
}
KIASectionCrimes::~KIASectionCrimes() {
- delete _suspectPhotoShape;
+ delete _suspectPhotoShapes;
_uiContainer->clear();
@@ -102,6 +101,8 @@ void KIASectionCrimes::reset() {
void KIASectionCrimes::open() {
_scheduledSwitch = false;
+ _suspectPhotoShapes->load("photos.shp");
+
_buttons->resetImages();
_buttons->defineImage(0, Common::Rect(136, 326, 185, 342), nullptr, _vm->_kia->_shapes->get(32), _vm->_kia->_shapes->get(36), _vm->_textKIA->getText(32));
_buttons->defineImage(1, Common::Rect(218, 326, 269, 342), nullptr, _vm->_kia->_shapes->get(33), _vm->_kia->_shapes->get(37), _vm->_textKIA->getText(33));
@@ -128,17 +129,14 @@ void KIASectionCrimes::close() {
_isOpen = false;
_buttons->deactivate();
_cluesScrollBox->hide();
- if (_suspectPhotoShapeId != -1) {
- delete _suspectPhotoShape;
- _suspectPhotoShape = nullptr;
- _suspectPhotoShapeId = -1;
- }
+ _suspectPhotoShapes->unload();
}
void KIASectionCrimes::draw(Graphics::Surface &surface) {
const char *text = nullptr;
if (_suspectPhotoShapeId != -1) {
- _suspectPhotoShape->draw(surface, 201 - _suspectPhotoShape->getWidth() / 2, 223 - _suspectPhotoShape->getHeight() / 2);
+ const Shape *shape = _suspectPhotoShapes->get(_suspectPhotoShapeId);
+ shape->draw(surface, 201 - shape->getWidth() / 2, 223 - shape->getHeight() / 2);
}
if (_suspectPhotoShapeId == 14 || _suspectPhotoShapeId == 13) {
text = _vm->_textKIA->getText(49);
@@ -396,11 +394,6 @@ void KIASectionCrimes::populateVisibleClues() {
}
void KIASectionCrimes::updateSuspectPhoto() {
- if (_suspectPhotoShapeId != -1) {
- delete _suspectPhotoShape;
- _suspectPhotoShape = nullptr;
- }
-
if (_suspectSelected == -1) {
_suspectPhotoShapeId = -1;
return;
@@ -429,11 +422,6 @@ void KIASectionCrimes::updateSuspectPhoto() {
_suspectPhotoShapeId = 13;
}
}
-
- if (_suspectPhotoShapeId != -1) {
- _suspectPhotoShape = new Shape(_vm);
- _suspectPhotoShape->open("photos.shp", _suspectPhotoShapeId);
- }
}
void KIASectionCrimes::nextCrime() {
diff --git a/engines/bladerunner/ui/kia_section_crimes.h b/engines/bladerunner/ui/kia_section_crimes.h
index 1bc3f88e4a..896a6aa73e 100644
--- a/engines/bladerunner/ui/kia_section_crimes.h
+++ b/engines/bladerunner/ui/kia_section_crimes.h
@@ -23,7 +23,6 @@
#ifndef BLADERUNNER_KIA_SECTION_CRIME_H
#define BLADERUNNER_KIA_SECTION_CRIME_H
-#include "bladerunner/shape.h"
#include "bladerunner/ui/kia_section_base.h"
#include "common/array.h"
@@ -32,6 +31,7 @@ namespace BladeRunner {
class ActorClues;
class BladeRunnerEngine;
+class Shapes;
class UIContainer;
class UIImagePicker;
class UIScrollBox;
@@ -65,12 +65,12 @@ class KIASectionCrimes : public KIASectionBase {
Common::Array<bool> _suspectsFound;
Common::Array<bool> _suspectsWithIdentity;
- int _mouseX;
- int _mouseY;
+ int _mouseX;
+ int _mouseY;
- int _suspectPhotoShapeId;
- int _suspectPhotoNotUsed;
- Shape *_suspectPhotoShape;
+ int _suspectPhotoShapeId;
+ int _suspectPhotoNotUsed;
+ Shapes *_suspectPhotoShapes;
public:
int _suspectSelected;
diff --git a/engines/bladerunner/ui/kia_section_help.cpp b/engines/bladerunner/ui/kia_section_help.cpp
index 7f1cb31b01..699f3d8a3f 100644
--- a/engines/bladerunner/ui/kia_section_help.cpp
+++ b/engines/bladerunner/ui/kia_section_help.cpp
@@ -23,9 +23,9 @@
#include "bladerunner/ui/kia_section_help.h"
#include "bladerunner/bladerunner.h"
+#include "bladerunner/shape.h"
#include "bladerunner/text_resource.h"
#include "bladerunner/ui/kia.h"
-#include "bladerunner/ui/kia_shapes.h"
#include "bladerunner/ui/ui_container.h"
#include "bladerunner/ui/ui_scroll_box.h"
diff --git a/engines/bladerunner/ui/kia_section_load.cpp b/engines/bladerunner/ui/kia_section_load.cpp
index 41f2e7e18f..5deefe7eb0 100644
--- a/engines/bladerunner/ui/kia_section_load.cpp
+++ b/engines/bladerunner/ui/kia_section_load.cpp
@@ -26,11 +26,11 @@
#include "bladerunner/bladerunner.h"
#include "bladerunner/game_info.h"
#include "bladerunner/savefile.h"
+#include "bladerunner/shape.h"
#include "bladerunner/text_resource.h"
#include "bladerunner/time.h"
#include "bladerunner/game_constants.h"
#include "bladerunner/ui/kia.h"
-#include "bladerunner/ui/kia_shapes.h"
#include "bladerunner/ui/ui_container.h"
#include "bladerunner/ui/ui_scroll_box.h"
diff --git a/engines/bladerunner/ui/kia_section_save.cpp b/engines/bladerunner/ui/kia_section_save.cpp
index e4a919040d..a0a45265ee 100644
--- a/engines/bladerunner/ui/kia_section_save.cpp
+++ b/engines/bladerunner/ui/kia_section_save.cpp
@@ -27,11 +27,11 @@
#include "bladerunner/font.h"
#include "bladerunner/game_info.h"
#include "bladerunner/savefile.h"
+#include "bladerunner/shape.h"
#include "bladerunner/text_resource.h"
#include "bladerunner/time.h"
#include "bladerunner/game_constants.h"
#include "bladerunner/ui/kia.h"
-#include "bladerunner/ui/kia_shapes.h"
#include "bladerunner/ui/ui_container.h"
#include "bladerunner/ui/ui_image_picker.h"
#include "bladerunner/ui/ui_input_box.h"
diff --git a/engines/bladerunner/ui/kia_section_settings.cpp b/engines/bladerunner/ui/kia_section_settings.cpp
index 8388d12e65..15d80803b5 100644
--- a/engines/bladerunner/ui/kia_section_settings.cpp
+++ b/engines/bladerunner/ui/kia_section_settings.cpp
@@ -32,10 +32,10 @@
#include "bladerunner/game_info.h"
#include "bladerunner/music.h"
#include "bladerunner/settings.h"
+#include "bladerunner/shape.h"
#include "bladerunner/subtitles.h"
#include "bladerunner/text_resource.h"
#include "bladerunner/ui/kia.h"
-#include "bladerunner/ui/kia_shapes.h"
#include "bladerunner/ui/ui_check_box.h"
#include "bladerunner/ui/ui_container.h"
#include "bladerunner/ui/ui_image_picker.h"
diff --git a/engines/bladerunner/ui/kia_section_suspects.cpp b/engines/bladerunner/ui/kia_section_suspects.cpp
index 93895a7d5b..abc8961572 100644
--- a/engines/bladerunner/ui/kia_section_suspects.cpp
+++ b/engines/bladerunner/ui/kia_section_suspects.cpp
@@ -35,7 +35,6 @@
#include "bladerunner/text_resource.h"
#include "bladerunner/ui/kia.h"
#include "bladerunner/ui/kia_log.h"
-#include "bladerunner/ui/kia_shapes.h"
#include "bladerunner/ui/ui_check_box.h"
#include "bladerunner/ui/ui_container.h"
#include "bladerunner/ui/ui_image_picker.h"
@@ -87,14 +86,14 @@ KIASectionSuspects::KIASectionSuspects(BladeRunnerEngine *vm, ActorClues *clues)
_suspectSelected = -1;
_suspectPhotoShapeId = -1;
_suspectPhotoNotUsed = -1;
- _suspectPhotoShape = nullptr;
+ _suspectPhotoShapes = new Shapes(vm);
_suspectsFoundCount = 0;
_suspectsFound.resize(_vm->_gameInfo->getSuspectCount());
_suspectsWithIdentity.resize(_vm->_gameInfo->getSuspectCount());
}
KIASectionSuspects::~KIASectionSuspects() {
- delete _suspectPhotoShape;
+ delete _suspectPhotoShapes;
_uiContainer->clear();
@@ -128,6 +127,8 @@ void KIASectionSuspects::reset() {
void KIASectionSuspects::open() {
_scheduledSwitch = false;
+ _suspectPhotoShapes->load("photos.shp");
+
_buttons->resetImages();
_buttons->defineImage(0, Common::Rect(142, 380, 191, 395), _vm->_kia->_shapes->get(79), _vm->_kia->_shapes->get(80), _vm->_kia->_shapes->get(81), _vm->_textKIA->getText(30));
_buttons->defineImage(1, Common::Rect(193, 380, 242, 395), _vm->_kia->_shapes->get(76), _vm->_kia->_shapes->get(77), _vm->_kia->_shapes->get(77), _vm->_textKIA->getText(31));
@@ -161,17 +162,14 @@ void KIASectionSuspects::close() {
_isOpen = false;
_buttons->deactivate();
_cluesScrollBox->hide();
- if (_suspectPhotoShapeId != -1) {
- delete _suspectPhotoShape;
- _suspectPhotoShape = nullptr;
- _suspectPhotoShapeId = -1;
- }
+
+ _suspectPhotoShapes->unload();
}
void KIASectionSuspects::draw(Graphics::Surface &surface) {
const char *text = nullptr;
if (_suspectPhotoShapeId != -1) {
- _suspectPhotoShape->draw(surface, 142, 150);
+ _suspectPhotoShapes->get(_suspectPhotoShapeId)->draw(surface, 142, 150);
}
if (_suspectPhotoShapeId == 14 || _suspectPhotoShapeId == 13) {
text = _vm->_textKIA->getText(49);
@@ -459,11 +457,6 @@ void KIASectionSuspects::populateVisibleClues() {
}
void KIASectionSuspects::updateSuspectPhoto() {
- if (_suspectPhotoShapeId != -1) {
- delete _suspectPhotoShape;
- _suspectPhotoShape = nullptr;
- }
-
if (_suspectSelected == -1) {
_suspectPhotoShapeId = -1;
return;
@@ -492,11 +485,6 @@ void KIASectionSuspects::updateSuspectPhoto() {
_suspectPhotoShapeId = 13;
}
}
-
- if (_suspectPhotoShapeId != -1) {
- _suspectPhotoShape = new Shape(_vm);
- _suspectPhotoShape->open("photos.shp", _suspectPhotoShapeId);
- }
}
void KIASectionSuspects::nextSuspect() {
diff --git a/engines/bladerunner/ui/kia_section_suspects.h b/engines/bladerunner/ui/kia_section_suspects.h
index c4ff35b417..dc9679331a 100644
--- a/engines/bladerunner/ui/kia_section_suspects.h
+++ b/engines/bladerunner/ui/kia_section_suspects.h
@@ -31,7 +31,7 @@ namespace BladeRunner {
class ActorClues;
class BladeRunnerEngine;
-class Shape;
+class Shapes;
class UICheckBox;
class UIContainer;
class UIImagePicker;
@@ -77,9 +77,9 @@ class KIASectionSuspects : public KIASectionBase {
int _mouseX;
int _mouseY;
- int _suspectPhotoShapeId;
- int _suspectPhotoNotUsed;
- Shape *_suspectPhotoShape;
+ int _suspectPhotoShapeId;
+ int _suspectPhotoNotUsed;
+ Shapes *_suspectPhotoShapes;
public:
int _crimeSelected;
diff --git a/engines/bladerunner/ui/kia_shapes.cpp b/engines/bladerunner/ui/kia_shapes.cpp
deleted file mode 100644
index ce5c8a7e5e..0000000000
--- a/engines/bladerunner/ui/kia_shapes.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "bladerunner/ui/kia_shapes.h"
-
-#include "bladerunner/bladerunner.h"
-
-namespace BladeRunner {
-
-KIAShapes::KIAShapes(BladeRunnerEngine *vm) {
- _vm = vm;
- _isLoaded = false;
- for (uint i = 0; i < kShapeCount; ++i) {
- _shapes[i] = nullptr;
- }
-}
-
-KIAShapes::~KIAShapes() {
- unload();
-}
-
-void KIAShapes::load() {
- if (_isLoaded) {
- return;
- }
-
- for (uint i = 0; i < kShapeCount; ++i) {
- Shape *shape = new Shape(_vm);
- shape->open("kiaopt.shp", i);
- _shapes[i] = shape;
- }
-
- _isLoaded = true;
-}
-
-void KIAShapes::unload() {
- if (!_isLoaded) {
- return;
- }
-
- for (uint i = 0; i < kShapeCount; ++i) {
- delete _shapes[i];
- _shapes[i] = nullptr;
- }
-
- _isLoaded = false;
-}
-
-const Shape *KIAShapes::get(int shapeId) const {
- return _shapes[shapeId];
-}
-
-} // End of namespace BladeRunner
diff --git a/engines/bladerunner/ui/kia_shapes.h b/engines/bladerunner/ui/kia_shapes.h
deleted file mode 100644
index af1898f408..0000000000
--- a/engines/bladerunner/ui/kia_shapes.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef BLADERUNNER_UI_SHAPES_H
-#define BLADERUNNER_UI_SHAPES_H
-
-#include "bladerunner/shape.h"
-
-#include "common/array.h"
-
-namespace BladeRunner {
-
-class BladeRunnerEngine;
-
-class KIAShapes {
- static const uint kShapeCount = 132;
-
- BladeRunnerEngine *_vm;
- const Shape *_shapes[kShapeCount];
- bool _isLoaded;
-
-public:
- KIAShapes(BladeRunnerEngine *vm);
- ~KIAShapes();
-
- void load();
- void unload();
- const Shape *get(int shapeId) const;
-};
-
-} // End of namespace BladeRunner
-
-#endif
diff --git a/engines/bladerunner/ui/spinner.cpp b/engines/bladerunner/ui/spinner.cpp
index 27116a8f20..4e7379d4d0 100644
--- a/engines/bladerunner/ui/spinner.cpp
+++ b/engines/bladerunner/ui/spinner.cpp
@@ -48,17 +48,14 @@ Spinner::Spinner(BladeRunnerEngine *vm) {
reset();
_imagePicker = new UIImagePicker(vm, kSpinnerDestinations);
_vqaPlayer = nullptr;
+ _shapes = new Shapes(vm);
}
Spinner::~Spinner() {
delete _imagePicker;
-
+ delete _vqaPlayer;
+ delete _shapes;
reset();
-
- if (_vqaPlayer != nullptr) {
- _vqaPlayer->close();
- delete _vqaPlayer;
- }
}
void Spinner::setSelectableDestinationFlag(int destination, bool selectable) {
@@ -106,25 +103,17 @@ int Spinner::chooseDestination(int loopId, bool immediately) {
}
_destinations = nullptr;
- int firstShapeId = 0;
- int shapeCount = 0;
int spinnerLoopId = 4;
- if (mapmask & 4) {
- _destinations = getDestinationsFar();
- firstShapeId = 26;
- shapeCount = 20;
- spinnerLoopId = 4;
+ if (mapmask & 1) {
+ _destinations = getDestinationsNear();
+ spinnerLoopId = 0;
} else if (mapmask & 2) {
_destinations = getDestinationsMedium();
- firstShapeId = 10;
- shapeCount = 16;
spinnerLoopId = 2;
- } else if (mapmask & 1) {
- _destinations = getDestinationsNear();
- firstShapeId = 0;
- shapeCount = 10;
- spinnerLoopId = 0;
+ } else if (mapmask & 4) {
+ _destinations = getDestinationsFar();
+ spinnerLoopId = 4;
} else {
return -1;
}
@@ -132,10 +121,7 @@ int Spinner::chooseDestination(int loopId, bool immediately) {
_vqaPlayer->setLoop(spinnerLoopId, -1, kLoopSetModeImmediate, nullptr, nullptr);
_vqaPlayer->setLoop(spinnerLoopId + 1, -1, kLoopSetModeJustStart, nullptr, nullptr);
- for (int j = 0; j != shapeCount; ++j) {
- _shapes.push_back(new Shape(_vm));
- _shapes[j]->open("SPINNER.SHP", firstShapeId + j);
- }
+ _shapes->load("SPINNER.SHP");
_imagePicker->resetImages();
@@ -149,9 +135,9 @@ int Spinner::chooseDestination(int loopId, bool immediately) {
_imagePicker->defineImage(
dest->id,
dest->rect,
- _shapes[dest->id],
- _shapes[dest->id + _shapes.size() / 2],
- _shapes[dest->id + _shapes.size() / 2],
+ _shapes->get(dest->shapeId),
+ _shapes->get(dest->shapeIdOver),
+ _shapes->get(dest->shapeIdOver),
tooltip
);
}
@@ -185,12 +171,8 @@ int Spinner::chooseDestination(int loopId, bool immediately) {
_imagePicker->deactivate();
- for (int i = 0; i != (int)_shapes.size(); ++i) {
- delete _shapes[i];
- }
- _shapes.clear();
+ _shapes->unload();
- _vqaPlayer->close();
delete _vqaPlayer;
_vqaPlayer = nullptr;
@@ -295,11 +277,6 @@ void Spinner::reset() {
_actorId = -1;
_sentenceId = -1;
_timeSpeakDescriptionStart = 0u;
-
- for (int i = 0; i != (int)_shapes.size(); ++i) {
- delete _shapes[i];
- }
- _shapes.clear();
}
void Spinner::resume() {
@@ -329,44 +306,44 @@ void Spinner::load(SaveFileReadStream &f) {
const Spinner::Destination *Spinner::getDestinationsFar() {
static const Destination destinations[] = {
- { 0, Common::Rect(220, 227, 246, 262) },
- { 1, Common::Rect(260, 252, 286, 279) },
- { 2, Common::Rect(286, 178, 302, 196) },
- { 3, Common::Rect(244, 178, 263, 195) },
- { 4, Common::Rect(288, 216, 306, 228) },
- { 5, Common::Rect(249, 77, 353, 124) },
- { 6, Common::Rect(190, 127, 208, 138) },
- { 7, Common::Rect(185, 149, 206, 170) },
- { 8, Common::Rect(398, 249, 419, 268) },
- { 9, Common::Rect(390, 218, 419, 236) },
- { -1, Common::Rect(-1, -1, -1, -1) }
+ { 0, Common::Rect(220, 227, 246, 262), 26 , 36 },
+ { 1, Common::Rect(260, 252, 286, 279), 27 , 37 },
+ { 2, Common::Rect(286, 178, 302, 196), 28 , 38 },
+ { 3, Common::Rect(244, 178, 263, 195), 29 , 39 },
+ { 4, Common::Rect(288, 216, 306, 228), 30 , 40 },
+ { 5, Common::Rect(249, 77, 353, 124), 31 , 41 },
+ { 6, Common::Rect(190, 127, 208, 138), 32 , 42 },
+ { 7, Common::Rect(185, 149, 206, 170), 33 , 43 },
+ { 8, Common::Rect(398, 249, 419, 268), 34 , 44 },
+ { 9, Common::Rect(390, 218, 419, 236), 35 , 45 },
+ { -1, Common::Rect(-1, -1, -1, -1), 0, 0 }
};
return destinations;
}
const Spinner::Destination *Spinner::getDestinationsMedium() {
static const Destination destinations[] = {
- { 0, Common::Rect(252, 242, 279, 283) },
- { 1, Common::Rect(301, 273, 328, 304) },
- { 2, Common::Rect(319, 182, 336, 200) },
- { 3, Common::Rect(269, 181, 293, 200) },
- { 4, Common::Rect(325, 227, 345, 240) },
- { 5, Common::Rect(259, 74, 380, 119) },
- { 6, Common::Rect(203, 124, 224, 136) },
- { 7, Common::Rect(200, 147, 222, 170) },
- { -1, Common::Rect(-1,-1,-1,-1) }
+ { 0, Common::Rect(252, 242, 279, 283), 10, 18 },
+ { 1, Common::Rect(301, 273, 328, 304), 11, 19 },
+ { 2, Common::Rect(319, 182, 336, 200), 12, 20 },
+ { 3, Common::Rect(269, 181, 293, 200), 13, 21 },
+ { 4, Common::Rect(325, 227, 345, 240), 14, 22 },
+ { 5, Common::Rect(259, 74, 380, 119), 15, 23 },
+ { 6, Common::Rect(203, 124, 224, 136), 16, 24 },
+ { 7, Common::Rect(200, 147, 222, 170), 17, 25 },
+ { -1, Common::Rect(-1,-1,-1,-1), 0, 0 }
};
return destinations;
}
const Spinner::Destination *Spinner::getDestinationsNear() {
static const Destination destinations[] = {
- { 0, Common::Rect(210, 263, 263, 332) },
- { 1, Common::Rect(307, 330, 361, 381) },
- { 2, Common::Rect(338, 137, 362, 169) },
- { 3, Common::Rect(248, 135, 289, 168) },
- { 4, Common::Rect(352, 222, 379, 238) },
- { -1, Common::Rect(-1,-1,-1,-1) }
+ { 0, Common::Rect(210, 263, 263, 332), 0, 5 },
+ { 1, Common::Rect(307, 330, 361, 381), 1, 6 },
+ { 2, Common::Rect(338, 137, 362, 169), 2, 7 },
+ { 3, Common::Rect(248, 135, 289, 168), 3, 8 },
+ { 4, Common::Rect(352, 222, 379, 238), 4, 9 },
+ { -1, Common::Rect(-1,-1,-1,-1), 0, 0 }
};
return destinations;
}
diff --git a/engines/bladerunner/ui/spinner.h b/engines/bladerunner/ui/spinner.h
index 2fa0dc659c..df9c666666 100644
--- a/engines/bladerunner/ui/spinner.h
+++ b/engines/bladerunner/ui/spinner.h
@@ -31,7 +31,7 @@ namespace BladeRunner {
class BladeRunnerEngine;
class SaveFileReadStream;
class SaveFileWriteStream;
-class Shape;
+class Shapes;
class UIImagePicker;
class VQAPlayer;
@@ -41,20 +41,22 @@ class Spinner {
struct Destination {
int id;
Common::Rect rect;
+ int shapeId;
+ int shapeIdOver;
};
- BladeRunnerEngine *_vm;
- bool _isDestinationSelectable[kSpinnerDestinations];
- bool _isOpen;
- VQAPlayer *_vqaPlayer;
- const Destination *_destinations;
- int _selectedDestination;
- Common::Array<Shape *> _shapes;
- UIImagePicker *_imagePicker;
-
- int _actorId;
- int _sentenceId;
- uint32 _timeSpeakDescriptionStart;
+ BladeRunnerEngine *_vm;
+ bool _isDestinationSelectable[kSpinnerDestinations];
+ bool _isOpen;
+ VQAPlayer *_vqaPlayer;
+ const Destination *_destinations;
+ int _selectedDestination;
+ Shapes *_shapes;
+ UIImagePicker *_imagePicker;
+
+ int _actorId;
+ int _sentenceId;
+ uint32 _timeSpeakDescriptionStart;
public:
Spinner(BladeRunnerEngine *vm);
diff --git a/engines/bladerunner/ui/ui_check_box.cpp b/engines/bladerunner/ui/ui_check_box.cpp
index 38fb86c679..8bc467bd0c 100644
--- a/engines/bladerunner/ui/ui_check_box.cpp
+++ b/engines/bladerunner/ui/ui_check_box.cpp
@@ -24,11 +24,11 @@
#include "bladerunner/audio_player.h"
#include "bladerunner/bladerunner.h"
+#include "bladerunner/game_constants.h"
#include "bladerunner/game_info.h"
+#include "bladerunner/shape.h"
#include "bladerunner/time.h"
-#include "bladerunner/game_constants.h"
#include "bladerunner/ui/kia.h"
-#include "bladerunner/ui/kia_shapes.h"
namespace BladeRunner {
diff --git a/engines/bladerunner/ui/ui_scroll_box.cpp b/engines/bladerunner/ui/ui_scroll_box.cpp
index b24aa89bac..b3b861e991 100644
--- a/engines/bladerunner/ui/ui_scroll_box.cpp
+++ b/engines/bladerunner/ui/ui_scroll_box.cpp
@@ -30,7 +30,6 @@
#include "bladerunner/time.h"
#include "bladerunner/game_constants.h"
#include "bladerunner/ui/kia.h"
-#include "bladerunner/ui/kia_shapes.h"
namespace BladeRunner {
diff --git a/engines/bladerunner/ui/vk.cpp b/engines/bladerunner/ui/vk.cpp
index 245bae9512..88c0892d24 100644
--- a/engines/bladerunner/ui/vk.cpp
+++ b/engines/bladerunner/ui/vk.cpp
@@ -51,12 +51,13 @@ namespace BladeRunner {
VK::VK(BladeRunnerEngine *vm) {
_vm = vm;
-
+ _shapes = new Shapes(vm);
reset();
}
VK::~VK() {
reset();
+ delete _shapes;
}
void VK::open(int actorId, int calibrationRatio) {
@@ -84,11 +85,7 @@ void VK::open(int actorId, int calibrationRatio) {
_buttons = new UIImagePicker(_vm, 8);
- _shapes.resize(15);
- for (int i = 0; i < (int)_shapes.size(); ++i) {
- _shapes[i] = new Shape(_vm);
- _shapes[i]->open("VK.SHP", i);
- }
+ _shapes->load("VK.SHP");
_vqaPlayerMain = new VQAPlayer(_vm, &_vm->_surfaceBack, "VK.VQA");
if (!_vqaPlayerMain->open()) {
@@ -176,10 +173,7 @@ void VK::close() {
_questions.clear();
- for (int i = 0; i < (int)_shapes.size(); ++i) {
- delete _shapes[i];
- }
- _shapes.clear();
+ _shapes->unload();
_vm->closeArchive("MODE.MIX");
_vm->_music->setVolume(_volumeMusic);
@@ -447,7 +441,7 @@ void VK::reset() {
_isOpen = false;
- _shapes.clear();
+ _shapes->unload();
_volumeAmbient = 0;
_volumeMusic = 0;
@@ -519,14 +513,14 @@ void VK::init() {
_vm->_mouse->disable();
_buttons->activate(nullptr, nullptr, mouseDownCallback, mouseUpCallback, this);
- _buttons->defineImage(0, Common::Rect(191, 364, 218, 373), nullptr, _shapes[2], _shapes[3], _vm->_textVK->getText(1));
- _buttons->defineImage(1, Common::Rect(154, 258, 161, 265), _shapes[4], _shapes[4], _shapes[5], _vm->_textVK->getText(2));
- _buttons->defineImage(2, Common::Rect(515, 368, 538, 398), nullptr, _shapes[6], _shapes[7], nullptr);
- _buttons->defineImage(3, Common::Rect(548, 368, 571, 398), nullptr, _shapes[8], _shapes[9], nullptr);
- _buttons->defineImage(4, Common::Rect(581, 368, 604, 398), nullptr, _shapes[10], _shapes[11], nullptr);
- _buttons->defineImage(5, Common::Rect( 31, 363, 65, 392), nullptr, _shapes[0], _shapes[1], _vm->_textVK->getText(0));
- _buttons->defineImage(6, Common::Rect( 59, 262, 87, 277), nullptr, nullptr, nullptr, _vm->_textVK->getText(6));
- _buttons->defineImage(7, Common::Rect( 59, 306, 87, 322), nullptr, nullptr, nullptr, _vm->_textVK->getText(7));
+ _buttons->defineImage(0, Common::Rect(191, 364, 218, 373), nullptr, _shapes->get(2), _shapes->get(3), _vm->_textVK->getText(1));
+ _buttons->defineImage(1, Common::Rect(154, 258, 161, 265), _shapes->get(4), _shapes->get(4), _shapes->get(5), _vm->_textVK->getText(2));
+ _buttons->defineImage(2, Common::Rect(515, 368, 538, 398), nullptr, _shapes->get(6), _shapes->get(7), nullptr);
+ _buttons->defineImage(3, Common::Rect(548, 368, 571, 398), nullptr, _shapes->get(8), _shapes->get(9), nullptr);
+ _buttons->defineImage(4, Common::Rect(581, 368, 604, 398), nullptr, _shapes->get(10), _shapes->get(11), nullptr);
+ _buttons->defineImage(5, Common::Rect( 31, 363, 65, 392), nullptr, _shapes->get(0), _shapes->get(1), _vm->_textVK->getText(0));
+ _buttons->defineImage(6, Common::Rect( 59, 262, 87, 277), nullptr, nullptr, nullptr, _vm->_textVK->getText(6));
+ _buttons->defineImage(7, Common::Rect( 59, 306, 87, 322), nullptr, nullptr, nullptr, _vm->_textVK->getText(7));
_script->initialize(_actorId);
@@ -592,11 +586,11 @@ void VK::draw() {
_blinkState = 0;
} else {
if (_humanProbability >= 80) {
- _buttons->setImageShapeUp(6, _shapes[13]);
+ _buttons->setImageShapeUp(6, _shapes->get(13));
_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(kSfxCROSLOCK), 100, 0, 0, 50, 0);
}
if (_replicantProbability >= 80) {
- _buttons->setImageShapeUp(7, _shapes[14]);
+ _buttons->setImageShapeUp(7, _shapes->get(14));
_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(kSfxCROSLOCK), 100, 0, 0, 50, 0);
}
_blinkState = 1;
@@ -662,7 +656,7 @@ void VK::draw() {
_buttons->setImageShapeUp(0, nullptr);
_blinkState = false;
} else {
- _buttons->setImageShapeUp(0, _shapes[2]);
+ _buttons->setImageShapeUp(0, _shapes->get(2));
_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(kSfxVKBEEP1), 50, 0, 0, 50, 0);
_blinkState = true;
}
@@ -696,9 +690,9 @@ void VK::draw() {
_buttons->setImageShapeUp(4, nullptr);
_blinkState = 0;
} else {
- _buttons->setImageShapeUp(2, _shapes[7]);
- _buttons->setImageShapeUp(3, _shapes[9]);
- _buttons->setImageShapeUp(4, _shapes[11]);
+ _buttons->setImageShapeUp(2, _shapes->get(7));
+ _buttons->setImageShapeUp(3, _shapes->get(9));
+ _buttons->setImageShapeUp(4, _shapes->get(11));
_blinkState = 1;
_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(kSfxVKBEEP2), 33, 0, 0, 50, 0);
@@ -857,7 +851,7 @@ void VK::drawMouse(Graphics::Surface &surface) {
}
void VK::drawGauge(Graphics::Surface &surface, int value, int x, int y, int width) {
- _shapes[12]->draw(surface, x + (width / 2) * value / 20 , y);
+ _shapes->get(12)->draw(surface, x + (width / 2) * value / 20 , y);
}
void VK::drawHumanGauge(Graphics::Surface &surface) {
@@ -885,16 +879,16 @@ void VK::calibrate() {
_calibrationStarted = true;
_buttons->setImageShapeUp(0, nullptr);
- _buttons->setImageShapeHovered(2, _shapes[6]);
- _buttons->setImageShapeDown(2, _shapes[7]);
+ _buttons->setImageShapeHovered(2, _shapes->get(6));
+ _buttons->setImageShapeDown(2, _shapes->get(7));
_buttons->setImageTooltip(2, _vm->_textVK->getText(3));
- _buttons->setImageShapeHovered(3, _shapes[8]);
- _buttons->setImageShapeDown(3, _shapes[9]);
+ _buttons->setImageShapeHovered(3, _shapes->get(8));
+ _buttons->setImageShapeDown(3, _shapes->get(9));
_buttons->setImageTooltip(3, _vm->_textVK->getText(4));
- _buttons->setImageShapeHovered(4, _shapes[10]);
- _buttons->setImageShapeDown(4, _shapes[11]);
+ _buttons->setImageShapeHovered(4, _shapes->get(10));
+ _buttons->setImageShapeDown(4, _shapes->get(11));
_buttons->setImageTooltip(4, _vm->_textVK->getText(5));
}
@@ -907,7 +901,7 @@ void VK::beginTest() {
_buttons->setImageShapeHovered(0, nullptr);
_buttons->setImageShapeDown(0, nullptr);
_buttons->setImageTooltip(0, nullptr);
- _buttons->setImageShapeDown(1, _shapes[4]);
+ _buttons->setImageShapeDown(1, _shapes->get(4));
_buttons->setImageTooltip(1, nullptr);
_buttons->setImageShapeUp(2, nullptr);
_buttons->setImageShapeUp(3, nullptr);
diff --git a/engines/bladerunner/ui/vk.h b/engines/bladerunner/ui/vk.h
index eeaee1b54d..b4a0bcc679 100644
--- a/engines/bladerunner/ui/vk.h
+++ b/engines/bladerunner/ui/vk.h
@@ -32,7 +32,7 @@ namespace BladeRunner {
class BladeRunnerEngine;
class VKScript;
-class Shape;
+class Shapes;
class UIImagePicker;
class VQAPlayer;
@@ -51,12 +51,12 @@ class VK {
VKScript *_script;
UIImagePicker *_buttons;
- Common::Array<Shape *> _shapes;
+ Shapes *_shapes;
VQAPlayer *_vqaPlayerMain;
VQAPlayer *_vqaPlayerEye;
- int _vqaFrameMain;
- bool _vqaLoopEnded;
+ int _vqaFrameMain;
+ bool _vqaLoopEnded;
Graphics::Surface _surfaceEye;