aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
authorPaul Gilbert2014-09-18 22:21:15 -0400
committerPaul Gilbert2014-09-18 22:21:15 -0400
commita1548e27a0038ca7e86f823ebcbc1a5f5affe737 (patch)
tree9d95097bc86b566fdd857cbf56776291a0214adf /engines/mads
parent394d4623be6cddb4158021d1093f86d90e73e962 (diff)
downloadscummvm-rg350-a1548e27a0038ca7e86f823ebcbc1a5f5affe737.tar.gz
scummvm-rg350-a1548e27a0038ca7e86f823ebcbc1a5f5affe737.tar.bz2
scummvm-rg350-a1548e27a0038ca7e86f823ebcbc1a5f5affe737.zip
MADS: Further animation setup in AnimView
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/animation.cpp2
-rw-r--r--engines/mads/animation.h2
-rw-r--r--engines/mads/nebular/menu_nebular.cpp40
-rw-r--r--engines/mads/nebular/menu_nebular.h7
4 files changed, 46 insertions, 5 deletions
diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp
index 512a3979f9..556c475b27 100644
--- a/engines/mads/animation.cpp
+++ b/engines/mads/animation.cpp
@@ -390,7 +390,7 @@ void Animation::loadInterface(UserInterface &interfaceSurface, DepthSurface &dep
_scene->_depthStyle = 0;
if (header._bgType <= ANIMBG_FULL_SIZE) {
_vm->_palette->_paletteUsage.setEmpty();
- sceneInfo->load(header._roomNumber, flags, header._interfaceFile, 0, depthSurface, interfaceSurface);
+ sceneInfo->load(header._roomNumber, 0, header._interfaceFile, flags, depthSurface, interfaceSurface);
_scene->_depthStyle = sceneInfo->_depthStyle == 2 ? 1 : 0;
if (palCycles) {
palCycles->clear();
diff --git a/engines/mads/animation.h b/engines/mads/animation.h
index 15086d3e41..4bf330e3a3 100644
--- a/engines/mads/animation.h
+++ b/engines/mads/animation.h
@@ -223,6 +223,8 @@ public:
int roomNumber() const { return _header._roomNumber; }
void resetSpriteSetsCount() { _header._spriteSetsCount = 0; } // CHECKME: See if it doesn't leak the memory when the destructor is called
+
+ SpriteAsset *getSpriteSet(int idx) { return _spriteSets[idx]; }
};
} // End of namespace MADS
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);