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

dreammaster dreammaster at scummvm.org
Sat Sep 20 17:29:38 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:
dfe9cf2618 MADS: Fix Animation to handle loading backgrounds as well as user interfaces


Commit: dfe9cf26187509b8aad8454374925aea739684c6
    https://github.com/scummvm/scummvm/commit/dfe9cf26187509b8aad8454374925aea739684c6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-09-20T11:29:00-04:00

Commit Message:
MADS: Fix Animation to handle loading backgrounds as well as user interfaces

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



diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp
index e4ca26d..9b2c097 100644
--- a/engines/mads/animation.cpp
+++ b/engines/mads/animation.cpp
@@ -47,7 +47,7 @@ void AAHeader::load(Common::SeekableReadStream *f) {
 	char buffer[FILENAME_SIZE];
 	f->read(buffer, FILENAME_SIZE);
 	buffer[FILENAME_SIZE - 1] = '\0';
-	_interfaceFile = Common::String(buffer);
+	_backgroundFile = Common::String(buffer);
 
 	for (int i = 0; i < 50; ++i) {
 		f->read(buffer, FILENAME_SIZE);
@@ -188,7 +188,7 @@ Animation::~Animation() {
 	}
 }
 
-void Animation::load(UserInterface &interfaceSurface, DepthSurface &depthSurface,
+void Animation::load(MSurface &backSurface, DepthSurface &depthSurface,
 		const Common::String &resName, int flags, Common::Array<PaletteCycle> *palCycles,
 		SceneInfo *sceneInfo) {
 	Common::String resourceName = resName;
@@ -206,7 +206,7 @@ void Animation::load(UserInterface &interfaceSurface, DepthSurface &depthSurface
 		flags |= PALFLAG_RESERVED;
 
 	if (flags & ANIMFLAG_LOAD_BACKGROUND) {
-		loadInterface(interfaceSurface, depthSurface, _header, flags, palCycles, sceneInfo);
+		loadBackground(backSurface, depthSurface, _header, flags, palCycles, sceneInfo);
 	}
 	if (flags & ANIMFLAG_LOAD_BACKGROUND_ONLY) {
 		// No data
@@ -384,12 +384,12 @@ bool Animation::drawFrame(SpriteAsset &spriteSet, const Common::Point &pt, int f
 	return 0;
 }
 
-void Animation::loadInterface(UserInterface &interfaceSurface, DepthSurface &depthSurface,
+void Animation::loadBackground(MSurface &backSurface, DepthSurface &depthSurface,
 		AAHeader &header, int flags, Common::Array<PaletteCycle> *palCycles, SceneInfo *sceneInfo) {
 	_scene->_depthStyle = 0;
 	if (header._bgType <= ANIMBG_FULL_SIZE) {
 		_vm->_palette->_paletteUsage.setEmpty();
-		sceneInfo->load(header._roomNumber, 0, header._interfaceFile, flags, depthSurface, interfaceSurface);
+		sceneInfo->load(header._roomNumber, 0, header._backgroundFile, flags, depthSurface, backSurface);
 		_scene->_depthStyle = sceneInfo->_depthStyle == 2 ? 1 : 0;
 		if (palCycles) {
 			palCycles->clear();
@@ -398,8 +398,8 @@ void Animation::loadInterface(UserInterface &interfaceSurface, DepthSurface &dep
 		}
 	} else if (header._bgType == ANIMBG_INTERFACE) {
 		// Load a scene interface
-		Common::String resourceName = "*" + header._interfaceFile;
-		interfaceSurface.load(resourceName);
+		Common::String resourceName = "*" + header._backgroundFile;
+		backSurface.load(resourceName);
 
 		if (palCycles)
 			palCycles->clear();
diff --git a/engines/mads/animation.h b/engines/mads/animation.h
index c14f7c8..917d899 100644
--- a/engines/mads/animation.h
+++ b/engines/mads/animation.h
@@ -124,7 +124,7 @@ public:
 	int _spritesIndex;
 	Common::Point _scrollPosition;
 	uint32 _scrollTicks;
-	Common::String _interfaceFile;
+	Common::String _backgroundFile;
 	Common::StringArray _spriteSetNames;
 	Common::String _lbmFilename;
 	Common::String _spritesFilename;
@@ -167,9 +167,9 @@ private:
 	bool drawFrame(SpriteAsset &spriteSet, const Common::Point &pt, int frameNumber);
 
 	/**
-	 * Load the user interface display for an animation
+	 * Load the user interface display or background for an animation
 	 */
-	void loadInterface(UserInterface &interfaceSurface, DepthSurface &depthSurface,
+	void loadBackground(MSurface &backSurface, DepthSurface &depthSurface,
 		AAHeader &header, int flags, Common::Array<PaletteCycle> *palCycles, SceneInfo *sceneInfo);
 
 	/**
@@ -197,7 +197,7 @@ public:
 	/**
 	 * Loads animation data
 	 */
-	void load(UserInterface &interfaceSurface, DepthSurface &depthSurface, const Common::String &resName,
+	void load(MSurface &backSurface, DepthSurface &depthSurface, const Common::String &resName,
 		int flags, Common::Array<PaletteCycle> *palCycles, SceneInfo *sceneInfo);
 
 	/**
diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h
index 3a5bf22..ebfb1f4 100644
--- a/engines/mads/msurface.h
+++ b/engines/mads/msurface.h
@@ -64,6 +64,11 @@ public:
 	 * Helper method for calculating new dimensions when scaling a sprite
 	 */
 	static int scaleValue(int value, int scale, int err);
+
+	/**
+	* Base method for descendents to load their contents
+	*/
+	virtual void load(const Common::String &resName) {}
 public:
 	/**
 	 * Basic constructor
diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp
index 14b5b5b..7f4eaae 100644
--- a/engines/mads/nebular/menu_nebular.cpp
+++ b/engines/mads/nebular/menu_nebular.cpp
@@ -875,7 +875,7 @@ void AnimationView::loadNextResource() {
 
 	delete _currentAnimation;
 	_currentAnimation = Animation::init(_vm, &scene);
-	_currentAnimation->load(scene._userInterface, scene._depthSurface, 
+	_currentAnimation->load(scene._backgroundSurface, scene._depthSurface, 
 		resEntry._resourceName, resEntry._bgFlag ? 0x100 : 0,
 		nullptr, _sceneInfo);
 
diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h
index f251441..89044c9 100644
--- a/engines/mads/user_interface.h
+++ b/engines/mads/user_interface.h
@@ -225,7 +225,7 @@ public:
 	/**
 	* Loads an interface from a specified resource
 	*/
-	void load(const Common::String &resName);
+	virtual void load(const Common::String &resName);
 
 	/**
 	* Set up the interface






More information about the Scummvm-git-logs mailing list