[Scummvm-cvs-logs] SF.net SVN: scummvm:[49409] scummvm/trunk/engines/m4
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Thu Jun 3 12:46:56 CEST 2010
Revision: 49409
http://scummvm.svn.sourceforge.net/scummvm/?rev=49409&view=rev
Author: dreammaster
Date: 2010-06-03 10:46:55 +0000 (Thu, 03 Jun 2010)
Log Message:
-----------
Properly implemented the logic for loading the correct interface background as specified in a scene's resources
Modified Paths:
--------------
scummvm/trunk/engines/m4/animation.cpp
scummvm/trunk/engines/m4/animation.h
scummvm/trunk/engines/m4/graphics.cpp
scummvm/trunk/engines/m4/graphics.h
Modified: scummvm/trunk/engines/m4/animation.cpp
===================================================================
--- scummvm/trunk/engines/m4/animation.cpp 2010-06-03 10:44:50 UTC (rev 49408)
+++ scummvm/trunk/engines/m4/animation.cpp 2010-06-03 10:46:55 UTC (rev 49409)
@@ -45,7 +45,7 @@
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 @@
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 @@
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 @@
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
Modified: scummvm/trunk/engines/m4/animation.h
===================================================================
--- scummvm/trunk/engines/m4/animation.h 2010-06-03 10:44:50 UTC (rev 49408)
+++ scummvm/trunk/engines/m4/animation.h 2010-06-03 10:46:55 UTC (rev 49409)
@@ -104,12 +104,12 @@
void load1(int frameNumber);
bool proc1(SpriteAsset &spriteSet, const Common::Point &pt, int frameNumber);
- void loadInterface(M4Surface *walkSurface, M4Surface *sceneSurface);
+ void loadInterface(M4Surface *&interfaceSurface, M4Surface *&depthSurface);
public:
MadsAnimation(MadsM4Engine *vm, MadsView *view);
virtual ~MadsAnimation();
- virtual void load(const Common::String &filename, uint16 flags, M4Surface *walkSurface, M4Surface *sceneSurface);
+ virtual void load(const Common::String &filename, uint16 flags, M4Surface *interfaceSurface, M4Surface *sceneSurface);
virtual void start();
virtual bool update();
virtual void stop();
Modified: scummvm/trunk/engines/m4/graphics.cpp
===================================================================
--- scummvm/trunk/engines/m4/graphics.cpp 2010-06-03 10:44:50 UTC (rev 49408)
+++ scummvm/trunk/engines/m4/graphics.cpp 2010-06-03 10:46:55 UTC (rev 49409)
@@ -727,16 +727,10 @@
delete tileBuffer;
}
-void M4Surface::madsloadInterface(int index, RGBList **palData) {
- char resourceName[20];
- sprintf(resourceName, "i%d.int", index);
- MadsPack intFile(resourceName, _vm);
+void M4Surface::madsLoadInterface(const Common::String &filename) {
+ MadsPack intFile(filename.c_str(), _vm);
RGB8 *palette = new RGB8[16];
- bool hasPalette = palData != NULL;
- if (!hasPalette)
- palData = &_rgbList;
-
// Chunk 0, palette
Common::SeekableReadStream *intStream = intFile.getItemStream(0);
@@ -748,7 +742,7 @@
intStream->readByte();
intStream->readByte();
}
- *palData = new RGBList(16, palette, true);
+ _rgbList = new RGBList(16, palette, true);
delete intStream;
// Chunk 1, data
@@ -757,11 +751,9 @@
intStream->read(pixels, 320 * 44);
delete intStream;
- if (!hasPalette) {
- // Translate the interface palette
- _vm->_palette->addRange(_rgbList);
- this->translate(_rgbList);
- }
+ // Translate the interface palette
+ _vm->_palette->addRange(_rgbList);
+ this->translate(_rgbList);
}
void M4Surface::scrollX(int xAmount) {
Modified: scummvm/trunk/engines/m4/graphics.h
===================================================================
--- scummvm/trunk/engines/m4/graphics.h 2010-06-03 10:44:50 UTC (rev 49408)
+++ scummvm/trunk/engines/m4/graphics.h 2010-06-03 10:46:55 UTC (rev 49409)
@@ -122,7 +122,8 @@
// loads the specified background
void loadBackground(int sceneNumber, RGBList **palData = NULL);
void loadBackgroundRiddle(const char *sceneName);
- void madsloadInterface(int index, RGBList **palData = NULL);
+ void madsLoadInterface(int index, RGBList **palData = NULL);
+ void madsLoadInterface(const Common::String &filename);
void setColor(byte value) { _color = value; }
void setColour(byte value) { _color = value; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list