Skip to content

Commit

Permalink
SHERLOCK: Some more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed May 9, 2015
1 parent e3e4354 commit f622d74
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion engines/sherlock/journal.cpp
Expand Up @@ -1125,7 +1125,7 @@ int Journal::getFindName(bool printError) {
if (events.kbHit()) {
Common::KeyState keyState = events.getKey();

if ((keyState.keycode == Common::KEYCODE_BACKSPACE) && (name.c_str() > 0)) {
if ((keyState.keycode == Common::KEYCODE_BACKSPACE) && (name.size() > 0)) {
screen.vgaBar(Common::Rect(xp - screen.charWidth(name.lastChar()), yp, xp + 8, yp + 9), BUTTON_MIDDLE);
xp -= screen.charWidth(name.lastChar());
screen.vgaBar(Common::Rect(xp, yp, xp + 8, yp + 9), INV_FOREGROUND);
Expand Down
4 changes: 2 additions & 2 deletions engines/sherlock/people.cpp
Expand Up @@ -335,10 +335,10 @@ void People::setWalking() {
// Set the initial frame sequence for the left and right, as well
// as setting the delta x depending on direction
if (_walkDest.x < (_player._position.x / 100)) {
_player._sequenceNumber = (int) (map._active ? MAP_LEFT : WALK_LEFT);
_player._sequenceNumber = (map._active ? (int)MAP_LEFT : (int)WALK_LEFT);
_player._delta.x = speed.x * -100;
} else {
_player._sequenceNumber = (int) (map._active ? MAP_RIGHT : WALK_RIGHT);
_player._sequenceNumber = (map._active ? (int)MAP_RIGHT : (int)WALK_RIGHT);
_player._delta.x = speed.x * 100;
}

Expand Down
33 changes: 17 additions & 16 deletions engines/sherlock/talk.cpp
Expand Up @@ -604,7 +604,7 @@ void Talk::stripVoiceCommands() {

// Scan for an sound effect byte, which indicates to play a sound
for (uint idx = 0; idx < statement._reply.size(); ++idx) {
if (statement._reply[idx] == (int)SFX_COMMAND) {
if (statement._reply[idx] == (char)SFX_COMMAND) {
// Replace instruction character with a space, and delete the
// rest of the name following it
statement._reply = Common::String(statement._reply.c_str(),
Expand Down Expand Up @@ -1004,7 +1004,6 @@ void Talk::doScript(const Common::String &script) {
int line = 0;
bool noTextYet = true;
bool openTalkWindow = false;
int obj;
int seqCount;

_savedSequences.clear();
Expand Down Expand Up @@ -1164,29 +1163,30 @@ void Talk::doScript(const Common::String &script) {
break;

case ADJUST_OBJ_SEQUENCE:
{
// Get the name of the object to adjust
++str;
for (int idx = 0; idx < (str[0] & 127); ++idx)
tempString += str[idx + 2];

// Scan for object
obj = -1;
int objId = -1;
for (uint idx = 0; idx < scene._bgShapes.size(); ++idx) {
if (scumm_stricmp(tempString.c_str(), scene._bgShapes[idx]._name.c_str()) == 0)
obj = idx;
objId = idx;
}
if (obj == -1)
if (objId == -1)
error("Could not find object %s to change", tempString.c_str());

// Should the script be overwritten?
if (str[0] > 128) {
// Save the current sequence
_savedSequences.push(SequenceEntry());
SequenceEntry &seqEntry = _savedSequences.top();
seqEntry._objNum = obj;
seqEntry._seqTo = scene._bgShapes[obj]._seqTo;
for (uint idx = 0; idx < scene._bgShapes[obj]._seqSize; ++idx)
seqEntry._sequences.push_back(scene._bgShapes[obj]._sequences[idx]);
seqEntry._objNum = objId;
seqEntry._seqTo = scene._bgShapes[objId]._seqTo;
for (uint idx = 0; idx < scene._bgShapes[objId]._seqSize; ++idx)
seqEntry._sequences.push_back(scene._bgShapes[objId]._sequences[idx]);
}

// Get number of bytes to change
Expand All @@ -1195,14 +1195,15 @@ void Talk::doScript(const Common::String &script) {

// Copy in the new sequence
for (int idx = 0; idx < seqCount; ++idx, ++str)
scene._bgShapes[obj]._sequences[idx] = str[0] - 1;
scene._bgShapes[objId]._sequences[idx] = str[0] - 1;

// Reset object back to beginning of new sequence
scene._bgShapes[obj]._frameNumber = 0;
scene._bgShapes[objId]._frameNumber = 0;
continue;
}

case WALK_TO_COORDS:
// Save the current point in the script, since it might be intterupted by
// 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;
Expand Down Expand Up @@ -1646,12 +1647,12 @@ void Talk::doScript(const Common::String &script) {
if (wait != -1) {
for (int ssIndex = 0; ssIndex < (int)_savedSequences.size(); ++ssIndex) {
SequenceEntry &seq = _savedSequences[ssIndex];
Object &obj = scene._bgShapes[seq._objNum];
Object &object = scene._bgShapes[seq._objNum];

for (uint idx = 0; idx < seq._sequences.size(); ++idx)
obj._sequences[idx] = seq._sequences[idx];
obj._frameNumber = seq._frameNumber;
obj._seqTo = seq._seqTo;
object._sequences[idx] = seq._sequences[idx];
object._frameNumber = seq._frameNumber;
object._seqTo = seq._seqTo;
}

pullSequence();
Expand Down

0 comments on commit f622d74

Please sign in to comment.