SHERLOCK: Further fixes for analysing flower on lab table

This commit is contained in:
Paul Gilbert 2015-04-27 04:40:19 -05:00
parent a2e1f4cb76
commit f7f405eadb

View file

@ -134,7 +134,7 @@ Talk::Talk(SherlockEngine *vm): _vm(vm) {
_talkStealth = 0; _talkStealth = 0;
_talkToFlag = -1; _talkToFlag = -1;
_moreTalkDown = _moreTalkUp = false; _moreTalkDown = _moreTalkUp = false;
_scriptMoreFlag = false; _scriptMoreFlag = 0;
_scriptSaveIndex = -1; _scriptSaveIndex = -1;
_scriptCurrentIndex = -1; _scriptCurrentIndex = -1;
} }
@ -217,7 +217,7 @@ void Talk::talkTo(const Common::String &filename) {
} }
} }
while (!_scriptStack.empty()) while (!_sequenceStack.empty())
pullSequence(); pullSequence();
// Restore any pressed button // Restore any pressed button
@ -578,6 +578,9 @@ void Talk::loadTalkFile(const Common::String &filename) {
Resources &res = *_vm->_res; Resources &res = *_vm->_res;
Sound &sound = *_vm->_sound; Sound &sound = *_vm->_sound;
// Save a copy of the talk filename
_scriptName = filename;
// Check for an existing person being talked to // Check for an existing person being talked to
_talkTo = -1; _talkTo = -1;
for (int idx = 0; idx < MAX_PEOPLE; ++idx) { for (int idx = 0; idx < MAX_PEOPLE; ++idx) {
@ -867,7 +870,7 @@ int Talk::talkLine(int lineNum, int stateNum, byte color, int lineY, bool slamIt
* Clears the stack of pending object sequences associated with speakers in the scene * Clears the stack of pending object sequences associated with speakers in the scene
*/ */
void Talk::clearSequences() { void Talk::clearSequences() {
_scriptStack.clear(); _sequenceStack.clear();
} }
/** /**
@ -1385,7 +1388,7 @@ void Talk::doScript(const Common::String &script) {
case ADD_ITEM_TO_INVENTORY: case ADD_ITEM_TO_INVENTORY:
++str; ++str;
for (int idx = 0; idx < str[0]; ++idx) for (int idx = 0; idx < str[0]; ++idx)
tempString += str[idx]; tempString += str[idx + 1];
str += str[0]; str += str[0];
inv.putNameInInventory(tempString); inv.putNameInInventory(tempString);
@ -1420,16 +1423,24 @@ void Talk::doScript(const Common::String &script) {
_scriptCurrentIndex = str - script.c_str(); _scriptCurrentIndex = str - script.c_str();
// Save the current script position and new talk file // Save the current script position and new talk file
if (_scriptStack.size() < 10) { if (_scriptStack.size() < 9) {
ScriptStackEntry rec; ScriptStackEntry rec1;
rec._name = _scriptName; rec1._name = _scriptName;
rec._currentIndex = _scriptCurrentIndex; rec1._currentIndex = _scriptCurrentIndex;
rec._select = _scriptSelect; rec1._select = _scriptSelect;
_scriptStack.push(rec1);
// Push the new talk file onto the stack
ScriptStackEntry rec2;
rec2._name = tempString;
rec2._currentIndex = 0;
rec2._select = 100;
_scriptStack.push(rec2);
} else { } else {
error("Script stack overflow"); error("Script stack overflow");
} }
_scriptMoreFlag = true; _scriptMoreFlag = 1;
endStr = true; endStr = true;
wait = 0; wait = 0;
break; break;
@ -1655,7 +1666,7 @@ void Talk::doScript(const Common::String &script) {
} }
pullSequence(); pullSequence();
if (_speaker < 128) if (_speaker >= 0 && _speaker < 128)
people.clearTalking(); people.clearTalking();
} }
} }
@ -1749,7 +1760,7 @@ void Talk::popStack() {
_scriptName = scriptEntry._name; _scriptName = scriptEntry._name;
_scriptSaveIndex = scriptEntry._currentIndex; _scriptSaveIndex = scriptEntry._currentIndex;
_scriptSelect = scriptEntry._select; _scriptSelect = scriptEntry._select;
_scriptMoreFlag = true; _scriptMoreFlag = 1;
} }
} }