From e743621f230caa807c24a8fc754f9391d43749f5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Oct 2014 18:21:49 -0400 Subject: MADS: Fix palette animations in cutscene animations --- engines/mads/nebular/menu_nebular.cpp | 27 +++++---------------------- engines/mads/nebular/menu_nebular.h | 1 - engines/mads/scene.h | 10 +++++----- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp index a85a67d69b..84db5a433c 100644 --- a/engines/mads/nebular/menu_nebular.cpp +++ b/engines/mads/nebular/menu_nebular.cpp @@ -809,7 +809,6 @@ AnimationView::AnimationView(MADSEngine *vm) : MenuView(vm) { _manualSpriteSet = nullptr; _manualStartFrame = _manualEndFrame = 0; _manualFrame2 = 0; - _hasManual = false; _animFrameNumber = 0; _sceneInfo = SceneInfo::init(_vm); @@ -878,6 +877,7 @@ void AnimationView::loadNextResource() { Scene &scene = _vm->_game->_scene; Palette &palette = *_vm->_palette; ResourceEntry &resEntry = _resources[_resourceIndex]; + Common::Array paletteCycles; if (resEntry._bgFlag) palette.resetGamePalette(1, 8); @@ -887,7 +887,7 @@ void AnimationView::loadNextResource() { _currentAnimation = Animation::init(_vm, &scene); _currentAnimation->load(scene._backgroundSurface, scene._depthSurface, resEntry._resourceName, resEntry._bgFlag ? ANIMFLAG_LOAD_BACKGROUND : 0, - nullptr, _sceneInfo); + &paletteCycles, _sceneInfo); // Signal for a screen refresh scene._spriteSlots.fullRefresh(); @@ -906,7 +906,6 @@ void AnimationView::loadNextResource() { if (_currentAnimation->_header._manualFlag) { _manualFrameNumber = _currentAnimation->_header._spritesIndex; _manualSpriteSet = _currentAnimation->getSpriteSet(_manualFrameNumber); - _hasManual = true; } // Set the sound data for the animation @@ -916,27 +915,11 @@ void AnimationView::loadNextResource() { if (!dsrName.empty()) _vm->_audio->setSoundGroup(dsrName); - // Initial frames scan loop - /* - bool foundFrame = false; - for (int frameCtr = 0; frameCtr < (int)_currentAnimation->_frameEntries.size(); ++frameCtr) { - int spritesIdx = _currentAnimation->_spriteListIndexes[_manualFrameNumber]; - AnimFrameEntry &frame = _currentAnimation->_frameEntries[frameCtr]; - - if (frame._spriteSlot._spritesIndex == spritesIdx) { - _animFrameNumber = frame._frameNumber; - _manualStartFrame = _animFrameNumber; - _manualEndFrame = _manualSpriteSet->getCount() - 1; - _manualFrame2 = _manualStartFrame - 1; - break; - } - } - if (!foundFrame) - */ - _hasManual = false; - // Start the new animation _currentAnimation->startAnimation(0); + + // If there were any palette cycles defined, start them up + scene.initPaletteAnimation(paletteCycles, true); } void AnimationView::scriptDone() { diff --git a/engines/mads/nebular/menu_nebular.h b/engines/mads/nebular/menu_nebular.h index f8e84fa5b6..ae063c6b43 100644 --- a/engines/mads/nebular/menu_nebular.h +++ b/engines/mads/nebular/menu_nebular.h @@ -281,7 +281,6 @@ private: SpriteAsset *_manualSpriteSet; int _manualStartFrame, _manualEndFrame; int _manualFrame2; - bool _hasManual; int _animFrameNumber; private: void checkResource(const Common::String &resourceName); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index ee7864cfee..9fd99ad8e5 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -52,11 +52,6 @@ private: */ void loadVocabStrings(); - /* - * Initializes the data for palette animation within the scene - */ - void initPaletteAnimation(Common::Array &palCycles, bool animFlag); - /** * Handles a single frame within the game scene */ @@ -204,6 +199,11 @@ public: */ void drawElements(ScreenTransition transitionType, bool surfaceFlag); + /* + * Initializes the data for palette animation within the scene + */ + void initPaletteAnimation(Common::Array &palCycles, bool animFlag); + /** * Handles cycling palette colors for the scene */ -- cgit v1.2.3