[Scummvm-cvs-logs] SF.net SVN: scummvm:[39463] scummvm/trunk/engines/parallaction

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Tue Mar 17 00:58:19 CET 2009


Revision: 39463
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39463&view=rev
Author:   Kirben
Date:     2009-03-16 23:58:19 +0000 (Mon, 16 Mar 2009)

Log Message:
-----------
Cleanup.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/disk.h
    scummvm/trunk/engines/parallaction/disk_br.cpp

Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h	2009-03-16 23:10:50 UTC (rev 39462)
+++ scummvm/trunk/engines/parallaction/disk.h	2009-03-16 23:58:19 UTC (rev 39463)
@@ -260,6 +260,7 @@
 
 	virtual void init();
 
+	Common::String selectArchive(const Common::String& name);
 	GfxObj* loadTalk(const char *name);
 	Font* loadFont(const char* name);
 	GfxObj* loadStatic(const char* name);
@@ -269,8 +270,7 @@
 	GfxObj* loadObjects(const char *name, uint8 part = 0);
 	Common::SeekableReadStream* loadMusic(const char* name);
 	Common::ReadStream* loadSound(const char* name);
-	Common::String selectArchive(const Common::String& name);
-
+	void loadMask(const char *name, MaskBuffer &buffer);
 };
 
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/disk_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_br.cpp	2009-03-16 23:10:50 UTC (rev 39462)
+++ scummvm/trunk/engines/parallaction/disk_br.cpp	2009-03-16 23:58:19 UTC (rev 39463)
@@ -500,6 +500,25 @@
 }
 
 
+void AmigaDisk_br::loadMask(const char *name, MaskBuffer &buffer) {
+	if (!name) {
+		return;
+	}
+
+	Common::SeekableReadStream *stream = openFile("msk/" + Common::String(name), ".msk");
+
+	byte *pal = 0;
+	Graphics::Surface* surf = new Graphics::Surface;
+	Graphics::ILBMDecoder decoder(*stream, *surf, pal);
+	decoder.decode();
+	free(pal);
+
+	buffer.create(surf->w, surf->h);
+	memcpy(buffer.data, surf->pixels, buffer.size);
+	buffer.bigEndian = false;
+	delete stream;
+}
+
 void AmigaDisk_br::loadScenery(BackgroundInfo& info, const char* name, const char* mask, const char* path) {
 	debugC(1, kDebugDisk, "AmigaDisk_br::loadScenery '%s', '%s' '%s'", name, mask, path);
 
@@ -510,35 +529,17 @@
 		loadBackground(info, *stream);
 		delete stream;
 	}
+	if (mask) {
 #if 0
-	if (mask) {
-		stream = tryOpenFile("msk/" + Common::String(mask), ".msk");
-		if (stream) {
-			Graphics::PackBitsReadStream unpackedStream(*stream);
-			info._mask = new MaskBuffer;
-			info._mask->bigEndian = false;
-			info._mask->create(info.width, info.height);
-			unpackedStream.read(info._mask->data, info._mask->size);
-			// TODO: there is another step to do after decompression...
-			delete stream;
-		} else {
-			debugC(1, kDebugDisk, "AmigaDisk_br::loadScenery: (%s) not found", mask);
-		}
+		info._mask = new MaskBuffer;
+		loadMask(mask, *info._mask);
+#endif
 	}
-#endif
+
 	if (path) {
-		stream = tryOpenFile("pth/" + Common::String(path), ".pth");
-		if (stream) {
-			// NOTE: info.width and info.height are only valid if the background graphics
-			// have already been loaded
-			info._path = new PathBuffer;
-			info._path->bigEndian = false;
-			info._path->create(info.width, info.height);
-			stream->read(info._path->data, info._path->size);
-			delete stream;
-		} else {
-			debugC(1, kDebugDisk, "AmigaDisk_br::loadScenery: (%s) not found", path);
-		}
+		info._path = new PathBuffer;
+		info._path->create(info.width, info.height);
+		loadPath(path, *info._path);
 	}
 
 	return;
@@ -568,7 +569,7 @@
 	free(pal);
 	delete stream;
 
-	return new GfxObj(0, new SurfaceToFrames(surf));
+	return new GfxObj(0, new SurfaceToFrames(surf), name);
 }
 
 Sprites* AmigaDisk_br::createSprites(Common::ReadStream &stream) {


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