From b60aa5eae76c049d301ed6a6727ac2f558a4e821 Mon Sep 17 00:00:00 2001 From: Simei Yin Date: Thu, 13 Jul 2017 23:26:47 +0200 Subject: SLUDGE: fix warnings --- engines/sludge/backdrop.cpp | 28 ++++++++++++---------------- engines/sludge/builtin.cpp | 10 ++++------ engines/sludge/fileset.cpp | 2 +- engines/sludge/fileset.h | 2 +- engines/sludge/graphics.cpp | 3 ++- engines/sludge/newfatal.cpp | 2 +- engines/sludge/newfatal.h | 2 +- engines/sludge/sludger.cpp | 14 +++++++------- engines/sludge/sprites.cpp | 6 +++--- engines/sludge/statusba.cpp | 2 +- engines/sludge/statusba.h | 2 +- engines/sludge/variable.cpp | 5 +++-- 12 files changed, 37 insertions(+), 41 deletions(-) diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp index 82260b9192..8e2916e5fe 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 e2ebb1f16d..ee1304997c 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 90fe4512ff..058ae15cd4 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 3a19ea5283..3e9385d18f 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 4a6d9b89a3..d43ae4e872 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 925aeab3ea..f224256b58 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 c26579a46a..f7e53a7ec0 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 7174fe286e..d84688e1d0 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 43bc590a96..62257854ff 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 de434ae22e..6bebb0dea9 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 4de04fba38..96404fca05 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 d47e0b4f43..2b0d15feff 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]; } -- cgit v1.2.3