From a3876ee8c1bf43ad998681188f83266a85ab64b8 Mon Sep 17 00:00:00 2001 From: Simei Yin Date: Sat, 15 Jul 2017 17:33:10 +0200 Subject: SLUDGE: Clean useless #if 0's --- engines/sludge/backdrop.cpp | 463 +----------------------------------------- engines/sludge/bg_effects.cpp | 5 - engines/sludge/builtin.cpp | 14 -- engines/sludge/fileset.cpp | 20 -- engines/sludge/loadsave.cpp | 13 -- engines/sludge/main_loop.cpp | 135 +----------- engines/sludge/movie.cpp | 15 -- engines/sludge/objtypes.cpp | 32 +-- engines/sludge/sludger.cpp | 45 ---- engines/sludge/sprites.cpp | 165 +-------------- engines/sludge/talk.cpp | 5 +- engines/sludge/thumbnail.cpp | 4 - engines/sludge/transition.cpp | 4 - engines/sludge/variable.cpp | 14 -- engines/sludge/variable.h | 12 -- engines/sludge/zbuffer.cpp | 57 +----- 16 files changed, 9 insertions(+), 994 deletions(-) (limited to 'engines/sludge') diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp index f0ab6ef020..9e211f4cb9 100644 --- a/engines/sludge/backdrop.cpp +++ b/engines/sludge/backdrop.cpp @@ -48,15 +48,6 @@ extern Graphics::Surface renderSurface; bool freeze(); void unfreeze(bool); // Because FREEZE.H needs a load of other includes -#if 0 -GLubyte *backdropTexture = NULL; -GLuint backdropTextureName = 0; -GLfloat backdropTexW = 1.0; -GLfloat backdropTexH = 1.0; - -GLuint snapshotTextureName = 0; -#endif - bool backdropExists = false; extern int zBufferToSet; @@ -121,10 +112,6 @@ bool restoreSnapshot(Common::SeekableReadStream *stream) { void killBackDrop() { if (backdropSurface.getPixels()) backdropSurface.free(); -#if 0 - deleteTextures(1, &backdropTextureName); - backdropTextureName = 0; -#endif backdropExists = false; } @@ -133,27 +120,16 @@ void killLightMap() { lightMap.free(); } lightMapNumber = 0; -#if 0 - deleteTextures(1, &lightMap.name); - lightMap.name = 0; -#endif } void killParallax() { - while (parallaxStuff) { - parallaxLayer *k = parallaxStuff; parallaxStuff = k->next; -#if 0 - // Now kill the image - deleteTextures(1, &k->textureName); -#endif k->surface.free(); delete k; k = NULL; } - } bool reserveBackdrop() { @@ -164,36 +140,7 @@ bool reserveBackdrop() { cameraZoom = 1.0; input.mouseX = (int)((float)input.mouseX / cameraZoom); input.mouseY = (int)((float)input.mouseY / cameraZoom); -#if 0 - int picWidth = sceneWidth; - int picHeight = sceneHeight; - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - if (backdropTexture) delete backdropTexture; - if (!NPOT_textures) { - picWidth = getNextPOT(sceneWidth); - picHeight = getNextPOT(sceneHeight); - backdropTexW = ((double)sceneWidth) / picWidth; - backdropTexH = ((double)sceneHeight) / picHeight; - } - backdropTexture = new GLubyte [picWidth * picHeight * 4]; - if (!checkNew(backdropTexture)) return false; - - if (!backdropTextureName) glGenTextures(1, &backdropTextureName); - glBindTexture(GL_TEXTURE_2D, backdropTextureName); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - if (gameSettings.antiAlias < 0) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - } - texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, picWidth, picHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, backdropTexture, backdropTextureName); -#endif return true; } @@ -269,45 +216,6 @@ void blankScreen(int x1, int y1, int x2, int y2) { y2 = (int)sceneHeight; backdropSurface.fillRect(Common::Rect(x1, y1, x2, y2), currentBlankColour); - -#if 0 - setPixelCoords(true); - - int xoffset = 0; - while (xoffset < picWidth) { - int w = (picWidth - xoffset < viewportWidth) ? picWidth - xoffset : viewportWidth; - - int yoffset = 0; - while (yoffset < picHeight) { - int h = (picHeight - yoffset < viewportHeight) ? picHeight - yoffset : viewportHeight; - - // Render the scene - - const GLfloat vertices[] = { - -10.325f, -1.325f, 0.0f, - w + 1.325f, -1.325f, 0.0f, - -10.325f, h + 1.325f, 0.0f, - w + 1.325f, h + 1.325f, 0.0f - }; - - glUseProgram(shader.color); - - setPMVMatrix(shader.color); - setPrimaryColor(redValue(currentBlankColour) / 255.0f, greenValue(currentBlankColour) / 255.0f, blueValue(currentBlankColour) / 255.0f, 1.0f); - drawQuad(shader.color, vertices, 0); - - glUseProgram(0); - - // Copy Our ViewPort To The Texture - copyTexSubImage2D(GL_TEXTURE_2D, 0, x1 + xoffset, y1 + yoffset, viewportOffsetX, viewportOffsetY, w, h, backdropTextureName); - - yoffset += viewportHeight; - } - xoffset += viewportWidth; - } - - setPixelCoords(false); -#endif } // This function is very useful for scrolling credits, but very little else @@ -411,38 +319,12 @@ bool loadLightMap(int v) { if (!ImgLoader::loadImage(bigDataFile, &lightMap)) return false; -#if 0 - int newPicWidth = lightMap.w; - int newPicHeight = lightMap.h; - if (lightMapMode == LIGHTMAPMODE_HOTSPOT) { if (lightMap.w != sceneWidth || lightMap.h != sceneHeight) { return fatal("Light map width and height don't match scene width and height. That is required for lightmaps in HOTSPOT mode."); } } - if (!NPOT_textures) { - newPicWidth = getNextPOT(lightMap.w); - newPicHeight = getNextPOT(lightMap.h); - lightMap.texW = (double) lightMap.w / newPicWidth; - lightMap.texH = (double) lightMap.h / newPicHeight; - } else { - lightMap.texW = 1.0; - lightMap.texH = 1.0; - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); -#endif -#if 0 - if (!lightMap.name) glGenTextures(1, &lightMap.name); - glBindTexture(GL_TEXTURE_2D, lightMap.name); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, newPicWidth, newPicHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, lightMap.data, lightMap.name); -#endif finishAccess(); setResourceForFatal(-1); @@ -450,45 +332,6 @@ bool loadLightMap(int v) { return true; } -void reloadParallaxTextures() { -#if 0 - parallaxLayer *nP = parallaxStuff; - if (!nP) return; - - while (nP) { - //fprintf (stderr, "Reloading parallax. (%d, %d) ", nP->width, nP->height); - nP->textureName = 0; - - glGenTextures(1, &nP->textureName); - glBindTexture(GL_TEXTURE_2D, nP->textureName); - if (nP->wrapS) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - else - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - if (nP->wrapT) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - else - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - if (gameSettings.antiAlias < 0) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - } - - if (!NPOT_textures) { - texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getNextPOT(nP->width), getNextPOT(nP->height), 0, GL_RGBA, GL_UNSIGNED_BYTE, nP->texture, nP->textureName); - } else { - texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, nP->width, nP->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nP->texture, nP->textureName); - } - - nP = nP->next; - } -#endif -} - bool loadParallax(uint16 v, uint16 fracX, uint16 fracY) { setResourceForFatal(v); if (!openFileFromNum(v)) @@ -550,129 +393,6 @@ bool loadParallax(uint16 v, uint16 fracX, uint16 fracY) { return true; } -extern int viewportOffsetX, viewportOffsetY; - -#if 0 -void makeGlArray(GLuint &tmpTex, const GLubyte *texture, int picWidth, int picHeight) { - glGenTextures(1, &tmpTex); - glBindTexture(GL_TEXTURE_2D, tmpTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - if (gameSettings.antiAlias < 0) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - } - texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, picWidth, picHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture, tmpTex); - -} - -void renderToTexture(GLuint tmpTex, int x, int y, int picWidth, int picHeight, int realPicWidth, int realPicHeight) { - GLfloat texCoordW = 1.0; - GLfloat texCoordH = 1.0; - if (!NPOT_textures) { - picWidth = getNextPOT(picWidth); - picHeight = getNextPOT(picHeight); - texCoordW = ((double)realPicWidth) / picWidth; - texCoordH = ((double)realPicHeight) / picHeight; - } - - float btx1; - float btx2; - float bty1; - float bty2; - if (!NPOT_textures) { - btx1 = backdropTexW * x / sceneWidth; - btx2 = backdropTexW * (x + realPicWidth) / sceneWidth; - bty1 = backdropTexH * y / sceneHeight; - bty2 = backdropTexH * (y + realPicHeight) / sceneHeight; - } else { - btx1 = (float) x / sceneWidth; - btx2 = (float)(x + realPicWidth) / sceneWidth; - bty1 = (float) y / sceneHeight; - bty2 = (float)(y + realPicHeight) / sceneHeight; - } - - const GLfloat btexCoords[] = { - btx1, bty1, - btx2, bty1, - btx1, bty2, - btx2, bty2 - }; - - setPixelCoords(true); - - int xoffset = 0; - while (xoffset < realPicWidth) { - int w = (realPicWidth - xoffset < viewportWidth) ? realPicWidth - xoffset : viewportWidth; - - int yoffset = 0; - while (yoffset < realPicHeight) { - int h = (realPicHeight - yoffset < viewportHeight) ? realPicHeight - yoffset : viewportHeight; - - glClear(GL_COLOR_BUFFER_BIT); // Clear The Screen - - const GLfloat vertices[] = { - (GLfloat) - xoffset, (GLfloat) - yoffset, 0., - (GLfloat)realPicWidth - xoffset, (GLfloat) - yoffset, 0., - (GLfloat) - xoffset, (GLfloat) - yoffset + realPicHeight, 0., - (GLfloat)realPicWidth - xoffset, (GLfloat) - yoffset + realPicHeight, 0. - }; - - const GLfloat texCoords[] = { - 0.0f, 0.0f, - texCoordW, 0.0f, - 0.0f, texCoordH, - texCoordW, texCoordH - }; - - if (backdropExists) { - // Render the sprite to the backdrop - // (using mulitexturing, so the old backdrop is seen where alpha < 1.0) - glActiveTexture(GL_TEXTURE2); - glBindTexture(GL_TEXTURE_2D, backdropTextureName); - glActiveTexture(GL_TEXTURE0); - - glUseProgram(shader.paste); - GLint uniform = glGetUniformLocation(shader.paste, "useLightTexture"); - if (uniform >= 0) glUniform1i(uniform, 0);// No lighting - - setPMVMatrix(shader.paste); - - setPrimaryColor(1.0, 1.0, 1.0, 1.0); - glBindTexture(GL_TEXTURE_2D, tmpTex); - //glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - drawQuad(shader.paste, vertices, 3, texCoords, NULL, btexCoords); - - glUseProgram(0); - - } else { - // It's all new - nothing special to be done. - glUseProgram(shader.texture); - setPMVMatrix(shader.texture); - - glBindTexture(GL_TEXTURE_2D, tmpTex); - - setPrimaryColor(1.0, 0.0, 0.0, 0.0); - - drawQuad(shader.texture, vertices, 1, texCoords); - - glUseProgram(0); - } - - // Copy Our ViewPort To The Texture - copyTexSubImage2D(GL_TEXTURE_2D, 0, x + xoffset, y + yoffset, viewportOffsetX, viewportOffsetY, w, h, backdropTextureName); - - yoffset += viewportHeight; - } - xoffset += viewportWidth; - } - setPixelCoords(false); -} -#endif bool loadHSI(Common::SeekableReadStream *stream, int x, int y, bool reserve) { debug(kSludgeDebugGraphics, "Load HSI"); if (reserve) { @@ -685,7 +405,8 @@ bool loadHSI(Common::SeekableReadStream *stream, int x, int y, bool reserve) { uint realPicWidth = backdropSurface.w; uint realPicHeight = backdropSurface.h; - if (reserve) { // resize backdrop + // resize backdrop + if (reserve) { if (!resizeBackdrop(realPicWidth, realPicHeight)) return false; } @@ -698,14 +419,7 @@ bool loadHSI(Common::SeekableReadStream *stream, int x, int y, bool reserve) { debug(kSludgeDebugGraphics, "Illegal back drop size"); return false; } -#if 0 - GLuint tmpTex; - makeGlArray(tmpTex, backdropTexture, picWidth, picHeight); - - renderToTexture(tmpTex, x, y, picWidth, picHeight, realPicWidth, realPicHeight); - deleteTextures(1, &tmpTex); -#endif OrigBackdropSurface.copyFrom(backdropSurface); backdropExists = true; @@ -731,183 +445,10 @@ bool mixHSI(Common::SeekableReadStream *stream, int x, int y) { Graphics::TransparentSurface tmp(mixSurface, false); tmp.blit(backdropSurface, x, y, Graphics::FLIP_NONE, nullptr, TS_ARGB(255, 255 >> 1, 255, 255)); mixSurface.free(); -; -#if 0 - float btx1, tx1; - float btx2, tx2; - float bty1, ty1; - float bty2, ty2; - - if (!NPOT_textures) { - tx1 = 0.0; - ty1 = 0.0; - tx2 = ((double)picWidth) / getNextPOT(picWidth); - ty2 = ((double)picHeight) / getNextPOT(picHeight); - picWidth = getNextPOT(picWidth); - picHeight = getNextPOT(picHeight); - btx1 = backdropTexW * x / sceneWidth; - btx2 = backdropTexW * (x + realPicWidth) / sceneWidth; - bty1 = backdropTexH * y / sceneHeight; - bty2 = backdropTexH * (y + realPicHeight) / sceneHeight; - } else { - tx1 = 0.0; - ty1 = 0.0; - tx2 = 1.0; - ty2 = 1.0; - btx1 = (float) x / sceneWidth; - btx2 = (float)(x + picWidth) / sceneWidth; - bty1 = (float) y / sceneHeight; - bty2 = (float)(y + picHeight) / sceneHeight; - } - - const GLfloat texCoords[] = { - tx1, ty1, - tx2, ty1, - tx1, ty2, - tx2, ty2 - }; - - const GLfloat btexCoords[] = { - btx1, bty1, - btx2, bty1, - btx1, bty2, - btx2, bty2 - }; - - GLuint tmpTex; - makeGlArray(tmpTex, backdropTexture, picWidth, picHeight); - - setPixelCoords(true); - - int xoffset = 0; - while (xoffset < realPicWidth) { - int w = (realPicWidth - xoffset < viewportWidth) ? realPicWidth - xoffset : viewportWidth; - - int yoffset = 0; - while (yoffset < realPicHeight) { - int h = (realPicHeight - yoffset < viewportHeight) ? realPicHeight - yoffset : viewportHeight; - - glClear(GL_COLOR_BUFFER_BIT); // Clear The Screen - - // Render the sprite to the backdrop - // (using mulitexturing, so the backdrop is seen where alpha < 1.0) - glActiveTexture(GL_TEXTURE2); - glBindTexture(GL_TEXTURE_2D, backdropTextureName); - glActiveTexture(GL_TEXTURE0); - - glUseProgram(shader.paste); - GLint uniform = glGetUniformLocation(shader.paste, "useLightTexture"); - if (uniform >= 0) glUniform1i(uniform, 0);// No lighting - - setPMVMatrix(shader.paste); - - setPrimaryColor(1.0, 1.0, 1.0, 0.5); - - glBindTexture(GL_TEXTURE_2D, tmpTex); - //glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - const GLfloat vertices[] = { - (GLfloat) - xoffset, (GLfloat) - yoffset, 0., - (GLfloat)realPicWidth - xoffset, (GLfloat) - yoffset, 0., - (GLfloat) - xoffset, (GLfloat) - yoffset + realPicHeight, 0., - (GLfloat)realPicWidth - xoffset, (GLfloat) - yoffset + realPicHeight, 0. - }; - - drawQuad(shader.paste, vertices, 3, texCoords, NULL, btexCoords); - // Copy Our ViewPort To The Texture - glUseProgram(0); - - copyTexSubImage2D(GL_TEXTURE_2D, 0, (int)((x < 0) ? xoffset : x + xoffset), (int)((y < 0) ? yoffset : y + yoffset), (int)((x < 0) ? viewportOffsetX - x : viewportOffsetX), (int)((y < 0) ? viewportOffsetY - y : viewportOffsetY), w, h, backdropTextureName); - - yoffset += viewportHeight; - } - - xoffset += viewportWidth; - } - deleteTextures(1, &tmpTex); - setPixelCoords(false); -#endif return true; } -#if 0 -void saveCoreHSI(Common::WriteStream *stream, GLuint texture, int w, int h) { - GLint tw, th; - glBindTexture(GL_TEXTURE_2D, texture); - getTextureDimensions(texture, &tw, &th); - - GLushort *image = new GLushort[tw * th]; - if (!checkNew(image)) - return; - glPixelStorei(GL_PACK_ALIGNMENT, 1); -// glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, image); - setPixelCoords(true); - - //glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - - const GLfloat texCoords[] = { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f }; - - int xoffset = 0; - while (xoffset < tw) { - int w = (tw - xoffset < viewportWidth) ? tw - xoffset : viewportWidth; - - int yoffset = 0; - while (yoffset < th) { - int h = (th - yoffset < viewportHeight) ? th - yoffset : viewportHeight; - glClear (GL_COLOR_BUFFER_BIT); // Clear The Screen - const GLfloat vertices[] = { (GLfloat)-xoffset, (GLfloat)-yoffset, 0., (GLfloat)w - xoffset, (GLfloat)-yoffset, 0., (GLfloat)-xoffset, (GLfloat)-yoffset + h, 0., (GLfloat)w - xoffset, - (GLfloat)-yoffset + h, 0. }; - - glUseProgram(shader.texture); - setPMVMatrix(shader.texture); - drawQuad(shader.texture, vertices, 1, texCoords); - glUseProgram(0); - - for (int i = 0; i < h; i++) { - glReadPixels(viewportOffsetX, viewportOffsetY + i, w, 1, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, image + xoffset + (yoffset + i) * tw); - } - yoffset += viewportHeight; - } - - xoffset += viewportWidth; - } - //glReadPixels(viewportOffsetX, viewportOffsetY, tw, th, GL_RGBA, GL_UNSIGNED_BYTE, data); - setPixelCoords(false); - - int x, y, lookAhead; - uint16 *fromHere, *lookPointer; - - stream->writeUint16BE(w); - stream->writeUint16BE(h); - - for (y = 0; y < h; y++) { - fromHere = image + (y * tw); - x = 0; - while (x < w) { - lookPointer = fromHere + 1; - for (lookAhead = x + 1; lookAhead < w; lookAhead++) { - if (lookAhead - x == 256) - break; - if (*fromHere != *lookPointer) - break; - lookPointer++; - } - if (lookAhead == x + 1) { - put2bytes((*fromHere) & 65503, stream); - } else { - stream->writeUint16BE(*fromHere | 32); - stream->writeByte(lookAhead - x - 1); - } - fromHere = lookPointer; - x = lookAhead; - } - } - delete[] image; - image = NULL; -} -#endif - void saveHSI(Common::WriteStream *stream) { Image::writePNG(*stream, backdropSurface); } diff --git a/engines/sludge/bg_effects.cpp b/engines/sludge/bg_effects.cpp index 0168e91b42..920be44e1c 100644 --- a/engines/sludge/bg_effects.cpp +++ b/engines/sludge/bg_effects.cpp @@ -30,11 +30,6 @@ namespace Sludge { -#if 0 -//extern uint16 **backDropImage; -extern GLuint backdropTextureName; -#endif - #if 0 // Raised static int s_matrixEffectDivide = 2; diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp index 61590a5f0f..dbf9dfc57b 100644 --- a/engines/sludge/builtin.cpp +++ b/engines/sludge/builtin.cpp @@ -77,17 +77,12 @@ extern Common::String *allUserFunc; extern Common::String *allBIFNames; extern inputType input; -#if 0 -extern GLuint backdropTextureName; -#endif - extern float speechSpeed; extern byte brightnessLevel; extern byte fadeMode; extern uint16 saveEncoding; extern frozenStuffStruct *frozenStuff; extern uint currentBlankColour; -extern uint languageID; extern byte currentBurnR, currentBurnG, currentBurnB; int paramNum[] = { -1, 0, 1, 1, -1, -1, 1, 3, 4, 1, 0, 0, 8, -1, // SAY->MOVEMOUSE @@ -1010,19 +1005,11 @@ builtIn(callEvent) { return BR_CONTINUE; } -#if 0 -SDL_Event quit_event; -#endif - bool reallyWantToQuit = false; builtIn(quitGame) { UNUSEDALL reallyWantToQuit = true; -#if 0 - quit_event.type = SDL_QUIT; - SDL_PushEvent(&quit_event); -#endif return BR_CONTINUE; } @@ -2627,7 +2614,6 @@ builtReturn callBuiltIn(int whichFunc, int numParams, loadedFunction *fun) { } if (builtInFunctionArray[whichFunc].func) { - //fprintf (stderr, "Calling %i: %s\n", whichFunc, builtInFunctionNames[whichFunc]); return builtInFunctionArray[whichFunc].func(numParams, fun); } } diff --git a/engines/sludge/fileset.cpp b/engines/sludge/fileset.cpp index 058ae15cd4..daec8bd7c0 100644 --- a/engines/sludge/fileset.cpp +++ b/engines/sludge/fileset.cpp @@ -38,56 +38,36 @@ Common::File *bigDataFile = NULL; uint32 startOfDataIndex, startOfTextIndex, startOfSubIndex, startOfObjectIndex; bool openSubSlice(int num) { -// FILE * dbug = fopen ("debuggy.txt", "at"); - -// fprintf (dbug, "\nTrying to open sub %i\n", num); - if (sliceBusy) { fatal("Can't read from data file", "I'm already reading something"); return false; } -// fprintf (dbug, "Going to position %li\n", startOfSubIndex + (num << 2)); bigDataFile->seek(startOfSubIndex + (num << 2), 0); bigDataFile->seek(bigDataFile->readUint32LE(), 0); -// fprintf (dbug, "Told to skip forward to %li\n", ftell (bigDataFile)); -// fclose (dbug); return sliceBusy = true; } bool openObjectSlice(int num) { -// FILE * dbug = fopen ("debuggy.txt", "at"); - -// fprintf (dbug, "\nTrying to open object %i\n", num); - if (sliceBusy) { fatal("Can't read from data file", "I'm already reading something"); return false; } -// fprintf (dbug, "Going to position %li\n", startOfObjectIndex + (num << 2)); bigDataFile->seek(startOfObjectIndex + (num << 2), 0); bigDataFile->seek(bigDataFile->readUint32LE(), 0); -// fprintf (dbug, "Told to skip forward to %li\n", ftell (bigDataFile)); -// fclose (dbug); return sliceBusy = true; } uint openFileFromNum(int num) { -// FILE * dbug = fopen ("debuggy.txt", "at"); - if (sliceBusy) { fatal("Can't read from data file", "I'm already reading something"); return 0; } -// fprintf (dbug, "\nTrying to open file %i\n", num); -// fprintf (dbug, "Jumping to %li (for index) \n", startOfDataIndex + (num << 2)); bigDataFile->seek(startOfDataIndex + (num << 2), 0); bigDataFile->seek(bigDataFile->readUint32LE(), 1); -// fprintf (dbug, "Jumping to %li (for data) \n", ftell (bigDataFile)); sliceBusy = true; -// fclose (dbug); return bigDataFile->readUint32LE(); } diff --git a/engines/sludge/loadsave.cpp b/engines/sludge/loadsave.cpp index 3ab1b13d85..0757067af2 100644 --- a/engines/sludge/loadsave.cpp +++ b/engines/sludge/loadsave.cpp @@ -109,8 +109,6 @@ void saveStack(variableStack *vs, Common::WriteStream *stream) { search = search->next; } - stackDebug((stackfp, " stack contains %d elements\n", elements)); - stream->writeUint16BE(elements); search = vs; for (a = 0; a < elements; a++) { @@ -131,7 +129,6 @@ variableStack *loadStack(Common::SeekableReadStream *stream, variableStack **las return NULL; loadVariable(&(nS->thisVar), stream); if (last && a == elements - 1) { - stackDebug((stackfp, "Setting last to %p\n", nS)); *last = nS; } nS->next = NULL; @@ -189,13 +186,9 @@ stackHandler *loadStackRef(Common::SeekableReadStream *stream) { stackHandler *nsh; if (stream->readByte()) { // It's one we've loaded already... - stackDebug((stackfp, "loadStackRef (duplicate, get from library)\n")); - nsh = getStackFromLibrary(stream->readUint16BE()); nsh->timesUsed++; } else { - stackDebug((stackfp, "loadStackRef (new one)\n")); - // Load the new stack nsh = new stackHandler; @@ -204,12 +197,6 @@ stackHandler *loadStackRef(Common::SeekableReadStream *stream) { nsh->last = NULL; nsh->first = loadStack(stream, &nsh->last); nsh->timesUsed = 1; - stackDebug((stackfp, " first = %p\n", nsh->first)); - if (nsh->first) - stackDebug((stackfp, " first->next = %p\n", nsh->first->next)); - stackDebug((stackfp, " last = %p\n", nsh->last)); - if (nsh->last) - stackDebug((stackfp, " last->next = %p\n", nsh->last->next)); // Add it to the library of loaded stacks diff --git a/engines/sludge/main_loop.cpp b/engines/sludge/main_loop.cpp index 51b3913c1a..1f8a44e81c 100644 --- a/engines/sludge/main_loop.cpp +++ b/engines/sludge/main_loop.cpp @@ -69,42 +69,6 @@ Graphics::Surface renderSurface; int dialogValue = 0; -void setGameFilePath(char *f) { -#if 0 - char currentDir[1000]; - if (!getcwd(currentDir, 998)) { - debugOut("Can't get current directory.\n"); - } - - int got = -1, a; - - for (a = 0; f[a]; a ++) { - if (f[a] == PATHSLASH) got = a; - } - - if (got != -1) { - f[got] = 0; - if (chdir(f)) { - debugOut("Error: Failed changing to directory %s\n", f); - } - f[got] = PATHSLASH; - } - - gamePath = new char[400]; - if (!checkNew(gamePath)) return; - - if (!getcwd(gamePath, 398)) { - debugOut("Can't get game directory.\n"); - } - - if (chdir(currentDir)) { - debugOut("Error: Failed changing to directory %s\n", currentDir); - } -#endif -} - -void saveHSI(Common::WriteStream *writer); - extern bool reallyWantToQuit; int weAreDoneSoQuit; @@ -165,39 +129,6 @@ void checkInput() { break; case Common::EVENT_KEYDOWN: -#if 0 - // A Windows key is pressed - let's leave fullscreen. - if (runningFullscreen) { - if (event.key.keysym.sym == SDLK_LSUPER || event.key.keysym.sym == SDLK_LSUPER) { - setGraphicsWindow(!runningFullscreen); - } - } - // Ignore Command keypresses - they're for the OS to handle. - if (event.key.keysym.mod & KMOD_META) { - // Command+F - let's switch to/from full screen - if ('f' == event.key.keysym.unicode) { - setGraphicsWindow(!runningFullscreen); - } - break; - } else if (event.key.keysym.mod & KMOD_ALT) { - // Alt + Enter also switches full screen mode - if (SDLK_RETURN == event.key.keysym.sym) { - setGraphicsWindow(!runningFullscreen); - } - if (SDLK_a == event.key.keysym.sym) { - gameSettings.antiAlias = !gameSettings.antiAlias; - break; - } - // Allow Alt+F4 to quit - if (SDLK_F4 == event.key.keysym.sym) { - SDL_Event event; - event.type = SDL_QUIT; - SDL_PushEvent(&event); - } - - break; - } -#endif switch (event.kbd.keycode) { case Common::KEYCODE_BACKSPACE: @@ -213,19 +144,7 @@ void checkInput() { case Common::EVENT_QUIT: weAreDoneSoQuit = 1; -#if 0 - if (reallyWantToQuit) { - // The game file has requested that we quit - weAreDoneSoQuit = 1; - } else { - // The request is from elsewhere - ask for confirmation. - setGraphicsWindow(false); - //fprintf (stderr, "%s %s\n", gameName, getNumberedString(2)); - if (msgBoxQuestion(gameName, getNumberedString(2))) { - weAreDoneSoQuit = 1; - } - } -#endif + // TODO: if reallyWantToQuit, popup a message box to confirm break; default: @@ -235,9 +154,6 @@ void checkInput() { } int main_loop(const char *filename) -#if 0 - try -#endif { /* Dimensions of our window. */ winWidth = 640; @@ -251,28 +167,6 @@ int main_loop(const char *filename) // Init screen surface renderSurface.create(g_system->getWidth(), g_system->getHeight(), g_system->getScreenFormat()); -#if 0 - /* Initialize the SDL library */ - if (SDL_Init(SDL_INIT_VIDEO) < 0) { - msgBox("Startup Error: Couldn't initialize SDL.", SDL_GetError()); - exit(1); - } -#endif - if (gameIcon) { -#if 0 - if (SDL_Surface *programIcon = SDL_CreateRGBSurfaceFrom(gameIcon, iconW, iconH, 32, iconW * 4, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)) { - SDL_WM_SetIcon(programIcon, NULL); - SDL_FreeSurface(programIcon); - } -#endif - delete gameIcon; - } -#if 0 - // Needed to make menu shortcuts work (on Mac), i.e. Command+Q for quit - SDL_putenv((char *)"SDL_ENABLEAPPEVENTS=1"); - - setupOpenGLStuff(); -#endif registerWindowForFatal(); @@ -292,19 +186,6 @@ int main_loop(const char *filename) g_sludge->gameName = getNumberedString(1); -#if 0 - SDL_WM_SetCaption(gameName, gameName); - - if ((specialSettings & (SPECIAL_MOUSE_1 | SPECIAL_MOUSE_2)) == SPECIAL_MOUSE_1) { - // Hide the standard mouse cursor! - // This is done in a weird way because there's bugs with SDL_ShowCursor(SDL_DISABLE); - SDL_Cursor *cursor = NULL; - Uint8 data = 0; - SDL_FreeCursor(cursor); - cursor = SDL_CreateCursor(&data, &data, 1, 1, 0, 0); - SDL_SetCursor(cursor); - } -#endif if (!(specialSettings & SPECIAL_SILENT)) { initSoundStuff(hMainWindow); } @@ -325,22 +206,8 @@ int main_loop(const char *filename) killSoundStuff(); -#if 0 - /* Clean up the SDL library */ - SDL_Quit(); -#endif - displayFatal(); return (0); } -#if 0 -catch (std::exception &ex) { //NOTE by reference, not value - std::cerr << "std::exception caught: " << ex.what() << std::endl; - return -1; -} catch (...) { - std::cerr << "Unknown exception was never caught" << std::endl; - return -2; -} -#endif } // End of namespace Sludge diff --git a/engines/sludge/movie.cpp b/engines/sludge/movie.cpp index bb56a45b33..49a6919964 100644 --- a/engines/sludge/movie.cpp +++ b/engines/sludge/movie.cpp @@ -19,21 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#if 0 -#include -#define VPX_CODEC_DISABLE_COMPAT 1 -#include "vpx/vpx_decoder.h" -#include "vpx/vp8dx.h" -#define interface (&vpx_codec_vp8_dx_algo) -#include "vorbis/codec.h" -#define OV_EXCLUDE_STATIC_CALLBACKS -#include "vorbis/vorbisfile.h" - -#include "ogg/ogg.h" -#include "libvorbis/vorbis_os.h" - -#include "AL/alure.h" -#endif #include "sludge/specialsettings.h" diff --git a/engines/sludge/objtypes.cpp b/engines/sludge/objtypes.cpp index e0fae1b19d..f975167ec9 100644 --- a/engines/sludge/objtypes.cpp +++ b/engines/sludge/objtypes.cpp @@ -82,28 +82,12 @@ objectType *loadObjectType(int i) { newType->numCom = bigDataFile->readUint16BE(); newType->allCombis = (newType->numCom) ? new combination[newType->numCom] : NULL; -#if DEBUG_COMBINATIONS - FILE *callEventLog = fopen("callEventLog.txt", "at"); - if (callEventLog) { - fprintf(callEventLog, "Object type %d has %d combinations... ", i, newType -> numCom); - } -#endif for (a = 0; a < newType->numCom; a++) { newType->allCombis[a].withObj = bigDataFile->readUint16BE(); newType->allCombis[a].funcNum = bigDataFile->readUint16BE(); -#if DEBUG_COMBINATIONS - if (callEventLog) { - fprintf(callEventLog, "%d(%d) ", newType -> allCombis[a].withObj, newType -> allCombis[a].funcNum); - } -#endif - } -#if DEBUG_COMBINATIONS - if (callEventLog) { - fprintf(callEventLog, "\n"); - fclose(callEventLog); } -#endif + finishAccess(); newType->screenName = getNumberedString(nameNum); newType->objectNum = i; @@ -132,13 +116,6 @@ int getCombinationFunction(int withThis, int thisObject) { int i, num = 0; objectType *obj = findObjectType(thisObject); -#if DEBUG_COMBINATIONS - FILE *callEventLog = fopen("callEventLog.txt", "at"); - if (callEventLog) { - fprintf(callEventLog, "Combining %d and %d - ", thisObject, withThis); - } -#endif - for (i = 0; i < obj->numCom; i++) { if (obj->allCombis[i].withObj == withThis) { num = obj->allCombis[i].funcNum; @@ -146,13 +123,6 @@ int getCombinationFunction(int withThis, int thisObject) { } } -#if DEBUG_COMBINATIONS - if (callEventLog) { - fprintf(callEventLog, "got function number %d\n", num); - fclose(callEventLog); - } -#endif - return num; } diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp index 9364aab540..41d2dd8cc4 100644 --- a/engines/sludge/sludger.cpp +++ b/engines/sludge/sludger.cpp @@ -502,14 +502,6 @@ bool initSludge(const Common::String &filename) { Common::String gameName = encodeFilename(gameNameOrig); -#if 0 - changeToUserDir(); - - mkdir(gameName, 0000777); - - if (chdir(gameName)) return fatal("This game's preference folder is inaccessible!\nI can't access the following directory (maybe there's a file with the same name, or maybe it's read-protected):", gameName); -#endif - // Get language selected by user gameSettings.languageID = g_sludge->getLanguageID(); @@ -521,11 +513,6 @@ bool initSludge(const Common::String &filename) { if (!dataFol.empty()) { Common::String dataFolder = encodeFilename(dataFol); -#if 0 - mkdir(dataFolder, 0000777); - - if (chdir(dataFolder)) return fatal("This game's data folder is inaccessible!\nI can't access the following directory (maybe there's a file with the same name, or maybe it's read-protected):", dataFolder); -#endif } positionStatus(10, winHeight - 15); @@ -534,23 +521,6 @@ bool initSludge(const Common::String &filename) { } extern int cameraX, cameraY; -extern float cameraZoom; - -bool checkColourChange(bool reset) { -#if 0 - static GLuint oldPixel; - static GLuint pixel; - glReadPixels((GLint)(viewportOffsetX + input.mouseX * viewportWidth / ((float)winWidth / cameraZoom)), - (GLint)(viewportOffsetY + (((float)winHeight / cameraZoom) - input.mouseY)*viewportHeight / ((float)winHeight / cameraZoom)), - 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel); - - if (reset || oldPixel != pixel) { - oldPixel = pixel; - return true; - } -#endif - return false; -} void displayBase() { drawBackDrop();// Draw the room @@ -1280,25 +1250,10 @@ int startNewFunctionNum(uint funcNum, uint numParamsExpected, int lastFramesPerSecond = -1; int thisFramesPerSecond = -1; -#if 0 -Uint32 lastSeconds = 0; -#endif bool handleInput() { static int l = 0; -#if 0 - static Uint32 theTime; - theTime = SDL_GetTicks() / 1000; - if (lastSeconds != theTime) { - lastSeconds = theTime; - lastFramesPerSecond = thisFramesPerSecond; - thisFramesPerSecond = 1; - } else { - thisFramesPerSecond ++; - } -// lastFramesPerSecond = theTime.wSecond; -#endif if (!g_sludge->launchMe.empty()) { if (l) { // Still paused because of spawned thingy... diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp index 1b9b977118..735db7d45e 100644 --- a/engines/sludge/sprites.cpp +++ b/engines/sludge/sprites.cpp @@ -59,10 +59,6 @@ SpriteLayers spriteLayers; extern zBufferData zBuffer; -#if 0 -extern GLuint backdropTextureName; -#endif - extern inputType input; extern int cameraX, cameraY; extern float cameraZoom; @@ -304,103 +300,8 @@ void pasteSpriteToBackDrop(int x1, int y1, sprite &single, const spritePalette & x1 -= single.xhot; y1 -= single.yhot; Graphics::TransparentSurface tmp(single.surface, false); - tmp.blit(backdropSurface, x1, y1, Graphics::FLIP_NONE, nullptr, TS_RGB(fontPal.originalRed, fontPal.originalGreen, fontPal.originalBlue)); -#if 0 - float tx1 = (float)(single.tex_x) / fontPal.tex_w[single.texNum]; - float ty1 = 0.0; - float tx2 = (float)(single.tex_x + single.width) / fontPal.tex_w[single.texNum]; - float ty2 = (float)(single.height) / fontPal.tex_h[single.texNum]; - - float btx1; - float btx2; - float bty1; - float bty2; - - int diffX = single.width; - int diffY = single.height; - - x1 -= single.xhot; - y1 -= single.yhot; - - if (! NPOT_textures) { - btx1 = backdropTexW * x1 / sceneWidth; - btx2 = backdropTexW * (x1 + single.width) / sceneWidth; - bty1 = backdropTexH * y1 / sceneHeight; - bty2 = backdropTexH * (y1 + single.height) / sceneHeight; - } else { - btx1 = (float) x1 / sceneWidth; - btx2 = (float)(x1 + single.width) / sceneWidth; - bty1 = (float) y1 / sceneHeight; - bty2 = (float)(y1 + single.height) / sceneHeight; - } - - const GLfloat btexCoords[] = { - btx1, bty1, - btx2, bty1, - btx1, bty2, - btx2, bty2 - }; - - if (x1 < 0) diffX += x1; - if (y1 < 0) diffY += y1; - if (x1 + diffX > sceneWidth) diffX = sceneWidth - x1; - if (y1 + diffY > sceneHeight) diffY = sceneHeight - y1; - if (diffX < 0) return; - if (diffY < 0) return; - - setPixelCoords(true); - - int xoffset = 0; - while (xoffset < diffX) { - int w = (diffX - xoffset < viewportWidth) ? diffX - xoffset : viewportWidth; - - int yoffset = 0; - while (yoffset < diffY) { - int h = (diffY - yoffset < viewportHeight) ? diffY - yoffset : viewportHeight; - - // Render the sprite to the backdrop - // (using mulitexturing, so the backdrop is seen where alpha < 1.0) - glActiveTexture(GL_TEXTURE2); - glBindTexture(GL_TEXTURE_2D, backdropTextureName); - glActiveTexture(GL_TEXTURE0); - - glUseProgram(shader.paste); - GLint uniform = glGetUniformLocation(shader.paste, "useLightTexture"); - if (uniform >= 0) glUniform1i(uniform, 0);// No lighting - - setPMVMatrix(shader.paste); - - setPrimaryColor(fontPal.originalRed / 255.f, fontPal.originalGreen / 255.f, fontPal.originalBlue / 255.f, 1.0f); - glBindTexture(GL_TEXTURE_2D, fontPal.tex_names[single.texNum]); - //glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - const GLfloat vertices[] = { - (GLfloat) - xoffset, (GLfloat) - yoffset, 0., - (GLfloat)single.width - xoffset, (GLfloat) - yoffset, 0., - (GLfloat) - xoffset, (GLfloat)single.height - yoffset, 0., - (GLfloat)single.width - xoffset, (GLfloat)single.height - yoffset, 0. - }; - - const GLfloat texCoords[] = { - tx1, ty1, - tx2, ty1, - tx1, ty2, - tx2, ty2 - }; - - drawQuad(shader.paste, vertices, 3, texCoords, NULL, btexCoords); - - // Copy Our ViewPort To The Texture - glUseProgram(0); - - copyTexSubImage2D(GL_TEXTURE_2D, 0, (int)((x1 < 0) ? xoffset : x1 + xoffset), (int)((y1 < 0) ? yoffset : y1 + yoffset), (int)((x1 < 0) ? viewportOffsetX - x1 : viewportOffsetX), (int)((y1 < 0) ? viewportOffsetY - y1 : viewportOffsetY), w, h, backdropTextureName); - - yoffset += viewportHeight; - } - xoffset += viewportWidth; - } - setPixelCoords(false); -#endif + tmp.blit(backdropSurface, x1, y1, Graphics::FLIP_NONE, nullptr, + TS_RGB(fontPal.originalRed, fontPal.originalGreen, fontPal.originalBlue)); } void burnSpriteToBackDrop(int x1, int y1, sprite &single, const spritePalette &fontPal) { @@ -507,10 +408,6 @@ void burnSpriteToBackDrop(int x1, int y1, sprite &single, const spritePalette &f #endif } -#if 0 -extern GLuint backdropTextureName; -#endif - void fontSprite(bool flip, int x, int y, sprite &single, const spritePalette &fontPal) { float x1 = (float)x - (float)single.xhot / cameraZoom; float y1 = (float)y - (float)single.yhot / cameraZoom; @@ -524,60 +421,6 @@ void fontSprite(bool flip, int x, int y, sprite &single, const spritePalette &fo tmp2.blit(renderSurface, x1, y1, (flip ? Graphics::FLIP_H : Graphics::FLIP_NONE), 0, TS_RGB(fontPal.originalRed, fontPal.originalGreen, fontPal.originalBlue)); } - -#if 0 - float x2 = x1 + (float) single.surface.w / cameraZoom; - float y2 = y1 + (float) single.surface.h / cameraZoom; - float tx1 = (float) (single.tex_x - 0.5) / fontPal.tex_w[single.texNum]; - float ty1 = 0.0; - float tx2 = (float) (single.tex_x + single.width + (flip ? 1.0 : 0.5)) - / fontPal.tex_w[single.texNum]; - float ty2 = (float) (single.height + 2) / fontPal.tex_h[single.texNum]; - - GLfloat vertices[] = { - x1, y1, 0.0f, - x2, y1, 0.0f, - x1, y2, 0.0f, - x2, y2, 0.0f - }; - if (flip) { - vertices[0] = x2; - vertices[3] = x1; - vertices[6] = x2; - vertices[9] = x1; - } - - const GLfloat texCoords[] = { - tx1, ty1, - tx2, ty1, - tx1, ty2, - tx2, ty2 - }; - - //glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // GL_MODULATE instead of decal mixes the colours! - setPrimaryColor(fontPal.originalRed / 255.f, fontPal.originalGreen / 255.f, fontPal.originalBlue / 255.f, 1.0f); - - glBindTexture(GL_TEXTURE_2D, fontPal.tex_names[single.texNum]); - - glUseProgram(shader.smartScaler); - GLuint uniform = glGetUniformLocation(shader.smartScaler, "useLightTexture"); - if (uniform >= 0) glUniform1i(uniform, 0); - - setPMVMatrix(shader.smartScaler); - - if (gameSettings.antiAlias == 1) { - glUniform1i(glGetUniformLocation(shader.smartScaler, "antialias"), 1); - } else { - glUniform1i(glGetUniformLocation(shader.smartScaler, "antialias"), 0); - } - - glEnable(GL_BLEND); - - drawQuad(shader.smartScaler, vertices, 1, texCoords); - - glDisable(GL_BLEND); - glUseProgram(0); -#endif } void fontSprite(int x, int y, sprite &single, const spritePalette &fontPal) { @@ -602,10 +445,6 @@ void setDrawMode(onScreenPerson *thisPerson) { #endif } -#if 0 -extern GLuint backdropTextureName; -#endif - bool scaleSprite(sprite &single, const spritePalette &fontPal, onScreenPerson *thisPerson, bool mirror) { float x = thisPerson->x; float y = thisPerson->y; diff --git a/engines/sludge/talk.cpp b/engines/sludge/talk.cpp index 4523a7f28f..e92cd00ef8 100644 --- a/engines/sludge/talk.cpp +++ b/engines/sludge/talk.cpp @@ -53,9 +53,7 @@ void initSpeech() { void killAllSpeech() { if (speech->lastFile != -1) { -#if 0 huntKillSound(speech->lastFile); -#endif speech->lastFile = -1; } @@ -111,13 +109,12 @@ int wrapSpeechXY(const Common::String &theText, int x, int y, int wrap, int samp speechTime = 1; if (sampleFile != -1) { if (speechMode >= 1) { -#if 0 if (startSound(sampleFile, false)) { speechTime = -10; speech->lastFile = sampleFile; if (speechMode == 2) return -10; } -#endif + } } speech->speechY = y; diff --git a/engines/sludge/thumbnail.cpp b/engines/sludge/thumbnail.cpp index 820e5af7a9..424feb40dd 100644 --- a/engines/sludge/thumbnail.cpp +++ b/engines/sludge/thumbnail.cpp @@ -35,10 +35,6 @@ void unfreeze(bool); // Because FREEZE.H needs a load of other includes int thumbWidth = 0, thumbHeight = 0; -#if 0 -extern GLuint backdropTextureName; -#endif - bool saveThumbnail(Common::WriteStream *stream) { #if 0 GLuint thumbnailTextureName = 0; diff --git a/engines/sludge/transition.cpp b/engines/sludge/transition.cpp index 83ec7dfd8b..306a51c300 100644 --- a/engines/sludge/transition.cpp +++ b/engines/sludge/transition.cpp @@ -24,10 +24,6 @@ #include "sludge/backdrop.h" #include "sludge/newfatal.h" -#if 0 -extern GLuint snapshotTextureName; -#endif - namespace Sludge { extern byte brightnessLevel; diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp index a1c736aa93..b13e123c09 100644 --- a/engines/sludge/variable.cpp +++ b/engines/sludge/variable.cpp @@ -194,12 +194,6 @@ bool copyStack(const variable &from, variable &to) { return true; } -/*void newStackVar (variable & thisVar) { - unlinkVar (thisVar); - thisVar.varType = VT_STACK; - thisVar.varData.theStack = NULL; - } */ - void addVariablesInSecond(variable &var1, variable &var2) { if (var1.varType == SVT_INT && var2.varType == SVT_INT) { var2.varData.intValue += var1.varData.intValue; @@ -315,14 +309,6 @@ Common::String getTextFromAnyVar(const variable &from) { return resourceNameFromNum(from.varData.intValue); } - /* case SVT_ANIM: - { - char * buff = new char[20]; - if (! checkNew (buff)) return NULL; - sprintf (buff, "%p", from.varData.animHandler); - return buff; - }*/ - case SVT_OBJTYPE: { objectType *thisType = findObjectType(from.varData.intValue); if (thisType) diff --git a/engines/sludge/variable.h b/engines/sludge/variable.h index 1cac125751..6c0aff4e19 100644 --- a/engines/sludge/variable.h +++ b/engines/sludge/variable.h @@ -117,18 +117,6 @@ bool makeFastArrayFromStack(variable &to, const stackHandler *stacky); bool makeFastArraySize(variable &to, int size); variable *fastArrayGetByIndex(fastArrayHandler *vS, uint theIndex); -#define DEBUG_STACKINESS 0 - -#if DEBUG_STACKINESS -#define stackDebug(params) { \ - FILE * stackfp = fopen ("stackout.txt", "at"); \ - fprintf params; \ - fclose (stackfp); \ - } -#else -#define stackDebug(a) {} -#endif - } // End of namespace Sludge #endif diff --git a/engines/sludge/zbuffer.cpp b/engines/sludge/zbuffer.cpp index ea9fdfee80..d9e66b82c6 100644 --- a/engines/sludge/zbuffer.cpp +++ b/engines/sludge/zbuffer.cpp @@ -178,59 +178,6 @@ void drawZBuffer(int x, int y, bool upsidedown) { return; resetSpriteLayers(&zBuffer, x, y, upsidedown); +} -#if 0 - glEnable (GL_DEPTH_TEST); - - glEnable(GL_DEPTH_TEST); - glEnable(GL_BLEND); - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - glDepthMask(GL_TRUE); - - glUseProgram(shader.texture); - - setPMVMatrix(shader.texture); - - //glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glBindTexture(GL_TEXTURE_2D, zBuffer.texName); - - setPrimaryColor(1.0, 1.0, 1.0, 1.0); - - for (i = 1; i < zBuffer.numPanels; i++) { - GLfloat z = 1.0 - (double) i * (1.0 / 128.0); - - GLfloat vy1 = -y, vy2 = zBuffer.height - y; - if (upsidedown) { - vy1 += zBuffer.height; - vy2 -= zBuffer.height; - } - - const GLfloat vertices[] = { - (GLfloat) - x, vy1, z, - (GLfloat)zBuffer.width - x, vy1, z, - (GLfloat) - x, vy2, z, - (GLfloat)zBuffer.width - x, vy2, z - }; - - const GLfloat texCoords[] = { - 0.0f, 0.0f, - backdropTexW, 0.0f, - 0.0f, backdropTexH, - backdropTexW, backdropTexH - }; - - glUniform1i(glGetUniformLocation(shader.texture, "zBuffer"), 1); - glUniform1f(glGetUniformLocation(shader.texture, "zBufferLayer"), i); - - drawQuad(shader.texture, vertices, 1, texCoords); - glUniform1i(glGetUniformLocation(shader.texture, "zBuffer"), 0); - } - - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glDepthMask(GL_FALSE); - glDisable(GL_BLEND); - glUseProgram(0); -#endif - } - - } // End of namespace Sludge +} // End of namespace Sludge -- cgit v1.2.3