aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-03-21 09:20:39 -0400
committerPaul Gilbert2015-03-21 09:20:39 -0400
commit06fbefc7875b37dd531b65c42087e4e6782c03a6 (patch)
treee7bf6566d22b0b9e328742242dac283195756f8f /engines
parentf0ad2f624bddcc031c99a487bff1d5ec89956477 (diff)
downloadscummvm-rg350-06fbefc7875b37dd531b65c42087e4e6782c03a6.tar.gz
scummvm-rg350-06fbefc7875b37dd531b65c42087e4e6782c03a6.tar.bz2
scummvm-rg350-06fbefc7875b37dd531b65c42087e4e6782c03a6.zip
SHERLOCK: Beginnings of transitionToScene
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/objects.cpp12
-rw-r--r--engines/sherlock/objects.h6
-rw-r--r--engines/sherlock/people.cpp1
-rw-r--r--engines/sherlock/people.h13
-rw-r--r--engines/sherlock/scalpel/scalpel.cpp4
-rw-r--r--engines/sherlock/scene.cpp117
-rw-r--r--engines/sherlock/scene.h6
-rw-r--r--engines/sherlock/sherlock.cpp3
-rw-r--r--engines/sherlock/sherlock.h3
9 files changed, 157 insertions, 8 deletions
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index d696954cda..3fc9901a38 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -57,6 +57,18 @@ void Sprite::setImageFrame() {
_imageFrame = &(*_images)[imageNumber];
}
+void Sprite::adjustSprite(bool onChessboard) {
+ // TODO
+}
+
+void Sprite::gotoStand() {
+ // TODO
+}
+
+void Sprite::setWalking() {
+ // TODO
+}
+
/*----------------------------------------------------------------*/
void ActionType::synchronize(Common::SeekableReadStream &s) {
diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h
index d43b70f4e9..a1bdc5933c 100644
--- a/engines/sherlock/objects.h
+++ b/engines/sherlock/objects.h
@@ -104,6 +104,12 @@ struct Sprite {
void clear();
void setImageFrame();
+
+ void adjustSprite(bool onChessboard = false);
+
+ void gotoStand();
+
+ void setWalking();
};
struct ActionType {
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index b4bbef2e1a..b187b65ad4 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -47,6 +47,7 @@ static const uint8 CHARACTER_SEQUENCES[MAX_HOLMES_SEQUENCE][MAX_FRAME] = {
People::People(SherlockEngine *vm) : _vm(vm) {
_walkLoaded = false;
+ _holmesOn = true;
}
People::~People() {
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index 4bdc6a88f0..74a4575af6 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -28,8 +28,13 @@
namespace Sherlock {
-#define MAX_PEOPLE 2
-#define PLAYER 0
+// People definitions
+enum PeopleId {
+ PLAYER = 0,
+ AL = 0,
+ PEG = 1,
+ MAX_PEOPLE = 2
+};
// Animation sequence identifiers for characters
enum {
@@ -48,12 +53,16 @@ private:
Sprite _data[MAX_PEOPLE];
bool _walkLoaded;
public:
+ bool _holmesOn;
+public:
People(SherlockEngine *vm);
~People();
void reset();
bool loadWalk();
+
+ Sprite &operator[](PeopleId id) { return _data[id]; }
};
} // End of namespace Sherlock
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index 40ca9736d6..2477f2894f 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -193,8 +193,8 @@ void ScalpelEngine::startScene() {
_scene->_goToRoom = _chess->doChessBoard();
_sound->freeSong();
- _hsavedPos = Common::Point(-1, -1);
- _hsavedFs = -1;
+ _scene->_hsavedPos = Common::Point(-1, -1);
+ _scene->_hsavedFs = -1;
}
// Some rooms are prologue cutscenes, rather than normal game scenes. These are:
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 4ec5c29134..8875327dcf 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -94,6 +94,8 @@ Scene::Scene(SherlockEngine *vm): _vm(vm) {
_version = 0;
_lzwMode = false;
_invGraphicItems = 0;
+ _hsavedPos = Common::Point(-1, -1);
+ _hsavedFs = -1;
_controlPanel = new ImageFile("controls.vgs");
_controls = nullptr; // new ImageFile("menu.all");
@@ -511,8 +513,123 @@ void Scene::transitionToScene() {
STOP_UP, STOP_UPRIGHT, STOP_RIGHT, STOP_DOWNRIGHT, STOP_DOWN,
STOP_DOWNLEFT, STOP_LEFT, STOP_UPLEFT
};
+ People &people = *_vm->_people;
+
+ if (_hsavedPos.x < 1) {
+ // No exit information from last scene-check entrance info
+ if (_entrance._startPosition.x < 1) {
+ // No entrance info either, so use defaults
+ _hsavedPos = Common::Point(16000, 10000);
+ _hsavedFs = 4;
+ } else {
+ // setup entrance info
+ _hsavedPos = _entrance._startPosition;
+ _hsavedFs = _entrance._startDir;
+ }
+ } else {
+ // Exit information exists, translate it to real sequence info
+ // Note: If a savegame was just loaded, then the data is already correct.
+ // Otherwise, this is a linked scene or entrance info, and must be translated
+ if (_hsavedFs < 8 && !_vm->_justLoaded) {
+ _hsavedFs = FS_TRANS[_hsavedFs];
+ _hsavedPos.x *= 100;
+ _hsavedPos.y *= 100;
+ }
+ }
+
+ int startcAnimNum = -1;
+
+ if (_hsavedFs < 101) {
+ // Standard info, so set it
+ people[PLAYER]._position = _hsavedPos;
+ people[PLAYER]._sequenceNumber = _hsavedFs;
+ } else {
+ // It's canimation information
+ startcAnimNum = _hsavedFs - 101;
+
+ // Prevent Holmes from being drawn
+ people[PLAYER]._position = Common::Point(0, 0);
+ }
+
+ for (uint objIdx = 0; objIdx < _bgShapes.size(); ++objIdx) {
+ Object &obj = _bgShapes[objIdx];
+
+ if (obj._aType > 1 && obj._type != INVALID && obj._type != HIDDEN) {
+ Common::Point topLeft = obj._position;
+ Common::Point bottomRight;
+
+ if (obj._type != NO_SHAPE) {
+ topLeft += obj._imageFrame->_position;
+ bottomRight.x = topLeft.x + obj._imageFrame->_frame.w;
+ bottomRight.y = topLeft.y + obj._imageFrame->_frame.h;
+ } else {
+ bottomRight = topLeft + obj._noShapeSize;
+ }
+
+ if (Common::Rect(topLeft.x, topLeft.y, bottomRight.x, bottomRight.y).contains(
+ Common::Point(people[PLAYER]._position.x / 100, people[PLAYER]._position.y / 100))) {
+ // Current point is already inside box - impact occurred on
+ // a previous call. So simply do nothing except talk until the
+ // player is clear of the box
+ switch (obj._aType) {
+ case FLAG_SET:
+ for (int useNum = 0; useNum < 4; ++useNum) {
+ if (obj._use[useNum]._useFlag) {
+ if (!_vm->readFlags(obj._use[useNum]._useFlag))
+ _vm->setFlags(obj._use[useNum]._useFlag);
+ }
+
+ if (!_vm->_talkToAbort) {
+ for (int nameIdx = 0; nameIdx < 4; ++nameIdx) {
+ toggleObject(obj._use[useNum]._names[nameIdx]);
+ }
+ }
+ }
+
+ obj._type = HIDDEN;
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+ updateBackground();
// TODO
}
+/**
+ * Scans through the object list to find one with a matching name, and will
+ * call toggleHidden with all matches found. Returns the numer of matches found
+ */
+int Scene::toggleObject(const Common::String &name) {
+ int count = 0;
+
+ for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
+ if (scumm_stricmp(name.c_str(), _bgShapes[idx]._name.c_str()) == 0) {
+ ++count;
+ _bgShapes[idx].toggleHidden();
+ }
+ }
+
+ return count;
+}
+
+/**
+ * Update the screen back buffer with all of the scene objects which need
+ * to be drawn
+ */
+void Scene::updateBackground() {
+ People &people = *_vm->_people;
+ //setDisplayBounds(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCENE_HEIGHT);
+
+ // Update Holmes if he's turned on
+ if (people._holmesOn)
+ people[AL].adjustSprite();
+
+
+}
+
} // End of namespace Sherlock
diff --git a/engines/sherlock/scene.h b/engines/sherlock/scene.h
index d51856b508..5625bb1f5b 100644
--- a/engines/sherlock/scene.h
+++ b/engines/sherlock/scene.h
@@ -96,6 +96,10 @@ private:
void checkInventory();
void transitionToScene();
+
+ int toggleObject(const Common::String &name);
+
+ void updateBackground();
public:
int _currentScene;
int _goToRoom;
@@ -128,6 +132,8 @@ public:
Common::Array<Exit> _exits;
SceneEntry _entrance;
Common::Array<SceneSound> _sounds;
+ Common::Point _hsavedPos;
+ int _hsavedFs;
public:
Scene(SherlockEngine *vm);
~Scene();
diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp
index 65dc6c80a5..60e32bda82 100644
--- a/engines/sherlock/sherlock.cpp
+++ b/engines/sherlock/sherlock.cpp
@@ -42,9 +42,8 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam
_sound = nullptr;
_talk = nullptr;
_useEpilogue2 = false;
- _hsavedPos = Common::Point(-1, -1);
- _hsavedFs = -1;
_justLoaded = false;
+ _talkToAbort = false;
}
SherlockEngine::~SherlockEngine() {
diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h
index a8ca9abbfd..84b6c48f12 100644
--- a/engines/sherlock/sherlock.h
+++ b/engines/sherlock/sherlock.h
@@ -92,12 +92,11 @@ public:
Common::String _soundOverride;
Common::String _titleOverride;
bool _useEpilogue2;
- Common::Point _hsavedPos;
- int _hsavedFs;
bool _justLoaded;
int _oldCharPoint; // Old scene
Common::Point _over; // Old map position
Common::Array<Common::Point> _map; // Map locations for each scene
+ bool _talkToAbort;
public:
SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
virtual ~SherlockEngine();