aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-03-22 15:44:11 -0400
committerPaul Gilbert2015-03-22 15:44:11 -0400
commit0f424da24b8d5c3399714d56c896e3a46983faac (patch)
treeacf223fedc4281fcfc04ab27d44160a3bf42f955 /engines
parent840bd862b734d54b18eb505b32ce030da10c934d (diff)
downloadscummvm-rg350-0f424da24b8d5c3399714d56c896e3a46983faac.tar.gz
scummvm-rg350-0f424da24b8d5c3399714d56c896e3a46983faac.tar.bz2
scummvm-rg350-0f424da24b8d5c3399714d56c896e3a46983faac.zip
SHERLOCK: First game scene is partially showing
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/objects.h3
-rw-r--r--engines/sherlock/scene.cpp14
-rw-r--r--engines/sherlock/sherlock.cpp7
3 files changed, 14 insertions, 10 deletions
diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h
index 2a52ec4d33..9e43c087b8 100644
--- a/engines/sherlock/objects.h
+++ b/engines/sherlock/objects.h
@@ -206,6 +206,9 @@ public:
void setFlagsAndToggles();
void adjustObject();
+
+ int frameWidth() const { return _imageFrame ? _imageFrame->_frame.w : 0; }
+ int frameHeight() const { return _imageFrame ? _imageFrame->_frame.h : 0; }
};
struct CAnim {
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 578eba2c24..5bad8338aa 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -316,6 +316,10 @@ bool Scene::loadScene(const Common::String &filename) {
// Set up the bgShapes
for (int idx = 0; idx < bgHeader._numStructs; ++idx) {
+ _bgShapes[idx]._images = _images[_bgShapes[idx]._misc]._images;
+ _bgShapes[idx]._imageFrame = !_bgShapes[idx]._images ? (ImageFrame *)nullptr :
+ &(*_bgShapes[idx]._images)[0];
+
_bgShapes[idx]._examine = Common::String(&_descText[_bgShapes[idx]._descOffset]);
_bgShapes[idx]._sequences = &_sequenceBuffer[_bgShapes[idx]._sequenceOffset];
_bgShapes[idx]._misc = 0;
@@ -325,10 +329,6 @@ bool Scene::loadScene(const Common::String &filename) {
_bgShapes[idx]._frameNumber = -1;
_bgShapes[idx]._position = Common::Point(0, 0);
_bgShapes[idx]._oldSize = Common::Point(1, 1);
-
- _bgShapes[idx]._images = _images[_bgShapes[idx]._misc]._images;
- _bgShapes[idx]._imageFrame = !_bgShapes[idx]._images ? (ImageFrame *)nullptr :
- &(*_bgShapes[idx]._images)[0];
}
// Load in cAnim list
@@ -799,8 +799,8 @@ void Scene::updateBackground() {
// Draw all static and active shapes that are FORWARD
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
_bgShapes[idx]._oldPosition = _bgShapes[idx]._position;
- _bgShapes[idx]._oldSize = Common::Point(_bgShapes[idx]._imageFrame->_frame.w,
- _bgShapes[idx]._imageFrame->_frame.h);
+ _bgShapes[idx]._oldSize = Common::Point(_bgShapes[idx].frameWidth(),
+ _bgShapes[idx].frameHeight());
if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) &&
_bgShapes[idx]._misc == FORWARD)
@@ -837,7 +837,7 @@ void Scene::checkBgShapes(ImageFrame *frame, const Common::Point &pt) {
Object &obj = _bgShapes[idx];
if (obj._type == STATIC_BG_SHAPE || obj._type == ACTIVE_BG_SHAPE) {
if ((obj._flags & 5) == 1) {
- obj._misc = (pt.y < (obj._position.y + obj._imageFrame->_frame.h - 1)) ?
+ obj._misc = (pt.y < (obj._position.y + obj.frameHeight() - 1)) ?
NORMAL_FORWARD : NORMAL_BEHIND;
} else if (!(obj._flags & 1)) {
obj._misc = BEHIND;
diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp
index ad590e3ffd..211c52ea87 100644
--- a/engines/sherlock/sherlock.cpp
+++ b/engines/sherlock/sherlock.cpp
@@ -54,14 +54,14 @@ SherlockEngine::~SherlockEngine() {
delete _animation;
delete _debugger;
delete _events;
- delete _inventory;
delete _journal;
delete _people;
- delete _res;
delete _scene;
delete _screen;
delete _sound;
delete _talk;
+ delete _inventory;
+ delete _res;
}
void SherlockEngine::initialize() {
@@ -111,7 +111,7 @@ Common::Error SherlockEngine::run() {
}
void SherlockEngine::sceneLoop() {
- while (!shouldQuit() && _scene->_goToScene != -1) {
+ while (!shouldQuit() && _scene->_goToScene == -1) {
// See if a script needs to be completed from either a goto room code,
// or a script that was interrupted by another script
if (_scriptMoreFlag == 1 || _scriptMoreFlag == 3)
@@ -133,6 +133,7 @@ void SherlockEngine::sceneLoop() {
void SherlockEngine::handleInput() {
// TODO
+ _events->pollEventsAndWait();
}