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

yinsimei roseline.yin at gmail.com
Thu Jul 13 23:29:59 CEST 2017


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

Summary:
b60aa5eae7 SLUDGE: fix warnings
cce0aace8b SLUDGE: get random number


Commit: b60aa5eae76c049d301ed6a6727ac2f558a4e821
    https://github.com/scummvm/scummvm/commit/b60aa5eae76c049d301ed6a6727ac2f558a4e821
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-07-13T23:29:26+02:00

Commit Message:
SLUDGE: fix warnings

Changed paths:
    engines/sludge/backdrop.cpp
    engines/sludge/builtin.cpp
    engines/sludge/fileset.cpp
    engines/sludge/fileset.h
    engines/sludge/graphics.cpp
    engines/sludge/newfatal.cpp
    engines/sludge/newfatal.h
    engines/sludge/sludger.cpp
    engines/sludge/sprites.cpp
    engines/sludge/statusba.cpp
    engines/sludge/statusba.h
    engines/sludge/variable.cpp


diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index 82260b9..8e2916e 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -151,10 +151,9 @@ bool restoreSnapshot(Common::SeekableReadStream *stream) {
 
 	if ((picWidth != winWidth) || (picHeight != winHeight))
 		return false;
-
+#if 0
 	uint t1, t2, n;
 	uint16 c;
-#if 0
 	GLubyte *target;
 	if (!NPOT_textures) {
 		picWidth = getNextPOT(picWidth);
@@ -164,7 +163,6 @@ bool restoreSnapshot(Common::SeekableReadStream *stream) {
 	}
 	GLubyte *snapshotTexture = new GLubyte [picHeight * picWidth * 4];
 	if (!snapshotTexture) return fatal("Out of memory while restoring snapshot.");
-#endif
 
 	for (t2 = 0; t2 < winHeight; t2++) {
 		t1 = 0;
@@ -176,7 +174,7 @@ bool restoreSnapshot(Common::SeekableReadStream *stream) {
 			} else {
 				n = 1;
 			}
-#if 0
+
 			while (n --) {
 				target = snapshotTexture + 4 * picWidth * t2 + t1 * 4;
 				target[0] = (GLubyte) redValue(c);
@@ -185,10 +183,9 @@ bool restoreSnapshot(Common::SeekableReadStream *stream) {
 				target[3] = (GLubyte) 255;
 				t1++;
 			}
-#endif
 		}
 	}
-#if 0
+
 	if (!snapshotTextureName) glGenTextures(1, &snapshotTextureName);
 	glBindTexture(GL_TEXTURE_2D, snapshotTextureName);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@@ -251,9 +248,10 @@ bool reserveBackdrop() {
 	input.mouseX = (int)((float)input.mouseX / cameraZoom);
 	input.mouseY = (int)((float)input.mouseY / cameraZoom);
 	setPixelCoords(false);
+#if 0
 	int picWidth = sceneWidth;
 	int picHeight = sceneHeight;
-#if 0
+
 	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
 
 	if (backdropTexture) delete backdropTexture;
@@ -398,7 +396,7 @@ void blankScreen(int x1, int y1, int x2, int y2) {
 }
 
 void hardScroll(int distance) {
-	if (ABS(distance) >= sceneHeight) {
+	if (ABS(distance) >= (int)sceneHeight) {
 		blankScreen(0, 0, sceneWidth, sceneHeight);
 		return;
 	}
@@ -571,6 +569,7 @@ bool loadLightMap(int v) {
 	if (!ImgLoader::loadImage(bigDataFile, &lightMap))
 		return false;
 
+#if 0
 	int newPicWidth = lightMap.w;
 	int newPicHeight = lightMap.h;
 
@@ -580,7 +579,6 @@ bool loadLightMap(int v) {
 		}
 	}
 
-#if 0
 	if (!NPOT_textures) {
 		newPicWidth = getNextPOT(lightMap.w);
 		newPicHeight = getNextPOT(lightMap.h);
@@ -590,9 +588,7 @@ bool loadLightMap(int v) {
 		lightMap.texW = 1.0;
 		lightMap.texH = 1.0;
 	}
-#endif
 
-#if 0
 	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
 #endif
 #if 0
@@ -667,6 +663,7 @@ bool loadParallax(uint16 v, uint16 fracX, uint16 fracY) {
 	}
 	nP->prev = NULL;
 
+#if 0
 	int picWidth;
 	int picHeight;
 
@@ -702,7 +699,6 @@ bool loadParallax(uint16 v, uint16 fracX, uint16 fracY) {
 		nP->wrapT = true;
 	}
 
-#if 0
 	glGenTextures(1, &nP->textureName);
 	glBindTexture(GL_TEXTURE_2D, nP->textureName);
 	if (nP->wrapS)
@@ -861,8 +857,8 @@ bool loadHSI(Common::SeekableReadStream *stream, int x, int y, bool reserve) {
 	if (!ImgLoader::loadImage(stream, &backdropSurface, (int)reserve))
 		return false;
 
-	int realPicWidth = backdropSurface.w;
-	int realPicHeight = backdropSurface.h;
+	uint realPicWidth = backdropSurface.w;
+	uint realPicHeight = backdropSurface.h;
 
 	if (reserve) { // resize backdrop
 		if (!resizeBackdrop(realPicWidth, realPicHeight))
@@ -896,8 +892,8 @@ bool mixHSI(Common::SeekableReadStream *stream, int x, int y) {
 	if (!ImgLoader::loadImage(stream, &mixSurface, 0))
 		return false;
 
-	int realPicWidth = mixSurface.w;
-	int realPicHeight = mixSurface.h;
+	uint realPicWidth = mixSurface.w;
+	uint realPicHeight = mixSurface.h;
 
 	if (x == IN_THE_CENTRE)
 		x = (sceneWidth - realPicWidth) >> 1;
diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index e2ebb1f..ee13049 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -120,7 +120,7 @@ bool failSecurityCheck(const Common::String &fn) {
 	if (fn.empty())
 		return true;
 
-	for (int i = 0; i < fn.size(); ++i) {
+	for (uint i = 0; i < fn.size(); ++i) {
 		switch (fn[i]) {
 			case ':':
 			case '\\':
@@ -1077,9 +1077,8 @@ builtIn(playMovie) {
 
 builtIn(stopMovie) {
 	UNUSEDALL
-	int r;
 
-	r = stopMovie();
+	stopMovie();
 
 	setVariable(fun->reg, SVT_INT, 0);
 	return BR_CONTINUE;
@@ -1087,9 +1086,8 @@ builtIn(stopMovie) {
 
 builtIn(pauseMovie) {
 	UNUSEDALL
-	int r;
 
-	r = pauseMovie();
+	pauseMovie();
 
 	setVariable(fun->reg, SVT_INT, 0);
 	return BR_CONTINUE;
@@ -2509,7 +2507,7 @@ builtIn(setThumbnailSize) {
 	if (!getValueType(thumbWidth, SVT_INT, fun->stack->thisVar))
 		return BR_ERROR;
 	trimStack(fun->stack);
-	if (thumbWidth < 0 || thumbHeight < 0 || thumbWidth > winWidth || thumbHeight > winHeight) {
+	if (thumbWidth < 0 || thumbHeight < 0 || thumbWidth > (int)winWidth || thumbHeight > (int)winHeight) {
 		Common::String buff = thumbWidth + " x " + thumbHeight;
 		fatal("Invalid thumbnail size", buff);
 		return BR_ERROR;
diff --git a/engines/sludge/fileset.cpp b/engines/sludge/fileset.cpp
index 90fe451..058ae15 100644
--- a/engines/sludge/fileset.cpp
+++ b/engines/sludge/fileset.cpp
@@ -189,7 +189,7 @@ void finishAccess() {
 
 int32 startIndex;
 
-void setFileIndices(Common::File *fp, int numLanguages, uint skipBefore) {
+void setFileIndices(Common::File *fp, uint numLanguages, uint skipBefore) {
 	if (fp) {
 		// Keep hold of the file handle, and let things get at it
 		bigDataFile = fp;
diff --git a/engines/sludge/fileset.h b/engines/sludge/fileset.h
index 3a19ea5..3e9385d 100644
--- a/engines/sludge/fileset.h
+++ b/engines/sludge/fileset.h
@@ -28,7 +28,7 @@ namespace Sludge {
 
 extern Common::File *bigDataFile;
 
-void setFileIndices(Common::File *fp, int, uint);
+void setFileIndices(Common::File *fp, uint, uint);
 
 uint openFileFromNum(int num);
 bool openSubSlice(int num);
diff --git a/engines/sludge/graphics.cpp b/engines/sludge/graphics.cpp
index 4a6d9b8..d43ae4e 100644
--- a/engines/sludge/graphics.cpp
+++ b/engines/sludge/graphics.cpp
@@ -49,10 +49,11 @@ extern int lightMapNumber;
 
 // This is for swapping settings between rendering to texture or to the screen
 void setPixelCoords(bool pixels) {
+#if 0
 	static int current = -1;
 //	if (current == pixels) return;
 	current = pixels;
-#if 0
+
 	glBindTexture(GL_TEXTURE_2D, backdropTextureName);
 
 	if (pixels) {
diff --git a/engines/sludge/newfatal.cpp b/engines/sludge/newfatal.cpp
index 925aeab..f224256 100644
--- a/engines/sludge/newfatal.cpp
+++ b/engines/sludge/newfatal.cpp
@@ -38,7 +38,7 @@ extern Common::String *allResourceNames /*= ""*/;
 
 int resourceForFatal = -1;
 
-const Common::String &resourceNameFromNum(int i) {
+const Common::String resourceNameFromNum(int i) {
 	if (i == -1)
 		return NULL;
 	if (numResourceNames == 0)
diff --git a/engines/sludge/newfatal.h b/engines/sludge/newfatal.h
index c26579a..f7e53a7 100644
--- a/engines/sludge/newfatal.h
+++ b/engines/sludge/newfatal.h
@@ -37,7 +37,7 @@ void displayFatal();
 void registerWindowForFatal();
 void setFatalInfo(const Common::String &userFunc, const Common::String &BIF);
 void setResourceForFatal(int n);
-const Common::String &resourceNameFromNum(int i);
+const Common::String resourceNameFromNum(int i);
 
 } // End of namespace Sludge
 
diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp
index 7174fe2..d84688e 100644
--- a/engines/sludge/sludger.cpp
+++ b/engines/sludge/sludger.cpp
@@ -895,20 +895,20 @@ bool continueFunction(loadedFunction *fun) {
 					if (!grab) {
 						setVariable(fun->reg, SVT_NULL, 0);
 					} else {
-						int ii;
+						int kk;
 						switch (com) {
 						case SLU_INCREMENT_INDEX:
-							if (!getValueType(ii, SVT_INT, *grab))
+							if (!getValueType(kk, SVT_INT, *grab))
 								return false;
-							setVariable(fun->reg, SVT_INT, ii);
-							grab->varData.intValue = ii + 1;
+							setVariable(fun->reg, SVT_INT, kk);
+							grab->varData.intValue = kk + 1;
 							break;
 
 						case SLU_DECREMENT_INDEX:
-							if (!getValueType(ii, SVT_INT, *grab))
+							if (!getValueType(kk, SVT_INT, *grab))
 								return false;
-							setVariable(fun->reg, SVT_INT, ii);
-							grab->varData.intValue = ii - 1;
+							setVariable(fun->reg, SVT_INT, kk);
+							grab->varData.intValue = kk - 1;
 							break;
 
 						default:
diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index 43bc590..6225785 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -178,7 +178,7 @@ bool loadSpriteBank(int fileNum, spriteBank &loadhere, bool isFont) {
 
 	// version 0, 1, 2
 	for (int i = 0; i < total; i++) {
-		int picwidth, picheight;
+		uint picwidth, picheight;
 		// load sprite width, height, relative position
 		if (spriteBankVersion == 2) {
 			picwidth = bigDataFile->readUint16BE();
@@ -205,8 +205,8 @@ bool loadSpriteBank(int fileNum, spriteBank &loadhere, bool isFont) {
 
 		// read color
 		if (spriteBankVersion == 2) { // RUN LENGTH COMPRESSED DATA
-			unsigned size = picwidth * picheight;
-			unsigned pip = 0;
+			uint size = picwidth * picheight;
+			uint pip = 0;
 
 			while (pip < size) {
 				byte col = bigDataFile->readByte();
diff --git a/engines/sludge/statusba.cpp b/engines/sludge/statusba.cpp
index de434ae..6bebb0d 100644
--- a/engines/sludge/statusba.cpp
+++ b/engines/sludge/statusba.cpp
@@ -163,7 +163,7 @@ void initStatusBar() {
 	statusBarLitColour(255, 255, 128);
 }
 
-const Common::String &statusBarText() {
+const Common::String statusBarText() {
 	if (nowStatus->firstStatusBar) {
 		return nowStatus->firstStatusBar->text;
 	} else {
diff --git a/engines/sludge/statusba.h b/engines/sludge/statusba.h
index 4de04fb..96404fc 100644
--- a/engines/sludge/statusba.h
+++ b/engines/sludge/statusba.h
@@ -49,7 +49,7 @@ void killLastStatus();
 void statusBarColour(byte r, byte g, byte b);
 void statusBarLitColour(byte r, byte g, byte b);
 void setLitStatus(int i);
-const Common::String &statusBarText();
+const Common::String statusBarText();
 void positionStatus(int, int);
 void drawStatusBar();
 
diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp
index d47e0b4..2b0d15f 100644
--- a/engines/sludge/variable.cpp
+++ b/engines/sludge/variable.cpp
@@ -141,12 +141,13 @@ int stackSize(const stackHandler *me) {
 }
 
 bool getSavedGamesStack(stackHandler *sH, const Common::String &ext) {
+#if 0
 	Common::String pattern = "*";
 	pattern += ext;
 
 	variable newName;
 	newName.varType = SVT_NULL;
-#if 0
+
 	DIR *dir = opendir(".");
 	if (!dir)
 		return false;
@@ -411,7 +412,7 @@ bool copyVariable(const variable &from, variable &to) {
 }
 
 variable *fastArrayGetByIndex(fastArrayHandler *vS, uint theIndex) {
-	if (theIndex < 0 || theIndex >= vS->size)
+	if ((int)theIndex >= vS->size)
 		return NULL;
 	return &vS->fastVariables[theIndex];
 }


Commit: cce0aace8b7f2d5c1c1ba18307d6b5ebabbeced5
    https://github.com/scummvm/scummvm/commit/cce0aace8b7f2d5c1c1ba18307d6b5ebabbeced5
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-07-13T23:29:26+02:00

Commit Message:
SLUDGE: get random number

Changed paths:
    engines/sludge/builtin.cpp
    engines/sludge/sludge.h


diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index ee13049..56db190 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -511,9 +511,8 @@ builtIn(pickOne) {
 	}
 
 	int i;
-#if 0
-	i = rand() % numParams;
-#endif
+
+	i = g_sludge->getRandomSource()->getRandomNumber(numParams - 1);
 
 	// Return value
 	while (numParams--) {
diff --git a/engines/sludge/sludge.h b/engines/sludge/sludge.h
index cb3d524..e419b85 100644
--- a/engines/sludge/sludge.h
+++ b/engines/sludge/sludge.h
@@ -71,6 +71,7 @@ public:
 	Common::Language getLanguage() const;
 	Graphics::PixelFormat *getScreenPixelFormat() const;
 	Graphics::PixelFormat *getOrigPixelFormat() const;
+	Common::RandomSource *getRandomSource() const { return _rnd; };
 
 	const char *getGameFile() const;
 





More information about the Scummvm-git-logs mailing list