diff options
-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; |