[Scummvm-cvs-logs] SF.net SVN: scummvm:[55554] scummvm/trunk/engines/mohawk

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Wed Jan 26 20:13:54 CET 2011


Revision: 55554
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55554&view=rev
Author:   mthreepwood
Date:     2011-01-26 19:13:53 +0000 (Wed, 26 Jan 2011)

Log Message:
-----------
MOHAWK: Introduce a new CursorManager for LB v2+ (they do not use exe cursors)

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/cursors.cpp
    scummvm/trunk/engines/mohawk/cursors.h
    scummvm/trunk/engines/mohawk/detection_tables.h
    scummvm/trunk/engines/mohawk/livingbooks.cpp

Modified: scummvm/trunk/engines/mohawk/cursors.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/cursors.cpp	2011-01-26 19:05:36 UTC (rev 55553)
+++ scummvm/trunk/engines/mohawk/cursors.cpp	2011-01-26 19:13:53 UTC (rev 55554)
@@ -103,12 +103,11 @@
 	}
 }
 
-void DefaultCursorManager::setCursor(uint16 id) {
+void CursorManager::setStandardCursor(Common::SeekableReadStream *stream) {
 	// The Broderbund devs decided to rip off the Mac format, it seems.
 	// However, they reversed the x/y hotspot. That makes it totally different!!!!
+	assert(stream);
 
-	Common::SeekableReadStream *stream = _vm->getResource(_tag, id);
-
 	byte cursorBitmap[16 * 16];
 	decodeMacXorCursor(stream, cursorBitmap);
 	uint16 hotspotY = stream->readUint16BE();
@@ -120,6 +119,10 @@
 	delete stream;
 }
 
+void DefaultCursorManager::setCursor(uint16 id) {
+	setStandardCursor(_vm->getResource(_tag, id));
+}
+
 MystCursorManager::MystCursorManager(MohawkEngine_Myst *vm) : _vm(vm) {
 	_bmpDecoder = new MystBitmap();
 }
@@ -349,4 +352,26 @@
 	delete stream;
 }
 
+LivingBooksCursorManager_v2::LivingBooksCursorManager_v2() {
+	// Try to open the system archive if we have it
+	_sysArchive = new MohawkArchive();
+
+	if (!_sysArchive->open("system.mhk")) {
+		delete _sysArchive;
+		_sysArchive = 0;
+	}
+}
+
+LivingBooksCursorManager_v2::~LivingBooksCursorManager_v2() {
+	delete _sysArchive;
+}
+
+void LivingBooksCursorManager_v2::setCursor(uint16 id) {
+	if (_sysArchive && _sysArchive->hasResource(ID_TCUR, id)) {
+		setStandardCursor(_sysArchive->getResource(ID_TCUR, id));
+	} else {
+		// TODO: Handle generated cursors
+	}
+}
+
 } // End of namespace Mohawk

Modified: scummvm/trunk/engines/mohawk/cursors.h
===================================================================
--- scummvm/trunk/engines/mohawk/cursors.h	2011-01-26 19:05:36 UTC (rev 55553)
+++ scummvm/trunk/engines/mohawk/cursors.h	2011-01-26 19:13:53 UTC (rev 55554)
@@ -66,6 +66,7 @@
 	kRivenHideCursor = 9000
 };
 
+class MohawkArchive;
 class MohawkEngine;
 class MohawkEngine_Myst;
 class MystBitmap;
@@ -83,6 +84,9 @@
 protected:
 	// Handles the Mac version of the xor/and map cursor
 	void decodeMacXorCursor(Common::SeekableReadStream *stream, byte *cursor);
+
+	// Set a tCUR resource as the current cursor
+	void setStandardCursor(Common::SeekableReadStream *stream);
 };
 
 // The default Mohawk cursor manager
@@ -152,6 +156,19 @@
 	Common::MacResManager *_resFork;
 };
 
+// The cursor manager for Living Books v2+ games
+// Handles custom generated cursors in addition to tCUR resources
+class LivingBooksCursorManager_v2 : public CursorManager {
+public:
+	LivingBooksCursorManager_v2();
+	~LivingBooksCursorManager_v2();
+
+	void setCursor(uint16 id);
+
+private:
+	MohawkArchive *_sysArchive;
+};
+
 } // End of namespace Mohawk
 
 #endif

Modified: scummvm/trunk/engines/mohawk/detection_tables.h
===================================================================
--- scummvm/trunk/engines/mohawk/detection_tables.h	2011-01-26 19:05:36 UTC (rev 55553)
+++ scummvm/trunk/engines/mohawk/detection_tables.h	2011-01-26 19:13:53 UTC (rev 55554)
@@ -610,7 +610,7 @@
 		},
 		GType_LIVINGBOOKSV2,
 		0,
-		"GREEN.EXE"
+		0
 	},
 
 	// 32-bit version of the previous entry
@@ -626,7 +626,7 @@
 		},
 		GType_LIVINGBOOKSV2,
 		0,
-		"GREEN32.EXE"
+		0
 	},
 
 	{
@@ -641,7 +641,7 @@
 		},
 		GType_LIVINGBOOKSV2,
 		0,
-		"Green Eggs and Ham"
+		0
 	},
 
 	{
@@ -656,7 +656,7 @@
 		},
 		GType_LIVINGBOOKSV2,
 		0,
-		"ABC.EXE"
+		0
 	},
 
 	// 32-bit version of the previous entry
@@ -672,7 +672,7 @@
 		},
 		GType_LIVINGBOOKSV2,
 		0,
-		"ABC32.EXE"
+		0
 	},
 
 	{
@@ -1005,7 +1005,7 @@
 		},
 		GType_LIVINGBOOKSV2,
 		0,
-		"RACE.EXE"
+		0
 	},
 
 	// 32-bit version of the previous entry
@@ -1021,7 +1021,7 @@
 		},
 		GType_LIVINGBOOKSV2,
 		0,
-		"RACE32.EXE"
+		0
 	},
 
 	{

Modified: scummvm/trunk/engines/mohawk/livingbooks.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/livingbooks.cpp	2011-01-26 19:05:36 UTC (rev 55553)
+++ scummvm/trunk/engines/mohawk/livingbooks.cpp	2011-01-26 19:13:53 UTC (rev 55554)
@@ -116,7 +116,9 @@
 
 	_gfx = new LBGraphics(this, _screenWidth, _screenHeight);
 
-	if (getPlatform() == Common::kPlatformMacintosh)
+	if (getGameType() != GType_LIVINGBOOKSV1)
+		_cursor = new LivingBooksCursorManager_v2();
+	else if (getPlatform() == Common::kPlatformMacintosh)
 		_cursor = new MacCursorManager(getAppName());
 	else
 		_cursor = new NECursorManager(getAppName());


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