aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/ui
diff options
context:
space:
mode:
authorPeter Kohaut2018-02-12 20:53:13 +0100
committerPeter Kohaut2018-02-12 20:57:26 +0100
commit1d9a248abe37a5e8230571d2b35cd96773be7f1e (patch)
tree08fb84f18dc8b3d5dbcc12555e7804b0cfb34e0b /engines/bladerunner/ui
parent7f50c5040144627cf00ccd91831946c356c45860 (diff)
downloadscummvm-rg350-1d9a248abe37a5e8230571d2b35cd96773be7f1e.tar.gz
scummvm-rg350-1d9a248abe37a5e8230571d2b35cd96773be7f1e.tar.bz2
scummvm-rg350-1d9a248abe37a5e8230571d2b35cd96773be7f1e.zip
BLADERUNNER: Fixed more Coverity issues
Diffstat (limited to 'engines/bladerunner/ui')
-rw-r--r--engines/bladerunner/ui/kia.cpp5
-rw-r--r--engines/bladerunner/ui/kia_section_crimes.cpp4
-rw-r--r--engines/bladerunner/ui/kia_section_diagnostic.cpp10
-rw-r--r--engines/bladerunner/ui/kia_section_pogo.cpp15
-rw-r--r--engines/bladerunner/ui/kia_section_suspects.cpp8
-rw-r--r--engines/bladerunner/ui/ui_image_picker.cpp49
-rw-r--r--engines/bladerunner/ui/vk.cpp49
7 files changed, 96 insertions, 44 deletions
diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp
index c27a548b3a..0a6229411e 100644
--- a/engines/bladerunner/ui/kia.cpp
+++ b/engines/bladerunner/ui/kia.cpp
@@ -99,6 +99,11 @@ KIA::KIA(BladeRunnerEngine *vm) {
_loadSection = new KIASectionLoad(_vm);
_diagnosticSection = new KIASectionDiagnostic(_vm);
_pogoSection = new KIASectionPogo(_vm);
+
+ for (int i = 0; i < kPlayerActorDialogueQueueCapacity; ++i) {
+ _playerActorDialogueQueue[i].actorId = -1;
+ _playerActorDialogueQueue[i].sentenceId = -1;
+ }
}
KIA::~KIA() {
diff --git a/engines/bladerunner/ui/kia_section_crimes.cpp b/engines/bladerunner/ui/kia_section_crimes.cpp
index 417a0588e0..96075fbc22 100644
--- a/engines/bladerunner/ui/kia_section_crimes.cpp
+++ b/engines/bladerunner/ui/kia_section_crimes.cpp
@@ -60,6 +60,10 @@ KIASectionCrimes::KIASectionCrimes(BladeRunnerEngine *vm, ActorClues *clues) : K
_uiContainer->add(_cluesScrollBox);
_acquiredClueCount = 0;
+ for (int i = 0; i < kClueCount; ++i) {
+ _acquiredClues[i].clueId = -1;
+ _acquiredClues[i].actorId = -1;
+ }
_crimeSelected = -1;
_crimesFoundCount = 0;
diff --git a/engines/bladerunner/ui/kia_section_diagnostic.cpp b/engines/bladerunner/ui/kia_section_diagnostic.cpp
index d4ccc32433..55672cdf2c 100644
--- a/engines/bladerunner/ui/kia_section_diagnostic.cpp
+++ b/engines/bladerunner/ui/kia_section_diagnostic.cpp
@@ -32,11 +32,17 @@ namespace BladeRunner {
const int KIASectionDiagnostic::kTextColors[] = { 0x0000, 0x0821, 0x1061, 0x1C82, 0x24C2, 0x2CE3, 0x3524, 0x4145, 0x4586, 0x4DC7, 0x5609, 0x5E4B, 0x668C, 0x6EEE, 0x7730, 0x7B92 };
-KIASectionDiagnostic::KIASectionDiagnostic(BladeRunnerEngine *vm) : KIASectionBase(vm) {}
+KIASectionDiagnostic::KIASectionDiagnostic(BladeRunnerEngine *vm) : KIASectionBase(vm) {
+ _text = nullptr;
+ _offset = 0;
+ _timeLast = 0;
+}
void KIASectionDiagnostic::open() {
_text = new TextResource(_vm);
- _text->open("KIACRED");
+ if (!_text->open("KIACRED")) {
+ return;
+ }
_vm->_kia->playActorDialogue(kActorRunciter, 140);
_offset = 0;
_timeLast = _vm->getTotalPlayTime();
diff --git a/engines/bladerunner/ui/kia_section_pogo.cpp b/engines/bladerunner/ui/kia_section_pogo.cpp
index 27cd9891c6..a0c5ac6a63 100644
--- a/engines/bladerunner/ui/kia_section_pogo.cpp
+++ b/engines/bladerunner/ui/kia_section_pogo.cpp
@@ -193,7 +193,20 @@ const char *KIASectionPogo::kStrings[] = {
"Zion National Park"
};
-KIASectionPogo::KIASectionPogo(BladeRunnerEngine *vm) : KIASectionBase(vm) {}
+KIASectionPogo::KIASectionPogo(BladeRunnerEngine *vm) : KIASectionBase(vm) {
+ _stringIndex = 0;
+ _timeLast = 0;
+
+ for (int i = 0; i < kStringCount; ++i) {
+ _strings[i] = nullptr;
+ }
+
+ for (int i = 0; i < kLineCount; ++i) {
+ _lineTexts[i] = nullptr;
+ _lineTimeouts[i] = 0;
+ _lineOffsets[i] = 0;
+ }
+}
void KIASectionPogo::open() {
_stringIndex = 0;
diff --git a/engines/bladerunner/ui/kia_section_suspects.cpp b/engines/bladerunner/ui/kia_section_suspects.cpp
index af2c457d92..54e33cb62b 100644
--- a/engines/bladerunner/ui/kia_section_suspects.cpp
+++ b/engines/bladerunner/ui/kia_section_suspects.cpp
@@ -77,6 +77,12 @@ KIASectionSuspects::KIASectionSuspects(BladeRunnerEngine *vm, ActorClues *clues)
_uiContainer->add(_crimesScrollBox);
_acquiredClueCount = 0;
+ for (int i = 0; i < kClueCount; ++i) {
+ _acquiredClues[i].clueId = -1;
+ _acquiredClues[i].actorId = -1;
+ }
+
+ _crimeSelected = -1;
_suspectSelected = -1;
_suspectPhotoShapeId = -1;
@@ -84,8 +90,6 @@ KIASectionSuspects::KIASectionSuspects(BladeRunnerEngine *vm, ActorClues *clues)
_suspectsFoundCount = 0;
_suspectsFound.resize(_vm->_gameInfo->getSuspectCount());
_suspectsWithIdentity.resize(_vm->_gameInfo->getSuspectCount());
-
- _crimeSelected = -1;
}
KIASectionSuspects::~KIASectionSuspects() {
diff --git a/engines/bladerunner/ui/ui_image_picker.cpp b/engines/bladerunner/ui/ui_image_picker.cpp
index 639c02f592..5cee12fef8 100644
--- a/engines/bladerunner/ui/ui_image_picker.cpp
+++ b/engines/bladerunner/ui/ui_image_picker.cpp
@@ -159,29 +159,29 @@ void UIImagePicker::activate(UIImagePickerCallback *mouseInCallback,
UIImagePickerCallback *mouseDownCallback,
UIImagePickerCallback *mouseUpCallback,
void *callbackData) {
- _isButtonDown = false;
- _mouseInCallback = mouseInCallback;
- _mouseOutCallback = mouseOutCallback;
- _mouseDownCallback = mouseDownCallback;
- _mouseUpCallback = mouseUpCallback;
- _callbackData = callbackData;
+ _isButtonDown = false;
+ _mouseInCallback = mouseInCallback;
+ _mouseOutCallback = mouseOutCallback;
+ _mouseDownCallback = mouseDownCallback;
+ _mouseUpCallback = mouseUpCallback;
+ _callbackData = callbackData;
_hoverStartTimestamp = 0;
- _isVisible = true;
- _hoveredImageIndex = -1;
- _pressedImageIndex = -1;
+ _isVisible = true;
+ _hoveredImageIndex = -1;
+ _pressedImageIndex = -1;
}
void UIImagePicker::deactivate() {
- _isButtonDown = false;
- _mouseInCallback = nullptr;
- _mouseOutCallback = nullptr;
- _mouseDownCallback = nullptr;
- _mouseUpCallback = nullptr;
- _callbackData = nullptr;
+ _isButtonDown = false;
+ _mouseInCallback = nullptr;
+ _mouseOutCallback = nullptr;
+ _mouseDownCallback = nullptr;
+ _mouseUpCallback = nullptr;
+ _callbackData = nullptr;
_hoverStartTimestamp = 0;
- _isVisible = false;
- _hoveredImageIndex = -1;
- _pressedImageIndex = -1;
+ _isVisible = false;
+ _hoveredImageIndex = -1;
+ _pressedImageIndex = -1;
}
void UIImagePicker::draw(Graphics::Surface &surface) {
@@ -343,6 +343,17 @@ bool UIImagePicker::hasHoveredImage() {
return _hoveredImageIndex >= 0;
}
-void UIImagePicker::reset() {}
+void UIImagePicker::reset() {
+ _isVisible = false;
+ _hoveredImageIndex = -1;
+ _pressedImageIndex = -1;
+ _hoverStartTimestamp = 0;
+ _isButtonDown = false;
+ _mouseInCallback = nullptr;
+ _mouseOutCallback = nullptr;
+ _mouseDownCallback = nullptr;
+ _mouseUpCallback = nullptr;
+ _callbackData = nullptr;
+}
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/ui/vk.cpp b/engines/bladerunner/ui/vk.cpp
index 8145ee39db..ebd088735e 100644
--- a/engines/bladerunner/ui/vk.cpp
+++ b/engines/bladerunner/ui/vk.cpp
@@ -73,11 +73,11 @@ void VK::open(int actorId, int calibrationRatio) {
}
_volumeAmbient = _vm->_ambientSounds->getVolume();
- _volumeMusic = _vm->_music->getVolume();
+ _volumeMusic = _vm->_music->getVolume();
- _actorId = actorId;
+ _actorId = actorId;
_calibrationRatio = calibrationRatio;
- _calibration = 0;
+ _calibration = 0;
_buttons = new UIImagePicker(_vm, 8);
@@ -371,9 +371,12 @@ void VK::loopEnded(void *callbackData, int frame, int loopId) {
}
void VK::reset() {
+ _actorId = -1;
+
_buttons = nullptr;
_vqaPlayerMain = nullptr;
_vqaPlayerEye = nullptr;
+ _vqaFrameMain = -1;
_script = nullptr;
@@ -381,6 +384,10 @@ void VK::reset() {
_shapes.clear();
+ _volumeAmbient = 0;
+ _volumeMusic = 0;
+
+ _calibrationRatio = 0;
_calibrationCounter = 0;
_calibrationStarted = false;
_calibration = 0;
@@ -390,6 +397,7 @@ void VK::reset() {
_needleValue = 0;
_needleValueTarget = 0;
_needleValueDelta = 0;
+ _needleValueMax = 0;
_timeNextNeedleStep = 0;
_timeNeedleReturn = 0;
_timeNextNeedleOscillate = 0;
@@ -415,10 +423,11 @@ void VK::reset() {
_isClosing = false;
_timeClose = 0;
- _isAdjusting = false;
- _adjustment = 154;
- _adjustmentTarget = 154;
- _adjustmentDelta = 0;
+ _isAdjusting = false;
+ _adjustment = 154;
+ _adjustmentTarget = 154;
+ _adjustmentDelta = 0;
+ _timeNextAdjustementStep = 0;
_eyeLineSelected = 1;
_eyeLineX = 315;
@@ -877,24 +886,24 @@ void VK::askQuestion(int intensity) {
return;
}
- int foundQuestionIndex = -1;
+ int foundQuestionIndex = -1;
int foundQuestionIndexLast = -1;
for (int i = 0; i < (int)_questions[intensity].size(); ++i) {
if (_questions[intensity][i].isPresent && !_questions[intensity][i].wasAsked) {
- int relatedQuestion = -1;
- if (_questions[intensity][i].relatedSentenceId >= 0) {
- // TODO: but not used in game
- // relatedQuestion = vk::findQuestionById(this, questions, relatedQuestionId);
- }
-
- if (relatedQuestion < 0 || _questions[intensity][relatedQuestion].wasAsked) {
- foundQuestionIndexLast = i;
- if (_vm->_rnd.getRandomNumberRng(0, 100) < 20) {
- foundQuestionIndex = i;
- break;
- }
+ // TODO: related questions are not used in game
+ // int relatedQuestion = -1;
+ // if (_questions[intensity][i].relatedSentenceId >= 0) {
+ // relatedQuestion = vk::findQuestionById(this, questions, relatedQuestionId);
+ // }
+
+ // if (relatedQuestion < 0 || _questions[intensity][relatedQuestion].wasAsked) {
+ foundQuestionIndexLast = i;
+ if (_vm->_rnd.getRandomNumberRng(0, 100) < 20) {
+ foundQuestionIndex = i;
+ break;
}
+ // }
}
}