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

megath at users.sourceforge.net megath at users.sourceforge.net
Sat Jan 2 23:30:44 CET 2010


Revision: 46903
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46903&view=rev
Author:   megath
Date:     2010-01-02 22:30:43 +0000 (Sat, 02 Jan 2010)

Log Message:
-----------
added unlogic logo

Modified Paths:
--------------
    scummvm/trunk/engines/teenagent/detection.cpp
    scummvm/trunk/engines/teenagent/pack.cpp
    scummvm/trunk/engines/teenagent/pack.h
    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-01-02 22:04:05 UTC (rev 46902)
+++ scummvm/trunk/engines/teenagent/detection.cpp	2010-01-02 22:30:43 UTC (rev 46903)
@@ -51,6 +51,7 @@
 			{"mmm.res", 0, NULL, -1},
 			{"sam_mmm.res", 0, NULL, -1},
 			{"sam_sam.res", 0, NULL, -1},
+			{"unlogic.res", 0, NULL, -1}, 
 			{NULL, 0, NULL, 0}
 		},
 		Common::EN_ANY,

Modified: scummvm/trunk/engines/teenagent/pack.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/pack.cpp	2010-01-02 22:04:05 UTC (rev 46902)
+++ scummvm/trunk/engines/teenagent/pack.cpp	2010-01-02 22:30:43 UTC (rev 46903)
@@ -42,8 +42,10 @@
 }
 
 
-void Pack::open(const Common::String &filename) {
-	file.open(filename);
+bool Pack::open(const Common::String &filename) {
+	if (!file.open(filename))
+		return false;
+	
 	count = file.readUint32LE();
 	debug(0, "opened %s, found %u entries", filename.c_str(), count);
 	offsets = new uint32[count + 1];
@@ -55,6 +57,7 @@
 			debug(0, "%d: len = %d", i, offsets[i + 1] - offsets[i]);
 		}
 	*/
+	return true;
 }
 
 uint32 Pack::get_size(uint32 id) const {

Modified: scummvm/trunk/engines/teenagent/pack.h
===================================================================
--- scummvm/trunk/engines/teenagent/pack.h	2010-01-02 22:04:05 UTC (rev 46902)
+++ scummvm/trunk/engines/teenagent/pack.h	2010-01-02 22:30:43 UTC (rev 46903)
@@ -37,8 +37,11 @@
 public:
 	Pack();
 	~Pack();
-	void open(const Common::String &filename);
+
+	bool open(const Common::String &filename);
 	void close();
+	
+	inline uint32 files_count() const { return count; }
 	uint32 get_size(uint32 id) const;
 	uint32 read(uint32 id, byte *dst, uint32 size) const;
 	Common::SeekableReadStream *getStream(uint32 id) const;

Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp	2010-01-02 22:04:05 UTC (rev 46902)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp	2010-01-02 22:30:43 UTC (rev 46903)
@@ -22,22 +22,22 @@
  * $Id$
  */
 
-#include "teenagent/teenagent.h"
-#include "common/system.h"
+#include "common/config-manager.h"
+#include "common/debug.h"
 #include "common/events.h"
-#include "common/debug.h"
 #include "common/savefile.h"
-#include "common/config-manager.h"
+#include "common/system.h"
 #include "engines/advancedDetector.h"
 #include "sound/mixer.h"
+#include "graphics/cursorman.h"
 #include "graphics/thumbnail.h"
+#include "teenagent/console.h"
+#include "teenagent/music.h"
+#include "teenagent/objects.h"
+#include "teenagent/pack.h"
 #include "teenagent/scene.h"
-#include "teenagent/objects.h"
-#include "teenagent/music.h"
-#include "teenagent/console.h"
+#include "teenagent/teenagent.h"
 
-#include "graphics/cursorman.h"
-
 namespace TeenAgent {
 
 TeenAgentEngine::TeenAgentEngine(OSystem *system, const ADGameDescription *gd) : Engine(system), action(kActionNone), _gameDescription(gd) {
@@ -244,6 +244,66 @@
 	return Common::kNoError;
 }
 
+bool TeenAgentEngine::showLogo(const Common::String &name) {
+	Pack logo;
+	if (!logo.open(name))
+		return true;
+
+	Common::EventManager *_event = _system->getEventManager();
+
+	byte bg[0xfa00];
+	byte palette[0x400];
+		
+	Common::SeekableReadStream *frame = logo.getStream(1);
+	if (frame == NULL)
+		return true;
+
+	frame->read(bg, sizeof(bg));
+	memset(palette, 0, sizeof(palette));
+	
+	for(uint c = 0; c < 0x100; ++c) {
+		uint idx = c * 4;
+		frame->read(palette + idx, 3);
+		palette[idx] *= 4;
+		palette[idx + 1] *= 4;
+		palette[idx + 2] *= 4;
+	}
+	_system->setPalette(palette, 0, 0x100);
+
+	uint n = logo.files_count();
+	for(uint f = 0; f < 4; ++f) 
+		for(uint i = 2; i <= n; ++i) {
+			_system->copyRectToScreen(bg, 320, 0, 0, 320, 200);
+	
+			frame = logo.getStream(i);
+			if (frame == NULL)
+				return true;
+			
+			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: ;
+				}
+			}
+			Surface s;
+			s.load(frame, Surface::kTypeOns);
+			if (s.empty())
+				return true;
+
+			_system->copyRectToScreen((const byte *)s.pixels, s.w, s.x, s.y, s.w, s.h);
+			_system->updateScreen();
+
+			_system->delayMillis(100);
+		}
+	return true;
+}
+
 Common::Error TeenAgentEngine::run() {
 	Resources *res = Resources::instance();
 	if (!res->loadArchives(_gameDescription))
@@ -252,6 +312,8 @@
 	Common::EventManager *_event = _system->getEventManager();
 
 	initGraphics(320, 200, false);
+	if (!showLogo("unlogic.res"))
+		return Common::kNoError;
 
 	scene = new Scene;
 	inventory = new Inventory;

Modified: scummvm/trunk/engines/teenagent/teenagent.h
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.h	2010-01-02 22:04:05 UTC (rev 46902)
+++ scummvm/trunk/engines/teenagent/teenagent.h	2010-01-02 22:30:43 UTC (rev 46903)
@@ -72,6 +72,8 @@
 	bool processCallback(uint16 addr);
 	inline Scene *getScene() { return scene; }
 
+	bool showLogo(const Common::String &name);
+
 	static Common::String parseMessage(uint16 addr);
 
 	//event driven:


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