From c4a5af22eac930b5ed8e04fede2b9e61a76ca5d6 Mon Sep 17 00:00:00 2001 From: yinsimei Date: Fri, 26 May 2017 21:25:11 +0200 Subject: SLUDGE: Add namespace --- engines/sludge/allfiles.h | 5 +++++ engines/sludge/backdrop.cpp | 26 ++++++++++++++------------ engines/sludge/backdrop.h | 6 +++++- engines/sludge/bg_effects.cpp | 4 ++++ engines/sludge/bg_effects.h | 4 ++++ engines/sludge/builtin.cpp | 9 +++++++-- engines/sludge/builtin.h | 4 ++++ engines/sludge/colours.h | 4 ++++ engines/sludge/csludge.h | 4 ++++ engines/sludge/cursors.cpp | 4 ++++ engines/sludge/cursors.h | 4 ++++ engines/sludge/debug.cpp | 6 +++++- engines/sludge/debug.h | 4 ++++ engines/sludge/errors.h | 4 ++++ engines/sludge/fileset.cpp | 3 +++ engines/sludge/fileset.h | 4 ++++ engines/sludge/floor.cpp | 4 ++++ engines/sludge/floor.h | 4 ++++ engines/sludge/fonttext.cpp | 4 ++++ engines/sludge/fonttext.h | 4 ++++ engines/sludge/freeze.cpp | 4 ++++ engines/sludge/freeze.h | 3 +++ engines/sludge/graphics.cpp | 4 ++++ engines/sludge/graphics.h | 4 ++++ engines/sludge/helpers.cpp | 4 ++++ engines/sludge/helpers.h | 4 ++++ engines/sludge/language.cpp | 4 ++++ engines/sludge/language.h | 4 ++++ engines/sludge/line.cpp | 4 ++++ engines/sludge/line.h | 4 ++++ engines/sludge/linuxstuff.cpp | 5 +++++ engines/sludge/linuxstuff.h | 4 ++++ engines/sludge/loadsave.cpp | 12 ++++++++---- engines/sludge/loadsave.h | 4 ++++ engines/sludge/main_loop.cpp | 3 +++ engines/sludge/main_loop.h | 4 ++++ engines/sludge/memwatch.cpp | 5 ++++- engines/sludge/memwatch.h | 4 ++++ engines/sludge/moreio.cpp | 7 ++++--- engines/sludge/moreio.h | 4 ++++ engines/sludge/movie.cpp | 4 ++++ engines/sludge/movie.h | 5 +++++ engines/sludge/newfatal.cpp | 12 +++++++----- engines/sludge/newfatal.h | 4 ++++ engines/sludge/objtypes.cpp | 4 ++++ engines/sludge/objtypes.h | 5 +++++ engines/sludge/people.cpp | 4 ++++ engines/sludge/people.h | 5 +++++ engines/sludge/platform-dependent.h | 4 ++++ engines/sludge/region.cpp | 4 ++++ engines/sludge/region.h | 4 ++++ engines/sludge/savedata.cpp | 4 ++++ engines/sludge/savedata.h | 4 ++++ engines/sludge/shaders.cpp | 8 ++++---- engines/sludge/shaders.h | 4 ++++ engines/sludge/sludge.cpp | 1 + engines/sludge/sludge.h | 3 ++- engines/sludge/sludger.cpp | 27 ++++++++++++++++++--------- engines/sludge/sludger.h | 11 +++++++++-- engines/sludge/sound.h | 14 +++++++++++--- engines/sludge/sound_bass.cpp | 5 +++-- engines/sludge/sound_nosound.cpp | 6 ++++-- engines/sludge/sound_openal.cpp | 4 ++++ engines/sludge/sprbanks.cpp | 4 ++++ engines/sludge/sprbanks.h | 4 ++++ engines/sludge/sprites.cpp | 5 +++-- engines/sludge/sprites.h | 4 ++++ engines/sludge/statusba.cpp | 4 ++++ engines/sludge/statusba.h | 4 ++++ engines/sludge/stringy.cpp | 11 +++++++++-- engines/sludge/stringy.h | 4 ++++ engines/sludge/talk.cpp | 7 ++++--- engines/sludge/talk.h | 5 +++++ engines/sludge/thumbnail.cpp | 6 ++++-- engines/sludge/thumbnail.h | 5 +++++ engines/sludge/timing.cpp | 3 +++ engines/sludge/timing.h | 4 ++++ engines/sludge/transition.cpp | 7 ++++--- engines/sludge/transition.h | 4 ++++ engines/sludge/variable.cpp | 8 ++++---- engines/sludge/variable.h | 6 ++++++ engines/sludge/vid.cpp | 4 ++++ engines/sludge/vid.h | 4 ++++ engines/sludge/winstuff.cpp | 5 +++++ engines/sludge/winstuff.h | 4 ++++ engines/sludge/zbuffer.cpp | 3 +++ engines/sludge/zbuffer.h | 3 +++ 87 files changed, 398 insertions(+), 68 deletions(-) (limited to 'engines') diff --git a/engines/sludge/allfiles.h b/engines/sludge/allfiles.h index 9478da56ee..a08df72673 100644 --- a/engines/sludge/allfiles.h +++ b/engines/sludge/allfiles.h @@ -27,6 +27,11 @@ //#define debuggy2 int #define IN_THE_CENTRE 65535 + +namespace Sludge { + typedef unsigned char byte; +} // End of namespace Sludge + #endif diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp index ed7177035e..bb840b3497 100644 --- a/engines/sludge/backdrop.cpp +++ b/engines/sludge/backdrop.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ - #if 0 #if defined __unix__ && !(defined __APPLE__) #include @@ -54,11 +53,12 @@ #include "talk.h" #include "sludger.h" #include "statusba.h" - +#include "variable.h" #include "CommonCode/version.h" -extern inputType input; +namespace Sludge { +extern inputType input; bool freeze(); void unfreeze(bool); // Because FREEZE.H needs a load of other includes @@ -96,7 +96,7 @@ void nosnapshot() { #endif } -#if ALLOW_FILE +#if 0 void saveSnapshot(FILE *fp) { if (snapshotTextureName) { fputc(1, fp); // 1 for snapshot follows @@ -157,7 +157,7 @@ bool snapshot() { return true; } -#if ALLOW_FILE +#if 0 bool restoreSnapshot(FILE *fp) { unsigned int picWidth = get2bytes(fp); unsigned int picHeight = get2bytes(fp); @@ -304,7 +304,7 @@ bool resizeBackdrop(int x, int y) { void loadBackDrop(int fileNum, int x, int y) { setResourceForFatal(fileNum); -#if ALLOW_FILE +#if 0 if (! openFileFromNum(fileNum)) { fatal("Can't load overlay image"); return; @@ -322,7 +322,7 @@ void loadBackDrop(int fileNum, int x, int y) { } void mixBackDrop(int fileNum, int x, int y) { -#if ALLOW_FILE +#if 0 setResourceForFatal(fileNum); if (! openFileFromNum(fileNum)) { fatal("Can't load overlay image"); @@ -623,7 +623,7 @@ void drawBackDrop() { bool loadLightMap(int v) { int newPicWidth, newPicHeight; -#if ALLOW_FILE +#if 0 setResourceForFatal(v); if (! openFileFromNum(v)) return fatal("Can't open light map."); long file_pointer = ftell(bigDataFile); @@ -764,9 +764,9 @@ bool loadLightMap(int v) { 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); -#endif - texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, newPicWidth, newPicHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, lightMap.data, lightMap.name); + texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, newPicWidth, newPicHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, lightMap.data, lightMap.name); +#endif finishAccess(); #endif @@ -816,7 +816,7 @@ void reloadParallaxTextures() { bool loadParallax(unsigned short v, unsigned short fracX, unsigned short fracY) { -#if ALLOW_FILE +#if 0 setResourceForFatal(v); if (! openFileFromNum(v)) return fatal("Can't open parallax image"); @@ -1004,7 +1004,7 @@ bool loadParallax(unsigned short v, unsigned short fracX, unsigned short fracY) extern int viewportOffsetX, viewportOffsetY; -#if ALLOW_FILE +#if 0 bool loadHSI(FILE *fp, int x, int y, bool reserve) { int t1, t2, n; @@ -1751,3 +1751,5 @@ bool getRGBIntoStack(unsigned int x, unsigned int y, stackHandler *sH) { #endif return true; } + +} // End of namespace Sludge diff --git a/engines/sludge/backdrop.h b/engines/sludge/backdrop.h index 97d3377504..5dd2014ddc 100644 --- a/engines/sludge/backdrop.h +++ b/engines/sludge/backdrop.h @@ -34,6 +34,8 @@ #include "variable.h" #include "graphics.h" +namespace Sludge { + enum { LIGHTMAPMODE_NONE = -1, LIGHTMAPMODE_HOTSPOT, @@ -65,7 +67,7 @@ void mixBackDrop(int fileNum, int x, int y); void drawBackDrop(); void blankScreen(int x1, int y1, int x2, int y2); void darkScreen(); -#if ALLOW_FILE +#if 0 void saveHSI(FILE *writer); void saveCoreHSI(FILE *writer, GLuint texture, int w, int h); bool loadHSI(FILE *fp, int, int, bool); @@ -101,3 +103,5 @@ void saveSnapshot(FILE *fp); bool restoreSnapshot(FILE *fp); #endif #endif + +} // End of namespace Sludge diff --git a/engines/sludge/bg_effects.cpp b/engines/sludge/bg_effects.cpp index ad6438b8a6..0a8550e01f 100644 --- a/engines/sludge/bg_effects.cpp +++ b/engines/sludge/bg_effects.cpp @@ -28,6 +28,8 @@ #include "newfatal.h" #include "moreio.h" +namespace Sludge { + #if 0 //extern unsigned short int * * backDropImage; extern GLuint backdropTextureName; @@ -373,3 +375,5 @@ bool blurScreen() { #endif return false; } + +} // End of namespace Sludge diff --git a/engines/sludge/bg_effects.h b/engines/sludge/bg_effects.h index 067fa8d92e..d18fae6b20 100644 --- a/engines/sludge/bg_effects.h +++ b/engines/sludge/bg_effects.h @@ -23,6 +23,8 @@ #ifndef SLUDGE_BG_EFFECTS_H #define SLUDGE_BG_EFFECTS_H +namespace Sludge { + bool blurScreen(); #if ALLOW_FILE void blur_saveSettings(FILE *fp); @@ -30,4 +32,6 @@ void blur_loadSettings(FILE *fp); #endif bool blur_createSettings(int numParams, variableStack *&stack); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp index 9ba633de65..6f2660db0d 100644 --- a/engines/sludge/builtin.cpp +++ b/engines/sludge/builtin.cpp @@ -56,6 +56,8 @@ #include "graphics.h" #include "CommonCode/utf8.h" +namespace Sludge { + extern char *gamePath; int speechMode = 0; @@ -308,7 +310,7 @@ builtIn(fileExists) { char *aaaaa = encodeFilename(loadNow); delete loadNow; if (failSecurityCheck(aaaaa)) return BR_ERROR; -#if ALLOW_FILE +#if 0 FILE *fp = fopen(aaaaa, "rb"); if (!fp) { char currentDir[1000]; @@ -324,8 +326,10 @@ builtIn(fileExists) { debugOut("Error: Failed changing to directory %s\n", currentDir); } } +#endif // Return value - setVariable(fun -> reg, SVT_INT, (fp != NULL)); + setVariable(fun -> reg, SVT_INT, 0/*(fp != NULL)*/);//TODO:false value +#if 0 if (fp) fclose(fp); delete[] aaaaa; loadNow = NULL; @@ -2543,3 +2547,4 @@ builtReturn callBuiltIn(int whichFunc, int numParams, loadedFunction *fun) { return BR_ERROR; } +} // End of namespace Sludge diff --git a/engines/sludge/builtin.h b/engines/sludge/builtin.h index 8f5ac5972e..00d780e18b 100644 --- a/engines/sludge/builtin.h +++ b/engines/sludge/builtin.h @@ -23,9 +23,13 @@ #ifndef SLUDGE_BUILTIN_H #define SLUDGE_BUILTIN_H +namespace Sludge { + enum builtReturn {BR_KEEP_AND_PAUSE, BR_ERROR, BR_CONTINUE, BR_PAUSE, BR_CALLAFUNC, BR_ALREADY_GONE}; bool failSecurityCheck(char *fn); builtReturn callBuiltIn(int whichFunc, int numParams, loadedFunction *fun); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/colours.h b/engines/sludge/colours.h index 503823fa27..2caf963590 100644 --- a/engines/sludge/colours.h +++ b/engines/sludge/colours.h @@ -23,6 +23,8 @@ #ifndef SLUDGE_COLOURS_H #define SLUDGE_COLOURS_H +namespace Sludge { + // Simple colour conversion routines to deal with 16-bit graphics //unsigned short int makeColour (byte r, byte g, byte b); @@ -44,4 +46,6 @@ inline unsigned short makeColour(unsigned short int r, unsigned short int g, uns return ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); } +} // End of namespace Sludge + #endif diff --git a/engines/sludge/csludge.h b/engines/sludge/csludge.h index 3c73a9d10a..22b6125ff0 100644 --- a/engines/sludge/csludge.h +++ b/engines/sludge/csludge.h @@ -23,6 +23,8 @@ #ifndef SLUDGE_CSLUDGE_H #define SLUDGE_CSLUDGE_H +namespace Sludge { + enum sludgeCommand {SLU_UNKNOWN, SLU_RETURN, SLU_BRANCH, SLU_BR_ZERO, SLU_SET_GLOBAL, SLU_SET_LOCAL, SLU_LOAD_GLOBAL, SLU_LOAD_LOCAL, @@ -40,4 +42,6 @@ enum sludgeCommand {SLU_UNKNOWN, numSludgeCommands }; +} // End of namespace Sludge + #endif diff --git a/engines/sludge/cursors.cpp b/engines/sludge/cursors.cpp index 6ad3a35906..91d0112ab5 100644 --- a/engines/sludge/cursors.cpp +++ b/engines/sludge/cursors.cpp @@ -36,6 +36,8 @@ #include "people.h" #include "sludger.h" +namespace Sludge { + personaAnimation *mouseCursorAnim; int mouseCursorFrameNum = 0; int mouseCursorCountUp = 0; @@ -84,3 +86,5 @@ void pasteCursor(int x, int y, personaAnimation *c) { c -> theSprites -> bank.sprites[c -> frames[0].frameNum], c -> theSprites -> bank.myPalette); } + +} // End of namespace Sludge diff --git a/engines/sludge/cursors.h b/engines/sludge/cursors.h index 9c803fc7db..6a32665511 100644 --- a/engines/sludge/cursors.h +++ b/engines/sludge/cursors.h @@ -23,8 +23,12 @@ #ifndef SLUDGE_CURSORS_H #define SLUDGE_CURSORS_H +namespace Sludge { + void pickAnimCursor(struct personaAnimation *pp); void displayCursor(); void pasteCursor(int x, int y, struct personaAnimation *c); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/debug.cpp b/engines/sludge/debug.cpp index 222f411b80..3e256bd2ab 100644 --- a/engines/sludge/debug.cpp +++ b/engines/sludge/debug.cpp @@ -28,13 +28,15 @@ #include "debug.h" #include "language.h" +namespace Sludge { + void debugOut(const char *a, ...) { if (! gameSettings.debugMode) return; va_list argptr; va_start(argptr, a); -#if ALLOW_FILE +#if 0 #if defined __unix__ && !(defined __APPLE__) vfprintf(stderr, a, argptr); #else @@ -50,3 +52,5 @@ void debugOut(const char *a, ...) { void debugHeader() { debugOut("*** Engine compiled " __DATE__ " at " __TIME__ ".\n"); } + +} // End of namespace Sludge diff --git a/engines/sludge/debug.h b/engines/sludge/debug.h index 94b6c347ff..aecff42471 100644 --- a/engines/sludge/debug.h +++ b/engines/sludge/debug.h @@ -23,7 +23,11 @@ #ifndef SLUDGE_DEDBUG_H #define SLUDGE_DEGBUG_H +namespace Sludge { + void debugOut(const char *a, ...); void debugHeader(); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/errors.h b/engines/sludge/errors.h index 0c4716c3e2..f706bad83f 100644 --- a/engines/sludge/errors.h +++ b/engines/sludge/errors.h @@ -23,6 +23,8 @@ #ifndef SLUDGE_ERRRORS_H #define SLUDGE_ERRRORS_H +namespace Sludge { + #define _NO_MEMORY_GENERAL_ "\n\nTry closing down any programs you don't really need running (or freeing up a bit of disk space, which will give you more virtual memory - that should help too)." //--------------------------------------- @@ -69,4 +71,6 @@ #define WARNING_BASS_WRONG_VERSION "Incompatible version of BASS.DLL found!" #define WARNING_BASS_FAIL "Can't initialise sound engine." +} // End of namespace Sludge + #endif diff --git a/engines/sludge/fileset.cpp b/engines/sludge/fileset.cpp index 8d5eb52a94..852fd70016 100644 --- a/engines/sludge/fileset.cpp +++ b/engines/sludge/fileset.cpp @@ -35,6 +35,7 @@ #include "newfatal.h" #include "CommonCode/version.h" +namespace Sludge { bool sliceBusy = true; #if ALLOW_FILE @@ -235,3 +236,5 @@ void setFileIndices(FILE *fp, int numLanguages, unsigned int skipBefore) { // Remember that the data section starts here startOfDataIndex = ftell(fp); } + +} // End of namespace Sludge diff --git a/engines/sludge/fileset.h b/engines/sludge/fileset.h index 39a66912f1..b83e47dcf5 100644 --- a/engines/sludge/fileset.h +++ b/engines/sludge/fileset.h @@ -22,6 +22,8 @@ #ifndef SLUDGE_FILESET_H #define SLUDGE_FILESET_H +namespace Sludge { + #if ALLOW_FILE extern FILE *bigDataFile; @@ -36,4 +38,6 @@ char *getNumberedString(int value); bool startAccess(); void finishAccess(); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/floor.cpp b/engines/sludge/floor.cpp index 826632a76a..291961dc68 100644 --- a/engines/sludge/floor.cpp +++ b/engines/sludge/floor.cpp @@ -26,6 +26,8 @@ #include "floor.h" #include "line.h" +namespace Sludge { + flor *currentFloor = NULL; bool pointInFloorPolygon(floorPolygon &floorPoly, int x, int y) { @@ -288,3 +290,5 @@ bool closestPointOnLine(int &closestX, int &closestY, int x1, int y1, int x2, in } return false; } + +} // End of namespace Sludge diff --git a/engines/sludge/floor.h b/engines/sludge/floor.h index 5c0d050b0c..193b6d19bf 100644 --- a/engines/sludge/floor.h +++ b/engines/sludge/floor.h @@ -26,6 +26,8 @@ #include "windef.h" #endif +namespace Sludge { + struct floorPolygon { int numVertices; int *vertexID; @@ -54,4 +56,6 @@ int inFloor(int x, int y); bool getMatchingCorners(floorPolygon &, floorPolygon &, int &, int &); bool closestPointOnLine(int &closestX, int &closestY, int x1, int y1, int x2, int y2, int xP, int yP); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/fonttext.cpp b/engines/sludge/fonttext.cpp index 835c2a6f32..6ac9209e8d 100644 --- a/engines/sludge/fonttext.cpp +++ b/engines/sludge/fonttext.cpp @@ -36,6 +36,8 @@ #include "newfatal.h" #include "moreio.h" +namespace Sludge { + spriteBank theFont; int fontHeight = 0, numFontColours, loadedFontNum; char *fontOrderString = NULL; @@ -204,3 +206,5 @@ bool loadFont(int filenum, const char *charOrder, int h) { fontHeight = h; return true; } + +} // End of namespace Sludge diff --git a/engines/sludge/fonttext.h b/engines/sludge/fonttext.h index f33876f6f9..92520a087c 100644 --- a/engines/sludge/fonttext.h +++ b/engines/sludge/fonttext.h @@ -22,6 +22,8 @@ #ifndef SLUDGE_FONTTEXT_H #define SLUDGE_FONTTEXT_H +namespace Sludge { + bool loadFont(int filenum, const char *charOrder, int); void pasteString(char *theText, int, int, spritePalette &); void fixFont(spritePalette &spal); @@ -32,4 +34,6 @@ void pasteStringToBackdrop(char *theText, int xOff, int y, spritePalette &thePal void burnStringToBackdrop(char *theText, int xOff, int y, spritePalette &thePal); bool isInFont(char *theText); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/freeze.cpp b/engines/sludge/freeze.cpp index f245ad0501..8435a9cd1d 100644 --- a/engines/sludge/freeze.cpp +++ b/engines/sludge/freeze.cpp @@ -36,6 +36,8 @@ #include "freeze.h" #include "zbuffer.h" +namespace Sludge { + extern onScreenPerson *allPeople; extern screenRegion *allScreenRegions; extern screenRegion *overRegion; @@ -362,3 +364,5 @@ void unfreeze(bool killImage) { killMe = NULL; } + +} // End of namespace Sludge diff --git a/engines/sludge/freeze.h b/engines/sludge/freeze.h index 1682d3b4b3..a9f5129ba2 100644 --- a/engines/sludge/freeze.h +++ b/engines/sludge/freeze.h @@ -22,6 +22,7 @@ #ifndef SLUDGE_FREEZE_H #define SLUDGE_FREEZE_H +namespace Sludge { struct frozenStuffStruct { onScreenPerson *allPeople; @@ -52,4 +53,6 @@ bool freeze(); void unfreeze(bool killImage = true); int howFrozen(); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/graphics.cpp b/engines/sludge/graphics.cpp index 8bdc917515..702865e9d4 100644 --- a/engines/sludge/graphics.cpp +++ b/engines/sludge/graphics.cpp @@ -53,6 +53,8 @@ #endif #endif +namespace Sludge { + unsigned int winWidth, winHeight; int viewportHeight, viewportWidth; int viewportOffsetX = 0, viewportOffsetY = 0; @@ -954,3 +956,5 @@ int printOglError(const char *file, int line) { #endif return retCode; } + +} // End of namespace Sludge diff --git a/engines/sludge/graphics.h b/engines/sludge/graphics.h index ca95307f51..24b7671464 100644 --- a/engines/sludge/graphics.h +++ b/engines/sludge/graphics.h @@ -31,6 +31,7 @@ #endif #endif +namespace Sludge { struct texture { #if 0 @@ -115,4 +116,7 @@ void getTextureDimensions(GLuint name, GLint *width, GLint *height); int printOglError(const char *file, int line); #define printOpenGLError() printOglError(__FILE__, __LINE__) #endif + +} // End of namespace Sludge + #endif diff --git a/engines/sludge/helpers.cpp b/engines/sludge/helpers.cpp index f25f878b5d..30d50943ac 100644 --- a/engines/sludge/helpers.cpp +++ b/engines/sludge/helpers.cpp @@ -22,6 +22,8 @@ #include "allfiles.h" #include "helpers.h" +namespace Sludge { + bool fileExists(const char *file) { bool retval = false; #if ALLOW_FILE @@ -34,3 +36,5 @@ bool fileExists(const char *file) { #endif return retval; } + +} // End of namespace Sludge diff --git a/engines/sludge/helpers.h b/engines/sludge/helpers.h index 82d8e40b23..27625d2794 100644 --- a/engines/sludge/helpers.h +++ b/engines/sludge/helpers.h @@ -22,6 +22,10 @@ #ifndef SLUDGE_HELPERS_H #define SLUDGE_HELPERS_H +namespace Sludge { + bool fileExists(const char *file); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/language.cpp b/engines/sludge/language.cpp index 3a956615e4..a55adae752 100644 --- a/engines/sludge/language.cpp +++ b/engines/sludge/language.cpp @@ -28,6 +28,8 @@ #include "CommonCode/version.h" #include "platform-dependent.h" +namespace Sludge { + int *languageTable; char **languageName; settingsStruct gameSettings; @@ -208,3 +210,5 @@ int getLanguageForFileB() { return indexNum; } + +} // End of namespace Sludge diff --git a/engines/sludge/language.h b/engines/sludge/language.h index fff3ef91da..27faffb4ac 100644 --- a/engines/sludge/language.h +++ b/engines/sludge/language.h @@ -22,6 +22,8 @@ #ifndef LANGUAGE_H #define LANGUAGE_H +namespace Sludge { + struct settingsStruct { unsigned int languageID; unsigned int numLanguages; @@ -43,4 +45,6 @@ int getLanguageForFileB(); void makeLanguageTable(FILE *table); #endif +} // End of namespace Sludge + #endif diff --git a/engines/sludge/line.cpp b/engines/sludge/line.cpp index f57bb642a3..bcb13437e3 100644 --- a/engines/sludge/line.cpp +++ b/engines/sludge/line.cpp @@ -26,6 +26,8 @@ #include "graphics.h" #include "allfiles.h" +namespace Sludge { + extern int sceneWidth, sceneHeight; #if 0 extern GLuint backdropTextureName; @@ -141,3 +143,5 @@ void drawLine(int x1, int y1, int x2, int y2) { setPixelCoords(false); #endif } + +} // End of namespace Sludge diff --git a/engines/sludge/line.h b/engines/sludge/line.h index e7d00f051c..49e895f9e5 100644 --- a/engines/sludge/line.h +++ b/engines/sludge/line.h @@ -22,6 +22,10 @@ #ifndef SLUDGE_LINE_H #define SLUDGE_LINE_H +namespace Sludge { + void drawLine(int x1, int y1, int x2, int y2); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/linuxstuff.cpp b/engines/sludge/linuxstuff.cpp index d5b76a5cf0..454cf932d0 100644 --- a/engines/sludge/linuxstuff.cpp +++ b/engines/sludge/linuxstuff.cpp @@ -35,6 +35,8 @@ #include "debug.h" #include "helpers.h" +namespace Sludge { + extern settingsStruct gameSettings; cmdlineSettingsStruct cmdlineSettings; @@ -222,4 +224,7 @@ uint32_t launch(char *filename) { bool defaultUserFullScreen() { return false; } + +} // End of namespace Sludge + #endif diff --git a/engines/sludge/linuxstuff.h b/engines/sludge/linuxstuff.h index ba7344c040..b97c7bf7fc 100644 --- a/engines/sludge/linuxstuff.h +++ b/engines/sludge/linuxstuff.h @@ -22,6 +22,8 @@ #ifndef SLUDGE_LINUXSTUFF_H #define SLUDGE_LINUXSTUFF_H +namespace Sludge { + struct cmdlineSettingsStruct { bool languageSet; unsigned int languageID; @@ -37,4 +39,6 @@ struct cmdlineSettingsStruct { void printCmdlineUsage(); bool parseCmdlineParameters(int argc, char *argv[]); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/loadsave.cpp b/engines/sludge/loadsave.cpp index 8641a67a7d..20140959ab 100644 --- a/engines/sludge/loadsave.cpp +++ b/engines/sludge/loadsave.cpp @@ -41,6 +41,8 @@ #include "fileset.h" #include "debug.h" +namespace Sludge { + //---------------------------------------------------------------------- // From elsewhere //---------------------------------------------------------------------- @@ -91,7 +93,7 @@ stackLibrary *stackLib = NULL; //---------------------------------------------------------------------- // For saving and loading stacks... //---------------------------------------------------------------------- -#if ALLOW_FILE +#if 0 bool saveVariable(variable *from, FILE *fp); bool loadVariable(variable *to, FILE *fp); @@ -179,7 +181,7 @@ stackHandler *getStackFromLibrary(int n) { } return stackLib -> stack; } -#if ALLOW_FILE +#if 0 stackHandler *loadStackRef(FILE *fp) { stackHandler *nsh; @@ -381,7 +383,7 @@ loadedFunction *loadFunction(FILE *fp) { //---------------------------------------------------------------------- bool saveGame(char *fname) { -#if ALLOW_FILE +#if 0 int a; FILE *fp = fopen(fname, "wb"); @@ -500,7 +502,7 @@ bool saveGame(char *fname) { int ssgVersion; bool loadGame(char *fname) { -#if ALLOW_FILE +#if 0 FILE *fp; FILETIME savedGameTime; int a; @@ -676,3 +678,5 @@ bool loadGame(char *fname) { clearStackLib(); return true; } + +} // End of namespace Sludge diff --git a/engines/sludge/loadsave.h b/engines/sludge/loadsave.h index d2ce316706..b91e8725e1 100644 --- a/engines/sludge/loadsave.h +++ b/engines/sludge/loadsave.h @@ -22,6 +22,8 @@ #ifndef SLUDGE_LOADSAVE_H #define SLUDGE_LOADSAVE_H +namespace Sludge { + bool saveGame(char *fname); bool loadGame(char *fname); @@ -30,4 +32,6 @@ loadedFunction *loadFunction(FILE *fp); void saveFunction(loadedFunction *fun, FILE *fp); #endif +} // End of namespace Sludge + #endif diff --git a/engines/sludge/main_loop.cpp b/engines/sludge/main_loop.cpp index 0d807afacf..47bfe67fe6 100644 --- a/engines/sludge/main_loop.cpp +++ b/engines/sludge/main_loop.cpp @@ -75,6 +75,7 @@ #include "graphics.h" #include "helpers.h" +namespace Sludge { #ifdef _WIN32 #define PATHSLASH '\\' @@ -506,3 +507,5 @@ catch (std::exception &ex) { //NOTE by reference, not value return -2; } #endif + +} // End of namespace Sludge diff --git a/engines/sludge/main_loop.h b/engines/sludge/main_loop.h index 8fea28eb7a..7ea58813d6 100644 --- a/engines/sludge/main_loop.h +++ b/engines/sludge/main_loop.h @@ -22,6 +22,10 @@ #ifndef SLUDGE_MAIN_LOOP_H #define SLUDGE_MAIN_LOOP_H +namespace Sludge { + int main_loop(char *filename); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/memwatch.cpp b/engines/sludge/memwatch.cpp index dab57b8bdb..d3166877f7 100644 --- a/engines/sludge/memwatch.cpp +++ b/engines/sludge/memwatch.cpp @@ -19,9 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#include #include "allfiles.h" +namespace Sludge { + void *allKnownMem[3000]; int allKnownNum = 0; @@ -59,3 +60,5 @@ void deleting(void *mem) { //db ("Error! Deleted a block which hasn't been allocated!"); exit(1); } + +} // End of namespace Sludge diff --git a/engines/sludge/memwatch.h b/engines/sludge/memwatch.h index 2325b2ea0d..0fb6f263df 100644 --- a/engines/sludge/memwatch.h +++ b/engines/sludge/memwatch.h @@ -22,7 +22,11 @@ #ifndef SLUDGE_MEMWATCH_H #define SLUDGE_MEMWATCH_H +namespace Sludge { + void adding(void *); void deleting(void *); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/moreio.cpp b/engines/sludge/moreio.cpp index 6df41fa7fa..b8dc3f9909 100644 --- a/engines/sludge/moreio.cpp +++ b/engines/sludge/moreio.cpp @@ -19,9 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#include -#include - #include "allfiles.h" #include "moreio.h" #include "newfatal.h" @@ -36,6 +33,8 @@ #endif #endif +namespace Sludge { + bool allowAnyFilename = true; #if ALLOW_FILE @@ -322,3 +321,5 @@ char *decodeFilename(char *nameIn) { return copyString(nameIn); } } + +} // End of namespace Sludge diff --git a/engines/sludge/moreio.h b/engines/sludge/moreio.h index 9635ffafcc..5d107a82e4 100644 --- a/engines/sludge/moreio.h +++ b/engines/sludge/moreio.h @@ -24,6 +24,8 @@ #include +namespace Sludge { + #if ALLOW_FILE int get2bytes(FILE *fp); void put2bytes(int numtoput, FILE *fp); @@ -39,4 +41,6 @@ void put4bytes(uint32_t f, FILE *fp); char *encodeFilename(char *nameIn); char *decodeFilename(char *nameIn); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/movie.cpp b/engines/sludge/movie.cpp index debec5e9dc..09693f1dfc 100644 --- a/engines/sludge/movie.cpp +++ b/engines/sludge/movie.cpp @@ -55,6 +55,8 @@ #include "AL/alure.h" #endif +namespace Sludge { + extern int specialSettings; // in main.c @@ -1041,3 +1043,5 @@ int pauseMovie() { #endif return movieIsPlaying; } + +} // End of namespace Sludge diff --git a/engines/sludge/movie.h b/engines/sludge/movie.h index 460edb6e99..100439a95d 100644 --- a/engines/sludge/movie.h +++ b/engines/sludge/movie.h @@ -21,6 +21,9 @@ */ #ifndef SLUDGE_MOVIE_H #define SLUDGE_MOVIE_H + +namespace Sludge { + /* movieIsPlaying tracks the state of movie playing */ @@ -35,4 +38,6 @@ int playMovie(int fileNumber); int stopMovie(); int pauseMovie(); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/newfatal.cpp b/engines/sludge/newfatal.cpp index b3fa74af6c..f05de5c4c2 100644 --- a/engines/sludge/newfatal.cpp +++ b/engines/sludge/newfatal.cpp @@ -26,18 +26,18 @@ #include #endif -#include "common/debug.h" +#include "allfiles.h" +#include "common/debug.h" #include "platform-dependent.h" -#include "allfiles.h" #include "CommonCode/version.h" - #include "sound.h" - #include "stringy.h" #include "errors.h" #include "graphics.h" +namespace Sludge { + const char emergencyMemoryMessage[] = "Out of memory displaying error message!"; static char *fatalMessage = NULL; @@ -85,7 +85,7 @@ extern SDL_Event quit_event; #endif int inFatal(const char *str) { -#if ALLOW_FILE +#if 0 FILE *fatFile = fopen("fatal.txt", "wt"); if (fatFile) { fprintf(fatFile, "FATAL:\n%s\n", str); @@ -156,3 +156,5 @@ int fatal(const char *str1, const char *str2) { } else fatal(emergencyMemoryMessage); return 0; } + +} // End of namespace Sludge diff --git a/engines/sludge/newfatal.h b/engines/sludge/newfatal.h index 6fd5b2f0d5..a97dca8101 100644 --- a/engines/sludge/newfatal.h +++ b/engines/sludge/newfatal.h @@ -24,6 +24,8 @@ #include "errors.h" +namespace Sludge { + bool hasFatal(); int fatal(const char *str); @@ -36,4 +38,6 @@ void warning(const char *l); void setResourceForFatal(int n); char *resourceNameFromNum(int i); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/objtypes.cpp b/engines/sludge/objtypes.cpp index 7f19ee74d3..58572b0f92 100644 --- a/engines/sludge/objtypes.cpp +++ b/engines/sludge/objtypes.cpp @@ -27,6 +27,8 @@ #include "fileset.h" #include "CommonCode/version.h" +namespace Sludge { + objectType *allObjectTypes = NULL; extern char *outputDir; @@ -175,3 +177,5 @@ void removeObjectType(objectType *oT) { } fatal("Can't delete object type: bad pointer"); } + +} // End of namespace Sludge diff --git a/engines/sludge/objtypes.h b/engines/sludge/objtypes.h index b56b112f94..f61c845074 100644 --- a/engines/sludge/objtypes.h +++ b/engines/sludge/objtypes.h @@ -22,6 +22,8 @@ #ifndef SLUDGE_OBJTYPES_H #define SLUDGE_OBJTYPES_H +namespace Sludge { + struct combination { int withObj, funcNum; }; @@ -46,4 +48,7 @@ void removeObjectType(objectType *oT); void saveObjectRef(objectType *r, FILE *fp); objectType *loadObjectRef(FILE *fp); #endif + +} // End of namespace Sludge + #endif diff --git a/engines/sludge/people.cpp b/engines/sludge/people.cpp index 3853bbe6c6..f54b1ff0c5 100644 --- a/engines/sludge/people.cpp +++ b/engines/sludge/people.cpp @@ -45,6 +45,8 @@ #define ANI_WALK 1 #define ANI_TALK 2 +namespace Sludge { + extern speechStruct *speech; extern variableStack *noStack; @@ -1175,3 +1177,5 @@ bool loadPeople(FILE *fp) { return true; } #endif + +} // End of namespace Sludge diff --git a/engines/sludge/people.h b/engines/sludge/people.h index fbc8fd7902..11cf10b737 100644 --- a/engines/sludge/people.h +++ b/engines/sludge/people.h @@ -22,6 +22,8 @@ #ifndef SLUDGE_PEOPLE_H #define SLUDGE_PEOPLE_H +namespace Sludge { + struct animFrame { int frameNum, howMany; int noise; @@ -131,4 +133,7 @@ bool loadPeople(FILE *fp); bool saveCostume(persona *cossy, FILE *fp); bool loadCostume(persona *cossy, FILE *fp); #endif + +} // End of namespace Sludge + #endif diff --git a/engines/sludge/platform-dependent.h b/engines/sludge/platform-dependent.h index 973e20f4b5..5754ef5c6c 100644 --- a/engines/sludge/platform-dependent.h +++ b/engines/sludge/platform-dependent.h @@ -26,6 +26,8 @@ */ #include +namespace Sludge { + char *grabFileName(); int showSetupWindow(); @@ -37,4 +39,6 @@ uint32_t launch(char *filename); bool defaultUserFullScreen(); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/region.cpp b/engines/sludge/region.cpp index 3cd7164d51..8c55ece9ff 100644 --- a/engines/sludge/region.cpp +++ b/engines/sludge/region.cpp @@ -27,6 +27,8 @@ #include "moreio.h" #include "backdrop.h" +namespace Sludge { + screenRegion *allScreenRegions = NULL; screenRegion *overRegion = NULL; extern inputType input; @@ -162,3 +164,5 @@ screenRegion *getRegionForObject(int obj) { return NULL; } + +} // End of namespace Sludge diff --git a/engines/sludge/region.h b/engines/sludge/region.h index 4c4843f2b7..52c1c588ba 100644 --- a/engines/sludge/region.h +++ b/engines/sludge/region.h @@ -22,6 +22,8 @@ #ifndef SLUDGE_REGION_H #define SLUDGE_REGION_H +namespace Sludge { + struct screenRegion { int x1, y1, x2, y2, sX, sY, di; objectType *thisType; @@ -39,4 +41,6 @@ void saveRegions(FILE *); #endif void showBoxes(); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/savedata.cpp b/engines/sludge/savedata.cpp index e8075ccf96..79e672b5fa 100644 --- a/engines/sludge/savedata.cpp +++ b/engines/sludge/savedata.cpp @@ -31,6 +31,8 @@ #define LOAD_ERROR "Can't load custom data...\n\n" +namespace Sludge { + unsigned short saveEncoding = false; char encode1 = 0; char encode2 = 0; @@ -266,3 +268,5 @@ bool stackToFile(char *filename, const variable &from) { #endif return true; } + +} // End of namespace Sludge diff --git a/engines/sludge/savedata.h b/engines/sludge/savedata.h index 19821cc0ee..e6422b8cca 100644 --- a/engines/sludge/savedata.h +++ b/engines/sludge/savedata.h @@ -22,7 +22,11 @@ #ifndef SLUDGE_SAVEDATA_H #define SLUDGE_SAVEDATA_H +namespace Sludge { + bool fileToStack(char *filename, stackHandler *sH); bool stackToFile(char *filename, const variable &from); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/shaders.cpp b/engines/sludge/shaders.cpp index fd4ca30aa2..e11a834775 100644 --- a/engines/sludge/shaders.cpp +++ b/engines/sludge/shaders.cpp @@ -19,14 +19,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#include -#include - +#include "allfiles.h" #include "debug.h" #include "stringy.h" #include "shaders.h" #include "graphics.h" +namespace Sludge { + extern char *bundleFolder; //Function from: http://www.evl.uic.edu/aej/594/code/ogl.cpp @@ -175,4 +175,4 @@ int buildShaders(const char *vertexShader, const char *fragmentShader) { return prog; } - +} // End of namespace Sludge diff --git a/engines/sludge/shaders.h b/engines/sludge/shaders.h index f62808b8d7..13b6e3703c 100644 --- a/engines/sludge/shaders.h +++ b/engines/sludge/shaders.h @@ -30,8 +30,12 @@ #endif #endif +namespace Sludge { + char *shaderFileRead(const char *fn); int buildShaders(const char *vertexShader, const char *fragmentShader); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/sludge.cpp b/engines/sludge/sludge.cpp index 12d0bbf288..0301d734d0 100644 --- a/engines/sludge/sludge.cpp +++ b/engines/sludge/sludge.cpp @@ -41,6 +41,7 @@ SludgeEngine::SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc) // Add debug channels DebugMan.addDebugChannel(kSludgeDebugScript, "Script", "Script debug level"); + DebugMan.addDebugChannel(kSludgeDebugDataLoad, "DataLoad", "Data loading debug level"); // check init debug("SludgeEngine::SludgeEngine"); diff --git a/engines/sludge/sludge.h b/engines/sludge/sludge.h index 5fe7c9a1e5..7878518bcf 100644 --- a/engines/sludge/sludge.h +++ b/engines/sludge/sludge.h @@ -37,7 +37,8 @@ struct SludgeGameDescription; // debug channels enum { - kSludgeDebugScript = 1 << 0 + kSludgeDebugScript = 1 << 0, + kSludgeDebugDataLoad = 1 << 1, }; class SludgeEngine : public Engine { diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp index d73c12867d..02a27f13cc 100644 --- a/engines/sludge/sludger.cpp +++ b/engines/sludge/sludger.cpp @@ -62,9 +62,11 @@ #include "language.h" #include "CommonCode/specialsettings.h" #include "graphics.h" +#include "variable.h" +#include "common/debug.h" +#include "sludge.h" -#include "debug.h" - +namespace Sludge { extern personaAnimation *mouseCursorAnim; extern spritePalette pastePalette; @@ -165,7 +167,7 @@ FILE *openAndVerify(char *filename, char extra1, char extra2, const char *er, in } char c; c = fgetc(fp); - putchar(c); + debug(c); while (c = fgetc(fp)) { putchar(c); } @@ -264,19 +266,21 @@ bool initSludge(char *filename) { } char *checker = readString(fp); - printf("checker : %s\n", checker); + debug(kSludgeDebugDataLoad, "checker : %s\n", checker); if (strcmp(checker, "okSoFar")) return fatal(ERROR_BAD_HEADER, filename); delete checker; checker = NULL; unsigned char customIconLogo = fgetc(fp); - putchar(customIconLogo); + kSludgeDebugDataLoad(kSludgeDebugDataLoad, "Game icon: %i", customIconLogo); if (customIconLogo & 1) { // There is an icon - read it! - int n; + debug(kSludgeDebugDataLoad, "There is an icon - read it!"); +#if 0 + int n; long file_pointer = ftell(fp); png_structp png_ptr; @@ -378,10 +382,12 @@ bool initSludge(char *filename) { } } } +#endif } if (customIconLogo & 2) { // There is an logo - read it! + debug(kSludgeDebugDataLoad, "There is an logo - read it!"); int n; long file_pointer = ftell(fp); @@ -519,7 +525,7 @@ bool initSludge(char *filename) { delete gameNameOrig; changeToUserDir(); - +#if 0 #ifdef _WIN32 mkdir(gameName); #else @@ -527,7 +533,7 @@ bool initSludge(char *filename) { #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 delete [] gameName; // Get user settings @@ -552,6 +558,7 @@ bool initSludge(char *filename) { if (dataFol[0]) { char *dataFolder = encodeFilename(dataFol); +#if 0 #ifdef _WIN32 mkdir(dataFolder); #else @@ -559,7 +566,7 @@ bool initSludge(char *filename) { #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 delete dataFolder; } @@ -1561,3 +1568,5 @@ bool handleInput() { lastRegion = overRegion; return runSludge(); } + +} // End of namespace Sludge diff --git a/engines/sludge/sludger.h b/engines/sludge/sludger.h index fb9734a995..ff24b24155 100644 --- a/engines/sludge/sludger.h +++ b/engines/sludge/sludger.h @@ -24,10 +24,13 @@ #include +#include "allfiles.h" #include "variable.h" #include "csludge.h" #include "language.h" +namespace Sludge { + #ifndef _WIN32 typedef struct _FILETIME { uint32_t dwLowDateTime; @@ -35,6 +38,8 @@ typedef struct _FILETIME { } FILETIME; #endif +struct variable; +struct variableStack; struct eventHandlers { int leftMouseFunction; @@ -47,8 +52,8 @@ struct eventHandlers { }; struct lineOfCode { - sludgeCommand theCommand; - int32_t param; + sludgeCommand theCommand; + int32_t param; }; struct loadedFunction { @@ -95,4 +100,6 @@ void completeTimers(); void killSpeechTimers(); int cancelAFunction(int funcNum, loadedFunction *myself, bool &killedMyself); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/sound.h b/engines/sludge/sound.h index 61f834ba90..5bb3f9d3c9 100644 --- a/engines/sludge/sound.h +++ b/engines/sludge/sound.h @@ -19,13 +19,19 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#include "variable.h" + +#ifndef SLUDGE_SOUND_H +#define SLUDGE_SOUND_H + #ifdef _WIN32 #include #else #define HWND void * #endif +#include "variable.h" + +namespace Sludge { // Sound list stuff struct soundList { @@ -38,8 +44,6 @@ struct soundList { soundList *deleteSoundFromList(soundList *s); void playSoundList(soundList *s); - - // GENERAL... bool initSoundStuff(HWND); void killSoundStuff(); @@ -69,3 +73,7 @@ void saveSounds(FILE *fp); #endif unsigned int getSoundSource(int index); + +} // End of namespace Sludge + +#endif diff --git a/engines/sludge/sound_bass.cpp b/engines/sludge/sound_bass.cpp index 65d8c93df9..017796cb4d 100644 --- a/engines/sludge/sound_bass.cpp +++ b/engines/sludge/sound_bass.cpp @@ -19,8 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#include - #include "allfiles.h" #include "newfatal.h" #include "bass.h" @@ -33,6 +31,8 @@ #define EFFECT_CHANNELS 8 #define TOTAL_CHANNELS 32 +namespace Sludge { + bool soundOK = false; struct soundThing { @@ -389,3 +389,4 @@ bool getSoundCacheStack(stackHandler *sH) { return true; } +} // End of namespace Sludge diff --git a/engines/sludge/sound_nosound.cpp b/engines/sludge/sound_nosound.cpp index 0731d232d2..8f8bb283ea 100644 --- a/engines/sludge/sound_nosound.cpp +++ b/engines/sludge/sound_nosound.cpp @@ -19,14 +19,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#include - #include "allfiles.h" #include "newfatal.h" #include "sound.h" #include "moreio.h" #include "fileset.h" +namespace Sludge { + bool soundOK = false; int defVol = 128; @@ -133,3 +133,5 @@ bool getSoundCacheStack(stackHandler *sH) { //#pragma unused (sH) return true; } + +} // End of namespace Sludge diff --git a/engines/sludge/sound_openal.cpp b/engines/sludge/sound_openal.cpp index fdb1e0bc58..aa8f8e1325 100644 --- a/engines/sludge/sound_openal.cpp +++ b/engines/sludge/sound_openal.cpp @@ -37,6 +37,8 @@ #define MAX_MODS 3 #define NUM_BUFS 3 +namespace Sludge { + bool soundOK = false; bool cacheLoopySound = false; bool SilenceIKillYou = false; @@ -815,3 +817,5 @@ int initMovieSound(int f, ALenum format, int audioChannels, ALuint samplerate, unsigned int getSoundSource(int index) { return 0; /*soundCache[index].playingOnSource;*/ //TODO:false value } + +} // End of namespace Sludge diff --git a/engines/sludge/sprbanks.cpp b/engines/sludge/sprbanks.cpp index bb3303b759..c95e405cb4 100644 --- a/engines/sludge/sprbanks.cpp +++ b/engines/sludge/sprbanks.cpp @@ -25,6 +25,8 @@ #include "newfatal.h" #include "debug.h" +namespace Sludge { + loadedSpriteBank *allLoadedBanks = NULL; extern spriteBank theFont; extern int loadedFontNum, fontTableSize; @@ -72,3 +74,5 @@ void reloadSpriteTextures() { loadSpriteBank(loadedFontNum, theFont, true); } } + +} // End of namespace Sludge diff --git a/engines/sludge/sprbanks.h b/engines/sludge/sprbanks.h index 3c0efd3364..81d1bc7890 100644 --- a/engines/sludge/sprbanks.h +++ b/engines/sludge/sprbanks.h @@ -24,6 +24,8 @@ #include "sprites.h" +namespace Sludge { + struct loadedSpriteBank { int ID, timesUsed; spriteBank bank; @@ -33,4 +35,6 @@ struct loadedSpriteBank { loadedSpriteBank *loadBankForAnim(int ID); void reloadSpriteTextures(); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp index 43ddcbe8a1..792fe664a3 100644 --- a/engines/sludge/sprites.cpp +++ b/engines/sludge/sprites.cpp @@ -27,8 +27,6 @@ #endif #endif -#include - #include "allfiles.h" #include "fileset.h" @@ -45,6 +43,8 @@ #include "shaders.h" +namespace Sludge { + extern zBufferData zBuffer; #if 0 @@ -1109,3 +1109,4 @@ void fixScaleSprite(int x, int y, sprite &single, const spritePalette &fontPal, #endif } +} // End of namespace Sludge diff --git a/engines/sludge/sprites.h b/engines/sludge/sprites.h index e9f053fcd5..2a617bb5ee 100644 --- a/engines/sludge/sprites.h +++ b/engines/sludge/sprites.h @@ -30,6 +30,8 @@ #endif #endif +namespace Sludge { + struct onScreenPerson; struct sprite { @@ -90,4 +92,6 @@ bool reserveSpritePal(spritePalette &sP, int n); void fixScaleSprite(int x1, int y1, sprite &single, const spritePalette &fontPal, onScreenPerson *thisPerson, const int camX, const int camY, bool); void burnSpriteToBackDrop(int x1, int y1, sprite &single, const spritePalette &fontPal); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/statusba.cpp b/engines/sludge/statusba.cpp index 43674a930b..e7dc4cb4f8 100644 --- a/engines/sludge/statusba.cpp +++ b/engines/sludge/statusba.cpp @@ -30,6 +30,8 @@ #include "newfatal.h" #include "statusba.h" +namespace Sludge { + spritePalette verbLinePalette; spritePalette litVerbLinePalette; @@ -227,3 +229,5 @@ bool loadStatusBars(FILE *fp) { return true; } #endif + +} // End of namespace Sludge diff --git a/engines/sludge/statusba.h b/engines/sludge/statusba.h index faa164cab6..2f0d30adc1 100644 --- a/engines/sludge/statusba.h +++ b/engines/sludge/statusba.h @@ -22,6 +22,8 @@ #ifndef SLUDGE_STATUSBA_H #define SLUDGE_STATUSBA_H +namespace Sludge { + struct statusBar { char *text; statusBar *next; @@ -59,4 +61,6 @@ void saveStatusBars(FILE *fp); void restoreBarStuff(statusStuff *here); statusStuff *copyStatusBarStuff(statusStuff *here); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/stringy.cpp b/engines/sludge/stringy.cpp index fdf4536da0..a5440b6c96 100644 --- a/engines/sludge/stringy.cpp +++ b/engines/sludge/stringy.cpp @@ -20,10 +20,13 @@ * */ #include "allfiles.h" -#include - #include "newfatal.h" +#ifndef SLUDGE_STRINGY_H +#define SLUDGE_STRINGY_H + +namespace Sludge { + char *copyString(const char *copyMe) { char *newString = new char [strlen(copyMe) + 1]; if (! checkNew(newString)) return NULL; @@ -37,3 +40,7 @@ char *joinStrings(const char *s1, const char *s2) { sprintf(newString, "%s%s", s1, s2); return newString; } + +} // End of namespace Sludge + +#endif diff --git a/engines/sludge/stringy.h b/engines/sludge/stringy.h index 2306567699..7c6f9ed492 100644 --- a/engines/sludge/stringy.h +++ b/engines/sludge/stringy.h @@ -22,7 +22,11 @@ #ifndef SLUDGE_STRINGY_H #define SLUDGE_STRINGY_H +namespace Sludge { + char *copyString(const char *copyMe); char *joinStrings(const char *s1, const char *s2); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/talk.cpp b/engines/sludge/talk.cpp index 2803e2b881..b6bc864fc7 100644 --- a/engines/sludge/talk.cpp +++ b/engines/sludge/talk.cpp @@ -20,9 +20,6 @@ * */ #include "allfiles.h" - -#include - #include "backdrop.h" #include "sprites.h" #include "sludger.h" @@ -37,6 +34,8 @@ #include "stringy.h" #include "moreio.h" +namespace Sludge { + extern int fontHeight, cameraX, cameraY, speechMode; extern float cameraZoom; speechStruct *speech; @@ -272,3 +271,5 @@ bool loadSpeech(speechStruct *sS, FILE *fp) { return true; } #endif + +} // End of namespace Sludge diff --git a/engines/sludge/talk.h b/engines/sludge/talk.h index ba9bd7ffda..a0fb1a9b8c 100644 --- a/engines/sludge/talk.h +++ b/engines/sludge/talk.h @@ -24,6 +24,8 @@ #include "sprites.h" +namespace Sludge { + struct speechLine { char *textLine; speechLine *next; @@ -49,4 +51,7 @@ void initSpeech(); void saveSpeech(speechStruct *sS, FILE *fp); bool loadSpeech(speechStruct *sS, FILE *fp); #endif + +} // End of namespace Sludge + #endif diff --git a/engines/sludge/thumbnail.cpp b/engines/sludge/thumbnail.cpp index 53ab7ecfb9..9cb471f2d6 100644 --- a/engines/sludge/thumbnail.cpp +++ b/engines/sludge/thumbnail.cpp @@ -19,8 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#include - #include "allfiles.h" #include "errors.h" #include "moreio.h" @@ -31,6 +29,8 @@ #include "graphics.h" #include "newfatal.h" +namespace Sludge { + bool freeze(); void unfreeze(bool); // Because FREEZE.H needs a load of other includes @@ -264,3 +264,5 @@ bool skipThumbnail(FILE *fp) { return (fgetc(fp) == '!'); } #endif + +} // End of namespace Sludge diff --git a/engines/sludge/thumbnail.h b/engines/sludge/thumbnail.h index 4e505bedd2..3836478a82 100644 --- a/engines/sludge/thumbnail.h +++ b/engines/sludge/thumbnail.h @@ -22,10 +22,15 @@ #ifndef SLUDGE_THUMBNAIL_H #define SLUDGE_THUMBNAIL_H +namespace Sludge { + #if ALLOW_FILE bool saveThumbnail(FILE *fp); bool skipThumbnail(FILE *fp); #endif void showThumbnail(char *filename, int x, int y); + +} // End of namespace Sludge + #endif diff --git a/engines/sludge/timing.cpp b/engines/sludge/timing.cpp index a1dcba0882..ae4c0cd102 100644 --- a/engines/sludge/timing.cpp +++ b/engines/sludge/timing.cpp @@ -23,6 +23,8 @@ #include #endif +namespace Sludge { + int desiredfps = 300; //holds desired frames per second Uint32 starttime, endtime; Uint32 desired_frame_time; @@ -54,3 +56,4 @@ void Wait_Frame(void) { starttime = endtime; } +} // End of namespace Sludge diff --git a/engines/sludge/timing.h b/engines/sludge/timing.h index 504bf62470..0fd59f5351 100644 --- a/engines/sludge/timing.h +++ b/engines/sludge/timing.h @@ -22,10 +22,14 @@ #ifndef SLUDGE_TIMING_H #define SLUDGE_TIMING_H +namespace Sludge { + void Init_Timer(void); void Init_Special_Timer(int t); void Get_Start_Time(void); void Get_End_Time(void); void Wait_Frame(void); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/transition.cpp b/engines/sludge/transition.cpp index 041e2c97d8..0fcd4fe7a4 100644 --- a/engines/sludge/transition.cpp +++ b/engines/sludge/transition.cpp @@ -20,8 +20,6 @@ * */ #include -#include - #include "allfiles.h" #include "colours.h" #include "backdrop.h" @@ -32,13 +30,14 @@ extern GLuint snapshotTextureName; #endif +namespace Sludge { + extern unsigned char brightnessLevel; extern float snapTexW, snapTexH; unsigned char fadeMode = 2; - //---------------------------------------------------- // PROPER BRIGHTNESS FADING //---------------------------------------------------- @@ -406,3 +405,5 @@ void fixBrightness() { } } + +} // End of namespace Sludge diff --git a/engines/sludge/transition.h b/engines/sludge/transition.h index f05c438ecb..7dc29f764f 100644 --- a/engines/sludge/transition.h +++ b/engines/sludge/transition.h @@ -22,7 +22,11 @@ #ifndef SLUDGE_TRANSITION_H #define SLUDGE_TRANSITION_H +namespace Sludge { + void fixBrightness(); void resetRandW(); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp index 2c64a7fa25..334beb1e84 100644 --- a/engines/sludge/variable.cpp +++ b/engines/sludge/variable.cpp @@ -19,15 +19,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#include - #include "debug.h" #include "allfiles.h" - #include "variable.h" #include "newfatal.h" - #include "stringy.h" #include "objtypes.h" #include "people.h" @@ -40,6 +36,8 @@ #endif +namespace Sludge { + const char *typeName[] = {"undefined", "number", "user function", "string", "built-in function", "file", "stack", "object type", "animation", "costume" @@ -667,3 +665,5 @@ void debugVar (FILE * fp, const variable & thisVar) { } } */ + +} // End of namespace Sludge diff --git a/engines/sludge/variable.h b/engines/sludge/variable.h index 8d633c8160..8f9f743fb8 100644 --- a/engines/sludge/variable.h +++ b/engines/sludge/variable.h @@ -22,6 +22,11 @@ #ifndef SLUDGE_VARIABLE_H #define SLUDGE_VARIABLE_H +namespace Sludge { + +struct variable; +struct variableStack; + enum variableType {SVT_NULL, SVT_INT, SVT_FUNC, SVT_STRING, SVT_BUILT, SVT_FILE, SVT_STACK, SVT_OBJTYPE, SVT_ANIM, SVT_COSTUME, @@ -114,6 +119,7 @@ variable *fastArrayGetByIndex(fastArrayHandler *vS, unsigned int theIndex); #define stackDebug(a) {} #endif +} // End of namespace Sludge #endif diff --git a/engines/sludge/vid.cpp b/engines/sludge/vid.cpp index a95a452e89..266c5bd859 100644 --- a/engines/sludge/vid.cpp +++ b/engines/sludge/vid.cpp @@ -37,6 +37,8 @@ #include "colours.h" #include "fileset.h" +namespace Sludge { + struct timStream { PAVISTREAM got; AVISTREAMINFO info; @@ -257,3 +259,5 @@ bool nextVideoFrame() { return true; } + +} // End of namespace Sludge diff --git a/engines/sludge/vid.h b/engines/sludge/vid.h index 5b28e371a1..1d81daf0e2 100644 --- a/engines/sludge/vid.h +++ b/engines/sludge/vid.h @@ -22,9 +22,13 @@ #ifndef SLUDGE_VID_H #define SLUDGE_VID_H +namespace Sludge { + bool startVideo(int fileNum); bool nextVideoFrame(); void finishVideo(); void initialiseMovieStuff(); +} // End of namespace Sludge + #endif diff --git a/engines/sludge/winstuff.cpp b/engines/sludge/winstuff.cpp index 2e51b4bb3d..266df699d9 100644 --- a/engines/sludge/winstuff.cpp +++ b/engines/sludge/winstuff.cpp @@ -51,6 +51,8 @@ #include "..\..\images\resource.h" +namespace Sludge { + HINSTANCE hInst; // Handle of the main instance extern HWND hMainWindow; @@ -224,4 +226,7 @@ uint32_t launch(char *f) { bool defaultUserFullScreen() { return true; } + +} // End of namespace Sludge + #endif diff --git a/engines/sludge/winstuff.h b/engines/sludge/winstuff.h index a934f4479a..4a0cbbeb4c 100644 --- a/engines/sludge/winstuff.h +++ b/engines/sludge/winstuff.h @@ -26,6 +26,8 @@ #include #endif +namespace Sludge { + #ifndef _WIN32 #ifndef HINSTANCE #define HINSTANCE int @@ -36,4 +38,6 @@ 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.cpp b/engines/sludge/zbuffer.cpp index 6597f3749d..ddcebb1055 100644 --- a/engines/sludge/zbuffer.cpp +++ b/engines/sludge/zbuffer.cpp @@ -28,6 +28,8 @@ #include "newfatal.h" #include "graphics.h" +namespace Sludge { + zBufferData zBuffer; extern int sceneWidth, sceneHeight; @@ -203,3 +205,4 @@ void drawZBuffer(int x, int y, bool upsidedown) { #endif } +} // End of namespace Sludge diff --git a/engines/sludge/zbuffer.h b/engines/sludge/zbuffer.h index 9040f5764b..6fdbd0284e 100644 --- a/engines/sludge/zbuffer.h +++ b/engines/sludge/zbuffer.h @@ -30,6 +30,7 @@ #endif #endif +namespace Sludge { struct zBufferData { int width, height; @@ -48,4 +49,6 @@ bool setZBuffer(int y); void killZBuffer(); void drawZBuffer(int x, int y, bool upsidedown); +} // End of namespace Sludges + #endif -- cgit v1.2.3