Skip to content

Commit

Permalink
SHERLOCK: Remove redundant _scriptCurrentIndex field
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster authored and wjp committed May 13, 2015
1 parent 4cffb1c commit 2a7019b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 40 deletions.
40 changes: 4 additions & 36 deletions engines/sherlock/talk.cpp
Expand Up @@ -104,7 +104,6 @@ Talk::Talk(SherlockEngine *vm): _vm(vm) {
_moreTalkDown = _moreTalkUp = false;
_scriptMoreFlag = 0;
_scriptSaveIndex = -1;
_scriptCurrentIndex = -1;
}

/**
Expand Down Expand Up @@ -1082,10 +1081,6 @@ void Talk::doScript(const Common::String &script) {
// Handle control code
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
_scriptCurrentIndex = str - scriptStart;

if (!(_speaker & 128))
people.clearTalking();
if (_talkToAbort)
Expand All @@ -1103,10 +1098,7 @@ void Talk::doScript(const Common::String &script) {
break;

case RUN_CANIMATION:
// 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
++str;
_scriptCurrentIndex = (str + 1) - scriptStart;
scene.startCAnim((str[0] - 1) & 127, (str[0] & 128) ? -1 : 1);
if (_talkToAbort)
return;
Expand Down Expand Up @@ -1143,10 +1135,6 @@ void Talk::doScript(const Common::String &script) {
break;

case REMOVE_PORTRAIT:
// 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
_scriptCurrentIndex = str - scriptStart;

if (_speaker >= 0 && _speaker < 128)
people.clearTalking();
pullSequence();
Expand Down Expand Up @@ -1203,10 +1191,7 @@ void Talk::doScript(const Common::String &script) {
}

case WALK_TO_COORDS:
// Save the current point in the script, since it might be interrupted by
// doing bg anims in the next call, so we need to know where to return to
++str;
_scriptCurrentIndex = str - scriptStart;

people.walkToCoords(Common::Point(((str[0] - 1) * 256 + str[1] - 1) * 100,
str[2] * 100), str[3] - 1);
Expand All @@ -1217,10 +1202,7 @@ void Talk::doScript(const Common::String &script) {
break;

case PAUSE_WITHOUT_CONTROL:
// 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
++str;
_scriptCurrentIndex = str - scriptStart;

for (int idx = 0; idx < (str[0] - 1); ++idx) {
scene.doBgAnim();
Expand All @@ -1234,10 +1216,6 @@ void Talk::doScript(const Common::String &script) {
break;

case BANISH_WINDOW:
// 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
_scriptCurrentIndex = str - scriptStart;

if (!(_speaker & 128))
people.clearTalking();
pullSequence();
Expand Down Expand Up @@ -1403,19 +1381,19 @@ void Talk::doScript(const Common::String &script) {
break;
}

case CALL_TALK_FILE:
case CALL_TALK_FILE: {
++str;
for (int idx = 0; idx < 8 && str[idx] != '~'; ++idx)
tempString += str[idx];
str += 8;

_scriptCurrentIndex = str - scriptStart;
int scriptCurrentIndex = str - scriptStart;

// Save the current script position and new talk file
if (_scriptStack.size() < 9) {
ScriptStackEntry rec1;
rec1._name = _scriptName;
rec1._currentIndex = _scriptCurrentIndex;
rec1._currentIndex = scriptCurrentIndex;
rec1._select = _scriptSelect;
_scriptStack.push(rec1);

Expand All @@ -1433,12 +1411,10 @@ void Talk::doScript(const Common::String &script) {
endStr = true;
wait = 0;
break;
}

case MOVE_MOUSE:
// 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
++str;
_scriptCurrentIndex = str - scriptStart;
events.moveMouse(Common::Point((str[0] - 1) * 256 + str[1] - 1, str[2]));
if (_talkToAbort)
return;
Expand All @@ -1464,10 +1440,6 @@ void Talk::doScript(const Common::String &script) {
++str;
CAnim &animation = scene._cAnim[str[0] - 1];

// Save the current point in the script, since it might be interrupted by
// doing bg anims in the next call, so we need to know where to return to
_scriptCurrentIndex = (str + 1) - scriptStart;

people.walkToCoords(animation._goto, animation._gotoDir);
if (_talkToAbort)
return;
Expand Down Expand Up @@ -1614,10 +1586,6 @@ void Talk::doScript(const Common::String &script) {
}

if (wait) {
// 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
_scriptCurrentIndex = str - scriptStart;

// Handling pausing
if (!pauseFlag && charCount < 160)
charCount = 160;
Expand Down
1 change: 0 additions & 1 deletion engines/sherlock/talk.h
Expand Up @@ -140,7 +140,6 @@ class Talk {
int _talkStealth;
int _talkToFlag;
int _scriptSaveIndex;
int _scriptCurrentIndex;
private:
void stripVoiceCommands();
void setTalkMap();
Expand Down
3 changes: 0 additions & 3 deletions engines/sherlock/user_interface.cpp
Expand Up @@ -1694,9 +1694,6 @@ void UserInterface::doTalkControl() {
sound._speechOn = false;
}

// Set the _scriptCurrentIndex so if the statement is irrupted, the entire
// reply will be shown when it's restarted
talk._scriptCurrentIndex = 0;
talk.waitForMore(talk._statements[_selector]._statement.size());
if (talk._talkToAbort)
return;
Expand Down

0 comments on commit 2a7019b

Please sign in to comment.