aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Boutonné2010-09-04 16:02:16 +0000
committerArnaud Boutonné2010-09-04 16:02:16 +0000
commita29ae442965bdef0b2a4a0e4df8638a37adcde82 (patch)
treecc11d4651504f7b4d15479171d3a7ba7b9a781a4
parent34195238bb6cc3ff1051230c4acbe3669f082e0e (diff)
downloadscummvm-rg350-a29ae442965bdef0b2a4a0e4df8638a37adcde82.tar.gz
scummvm-rg350-a29ae442965bdef0b2a4a0e4df8638a37adcde82.tar.bz2
scummvm-rg350-a29ae442965bdef0b2a4a0e4df8638a37adcde82.zip
HUGO: Fix decryption in H2 DOS, plus some cleanup
svn-id: r52525
-rw-r--r--engines/hugo/detection.cpp30
-rw-r--r--engines/hugo/display.cpp2
-rw-r--r--engines/hugo/hugo.cpp28
-rw-r--r--engines/hugo/schedule.cpp21
-rw-r--r--engines/hugo/schedule.h18
-rw-r--r--engines/hugo/util.cpp7
6 files changed, 68 insertions, 38 deletions
diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp
index 0967dcc07d..d19eee0041 100644
--- a/engines/hugo/detection.cpp
+++ b/engines/hugo/detection.cpp
@@ -26,7 +26,6 @@
#include "engines/advancedDetector.h"
#include "hugo/hugo.h"
-#include "hugo/intro.h"
namespace Hugo {
@@ -44,7 +43,6 @@ static const PlainGameDescriptor hugoGames[] = {
{"hugo1", "Hugo 1: Hugo's House of Horrors"},
{"hugo2", "Hugo 2: Hugo's Mystery Adventure"},
{"hugo3", "Hugo 3: Hugo's Amazon Adventure"},
-
{0, 0}
};
@@ -172,7 +170,6 @@ bool HugoMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGame
if (gd) {
*engine = new HugoEngine(syst, (const HugoGameDescription *)gd);
((HugoEngine *)*engine)->initGame((const HugoGameDescription *)gd);
- ((HugoEngine *)*engine)->initGamePart((const HugoGameDescription *)gd);
}
return gd != 0;
}
@@ -192,13 +189,11 @@ REGISTER_PLUGIN_STATIC(HUGO, PLUGIN_TYPE_ENGINE, Hugo::HugoMetaEngine);
namespace Hugo {
void HugoEngine::initGame(const HugoGameDescription *gd) {
+ char tmpStr[8];
+
_gameType = gd->gameType;
_platform = gd->desc.platform;
_packedFl = (getFeatures() & GF_PACKED);
-}
-
-void HugoEngine::initGamePart(const HugoGameDescription *gd) {
- char tmpStr[8];
_gameVariant = _gameType - 1 + ((_platform == Common::kPlatformWindows) ? 0 : 3);
//Generate filenames
@@ -209,27 +204,6 @@ void HugoEngine::initGamePart(const HugoGameDescription *gd) {
sprintf(_initFilename, "%s-00.SAV", tmpStr);
sprintf(_saveFilename, "%s-%s.SAV", tmpStr, "%d");
-
- switch (_gameVariant) {
- case 0:
- _introHandler = new intro_1w(*this);
- break;
- case 1:
- _introHandler = new intro_2w(*this);
- break;
- case 2:
- _introHandler = new intro_3w(*this);
- break;
- case 3:
- _introHandler = new intro_1d(*this);
- break;
- case 4:
- _introHandler = new intro_2d(*this);
- break;
- case 5:
- _introHandler = new intro_3d(*this);
- break;
- }
}
} // End of namespace Hugo
diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp
index 67359b59bf..ddd193c2a6 100644
--- a/engines/hugo/display.cpp
+++ b/engines/hugo/display.cpp
@@ -406,7 +406,7 @@ void Screen::shadowStr(int16 sx, int16 sy, char *s, byte color) {
// Load font file, construct font ptrs and reverse data bytes
void Screen::loadFont(int16 fontId) {
byte height, width;
- static bool fontLoadedFl[NUM_FONTS] = {0, 0, 0};
+ static bool fontLoadedFl[NUM_FONTS] = {false, false, false};
debugC(2, kDebugDisplay, "loadFont(%d)", fontId);
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index 32dd841929..58f4dc444e 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -141,7 +141,6 @@ Common::Error HugoEngine::run() {
initGraphics(320, 200, false);
_fileManager = new FileManager(*this);
- _scheduler = new Scheduler(*this);
_screen = new Screen(*this);
_mouseHandler = new MouseHandler(*this);
_inventoryHandler = new InventoryHandler(*this);
@@ -149,6 +148,33 @@ Common::Error HugoEngine::run() {
_route = new Route(*this);
_soundHandler = new SoundHandler(*this);
+ switch (_gameVariant) {
+ case 0:
+ _scheduler = new Scheduler_v2(*this);
+ _introHandler = new intro_1w(*this);
+ break;
+ case 1:
+ _scheduler = new Scheduler_v2(*this);
+ _introHandler = new intro_2w(*this);
+ break;
+ case 2:
+ _scheduler = new Scheduler_v2(*this);
+ _introHandler = new intro_3w(*this);
+ break;
+ case 3:
+ _scheduler = new Scheduler_v1(*this);
+ _introHandler = new intro_1d(*this);
+ break;
+ case 4:
+ _scheduler = new Scheduler_v1(*this);
+ _introHandler = new intro_2d(*this);
+ break;
+ case 5:
+ _scheduler = new Scheduler_v2(*this);
+ _introHandler = new intro_3d(*this);
+ break;
+ }
+
if (!loadHugoDat())
return Common::kUnknownError;
diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp
index 4be0cf6d85..296a723821 100644
--- a/engines/hugo/schedule.cpp
+++ b/engines/hugo/schedule.cpp
@@ -176,7 +176,7 @@ void Scheduler::decodeString(char *line) {
// Decode a string
debugC(1, kDebugSchedule, "decodeString(%s)", line);
- static char cypher[] = "Copyright 1992, Gray Design Associates";
+ const char *cypher = getCypher();
for (uint16 i = 0; i < strlen(line); i++)
line[i] -= cypher[i % strlen(cypher)];
@@ -675,4 +675,23 @@ void Scheduler::swapImages(int objNumb1, int objNumb2) {
_vm._objects[objNumb1].y += _vm._objects[objNumb2].currImagePtr->y2 - _vm._objects[objNumb1].currImagePtr->y2;
}
+Scheduler_v1::Scheduler_v1(HugoEngine &vm) : Scheduler(vm) {
+}
+
+Scheduler_v1::~Scheduler_v1() {
+}
+
+const char *Scheduler_v1::getCypher() {
+ return "Copyright 1991, Gray Design Associates";
+}
+
+Scheduler_v2::Scheduler_v2(HugoEngine &vm) : Scheduler(vm) {
+}
+
+Scheduler_v2::~Scheduler_v2() {
+}
+
+const char *Scheduler_v2::getCypher() {
+ return "Copyright 1992, Gray Design Associates";
+}
} // End of namespace Hugo
diff --git a/engines/hugo/schedule.h b/engines/hugo/schedule.h
index fa42cc03bf..046f3d04f3 100644
--- a/engines/hugo/schedule.h
+++ b/engines/hugo/schedule.h
@@ -79,6 +79,24 @@ private:
event_t *getQueue();
void delQueue(event_t *curEvent);
event_t *doAction(event_t *curEvent);
+
+ virtual const char* getCypher() = 0;
+};
+
+class Scheduler_v1 : public Scheduler {
+public:
+ Scheduler_v1(HugoEngine &vm);
+ ~Scheduler_v1();
+
+ const char *getCypher();
+};
+
+class Scheduler_v2 : public Scheduler {
+public:
+ Scheduler_v2(HugoEngine &vm);
+ ~Scheduler_v2();
+
+ const char *getCypher();
};
} // End of namespace Hugo
diff --git a/engines/hugo/util.cpp b/engines/hugo/util.cpp
index 31250dcf9f..8c63bedc04 100644
--- a/engines/hugo/util.cpp
+++ b/engines/hugo/util.cpp
@@ -135,7 +135,6 @@ void Utils::Error(int error_type, const char *format, ...) {
switch (error_type) {
case FILE_ERR:
-// case FONT_ERR:
strcpy(buffer, HugoEngine::get()._textUtil[kErr1]);
break;
case WRITE_ERR:
@@ -151,12 +150,6 @@ void Utils::Error(int error_type, const char *format, ...) {
case SOUND_ERR:
strcpy(buffer, HugoEngine::get()._textUtil[kErr5]);
break;
-// case TIMER_ERR:
-// strcpy(buffer, HugoEngine::get()._textUtil[kObsoleteErr1]);
-// break;
-// case VBX_ERR:
-// strcpy(buffer, HugoEngine::get()._textUtil[kObsoleteErr2]);
-// break;
default:
strcpy(buffer, HugoEngine::get()._textUtil[kErr6]);
break;