diff options
-rw-r--r-- | engines/illusions/actor.cpp | 55 | ||||
-rw-r--r-- | engines/illusions/actor.h | 8 | ||||
-rw-r--r-- | engines/illusions/actorresource.cpp | 23 | ||||
-rw-r--r-- | engines/illusions/actorresource.h | 3 | ||||
-rw-r--r-- | engines/illusions/dictionary.cpp | 11 | ||||
-rw-r--r-- | engines/illusions/dictionary.h | 4 | ||||
-rw-r--r-- | engines/illusions/graphics.cpp | 6 | ||||
-rw-r--r-- | engines/illusions/illusions.cpp | 100 | ||||
-rw-r--r-- | engines/illusions/illusions.h | 5 | ||||
-rw-r--r-- | engines/illusions/screen.cpp | 23 | ||||
-rw-r--r-- | engines/illusions/screen.h | 1 | ||||
-rw-r--r-- | engines/illusions/spritedecompressqueue.cpp | 6 |
12 files changed, 187 insertions, 58 deletions
diff --git a/engines/illusions/actor.cpp b/engines/illusions/actor.cpp index 2de6f483a0..01222f3ee5 100644 --- a/engines/illusions/actor.cpp +++ b/engines/illusions/actor.cpp @@ -153,6 +153,18 @@ void Actor::destroySurface() { } } +void Actor::initSequenceStack() { + _seqStackCount = 0; +} + +void Actor::pushSequenceStack(int16 value) { + _seqStack[_seqStackCount++] = value; +} + +int16 Actor::popSequenceStack() { + return _seqStack[--_seqStackCount]; +} + // Control Control::Control(IllusionsEngine *vm) @@ -180,7 +192,7 @@ Control::~Control() { void Control::pause() { - // TODO scrmgrSetObjectArtThread(control->objectId, 0); + _vm->_dict->setObjectControl(_objectId, 0); if (_objectId == 0x40004) _vm->setCursorControl(0); @@ -192,7 +204,7 @@ void Control::pause() { void Control::unpause() { - // TODO scrmgrSetObjectArtThread(control->objectId, control); + _vm->_dict->setObjectControl(_objectId, this); if (_objectId == 0x40004) _vm->setCursorControl(this); @@ -227,7 +239,7 @@ void Control::appearActor() { _actor->_flags |= 0x1000; for (uint i = 0; i < kSubObjectsCount; ++i) if (_actor->_subobjects[i]) { - Control *subControl = _vm->findControl(_actor->_subobjects[i]); + Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]); subControl->appearActor(); } } @@ -244,7 +256,7 @@ void Control::disappearActor() { _actor->_flags |= ~0x1000; for (uint i = 0; i < kSubObjectsCount; ++i) if (_actor->_subobjects[i]) { - Control *subControl = _vm->findControl(_actor->_subobjects[i]); + Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]); subControl->disappearActor(); } } @@ -258,7 +270,7 @@ void Control::activateObject() { _flags |= 1; for (uint i = 0; i < kSubObjectsCount; ++i) if (_actor->_subobjects[i]) { - Control *subControl = _vm->findControl(_actor->_subobjects[i]); + Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]); subControl->activateObject(); } } @@ -267,7 +279,7 @@ void Control::deactivateObject() { _flags |= ~1; for (uint i = 0; i < kSubObjectsCount; ++i) if (_actor->_subobjects[i]) { - Control *subControl = _vm->findControl(_actor->_subobjects[i]); + Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]); subControl->deactivateObject(); } } @@ -286,7 +298,7 @@ void Control::setActorScale(int scale) { _actor->_scale = scale; for (uint i = 0; i < kSubObjectsCount; ++i) if (_actor->_subobjects[i]) { - Control *subControl = _vm->findControl(_actor->_subobjects[i]); + Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]); subControl->activateObject(); } } @@ -295,7 +307,7 @@ void Control::faceActor(uint facing) { _actor->_facing = facing; for (uint i = 0; i < kSubObjectsCount; ++i) if (_actor->_subobjects[i]) { - Control *subControl = _vm->findControl(_actor->_subobjects[i]); + Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]); subControl->faceActor(facing); } } @@ -317,7 +329,7 @@ void Control::clearNotifyThreadId1() { void Control::clearNotifyThreadId2() { for (uint i = 0; i < kSubObjectsCount; ++i) if (_actor->_subobjects[i]) { - Control *subControl = _vm->findControl(_actor->_subobjects[i]); + Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]); subControl->_actor->_flags &= ~0x80; subControl->_actor->_field30 = 0; subControl->_actor->_notifyThreadId2 = 0; @@ -337,7 +349,7 @@ int Control::getPriority() { if (_actor) { if (_actor->_parentObjectId && (_actor->_flags & 0x40)) { uint32 objectId2 = getSubActorParent(); - Control *control2 = _vm->findControl(objectId2); + Control *control2 = _vm->_dict->getObjectControl(objectId2); objectId = control2->_objectId; priority = control2->_priority; positionY = control2->_actor->_position.y; @@ -368,7 +380,7 @@ int Control::getPriority() { uint32 Control::getSubActorParent() { uint32 parentObjectId = _objectId; while (1) { - Actor *actor = _vm->findControl(parentObjectId)->_actor; + Actor *actor = _vm->_dict->getObjectControl(parentObjectId)->_actor; if (actor->_parentObjectId && (actor->_flags & 0x40)) parentObjectId = actor->_parentObjectId; else @@ -460,7 +472,7 @@ void Control::stopSequenceActor() { } for (uint i = 0; i < kSubObjectsCount; ++i) if (_actor->_subobjects[i]) { - Control *subControl = _vm->findControl(_actor->_subobjects[i]); + Control *subControl = _vm->_dict->getObjectControl(_actor->_subobjects[i]); subControl->stopSequenceActor(); } } @@ -485,14 +497,17 @@ void Control::startSequenceActorIntern(uint32 sequenceId, int value, int value2, _actor->_path40 = 0; Sequence *sequence = _vm->_dict->findSequence(sequenceId); + debug("Control::startSequenceActorIntern() sequence = %p", (void*)sequence); _actor->_seqCodeIp = sequence->_sequenceCode; - _actor->_frames = _vm->findSequenceFrames(sequence); + _actor->_frames = _vm->_actorItems->findSequenceFrames(sequence); + debug("Control::startSequenceActorIntern() _actor->_seqCodeIp = %p", (void*)_actor->_seqCodeIp); + debug("Control::startSequenceActorIntern() _actor->_frames = %p", (void*)_actor->_frames); _actor->_seqCodeValue3 = 0; _actor->_seqCodeValue1 = 0; _actor->_seqCodeValue2 = value == 1 ? 350 : 600; - // TODO _actor->initSequenceStack(); + _actor->initSequenceStack(); stopSequenceActor(); _actor->_linkIndex2 = 0; if (value2) { @@ -570,7 +585,7 @@ void Controls::placeActor(uint32 actorTypeId, Common::Point placePt, uint32 sequ actor->_pathCtrY = 140; _controls.push_back(control); - // TODO scrmgrSetObjectArtThread(objectId, controlb); + _vm->_dict->setObjectControl(objectId, control); if (actorTypeId == 0x50001 && objectId == 0x40004) _vm->placeCursor(control, sequenceId); @@ -610,7 +625,7 @@ void Controls::placeSequenceLessActor(uint32 objectId, Common::Point placePt, Wi actor->_pathCtrY = 140; _controls.push_back(control); - // TODO scrmgrSetObjectArtThread(objectId, controlb); + _vm->_dict->setObjectControl(objectId, control); control->appearActor(); } @@ -627,7 +642,7 @@ void Controls::placeActorLessObject(uint32 objectId, Common::Point feetPt, Commo control->_actorTypeId = 0; control->_actor = 0; _controls.push_back(control); - // TODO scrmgrSetObjectArtThread(objectId, controlb); + _vm->_dict->setObjectControl(objectId, control); } Actor *Controls::newActor() { @@ -641,11 +656,9 @@ Control *Controls::newControl() { void Controls::destroyControl(Control *control) { _controls.remove(control); - /* TODO if (control->_pauseCtr <= 0) - scrmgrSetObjectArtThread(control->objectId, 0); - */ - + _vm->_dict->setObjectControl(control->_objectId, 0); + if (control->_objectId == 0x40004 && control->_pauseCtr <= 0) _vm->setCursorControl(0); diff --git a/engines/illusions/actor.h b/engines/illusions/actor.h index e70efab02e..abe746dc9d 100644 --- a/engines/illusions/actor.h +++ b/engines/illusions/actor.h @@ -69,8 +69,13 @@ public: void unpause(); void createSurface(SurfInfo &surfInfo); void destroySurface(); + void initSequenceStack(); + void pushSequenceStack(int16 value); + int16 popSequenceStack(); public: IllusionsEngine *_vm; + byte _drawFlags; + uint _spriteFlags; int _pauseCtr; uint _flags; @@ -86,6 +91,9 @@ public: ScaleLayer *_scaleLayer; PriorityLayer *_priorityLayer; + uint _seqStackCount; + int16 _seqStack[5]; + Common::Point _position; Common::Point _position2; uint _facing; diff --git a/engines/illusions/actorresource.cpp b/engines/illusions/actorresource.cpp index b58a3382fb..541e4b4aed 100644 --- a/engines/illusions/actorresource.cpp +++ b/engines/illusions/actorresource.cpp @@ -29,7 +29,6 @@ namespace Illusions { // ActorResourceLoader void ActorResourceLoader::load(Resource *resource) { - // TODO debug("ActorResourceLoader::load() Loading actor %08X from %s...", resource->_resId, resource->_filename.c_str()); ActorResource *actorResource = new ActorResource(); @@ -76,13 +75,14 @@ bool ActorResourceLoader::isFlag(int flag) { } void Frame::load(byte *dataStart, Common::SeekableReadStream &stream) { - stream.readUint32LE(); //field_0 dd + _flags = stream.readUint16LE(); + stream.skip(2); // Skip padding stream.readUint32LE(); // TODO config dd _surfInfo.load(stream); uint32 compressedPixelsOffs = stream.readUint32LE(); _compressedPixels = dataStart + compressedPixelsOffs; - debug("Frame::load() compressedPixelsOffs: %08X", + debug(5, "Frame::load() compressedPixelsOffs: %08X", compressedPixelsOffs); } @@ -92,7 +92,7 @@ void Sequence::load(byte *dataStart, Common::SeekableReadStream &stream) { uint32 sequenceCodeOffs = stream.readUint32LE(); _sequenceCode = dataStart + sequenceCodeOffs; - debug("Sequence::load() _sequenceId: %08X; _unk4: %d; sequenceCodeOffs: %08X", + debug(5, "Sequence::load() _sequenceId: %08X; _unk4: %d; sequenceCodeOffs: %08X", _sequenceId, _unk4, sequenceCodeOffs); } @@ -117,11 +117,11 @@ void ActorType::load(byte *dataStart, Common::SeekableReadStream &stream) { _regionLayerIndex = stream.readUint16LE(); _flags = stream.readUint16LE(); - debug("ActorType::load() _actorTypeId: %08X; _color(%d,%d,%d); _scale: %d; _priority: %d; _value1E: %d", + debug(5, "ActorType::load() _actorTypeId: %08X; _color(%d,%d,%d); _scale: %d; _priority: %d; _value1E: %d", _actorTypeId, _color.r, _color.g, _color.b, _scale, _priority, _value1E); - debug("ActorType::load() _pathWalkPointsIndex: %d; _scaleLayerIndex: %d; _pathWalkRectIndex: %d", + debug(5, "ActorType::load() _pathWalkPointsIndex: %d; _scaleLayerIndex: %d; _pathWalkRectIndex: %d", _pathWalkPointsIndex, _scaleLayerIndex, _pathWalkRectIndex); - debug("ActorType::load() _priorityLayerIndex: %d; _regionLayerIndex: %d; _flags: %04X", + debug(5, "ActorType::load() _priorityLayerIndex: %d; _regionLayerIndex: %d; _flags: %04X", _priorityLayerIndex, _regionLayerIndex,_flags); } @@ -246,4 +246,13 @@ void ActorItems::unpauseByTag(uint32 tag) { (*it)->pause(); } +FramesList *ActorItems::findSequenceFrames(Sequence *sequence) { + for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) { + ActorItem *actorItem = *it; + if (actorItem->_pauseCtr <= 0 && actorItem->_actRes->containsSequence(sequence)) + return &actorItem->_actRes->_frames; + } + return 0; +} + } // End of namespace Illusions diff --git a/engines/illusions/actorresource.h b/engines/illusions/actorresource.h index af535d5692..1b6e271a16 100644 --- a/engines/illusions/actorresource.h +++ b/engines/illusions/actorresource.h @@ -44,7 +44,7 @@ protected: }; struct Frame { - //field_0 dd + uint16 _flags; // TODO config dd SurfInfo _surfInfo; byte *_compressedPixels; @@ -113,6 +113,7 @@ public: ActorItem *allocActorItem(); void pauseByTag(uint32 tag); void unpauseByTag(uint32 tag); + FramesList *findSequenceFrames(Sequence *sequence); protected: typedef Common::List<ActorItem*> Items; typedef Items::iterator ItemsIterator; diff --git a/engines/illusions/dictionary.cpp b/engines/illusions/dictionary.cpp index bf0a4c82d6..2d3de2a29c 100644 --- a/engines/illusions/dictionary.cpp +++ b/engines/illusions/dictionary.cpp @@ -51,4 +51,15 @@ Sequence *Dictionary::findSequence(uint32 id) { return _sequences.find(id); } +void Dictionary::setObjectControl(uint32 objectId, Control *control) { + if (control) + _controls.add(objectId, control); + else + _controls.remove(objectId); +} + +Control *Dictionary::getObjectControl(uint32 objectId) { + return _controls.find(objectId); +} + } // End of namespace Illusions diff --git a/engines/illusions/dictionary.h b/engines/illusions/dictionary.h index 9205fa69c6..e8863f4c53 100644 --- a/engines/illusions/dictionary.h +++ b/engines/illusions/dictionary.h @@ -63,9 +63,13 @@ public: void removeSequence(uint32 id); Sequence *findSequence(uint32 id); + void setObjectControl(uint32 objectId, Control *control); + Control *getObjectControl(uint32 objectId); + protected: DictionaryHashMap<ActorType> _actorTypes; DictionaryHashMap<Sequence> _sequences; + DictionaryHashMap<Control> _controls; }; } // End of namespace Illusions diff --git a/engines/illusions/graphics.cpp b/engines/illusions/graphics.cpp index 0f27a36e11..61130988bd 100644 --- a/engines/illusions/graphics.cpp +++ b/engines/illusions/graphics.cpp @@ -28,7 +28,7 @@ void WidthHeight::load(Common::SeekableReadStream &stream) { _width = stream.readSint16LE(); _height = stream.readSint16LE(); - debug("WidthHeight::load() _width: %d; _height: %d", + debug(5, "WidthHeight::load() _width: %d; _height: %d", _width, _height); } @@ -36,7 +36,7 @@ void SurfInfo::load(Common::SeekableReadStream &stream) { _pixelSize = stream.readUint32LE(); _dimensions.load(stream); - debug("SurfInfo::load() _pixelSize: %d", + debug(5, "SurfInfo::load() _pixelSize: %d", _pixelSize); } @@ -44,7 +44,7 @@ void loadPoint(Common::SeekableReadStream &stream, Common::Point &pt) { pt.x = stream.readSint16LE(); pt.y = stream.readSint16LE(); - debug("loadPoint() x: %d; y: %d", + debug(5, "loadPoint() x: %d; y: %d", pt.x, pt.y); } diff --git a/engines/illusions/illusions.cpp b/engines/illusions/illusions.cpp index e2ae4182b1..3d182276e0 100644 --- a/engines/illusions/illusions.cpp +++ b/engines/illusions/illusions.cpp @@ -95,13 +95,14 @@ Common::Error IllusionsEngine::run() { _actorItems = new ActorItems(this); _backgroundItems = new BackgroundItems(this); _camera = new Camera(this); + _controls = new Controls(this); #if 0 // ActorResource test _resSys->loadResource(0x00100006, 0, 0); #endif -#if 1 +#if 0 // BackgroundResource test _resSys->loadResource(0x00110007, 0, 0); BackgroundItem *backgroundItem = _backgroundItems->debugFirst(); @@ -124,17 +125,35 @@ Common::Error IllusionsEngine::run() { #if 0 // ScriptResource test _resSys->loadResource(0x000D0001, 0, 0); - _scriptMan->startScriptThread(0x00020004, 0, 0, 0, 0); - while (!shouldQuit()) { updateEvents(); _scriptMan->_threads->updateThreads(); } +#endif + +#if 1 + // Actor/graphics test + _resSys->loadResource(0x00110007, 0, 0); + _resSys->loadResource(0x00100006, 0, 0); + _controls->placeActor(0x00050008, Common::Point(200, 200), 0x00060136, 0x00040001, 0); + Control *control = *_controls->_controls.begin(); + control->setActorFrameIndex(1); + control->appearActor(); + + while (!shouldQuit()) { + updateGraphics(); + _screen->updateSprites(); + _system->updateScreen(); + updateEvents(); + + //break; + } #endif + delete _controls; delete _camera; delete _backgroundItems; delete _actorItems; @@ -190,11 +209,6 @@ Common::Point *IllusionsEngine::getObjectActorPositionPtr(uint32 objectId) { return 0; } -Control *IllusionsEngine::findControl(uint32 objectId) { - // TODO Dummy, to be replaced later - return 0; -} - void IllusionsEngine::notifyThreadId(uint32 &threadId) { if (threadId) { uint32 tempThreadId = threadId; @@ -203,11 +217,6 @@ void IllusionsEngine::notifyThreadId(uint32 &threadId) { } } -FramesList *IllusionsEngine::findSequenceFrames(Sequence *sequence) { - // TODO Dummy, to be replaced later - return 0; -} - void IllusionsEngine::setCursorControl(Control *control) { // TODO Dummy, to be replaced later } @@ -230,4 +239,69 @@ bool IllusionsEngine::hideCursor() { return false; } +int IllusionsEngine::updateGraphics() { + Common::Point panPoint(0, 0); + + uint32 currTime = getCurrentTime(); + _camera->update(currTime); + + // TODO Move to BackgroundItems class + BackgroundItem *backgroundItem = _backgroundItems->findActiveBackground(); + if (backgroundItem) { + BackgroundResource *bgRes = backgroundItem->_bgRes; + for (uint i = 0; i < bgRes->_bgInfosCount; ++i) { + BgInfo *bgInfo = &bgRes->_bgInfos[i]; + // TODO int16 priority = artcntrlGetPriorityFromBase(bgInfos[v7].priorityBase); + int16 priority = -1; + _screen->_drawQueue->insertSurface(backgroundItem->_surfaces[i], + bgInfo->_surfInfo._dimensions, backgroundItem->_panPoints[i], priority); + if (bgInfo->_flags & 1) + panPoint = backgroundItem->_panPoints[i]; + } + } + + // TODO Move to Controls class + for (Controls::ItemsIterator it = _controls->_controls.begin(); it != _controls->_controls.end(); ++it) { + Control *control = *it; + Actor *actor = control->_actor; + + debug("control->_pauseCtr: %d; actor->_flags: %04X", control->_pauseCtr, actor->_flags); + + if (control->_pauseCtr == 0 && actor && (actor->_flags & 1) && !(actor->_flags & 0x0200)) { + // TODO Common::Point drawPosition = control->calcPosition(panPoint); + Common::Point drawPosition(200, 200);//DEBUG + if (actor->_flags & 0x2000) { + Frame *frame = &(*actor->_frames)[actor->_frameIndex - 1]; + _screen->_decompressQueue->insert(&actor->_drawFlags, frame->_flags, + frame->_surfInfo._pixelSize, frame->_surfInfo._dimensions, + frame->_compressedPixels, actor->_surface); + actor->_flags &= ~0x2000; + } + /* Unused + if (actor->_flags & 0x4000) { + nullsub_1(&actor->drawFlags); + actor->flags &= ~0x4000; + } + */ + if (actor->_surfInfo._dimensions._width && actor->_surfInfo._dimensions._height) { + // TODO int16 priority = control->getPriority(); + int16 priority = 2; + _screen->_drawQueue->insertSprite(&actor->_drawFlags, actor->_surface, + actor->_surfInfo._dimensions, drawPosition, control->_position, + priority, actor->_scale, actor->_spriteFlags); + } + } + } + +#if 0 // TODO + if (_textInfo._surface) { + int16 priority = getPriorityFromBase(99); + _screen->_drawQueue->insertTextSurface(_textInfo._surface, _textInfo._dimensions, + _textInfo._position, priority); + } +#endif + + return 1; +} + } // End of namespace Illusions diff --git a/engines/illusions/illusions.h b/engines/illusions/illusions.h index 56bd7d9edf..d262690a7f 100644 --- a/engines/illusions/illusions.h +++ b/engines/illusions/illusions.h @@ -56,6 +56,7 @@ class BackgroundItems; class BackgroundResource; class Camera; class Control; +class Controls; class Dictionary; class Input; class Screen; @@ -89,10 +90,9 @@ public: ActorItems *_actorItems; BackgroundItems *_backgroundItems; Camera *_camera; + Controls *_controls; Common::Point *getObjectActorPositionPtr(uint32 objectId); - Control *findControl(uint32 objectId); - FramesList *findSequenceFrames(Sequence *sequence); void notifyThreadId(uint32 &threadId); @@ -100,6 +100,7 @@ public: void placeCursor(Control *control, uint32 sequenceId); bool showCursor(); bool hideCursor(); + int updateGraphics(); #if 0 diff --git a/engines/illusions/screen.cpp b/engines/illusions/screen.cpp index 1b33b0c856..6f14f8d759 100644 --- a/engines/illusions/screen.cpp +++ b/engines/illusions/screen.cpp @@ -31,7 +31,7 @@ namespace Illusions { // Screen Screen::Screen(IllusionsEngine *vm) - : _vm(vm) { + : _vm(vm), _colorKey2(0) { _displayOn = true; _backSurface = allocSurface(640, 480); _decompressQueue = new SpriteDecompressQueue(); @@ -65,11 +65,6 @@ uint16 Screen::getColorKey2() { return _colorKey2; } -Graphics::Surface *Screen::getBackSurface() { - // TODO Move this outside into a screen class - return 0; -} - void Screen::updateSprites() { _decompressQueue->decompressAll(); // NOTE Skipped doShiftBrightness and related as it seems to be unused @@ -80,19 +75,33 @@ void Screen::updateSprites() { } void Screen::drawSurface10(int16 destX, int16 destY, Graphics::Surface *surface, Common::Rect &srcRect, uint16 colorKey) { + // Unscaled, transparent // TODO + debug("Screen::drawSurface10"); } void Screen::drawSurface11(int16 destX, int16 destY, Graphics::Surface *surface, Common::Rect &srcRect) { - // TODO + // Unscaled, non-transparent + debug(1, "Screen::drawSurface11() destX: %d; destY: %d; srcRect: (%d, %d, %d, %d)", destX, destY, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom); + const int16 w = srcRect.width(); + const int16 h = srcRect.height(); + for (int16 yc = 0; yc < h; ++yc) { + byte *src = (byte*)surface->getBasePtr(srcRect.left, srcRect.top + yc); + byte *dst = (byte*)_backSurface->getBasePtr(destX, destY + yc); + memcpy(dst, src, w * 2); + } } void Screen::drawSurface20(Common::Rect &dstRect, Graphics::Surface *surface, Common::Rect &srcRect, uint16 colorKey) { + // Scaled, transparent // TODO + debug("Screen::drawSurface20"); } void Screen::drawSurface21(Common::Rect &dstRect, Graphics::Surface *surface, Common::Rect &srcRect) { + // Scaled, non-transparent // TODO + debug("Screen::drawSurface21"); } } // End of namespace Illusions diff --git a/engines/illusions/screen.h b/engines/illusions/screen.h index 5d5ead2476..f0e1dbfdf4 100644 --- a/engines/illusions/screen.h +++ b/engines/illusions/screen.h @@ -39,7 +39,6 @@ public: Graphics::Surface *allocSurface(SurfInfo &surfInfo); bool isDisplayOn(); uint16 getColorKey2(); - Graphics::Surface *getBackSurface(); void updateSprites(); void drawSurface10(int16 destX, int16 destY, Graphics::Surface *surface, Common::Rect &srcRect, uint16 colorKey); void drawSurface11(int16 destX, int16 destY, Graphics::Surface *surface, Common::Rect &srcRect); diff --git a/engines/illusions/spritedecompressqueue.cpp b/engines/illusions/spritedecompressqueue.cpp index 01ebc740ee..acb4547a76 100644 --- a/engines/illusions/spritedecompressqueue.cpp +++ b/engines/illusions/spritedecompressqueue.cpp @@ -77,12 +77,13 @@ void SpriteDecompressQueue::decompress(SpriteDecompressQueueItem *item) { } byte *dst = (byte*)dstSurface->getBasePtr(x, y); - + while (processedSize < dstSize) { int16 op = READ_LE_UINT16(src); src += 2; if (op & 0x8000) { int runCount = (op & 0x7FFF) + 1; + processedSize += runCount; uint16 runColor = READ_LE_UINT16(src); src += 2; while (runCount--) { @@ -96,9 +97,9 @@ void SpriteDecompressQueue::decompress(SpriteDecompressQueueItem *item) { dst += 2 * xincr; } } - processedSize += runCount; } else { int copyCount = op + 1; + processedSize += copyCount; while (copyCount--) { uint16 color = READ_LE_UINT16(src); src += 2; @@ -112,7 +113,6 @@ void SpriteDecompressQueue::decompress(SpriteDecompressQueueItem *item) { dst += 2 * xincr; } } - processedSize += copyCount; } } |