[Scummvm-git-logs] scummvm master -> ba1329094c6cdba0ed30c8155d0d4f3476884d8e

yinsimei roseline.yin at gmail.com
Sun Apr 29 09:58:44 CEST 2018


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8b91fe536c SLUDGE: Remove global variable saveEncoding and refactor CustomSaveData features
4b271c6e7c SLUDGE: Remove global variable fadeMode and move transition functions to GraphicsManager
ba1329094c SLUDGE: Remove unused global variable dialogValue


Commit: 8b91fe536c072db4a88d797758d0b27e394f86bc
    https://github.com/scummvm/scummvm/commit/8b91fe536c072db4a88d797758d0b27e394f86bc
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2018-04-29T09:57:32+02:00

Commit Message:
SLUDGE: Remove global variable saveEncoding and refactor CustomSaveData features

Changed paths:
    engines/sludge/builtin.cpp
    engines/sludge/loadsave.cpp
    engines/sludge/savedata.cpp
    engines/sludge/savedata.h
    engines/sludge/sludger.cpp


diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index 42fcfcf..376849a 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -66,7 +66,6 @@ extern Common::String *allUserFunc;
 extern Common::String *allBIFNames;
 
 extern byte fadeMode;
-extern uint16 saveEncoding;
 
 int paramNum[] = { -1, 0, 1, 1, -1, -1, 1, 3, 4, 1, 0, 0, 8, -1,    // SAY->MOVEMOUSE
                    -1, 0, 0, -1, -1, 1, 1, 1, 1, 4, 1, 1, 2, 1,// FOCUS->REMOVEREGION
@@ -2246,7 +2245,7 @@ builtIn(saveCustomData) {
 		fatal("First parameter isn't a stack");
 		return BR_ERROR;
 	}
-	if (!stackToFile(fileName, fun->stack->thisVar))
+	if (!CustomSaveHelper::stackToFile(fileName, fun->stack->thisVar))
 		return BR_ERROR;
 	trimStack(fun->stack);
 	return BR_CONTINUE;
@@ -2271,7 +2270,7 @@ builtIn(loadCustomData) {
 	fun->reg.varData.theStack->first = NULL;
 	fun->reg.varData.theStack->last = NULL;
 	fun->reg.varData.theStack->timesUsed = 1;
-	if (!fileToStack(newText, fun->reg.varData.theStack))
+	if (!CustomSaveHelper::fileToStack(newText, fun->reg.varData.theStack))
 		return BR_ERROR;
 	return BR_CONTINUE;
 }
@@ -2281,7 +2280,7 @@ builtIn(setCustomEncoding) {
 	int n;
 	if (!getValueType(n, SVT_INT, fun->stack->thisVar))
 		return BR_ERROR;
-	saveEncoding = n;
+	CustomSaveHelper::_saveEncoding = n;
 	trimStack(fun->stack);
 	setVariable(fun->reg, SVT_INT, 1);
 	return BR_CONTINUE;
diff --git a/engines/sludge/loadsave.cpp b/engines/sludge/loadsave.cpp
index 65ea474..a962019 100644
--- a/engines/sludge/loadsave.cpp
+++ b/engines/sludge/loadsave.cpp
@@ -37,6 +37,7 @@
 #include "sludge/objtypes.h"
 #include "sludge/people.h"
 #include "sludge/region.h"
+#include "sludge/savedata.h"
 #include "sludge/sludge.h"
 #include "sludge/sludger.h"
 #include "sludge/sound.h"
@@ -62,7 +63,6 @@ extern Floor *currentFloor;                          // In floor.cpp
 extern FILETIME fileTime;                           // In sludger.cpp
 extern byte fadeMode;                      // In transition.cpp
 extern bool allowAnyFilename;
-extern uint16 saveEncoding;                 // in savedata.cpp
 
 //----------------------------------------------------------------------
 // Globals (so we know what's saved already and what's a reference
@@ -409,7 +409,7 @@ bool saveGame(const Common::String &fname) {
 	saveStatusBars(fp);
 	g_sludge->_soundMan->saveSounds(fp);
 
-	fp->writeUint16BE(saveEncoding);
+	fp->writeUint16BE(CustomSaveHelper::_saveEncoding);
 
 	blur_saveSettings(fp);
 
@@ -544,7 +544,7 @@ bool loadGame(const Common::String &fname) {
 	loadStatusBars(fp);
 	g_sludge->_soundMan->loadSounds(fp);
 
-	saveEncoding = fp->readUint16BE();
+	CustomSaveHelper::_saveEncoding = fp->readUint16BE();
 
 	if (ssgVersion >= VERSION(1, 6)) {
 		if (ssgVersion < VERSION(2, 0)) {
diff --git a/engines/sludge/savedata.cpp b/engines/sludge/savedata.cpp
index 9e2c923..687c913 100644
--- a/engines/sludge/savedata.cpp
+++ b/engines/sludge/savedata.cpp
@@ -20,44 +20,45 @@
  *
  */
 
-#include "common/file.h"
+#include "common/savefile.h"
 
 #include "sludge/allfiles.h"
 #include "sludge/moreio.h"
 #include "sludge/newfatal.h"
+#include "sludge/savedata.h"
 #include "sludge/variable.h"
 
 #define LOAD_ERROR "Can't load custom data...\n\n"
 
 namespace Sludge {
 
-const char UTF8_CHECKER[] = {'U', 'N', '\xef', '\xbf', '\xbd', 'L', 'O', '\xef', '\xbf', '\xbd', 'C', 'K', 'E', 'D', '\0'};
-uint16 saveEncoding = false;
-char encode1 = 0;
-char encode2 = 0;
+const char CustomSaveHelper::UTF8_CHECKER[] = {'U', 'N', '\xef', '\xbf', '\xbd', 'L', 'O', '\xef', '\xbf', '\xbd', 'C', 'K', 'E', 'D', '\0'};
+uint16 CustomSaveHelper::_saveEncoding = false;
+char CustomSaveHelper::_encode1 = 0;
+char CustomSaveHelper::_encode2 = 0;
 
-void writeStringEncoded(const Common::String &s, Common::WriteStream *stream) {
-	int len = s.size();
+void CustomSaveHelper::writeStringEncoded(const Common::String checker, Common::WriteStream *stream) {
+	int len = checker.size();
 
 	stream->writeUint16BE(len);
 	for (int a = 0; a < len; a++) {
-		stream->writeByte(s[a] ^ encode1);
-		encode1 += encode2;
+		stream->writeByte(checker[a] ^ _encode1);
+		_encode1 += _encode2;
 	}
 }
 
-Common::String readStringEncoded(Common::File *fp) {
+Common::String CustomSaveHelper::readStringEncoded(Common::SeekableReadStream *fp) {
 	int len = fp->readUint16BE();
 	Common::String res = "";
 
 	for (int a = 0; a < len; a++) {
-		res += (char)(fp->readByte() ^ encode1);
-		encode1 += encode2;
+		res += (char)(fp->readByte() ^ _encode1);
+		_encode1 += _encode2;
 	}
 	return res;
 }
 
-char *readTextPlain(Common::File *fp) {
+char *CustomSaveHelper::readTextPlain(Common::SeekableReadStream *fp) {
 	int32 startPos;
 
 	uint32 stringSize = 0;
@@ -94,83 +95,63 @@ char *readTextPlain(Common::File *fp) {
 	return reply;
 }
 
-bool fileToStack(const Common::String &filename, StackHandler *sH) {
-
+bool CustomSaveHelper::fileToStack(const Common::String &filename, StackHandler *sH) {
 	Variable stringVar;
 	stringVar.varType = SVT_NULL;
-	Common::String checker = saveEncoding ? "[Custom data (encoded)]\r\n" : "[Custom data (ASCII)]\n";
-
-	Common::File fd;
-
-	if (!fd.open(filename)) {
-#if 0
-		char currentDir[1000];
-		if (!getcwd(currentDir, 998)) {
-			debugOut("Can't get current directory.\n");
-		}
-
-		if (chdir(gamePath)) {
-			debugOut("Error: Failed changing to directory %s\n", gamePath);
-		}
+	Common::String checker = _saveEncoding ? "[Custom data (encoded)]\r\n" : "[Custom data (ASCII)]\n";
 
-		if (chdir(currentDir)) {
-			debugOut("Error: Failed changing to directory %s\n", currentDir);
-		}
+	Common::InSaveFile *fp = g_system->getSavefileManager()->openForLoading(filename);
 
-		if (!fd.open(filename)) {
-			return fatal("No such file", filename);
-		}
-#endif
+	if (fp == NULL) {
 		return fatal("No such file", filename); //TODO: false value
 	}
 
-	encode1 = (byte)saveEncoding & 255;
-	encode2 = (byte)(saveEncoding >> 8);
+	_encode1 = (byte)_saveEncoding & 255;
+	_encode2 = (byte)(_saveEncoding >> 8);
 
 	for (uint i = 0; i < checker.size(); ++i) {
-		if (fd.readByte() != checker[i]) {
-			fd.close();
+		if (fp->readByte() != checker[i]) {
+			delete fp;
 			return fatal(LOAD_ERROR "This isn't a SLUDGE custom data file:", filename);
 		}
 	}
 
-	if (saveEncoding) {
-		checker = readStringEncoded(&fd);
+	if (_saveEncoding) {
+		checker = readStringEncoded(fp);
 		if (checker == UTF8_CHECKER) {
-			fd.close();
-			return fatal(
-			LOAD_ERROR "The current file encoding setting does not match the encoding setting used when this file was created:", filename);
+			delete fp;
+			return fatal(LOAD_ERROR "The current file encoding setting does not match the encoding setting used when this file was created:", filename);
 		}
 	}
 
 	for (;;) {
-		if (saveEncoding) {
-			char i = fd.readByte() ^ encode1;
+		if (_saveEncoding) {
+			char i = fp->readByte() ^ _encode1;
 
-			if (fd.eos())
+			if (fp->eos())
 				break;
 			switch (i) {
 				case 0: {
-					Common::String g = readStringEncoded(&fd);
+					Common::String g = readStringEncoded(fp);
 					makeTextVar(stringVar, g);
 				}
 					break;
 
 				case 1:
-					setVariable(stringVar, SVT_INT, fd.readUint32LE());
+					setVariable(stringVar, SVT_INT, fp->readUint32LE());
 					break;
 
 				case 2:
-					setVariable(stringVar, SVT_INT, fd.readByte());
+					setVariable(stringVar, SVT_INT, fp->readByte());
 					break;
 
 				default:
 					fatal(LOAD_ERROR "Corrupt custom data file:", filename);
-					fd.close();
+					delete fp;
 					return false;
 			}
 		} else {
-			char *line = readTextPlain(&fd);
+			char *line = readTextPlain(fp);
 			if (!line)
 				break;
 			makeTextVar(stringVar, line);
@@ -188,63 +169,66 @@ bool fileToStack(const Common::String &filename, StackHandler *sH) {
 			sH->last = sH->last->next;
 		}
 	}
-	fd.close();
+
+	delete fp;
 
 	return true;
 }
 
-bool stackToFile(const Common::String &filename, const Variable &from) {
-#if 0
-	FILE *fp = fopen(filename, saveEncoding ? "wb" : "wt");
-	if (!fp) return fatal("Can't create file", filename);
+bool CustomSaveHelper::stackToFile(const Common::String &filename, const Variable &from) {
+	Common::OutSaveFile *fp = g_system->getSavefileManager()->openForSaving(filename);
+	if (fp == NULL) {
+		return fatal("Can't create file", filename);
+	}
 
 	VariableStack *hereWeAre = from.varData.theStack -> first;
 
-	encode1 = (byte)saveEncoding & 255;
-	encode2 = (byte)(saveEncoding >> 8);
+	_encode1 = (byte)_saveEncoding & 255;
+	_encode2 = (byte)(_saveEncoding >> 8);
 
-	if (saveEncoding) {
-		fprintf(fp, "[Custom data (encoded)]\r\n");
+	if (_saveEncoding) {
+		fp->writeString("[Custom data (encoded)]\r\n");
 		writeStringEncoded(UTF8_CHECKER, fp);
 	} else {
-		fprintf(fp, "[Custom data (ASCII)]\n");
+		fp->writeString("[Custom data (ASCII)]\n");
 	}
 
 	while (hereWeAre) {
-		if (saveEncoding) {
+		if (_saveEncoding) {
 			switch (hereWeAre -> thisVar.varType) {
 				case SVT_STRING:
-				fputc(encode1, fp);
-				writeStringEncoded(hereWeAre -> thisVar.varData.theString, fp);
-				break;
+					fp->writeByte(_encode1);
+					writeStringEncoded(hereWeAre -> thisVar.varData.theString, fp);
+					break;
 
 				case SVT_INT:
-				// Small enough to be stored as a char
-				if (hereWeAre -> thisVar.varData.intValue >= 0 && hereWeAre -> thisVar.varData.intValue < 256) {
-					fputc(2 ^ encode1, fp);
-					fputc(hereWeAre -> thisVar.varData.intValue, fp);
-				} else {
-					fputc(1 ^ encode1, fp);
-					fp->writeUint32LE(hereWeAre -> thisVar.varData.intValue);
-				}
-				break;
+					// Small enough to be stored as a char
+					if (hereWeAre -> thisVar.varData.intValue >= 0 && hereWeAre -> thisVar.varData.intValue < 256) {
+						fp->writeByte(2 ^ _encode1);
+						fp->writeByte(hereWeAre -> thisVar.varData.intValue);
+					} else {
+						fp->writeByte(1 ^ _encode1);
+						fp->writeUint32LE(hereWeAre -> thisVar.varData.intValue);
+					}
+					break;
 
 				default:
-				fatal("Can't create an encoded custom data file containing anything other than numbers and strings", filename);
-				fclose(fp);
-				return false;
+					fatal("Can't create an encoded custom data file containing anything other than numbers and strings", filename);
+					delete fp;
+					return false;
 			}
 		} else {
-			char *makeSureItsText = getTextFromAnyVar(hereWeAre -> thisVar);
-			if (makeSureItsText == NULL) break;
-			fprintf(fp, "%s\n", makeSureItsText);
-			delete makeSureItsText;
+			Common::String makeSureItsText = getTextFromAnyVar(hereWeAre -> thisVar);
+			if (makeSureItsText.empty())
+				break;
+			fp->writeString((makeSureItsText + "\n").c_str());
 		}
 
 		hereWeAre = hereWeAre -> next;
 	}
-	fclose(fp);
-#endif
+
+	delete fp;
+
 	return true;
 }
 
diff --git a/engines/sludge/savedata.h b/engines/sludge/savedata.h
index 956df93..90b093f 100644
--- a/engines/sludge/savedata.h
+++ b/engines/sludge/savedata.h
@@ -24,8 +24,26 @@
 
 namespace Sludge {
 
-bool fileToStack(const Common::String &filename, StackHandler *sH);
-bool stackToFile(const Common::String &filename, const Variable &from);
+struct StackHandler;
+struct Variable;
+
+class CustomSaveHelper {
+public:
+	static bool fileToStack(const Common::String &filename, StackHandler *sH);
+	static bool stackToFile(const Common::String &filename, const Variable &from);
+
+	static uint16 _saveEncoding;
+
+private:
+	static const char UTF8_CHECKER[];
+	static char _encode1;
+	static char _encode2;
+
+	static void writeStringEncoded(const Common::String checker, Common::WriteStream *stream);
+	static Common::String readStringEncoded(Common::SeekableReadStream *fp);
+	static char *readTextPlain(Common::SeekableReadStream *fp);
+
+};
 
 } // End of namespace Sludge
 
diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp
index f616fe6..64727df 100644
--- a/engines/sludge/sludger.cpp
+++ b/engines/sludge/sludger.cpp
@@ -41,6 +41,7 @@
 #include "sludge/objtypes.h"
 #include "sludge/people.h"
 #include "sludge/region.h"
+#include "sludge/savedata.h"
 #include "sludge/statusba.h"
 #include "sludge/sprites.h"
 #include "sludge/sprbanks.h"
@@ -83,7 +84,6 @@ extern int lastFramesPerSecond;
 
 extern bool allowAnyFilename;
 extern byte fadeMode;
-extern uint16 saveEncoding;
 
 const char *sludgeText[] = { "?????", "RETURN", "BRANCH", "BR_ZERO",
 		"SET_GLOBAL", "SET_LOCAL", "LOAD_GLOBAL", "LOAD_LOCAL", "PLUS", "MINUS",
@@ -162,6 +162,8 @@ void initSludge() {
 		g_sludge->_soundMan->initSoundStuff();
 	}
 
+	CustomSaveHelper::_saveEncoding = false;
+
 	// global variables
 	numGlobals = 0;
 	launchResult = nullptr;
@@ -173,7 +175,6 @@ void initSludge() {
 	allUserFunc = allBIFNames = nullptr;
 	brightnessLevel = 255;
 	fadeMode = 2;
-	saveEncoding = false;
 }
 
 void killSludge() {


Commit: 4b271c6e7cb70313c498cbf6b9f888f95b77d918
    https://github.com/scummvm/scummvm/commit/4b271c6e7cb70313c498cbf6b9f888f95b77d918
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2018-04-29T09:57:32+02:00

Commit Message:
SLUDGE: Remove global variable fadeMode and move transition functions to GraphicsManager

Changed paths:
  R engines/sludge/transition.h
    engines/sludge/backdrop.cpp
    engines/sludge/builtin.cpp
    engines/sludge/graphics.cpp
    engines/sludge/graphics.h
    engines/sludge/loadsave.cpp
    engines/sludge/main_loop.cpp
    engines/sludge/sludger.cpp
    engines/sludge/transition.cpp


diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index 1c618c7..04f4847 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -422,6 +422,7 @@ void GraphicsManager::saveLightMap(Common::WriteStream *stream) {
 		stream->writeByte(0);
 	}
 	stream->writeByte(_lightMapMode);
+	stream->writeByte(_fadeMode);
 }
 
 bool GraphicsManager::loadLightMap(int ssgVersion, Common::SeekableReadStream *stream) {
@@ -434,6 +435,8 @@ bool GraphicsManager::loadLightMap(int ssgVersion, Common::SeekableReadStream *s
 		_lightMapMode = stream->readByte() % 3;
 	}
 
+	_fadeMode = stream->readByte();
+
 	return true;
 }
 
diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index 376849a..4ea9cad 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -65,8 +65,6 @@ extern int numBIFNames, numUserFunc;
 extern Common::String *allUserFunc;
 extern Common::String *allBIFNames;
 
-extern byte fadeMode;
-
 int paramNum[] = { -1, 0, 1, 1, -1, -1, 1, 3, 4, 1, 0, 0, 8, -1,    // SAY->MOVEMOUSE
                    -1, 0, 0, -1, -1, 1, 1, 1, 1, 4, 1, 1, 2, 1,// FOCUS->REMOVEREGION
                    2, 2, 0, 0, 2,                              // ANIMATE->SETSCALE
@@ -2202,7 +2200,7 @@ builtIn(transitionMode) {
 	int n;
 	if (!getValueType(n, SVT_INT, fun->stack->thisVar))
 		return BR_ERROR;
-	fadeMode = n;
+	g_sludge->_gfxMan->setFadeMode(n);
 	trimStack(fun->stack);
 	setVariable(fun->reg, SVT_INT, 1);
 	return BR_CONTINUE;
diff --git a/engines/sludge/graphics.cpp b/engines/sludge/graphics.cpp
index 580124f..72301b3 100644
--- a/engines/sludge/graphics.cpp
+++ b/engines/sludge/graphics.cpp
@@ -87,6 +87,11 @@ void GraphicsManager::init() {
 	// Thumbnail
 	_thumbWidth = 0;
 	_thumbHeight = 0;
+
+	// Transition
+	resetRandW();
+	_brightnessLevel = 255;
+	_fadeMode = 2;
 }
 
 void GraphicsManager::kill() {
@@ -161,6 +166,8 @@ bool GraphicsManager::initGfx() {
 void GraphicsManager::display() {
 	g_system->copyRectToScreen((byte *)_renderSurface.getPixels(), _renderSurface.pitch, 0, 0, _renderSurface.w, _renderSurface.h);
 	g_system->updateScreen();
+	if (_brightnessLevel < 255)
+		fixBrightness();
 }
 
 void GraphicsManager::clear() {
diff --git a/engines/sludge/graphics.h b/engines/sludge/graphics.h
index f7ed7d0..8bc47cd 100644
--- a/engines/sludge/graphics.h
+++ b/engines/sludge/graphics.h
@@ -172,6 +172,9 @@ public:
 
 	// Transition
 	void setBrightnessLevel(int brightnessLevel);
+	void setFadeMode(int fadeMode) { _fadeMode = fadeMode; };
+	void fixBrightness();
+	void resetRandW();
 
 private:
 	SludgeEngine *_vm;
@@ -230,6 +233,7 @@ private:
 
 	// Transition
 	byte _brightnessLevel;
+	byte _fadeMode;
 };
 
 } // End of namespace Sludge
diff --git a/engines/sludge/loadsave.cpp b/engines/sludge/loadsave.cpp
index a962019..f1dfb6c 100644
--- a/engines/sludge/loadsave.cpp
+++ b/engines/sludge/loadsave.cpp
@@ -61,7 +61,6 @@ extern int numGlobals;                              // In sludger.cpp
 extern Variable *globalVars;                        // In sludger.cpp
 extern Floor *currentFloor;                          // In floor.cpp
 extern FILETIME fileTime;                           // In sludger.cpp
-extern byte fadeMode;                      // In transition.cpp
 extern bool allowAnyFilename;
 
 //----------------------------------------------------------------------
@@ -403,8 +402,6 @@ bool saveGame(const Common::String &fname) {
 	g_sludge->_gfxMan->saveZBuffer(fp);
 	g_sludge->_gfxMan->saveLightMap(fp);
 
-	fp->writeByte(fadeMode);
-
 	g_sludge->_speechMan->save(fp);
 	saveStatusBars(fp);
 	g_sludge->_soundMan->saveSounds(fp);
@@ -539,7 +536,6 @@ bool loadGame(const Common::String &fname) {
 		return false;
 	}
 
-	fadeMode = fp->readByte();
 	g_sludge->_speechMan->load(fp);
 	loadStatusBars(fp);
 	g_sludge->_soundMan->loadSounds(fp);
diff --git a/engines/sludge/main_loop.cpp b/engines/sludge/main_loop.cpp
index eac8610..6341c3e 100644
--- a/engines/sludge/main_loop.cpp
+++ b/engines/sludge/main_loop.cpp
@@ -39,7 +39,6 @@
 #include "sludge/sludge.h"
 #include "sludge/sludger.h"
 #include "sludge/speech.h"
-#include "sludge/transition.h"
 #include "sludge/timing.h"
 
 namespace Sludge {
diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp
index 64727df..e363ab6 100644
--- a/engines/sludge/sludger.cpp
+++ b/engines/sludge/sludger.cpp
@@ -49,7 +49,6 @@
 #include "sludge/sludge.h"
 #include "sludge/sludger.h"
 #include "sludge/speech.h"
-#include "sludge/transition.h"
 #include "sludge/variable.h"
 #include "sludge/version.h"
 #include "sludge/zbuffer.h"
@@ -69,8 +68,6 @@ int selectedLanguage = 0;
 int gameVersion;
 FILETIME fileTime;
 
-byte brightnessLevel = 255;
-
 extern LoadedFunction *saverFunc;
 
 LoadedFunction *allRunningFunctions = NULL;
@@ -83,7 +80,6 @@ extern Variable *launchResult;
 extern int lastFramesPerSecond;
 
 extern bool allowAnyFilename;
-extern byte fadeMode;
 
 const char *sludgeText[] = { "?????", "RETURN", "BRANCH", "BR_ZERO",
 		"SET_GLOBAL", "SET_LOCAL", "LOAD_GLOBAL", "LOAD_LOCAL", "PLUS", "MINUS",
@@ -152,7 +148,6 @@ void initSludge() {
 	g_sludge->_objMan->init();
 	g_sludge->_speechMan->init();
 	initStatusBar();
-	resetRandW();
 	g_sludge->_evtMan->init();
 	g_sludge->_txtMan->init();
 	g_sludge->_cursorMan->init();
@@ -173,8 +168,6 @@ void initSludge() {
 	noStack = nullptr;
 	numBIFNames = numUserFunc = 0;
 	allUserFunc = allBIFNames = nullptr;
-	brightnessLevel = 255;
-	fadeMode = 2;
 }
 
 void killSludge() {
@@ -340,7 +333,6 @@ void sludgeDisplay() {
 	drawStatusBar();
 	g_sludge->_cursorMan->displayCursor();
 	g_sludge->_gfxMan->display();
-	if (brightnessLevel < 255) fixBrightness();// This is for transitionLevel special effects
 }
 
 void pauseFunction(LoadedFunction *fun) {
diff --git a/engines/sludge/transition.cpp b/engines/sludge/transition.cpp
index ddefbe9..35f650e 100644
--- a/engines/sludge/transition.cpp
+++ b/engines/sludge/transition.cpp
@@ -29,8 +29,6 @@ namespace Sludge {
 
 extern float snapTexW, snapTexH;
 
-byte fadeMode = 2;
-
 void GraphicsManager::setBrightnessLevel(int brightnessLevel)
 {
 	if (brightnessLevel < 0)
@@ -151,7 +149,7 @@ void transitionSnapshotBox() {
 uint32 randbuffer[KK][2];  // history buffer
 int p1, p2;
 
-void resetRandW() {
+void GraphicsManager::resetRandW() {
 	int32 seed = 12345;
 
 	for (int i = 0; i < KK; i++) {
@@ -382,8 +380,8 @@ void transitionBlinds() {
 
 //----------------------------------------------------
 
-void fixBrightness() {
-	switch (fadeMode) {
+void GraphicsManager::fixBrightness() {
+	switch (_fadeMode) {
 		case 0:
 			transitionFader();
 			break;
diff --git a/engines/sludge/transition.h b/engines/sludge/transition.h
deleted file mode 100644
index 5ce5568..0000000
--- a/engines/sludge/transition.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-#ifndef SLUDGE_TRANSITION_H
-#define SLUDGE_TRANSITION_H
-
-namespace Sludge {
-
-void fixBrightness();
-void resetRandW();
-
-} // End of namespace Sludge
-
-#endif


Commit: ba1329094c6cdba0ed30c8155d0d4f3476884d8e
    https://github.com/scummvm/scummvm/commit/ba1329094c6cdba0ed30c8155d0d4f3476884d8e
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2018-04-29T09:57:32+02:00

Commit Message:
SLUDGE: Remove unused global variable dialogValue

Changed paths:
    engines/sludge/main_loop.cpp
    engines/sludge/sludger.cpp


diff --git a/engines/sludge/main_loop.cpp b/engines/sludge/main_loop.cpp
index 6341c3e..10f54d4 100644
--- a/engines/sludge/main_loop.cpp
+++ b/engines/sludge/main_loop.cpp
@@ -45,8 +45,6 @@ namespace Sludge {
 
 extern VariableStack *noStack;
 
-int dialogValue = 0;
-
 int main_loop(Common::String filename) {
 
 	if (!initSludge(filename)) {
diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp
index e363ab6..5f22acb 100644
--- a/engines/sludge/sludger.cpp
+++ b/engines/sludge/sludger.cpp
@@ -55,8 +55,6 @@
 
 namespace Sludge {
 
-extern int dialogValue;
-
 int numBIFNames = 0;
 Common::String *allBIFNames;
 int numUserFunc = 0;
@@ -604,8 +602,6 @@ bool continueFunction(LoadedFunction *fun) {
 			break;
 
 		case SLU_UNREG:
-			if (dialogValue != 1)
-				fatal(ERROR_HACKER);
 			break;
 
 		case SLU_LOAD_STRING:





More information about the Scummvm-git-logs mailing list