aboutsummaryrefslogtreecommitdiff
path: root/engines/m4/animation.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2010-06-03 10:46:55 +0000
committerPaul Gilbert2010-06-03 10:46:55 +0000
commit26860b8e5170d9da92b5da82325c137fddfd8778 (patch)
tree340cceee0b47095bf530f605a62b3a7f86f9addb /engines/m4/animation.cpp
parent2ae4c5796b44f6ab6ecf68425e096dde50cb9f95 (diff)
downloadscummvm-rg350-26860b8e5170d9da92b5da82325c137fddfd8778.tar.gz
scummvm-rg350-26860b8e5170d9da92b5da82325c137fddfd8778.tar.bz2
scummvm-rg350-26860b8e5170d9da92b5da82325c137fddfd8778.zip
Properly implemented the logic for loading the correct interface background as specified in a scene's resources
svn-id: r49409
Diffstat (limited to 'engines/m4/animation.cpp')
-rw-r--r--engines/m4/animation.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/engines/m4/animation.cpp b/engines/m4/animation.cpp
index 412f514e5b..58d829c4a2 100644
--- a/engines/m4/animation.cpp
+++ b/engines/m4/animation.cpp
@@ -45,7 +45,7 @@ MadsAnimation::~MadsAnimation() {
delete _font;
}
-void MadsAnimation::load(const Common::String &filename, uint16 flags, M4Surface *walkSurface, M4Surface *sceneSurface) {
+void MadsAnimation::load(const Common::String &filename, uint16 flags, M4Surface *interfaceSurface, M4Surface *sceneSurface) {
MadsPack anim(filename.c_str(), _vm);
bool madsRes = filename[0] == '*';
char buffer[20];
@@ -66,8 +66,8 @@ void MadsAnimation::load(const Common::String &filename, uint16 flags, M4Surface
animStream->skip(2);
_animMode = animStream->readUint16LE();
_roomNumber = animStream->readUint16LE();
+ animStream->skip(2);
_field12 = animStream->readUint16LE() != 0;
- animStream->skip(4);
_spriteListIndex = animStream->readUint16LE();
_scrollX = animStream->readUint16LE();
_scrollY = animStream->readSint16LE();
@@ -96,7 +96,7 @@ void MadsAnimation::load(const Common::String &filename, uint16 flags, M4Surface
if (_animMode == 4)
flags |= 0x4000;
if (flags & 0x100)
- loadInterface(walkSurface, sceneSurface);
+ loadInterface(interfaceSurface, sceneSurface);
// Initialise the reference list
for (int i = 0; i < spriteListCount; ++i)
@@ -424,18 +424,28 @@ bool MadsAnimation::proc1(SpriteAsset &spriteSet, const Common::Point &pt, int f
return 0;
}
-void MadsAnimation::loadInterface(M4Surface *walkSurface, M4Surface *sceneSurface) {
- walkSurface->madsloadInterface(0);
+void MadsAnimation::loadInterface(M4Surface *&interfaceSurface, M4Surface *&depthSurface) {
+ if (_animMode <= 2) {
+ MadsSceneResources sceneResources;
+ sceneResources.load(_roomNumber, _infoFilename.c_str(), 0, depthSurface, interfaceSurface);
+ // Rex only supports a single dialog draw style
+ assert(sceneResources.dialogStyle == 2);
- /* TODO - implement properly
- if (_animMode > 2) {
- warning("Mode1");
+ } else if (_animMode == 4) {
+ // Load a scene interface
+ interfaceSurface->madsLoadInterface(_infoFilename);
} else {
- MadsSceneResources sceneResources;
- sceneResources.load(_roomNumber, _infoFilename.c_str(), 0, walkSurface, sceneSurface);
+ // This mode allocates two large surfaces for the animation
+ // TODO: Are these ever properly freed?
+error("Anim mode %d - need to check free logic", _animMode);
+ assert(!interfaceSurface);
+ assert(!depthSurface);
+ depthSurface = new M4Surface(MADS_SURFACE_WIDTH, MADS_SCREEN_HEIGHT);
+ interfaceSurface = new M4Surface(MADS_SURFACE_WIDTH, MADS_SCREEN_HEIGHT);
+ depthSurface->clear();
+ interfaceSurface->clear();
}
- */
}
} // End of namespace M4