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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Feb 3 17:51:38 CET 2008


Revision: 30770
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30770&view=rev
Author:   peres001
Date:     2008-02-03 08:51:38 -0800 (Sun, 03 Feb 2008)

Log Message:
-----------
Implemented a couple more opcodes and added capability to load/display static images in BRA.

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

Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h	2008-02-03 16:02:21 UTC (rev 30769)
+++ scummvm/trunk/engines/parallaction/disk.h	2008-02-03 16:51:38 UTC (rev 30770)
@@ -209,6 +209,7 @@
 	void errorFileNotFound(const char *s);
 	Font *createFont(const char *name, Common::ReadStream &stream);
 	Sprites*	createSprites(const char *name);
+	void loadBitmap(Common::SeekableReadStream &stream, Graphics::Surface &surf, byte *palette);
 
 public:
 	DosDisk_br(Parallaction *vm);

Modified: scummvm/trunk/engines/parallaction/disk_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_br.cpp	2008-02-03 16:02:21 UTC (rev 30769)
+++ scummvm/trunk/engines/parallaction/disk_br.cpp	2008-02-03 16:51:38 UTC (rev 30770)
@@ -180,7 +180,22 @@
 	return 0;
 }
 
+void DosDisk_br::loadBitmap(Common::SeekableReadStream &stream, Graphics::Surface &surf, byte *palette) {
+	stream.skip(4);
+	uint width = stream.readUint32BE();
+	uint height = stream.readUint32BE();
+	stream.skip(20);
 
+	if (palette) {
+		stream.read(palette, 768);
+	} else {
+		stream.skip(768);
+	}
+
+	surf.create(width, height, 1);
+	stream.read(surf.pixels, width * height);
+}
+
 Frames* DosDisk_br::loadPointer(const char *name) {
 	debugC(5, kDebugDisk, "DosDisk_br::loadPointer");
 
@@ -191,17 +206,8 @@
 	if (!stream.open(path))
 		errorFileNotFound(path);
 
-	stream.skip(4);
-	uint width = stream.readUint32BE();
-	uint height = stream.readUint32BE();
-	stream.skip(20);
-	stream.skip(768);
-
 	Graphics::Surface *surf = new Graphics::Surface;
-
-	surf->create(width, height, 1);
-	stream.read(surf->pixels, width * height);
-
+	loadBitmap(stream, *surf, 0);
 	return new SurfaceToFrames(surf);
 }
 
@@ -231,7 +237,17 @@
 
 Frames* DosDisk_br::loadStatic(const char* name) {
 	debugC(5, kDebugDisk, "DosDisk_br::loadStatic");
-	return 0;
+
+	char path[PATH_LEN];
+	sprintf(path, "%s/ras/%s", _partPath, name);
+	Common::File stream;
+	if (!stream.open(path)) {
+		errorFileNotFound(path);
+	}
+
+	Graphics::Surface *surf = new Graphics::Surface;
+	loadBitmap(stream, *surf, 0);
+	return new SurfaceToFrames(surf);
 }
 
 Sprites* DosDisk_br::createSprites(const char *path) {
@@ -284,21 +300,16 @@
 	if (!stream.open(path))
 		errorFileNotFound(path);
 
-	stream.skip(4);
-	info.width = stream.readUint32BE();
-	info.height = stream.readUint32BE();
-	stream.skip(20);
-
 	byte rgb[768];
-	stream.read(rgb, 768);
 
+	loadBitmap(stream, info.bg, rgb);
+	info.width = info.bg.w;
+	info.height = info.bg.h;
+
 	for (uint i = 0; i < 256; i++) {
 		info.palette.setEntry(i, rgb[i] >> 2, rgb[i+256] >> 2, rgb[i+512] >> 2);
 	}
 
-	info.bg.create(info.width, info.height, 1);
-	stream.read(info.bg.pixels, info.width * info.height);
-
 	return;
 }
 
@@ -313,20 +324,16 @@
 		if (!stream.open(filename))
 			errorFileNotFound(filename);
 
-		stream.skip(4);
-		info.width = stream.readUint32BE();
-		info.height = stream.readUint32BE();
-		stream.skip(20);
-
 		byte rgb[768];
-		stream.read(rgb, 768);
 
+		loadBitmap(stream, info.bg, rgb);
+		info.width = info.bg.w;
+		info.height = info.bg.h;
+
 		for (uint i = 0; i < 256; i++) {
 			info.palette.setEntry(i, rgb[i] >> 2, rgb[i+256] >> 2, rgb[i+512] >> 2);
 		}
 
-		info.bg.create(info.width, info.height, 1);
-		stream.read(info.bg.pixels, info.width * info.height);
 		stream.close();
 	}
 

Modified: scummvm/trunk/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_br.cpp	2008-02-03 16:02:21 UTC (rev 30769)
+++ scummvm/trunk/engines/parallaction/exec_br.cpp	2008-02-03 16:51:38 UTC (rev 30770)
@@ -294,11 +294,35 @@
 
 DECLARE_INSTRUCTION_OPCODE(on) {
 	warning("Parallaction_br::instOp_on not yet implemented");
+
+	Instruction *inst = *_instRunCtxt.inst;
+	Zone *z = inst->_z;
+
+	if (z) {
+		z->_flags |= kFlagsActive;
+		z->_flags &= ~kFlagsRemove;
+
+		if ((z->_type & 0xFFFF) & kZoneGet) {
+			_gfx->showGfxObj(z->u.get->gfxobj, true);
+		}
+	}
+
 }
 
 
 DECLARE_INSTRUCTION_OPCODE(off) {
 	warning("Parallaction_br::instOp_off not yet implemented");
+
+	Instruction *inst = *_instRunCtxt.inst;
+	Zone *z = inst->_z;
+
+	if (z) {
+		z->_flags |= kFlagsRemove;
+
+		if ((z->_type & 0xFFFF) & kZoneGet) {
+			_gfx->showGfxObj(z->u.get->gfxobj, false);
+		}
+	}
 }
 
 


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