[Scummvm-cvs-logs] scummvm master -> a1548e27a0038ca7e86f823ebcbc1a5f5affe737

dreammaster dreammaster at scummvm.org
Fri Sep 19 04:22:00 CEST 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a1548e27a0 MADS: Further animation setup in AnimView


Commit: a1548e27a0038ca7e86f823ebcbc1a5f5affe737
    https://github.com/scummvm/scummvm/commit/a1548e27a0038ca7e86f823ebcbc1a5f5affe737
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-09-18T22:21:15-04:00

Commit Message:
MADS: Further animation setup in AnimView

Changed paths:
    engines/mads/animation.cpp
    engines/mads/animation.h
    engines/mads/nebular/menu_nebular.cpp
    engines/mads/nebular/menu_nebular.h



diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp
index 512a397..556c475 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 15086d3..4bf330e 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 d303dd7..14b5b5b 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 3bfee2d..2ffc0d6 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);
 






More information about the Scummvm-git-logs mailing list