aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hugo/file.cpp45
-rw-r--r--engines/hugo/hugo.cpp30
-rw-r--r--engines/hugo/intro.cpp4
3 files changed, 49 insertions, 30 deletions
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index b0ef2d1988..5fd7bac05f 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -48,8 +48,8 @@
namespace Hugo {
namespace {
-static const char *s_bootCyper = "Copyright 1992, David P Gray, Gray Design Associates";
-static const int s_bootCyperLen = sizeof(s_bootCyper) - 1;
+static const char *s_bootCypher = "Copyright 1992, David P Gray, Gray Design Associates";
+static const int s_bootCypherLen = strlen(s_bootCypher) - 1;
}
@@ -533,12 +533,14 @@ void FileManager::printBootText() {
Common::File ofp;
if (!ofp.open(getBootFilename())) {
- if (_vm->_gameVariant == kGameVariantH1Dos) {
+ if (_vm->getPlatform() == Common::kPlatformPC) {
//TODO initialize properly _boot structure
- warning("printBootText - Skipping as H1 Dos may be a freeware");
+ warning("printBootText - Skipping as Dos versions may be a freeware or shareware");
return;
} else {
- error("Missing startup file '%s'", getBootFilename());
+ Utils::notifyBox(Common::String::format("Missing startup file '%s'", getBootFilename()));
+ _vm->getGameStatus().doQuitFl = true;
+ return;
}
}
@@ -547,13 +549,16 @@ void FileManager::printBootText() {
if (buf) {
// Skip over the boot structure (already read) and read exit text
ofp.seek((long)sizeof(_vm->_boot), SEEK_SET);
- if (ofp.read(buf, _vm->_boot.exit_len) != (size_t)_vm->_boot.exit_len)
- error("Error while reading startup file");
+ if (ofp.read(buf, _vm->_boot.exit_len) != (size_t)_vm->_boot.exit_len) {
+ Utils::notifyBox(Common::String::format("Error while reading startup file '%s'", getBootFilename()));
+ _vm->getGameStatus().doQuitFl = true;
+ return;
+ }
// Decrypt the exit text, using CRYPT substring
int i;
for (i = 0; i < _vm->_boot.exit_len; i++)
- buf[i] ^= s_bootCyper[i % s_bootCyperLen];
+ buf[i] ^= s_bootCypher[i % s_bootCypherLen];
buf[i] = '\0';
Utils::notifyBox(buf);
@@ -578,13 +583,23 @@ void FileManager::readBootFile() {
memset(_vm->_boot.distrib, '\0', sizeof(_vm->_boot.distrib));
_vm->_boot.registered = kRegFreeware;
return;
+ } else if (_vm->getPlatform() == Common::kPlatformPC) {
+ warning("readBootFile - Skipping as H2 and H3 Dos may be shareware");
+ memset(_vm->_boot.distrib, '\0', sizeof(_vm->_boot.distrib));
+ _vm->_boot.registered = kRegShareware;
+ return;
} else {
- error("Missing startup file '%s'", getBootFilename());
+ Utils::notifyBox(Common::String::format("Missing startup file '%s'", getBootFilename()));
+ _vm->getGameStatus().doQuitFl = true;
+ return;
}
}
- if (ofp.size() < (int32)sizeof(_vm->_boot))
- error("Corrupted startup file");
+ if (ofp.size() < (int32)sizeof(_vm->_boot)) {
+ Utils::notifyBox(Common::String::format("Corrupted startup file '%s'", getBootFilename()));
+ _vm->getGameStatus().doQuitFl = true;
+ return;
+ }
_vm->_boot.checksum = ofp.readByte();
_vm->_boot.registered = ofp.readByte();
@@ -597,12 +612,14 @@ void FileManager::readBootFile() {
byte checksum = 0;
for (uint32 i = 0; i < sizeof(_vm->_boot); i++) {
checksum ^= p[i];
- p[i] ^= s_bootCyper[i % s_bootCyperLen];
+ p[i] ^= s_bootCypher[i % s_bootCypherLen];
}
ofp.close();
- if (checksum)
- error("Corrupted startup file");
+ if (checksum) {
+ Utils::notifyBox(Common::String::format("Corrupted startup file '%s'", getBootFilename()));
+ _vm->getGameStatus().doQuitFl = true;
+ }
}
/**
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index 6ba9e8eaa8..ba87f58150 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -53,7 +53,7 @@ HugoEngine *HugoEngine::s_Engine = 0;
HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(syst), _gameDescription(gd),
_hero(0), _heroImage(0), _defltTunes(0), _numScreens(0), _tunesNbr(0), _soundSilence(0), _soundTest(0),
- _screenStates(0), _score(0), _maxscore(0), _lastTime(0), _curTime(0)
+ _screenStates(0), _score(0), _maxscore(0), _lastTime(0), _curTime(0), _episode(0)
{
_system = syst;
DebugMan.addDebugChannel(kDebugSchedule, "Schedule", "Script Schedule debug level");
@@ -252,19 +252,21 @@ Common::Error HugoEngine::run() {
initStatus(); // Initialize game status
initConfig(); // Initialize user's config
- initialize();
- resetConfig(); // Reset user's config
- initMachine();
-
- // Start the state machine
- _status.viewState = kViewIntroInit;
- _status.doQuitFl = false;
- int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot");
- if (loadSlot >= 0) {
- _status.skipIntroFl = true;
- _file->restoreGame(loadSlot);
- } else {
- _file->saveGame(0, "New Game");
+ if (!_status.doQuitFl) {
+ initialize();
+ resetConfig(); // Reset user's config
+ initMachine();
+
+ // Start the state machine
+ _status.viewState = kViewIntroInit;
+
+ int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot");
+ if (loadSlot >= 0) {
+ _status.skipIntroFl = true;
+ _file->restoreGame(loadSlot);
+ } else {
+ _file->saveGame(0, "New Game");
+ }
}
while (!_status.doQuitFl) {
diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp
index 7cd5a0fd17..63e81924c4 100644
--- a/engines/hugo/intro.cpp
+++ b/engines/hugo/intro.cpp
@@ -262,7 +262,7 @@ void intro_v2d::introInit() {
font.drawString(&surf, buffer, 0, 186, 320, _TLIGHTRED, Graphics::kTextAlignCenter);
- if (scumm_stricmp(_vm->_boot.distrib, "David P. Gray")) {
+ if ((*_vm->_boot.distrib != '\0') && (scumm_stricmp(_vm->_boot.distrib, "David P. Gray"))) {
// TROMAN, size 10-5
sprintf(buffer, "Distributed by %s.", _vm->_boot.distrib);
font.drawString(&surf, buffer, 0, 1, 320, _TLIGHTRED, Graphics::kTextAlignCenter);
@@ -307,7 +307,7 @@ void intro_v3d::introInit() {
font.drawString(&surf, buffer, 0, 190, 320, _TBROWN, Graphics::kTextAlignCenter);
- if (scumm_stricmp(_vm->_boot.distrib, "David P. Gray")) {
+ if ((*_vm->_boot.distrib != '\0') && (scumm_stricmp(_vm->_boot.distrib, "David P. Gray"))) {
sprintf(buffer, "Distributed by %s.", _vm->_boot.distrib);
font.drawString(&surf, buffer, 0, 0, 320, _TBROWN, Graphics::kTextAlignCenter);
}