From bff5a3e6802e9a7f00e7089a3d9c3516a82f27e7 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 9 Nov 2015 12:04:09 +0200 Subject: MADS: Phantom: Implement Scene::drawToBackground() This is used to conditionally display additional background objects. Also, added a TODO in Scene::deleteSequence() --- engines/mads/scene.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 4c48619ab9..4e7ec2f61c 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -793,8 +793,23 @@ void Scene::setCamera(Common::Point pos) { _posAdjust = pos; } -void Scene::drawToBackground(int series_id, int sprite_id, Common::Point pos, int depth, int scale) { - warning("TODO: Scene::drawToBackground"); +void Scene::drawToBackground(int spriteId, int frameId, Common::Point pos, int depth, int scale) { + SpriteAsset &asset = *_sprites[spriteId]; + + if (pos.x == -32000) + pos.x = asset.getFramePos(frameId - 1).x; + if (pos.y == -32000) + pos.y = asset.getFramePos(frameId - 1).y; + + int slotIndex = _spriteSlots.add(); + SpriteSlot &slot = _spriteSlots[slotIndex]; + slot._spritesIndex = spriteId; + slot._frameNumber = frameId; + slot._seqIndex = 1; + slot._position = pos; + slot._depth = depth; + slot._scale = scale; + slot._flags = IMG_DELTA; } void Scene::deleteSequence(int idx) { @@ -803,10 +818,13 @@ void Scene::deleteSequence(int idx) { _sequences[idx]._active = false; - if (!_sequences[idx]._doneFlag) - doFrame(); // FIXME/CHECKME: Is this correct? - else + if (!_sequences[idx]._doneFlag) { + warning("TODO: deleteSequence: Sequence %d not done", idx); + // TODO: This is wrong, and crashes Phantom at scene 102 when the door is opened + //doFrame(); // FIXME/CHECKME: Is this correct? + } else { _sequences.remove(idx); + } } void Scene::loadSpeech(int idx) { -- cgit v1.2.3