[Scummvm-cvs-logs] SF.net SVN: scummvm:[52525] scummvm/trunk/engines/hugo

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Sat Sep 4 18:02:16 CEST 2010


Revision: 52525
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52525&view=rev
Author:   strangerke
Date:     2010-09-04 16:02:16 +0000 (Sat, 04 Sep 2010)

Log Message:
-----------
HUGO: Fix decryption in H2 DOS, plus some cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/hugo/detection.cpp
    scummvm/trunk/engines/hugo/display.cpp
    scummvm/trunk/engines/hugo/hugo.cpp
    scummvm/trunk/engines/hugo/schedule.cpp
    scummvm/trunk/engines/hugo/schedule.h
    scummvm/trunk/engines/hugo/util.cpp

Modified: scummvm/trunk/engines/hugo/detection.cpp
===================================================================
--- scummvm/trunk/engines/hugo/detection.cpp	2010-09-04 15:38:24 UTC (rev 52524)
+++ scummvm/trunk/engines/hugo/detection.cpp	2010-09-04 16:02:16 UTC (rev 52525)
@@ -26,7 +26,6 @@
 #include "engines/advancedDetector.h"
 
 #include "hugo/hugo.h"
-#include "hugo/intro.h"
 
 namespace Hugo {
 
@@ -44,7 +43,6 @@
 	{"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 @@
 	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 @@
 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 @@
 
 	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

Modified: scummvm/trunk/engines/hugo/display.cpp
===================================================================
--- scummvm/trunk/engines/hugo/display.cpp	2010-09-04 15:38:24 UTC (rev 52524)
+++ scummvm/trunk/engines/hugo/display.cpp	2010-09-04 16:02:16 UTC (rev 52525)
@@ -406,7 +406,7 @@
 // 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);
 

Modified: scummvm/trunk/engines/hugo/hugo.cpp
===================================================================
--- scummvm/trunk/engines/hugo/hugo.cpp	2010-09-04 15:38:24 UTC (rev 52524)
+++ scummvm/trunk/engines/hugo/hugo.cpp	2010-09-04 16:02:16 UTC (rev 52525)
@@ -141,7 +141,6 @@
 	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 @@
 	_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;
 

Modified: scummvm/trunk/engines/hugo/schedule.cpp
===================================================================
--- scummvm/trunk/engines/hugo/schedule.cpp	2010-09-04 15:38:24 UTC (rev 52524)
+++ scummvm/trunk/engines/hugo/schedule.cpp	2010-09-04 16:02:16 UTC (rev 52525)
@@ -176,7 +176,7 @@
 // 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 @@
 	_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

Modified: scummvm/trunk/engines/hugo/schedule.h
===================================================================
--- scummvm/trunk/engines/hugo/schedule.h	2010-09-04 15:38:24 UTC (rev 52524)
+++ scummvm/trunk/engines/hugo/schedule.h	2010-09-04 16:02:16 UTC (rev 52525)
@@ -79,8 +79,26 @@
 	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
 
 #endif //HUGO_SCHEDULE_H

Modified: scummvm/trunk/engines/hugo/util.cpp
===================================================================
--- scummvm/trunk/engines/hugo/util.cpp	2010-09-04 15:38:24 UTC (rev 52524)
+++ scummvm/trunk/engines/hugo/util.cpp	2010-09-04 16:02:16 UTC (rev 52525)
@@ -135,7 +135,6 @@
 
 	switch (error_type) {
 	case FILE_ERR:
-//	case FONT_ERR:
 		strcpy(buffer, HugoEngine::get()._textUtil[kErr1]);
 		break;
 	case WRITE_ERR:
@@ -151,12 +150,6 @@
 	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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list