aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/ui
diff options
context:
space:
mode:
authorPeter Kohaut2018-02-01 20:40:49 +0100
committerPeter Kohaut2018-02-01 21:38:30 +0100
commit7f53a0cd31f07cdcc9610b3c6972002e296ff0ee (patch)
treed01c2b034c231fd452ac18d95edad6e733c75581 /engines/bladerunner/ui
parent2e74fd8f224428a368cb3301c12e613d3111d424 (diff)
downloadscummvm-rg350-7f53a0cd31f07cdcc9610b3c6972002e296ff0ee.tar.gz
scummvm-rg350-7f53a0cd31f07cdcc9610b3c6972002e296ff0ee.tar.bz2
scummvm-rg350-7f53a0cd31f07cdcc9610b3c6972002e296ff0ee.zip
BLADERUNNER: Fixed few Coverity issues
Diffstat (limited to 'engines/bladerunner/ui')
-rw-r--r--engines/bladerunner/ui/elevator.cpp1
-rw-r--r--engines/bladerunner/ui/kia.cpp22
-rw-r--r--engines/bladerunner/ui/kia.h10
-rw-r--r--engines/bladerunner/ui/kia_section_crimes.h2
-rw-r--r--engines/bladerunner/ui/kia_section_help.cpp4
-rw-r--r--engines/bladerunner/ui/kia_shapes.cpp3
-rw-r--r--engines/bladerunner/ui/spinner.cpp10
-rw-r--r--engines/bladerunner/ui/ui_scroll_box.cpp4
-rw-r--r--engines/bladerunner/ui/ui_slider.cpp1
9 files changed, 33 insertions, 24 deletions
diff --git a/engines/bladerunner/ui/elevator.cpp b/engines/bladerunner/ui/elevator.cpp
index f0c8d7d921..1ee4115fab 100644
--- a/engines/bladerunner/ui/elevator.cpp
+++ b/engines/bladerunner/ui/elevator.cpp
@@ -241,6 +241,7 @@ void Elevator::reset() {
_actorId = -1;
_sentenceId = -1;
_timeSpeakDescription = 0;
+ _buttonClicked = false;
}
void Elevator::buttonFocus(int buttonId) {
diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp
index 24316aa53e..95a66b6332 100644
--- a/engines/bladerunner/ui/kia.cpp
+++ b/engines/bladerunner/ui/kia.cpp
@@ -91,17 +91,14 @@ KIA::KIA(BladeRunnerEngine *vm) {
_playerPhotograph = nullptr;
_playerSliceModelId = -1;
_playerSliceModelAngle = 0.0f;
- // _playerImage = nullptr;
_timeLast = _vm->getTotalPlayTime();
- _playerActorDialogueQueueCapacity = 31;
_playerActorDialogueQueuePosition = 0;
_playerActorDialogueQueueSize = 0;
- _playerActorDialogueQueue = new ActorDialogueQueueEntry[_playerActorDialogueQueueCapacity];
_playerActorDialogueState = 0;
_currentSection = nullptr;
_mainVqaPlayer = nullptr;
_playerVqaPlayer = nullptr;
- // _thumbnail = nullptr;
+ _transitionId = 0;
_pogoPos = 0;
@@ -119,10 +116,17 @@ KIA::KIA(BladeRunnerEngine *vm) {
}
KIA::~KIA() {
- delete _playerPhotograph;
- // delete _playerImage;
- // delete _thumbnail;
+ delete _crimesSection;
+ delete _suspectsSection;
+ delete _cluesSection;
delete _settingsSection;
+ delete _helpSection;
+ delete _saveSection;
+ delete _loadSection;
+ delete _diagnosticSection;
+ delete _pogoSection;
+
+ delete _playerPhotograph;
delete _buttons;
delete _shapes;
delete _log;
@@ -155,7 +159,7 @@ void KIA::tick() {
} else if (_playerActorDialogueState == 200) {
if (!_vm->_actors[_playerActorDialogueQueue[_playerActorDialogueQueuePosition].actorId]->isSpeeching()) {
if (_playerActorDialogueQueueSize != _playerActorDialogueQueuePosition) {
- _playerActorDialogueQueuePosition = (_playerActorDialogueQueuePosition + 1) % _playerActorDialogueQueueCapacity;
+ _playerActorDialogueQueuePosition = (_playerActorDialogueQueuePosition + 1) % kPlayerActorDialogueQueueCapacity;
}
if (_playerActorDialogueQueueSize != _playerActorDialogueQueuePosition) {
_vm->_actors[_playerActorDialogueQueue[_playerActorDialogueQueuePosition].actorId]->speechPlay(_playerActorDialogueQueue[_playerActorDialogueQueuePosition].sentenceId, true);
@@ -444,7 +448,7 @@ void KIA::playerReset() {
}
void KIA::playActorDialogue(int actorId, int sentenceId) {
- int newQueueSize = (_playerActorDialogueQueueSize + 1) % _playerActorDialogueQueueCapacity;
+ int newQueueSize = (_playerActorDialogueQueueSize + 1) % kPlayerActorDialogueQueueCapacity;
if (newQueueSize != _playerActorDialogueQueuePosition) {
_playerActorDialogueQueue[_playerActorDialogueQueueSize].actorId = actorId;
_playerActorDialogueQueue[_playerActorDialogueQueueSize].sentenceId = sentenceId;
diff --git a/engines/bladerunner/ui/kia.h b/engines/bladerunner/ui/kia.h
index c979f9ff8b..0452230382 100644
--- a/engines/bladerunner/ui/kia.h
+++ b/engines/bladerunner/ui/kia.h
@@ -56,6 +56,7 @@ class VQAPlayer;
class KIA {
static const char *kPogo;
+ static const int kPlayerActorDialogueQueueCapacity = 31;
struct ActorDialogueQueueEntry {
int actorId;
@@ -80,11 +81,10 @@ class KIA {
float _playerSliceModelAngle;
int _timeLast;
- ActorDialogueQueueEntry *_playerActorDialogueQueue;
- int _playerActorDialogueQueueCapacity;
- int _playerActorDialogueQueuePosition;
- int _playerActorDialogueQueueSize;
- int _playerActorDialogueState;
+ ActorDialogueQueueEntry _playerActorDialogueQueue[kPlayerActorDialogueQueueCapacity];
+ int _playerActorDialogueQueuePosition;
+ int _playerActorDialogueQueueSize;
+ int _playerActorDialogueState;
KIASectionBase *_currentSection;
KIASectionClues *_cluesSection;
diff --git a/engines/bladerunner/ui/kia_section_crimes.h b/engines/bladerunner/ui/kia_section_crimes.h
index 1ca60eb02b..23983b8d39 100644
--- a/engines/bladerunner/ui/kia_section_crimes.h
+++ b/engines/bladerunner/ui/kia_section_crimes.h
@@ -72,7 +72,7 @@ class KIASectionCrimes : public KIASectionBase {
Shape *_suspectPhotoShape;
public:
- int _suspectSelected;
+ int _suspectSelected;
public:
KIASectionCrimes(BladeRunnerEngine *vm, ActorClues *clues);
diff --git a/engines/bladerunner/ui/kia_section_help.cpp b/engines/bladerunner/ui/kia_section_help.cpp
index 5065382c41..61cfc99157 100644
--- a/engines/bladerunner/ui/kia_section_help.cpp
+++ b/engines/bladerunner/ui/kia_section_help.cpp
@@ -46,7 +46,9 @@ KIASectionHelp::~KIASectionHelp() {
void KIASectionHelp::open() {
TextResource textResource(_vm);
- textResource.open("HELP");
+ if (!textResource.open("HELP")) {
+ return;
+ }
_scrollBox->clearLines();
diff --git a/engines/bladerunner/ui/kia_shapes.cpp b/engines/bladerunner/ui/kia_shapes.cpp
index 6835216e26..d992ec7045 100644
--- a/engines/bladerunner/ui/kia_shapes.cpp
+++ b/engines/bladerunner/ui/kia_shapes.cpp
@@ -29,6 +29,9 @@ namespace BladeRunner {
KIAShapes::KIAShapes(BladeRunnerEngine *vm) {
_vm = vm;
_isLoaded = false;
+ for (uint i = 0; i < kShapeCount; ++i) {
+ _shapes[i] = nullptr;
+ }
}
KIAShapes::~KIAShapes() {
diff --git a/engines/bladerunner/ui/spinner.cpp b/engines/bladerunner/ui/spinner.cpp
index cc913e3a9c..72c8b19070 100644
--- a/engines/bladerunner/ui/spinner.cpp
+++ b/engines/bladerunner/ui/spinner.cpp
@@ -99,8 +99,6 @@ int Spinner::chooseDestination(int loopId, bool immediately) {
int shapeCount = 0;
int spinnerLoopId = 4;
- mapmask = 1;
-
if (mapmask & 4) {
_destinations = getDestinationsFar();
firstShapeId = 26;
@@ -168,11 +166,9 @@ int Spinner::chooseDestination(int loopId, bool immediately) {
}
_shapes.clear();
- if (_vqaPlayer != nullptr) {
- _vqaPlayer->close();
- delete _vqaPlayer;
- _vqaPlayer = nullptr;
- }
+ _vqaPlayer->close();
+ delete _vqaPlayer;
+ _vqaPlayer = nullptr;
_vm->closeArchive("MODE.MIX");
diff --git a/engines/bladerunner/ui/ui_scroll_box.cpp b/engines/bladerunner/ui/ui_scroll_box.cpp
index a0d53a444d..6bd4dabdd4 100644
--- a/engines/bladerunner/ui/ui_scroll_box.cpp
+++ b/engines/bladerunner/ui/ui_scroll_box.cpp
@@ -75,8 +75,10 @@ UIScrollBox::UIScrollBox(BladeRunnerEngine *vm, UIScrollBoxCallback *lineSelecte
_maxLineCount = maxLineCount;
_firstLineVisible = 0;
+ _maxLinesVisible = _rect.height() / kLineHeight;
+
+ _mouseButton = false;
- _maxLinesVisible = _rect.height() / kLineHeight;
_rect.bottom = _rect.top + kLineHeight * _maxLinesVisible - 1;
_lines.resize(_maxLineCount);
diff --git a/engines/bladerunner/ui/ui_slider.cpp b/engines/bladerunner/ui/ui_slider.cpp
index d25b7fac2c..88d9567639 100644
--- a/engines/bladerunner/ui/ui_slider.cpp
+++ b/engines/bladerunner/ui/ui_slider.cpp
@@ -44,6 +44,7 @@ UISlider::UISlider(BladeRunnerEngine *vm, UIComponentCallback *valueChangedCallb
_currentFrameColor = 0;
_hasFocus = false;
_pressedStatus = 0;
+ _mouseX = 0;
}
void UISlider::draw(Graphics::Surface &surface) {