diff options
author | Filippos Karapetis | 2015-02-25 03:13:26 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2015-12-15 00:05:02 +0100 |
commit | 219811feaa9fcf23266d97423d013244280cf9f3 (patch) | |
tree | 7f5069e9280d39ab9377f31977abd5f0fab2f238 /engines | |
parent | 16df4305f4334845b52b0bbc999e4d6d04cdbbbb (diff) | |
download | scummvm-rg350-219811feaa9fcf23266d97423d013244280cf9f3.tar.gz scummvm-rg350-219811feaa9fcf23266d97423d013244280cf9f3.tar.bz2 scummvm-rg350-219811feaa9fcf23266d97423d013244280cf9f3.zip |
LAB: Add support for the Wyrmkeep Windows trial version
Only the trial part of this version can be played in ScummVM, since we
can't check for game payment status
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lab/detection.cpp | 2 | ||||
-rw-r--r-- | engines/lab/lab.cpp | 38 | ||||
-rw-r--r-- | engines/lab/lab.h | 6 | ||||
-rw-r--r-- | engines/lab/processroom.cpp | 36 | ||||
-rw-r--r-- | engines/lab/special.cpp | 13 |
5 files changed, 57 insertions, 38 deletions
diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index 2b1bb21205..1da269ecad 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -120,7 +120,7 @@ Common::Platform LabEngine::getPlatform() const { } uint32 LabEngine::getFeatures() const { - return _gameDescription->flags; + return _gameDescription->flags | _extraGameFeatures; } } // End of namespace Lab diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 563ccefa84..f1d0fe96c4 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -36,6 +36,8 @@ #include "engines/util.h" +#include "gui/message.h" + #include "lab/lab.h" #include "lab/labfun.h" @@ -46,7 +48,7 @@ namespace Lab { LabEngine *g_lab; LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) - : Engine(syst), _gameDescription(gameDesc) { + : Engine(syst), _gameDescription(gameDesc), _extraGameFeatures(0) { g_lab = this; } @@ -63,6 +65,40 @@ Common::Error LabEngine::run() { g_music = new Music(); + if (getPlatform() == Common::kPlatformWindows) { + // Check if this is the Wyrmkeep trial + Common::File roomFile; + bool knownVersion = true; + bool roomFileOpened = roomFile.open("game/rooms/48"); + + if (!roomFileOpened) + knownVersion = false; + else if (roomFile.size() != 892) + knownVersion = false; + else { + roomFile.seek(352); + byte checkByte = roomFile.readByte(); + if (checkByte == 0x00) { + // Full Windows version + } else if (checkByte == 0x80) { + // Wyrmkeep trial version + _extraGameFeatures = GF_WINDOWS_TRIAL; + + GUI::MessageDialog trialMessage("This is a trial Windows version of the game. To play the full version, you will need to use the original interpreter and purchase a key from Wyrmkeep"); + trialMessage.runModal(); + } else { + knownVersion = false; + } + + roomFile.close(); + + if (!knownVersion) { + warning("Unknown Windows version found, please report this version to the ScummVM team"); + return Common::kNoGameDataFoundError; + } + } + } + go(); return Common::kNoError; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index fa5edd6c24..b16b5981b3 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -41,7 +41,8 @@ struct ADGameDescription; namespace Lab { enum GameFeatures { - GF_LOWRES = 1 << 0 + GF_LOWRES = 1 << 0, + GF_WINDOWS_TRIAL = 1 << 1 }; class LabEngine : public Engine { @@ -60,6 +61,9 @@ public: Common::String generateSaveFileName(uint slot); LargeSet *_conditions, *_roomsFound; + +private: + uint32 _extraGameFeatures; }; extern LabEngine *g_lab; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 54d7605d15..27d480bf69 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -28,6 +28,8 @@ * */ +#include "gui/message.h" + #include "lab/lab.h" #include "lab/stddefines.h" #include "lab/labfun.h" @@ -40,10 +42,6 @@ namespace Lab { -#ifdef GAME_TRIAL -extern int g_IsRegistered; -#endif - /* Global parser data */ RoomData *Rooms; @@ -519,30 +517,16 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { } #endif -#if defined(GAME_TRIAL) - - if (APtr->Param1 & 0x8000) { // check registration if high-bit set - if (!g_IsRegistered) { - extern int trialCheckInGame(); - int result; - - // Time to pay up! - result = trialCheckInGame(); - - CurFileName = getPictName(LCPtr); - readPict(CurFileName, true); - - if (!g_IsRegistered) { - APtr = NULL; - continue; - } - } - - // fix-up data - APtr->Param1 &= 0x7fff; // clear high-bit + if (APtr->Param1 & 0x8000) { + // This is a Wyrmkeep Windows trial version, thus stop at this + // point, since we can't check for game payment status + readPict(getPictName(LCPtr), true); + APtr = NULL; + GUI::MessageDialog trialMessage("This is the end of the trial version. You can play the full game using the original interpreter from Wyrmkeep"); + trialMessage.runModal(); + continue; } -#endif RoomNum = APtr->Param1; Direction = APtr->Param2 - 1; *LCPtr = NULL; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 7d2212138b..74625a63f4 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -47,10 +47,6 @@ namespace Lab { -#ifdef GAME_TRIAL -int g_IsRegistered; -#endif - extern bool nopalchange, DoBlack, IsHiRes; extern BitMap *DispBitMap, *DrawBitMap; @@ -450,12 +446,11 @@ static void changeTile(uint16 col, uint16 row) { return; #endif -#if defined(GAME_TRIAL) - - if (!g_IsRegistered) + if (g_lab->getFeatures() & GF_WINDOWS_TRIAL) { + GUI::MessageDialog trialMessage("This puzzle is not available in the trial version of the game"); + trialMessage.runModal(); return; - -#endif + } check = true; row = 0; |