aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sherlock/objects.cpp13
-rw-r--r--engines/sherlock/objects.h5
-rw-r--r--engines/sherlock/people.cpp8
-rw-r--r--engines/sherlock/people.h3
-rw-r--r--engines/sherlock/scalpel/scalpel.cpp4
-rw-r--r--engines/sherlock/scalpel/scalpel_people.cpp11
-rw-r--r--engines/sherlock/scalpel/scalpel_talk.cpp8
-rw-r--r--engines/sherlock/scene.cpp11
-rw-r--r--engines/sherlock/scene.h4
-rw-r--r--engines/sherlock/sherlock.cpp2
-rw-r--r--engines/sherlock/tattoo/tattoo.cpp4
-rw-r--r--engines/sherlock/tattoo/tattoo_people.cpp21
-rw-r--r--engines/sherlock/tattoo/tattoo_talk.cpp6
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.h1
-rw-r--r--engines/sherlock/user_interface.cpp2
-rw-r--r--engines/sherlock/user_interface.h1
16 files changed, 53 insertions, 51 deletions
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 12f5a2f90d..9d2110e804 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -526,18 +526,17 @@ int BaseObject::checkNameForCodes(const Common::String &name, FixedTextActionId
++p;
Common::String s(p, p + 3);
- people._hSavedPos.x = atoi(s.c_str());
+ people._savedPos.x = atoi(s.c_str());
s = Common::String(p + 3, p + 6);
- people._hSavedPos.y = atoi(s.c_str());
+ people._savedPos.y = atoi(s.c_str());
s = Common::String(p + 6, p + 9);
- people._hSavedFacing = atoi(s.c_str());
- if (people._hSavedFacing == 0)
- people._hSavedFacing = 10;
+ people._savedPos._facing = atoi(s.c_str());
+ if (people._savedPos._facing == 0)
+ people._savedPos._facing = 10;
} else if ((p = strchr(name.c_str(), '/')) != nullptr) {
- people._hSavedPos = Common::Point(1, 0);
- people._hSavedFacing = 100 + atoi(p + 1);
+ people._savedPos = PositionFacing(1, 0, 100 + atoi(p + 1));
}
} else {
scene._goToScene = 100;
diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h
index 60b5b3345e..7b42445f48 100644
--- a/engines/sherlock/objects.h
+++ b/engines/sherlock/objects.h
@@ -122,6 +122,11 @@ public:
int _facing;
PositionFacing() : Point32(), _facing(0) {}
+ PositionFacing(int xp, int yp, int theFacing) : Point32(xp, yp), _facing(theFacing) {}
+ PositionFacing &operator=(const Point32 &pt) {
+ x = pt.x; y = pt.y;
+ return *this;
+ }
};
struct WalkSequence {
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index cab4abff89..dae0d5d0c0 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -172,8 +172,8 @@ People::People(SherlockEngine *vm) : _vm(vm) {
_speakerFlip = false;
_holmesFlip = false;
_holmesQuotient = 0;
- _hSavedPos = Point32(-1, -1);
- _hSavedFacing = -1;
+ _savedPos = Point32(-1, -1);
+ _savedPos._facing = -1;
_forceWalkReload = false;
_useWalkLib = false;
_walkControl = 0;
@@ -336,8 +336,8 @@ void People::synchronize(Serializer &s) {
s.syncAsSint16LE(_holmesQuotient);
if (s.isLoading()) {
- _hSavedPos = _data[HOLMES]->_position;
- _hSavedFacing = _data[HOLMES]->_sequenceNumber;
+ _savedPos = _data[HOLMES]->_position;
+ _savedPos._facing = _data[HOLMES]->_sequenceNumber;
}
}
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index 257c9b3987..170f93589b 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -99,8 +99,7 @@ protected:
public:
Common::Array<PersonData> _characters;
ImageFile *_talkPics;
- Point32 _hSavedPos;
- int _hSavedFacing;
+ PositionFacing _savedPos;
bool _holmesOn;
bool _portraitLoaded;
bool _portraitsOn;
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index 586978e1c5..91e920d8f0 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -922,8 +922,8 @@ void ScalpelEngine::startScene() {
_scene->_goToScene = _map->show();
_music->freeSong();
- _people->_hSavedPos = Common::Point(-1, -1);
- _people->_hSavedFacing = -1;
+ _people->_savedPos = Common::Point(-1, -1);
+ _people->_savedPos._facing = -1;
}
// Some rooms are prologue cutscenes, rather than normal game scenes. These are:
diff --git a/engines/sherlock/scalpel/scalpel_people.cpp b/engines/sherlock/scalpel/scalpel_people.cpp
index 94042e7a13..db26bb8c0f 100644
--- a/engines/sherlock/scalpel/scalpel_people.cpp
+++ b/engines/sherlock/scalpel/scalpel_people.cpp
@@ -126,11 +126,10 @@ void ScalpelPerson::adjustSprite() {
scene._goToScene = exit->_scene;
if (exit->_newPosition.x != 0) {
- people._hSavedPos = exit->_newPosition;
- people._hSavedFacing = exit->_newFacing;
+ people._savedPos = exit->_newPosition;
- if (people._hSavedFacing > 100 && people._hSavedPos.x < 1)
- people._hSavedPos.x = 100;
+ if (people._savedPos._facing > 100 && people._savedPos.x < 1)
+ people._savedPos.x = 100;
}
}
}
@@ -444,8 +443,8 @@ void ScalpelPeople::synchronize(Serializer &s) {
s.syncAsSint16LE(_holmesQuotient);
if (s.isLoading()) {
- _hSavedPos = _data[HOLMES]->_position;
- _hSavedFacing = _data[HOLMES]->_sequenceNumber;
+ _savedPos = _data[HOLMES]->_position;
+ _savedPos._facing = _data[HOLMES]->_sequenceNumber;
}
}
diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp
index ed529df17c..a6bb6b6fcd 100644
--- a/engines/sherlock/scalpel/scalpel_talk.cpp
+++ b/engines/sherlock/scalpel/scalpel_talk.cpp
@@ -320,15 +320,13 @@ OpcodeReturn ScalpelTalk::cmdGotoScene(const byte *&str) {
// Run a canimation?
if (str[2] > 100) {
- people._hSavedFacing = str[2];
- people._hSavedPos = Point32(160, 100);
+ people._savedPos = PositionFacing(160, 100, str[2]);
} else {
- people._hSavedFacing = str[2] - 1;
int32 posX = (str[3] - 1) * 256 + str[4] - 1;
int32 posY = str[5] - 1;
- people._hSavedPos = Point32(posX, posY);
+ people._savedPos = PositionFacing(posX, posY, str[2] - 1);
}
- } // if (scene._goToScene != 100)
+ }
str += 6;
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 3d406fe134..c948baa176 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -116,7 +116,7 @@ void Exit::load(Common::SeekableReadStream &s, bool isRoseTattoo) {
_newPosition.x = s.readSint16LE();
_newPosition.y = s.readSint16LE();
- _newFacing = s.readUint16LE();
+ _newPosition._facing = s.readUint16LE();
if (isRoseTattoo)
_allow = s.readSint16LE();
@@ -135,7 +135,7 @@ void Exit::load3DO(Common::SeekableReadStream &s) {
_newPosition.x = s.readSint16BE();
_newPosition.y = s.readSint16BE();
- _newFacing = s.readUint16BE();
+ _newPosition._facing = s.readUint16BE();
s.skip(2); // Filler
}
@@ -231,7 +231,6 @@ Scene::Scene(SherlockEngine *vm): _vm(vm) {
_animating = 0;
_doBgAnimDone = true;
_tempFadeStyle = 0;
- _exitZone = -1;
_doBgAnimDone = false;
}
@@ -603,7 +602,6 @@ bool Scene::loadScene(const Common::String &filename) {
}
// Read in the exits
- _exitZone = -1;
int numExits = rrmStream->readByte();
_exits.resize(numExits);
@@ -922,7 +920,6 @@ bool Scene::loadScene(const Common::String &filename) {
int exitsCount = header3DO_exits_size / 20;
- _exitZone = -1;
_exits.resize(exitsCount);
for (int idx = 0; idx < exitsCount; ++idx)
_exits[idx].load3DO(*roomStream);
@@ -1157,8 +1154,8 @@ void Scene::transitionToScene() {
SaveManager &saves = *_vm->_saves;
Screen &screen = *_vm->_screen;
Talk &talk = *_vm->_talk;
- Point32 &hSavedPos = people._hSavedPos;
- int &hSavedFacing = people._hSavedFacing;
+ Point32 &hSavedPos = people._savedPos;
+ int &hSavedFacing = people._savedPos._facing;
if (hSavedPos.x < 1) {
// No exit information from last scene-check entrance info
diff --git a/engines/sherlock/scene.h b/engines/sherlock/scene.h
index 4ffe1ac340..8ae6327ce2 100644
--- a/engines/sherlock/scene.h
+++ b/engines/sherlock/scene.h
@@ -79,8 +79,7 @@ class Exit: public Common::Rect {
public:
int _scene;
int _allow;
- Common::Point _newPosition;
- int _newFacing;
+ PositionFacing _newPosition;
Common::String _dest;
int _image; // Arrow image to use
@@ -228,7 +227,6 @@ public:
int _walkDirectory[MAX_ZONES][MAX_ZONES];
Common::Array<WalkArray> _walkPoints;
Common::Array<Exit> _exits;
- int _exitZone;
SceneEntry _entrance;
Common::Array<SceneSound> _sounds;
ObjectArray _canimShapes;
diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp
index a026670453..6e2ed44eea 100644
--- a/engines/sherlock/sherlock.cpp
+++ b/engines/sherlock/sherlock.cpp
@@ -179,7 +179,7 @@ void SherlockEngine::sceneLoop() {
// Handle any input from the keyboard or mouse
handleInput();
- if (_people->_hSavedPos.x == -1) {
+ if (_people->_savedPos.x == -1) {
_canLoadSave = true;
_scene->doBgAnim();
_canLoadSave = false;
diff --git a/engines/sherlock/tattoo/tattoo.cpp b/engines/sherlock/tattoo/tattoo.cpp
index 151d1773fe..85418880d0 100644
--- a/engines/sherlock/tattoo/tattoo.cpp
+++ b/engines/sherlock/tattoo/tattoo.cpp
@@ -85,8 +85,8 @@ void TattooEngine::startScene() {
_scene->_currentScene = OVERHEAD_MAP;
_scene->_goToScene = _map->show();
- _people->_hSavedPos = Common::Point(-1, -1);
- _people->_hSavedFacing = -1;
+ _people->_savedPos = Common::Point(-1, -1);
+ _people->_savedPos._facing = -1;
}
// TODO
diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp
index f22ce87574..23366f17db 100644
--- a/engines/sherlock/tattoo/tattoo_people.cpp
+++ b/engines/sherlock/tattoo/tattoo_people.cpp
@@ -23,6 +23,7 @@
#include "sherlock/tattoo/tattoo_people.h"
#include "sherlock/tattoo/tattoo_scene.h"
#include "sherlock/tattoo/tattoo_talk.h"
+#include "sherlock/tattoo/tattoo_user_interface.h"
#include "sherlock/tattoo/tattoo.h"
namespace Sherlock {
@@ -131,6 +132,7 @@ void TattooPerson::freeAltGraphics() {
void TattooPerson::adjustSprite() {
People &people = *_vm->_people;
TattooScene &scene = *(TattooScene *)_vm->_scene;
+ TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
if (_type == INVALID)
return;
@@ -192,13 +194,17 @@ void TattooPerson::adjustSprite() {
// See if the player has come to a stop after clicking on an Arrow zone to leave the scene.
// If so, this will set up the exit information for the scene transition
- if (!_walkCount && scene._exitZone != -1 && scene._walkedInScene && scene._goToScene != -1 &&
+ if (!_walkCount && ui._exitZone != -1 && scene._walkedInScene && scene._goToScene == -1 &&
!_description.compareToIgnoreCase(people[HOLMES]._description)) {
- people._hSavedPos = scene._exits[scene._exitZone]._newPosition;
- people._hSavedFacing = scene._exits[scene._exitZone]._newFacing;
+ Exit &exit = scene._exits[ui._exitZone];
+ scene._goToScene = exit._scene;
- if (people._hSavedFacing > 100 && people._hSavedPos.x < 1)
- people._hSavedPos.x = 100;
+ if (exit._newPosition.x != 0) {
+ people._savedPos = exit._newPosition;
+
+ if (people._savedPos._facing > 100 && people._savedPos.x < 1)
+ people._savedPos.x = 100;
+ }
}
}
@@ -1184,8 +1190,9 @@ void TattooPeople::synchronize(Serializer &s) {
s.syncAsSint16LE(_holmesQuotient);
if (s.isLoading()) {
- _hSavedPos = _data[HOLMES]->_position;
- _hSavedFacing = _data[HOLMES]->_sequenceNumber;
+ _savedPos.x = _data[HOLMES]->_position.x;
+ _savedPos.y = _data[HOLMES]->_position.y;
+ _savedPos._facing = _data[HOLMES]->_sequenceNumber;
}
}
diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp
index ab73b404da..54d327e92a 100644
--- a/engines/sherlock/tattoo/tattoo_talk.cpp
+++ b/engines/sherlock/tattoo/tattoo_talk.cpp
@@ -267,15 +267,13 @@ OpcodeReturn TattooTalk::cmdGotoScene(const byte *&str) {
// Run a canimation?
if (str[2] > 100) {
- people._hSavedFacing = str[2];
- people._hSavedPos = Point32(160, 100);
+ people._savedPos = PositionFacing(160, 100, str[2]);
} else {
- people._hSavedFacing = str[2] - 1;
int32 posX = (str[3] - 1) * 256 + str[4] - 1;
if (posX > 16384)
posX = -1 * (posX - 16384);
int32 posY = (str[5] - 1) * 256 + str[6] - 1;
- people._hSavedPos = Point32(posX, posY);
+ people._savedPos = PositionFacing(posX, posY, str[2] - 1);
}
_scriptMoreFlag = 1;
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h
index 994caa6049..ba98e5c59c 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.h
+++ b/engines/sherlock/tattoo/tattoo_user_interface.h
@@ -45,7 +45,6 @@ class TattooUserInterface : public UserInterface {
private:
int _lockoutTimer;
SaveMode _fileMode;
- int _exitZone;
int _scriptZone;
int _cAnimFramePause;
WidgetInventory _inventoryWidget;
diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp
index 539efdd6cc..37bde6be6c 100644
--- a/engines/sherlock/user_interface.cpp
+++ b/engines/sherlock/user_interface.cpp
@@ -46,6 +46,7 @@ UserInterface::UserInterface(SherlockEngine *vm) : _vm(vm) {
_helpStyle = false;
_windowBounds = Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH - 1, SHERLOCK_SCREEN_HEIGHT - 1);
_lookScriptFlag = false;
+ _exitZone = -1;
_bgFound = _oldBgFound = -1;
_key = _oldKey = '\0';
@@ -193,6 +194,7 @@ void UserInterface::reset() {
_bgFound = _oldBgFound = -1;
_oldKey = -1;
_oldTemp = _temp = -1;
+ _exitZone = -1;
}
diff --git a/engines/sherlock/user_interface.h b/engines/sherlock/user_interface.h
index 306e0216a3..9af5ad5ae6 100644
--- a/engines/sherlock/user_interface.h
+++ b/engines/sherlock/user_interface.h
@@ -73,6 +73,7 @@ public:
Common::Rect _windowBounds;
bool _lookScriptFlag;
int _bgFound, _oldBgFound;
+ int _exitZone;
// TODO: Not so sure these should be in the base class. May want to refactor them to SherlockEngine, or refactor
// various Scalpel dialogs to keep their own private state of key/selections