aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2016-01-14 23:29:34 +0200
committerFilippos Karapetis2016-01-14 23:41:35 +0200
commit46fdd5e7a48e0312c3fb523058f98e1d11f068e5 (patch)
tree6253216ff3b87ee62f7ff1c5e26fba0aa4045c13 /engines
parente8d1100fec554377d012da2d21eb88e19156274d (diff)
downloadscummvm-rg350-46fdd5e7a48e0312c3fb523058f98e1d11f068e5.tar.gz
scummvm-rg350-46fdd5e7a48e0312c3fb523058f98e1d11f068e5.tar.bz2
scummvm-rg350-46fdd5e7a48e0312c3fb523058f98e1d11f068e5.zip
LAB: Clean up the trial warning handling code
Diffstat (limited to 'engines')
-rw-r--r--engines/lab/engine.cpp39
-rw-r--r--engines/lab/lab.cpp35
-rw-r--r--engines/lab/lab.h3
3 files changed, 41 insertions, 36 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 3585134fde..b0b7d38e19 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -30,6 +30,8 @@
#include "common/config-manager.h"
+#include "gui/message.h"
+
#include "lab/lab.h"
#include "lab/anim.h"
#include "lab/dispman.h"
@@ -100,6 +102,40 @@ static char initColors[] = { '\x00', '\x00', '\x00', '\x30',
'\x24', '\x24', '\x2c', '\x2c',
'\x2c', '\x08', '\x08', '\x08' };
+void LabEngine::handleTrialWarning() {
+ // Check if this is the Wyrmkeep trial
+ Common::File roomFile;
+ bool knownVersion = true;
+ bool roomFileOpened = roomFile.open("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)
+ error("Unknown Windows version found, please report this version to the ScummVM team");
+}
+
uint16 LabEngine::getQuarters() {
return _inventory[kItemQuarter]._quantity;
}
@@ -1001,6 +1037,9 @@ void LabEngine::performAction(uint16 actionMode, Common::Point curPos, uint16 &c
}
void LabEngine::go() {
+ if (getPlatform() == Common::kPlatformWindows)
+ handleTrialWarning();
+
_isHiRes = ((getFeatures() & GF_LOWRES) == 0);
_graphics->setUpScreens();
diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp
index 048082cce6..4eb0e4db56 100644
--- a/engines/lab/lab.cpp
+++ b/engines/lab/lab.cpp
@@ -33,7 +33,6 @@
#include "common/error.h"
#include "engines/util.h"
-#include "gui/message.h"
#include "lab/lab.h"
@@ -172,40 +171,6 @@ Common::Error LabEngine::run() {
_console = new Console(this);
_journalBackImage = new Image(this);
- if (getPlatform() == Common::kPlatformWindows) {
- // Check if this is the Wyrmkeep trial
- Common::File roomFile;
- bool knownVersion = true;
- bool roomFileOpened = roomFile.open("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 c3a5d8bce8..3951f45127 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -487,7 +487,6 @@ private:
void processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonId, uint16 &actionMode);
void performAction(uint16 actionMode, Common::Point curPos, uint16 &curInv);
-private:
/**
* Writes the game out to disk.
*/
@@ -498,6 +497,8 @@ private:
*/
bool loadGame(int slot);
void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName);
+
+ void handleTrialWarning();
};
bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header);