aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-03-31 22:42:57 -0400
committerPaul Gilbert2015-03-31 22:42:57 -0400
commit1199cf724c7507fb54a52eea842ac2bcc6864736 (patch)
tree3dadbc8201a1309742172ba2e2c6125e3666ed28 /engines
parent8fa8b14762ce655d0d99782864be927d3c946cba (diff)
downloadscummvm-rg350-1199cf724c7507fb54a52eea842ac2bcc6864736.tar.gz
scummvm-rg350-1199cf724c7507fb54a52eea842ac2bcc6864736.tar.bz2
scummvm-rg350-1199cf724c7507fb54a52eea842ac2bcc6864736.zip
SHERLOCK: Loading for TALK_SEQUENCES and STILL_SEQUENCES Scalpel arrays
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/people.cpp5
-rw-r--r--engines/sherlock/people.h2
-rw-r--r--engines/sherlock/scalpel/scalpel.cpp145
-rw-r--r--engines/sherlock/scripts.cpp12
-rw-r--r--engines/sherlock/scripts.h6
-rw-r--r--engines/sherlock/talk.cpp100
-rw-r--r--engines/sherlock/talk.h27
7 files changed, 257 insertions, 40 deletions
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index 8d4fa68117..3da35f2fec 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -470,4 +470,9 @@ void People::clearTalking() {
}
}
+int People::findSpeaker(int speaker) {
+ // TODO
+ return -1;
+}
+
} // End of namespace Sherlock
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index 1c67ff8996..aa54c67567 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -100,6 +100,8 @@ public:
void goAllTheWay();
void clearTalking();
+
+ int findSpeaker(int speaker);
};
} // End of namespace Sherlock
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index d226c2e82a..0432dc2278 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -39,6 +39,148 @@ const int MAP_Y[NUM_PLACES] = {
37, 0, 70, 0, 116, 0, 0, 0, 50, 21, 0, 303, 0, 0, 229, 0, 0
};
+#define MAX_PEOPLE 66
+
+const byte STILL_SEQUENCES[MAX_PEOPLE][MAX_TALK_SEQUENCES] = {
+ { 1, 0, 0 }, // Sherlock Holmes
+ { 6, 0, 0 }, // Dr. Watson
+ { 4, 0, 0 }, // Inspector Lestrade
+ { 2, 0, 0 }, // Constable #1
+ { 2, 0, 0 }, // Constable #2
+ { 2, 0, 0 }, // Sheila Parker
+ { 3, 0, 0 }, // Henry Carruthers
+ { 9, 0, 0 }, // Lesly (flower girl)
+ { 13, 0, 0 }, // Usher #1
+ { 2, 0, 0 }, // Usher #2
+ { 4, 0, 0 }, // Fredrick Epstein
+ { 9, 0, 0 }, // Mrs.Worthington
+ { 2, 0, 0 }, // Coach
+ { 8, 0, 0 }, // Player
+ { 13, 0, 0 }, // Waterboy
+ { 6, 0, 0 }, // James Sanders
+ { 1, 0, 0 }, // Belle (perfumerie)
+ { 20, 0, 0 }, // Cleaning Girl (perfumerie)
+ { 17, 0, 0 }, // Epstien in the Opera Balcony
+ { 3, 0, 0 }, // Wiggins
+ { 2, 0, 0 }, // Paul (Brumwell/Carroway)
+ { 1, 0, 0 }, // Bartender
+ { 1, 0, 0 }, // Dirty Drunk
+ { 1, 0, 0 }, // Shouting Drunk
+ { 1, 0, 0 }, // Staggering Drunk
+ { 1, 0, 0 }, // Bouncer
+ { 6, 0, 0 }, // James Sanders - At Home
+ { 6, 0, 0 }, // The Coroner
+ { 1, 0, 0 }, // The Equestrian Shop Keeper
+ { 1, 0, 0 }, // George Blackwood
+ { 7, 0, 0 }, // Lars
+ { 1, 0, 0 }, // Sheila Parker
+ { 8, 0, 0 }, // Chemist
+ { 6, 0, 0 }, // Inspector Gregson
+ { 1, 0, 0 }, // Lawyer
+ { 1, 0, 0 }, // Mycroft
+ { 7, 0, 0 }, // Old Sherman
+ { 1, 0, 0 }, // Stock Boy in Chemist Shop
+ { 1, 0, 0 }, // Barman
+ { 1, 0, 0 }, // Dandy Player
+ { 1, 0, 0 }, // Rough-looking Player
+ { 1, 0, 0 }, // Spectator
+ { 1, 0, 0 }, // Robert Hunt
+ { 3, 0, 0 }, // Violet Secretary
+ { 1, 0, 0 }, // Pettigrew
+ { 8, 0, 0 }, // Augie (apple seller)
+ { 16, 0, 0 }, // Anna Carroway
+ { 1, 0, 0 }, // Guard
+ { 8, 0, 0 }, // Antonio Caruso
+ { 1, 0, 0 }, // Toby the Dog
+ { 13, 0, 0 }, // Simon Kingsley
+ { 2, 0, 0 }, // Alfred Tobacco Clerk
+ { 1, 0, 0 }, // Lady Brumwell
+ { 1, 0, 0 }, // Madame Rosa
+ { 1, 0, 0 }, // Lady Brumwell
+ { 1, 0, 0 }, // Joseph Moorehead
+ { 5, 0, 0 }, // Mrs. Beale
+ { 1, 0, 0 }, // Felix the Lion
+ { 1, 0, 0 }, // Hollingston
+ { 1, 0, 0 }, // Constable Callaghan
+ { 2, 0, 0 }, // Sergeant Jeremy Duncan
+ { 1, 0, 0 }, // Lord Brumwell
+ { 1, 0, 0 }, // Nigel Jameson
+ { 1, 0, 0 }, // Jonas (newspaper seller)
+ { 1, 0, 0 }, // Constable Dugan
+ { 4, 0, 0 } // Inspector Lestrade (Yard)
+};
+
+byte TALK_SEQUENCES[MAX_PEOPLE][MAX_TALK_SEQUENCES] = {
+ { 1, 0, 0 }, // Sherlock Holmes
+ { 5, 5, 6, 7, 8, 7, 8, 6, 0, 0 }, // Dr. Watson
+ { 2, 0, 0 }, // Inspector Lestrade
+ { 1, 0, 0 }, // Constable #1
+ { 1, 0, 0 }, // Constable #2
+ { 2, 3, 0, 0 }, // Sheila Parker
+ { 3, 0, 0 }, // Henry Carruthers
+ { 1, 2, 3, 2, 1, 2, 3, 0, 0 }, // Lesly (flower girl)
+ { 13, 14, 0, 0 }, // Usher #1
+ { 2, 0, 0 }, // Usher #2
+ { 1, 2, 3, 4, 3, 4, 3, 2, 0, 0 }, // Fredrick Epstein
+ { 8, 0, 0 }, // Mrs.Worthington
+ { 1, 2, 3, 4, 5, 4, 3, 2, 0, 0 }, // Coach
+ { 7, 8, 0, 0 }, // Player
+ { 12, 13, 0, 0 }, // Waterboy
+ { 3, 4, 0, 0 }, // James Sanders
+ { 4, 5, 0, 0 }, // Belle (perfumerie)
+ { 14, 15, 16, 17, 18, 19, 20, 20, 20, 0, 0 }, // Cleaning Girl (perfumerie)
+ { 16, 17, 18, 18, 18, 17, 17, 0, 0 }, // Epstien in the Opera Balcony
+ { 2, 3, 0, 0 }, // Wiggins
+ { 1, 2, 0, 0 }, // Paul (Brumwell/Carroway)
+ { 1, 0, 0 }, // Bartender
+ { 1, 0, 0 }, // Dirty Drunk
+ { 1, 0, 0 }, // Shouting Drunk
+ { 1, 0, 0 }, // Staggering Drunk
+ { 1, 0, 0 }, // Bouncer
+ { 5, 6, 0, 0 }, // James Sanders - At Home
+ { 4, 5, 0, 0 }, // The Coroner
+ { 1, 0, 0 }, // The Equestrian Shop Keeper
+ { 1, 0, 0 }, // George Blackwood
+ { 5, 6, 0, 0 }, // Lars
+ { 1, 0, 0 }, // Sheila Parker
+ { 8, 9, 0, 0 }, // Chemist
+ { 5, 6, 0, 0 }, // Inspector Gregson
+ { 1, 0, 0 }, // Lawyer
+ { 1, 0, 0 }, // Mycroft
+ { 7, 8, 0, 0 }, // Old Sherman
+ { 1, 0, 0 }, // Stock Boy in Chemist Shop
+ { 1, 0, 0 }, // Barman
+ { 1, 0, 0 }, // Dandy Player
+ { 1, 0, 0 }, // Rough-looking Player
+ { 1, 0, 0 }, // Spectator
+ { 1, 0, 0 }, // Robert Hunt
+ { 3, 4, 0, 0 }, // Violet Secretary
+ { 1, 0, 0 }, // Pettigrew
+ { 14, 15, 0, 0 }, // Augie (apple seller)
+ { 3, 4, 5, 6, 0, 0 }, // Anna Carroway
+ { 4, 5, 6, 0, 0 }, // Guard
+ { 7, 8, 0, 0 }, // Antonio Caruso
+ { 1, 0, 0 }, // Toby the Dog
+ { 13, 14, 0, 0 }, // Simon Kingsley
+ { 2, 3, 0, 0 }, // Alfred Tobacco Clerk
+ { 3, 4, 0, 0 }, // Lady Brumwell
+ { 1, 30, 0, 0 }, // Madame Rosa
+ { 3, 4, 0, 0 }, // Lady Brumwell
+ { 1, 0, 0 }, // Joseph Moorehead
+ { 14, 15, 16, 17, 18, 19, 20, 0, 0 }, // Mrs. Beale
+ { 1, 0, 0 }, // Felix the Lion
+ { 1, 0, 0 }, // Hollingston
+ { 1, 0, 0 }, // Constable Callaghan
+ { 1, 1, 2, 2, 0, 0 }, // Sergeant Jeremy Duncan
+ { 9, 10, 0, 0 }, // Lord Brumwell
+ { 1, 2, 0, 138, 3, 4, 0, 138, 0, 0 }, // Nigel Jameson
+ { 1, 8, 0, 0 }, // Jonas (newspaper seller)
+ { 1, 0, 0 }, // Constable Dugan
+ { 2, 0, 0 } // Inspector Lestrade (Yard)
+};
+
+/*----------------------------------------------------------------*/
+
ScalpelEngine::ScalpelEngine(OSystem *syst, const SherlockGameDescription *gameDesc) :
SherlockEngine(syst, gameDesc) {
_chess = nullptr;
@@ -71,6 +213,9 @@ void ScalpelEngine::initialize() {
// Load the inventory
loadInventory();
+ // Set up constants used by the talk system
+ _talk->setSequences(&TALK_SEQUENCES[0][0], &STILL_SEQUENCES[0][0], MAX_PEOPLE);
+
// Starting scene
_scene->_goToScene = 4;
}
diff --git a/engines/sherlock/scripts.cpp b/engines/sherlock/scripts.cpp
index 1da72c976b..d337030bae 100644
--- a/engines/sherlock/scripts.cpp
+++ b/engines/sherlock/scripts.cpp
@@ -35,18 +35,6 @@ void Scripts::doScript(const Common::String &str) {
// TODO
}
-void Scripts::pullSeq() {
- // TODO
-}
-
-void Scripts::pushSeq(int speak) {
- // TODO
-}
-
-void Scripts::setStillSeq(int speak) {
- // TODO
-}
-
void Scripts::popStack() {
ScriptEntry script = _scriptStack.pop();
_scriptName = script._name;
diff --git a/engines/sherlock/scripts.h b/engines/sherlock/scripts.h
index 6c23e72fe4..6765687bcf 100644
--- a/engines/sherlock/scripts.h
+++ b/engines/sherlock/scripts.h
@@ -50,12 +50,6 @@ public:
void doScript(const Common::String &str);
- void pullSeq();
-
- void pushSeq(int speak);
-
- void setStillSeq(int speak);
-
void popStack();
};
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp
index 79f9167506..26c2e523f3 100644
--- a/engines/sherlock/talk.cpp
+++ b/engines/sherlock/talk.cpp
@@ -73,6 +73,16 @@ TalkHistoryEntry::TalkHistoryEntry() {
/*----------------------------------------------------------------*/
+TalkSequences::TalkSequences(const byte *data) {
+ Common::copy(data, data + MAX_TALK_SEQUENCES, _data);
+}
+
+void TalkSequences::clear() {
+ Common::fill(&_data[0], &_data[MAX_TALK_SEQUENCES], 0);
+}
+
+/*----------------------------------------------------------------*/
+
Talk::Talk(SherlockEngine *vm): _vm(vm) {
_talkCounter = 0;
_talkToAbort = false;
@@ -87,6 +97,15 @@ Talk::Talk(SherlockEngine *vm): _vm(vm) {
_moreTalkDown = _moreTalkUp = false;
}
+void Talk::setSequences(const byte *talkSequences, const byte *stillSequences, int maxPeople) {
+ for (int idx = 0; idx < maxPeople; ++idx) {
+ STILL_SEQUENCES.push_back(TalkSequences(stillSequences));
+ TALK_SEQUENCES.push_back(TalkSequences(talkSequences));
+ stillSequences += MAX_TALK_SEQUENCES;
+ talkSequences += MAX_TALK_SEQUENCES;
+ }
+}
+
/**
* Called when either an NPC initiates a conversation or for inventory item
* descriptions. It opens up a description window similar to how 'talk' does,
@@ -158,7 +177,7 @@ void Talk::talkTo(const Common::String &filename) {
}
}
- while (_sequenceStack.empty())
+ while (!_sequenceStack.empty())
pullSequence();
// Restore any pressed button
@@ -283,7 +302,7 @@ void Talk::talkTo(const Common::String &filename) {
// Handle replies until there's no further linked file,
// or the link file isn't a reply first cnversation
for (;;) {
- _sequenceStack.clear();
+ clearSequences();
_scriptSelect = select;
_speaker = _talkTo;
@@ -318,7 +337,7 @@ void Talk::talkTo(const Common::String &filename) {
}
if (_talkToFlag == 1)
- scripts.pullSeq();
+ pullSequence();
// Set the stealth mode for the new talk file
Statement &newStatement = _statements[select];
@@ -328,9 +347,9 @@ void Talk::talkTo(const Common::String &filename) {
// to display any choices, since the reply needs to be shown
if (!newStatement._statement.hasPrefix("*") &&
!newStatement._statement.hasPrefix("^")) {
- _sequenceStack.clear();
- scripts.pushSeq(_talkTo);
- scripts.setStillSeq(_talkTo);
+ clearSequences();
+ pushSequence(_talkTo);
+ setStillSeq(_talkTo);
_talkIndex = select;
ui._selector = ui._oldSelector = -1;
@@ -417,7 +436,6 @@ void Talk::talk(int objNum) {
People &people = *_vm->_people;
Scene &scene = *_vm->_scene;
Screen &screen = *_vm->_screen;
- Scripts &scripts = *_vm->_scripts;
UserInterface &ui = *_vm->_ui;
Object &obj = scene._bgShapes[objNum];
@@ -440,7 +458,7 @@ void Talk::talk(int objNum) {
// See if the statement is a stealth mode reply
Statement &statement = _statements[select];
if (statement._statement.hasPrefix("^")) {
- _sequenceStack.clear();
+ clearSequences();
// Start talk in stealth mode
_talkStealth = 2;
@@ -448,9 +466,9 @@ void Talk::talk(int objNum) {
talkTo(obj._name);
} else if (statement._statement.hasPrefix("*")) {
// Character being spoken to will speak first
- _sequenceStack.clear();
- scripts.pushSeq(_talkTo);
- scripts.setStillSeq(_talkTo);
+ clearSequences();
+ pushSequence(_talkTo);
+ setStillSeq(_talkTo);
events.setCursor(WAIT);
if (obj._lookPosition.y != 0)
@@ -463,9 +481,9 @@ void Talk::talk(int objNum) {
talkTo(obj._name);
} else {
// Holmes will be speaking first
- _sequenceStack.clear();
- scripts.pushSeq(_talkTo);
- scripts.setStillSeq(_talkTo);
+ clearSequences();
+ pushSequence(_talkTo);
+ setStillSeq(_talkTo);
_talkToFlag = false;
events.setCursor(WAIT);
@@ -481,7 +499,7 @@ void Talk::talk(int objNum) {
if (_talkToFlag == 1) {
events.setCursor(ARROW);
// _sequenceStack._count = 1;
- scripts.pullSeq();
+ pullSequence();
}
} else {
drawInterface();
@@ -513,10 +531,6 @@ void Talk::freeTalkVars() {
_statements.clear();
}
-void Talk::pullSequence() {
- // TODO
-}
-
/**
* Opens the talk file 'talk.tlk' and searches the index for the specified
* conversation. If found, the data for that conversation is loaded
@@ -810,4 +824,52 @@ int Talk::talkLine(int lineNum, int stateNum, byte color, int lineY, bool slamIt
return lineY;
}
+/**
+ * Clears the stack of pending object sequences associated with speakers in the scene
+ */
+void Talk::clearSequences() {
+ _sequenceStack.clear();
+}
+
+void Talk::pullSequence() {
+ // TODO
+}
+
+void Talk::pushSequence(int speak) {
+ // TODO
+}
+
+/**
+ * Change the sequence of a background object corresponding to a given speaker.
+ * The new sequence will display the character as "listening"
+ */
+void Talk::setStillSeq(int speak) {
+ People &people = *_vm->_people;
+ Scene &scene = *_vm->_scene;
+
+ // Don't bother doing anything if no specific speaker is specified
+ if (speak == -1)
+ return;
+
+ if (speak) {
+ int objNum = people.findSpeaker(speak);
+ if (objNum != -1) {
+ Object &obj = scene._bgShapes[objNum];
+
+ if (obj._seqSize < MAX_TALK_SEQUENCES) {
+ warning("Tried to copy too many still frames");
+ } else {
+ for (uint idx = 0; idx < MAX_TALK_SEQUENCES; ++idx) {
+ obj._sequences[idx] = STILL_SEQUENCES[speak][idx];
+ if (idx > 0 && !TALK_SEQUENCES[speak][idx] && !TALK_SEQUENCES[speak][idx - 1])
+ break;
+ }
+
+ obj._frameNumber = 0;
+ obj._seqTo = 0;
+ }
+ }
+ }
+}
+
} // End of namespace Sherlock
diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h
index dbcdf742b8..3b02f92bc6 100644
--- a/engines/sherlock/talk.h
+++ b/engines/sherlock/talk.h
@@ -31,6 +31,8 @@
namespace Sherlock {
+#define MAX_TALK_SEQUENCES 11
+
struct SavedSequence {
int _objNum;
Common::Array<byte> _sequences;
@@ -58,15 +60,28 @@ struct TalkHistoryEntry {
bool &operator[](int index) { return _data[index]; }
};
+struct TalkSequences {
+ byte _data[MAX_TALK_SEQUENCES];
+
+ TalkSequences() { clear(); }
+ TalkSequences(const byte *data);
+
+ byte &operator[](int idx) { return _data[idx]; }
+ void clear();
+};
+
class SherlockEngine;
class Talk {
private:
+ Common::Array<TalkSequences> STILL_SEQUENCES;
+ Common::Array<TalkSequences> TALK_SEQUENCES;
+private:
SherlockEngine *_vm;
int _saveSeqNum;
Common::Array<SavedSequence> _savedSequences;
- Common::Stack<int> _sequenceStack;
Common::Array<Statement> _statements;
+ Common::Stack<int> _sequenceStack;
TalkHistoryEntry _talkHistory[500];
int _speaker;
int _talkIndex;
@@ -77,8 +92,6 @@ private:
int _talkToFlag;
bool _moreTalkUp, _moreTalkDown;
- void pullSequence();
-
void loadTalkFile(const Common::String &filename);
void stripVoiceCommands();
@@ -92,6 +105,8 @@ public:
int _talkCounter;
public:
Talk(SherlockEngine *vm);
+ void setSequences(const byte *talkSequences, const byte *stillSequences,
+ int maxPeople);
void talkTo(const Common::String &filename);
@@ -100,6 +115,12 @@ public:
void freeTalkVars();
void drawInterface();
+
+ void setStillSeq(int speak);
+ void clearSequences();
+ void pullSequence();
+ void pushSequence(int speak);
+ bool isSequencesEmpty() const { return _sequenceStack.empty(); }
};
} // End of namespace Sherlock