aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoryinsimei2017-06-05 19:58:32 +0200
committerEugene Sandulenko2017-07-13 18:27:45 +0200
commitbee42dc52fb7fa2d73f95cf088fc26ced732a17c (patch)
treef414e55652ba611caf72a137380beacd9ce51788 /engines
parent7430ebe8830f58ae8fd1c123bfd7b08031a0f8b1 (diff)
downloadscummvm-rg350-bee42dc52fb7fa2d73f95cf088fc26ced732a17c.tar.gz
scummvm-rg350-bee42dc52fb7fa2d73f95cf088fc26ced732a17c.tar.bz2
scummvm-rg350-bee42dc52fb7fa2d73f95cf088fc26ced732a17c.zip
SLUDGE: remove platform dependent defines
Diffstat (limited to 'engines')
-rw-r--r--engines/sludge/builtin.cpp8
-rw-r--r--engines/sludge/cursors.cpp8
-rw-r--r--engines/sludge/debug.cpp4
-rw-r--r--engines/sludge/fileset.cpp9
-rw-r--r--engines/sludge/floor.h6
-rw-r--r--engines/sludge/graphics.cpp71
-rw-r--r--engines/sludge/graphics.h9
-rw-r--r--engines/sludge/language.cpp4
-rw-r--r--engines/sludge/libwebm/mkvreader.cpp2
-rw-r--r--engines/sludge/libwebm/mkvreader.hpp2
-rw-r--r--engines/sludge/line.cpp3
-rw-r--r--engines/sludge/linuxstuff.cpp230
-rw-r--r--engines/sludge/linuxstuff.h44
-rw-r--r--engines/sludge/main_loop.cpp49
-rw-r--r--engines/sludge/module.mk7
-rw-r--r--engines/sludge/moreio.cpp4
-rw-r--r--engines/sludge/newfatal.cpp1
-rw-r--r--engines/sludge/people.h2
-rw-r--r--engines/sludge/shaders.h8
-rw-r--r--engines/sludge/sludger.cpp34
-rw-r--r--engines/sludge/sludger.h2
-rw-r--r--engines/sludge/sound.h4
-rw-r--r--engines/sludge/talk.cpp3
-rw-r--r--engines/sludge/timing.cpp3
-rw-r--r--engines/sludge/variable.cpp40
-rw-r--r--engines/sludge/winstuff.cpp231
-rw-r--r--engines/sludge/winstuff.h43
-rw-r--r--engines/sludge/zbuffer.h8
28 files changed, 12 insertions, 827 deletions
diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index 9733689c20..873b523872 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -20,10 +20,6 @@
*
*/
-#if 0
-#include <SDL/SDL.h>
-#endif
-
#include "sludge/debug.h"
#include "sludge/allfiles.h"
#include "sludge/sludger.h"
@@ -995,11 +991,7 @@ builtIn(launch) {
launchMe = copyString(newTextA);
} else {
char *gameDir;
-#ifdef _WIN32
- gameDir = joinStrings(gamePath, "\\");
-#else
gameDir = joinStrings(gamePath, "/");
-#endif
launchMe = joinStrings(gameDir, newText);
delete newText;
if (!launchMe)
diff --git a/engines/sludge/cursors.cpp b/engines/sludge/cursors.cpp
index 4720677bfe..abe09c86d3 100644
--- a/engines/sludge/cursors.cpp
+++ b/engines/sludge/cursors.cpp
@@ -20,14 +20,6 @@
*
*/
-#if 0
-#if !defined(HAVE_GLES2)
-#include "GLee.h"
-#else
-#include <GLES2/gl2.h>
-#endif
-#endif
-
#include "sludge/allfiles.h"
#include "sludge/cursors.h"
#include "sludge/colours.h"
diff --git a/engines/sludge/debug.cpp b/engines/sludge/debug.cpp
index e79571a834..cbeb9967fb 100644
--- a/engines/sludge/debug.cpp
+++ b/engines/sludge/debug.cpp
@@ -20,10 +20,6 @@
*
*/
-#if 0
-#include <stdarg.h>
-#endif
-
#include "sludge/allfiles.h"
#include "sludge/debug.h"
#include "sludge/language.h"
diff --git a/engines/sludge/fileset.cpp b/engines/sludge/fileset.cpp
index 2c4216d4de..0a68f7a5b2 100644
--- a/engines/sludge/fileset.cpp
+++ b/engines/sludge/fileset.cpp
@@ -19,13 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
-#if 0
-#include <errno.h>
-#include <stdint.h>
-#include <string.h>
-// For unicode conversion
-#include <iconv.h>
-#endif
#include "common/file.h"
#include "common/debug.h"
@@ -44,7 +37,7 @@ bool sliceBusy = true;
Common::File *bigDataFile = NULL;
-uint32_t startOfDataIndex, startOfTextIndex, startOfSubIndex, startOfObjectIndex;
+uint32 startOfDataIndex, startOfTextIndex, startOfSubIndex, startOfObjectIndex;
bool openSubSlice(int num) {
// FILE * dbug = fopen ("debuggy.txt", "at");
diff --git a/engines/sludge/floor.h b/engines/sludge/floor.h
index 193b6d19bf..1b212fa73b 100644
--- a/engines/sludge/floor.h
+++ b/engines/sludge/floor.h
@@ -22,10 +22,6 @@
#ifndef SLUDGE_FLOOR_H
#define SLUDGE_FLOOR_H
-#ifdef _WIN32
-#include "windef.h"
-#endif
-
namespace Sludge {
struct floorPolygon {
@@ -33,12 +29,10 @@ struct floorPolygon {
int *vertexID;
};
-#ifndef _WIN32
struct POINT {
int x;
int y;
};
-#endif
struct flor {
int originalNum;
diff --git a/engines/sludge/graphics.cpp b/engines/sludge/graphics.cpp
index e48ad8c2ee..29cc47fd8d 100644
--- a/engines/sludge/graphics.cpp
+++ b/engines/sludge/graphics.cpp
@@ -19,21 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
-#if 0
-#include <stdarg.h>
-
-#include <SDL/SDL.h>
-
-#if !defined(HAVE_GLES2)
-#ifdef _WIN32
-#include <GL\glu.h> // handy for gluErrorString
-#elif defined __APPLE__
-#include <OpenGL/glu.h>
-#else
-#include <GL/glu.h>
-#endif
-#endif
-#endif
#include "sludge/allfiles.h"
#include "sludge/debug.h"
@@ -364,62 +349,6 @@ void saveTexture(GLuint tex, GLubyte *data) {
glViewport(old_vp[0], old_vp[1], old_vp[2], old_vp[3]);
glBindFramebuffer(GL_FRAMEBUFFER, old_fbo);
}
-#elif defined _WIN32
-// Replacement for glGetTexImage, because some ATI drivers are buggy.
-void saveTexture(GLuint tex, GLubyte *data) {
- setPixelCoords(true);
-
- glBindTexture(GL_TEXTURE_2D, tex);
-
- GLint tw, th;
- getTextureDimensions(tex, &tw, &th);
-
- //glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- 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.f,
- (GLfloat)tw - xoffset, (GLfloat) - yoffset, 0.f,
- (GLfloat) - xoffset, (GLfloat) - yoffset + th, 0.f,
- (GLfloat)tw - xoffset, (GLfloat) - yoffset + th, 0.f
- };
-
- const GLfloat texCoords[] = {
- 0.0f, 0.0f,
- 1.0f, 0.0f,
- 0.0f, 1.0f,
- 1.0f, 1.0f
- };
-
- 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_RGBA, GL_UNSIGNED_BYTE, data + xoffset * 4 + (yoffset + i) * 4 * tw);
- }
-
- yoffset += viewportHeight;
- }
-
- xoffset += viewportWidth;
- }
- //glReadPixels(viewportOffsetX, viewportOffsetY, tw, th, GL_RGBA, GL_UNSIGNED_BYTE, data);
-
- setPixelCoords(false);
-
-}
#else
#if 0
void saveTexture(GLuint tex, GLubyte *data) {
diff --git a/engines/sludge/graphics.h b/engines/sludge/graphics.h
index 5d2bb9a098..b6d82ab47f 100644
--- a/engines/sludge/graphics.h
+++ b/engines/sludge/graphics.h
@@ -22,15 +22,6 @@
#ifndef SLUDGE_GRAPHICS_H
#define SLUDGE_GRAPHICS_H
-#if 0
-#if !defined(HAVE_GLES2)
-#include "GLee.h"
-#else
-#include <GLES2/gl2.h>
-#include "eglport/eglport.h"
-#endif
-#endif
-
#include "graphics/surface.h"
namespace Sludge {
diff --git a/engines/sludge/language.cpp b/engines/sludge/language.cpp
index d06dda3903..1aff3942fc 100644
--- a/engines/sludge/language.cpp
+++ b/engines/sludge/language.cpp
@@ -70,11 +70,7 @@ char *getPrefsFilename(char *filename) {
char *f = filename;
for (i = 0; i < n; i++) {
-#ifdef _WIN32
- if (filename[i] == '\\')
-#else
if (filename[i] == '/')
-#endif
f = filename + i + 1;
}
diff --git a/engines/sludge/libwebm/mkvreader.cpp b/engines/sludge/libwebm/mkvreader.cpp
index 5ead48718b..4cae468d0d 100644
--- a/engines/sludge/libwebm/mkvreader.cpp
+++ b/engines/sludge/libwebm/mkvreader.cpp
@@ -15,6 +15,7 @@
#include <cassert>
#include <stdio.h>
+#if 0
MkvReader::MkvReader() :
m_file(0)
{
@@ -116,3 +117,4 @@ int MkvReader::Read(long long offset, long len, unsigned char* buffer)
return 0; //success
}
+#endif
diff --git a/engines/sludge/libwebm/mkvreader.hpp b/engines/sludge/libwebm/mkvreader.hpp
index 6be9e16aac..b46ef7821a 100644
--- a/engines/sludge/libwebm/mkvreader.hpp
+++ b/engines/sludge/libwebm/mkvreader.hpp
@@ -16,6 +16,7 @@
class MkvReader : public mkvparser::IMkvReader
{
+#if 0
MkvReader(const MkvReader&);
MkvReader& operator=(const MkvReader&);
public:
@@ -32,6 +33,7 @@ private:
long long m_length;
unsigned int m_start;
int m_file;
+#endif
};
#endif //MKVREADER_HPP
diff --git a/engines/sludge/line.cpp b/engines/sludge/line.cpp
index b041884a51..2262d9255f 100644
--- a/engines/sludge/line.cpp
+++ b/engines/sludge/line.cpp
@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
-#if 0
-#include <stdlib.h>
-#endif
#include "sludge/graphics.h"
#include "sludge/allfiles.h"
diff --git a/engines/sludge/linuxstuff.cpp b/engines/sludge/linuxstuff.cpp
deleted file mode 100644
index 84f3bc0f38..0000000000
--- a/engines/sludge/linuxstuff.cpp
+++ /dev/null
@@ -1,230 +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.
- *
- */
-#if defined __unix__ && !(defined __APPLE__)
-#include <iostream>
-#include <fstream>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <getopt.h>
-
-#include "linuxstuff.h"
-#include "platform-dependent.h"
-#include "allfiles.h"
-#include "language.h" // for settings
-#include "debug.h"
-#include "helpers.h"
-
-namespace Sludge {
-
-extern settingsStruct gameSettings;
-cmdlineSettingsStruct cmdlineSettings;
-
-extern char **languageName;
-
-/*
- * Functions declared in linuxstuff.h:
- */
-
-void printCmdlineUsage() {
- fprintf(stdout, "OpenSLUDGE engine, usage: sludge-engine [<options>] <gamefile name>\n\n");
- fprintf(stdout, "Options:\n");
- fprintf(stdout, "-f, --fullscreen Set display mode to fullscreen\n");
- fprintf(stdout, "-w, --window Set display mode to windowed\n");
- fprintf(stdout, "-L, --list-languages Print available languages and their indices\n");
- fprintf(stdout, "-l<index>, --language=<index> Set language to <index> (look up with -L)\n");
- fprintf(stdout, "-a<number>, --antialias=<number> Turn antialiasing on (1) or off (0)\n");
- fprintf(stdout, " or choose linear interpolation (-1)\n");
- fprintf(stdout, "-d<number>, --debug=<number> Turn debug mode on (1) or off (0)\n");
- fprintf(stdout, "-h, --help Print this help message\n\n");
- fprintf(stdout, "Options are saved, so you don't need to specify them every time.\n");
- fprintf(stdout, "If you entered a wrong language number, use -l0 to reset the language to the default setting.\n");
- fprintf(stdout, "You can always toggle between fullscreen and windowed mode with \"Alt+Enter\"\n");
- fprintf(stdout, "or antialiasing on and off with \"Alt+A\".\n");
-}
-
-void printLanguageTable() {
- if (gameSettings.numLanguages) {
- fprintf(stdout, "Index Language\n");
- for (unsigned int i = 0; i <= gameSettings.numLanguages; i++) {
- if (languageName[i]) {
- fprintf(stdout, "%d %s\n", i, languageName[i]);
- } else {
- fprintf(stdout, "%d Language %d\n", i, i);
- }
- }
- } else {
- fprintf(stdout, "No translations available.\n");
- }
-}
-
-bool parseCmdlineParameters(int argc, char *argv[]) {
- int retval = true;
- cmdlineSettings.fullscreenSet = false;
- cmdlineSettings.languageSet = false;
- cmdlineSettings.aaSet = false;
- cmdlineSettings.debugModeSet = false;
- cmdlineSettings.listLanguages = false;
- while (1) {
- static struct option long_options[] = {
- {"fullscreen", no_argument, 0, 'f' },
- {"window", no_argument, 0, 'w' },
- {"list-languages", no_argument, 0, 'L' },
- {"language", required_argument, 0, 'l' },
- {"antialias", required_argument, 0, 'a' },
- {"debug", required_argument, 0, 'd' },
- {"help", no_argument, 0, 'h' },
- {0, 0, 0, 0} /* This is a filler for -1 */
- };
- int option_index = 0;
- int c = getopt_long(argc, argv, "fwLl:a:d:h", long_options, &option_index);
- if (c == -1) break;
- switch (c) {
- case 'f':
- cmdlineSettings.fullscreenSet = true;
- cmdlineSettings.userFullScreen = true;
- break;
- case 'w':
- cmdlineSettings.fullscreenSet = true;
- cmdlineSettings.userFullScreen = false;
- break;
- case 'L':
- cmdlineSettings.listLanguages = true;
- break;
- case 'l':
- cmdlineSettings.languageSet = true;
- cmdlineSettings.languageID = atoi(optarg);
- break;
- case 'a':
- cmdlineSettings.aaSet = true;
- cmdlineSettings.antiAlias = atoi(optarg);
- break;
- case 'd':
- cmdlineSettings.debugModeSet = true;
- cmdlineSettings.debugMode = atoi(optarg);
- break;
- case 'h':
- default:
- retval = false;
- break;
- }
- }
- return retval;
-}
-
-/*
- * Functions declared in platform-dependent.h:
- */
-
-char *grabFileName() {
- return NULL;
-}
-
-int showSetupWindow() {
- if (cmdlineSettings.listLanguages) {
- printLanguageTable();
- return 0;
- }
- if (cmdlineSettings.languageSet) {
- if (cmdlineSettings.languageID <= gameSettings.numLanguages) {
- gameSettings.languageID = cmdlineSettings.languageID;
- } else {
- fprintf(stdout, "Language index %d doesn't exist. Please specify an index between 0 and %d.\n\n",
- cmdlineSettings.languageID, gameSettings.numLanguages);
- printLanguageTable();
- return 0;
- }
- }
- if (cmdlineSettings.fullscreenSet) {
- gameSettings.userFullScreen = cmdlineSettings.userFullScreen;
- }
- if (cmdlineSettings.aaSet) {
- gameSettings.antiAlias = cmdlineSettings.antiAlias;
- }
- if (cmdlineSettings.debugModeSet) {
- gameSettings.debugMode = cmdlineSettings.debugMode;
- }
- return 1;
-}
-
-void msgBox(const char *head, const char *msg) {
- fprintf(stderr, "%s\n%s\n", head, msg);
-}
-
-int msgBoxQuestion(const char *head, const char *msg) {
- return 1;
-}
-
-void changeToUserDir() {
- if (chdir(getenv("HOME"))) {
- debugOut("Error: Failed changing to directory %s\n", getenv("HOME"));
- }
- mkdir(".sludge-engine", 0000777);
- if (chdir(".sludge-engine")) {
- debugOut("Error: Failed changing to directory %s\n", ".sludge-engine");
- }
-}
-
-uint32 launch(char *filename) {
- debugOut("Trying to launch: %s\n", filename);
-
- if (!fileExists("/usr/bin/xdg-open")) {
- debugOut("Launching failed due to missing /usr/bin/xdg-open.\n");
- return 0;
- }
-
- if (!(filename[0] == 'h' &&
- filename[1] == 't' &&
- filename[2] == 't' &&
- filename[3] == 'p' &&
- (filename[4] == ':' || (filename[4] == 's' && filename[5] == ':'))) &&
- !fileExists(filename)) {
- return 0;
- }
-
- int status;
-
- pid_t pid = fork();
- if (pid < 0) {
- return 0;
- } else if (pid == 0) {
- execl("/usr/bin/xdg-open", "xdg-open", filename, (char *)0);
- exit(EXIT_FAILURE);
- } else {
- waitpid(pid, &status, 0);
- }
-
- if (status == EXIT_SUCCESS) {
- return 69;
- } else {
- return 0;
- }
-}
-
-bool defaultUserFullScreen() {
- return false;
-}
-
-} // End of namespace Sludge
-
-#endif
diff --git a/engines/sludge/linuxstuff.h b/engines/sludge/linuxstuff.h
deleted file mode 100644
index b97c7bf7fc..0000000000
--- a/engines/sludge/linuxstuff.h
+++ /dev/null
@@ -1,44 +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_LINUXSTUFF_H
-#define SLUDGE_LINUXSTUFF_H
-
-namespace Sludge {
-
-struct cmdlineSettingsStruct {
- bool languageSet;
- unsigned int languageID;
- bool fullscreenSet;
- bool userFullScreen;
- bool aaSet;
- int antiAlias;
- bool debugModeSet;
- bool debugMode;
- bool listLanguages;
-};
-
-void printCmdlineUsage();
-bool parseCmdlineParameters(int argc, char *argv[]);
-
-} // End of namespace Sludge
-
-#endif
diff --git a/engines/sludge/main_loop.cpp b/engines/sludge/main_loop.cpp
index 143d84f05d..ebeedf974b 100644
--- a/engines/sludge/main_loop.cpp
+++ b/engines/sludge/main_loop.cpp
@@ -19,38 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
-#if defined __unix__ && !(defined __APPLE__)
-#include "linuxstuff.h"
-#endif
-
-#if 0
-#ifdef _WIN32
-#include "winstuff.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <unistd.h>
-
-#include <iostream>
-
-#include <stdexcept>
-
-#include <time.h>
-#include <sys/time.h>
-
-#if !defined(HAVE_GLES2)
-#include "GLee.h"
-#else
-#include <GLES2/gl2.h>
-#include "eglport/eglport.h"
-#endif
-
-#include <SDL/SDL.h>
-#include <SDL/SDL_syswm.h>
-#endif
#include "common/debug.h"
@@ -81,12 +49,6 @@
namespace Sludge {
-#ifdef _WIN32
-#define PATHSLASH '\\'
-#else
-#define PATHSLASH '/'
-#endif
-
extern bool runningFullscreen;
#ifndef MAX_PATH
@@ -148,10 +110,6 @@ void saveHSI(Common::WriteStream *writer);
extern bool reallyWantToQuit;
-#ifdef _WIN32
-#undef main
-#endif
-
int weAreDoneSoQuit;
void checkInput() {
@@ -426,13 +384,6 @@ int main_loop(char *filename)
setupOpenGLStuff();
#endif
-#ifdef _WIN32
- SDL_SysWMinfo wmInfo;
- SDL_VERSION(&wmInfo.version);
- SDL_GetWMInfo(&wmInfo);
- hMainWindow = wmInfo.window;
-#endif
-
registerWindowForFatal();
if (!killResizeBackdrop(winWidth, winHeight))
diff --git a/engines/sludge/module.mk b/engines/sludge/module.mk
index 726cd6b115..b0913617a1 100644
--- a/engines/sludge/module.mk
+++ b/engines/sludge/module.mk
@@ -42,10 +42,9 @@ MODULE_OBJS := \
variable.o \
zbuffer.o \
CommonCode/utf8.o \
-# linuxstuff.o \
- shaders.o \
- libwebm/mkvparser.o \
- libwebm/mkvreader.o \
+# shaders.o \
+# libwebm/mkvparser.o \
+# libwebm/mkvreader.o \
MODULE_DIRS += \
engines/sludge
diff --git a/engines/sludge/moreio.cpp b/engines/sludge/moreio.cpp
index 7dca5a6f2b..f76b919e1b 100644
--- a/engines/sludge/moreio.cpp
+++ b/engines/sludge/moreio.cpp
@@ -188,12 +188,8 @@ char *encodeFilename(char *nameIn) {
} else {
int a;
for (a = 0; nameIn[a]; a++) {
-#ifdef _WIN32
- if (nameIn[a] == '/') nameIn[a] = '\\';
-#else
if (nameIn[a] == '\\')
nameIn[a] = '/';
-#endif
}
return copyString(nameIn);
diff --git a/engines/sludge/newfatal.cpp b/engines/sludge/newfatal.cpp
index c00476de00..bc97d6a610 100644
--- a/engines/sludge/newfatal.cpp
+++ b/engines/sludge/newfatal.cpp
@@ -114,6 +114,7 @@ int inFatal(const char *str) {
atexit(displayFatal);
exit(1);
#endif
+ return true;
}
int checkNew(const void *mem) {
diff --git a/engines/sludge/people.h b/engines/sludge/people.h
index 442cb925ca..45ba55a233 100644
--- a/engines/sludge/people.h
+++ b/engines/sludge/people.h
@@ -22,6 +22,8 @@
#ifndef SLUDGE_PEOPLE_H
#define SLUDGE_PEOPLE_H
+#include "sludge/variable.h"
+
namespace Sludge {
struct animFrame {
diff --git a/engines/sludge/shaders.h b/engines/sludge/shaders.h
index 13b6e3703c..fe31e196cf 100644
--- a/engines/sludge/shaders.h
+++ b/engines/sludge/shaders.h
@@ -22,14 +22,6 @@
#ifndef SLUDGE_SHADERS_H
#define SLUDGE_SHADERS_H
-#if 0
-#if !defined(HAVE_GLES2)
-#include "GLee.h"
-#else
-#include <GLES2/gl2.h>
-#endif
-#endif
-
namespace Sludge {
char *shaderFileRead(const char *fn);
diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp
index 3ae7c35aed..0b99d79c39 100644
--- a/engines/sludge/sludger.cpp
+++ b/engines/sludge/sludger.cpp
@@ -19,19 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
-#if 0
-#if defined __unix__ && !(defined __APPLE__)
-#include <png.h>
-#else
-#include <libpng/png.h>
-#endif
-
-#include <SDL/SDL.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <iconv.h>
-#endif
#include "common/debug.h"
@@ -457,12 +444,6 @@ bool initSludge(char *filename) {
png_set_expand(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(png_ptr);
if (bit_depth == 16) png_set_strip_16(png_ptr);
-#ifdef WIN32
- // Windows wants a BGR bitmap
- if (color_type == PNG_COLOR_TYPE_RGB ||
- color_type == PNG_COLOR_TYPE_RGB_ALPHA)
- png_set_bgr(png_ptr);
-#endif
png_set_add_alpha(png_ptr, 0xff, PNG_FILLER_AFTER);
@@ -500,16 +481,9 @@ bool initSludge(char *filename) {
n = 1;
}
while (n --) {
-#ifdef WIN32
- // Windows wants a BGR bitmap
- *p++ = (Uint8) blueValue(c);
- *p++ = (Uint8) greenValue(c);
- *p++ = (Uint8) redValue(c);
-#else
*p++ = (Uint8) redValue(c);
*p++ = (Uint8) greenValue(c);
*p++ = (Uint8) blueValue(c);
-#endif
*p++ = (Uint8) /*(c == transCol) ? 0 :*/255;
t1++;
@@ -541,11 +515,7 @@ bool initSludge(char *filename) {
#if 0
changeToUserDir();
-#ifdef _WIN32
- mkdir(gameName);
-#else
mkdir(gameName, 0000777);
-#endif
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
@@ -577,11 +547,7 @@ bool initSludge(char *filename) {
if (dataFol[0]) {
char *dataFolder = encodeFilename(dataFol);
#if 0
-#ifdef _WIN32
- mkdir(dataFolder);
-#else
mkdir(dataFolder, 0000777);
-#endif
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
diff --git a/engines/sludge/sludger.h b/engines/sludge/sludger.h
index be49276cb0..840af9e409 100644
--- a/engines/sludge/sludger.h
+++ b/engines/sludge/sludger.h
@@ -31,12 +31,10 @@
namespace Sludge {
-#ifndef _WIN32
typedef struct _FILETIME {
uint32 dwLowDateTime;
uint32 dwHighDateTime;
} FILETIME;
-#endif
struct variable;
struct variableStack;
diff --git a/engines/sludge/sound.h b/engines/sludge/sound.h
index ee1321a739..2e31943df6 100644
--- a/engines/sludge/sound.h
+++ b/engines/sludge/sound.h
@@ -23,11 +23,7 @@
#ifndef SLUDGE_SOUND_H
#define SLUDGE_SOUND_H
-#ifdef _WIN32
-#include <windows.h>
-#else
#define HWND void *
-#endif
#include "common/file.h"
diff --git a/engines/sludge/talk.cpp b/engines/sludge/talk.cpp
index 59f71aa459..162875cb8a 100644
--- a/engines/sludge/talk.cpp
+++ b/engines/sludge/talk.cpp
@@ -281,9 +281,8 @@ bool loadSpeech(speechStruct *sS, Common::SeekableReadStream *stream) {
(* viewLine) = newOne;
viewLine = &(newOne->next);
}
-
- return true;
#endif
+ return true;
}
} // End of namespace Sludge
diff --git a/engines/sludge/timing.cpp b/engines/sludge/timing.cpp
index 6bf68632d0..152d9ae776 100644
--- a/engines/sludge/timing.cpp
+++ b/engines/sludge/timing.cpp
@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
-#if 0
-#include <SDL/SDL.h>
-#endif
namespace Sludge {
diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp
index 949060c786..73e90f0b16 100644
--- a/engines/sludge/variable.cpp
+++ b/engines/sludge/variable.cpp
@@ -33,11 +33,6 @@
#include "sludge/fileset.h"
#include "sludge/sludge.h"
-#ifdef _WIN32
-#include "windows.h"
-
-#endif
-
namespace Sludge {
const char *typeName[] = { "undefined", "number", "user function", "string",
@@ -149,12 +144,6 @@ int stackSize(const stackHandler *me) {
return r;
}
-#ifdef _WIN32
-#include <windows.h>
-WCHAR *ConvertToUTF16(const char *input);
-char *ConvertFromUTF16(const WCHAR *input);
-#endif
-
bool getSavedGamesStack(stackHandler *sH, char *ext) {
char *pattern = joinStrings("*", ext);
if (!pattern)
@@ -163,33 +152,6 @@ bool getSavedGamesStack(stackHandler *sH, char *ext) {
variable newName;
newName.varType = SVT_NULL;
#if 0
-#ifdef _WIN32
-
- WCHAR *w_pattern = ConvertToUTF16(pattern);
-
- WIN32_FIND_DATA theData;
- HANDLE handle = FindFirstFile(w_pattern, & theData);
-
- delete w_pattern;
-
- if (handle != INVALID_HANDLE_VALUE) {
- bool keepGoing;
- do {
- theData.cFileName[lstrlen(theData.cFileName) - strlen(ext)] = TEXT('\0');
- char *fileName = ConvertFromUTF16(theData.cFileName);
- char *decoded = decodeFilename(fileName);
- makeTextVar(newName, decoded);
- delete fileName;
- delete decoded;
- if (! addVarToStack(newName, sH -> first)) return false;
- if (sH -> last == NULL) sH -> last = sH -> first;
- keepGoing = FindNextFile(handle, & theData);
- }while (keepGoing);
- FindClose(handle);
- }
-
-#else
-
DIR *dir = opendir(".");
if (!dir)
return false;
@@ -211,8 +173,6 @@ bool getSavedGamesStack(stackHandler *sH, char *ext) {
}
closedir(dir);
-
-#endif
#endif
delete[] pattern;
pattern = NULL;
diff --git a/engines/sludge/winstuff.cpp b/engines/sludge/winstuff.cpp
deleted file mode 100644
index dfe0a5a794..0000000000
--- a/engines/sludge/winstuff.cpp
+++ /dev/null
@@ -1,231 +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.
- *
- */
-#ifdef _WIN32
-#include <windows.h>
-#include <shellapi.h>
-
-#include "allfiles.h"
-#include "debug.h"
-
-#include "winstuff.h"
-#include "platform-dependent.h"
-#include "language.h"
-#include "newfatal.h"
-#include "sprites.h"
-#include "sprbanks.h"
-#include "fonttext.h"
-#include "backdrop.h"
-#include "sludger.h"
-#include "cursors.h"
-#include "objtypes.h"
-#include "region.h"
-#include "people.h"
-#include "talk.h"
-#include "direct.h"
-#include "sound.h"
-#include "colours.h"
-#include "moreio.h"
-#include "stringy.h"
-
-#include <shellapi.h>
-#include <shlobj.h> // For SHGetFolderPath
-
-#include "..\..\images\resource.h"
-
-namespace Sludge {
-
- HINSTANCE hInst; // Handle of the main instance
- extern HWND hMainWindow;
-
- extern variableStack *noStack;
-
-// The platform-specific functions - Windows edition.
-
- WCHAR *ConvertToUTF16(const char *input) {
- int s = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, input, -1, NULL, 0);
- WCHAR *ret = new WCHAR [s];
- checkNew(ret);
- /*int a = */MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, input, -1, ret, s);
- return ret;
- }
-
- char *ConvertFromUTF16(const WCHAR *input) {
- int s = WideCharToMultiByte(CP_UTF8, 0, input, -1, NULL, 0, NULL, NULL);
- char *ret = new char [s];
- checkNew(ret);
- /*int a = */WideCharToMultiByte(CP_UTF8, 0, input, -1, ret, s, NULL, NULL);
- return ret;
- }
-
- char *grabFileName() {
- OPENFILENAME ofn;
- WCHAR path[MAX_PATH];
- WCHAR file[MAX_PATH] = TEXT("");
-
- hInst = GetModuleHandle(NULL);
-
- memset(& ofn, 0, sizeof(ofn));
- ofn.lStructSize = sizeof(ofn);
- ofn.hwndOwner = NULL;
- ofn.hInstance = hInst;
- ofn.nMaxFile = MAX_PATH;
- ofn.lpstrInitialDir = path;
- ofn.Flags = OFN_HIDEREADONLY | OFN_EXPLORER;
- ofn.lpstrFilter = TEXT("SLUDGE games (*.SLG)\0*.slg\0\0");
- ofn.lpstrFile = file;
-
- if (GetOpenFileName(& ofn)) {
- return ConvertFromUTF16(file);
- } else {
- return NULL;
- }
- }
-
- extern char **languageName;
- extern int *languageTable;
-
- HBITMAP hLogo = NULL;
- extern unsigned char *gameLogo;
-
- BOOL CALLBACK setupDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
- switch (message) {
- case WM_INITDIALOG:
- if (gameLogo) {
- hLogo = CreateBitmap(310, 88, 1, 32, gameLogo);
- SendDlgItemMessage(hDlg, 1003, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hLogo);
- }
-
- if (gameSettings.userFullScreen)
- CheckDlgButton(hDlg, 1000, BST_CHECKED);
- else
- CheckDlgButton(hDlg, 1000, BST_UNCHECKED);
-
- SendDlgItemMessage(hDlg, 1002, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)TEXT("Default (best looking)")));
- SendDlgItemMessage(hDlg, 1002, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)TEXT("Linear (faster but blurry)")));
- SendDlgItemMessage(hDlg, 1002, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)TEXT("Off (blocky graphics)")));
-
- if (gameSettings.antiAlias < 0)
- SendDlgItemMessage(hDlg, 1002, CB_SETCURSEL, 1, 0);
- else if (gameSettings.antiAlias)
- SendDlgItemMessage(hDlg, 1002, CB_SETCURSEL, 0, 0);
- else
- SendDlgItemMessage(hDlg, 1002, CB_SETCURSEL, 2, 0);
-
- if (gameSettings.numLanguages) {
- WCHAR text[20];
- for (unsigned int i = 0; i <= gameSettings.numLanguages; i++) {
- if (languageName[i]) {
- WCHAR *w_lang = ConvertToUTF16(languageName[i]);
- SendDlgItemMessage(hDlg, 1001, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)w_lang));
- delete w_lang;
- } else {
- swprintf(text, TEXT("Language %d"), i);
- SendDlgItemMessage(hDlg, 1001, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)text));
- }
- }
- SendDlgItemMessage(hDlg, 1001, CB_SETCURSEL, getLanguageForFileB(), 0);
- } else {
- const WCHAR *text = TEXT("No translations available");
- SendDlgItemMessage(hDlg, 1001, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)text));
- SendDlgItemMessage(hDlg, 1001, CB_SETCURSEL, 0, 0);
- EnableWindow(GetDlgItem(hDlg, 1001), false);
- }
- return true;
-
- case WM_COMMAND:
- if (hLogo) DeleteObject(hLogo);
- switch (LOWORD(wParam)) {
- case IDOK:
-
- gameSettings.userFullScreen = (IsDlgButtonChecked(hDlg, 1000) == BST_CHECKED);
- gameSettings.antiAlias = SendDlgItemMessage(hDlg, 1002, CB_GETCURSEL, 0, 0);
- if (gameSettings.antiAlias == 0) gameSettings.antiAlias = 1;
- else if (gameSettings.antiAlias == 1) gameSettings.antiAlias = -1;
- else if (gameSettings.antiAlias == 2) gameSettings.antiAlias = 0;
-
- if (gameSettings.numLanguages) {
- gameSettings.languageID = SendDlgItemMessage(hDlg, 1001, CB_GETCURSEL, 0, 0);
- if (gameSettings.languageID < 0) gameSettings.languageID = 0;
- gameSettings.languageID = languageTable[gameSettings.languageID];
- }
- EndDialog(hDlg, true);
- return TRUE;
-
- case IDCANCEL:
- EndDialog(hDlg, false);
- return TRUE;
- }
- break;
- }
- return false;
- }
-
- int showSetupWindow() {
-
- hInst = GetModuleHandle(NULL);
-
- if (! hInst) debugOut("ERROR: No hInst!\n");
-
- if (DialogBox(hInst, TEXT("SETUPWINDOW"), NULL, setupDlgProc)) return true;
- return false;
-
- }
-
- void msgBox(const char *head, const char *msg) {
- WCHAR *w_head = ConvertToUTF16(head);
- WCHAR *w_msg = ConvertToUTF16(msg);
- MessageBox(NULL, w_msg, w_head, MB_OK | MB_ICONSTOP | MB_SYSTEMMODAL | MB_SETFOREGROUND);
- delete w_head;
- delete w_msg;
- }
-
- int msgBoxQuestion(const char *head, const char *msg) {
- WCHAR *w_head = ConvertToUTF16(head);
- WCHAR *w_msg = ConvertToUTF16(msg);
- int val = MessageBox(NULL, w_msg, w_head, MB_YESNO | MB_SETFOREGROUND | MB_APPLMODAL | MB_ICONQUESTION) == IDNO;
- delete w_head;
- delete w_msg;
- if (val)
- return false;
- return true;
- }
-
- void changeToUserDir() {
- TCHAR szAppData[MAX_PATH];
- /*hr = */SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szAppData);
- _wchdir(szAppData);
- }
-
- uint32 launch(char *f) {
- WCHAR *w_f = ConvertToUTF16(f);
- uint32 r = (uint32) ShellExecute(hMainWindow, TEXT("open"), w_f, NULL, TEXT("C:\\"), SW_SHOWNORMAL);
- delete w_f;
- return r;
- }
-
- bool defaultUserFullScreen() {
- return true;
- }
-
-} // End of namespace Sludge
-
-#endif
diff --git a/engines/sludge/winstuff.h b/engines/sludge/winstuff.h
deleted file mode 100644
index 4a0cbbeb4c..0000000000
--- a/engines/sludge/winstuff.h
+++ /dev/null
@@ -1,43 +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_WINSTUFF_H
-#define SLUDGE_WINSTUFF_H
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-namespace Sludge {
-
-#ifndef _WIN32
-#ifndef HINSTANCE
-#define HINSTANCE int
-#endif
-#endif
-
-void setWindowName(const char *tx);
-bool InitApplication(HINSTANCE hInstance);
-bool InitInstance(HINSTANCE hInstance, const char *);
-
-} // End of namespace Sludge
-
-#endif
diff --git a/engines/sludge/zbuffer.h b/engines/sludge/zbuffer.h
index 46510ece71..bb0b2ed9d8 100644
--- a/engines/sludge/zbuffer.h
+++ b/engines/sludge/zbuffer.h
@@ -22,14 +22,6 @@
#ifndef SLUDGE_ZBUFFER_H
#define SLUDGE_ZBUFFER_H
-#if 0
-#if !defined(HAVE_GLES2)
-#include "GLee.h"
-#else
-#include <GLES2/gl2.h>
-#endif
-#endif
-
namespace Sludge {
struct zBufferData {