diff options
-rw-r--r-- | engines/teenagent/detection.cpp | 22 | ||||
-rw-r--r-- | engines/teenagent/pack.cpp | 6 | ||||
-rw-r--r-- | engines/teenagent/teenagent.cpp | 35 | ||||
-rw-r--r-- | engines/teenagent/teenagent.h | 1 |
4 files changed, 60 insertions, 4 deletions
diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp index e3c99a432c..258bd982ed 100644 --- a/engines/teenagent/detection.cpp +++ b/engines/teenagent/detection.cpp @@ -51,12 +51,32 @@ 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}, + //{"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, diff --git a/engines/teenagent/pack.cpp b/engines/teenagent/pack.cpp index fa57256b3b..e3b7a33960 100644 --- a/engines/teenagent/pack.cpp +++ b/engines/teenagent/pack.cpp @@ -41,7 +41,7 @@ void FilePack::close() { } 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 @@ bool TransientFilePack::open(const Common::String &filename) { _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 @@ void MemoryPack::close() { 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(); diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index d3e5fcecae..eb38e4820c 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -268,6 +268,39 @@ int TeenAgentEngine::skipEvents() const { 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 @@ Common::Error TeenAgentEngine::run() { if (load_slot >= 0) { loadGameState(load_slot); } else { + if (!showCDLogo()) + return Common::kNoError; if (!showLogo()) return Common::kNoError; if (!showMetropolis()) diff --git a/engines/teenagent/teenagent.h b/engines/teenagent/teenagent.h index 225439907f..dc195c0f4e 100644 --- a/engines/teenagent/teenagent.h +++ b/engines/teenagent/teenagent.h @@ -74,6 +74,7 @@ public: inline Scene *getScene() { return scene; } bool showLogo(); + bool showCDLogo(); bool showMetropolis(); int skipEvents() const; |