aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2014-09-20 11:29:00 -0400
committerPaul Gilbert2014-09-20 11:29:00 -0400
commitdfe9cf26187509b8aad8454374925aea739684c6 (patch)
treebbc16c3b408e2df48b1c65be473c1fbb7bc6cff9 /engines
parent9a0ba3e63443fcfef4d2edcc48e06faf0820b0c3 (diff)
downloadscummvm-rg350-dfe9cf26187509b8aad8454374925aea739684c6.tar.gz
scummvm-rg350-dfe9cf26187509b8aad8454374925aea739684c6.tar.bz2
scummvm-rg350-dfe9cf26187509b8aad8454374925aea739684c6.zip
MADS: Fix Animation to handle loading backgrounds as well as user interfaces
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/animation.cpp14
-rw-r--r--engines/mads/animation.h8
-rw-r--r--engines/mads/msurface.h5
-rw-r--r--engines/mads/nebular/menu_nebular.cpp2
-rw-r--r--engines/mads/user_interface.h2
5 files changed, 18 insertions, 13 deletions
diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp
index e4ca26d2a5..9b2c097004 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 c14f7c8710..917d899ec5 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 3a5bf22eed..ebfb1f437a 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 14b5b5be9e..7f4eaaeec3 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 f251441e40..89044c9bf1 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