aboutsummaryrefslogtreecommitdiff
path: root/engines/teenagent
diff options
context:
space:
mode:
authorVladimir Menshakov2010-01-02 22:30:43 +0000
committerVladimir Menshakov2010-01-02 22:30:43 +0000
commit09a197d125b92035db7bbc487cd29f3fea40d998 (patch)
tree2775d4f4553521525ba5c907a5914e40fe02597f /engines/teenagent
parentbaf8575e36badf6d8379087e4fc7b2a2cc7b42ad (diff)
downloadscummvm-rg350-09a197d125b92035db7bbc487cd29f3fea40d998.tar.gz
scummvm-rg350-09a197d125b92035db7bbc487cd29f3fea40d998.tar.bz2
scummvm-rg350-09a197d125b92035db7bbc487cd29f3fea40d998.zip
added unlogic logo
svn-id: r46903
Diffstat (limited to 'engines/teenagent')
-rw-r--r--engines/teenagent/detection.cpp1
-rw-r--r--engines/teenagent/pack.cpp7
-rw-r--r--engines/teenagent/pack.h5
-rw-r--r--engines/teenagent/teenagent.cpp80
-rw-r--r--engines/teenagent/teenagent.h2
5 files changed, 83 insertions, 12 deletions
diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp
index 455cc65bd5..24aa250c0e 100644
--- a/engines/teenagent/detection.cpp
+++ b/engines/teenagent/detection.cpp
@@ -51,6 +51,7 @@ static const ADGameDescription teenAgentGameDescriptions[] = {
{"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,
diff --git a/engines/teenagent/pack.cpp b/engines/teenagent/pack.cpp
index 50577b9d81..3a5fae88f9 100644
--- a/engines/teenagent/pack.cpp
+++ b/engines/teenagent/pack.cpp
@@ -42,8 +42,10 @@ void Pack::close() {
}
-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 @@ void Pack::open(const Common::String &filename) {
debug(0, "%d: len = %d", i, offsets[i + 1] - offsets[i]);
}
*/
+ return true;
}
uint32 Pack::get_size(uint32 id) const {
diff --git a/engines/teenagent/pack.h b/engines/teenagent/pack.h
index 326c92d9fb..4013998152 100644
--- a/engines/teenagent/pack.h
+++ b/engines/teenagent/pack.h
@@ -37,8 +37,11 @@ class Pack {
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;
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index f709ce332b..ab97233052 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -22,21 +22,21 @@
* $Id$
*/
-#include "teenagent/teenagent.h"
-#include "common/system.h"
-#include "common/events.h"
+#include "common/config-manager.h"
#include "common/debug.h"
+#include "common/events.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/scene.h"
-#include "teenagent/objects.h"
-#include "teenagent/music.h"
#include "teenagent/console.h"
-
-#include "graphics/cursorman.h"
+#include "teenagent/music.h"
+#include "teenagent/objects.h"
+#include "teenagent/pack.h"
+#include "teenagent/scene.h"
+#include "teenagent/teenagent.h"
namespace TeenAgent {
@@ -244,6 +244,66 @@ Common::Error TeenAgentEngine::saveGameState(int slot, const char *desc) {
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::Error TeenAgentEngine::run() {
Common::EventManager *_event = _system->getEventManager();
initGraphics(320, 200, false);
+ if (!showLogo("unlogic.res"))
+ return Common::kNoError;
scene = new Scene;
inventory = new Inventory;
diff --git a/engines/teenagent/teenagent.h b/engines/teenagent/teenagent.h
index a02197aa33..1156bc9d81 100644
--- a/engines/teenagent/teenagent.h
+++ b/engines/teenagent/teenagent.h
@@ -72,6 +72,8 @@ public:
bool processCallback(uint16 addr);
inline Scene *getScene() { return scene; }
+ bool showLogo(const Common::String &name);
+
static Common::String parseMessage(uint16 addr);
//event driven: