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

megath at users.sourceforge.net megath at users.sourceforge.net
Sun Jan 3 16:18:21 CET 2010


Revision: 46926
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46926&view=rev
Author:   megath
Date:     2010-01-03 15:18:20 +0000 (Sun, 03 Jan 2010)

Log Message:
-----------
added metropolis/TEENAGENT logo

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

Modified: scummvm/trunk/engines/teenagent/resources.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/resources.cpp	2010-01-03 15:08:26 UTC (rev 46925)
+++ scummvm/trunk/engines/teenagent/resources.cpp	2010-01-03 15:18:20 UTC (rev 46926)
@@ -47,6 +47,21 @@
 	sam_sam.close();
 }
 
+/*
+quick note on varia resources:
+1: Mark's animations (with head)
+2: Mark's idle animation
+3: Inventory background
+4: Inventory items
+5: Metropolis palette
+6: TEENAGENT logo (flames)
+7: Small font
+8: Bigger font
+9: Metropolis software house
+10: quit registered
+11: quit shareware
+*/
+
 bool Resources::loadArchives(const ADGameDescription *gd) {
 	Common::File dat_file;
 	if (!dat_file.open("teenagent.dat")) {

Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp	2010-01-03 15:08:26 UTC (rev 46925)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp	2010-01-03 15:18:20 UTC (rev 46926)
@@ -244,13 +244,33 @@
 	return Common::kNoError;
 }
 
-bool TeenAgentEngine::showLogo(const Common::String &name) {
+
+int TeenAgentEngine::skipEvents() const {
+	Common::EventManager *_event = _system->getEventManager();
+	Common::Event event;
+	while (_event->pollEvent(event)) {
+		switch(event.type) {
+		case Common::EVENT_QUIT:
+		case Common::EVENT_RTL:
+			return -1;
+		case Common::EVENT_MAINMENU:
+		case Common::EVENT_LBUTTONDOWN:
+		case Common::EVENT_RBUTTONDOWN:
+			return 1;
+		case Common::EVENT_KEYDOWN:
+		if (event.kbd.ascii)
+			return 1;
+		default: ;
+		}
+	}
+	return 0;
+}
+
+bool TeenAgentEngine::showLogo() {
 	Pack logo;
-	if (!logo.open(name))
+	if (!logo.open("unlogic.res"))
 		return true;
 
-	Common::EventManager *_event = _system->getEventManager();
-
 	byte bg[0xfa00];
 	byte palette[0x400];
 		
@@ -273,17 +293,10 @@
 	uint n = logo.files_count();
 	for(uint f = 0; f < 4; ++f) 
 		for(uint i = 2; i <= n; ++i) {
-			Common::Event event;
-			while (_event->pollEvent(event)) {
-				switch(event.type) {
-				case Common::EVENT_RTL:
-					return false;
-				case Common::EVENT_LBUTTONDOWN:
-				case Common::EVENT_RBUTTONDOWN:
-				case Common::EVENT_KEYDOWN:
-					return true;
-				default: ;
-				}
+			{
+				int r = skipEvents();
+				if (r != 0)
+					return r > 0? true: false;
 			}
 			_system->copyRectToScreen(bg, 320, 0, 0, 320, 200);
 	
@@ -305,6 +318,95 @@
 	return true;
 }
 
+bool TeenAgentEngine::showMetropolis() {
+	_system->fillScreen(0);
+	_system->updateScreen();
+	
+	Resources *res = Resources::instance();
+	
+	byte palette[0x400];
+	memset(palette, 0, sizeof(palette));
+	{
+		Common::SeekableReadStream *s = res->varia.getStream(5);
+		for(uint c = 0; c < 0x100; ++c) {
+			uint idx = c * 4;
+			s->read(palette + idx, 3);
+			palette[idx] *= 4;
+			palette[idx + 1] *= 4;
+			palette[idx + 2] *= 4;
+		}
+	}
+	
+	_system->setPalette(palette, 0, 0x100);
+	
+	byte varia_6[21760], varia_9[18302];
+	res->varia.read(6, varia_6, sizeof(varia_6));
+	res->varia.read(9, varia_9, sizeof(varia_9));
+	
+	byte colors[56 * 160 * 2];
+	memset(colors, 0, sizeof(colors));
+
+	int logo_y = -56;
+	for(uint f = 0; f < 300; ++f) {
+		{
+			int r = skipEvents();
+			if (r != 0)
+				return r > 0? true: false;
+		}
+
+		Graphics::Surface *surface = _system->lockScreen();
+		if (logo_y > 0) {
+			surface->fillRect(Common::Rect(0, 0, 320, logo_y), 0);
+		}
+		
+		{
+			//generate colors matrix
+			memmove(colors + 320, colors + 480, 8480);
+			for(uint c = 0; c < 17; ++c) {
+				byte x = (random.getRandomNumber(185) + 5) & 0xf;
+				colors[8800 + random.getRandomNumber(159)] = x | (x << 4); //last line
+			}
+			for(uint y = 1; y < 56; ++y) {
+				for(uint x = 1; x < 160; ++x) {
+					uint offset = y * 160 + x;
+					uint v = 
+						(uint)colors[offset - 161] + colors[offset - 160] + colors[offset - 159] + 
+						(uint)colors[offset - 1] + colors[offset + 1] + 
+						(uint)colors[offset + 161] + colors[offset + 160] + colors[offset + 159];
+					v >>= 3;
+					colors[offset + 8960] = v;
+				}
+			}
+			memmove(colors, colors + 8960, 8960);
+		}
+
+		byte *dst = (byte *)surface->getBasePtr(0, 131);
+		byte *src = varia_6;
+		for(uint y = 0; y < 68; ++y) {
+			for(uint x = 0; x < 320; ++x) {
+				if (*src++ == 1) {
+					*dst++ = colors[18 * 160 + y / 2 * 160 + x / 2];
+				} else 
+					++dst;
+			}
+		}
+		_system->unlockScreen();
+		
+		_system->copyRectToScreen(
+			varia_9 + (logo_y < 0? -logo_y * 320: 0), 320, 
+			0, logo_y >= 0? logo_y: 0, 
+			320, logo_y >= 0? 57: 57 + logo_y);
+
+		if (logo_y < 82 - 57)
+			++logo_y;
+		
+		
+		_system->updateScreen();
+		_system->delayMillis(100);
+	}
+	return true;
+}
+
 Common::Error TeenAgentEngine::run() {
 	Resources *res = Resources::instance();
 	if (!res->loadArchives(_gameDescription))
@@ -335,8 +437,10 @@
 	if (load_slot >= 0) {
 		loadGameState(load_slot);
 	} else {
-		if (!showLogo("unlogic.res"))
+		if (!showLogo())
 			return Common::kNoError;
+		if (!showMetropolis())
+			return Common::kNoError;
 		scene->intro = true;
 		scene_busy = true;
 		processCallback(0x24c);

Modified: scummvm/trunk/engines/teenagent/teenagent.h
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.h	2010-01-03 15:08:26 UTC (rev 46925)
+++ scummvm/trunk/engines/teenagent/teenagent.h	2010-01-03 15:18:20 UTC (rev 46926)
@@ -37,10 +37,10 @@
 /**
  * This is the namespace of the TeenAgent engine.
  *
- * Status of this engine: ???
+ * Status of this engine: Complete
  *
  * Supported games:
- * - ???
+ * - Teen Agent
  */
 namespace TeenAgent {
 
@@ -72,7 +72,9 @@
 	bool processCallback(uint16 addr);
 	inline Scene *getScene() { return scene; }
 
-	bool showLogo(const Common::String &name);
+	bool showLogo();
+	bool showMetropolis();
+	int skipEvents() const;
 
 	static Common::String parseMessage(uint16 addr);
 


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