[Scummvm-cvs-logs] SF.net SVN: scummvm:[48831] scummvm/trunk/engines/teenagent

megath at users.sourceforge.net megath at users.sourceforge.net
Wed Apr 28 21:50:29 CEST 2010


Revision: 48831
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48831&view=rev
Author:   megath
Date:     2010-04-28 19:50:28 +0000 (Wed, 28 Apr 2010)

Log Message:
-----------
added cd-version detection and cdlogo.res support

Modified Paths:
--------------
    scummvm/trunk/engines/teenagent/detection.cpp
    scummvm/trunk/engines/teenagent/pack.cpp
    scummvm/trunk/engines/teenagent/teenagent.cpp
    scummvm/trunk/engines/teenagent/teenagent.h

Modified: scummvm/trunk/engines/teenagent/detection.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/detection.cpp	2010-04-28 19:17:22 UTC (rev 48830)
+++ scummvm/trunk/engines/teenagent/detection.cpp	2010-04-28 19:50:28 UTC (rev 48831)
@@ -51,12 +51,32 @@
 			{"mmm.res", 0, NULL, -1},
 			{"sam_mmm.res", 0, NULL, -1},
 			{"sam_sam.res", 0, NULL, -1},
-			{"unlogic.res", 0, NULL, -1},
+			//{"unlogic.res", 0, NULL, -1}, //skipped if not present
 			{NULL, 0, NULL, 0}
 		},
 		Common::EN_ANY,
 		Common::kPlatformPC,
 		ADGF_NO_FLAGS,
+		Common::GUIO_NOSPEECH
+	},
+	{
+		"teenagent",
+		"",
+		{
+			{"off.res", 0, NULL, -1},
+			{"on.res", 0, NULL, -1},
+			{"ons.res", 0, NULL, -1},
+			{"varia.res", 0, NULL, -1},
+			{"lan_000.res", 0, NULL, -1},
+			{"lan_500.res", 0, NULL, -1},
+			{"sam_sam.res", 0, NULL, -1},
+			{"voices.res", 0, NULL, -1},
+			{"cdlogo.res", 0, NULL, -1},
+			{NULL, 0, NULL, 0}
+		},
+		Common::CZ_CZE,
+		Common::kPlatformPC,
+		ADGF_CD,
 		Common::GUIO_NONE
 	},
 	AD_TABLE_END_MARKER,

Modified: scummvm/trunk/engines/teenagent/pack.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/pack.cpp	2010-04-28 19:17:22 UTC (rev 48830)
+++ scummvm/trunk/engines/teenagent/pack.cpp	2010-04-28 19:50:28 UTC (rev 48831)
@@ -41,7 +41,7 @@
 }
 
 bool FilePack::open(const Common::String &filename) {
-	if (!file.open(filename))
+	if (!file.exists(filename) || !file.open(filename))
 		return false;
 
 	_fileCount = file.readUint32LE();
@@ -94,7 +94,7 @@
 	_filename = filename;
 
 	Common::File file;
-	if (!file.open(filename))
+	if (!file.exists(filename) || !file.open(filename))
 		return false;
 
 	_fileCount = file.readUint32LE();
@@ -154,7 +154,7 @@
 
 bool MemoryPack::open(const Common::String &filename) {
 	Common::File file;
-	if (!file.open(filename))
+	if (!file.exists(filename) || !file.open(filename))
 		return false;
 
 	uint32 count = file.readUint32LE();

Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp	2010-04-28 19:17:22 UTC (rev 48830)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp	2010-04-28 19:50:28 UTC (rev 48831)
@@ -268,6 +268,39 @@
 	return 0;
 }
 
+bool TeenAgentEngine::showCDLogo() {
+	Common::File cdlogo;
+	if (!cdlogo.exists("cdlogo.res") || !cdlogo.open("cdlogo.res"))
+		return true;
+
+	byte bg[0xfa00];
+	byte palette[0x400];
+
+	cdlogo.read(bg, sizeof(bg));
+	memset(palette, 0, sizeof(palette));
+
+	for(uint c = 0; c < 0x100; ++c) {
+		uint idx = c * 4;
+		cdlogo.read(palette + idx, 3);
+		palette[idx] *= 4;
+		palette[idx + 1] *= 4;
+		palette[idx + 2] *= 4;
+	}
+	_system->setPalette(palette, 0, 0x100);
+	_system->copyRectToScreen(bg, 320, 0, 0, 320, 200);
+	_system->updateScreen();
+
+	for(uint i = 0; i < 20; ++i) {
+		int r = skipEvents();
+		if (r != 0)
+			return r > 0? true: false;
+		_system->delayMillis(100);
+	}
+	cdlogo.close();
+
+	return true;
+}
+
 bool TeenAgentEngine::showLogo() {
 	FilePack logo;
 	if (!logo.open("unlogic.res"))
@@ -440,6 +473,8 @@
 	if (load_slot >= 0) {
 		loadGameState(load_slot);
 	} else {
+		if (!showCDLogo())
+			return Common::kNoError;
 		if (!showLogo())
 			return Common::kNoError;
 		if (!showMetropolis())

Modified: scummvm/trunk/engines/teenagent/teenagent.h
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.h	2010-04-28 19:17:22 UTC (rev 48830)
+++ scummvm/trunk/engines/teenagent/teenagent.h	2010-04-28 19:50:28 UTC (rev 48831)
@@ -74,6 +74,7 @@
 	inline Scene *getScene() { return scene; }
 
 	bool showLogo();
+	bool showCDLogo();
 	bool showMetropolis();
 	int skipEvents() const;
 


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