diff options
author | Paul Gilbert | 2014-09-18 22:21:15 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-09-18 22:21:15 -0400 |
commit | a1548e27a0038ca7e86f823ebcbc1a5f5affe737 (patch) | |
tree | 9d95097bc86b566fdd857cbf56776291a0214adf /engines/mads/nebular | |
parent | 394d4623be6cddb4158021d1093f86d90e73e962 (diff) | |
download | scummvm-rg350-a1548e27a0038ca7e86f823ebcbc1a5f5affe737.tar.gz scummvm-rg350-a1548e27a0038ca7e86f823ebcbc1a5f5affe737.tar.bz2 scummvm-rg350-a1548e27a0038ca7e86f823ebcbc1a5f5affe737.zip |
MADS: Further animation setup in AnimView
Diffstat (limited to 'engines/mads/nebular')
-rw-r--r-- | engines/mads/nebular/menu_nebular.cpp | 40 | ||||
-rw-r--r-- | engines/mads/nebular/menu_nebular.h | 7 |
2 files changed, 43 insertions, 4 deletions
diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp index d303dd7aad..14b5b5be9e 100644 --- a/engines/mads/nebular/menu_nebular.cpp +++ b/engines/mads/nebular/menu_nebular.cpp @@ -805,12 +805,20 @@ AnimationView::AnimationView(MADSEngine *vm) : MenuView(vm) { _sfx = 0; _soundFlag = _bgLoadFlag = true; _showWhiteBars = true; + _manualFrameNumber = 0; + _manualSpriteSet = nullptr; + _manualStartFrame = _manualEndFrame = 0; + _manualFrame2 = 0; + _hasManual = false; + _animFrameNumber = 0; + _sceneInfo = SceneInfo::init(_vm); load(); } AnimationView::~AnimationView() { delete _currentAnimation; + delete _sceneInfo; } void AnimationView::load() { @@ -868,7 +876,8 @@ void AnimationView::loadNextResource() { delete _currentAnimation; _currentAnimation = Animation::init(_vm, &scene); _currentAnimation->load(scene._userInterface, scene._depthSurface, - resEntry._resourceName, 0, nullptr, scene._sceneInfo); + resEntry._resourceName, resEntry._bgFlag ? 0x100 : 0, + nullptr, _sceneInfo); // If a sound driver has been specified, then load the correct one if (!_currentAnimation->_header._soundName.empty()) { @@ -879,13 +888,36 @@ void AnimationView::loadNextResource() { _vm->_sound->init(driverNum); } - // Set the enabled state for this animation + // Handle any manual setup + if (_currentAnimation->_header._manualFlag) { + _manualFrameNumber = _currentAnimation->_header._spritesIndex; + _manualSpriteSet = _currentAnimation->getSpriteSet(_manualFrameNumber); + _hasManual = true; + } + + // Set the sound data for the animation _vm->_sound->setEnabled(resEntry._soundFlag); - // Check for background loading - if (resEntry._bgFlag) { + Common::String dsrName = _currentAnimation->_header._dsrName; + 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; } void AnimationView::scriptDone() { diff --git a/engines/mads/nebular/menu_nebular.h b/engines/mads/nebular/menu_nebular.h index 3bfee2d6a6..2ffc0d6d07 100644 --- a/engines/mads/nebular/menu_nebular.h +++ b/engines/mads/nebular/menu_nebular.h @@ -276,7 +276,14 @@ private: int _v1; int _v2; int _resourceIndex; + SceneInfo *_sceneInfo; Animation *_currentAnimation; + int _manualFrameNumber; + SpriteAsset *_manualSpriteSet; + int _manualStartFrame, _manualEndFrame; + int _manualFrame2; + bool _hasManual; + int _animFrameNumber; private: void checkResource(const Common::String &resourceName); |