aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-04-13 22:55:07 -0500
committerPaul Gilbert2015-04-13 22:55:07 -0500
commit38b6aa70a82fb05ee7e1581a239e054a9d304827 (patch)
tree3ef51b2178307c401870375a6fe6ace2ea696239 /engines
parent3be28b495dbedc3a94b366edd6178cbf0941cc77 (diff)
downloadscummvm-rg350-38b6aa70a82fb05ee7e1581a239e054a9d304827.tar.gz
scummvm-rg350-38b6aa70a82fb05ee7e1581a239e054a9d304827.tar.bz2
scummvm-rg350-38b6aa70a82fb05ee7e1581a239e054a9d304827.zip
SHERLOCK: Fixes for talk setup and portrait loading
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/objects.cpp1
-rw-r--r--engines/sherlock/people.cpp8
-rw-r--r--engines/sherlock/people.h3
-rw-r--r--engines/sherlock/sound.cpp6
-rw-r--r--engines/sherlock/talk.cpp35
-rw-r--r--engines/sherlock/user_interface.cpp3
6 files changed, 31 insertions, 25 deletions
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index cab35f9634..4cf26a3ad7 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -962,7 +962,6 @@ int Object::pickUpObject(const char *const messages[]) {
bool printed = false;
bool takeFlag = true;
int numObjects = 0;
- int message;
if (pickup == 99) {
for (int idx = 0; idx < 4 && !talk._talkToAbort; ++idx) {
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index e6a4eeed0f..5dd50e7e94 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -196,7 +196,7 @@ People::People(SherlockEngine *vm) : _vm(vm), _player(_data[0]) {
_oldWalkSequence = -1;
_allowWalkAbort = false;
_portraitLoaded = false;
- _portraitsOn = false;
+ _portraitsOn = true;
_clearingThePortrait = false;
_srcZone = _destZone = 0;
_talkPics = nullptr;
@@ -204,12 +204,15 @@ People::People(SherlockEngine *vm) : _vm(vm), _player(_data[0]) {
_speakerFlip = false;
_holmesFlip = false;
_homesQuotient = 0;
+
+ _portrait._sequences = new byte[32];
}
People::~People() {
if (_walkLoaded)
delete _data[PLAYER]._images;
delete _talkPics;
+ delete[] _portrait._sequences;
}
void People::reset() {
@@ -646,7 +649,8 @@ void People::setTalking(int speaker) {
if (_portraitsOn) {
delete _talkPics;
- _talkPics = new ImageFile("portrait.lib");
+ Common::String filename = Common::String::format("%s.vgs", PORTRAITS[speaker]);
+ _talkPics = new ImageFile(filename);
// Load portrait sequences
Common::SeekableReadStream *stream = res.load("sequence.txt");
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index 601fe6006b..593b516ee6 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -51,6 +51,9 @@ enum {
MAP_DOWN = 5, MAP_DOWNLEFT = 6, MAP_LEFT = 2, MAP_UPLEFT = 8
};
+extern const char *const NAMES[MAX_PEOPLE];
+extern const char PORTRAITS[MAX_PEOPLE][5];
+
class SherlockEngine;
class Person: public Sprite {
diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp
index 771d5db9d5..c3e50a8be2 100644
--- a/engines/sherlock/sound.cpp
+++ b/engines/sherlock/sound.cpp
@@ -25,9 +25,9 @@
namespace Sherlock {
Sound::Sound(SherlockEngine *vm): _vm(vm) {
- _soundOn = true;
- _musicOn = true;
- _speechOn = true;
+ _soundOn = false;
+ _musicOn = false;
+ _speechOn = false;
_voices = 0;
_playingEpilogue = false;
_music = false;
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp
index a40d3ace2d..279e6de69a 100644
--- a/engines/sherlock/talk.cpp
+++ b/engines/sherlock/talk.cpp
@@ -96,9 +96,9 @@ void Statement::synchronize(Common::SeekableReadStream &s) {
// Read in flag required/modified data
for (uint idx = 0; idx < _required.size(); ++idx)
- _required[idx] = s.readUint16LE();
+ _required[idx] = s.readSint16LE();
for (uint idx = 0; idx < _modified.size(); ++idx)
- _modified[idx] = s.readUint16LE();
+ _modified[idx] = s.readSint16LE();
_portraitSide = s.readByte();
_quotient = s.readUint16LE();
@@ -583,8 +583,8 @@ void Talk::loadTalkFile(const Common::String &filename) {
// Check for an existing person being talked to
_talkTo = -1;
- for (int idx = 0; idx < NUM_OF_PEOPLE; ++idx) {
- if (!scumm_strnicmp(filename.c_str(), people[(PeopleId)idx]._portrait.c_str(), 4)) {
+ for (int idx = 0; idx < MAX_PEOPLE; ++idx) {
+ if (!scumm_strnicmp(filename.c_str(), PORTRAITS[idx], 4)) {
_talkTo = idx;
break;
}
@@ -1036,7 +1036,7 @@ void Talk::doScript(const Common::String &script) {
ui.clearWindow();
// Need to switch speakers?
- if (str[0] == SWITCH_SPEAKER) {
+ if ((byte)str[0] == SWITCH_SPEAKER) {
_speaker = str[1] - 1;
str += 2;
pullSequence();
@@ -1048,7 +1048,7 @@ void Talk::doScript(const Common::String &script) {
}
// Assign portrait location?
- if (str[0] == ASSIGN_PORTRAIT_LOCATION) {
+ if ((byte)str[0] == ASSIGN_PORTRAIT_LOCATION) {
switch (str[1] & 15) {
case 1:
people._portraitSide = 20;
@@ -1083,15 +1083,16 @@ void Talk::doScript(const Common::String &script) {
Common::String tempString;
wait = 0;
- if (!str[0]) {
+ byte c = (byte)str[0];
+ if (!c) {
endStr = true;
- } else if (str[0] == '{') {
+ } else if (c == '{') {
// Start of comment, so skip over it
while (*str++ != '}')
;
- } else if (str[0] >= 128) {
+ } else if (c >= 128) {
// Handle control code
- switch (str[0]) {
+ switch (c) {
case SWITCH_SPEAKER:
// Save the current point in the script, since it might be intterupted by
// doing bg anims in the next call, so we need to know where to return to
@@ -1157,7 +1158,7 @@ void Talk::doScript(const Common::String &script) {
// doing bg anims in the next call, so we need to know where to return to
_scriptCurrentIndex = str - script.c_str();
- if (_speaker < 128)
+ if (_speaker >= 0 && _speaker < 128)
people.clearTalking();
pullSequence();
if (_talkToAbort)
@@ -1508,9 +1509,9 @@ void Talk::doScript(const Common::String &script) {
// If the window is open, display the name directly on-screen.
// Otherwise, simply draw it on the back buffer
if (ui._windowOpen) {
- screen.print(Common::Point(16, yp), TALK_FOREGROUND, inv._names[_speaker & 127].c_str());
+ screen.print(Common::Point(16, yp), TALK_FOREGROUND, NAMES[_speaker & 127]);
} else {
- screen.gPrint(Common::Point(16, yp - 1), TALK_FOREGROUND, inv._names[_speaker & 127].c_str());
+ screen.gPrint(Common::Point(16, yp - 1), TALK_FOREGROUND, NAMES[_speaker & 127]);
openTalkWindow = true;
}
@@ -1523,10 +1524,10 @@ void Talk::doScript(const Common::String &script) {
width += screen.charWidth(str[idx]);
++idx;
++charCount;
- } while (width < 298 && str[idx] && str[idx] != '{' && str[idx] < 128);
+ } while (width < 298 && str[idx] && str[idx] != '{' && (byte)str[idx] < 128);
if (str[idx] || width >= 298) {
- if (str[idx] < 128 && str[idx] != '{') {
+ if ((byte)str[idx] < 128 && str[idx] != '{') {
--idx;
--charCount;
}
@@ -1565,7 +1566,7 @@ void Talk::doScript(const Common::String &script) {
str += idx;
// If line wrap occurred, then move to after the separating space between the words
- if (str[0] < 128 && str[0] != '{')
+ if ((byte)str[0] < 128 && str[0] != '{')
++str;
yp += 9;
@@ -1578,7 +1579,7 @@ void Talk::doScript(const Common::String &script) {
wait = 1;
}
- switch (str[0]) {
+ switch ((byte)str[0]) {
case SWITCH_SPEAKER:
case ASSIGN_PORTRAIT_LOCATION:
case BANISH_WINDOW:
diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp
index dc87cf130c..43ae76f94b 100644
--- a/engines/sherlock/user_interface.cpp
+++ b/engines/sherlock/user_interface.cpp
@@ -2200,7 +2200,6 @@ void UserInterface::checkUseAction(const UseType *use, const Common::String &inv
if (targetNum != -1) {
// Found a target, so do the action
const UseType &action = use[targetNum];
- int messageNum = action._cAnimNum;
events.setCursor(WAIT);
@@ -2318,7 +2317,7 @@ void UserInterface::checkAction(ActionType &action, const char *const messages[]
people[AL]._sequenceNumber = dir;
people.gotoStand(people[AL]);
- talk.talkTo(action._names[nameIdx] + 2);
+ talk.talkTo(action._names[nameIdx].c_str() + 2);
if (ch == 'T')
doCAnim = false;
}