From ef34896dce9188591e8ddd6e8eed543febd70b87 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 11 Jun 2010 11:03:51 +0000 Subject: Clarified various incorrectly named parameters, and fixed code for loading the correct art file backgrounds when running animation sequences svn-id: r49595 --- engines/m4/animation.cpp | 4 ++-- engines/m4/animation.h | 2 +- engines/m4/mads_anim.cpp | 17 +++++++++++------ engines/m4/mads_anim.h | 1 + engines/m4/mads_scene.cpp | 2 +- engines/m4/mads_views.h | 2 +- 6 files changed, 17 insertions(+), 11 deletions(-) (limited to 'engines') diff --git a/engines/m4/animation.cpp b/engines/m4/animation.cpp index 1142ba48d1..dacfd8c581 100644 --- a/engines/m4/animation.cpp +++ b/engines/m4/animation.cpp @@ -63,7 +63,7 @@ MadsAnimation::~MadsAnimation() { /** * Initialises and loads the data of an animation */ -void MadsAnimation::initialise(const Common::String &filename, uint16 flags, M4Surface *interfaceSurface, M4Surface *sceneSurface) { +void MadsAnimation::initialise(const Common::String &filename, uint16 flags, M4Surface *surface, M4Surface *depthSurface) { MadsPack anim(filename.c_str(), _vm); bool madsRes = filename[0] == '*'; char buffer[20]; @@ -114,7 +114,7 @@ void MadsAnimation::initialise(const Common::String &filename, uint16 flags, M4S if (_animMode == 4) flags |= 0x4000; if (flags & 0x100) - loadInterface(interfaceSurface, sceneSurface); + loadInterface(surface, depthSurface); // Initialise the reference list for (int i = 0; i < spriteListCount; ++i) diff --git a/engines/m4/animation.h b/engines/m4/animation.h index 5c7227a256..029cf45738 100644 --- a/engines/m4/animation.h +++ b/engines/m4/animation.h @@ -108,7 +108,7 @@ public: MadsAnimation(MadsM4Engine *vm, MadsView *view); virtual ~MadsAnimation(); - virtual void initialise(const Common::String &filename, uint16 flags, M4Surface *interfaceSurface, M4Surface *sceneSurface); + virtual void initialise(const Common::String &filename, uint16 flags, M4Surface *surface, M4Surface *depthSurface); virtual void load(const Common::String &filename, int abortTimers); virtual void update(); virtual void setCurrentFrame(int frameNumber); diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp index eac6d1b4aa..c618ae57cc 100644 --- a/engines/m4/mads_anim.cpp +++ b/engines/m4/mads_anim.cpp @@ -458,6 +458,8 @@ AnimviewView::AnimviewView(MadsM4Engine *vm): _previousUpdate = 0; _transition = kTransitionNone; _activeAnimation = NULL; + _bgLoadFlag = true; + reset(); // Set up system palette colors @@ -572,12 +574,12 @@ void AnimviewView::readNextCommand() { if (strchr(_currentLine, '.') == NULL) strcat(_currentLine, ".aa"); - _activeAnimation = new MadsAnimation(_vm, this); - _activeAnimation->load(_currentLine, 0); + uint16 flags = 0; + if (_bgLoadFlag) + flags |= 0x100; - _backgroundSurface.loadBackground(_activeAnimation->roomNumber()); - _codeSurface.setSize(_backgroundSurface.width(), _backgroundSurface.height()); - _codeSurface.fillRect(_codeSurface.bounds(), 0xff); + _activeAnimation = new MadsAnimation(_vm, this); + _activeAnimation->initialise(_currentLine, flags, &_backgroundSurface, &_codeSurface); _spriteSlots.fullRefresh(); /* @@ -675,7 +677,10 @@ void AnimviewView::processCommand() { str_upper(commandStr); char *param = commandStr; - if (!strncmp(commandStr, "X", 1)) { + if (!strncmp(commandStr, "B", 1)) { + // Toggle background load flag + _bgLoadFlag = !_bgLoadFlag; + } else if (!strncmp(commandStr, "X", 1)) { //printf("X "); } else if (!strncmp(commandStr, "W", 1)) { //printf("W "); diff --git a/engines/m4/mads_anim.h b/engines/m4/mads_anim.h index 8c4a5e6fb7..f18fe46f48 100644 --- a/engines/m4/mads_anim.h +++ b/engines/m4/mads_anim.h @@ -90,6 +90,7 @@ private: RGBList *_palData; int _transition; MadsAnimation *_activeAnimation; + bool _bgLoadFlag; void reset(); void readNextCommand(); diff --git a/engines/m4/mads_scene.cpp b/engines/m4/mads_scene.cpp index a65224c722..f98684de6a 100644 --- a/engines/m4/mads_scene.cpp +++ b/engines/m4/mads_scene.cpp @@ -720,7 +720,7 @@ void MadsSceneResources::load(int sceneNumber, const char *resName, int v0, M4Su _vm->_resourceManager->toss(sceneName); // Load the surface artwork - surface->loadBackground(sceneNumber); + surface->loadBackground(artFileNum); // Final cleanup if (ssFlag) diff --git a/engines/m4/mads_views.h b/engines/m4/mads_views.h index 85bfe9e552..c0f3790a23 100644 --- a/engines/m4/mads_views.h +++ b/engines/m4/mads_views.h @@ -367,7 +367,7 @@ protected: public: Animation(MadsM4Engine *vm); virtual ~Animation(); - virtual void initialise(const Common::String &filename, uint16 flags, M4Surface *walkSurface, M4Surface *sceneSurface) = 0; + virtual void initialise(const Common::String &filename, uint16 flags, M4Surface *surface, M4Surface *depthSurface) = 0; virtual void load(const Common::String &filename, int v0) = 0; virtual void update() = 0; virtual void setCurrentFrame(int frameNumber) = 0; -- cgit v1.2.3