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

yinsimei roseline.yin at gmail.com
Tue Dec 19 22:22:08 CET 2017


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

Summary:
d98016b222 SLUDGE: Objectify speech manager
fe9968a074 SLUDGE: Arrange include order


Commit: d98016b22293c9f692050bef62e81c1cb70ff1fa
    https://github.com/scummvm/scummvm/commit/d98016b22293c9f692050bef62e81c1cb70ff1fa
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-12-19T22:12:08+01:00

Commit Message:
SLUDGE: Objectify speech manager

Changed paths:
  A engines/sludge/speech.cpp
  A engines/sludge/speech.h
  R engines/sludge/talk.cpp
  R engines/sludge/talk.h
    engines/sludge/backdrop.cpp
    engines/sludge/builtin.cpp
    engines/sludge/freeze.cpp
    engines/sludge/loadsave.cpp
    engines/sludge/main_loop.cpp
    engines/sludge/module.mk
    engines/sludge/people.cpp
    engines/sludge/sludge.cpp
    engines/sludge/sludge.h
    engines/sludge/sludger.cpp


diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index dab10be..c1042c7 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -35,11 +35,11 @@
 #include "sludge/imgloader.h"
 #include "sludge/moreio.h"
 #include "sludge/newfatal.h"
+#include "sludge/speech.h"
 #include "sludge/statusba.h"
 #include "sludge/zbuffer.h"
 #include "sludge/sludge.h"
 #include "sludge/sludger.h"
-#include "sludge/talk.h"
 #include "sludge/variable.h"
 #include "sludge/version.h"
 
@@ -185,7 +185,7 @@ bool GraphicsManager::snapshot() {
 
 	// draw snapshot to rendersurface
 	displayBase();
-	viewSpeech(); // ...and anything being said
+	_vm->_speechMan->display();
 	drawStatusBar();
 
 	// copy backdrop to snapshot
diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index 9b4c1b7..1a538fd 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -40,7 +40,6 @@
 #include "sludge/objtypes.h"
 #include "sludge/floor.h"
 #include "sludge/zbuffer.h"
-#include "sludge/talk.h"
 #include "sludge/region.h"
 #include "sludge/language.h"
 #include "sludge/moreio.h"
@@ -49,6 +48,7 @@
 #include "sludge/freeze.h"
 #include "sludge/language.h"
 #include "sludge/sludge.h"
+#include "sludge/speech.h"
 #include "sludge/utf8.h"
 #include "sludge/graphics.h"
 #include "sludge/event.h"
@@ -71,7 +71,6 @@ extern int numBIFNames, numUserFunc;
 extern Common::String *allUserFunc;
 extern Common::String *allBIFNames;
 
-extern float speechSpeed;
 extern byte brightnessLevel;
 extern byte fadeMode;
 extern uint16 saveEncoding;
@@ -153,7 +152,7 @@ static BuiltReturn sayCore(int numParams, LoadedFunction *fun, bool sayIt) {
 			if (!getValueType(objT, SVT_OBJTYPE, fun->stack->thisVar))
 				return BR_ERROR;
 			trimStack(fun->stack);
-			p = wrapSpeech(newText, objT, fileNum, sayIt);
+			p = g_sludge->_speechMan->wrapSpeech(newText, objT, fileNum, sayIt);
 			fun->timeLeft = p;
 			//debugOut ("BUILTIN: sayCore: %s (%i)\n", newText, p);
 			fun->isSpeech = true;
@@ -1298,7 +1297,7 @@ builtIn(setSpeechMode) {
 
 builtIn(somethingSpeaking) {
 	UNUSEDALL
-	int i = isThereAnySpeechGoingOn();
+	int i = g_sludge->_speechMan->isThereAnySpeechGoingOn();
 	if (i == -1) {
 		setVariable(fun->reg, SVT_INT, 0);
 	} else {
@@ -1958,7 +1957,7 @@ builtIn(setSpeechSpeed) {
 	if (!getValueType(number, SVT_INT, fun->stack->thisVar))
 		return BR_ERROR;
 	trimStack(fun->stack);
-	speechSpeed = number * 0.01;
+	g_sludge->_speechMan->setSpeechSpeed(number * 0.01);
 	setVariable(fun->reg, SVT_INT, 1);
 	return BR_CONTINUE;
 }
diff --git a/engines/sludge/freeze.cpp b/engines/sludge/freeze.cpp
index 3e8cdef..9f55564 100644
--- a/engines/sludge/freeze.cpp
+++ b/engines/sludge/freeze.cpp
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  */
+
 #include "sludge/allfiles.h"
 #include "sludge/cursors.h"
 #include "sludge/backdrop.h"
@@ -30,12 +31,12 @@
 #include "sludge/objtypes.h"
 #include "sludge/people.h"
 #include "sludge/region.h"
+#include "sludge/speech.h"
 #include "sludge/sprites.h"
 #include "sludge/sprbanks.h"
 #include "sludge/sludge.h"
 #include "sludge/sludger.h"
 #include "sludge/statusba.h"
-#include "sludge/talk.h"
 #include "sludge/zbuffer.h"
 
 namespace Sludge {
@@ -43,7 +44,6 @@ namespace Sludge {
 extern OnScreenPerson *allPeople;
 extern ScreenRegion *allScreenRegions;
 extern ScreenRegion *overRegion;
-extern SpeechStruct *speech;
 
 void GraphicsManager::freezeGraphics() {
 
@@ -100,10 +100,7 @@ bool GraphicsManager::freeze() {
 	overRegion = NULL;
 
 	_vm->_cursorMan->freeze(newFreezer);
-
-	newFreezer->speech = speech;
-	initSpeech();
-
+	_vm->_speechMan->freeze(newFreezer);
 	_vm->_evtMan->freeze(newFreezer);
 
 	newFreezer->next = _frozenStuff;
@@ -168,19 +165,12 @@ void GraphicsManager::unfreeze(bool killImage) {
 
 	killParallax();
 	_parallaxStuff = _frozenStuff->parallaxStuff;
-
 	_vm->_cursorMan->resotre(_frozenStuff);
-
 	restoreBarStuff(_frozenStuff->frozenStatus);
-
 	_vm->_evtMan->restore(_frozenStuff);
+	_vm->_speechMan->restore(_frozenStuff);
 
-	killAllSpeech();
-	delete speech;
-
-	speech = _frozenStuff->speech;
 	_frozenStuff = _frozenStuff->next;
-
 	overRegion = NULL;
 
 	// free current frozen screen struct
diff --git a/engines/sludge/loadsave.cpp b/engines/sludge/loadsave.cpp
index 21c80f7..dc593a4 100644
--- a/engines/sludge/loadsave.cpp
+++ b/engines/sludge/loadsave.cpp
@@ -33,7 +33,6 @@
 #include "sludge/sludge.h"
 #include "sludge/sludger.h"
 #include "sludge/people.h"
-#include "sludge/talk.h"
 #include "sludge/objtypes.h"
 #include "sludge/backdrop.h"
 #include "sludge/region.h"
@@ -44,6 +43,7 @@
 #include "sludge/sound.h"
 #include "sludge/loadsave.h"
 #include "sludge/bg_effects.h"
+#include "sludge/speech.h"
 #include "sludge/utf8.h"
 #include "sludge/version.h"
 #include "sludge/graphics.h"
@@ -59,9 +59,7 @@ extern const char *typeName[];                      // In variable.cpp
 extern int numGlobals;                              // In sludger.cpp
 extern Variable *globalVars;                        // In sludger.cpp
 extern Floor *currentFloor;                          // In floor.cpp
-extern SpeechStruct *speech;                        // In talk.cpp
 extern FILETIME fileTime;                           // In sludger.cpp
-extern int speechMode;                              // "    "   "
 extern byte brightnessLevel;               // "    "   "
 extern byte fadeMode;                      // In transition.cpp
 extern bool captureAllKeys;
@@ -410,12 +408,11 @@ bool saveGame(const Common::String &fname) {
 	}
 
 	g_sludge->_gfxMan->saveZBuffer(fp);
-
 	g_sludge->_gfxMan->saveLightMap(fp);
 
-	fp->writeByte(speechMode);
 	fp->writeByte(fadeMode);
-	saveSpeech(speech, fp);
+
+	g_sludge->_speechMan->save(fp);
 	saveStatusBars(fp);
 	g_sludge->_soundMan->saveSounds(fp);
 
@@ -559,9 +556,8 @@ bool loadGame(const Common::String &fname) {
 		return false;
 	}
 
-	speechMode = fp->readByte();
 	fadeMode = fp->readByte();
-	loadSpeech(speech, fp);
+	g_sludge->_speechMan->load(fp);
 	loadStatusBars(fp);
 	g_sludge->_soundMan->loadSounds(fp);
 
diff --git a/engines/sludge/main_loop.cpp b/engines/sludge/main_loop.cpp
index fc164df..905d91d 100644
--- a/engines/sludge/main_loop.cpp
+++ b/engines/sludge/main_loop.cpp
@@ -38,7 +38,7 @@
 #include "sludge/sound.h"
 #include "sludge/sludge.h"
 #include "sludge/sludger.h"
-#include "sludge/talk.h"
+#include "sludge/speech.h"
 #include "sludge/transition.h"
 #include "sludge/timing.h"
 
diff --git a/engines/sludge/module.mk b/engines/sludge/module.mk
index 07f1af3..a083ec4 100644
--- a/engines/sludge/module.mk
+++ b/engines/sludge/module.mk
@@ -28,10 +28,10 @@ MODULE_OBJS := \
 	sludge.o \
 	sludger.o \
 	sound.o \
+	speech.o \
 	sprbanks.o \
 	sprites.o \
 	statusba.o \
-	talk.o \
 	thumbnail.o \
 	timing.o \
 	transition.o \
diff --git a/engines/sludge/people.cpp b/engines/sludge/people.cpp
index a6adc4e..c4c0cfe 100644
--- a/engines/sludge/people.cpp
+++ b/engines/sludge/people.cpp
@@ -28,7 +28,6 @@
 #include "sludge/objtypes.h"
 #include "sludge/region.h"
 #include "sludge/people.h"
-#include "sludge/talk.h"
 #include "sludge/newfatal.h"
 #include "sludge/variable.h"
 #include "sludge/moreio.h"
@@ -37,6 +36,7 @@
 #include "sludge/zbuffer.h"
 #include "sludge/sludge.h"
 #include "sludge/sound.h"
+#include "sludge/speech.h"
 #include "sludge/version.h"
 
 #define ANGLEFIX (180.0 / 3.14157)
@@ -46,8 +46,6 @@
 
 namespace Sludge {
 
-extern SpeechStruct *speech;
-
 extern VariableStack *noStack;
 
 extern int ssgVersion;
@@ -202,7 +200,7 @@ bool turnPersonToFace(int thisNum, int direc) {
 		thisPerson->walking = false;
 		thisPerson->spinning = false;
 		turnMeAngle(thisPerson, direc);
-		setFrames(*thisPerson, (thisPerson == speech->currentTalker) ? ANI_TALK : ANI_STAND);
+		setFrames(*thisPerson, g_sludge->_speechMan->isCurrentTalker(thisPerson) ? ANI_TALK : ANI_STAND);
 		return true;
 	}
 	return false;
diff --git a/engines/sludge/sludge.cpp b/engines/sludge/sludge.cpp
index 97904e1..d14f922 100644
--- a/engines/sludge/sludge.cpp
+++ b/engines/sludge/sludge.cpp
@@ -27,10 +27,11 @@
 
 #include "sludge/cursors.h"
 #include "sludge/event.h"
+#include "sludge/fonttext.h"
 #include "sludge/graphics.h"
 #include "sludge/sludge.h"
 #include "sludge/sound.h"
-#include "sludge/fonttext.h"
+#include "sludge/speech.h"
 #include "sludge/main_loop.h"
 
 namespace Sludge {
@@ -80,6 +81,7 @@ SludgeEngine::SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc)
 	_soundMan = new SoundManager();
 	_txtMan = new TextManager();
 	_cursorMan = new CursorManager(this);
+	_speechMan = new SpeechManager(this);
 }
 
 SludgeEngine::~SludgeEngine() {
@@ -118,6 +120,8 @@ SludgeEngine::~SludgeEngine() {
 	_languageMan = nullptr;
 	delete _resMan;
 	_resMan = nullptr;
+	delete _speechMan;
+	_speechMan = nullptr;
 }
 
 Common::Error SludgeEngine::run() {
diff --git a/engines/sludge/sludge.h b/engines/sludge/sludge.h
index 240045d..83c6359 100644
--- a/engines/sludge/sludge.h
+++ b/engines/sludge/sludge.h
@@ -42,6 +42,7 @@ class CursorManager;
 class EventManager;
 class GraphicsManager;
 class SoundManager;
+class SpeechManager;
 class TextManager;
 
 class SludgeConsole;
@@ -86,6 +87,7 @@ public:
 	SoundManager *_soundMan;
 	TextManager *_txtMan;
 	CursorManager *_cursorMan;
+	SpeechManager *_speechMan;
 
 	SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc);
 	virtual ~SludgeEngine();
diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp
index 69e6966..812f42f 100644
--- a/engines/sludge/sludger.cpp
+++ b/engines/sludge/sludger.cpp
@@ -47,7 +47,7 @@
 #include "sludge/sound.h"
 #include "sludge/sludge.h"
 #include "sludge/sludger.h"
-#include "sludge/talk.h"
+#include "sludge/speech.h"
 #include "sludge/transition.h"
 #include "sludge/variable.h"
 #include "sludge/version.h"
@@ -71,7 +71,6 @@ bool captureAllKeys = false;
 
 byte brightnessLevel = 255;
 
-extern SpeechStruct *speech;
 extern LoadedFunction *saverFunc;
 
 LoadedFunction *allRunningFunctions = NULL;
@@ -81,8 +80,6 @@ Variable *globalVars;
 int numGlobals = 0;
 
 extern SpritePalette pastePalette;
-extern int speechMode;
-extern float speechSpeed;
 extern Variable *launchResult;
 extern int lastFramesPerSecond, thumbWidth, thumbHeight;
 
@@ -155,7 +152,7 @@ void initSludge() {
 	initPeople();
 	initFloor();
 	g_sludge->_objMan->init();
-	initSpeech();
+	g_sludge->_speechMan->init();
 	initStatusBar();
 	resetRandW();
 	g_sludge->_evtMan->init();
@@ -169,7 +166,6 @@ void initSludge() {
 
 	// global variables
 	numGlobals = 0;
-	speechMode = 0;
 	launchResult = nullptr;
 
 	lastFramesPerSecond = -1;
@@ -179,7 +175,6 @@ void initSludge() {
 	noStack = nullptr;
 	numBIFNames = numUserFunc = 0;
 	allUserFunc = allBIFNames = nullptr;
-	speechSpeed = 1;
 	brightnessLevel = 255;
 	fadeMode = 2;
 	saveEncoding = false;
@@ -190,7 +185,7 @@ void killSludge() {
 	killAllPeople();
 	killAllRegions();
 	setFloorNull();
-	killAllSpeech();
+	g_sludge->_speechMan->kill();
 	g_sludge->_languageMan->kill();
 	g_sludge->_gfxMan->kill();
 	g_sludge->_resMan->kill();
@@ -345,7 +340,7 @@ void displayBase() {
 
 void sludgeDisplay() {
 	displayBase();
-	viewSpeech();// ...and anything being said
+	g_sludge->_speechMan->display();
 	drawStatusBar();
 	g_sludge->_cursorMan->displayCursor();
 	g_sludge->_gfxMan->display();
@@ -381,7 +376,7 @@ void killSpeechTimers() {
 		thisFunction = thisFunction->next;
 	}
 
-	killAllSpeech();
+	g_sludge->_speechMan->kill();
 }
 
 void completeTimers() {
@@ -940,7 +935,7 @@ bool runSludge() {
 			if (thisFunction->timeLeft) {
 				if (thisFunction->timeLeft < 0) {
 					if (!g_sludge->_soundMan->stillPlayingSound(
-							g_sludge->_soundMan->findInSoundCache(speech->lastFile))) {
+							g_sludge->_speechMan->getLastSpeechSound())) {
 						thisFunction->timeLeft = 0;
 					}
 				} else if (!--(thisFunction->timeLeft)) {
@@ -948,7 +943,7 @@ bool runSludge() {
 			} else {
 				if (thisFunction->isSpeech) {
 					thisFunction->isSpeech = false;
-					killAllSpeech();
+					g_sludge->_speechMan->kill();
 				}
 				if (!continueFunction(thisFunction))
 					return false;
diff --git a/engines/sludge/speech.cpp b/engines/sludge/speech.cpp
new file mode 100644
index 0000000..1d342a1
--- /dev/null
+++ b/engines/sludge/speech.cpp
@@ -0,0 +1,311 @@
+/* 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.
+ *
+ */
+
+#include "sludge/allfiles.h"
+#include "sludge/backdrop.h"
+#include "sludge/fonttext.h"
+#include "sludge/freeze.h"
+#include "sludge/graphics.h"
+#include "sludge/moreio.h"
+#include "sludge/newfatal.h"
+#include "sludge/objtypes.h"
+#include "sludge/people.h"
+#include "sludge/region.h"
+#include "sludge/sludge.h"
+#include "sludge/sludger.h"
+#include "sludge/sound.h"
+#include "sludge/speech.h"
+#include "sludge/sprbanks.h"
+#include "sludge/sprites.h"
+
+namespace Sludge {
+
+void SpeechManager::init() {
+	_speechMode = 0;
+	_speechSpeed = 1;
+	_speech = new SpeechStruct;
+	if (checkNew(_speech)) {
+		_speech->currentTalker = NULL;
+		_speech->allSpeech = NULL;
+		_speech->speechY = 0;
+		_speech->lastFile = -1;
+	}
+}
+
+void SpeechManager::kill() {
+	if (!_speech)
+		return;
+
+	if (_speech->lastFile != -1) {
+		_vm->_soundMan->huntKillSound(_speech->lastFile);
+		_speech->lastFile = -1;
+	}
+
+	if (_speech->currentTalker) {
+		makeSilent(*(_speech->currentTalker));
+		_speech->currentTalker = NULL;
+	}
+
+	SpeechLine *killMe;
+	while (_speech->allSpeech) {
+		killMe = _speech->allSpeech;
+		_speech->allSpeech = _speech->allSpeech->next;
+		delete killMe;
+	}
+}
+
+void SpeechManager::setObjFontColour(ObjectType *t) {
+	setFontColour(_speech->talkCol, t->r, t->g, t->b);
+}
+
+void SpeechManager::addSpeechLine(const Common::String &theLine, int x, int &offset) {
+	float cameraZoom = g_sludge->_gfxMan->getCamZoom();
+	int halfWidth = (g_sludge->_txtMan->stringWidth(theLine) >> 1) / cameraZoom;
+	int xx1 = x - (halfWidth);
+	int xx2 = x + (halfWidth);
+	SpeechLine *newLine = new SpeechLine;
+	checkNew(newLine);
+
+	newLine->next = _speech->allSpeech;
+	newLine->textLine.clear();
+	newLine->textLine = theLine;
+	newLine->x = xx1;
+	_speech->allSpeech = newLine;
+	if ((xx1 < 5) && (offset < (5 - xx1))) {
+		offset = 5 - xx1;
+	} else if ((xx2 >= ((float) g_system->getWidth() / cameraZoom) - 5)
+			&& (offset > (((float) g_system->getWidth() / cameraZoom) - 5 - xx2))) {
+		offset = ((float) g_system->getWidth() / cameraZoom) - 5 - xx2;
+	}
+}
+
+int SpeechManager::isThereAnySpeechGoingOn() {
+	return _speech->allSpeech ? _speech->lookWhosTalking : -1;
+}
+
+int SpeechManager::getLastSpeechSound() {
+	return _vm->_soundMan->findInSoundCache(_speech->lastFile);
+}
+
+int SpeechManager::wrapSpeechXY(const Common::String &theText, int x, int y, int wrap, int sampleFile) {
+	float cameraZoom = g_sludge->_gfxMan->getCamZoom();
+	int fontHeight = g_sludge->_txtMan->getFontHeight();
+	int cameraY = g_sludge->_gfxMan->getCamY();
+
+	int a, offset = 0;
+
+	kill();
+
+	int speechTime = (theText.size() + 20) * _speechSpeed;
+	if (speechTime < 1)
+		speechTime = 1;
+	if (sampleFile != -1) {
+		if (_speechMode >= 1) {
+			if (g_sludge->_soundMan->startSound(sampleFile, false)) {
+				speechTime = -10;
+				_speech->lastFile = sampleFile;
+				if (_speechMode == 2) return -10;
+			}
+
+		}
+	}
+	_speech->speechY = y;
+
+	char *tmp, *txt;
+	tmp = txt = createCString(theText);
+	while ((int)strlen(txt) > wrap) {
+		a = wrap;
+		while (txt[a] != ' ') {
+			a--;
+			if (a == 0) {
+				a = wrap;
+				break;
+			}
+		}
+		txt[a] = 0;
+		addSpeechLine(txt, x, offset);
+		txt[a] = ' ';
+		txt += a + 1;
+		y -= fontHeight / cameraZoom;
+	}
+	addSpeechLine(txt, x, offset);
+	y -= fontHeight / cameraZoom;
+	delete []tmp;
+
+	if (y < 0)
+		_speech->speechY -= y;
+	else if (_speech->speechY > cameraY + (float) (g_system->getHeight() - fontHeight / 3) / cameraZoom)
+		_speech->speechY = cameraY
+				+ (float) (g_system->getHeight() - fontHeight / 3) / cameraZoom;
+
+	if (offset) {
+		SpeechLine *viewLine = _speech->allSpeech;
+		while (viewLine) {
+			viewLine->x += offset;
+			viewLine = viewLine->next;
+		}
+	}
+	return speechTime;
+}
+
+int SpeechManager::wrapSpeechPerson(const Common::String &theText, OnScreenPerson &thePerson, int sampleFile, bool animPerson) {
+	int cameraX = g_sludge->_gfxMan->getCamX();
+	int cameraY = g_sludge->_gfxMan->getCamY();
+	int i = wrapSpeechXY(theText, thePerson.x - cameraX,
+			thePerson.y - cameraY
+					- (thePerson.scale * (thePerson.height - thePerson.floaty))
+					- thePerson.thisType->speechGap,
+			thePerson.thisType->wrapSpeech, sampleFile);
+	if (animPerson) {
+		makeTalker(thePerson);
+		_speech->currentTalker = &thePerson;
+	}
+	return i;
+}
+
+int SpeechManager::wrapSpeech(const Common::String &theText, int objT, int sampleFile, bool animPerson) {
+	int i;
+	int cameraX = g_sludge->_gfxMan->getCamX();
+	int cameraY = g_sludge->_gfxMan->getCamY();
+
+	_speech->lookWhosTalking = objT;
+	OnScreenPerson *thisPerson = findPerson(objT);
+	if (thisPerson) {
+		setObjFontColour(thisPerson->thisType);
+		i = wrapSpeechPerson(theText, *thisPerson, sampleFile, animPerson);
+	} else {
+		ScreenRegion *thisRegion = getRegionForObject(objT);
+		if (thisRegion) {
+			setObjFontColour(thisRegion->thisType);
+			i = wrapSpeechXY(theText,
+					((thisRegion->x1 + thisRegion->x2) >> 1) - cameraX,
+					thisRegion->y1 - thisRegion->thisType->speechGap - cameraY,
+					thisRegion->thisType->wrapSpeech, sampleFile);
+		} else {
+			ObjectType *temp = g_sludge->_objMan->findObjectType(objT);
+			setObjFontColour(temp);
+			i = wrapSpeechXY(theText, g_system->getWidth() >> 1, 10, temp->wrapSpeech,
+					sampleFile);
+		}
+	}
+	return i;
+}
+
+void SpeechManager::display() {
+	float cameraZoom = g_sludge->_gfxMan->getCamZoom();
+	int fontHeight = g_sludge->_txtMan->getFontHeight();
+	int viewY = _speech->speechY;
+	SpeechLine *viewLine = _speech->allSpeech;
+	while (viewLine) {
+		g_sludge->_txtMan->pasteString(viewLine->textLine, viewLine->x, viewY, _speech->talkCol);
+		viewY -= fontHeight / cameraZoom;
+		viewLine = viewLine->next;
+	}
+}
+
+void SpeechManager::save(Common::WriteStream *stream) {
+	stream->writeByte(_speechMode);
+
+	SpeechLine *viewLine = _speech->allSpeech;
+
+	stream->writeByte(_speech->talkCol.originalRed);
+	stream->writeByte(_speech->talkCol.originalGreen);
+	stream->writeByte(_speech->talkCol.originalBlue);
+
+	stream->writeFloatLE(_speechSpeed);
+
+	// Write y co-ordinate
+	stream->writeUint16BE(_speech->speechY);
+
+	// Write which character's talking
+	stream->writeUint16BE(_speech->lookWhosTalking);
+	if (_speech->currentTalker) {
+		stream->writeByte(1);
+		stream->writeUint16BE(_speech->currentTalker->thisType->objectNum);
+	} else {
+		stream->writeByte(0);
+	}
+
+	// Write what's being said
+	while (viewLine) {
+		stream->writeByte(1);
+		writeString(viewLine->textLine, stream);
+		stream->writeUint16BE(viewLine->x);
+		viewLine = viewLine->next;
+	}
+	stream->writeByte(0);
+}
+
+bool SpeechManager::load(Common::SeekableReadStream *stream) {
+	// read speech mode
+	_speechMode = stream->readByte();
+
+	_speech->currentTalker = nullptr;
+	kill();
+	byte r = stream->readByte();
+	byte g = stream->readByte();
+	byte b = stream->readByte();
+	setFontColour(_speech->talkCol, r, g, b);
+
+	_speechSpeed = stream->readFloatLE();
+
+	// Read y co-ordinate
+	_speech->speechY = stream->readUint16BE();
+
+	// Read which character's talking
+	_speech->lookWhosTalking = stream->readUint16BE();
+
+	if (stream->readByte()) {
+		_speech->currentTalker = findPerson(stream->readUint16BE());
+	} else {
+		_speech->currentTalker = NULL;
+	}
+
+	// Read what's being said
+	SpeechLine **viewLine = &_speech->allSpeech;
+	SpeechLine *newOne;
+	_speech->lastFile = -1;
+	while (stream->readByte()) {
+		newOne = new SpeechLine;
+		if (!checkNew(newOne))
+			return false;
+		newOne->textLine = readString(stream);
+		newOne->x = stream->readUint16BE();
+		newOne->next = NULL;
+		(*viewLine) = newOne;
+		viewLine = &(newOne->next);
+	}
+	return true;
+}
+
+void SpeechManager::freeze(FrozenStuffStruct *frozenStuff) {
+	frozenStuff->speech = _speech;
+	init();
+}
+
+void SpeechManager::restore(FrozenStuffStruct *frozenStuff) {
+	kill();
+	delete _speech;
+	_speech = frozenStuff->speech;
+}
+
+} // End of namespace Sludge
diff --git a/engines/sludge/speech.h b/engines/sludge/speech.h
new file mode 100644
index 0000000..b33a528
--- /dev/null
+++ b/engines/sludge/speech.h
@@ -0,0 +1,83 @@
+/* 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_TALK_H
+#define SLUDGE_TALK_H
+
+#include "sludge/sprites.h"
+
+namespace Sludge {
+
+struct SpeechLine {
+	Common::String textLine;
+	SpeechLine *next;
+	int x;
+};
+
+struct SpeechStruct {
+	OnScreenPerson *currentTalker;
+	SpeechLine *allSpeech;
+	int speechY, lastFile, lookWhosTalking;
+	SpritePalette talkCol;
+};
+
+class SpeechManager {
+public:
+	SpeechManager(SludgeEngine *vm) : _vm(vm) { init(); }
+	~SpeechManager() { kill(); }
+
+	void init();
+	void kill();
+
+	int wrapSpeech(const Common::String &theText, int objT, int sampleFile, bool);
+	void display();
+
+	int isThereAnySpeechGoingOn();
+	bool isCurrentTalker(OnScreenPerson *person) { return person == _speech->currentTalker; }
+	int getLastSpeechSound();
+
+	// setters & getters
+	void setObjFontColour(ObjectType *t);
+	void setSpeechSpeed(float speed) { _speechSpeed = speed; }
+	float getSpeechSpeed() { return _speechSpeed; }
+
+	// load & save
+	void save(Common::WriteStream *stream);
+	bool load(Common::SeekableReadStream *stream);
+
+	// freeze & restore
+	void freeze(FrozenStuffStruct *frozenStuff);
+	void restore(FrozenStuffStruct *frozenStuff);
+
+private:
+	SludgeEngine *_vm;
+	int _speechMode;
+	SpeechStruct *_speech;
+	float _speechSpeed;
+
+	void addSpeechLine(const Common::String &theLine, int x, int &offset);
+	int wrapSpeechXY(const Common::String &theText, int x, int y, int wrap, int sampleFile);
+	int wrapSpeechPerson(const Common::String &theText, OnScreenPerson &thePerson, int sampleFile, bool animPerson);
+};
+
+} // End of namespace Sludge
+
+#endif
diff --git a/engines/sludge/talk.cpp b/engines/sludge/talk.cpp
deleted file mode 100644
index 4bb1d22..0000000
--- a/engines/sludge/talk.cpp
+++ /dev/null
@@ -1,292 +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.
- *
- */
-
-#include "sludge/allfiles.h"
-#include "sludge/backdrop.h"
-#include "sludge/graphics.h"
-#include "sludge/sprites.h"
-#include "sludge/sludger.h"
-#include "sludge/objtypes.h"
-#include "sludge/region.h"
-#include "sludge/sprbanks.h"
-#include "sludge/people.h"
-#include "sludge/talk.h"
-#include "sludge/sludge.h"
-#include "sludge/sound.h"
-#include "sludge/fonttext.h"
-#include "sludge/newfatal.h"
-#include "sludge/moreio.h"
-
-namespace Sludge {
-
-extern int speechMode;
-SpeechStruct *speech;
-float speechSpeed = 1;
-
-void initSpeech() {
-	speech = new SpeechStruct;
-	if (checkNew(speech)) {
-		speech->currentTalker = NULL;
-		speech->allSpeech = NULL;
-		speech->speechY = 0;
-		speech->lastFile = -1;
-	}
-}
-
-void killAllSpeech() {
-	if (!speech)
-		return;
-
-	if (speech->lastFile != -1) {
-		g_sludge->_soundMan->huntKillSound(speech->lastFile);
-		speech->lastFile = -1;
-	}
-
-	if (speech->currentTalker) {
-		makeSilent(*(speech->currentTalker));
-		speech->currentTalker = NULL;
-	}
-
-	SpeechLine *killMe;
-
-	while (speech->allSpeech) {
-		killMe = speech->allSpeech;
-		speech->allSpeech = speech->allSpeech->next;
-		delete killMe;
-	}
-}
-
-inline void setObjFontColour(ObjectType *t) {
-	setFontColour(speech->talkCol, t->r, t->g, t->b);
-}
-
-void addSpeechLine(const Common::String &theLine, int x, int &offset) {
-	float cameraZoom = g_sludge->_gfxMan->getCamZoom();
-	int halfWidth = (g_sludge->_txtMan->stringWidth(theLine) >> 1) / cameraZoom;
-	int xx1 = x - (halfWidth);
-	int xx2 = x + (halfWidth);
-	SpeechLine *newLine = new SpeechLine;
-	checkNew(newLine);
-
-	newLine->next = speech->allSpeech;
-	newLine->textLine.clear();
-	newLine->textLine = theLine;
-	newLine->x = xx1;
-	speech->allSpeech = newLine;
-	if ((xx1 < 5) && (offset < (5 - xx1))) {
-		offset = 5 - xx1;
-	} else if ((xx2 >= ((float) g_system->getWidth() / cameraZoom) - 5)
-			&& (offset > (((float) g_system->getWidth() / cameraZoom) - 5 - xx2))) {
-		offset = ((float) g_system->getWidth() / cameraZoom) - 5 - xx2;
-	}
-}
-
-int isThereAnySpeechGoingOn() {
-	return speech->allSpeech ? speech->lookWhosTalking : -1;
-}
-
-int wrapSpeechXY(const Common::String &theText, int x, int y, int wrap, int sampleFile) {
-	float cameraZoom = g_sludge->_gfxMan->getCamZoom();
-	int fontHeight = g_sludge->_txtMan->getFontHeight();
-	int cameraY = g_sludge->_gfxMan->getCamY();
-
-	int a, offset = 0;
-
-	killAllSpeech();
-
-	int speechTime = (theText.size() + 20) * speechSpeed;
-	if (speechTime < 1)
-		speechTime = 1;
-	if (sampleFile != -1) {
-		if (speechMode >= 1) {
-			if (g_sludge->_soundMan->startSound(sampleFile, false)) {
-				speechTime = -10;
-				speech->lastFile = sampleFile;
-				if (speechMode == 2) return -10;
-			}
-
-		}
-	}
-	speech->speechY = y;
-
-	char *tmp, *txt;
-	tmp = txt = createCString(theText);
-	while ((int)strlen(txt) > wrap) {
-		a = wrap;
-		while (txt[a] != ' ') {
-			a--;
-			if (a == 0) {
-				a = wrap;
-				break;
-			}
-		}
-		txt[a] = 0;
-		addSpeechLine(txt, x, offset);
-		txt[a] = ' ';
-		txt += a + 1;
-		y -= fontHeight / cameraZoom;
-	}
-	addSpeechLine(txt, x, offset);
-	y -= fontHeight / cameraZoom;
-	delete []tmp;
-
-	if (y < 0)
-		speech->speechY -= y;
-	else if (speech->speechY > cameraY + (float) (g_system->getHeight() - fontHeight / 3) / cameraZoom)
-		speech->speechY = cameraY
-				+ (float) (g_system->getHeight() - fontHeight / 3) / cameraZoom;
-
-	if (offset) {
-		SpeechLine *viewLine = speech->allSpeech;
-		while (viewLine) {
-			viewLine->x += offset;
-			viewLine = viewLine->next;
-		}
-	}
-	return speechTime;
-}
-
-int wrapSpeechPerson(const Common::String &theText, OnScreenPerson &thePerson, int sampleFile, bool animPerson) {
-	int cameraX = g_sludge->_gfxMan->getCamX();
-	int cameraY = g_sludge->_gfxMan->getCamY();
-	int i = wrapSpeechXY(theText, thePerson.x - cameraX,
-			thePerson.y - cameraY
-					- (thePerson.scale * (thePerson.height - thePerson.floaty))
-					- thePerson.thisType->speechGap,
-			thePerson.thisType->wrapSpeech, sampleFile);
-	if (animPerson) {
-		makeTalker(thePerson);
-		speech->currentTalker = &thePerson;
-	}
-	return i;
-}
-
-int wrapSpeech(const Common::String &theText, int objT, int sampleFile, bool animPerson) {
-	int i;
-	int cameraX = g_sludge->_gfxMan->getCamX();
-	int cameraY = g_sludge->_gfxMan->getCamY();
-
-	speech->lookWhosTalking = objT;
-	OnScreenPerson *thisPerson = findPerson(objT);
-	if (thisPerson) {
-		setObjFontColour(thisPerson->thisType);
-		i = wrapSpeechPerson(theText, *thisPerson, sampleFile, animPerson);
-	} else {
-		ScreenRegion *thisRegion = getRegionForObject(objT);
-		if (thisRegion) {
-			setObjFontColour(thisRegion->thisType);
-			i = wrapSpeechXY(theText,
-					((thisRegion->x1 + thisRegion->x2) >> 1) - cameraX,
-					thisRegion->y1 - thisRegion->thisType->speechGap - cameraY,
-					thisRegion->thisType->wrapSpeech, sampleFile);
-		} else {
-			ObjectType *temp = g_sludge->_objMan->findObjectType(objT);
-			setObjFontColour(temp);
-			i = wrapSpeechXY(theText, g_system->getWidth() >> 1, 10, temp->wrapSpeech,
-					sampleFile);
-		}
-	}
-	return i;
-}
-
-void viewSpeech() {
-	float cameraZoom = g_sludge->_gfxMan->getCamZoom();
-	int fontHeight = g_sludge->_txtMan->getFontHeight();
-	int viewY = speech->speechY;
-	SpeechLine *viewLine = speech->allSpeech;
-	while (viewLine) {
-		g_sludge->_txtMan->pasteString(viewLine->textLine, viewLine->x, viewY, speech->talkCol);
-		viewY -= fontHeight / cameraZoom;
-		viewLine = viewLine->next;
-	}
-}
-
-void saveSpeech(SpeechStruct *sS, Common::WriteStream *stream) {
-	SpeechLine *viewLine = sS->allSpeech;
-
-	stream->writeByte(sS->talkCol.originalRed);
-	stream->writeByte(sS->talkCol.originalGreen);
-	stream->writeByte(sS->talkCol.originalBlue);
-
-	stream->writeFloatLE(speechSpeed);
-
-	// Write y co-ordinate
-	stream->writeUint16BE(sS->speechY);
-
-	// Write which character's talking
-	stream->writeUint16BE(sS->lookWhosTalking);
-	if (sS->currentTalker) {
-		stream->writeByte(1);
-		stream->writeUint16BE(sS->currentTalker->thisType->objectNum);
-	} else {
-		stream->writeByte(0);
-	}
-
-	// Write what's being said
-	while (viewLine) {
-		stream->writeByte(1);
-		writeString(viewLine->textLine, stream);
-		stream->writeUint16BE(viewLine->x);
-		viewLine = viewLine->next;
-	}
-	stream->writeByte(0);
-}
-
-bool loadSpeech(SpeechStruct *sS, Common::SeekableReadStream *stream) {
-	speech->currentTalker = NULL;
-	killAllSpeech();
-	byte r = stream->readByte();
-	byte g = stream->readByte();
-	byte b = stream->readByte();
-	setFontColour(sS->talkCol, r, g, b);
-
-	speechSpeed = stream->readFloatLE();
-
-	// Read y co-ordinate
-	sS->speechY = stream->readUint16BE();
-
-	// Read which character's talking
-	sS->lookWhosTalking = stream->readUint16BE();
-
-	if (stream->readByte()) {
-		sS->currentTalker = findPerson(stream->readUint16BE());
-	} else {
-		sS->currentTalker = NULL;
-	}
-
-	// Read what's being said
-	SpeechLine **viewLine = &sS->allSpeech;
-	SpeechLine *newOne;
-	speech->lastFile = -1;
-	while (stream->readByte()) {
-		newOne = new SpeechLine;
-		if (! checkNew(newOne)) return false;
-		newOne->textLine = readString(stream);
-		newOne->x = stream->readUint16BE();
-		newOne->next = NULL;
-		(* viewLine) = newOne;
-		viewLine = &(newOne->next);
-	}
-	return true;
-}
-
-} // End of namespace Sludge
diff --git a/engines/sludge/talk.h b/engines/sludge/talk.h
deleted file mode 100644
index 0d7fa80..0000000
--- a/engines/sludge/talk.h
+++ /dev/null
@@ -1,52 +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_TALK_H
-#define SLUDGE_TALK_H
-
-#include "sludge/sprites.h"
-
-namespace Sludge {
-
-struct SpeechLine {
-	Common::String textLine;
-	SpeechLine *next;
-	int x;
-};
-
-struct SpeechStruct {
-	OnScreenPerson *currentTalker;
-	SpeechLine *allSpeech;
-	int speechY, lastFile, lookWhosTalking;
-	SpritePalette talkCol;
-};
-
-int wrapSpeech(const Common::String &theText, int objT, int sampleFile, bool);
-void viewSpeech();
-void killAllSpeech();
-int isThereAnySpeechGoingOn();
-void initSpeech();
-void saveSpeech(SpeechStruct *sS, Common::WriteStream *stream);
-bool loadSpeech(SpeechStruct *sS, Common::SeekableReadStream *stream);
-
-} // End of namespace Sludge
-
-#endif


Commit: fe9968a074ac728610ea3955fd9c183b2e3e3529
    https://github.com/scummvm/scummvm/commit/fe9968a074ac728610ea3955fd9c183b2e3e3529
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-12-19T22:16:21+01:00

Commit Message:
SLUDGE: Arrange include order

Changed paths:
    engines/sludge/builtin.cpp
    engines/sludge/floor.cpp
    engines/sludge/fonttext.cpp
    engines/sludge/freeze.cpp
    engines/sludge/language.cpp
    engines/sludge/loadsave.cpp
    engines/sludge/loadsave.h
    engines/sludge/movie.cpp
    engines/sludge/newfatal.cpp
    engines/sludge/objtypes.cpp
    engines/sludge/people.cpp
    engines/sludge/savedata.cpp
    engines/sludge/sound.cpp
    engines/sludge/speech.h
    engines/sludge/sprbanks.cpp
    engines/sludge/sprites.cpp
    engines/sludge/statusba.cpp
    engines/sludge/thumbnail.cpp
    engines/sludge/variable.cpp
    engines/sludge/zbuffer.cpp


diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index 1a538fd..7385d4d 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -24,34 +24,33 @@
 #include "common/savefile.h"
 
 #include "sludge/allfiles.h"
-#include "sludge/sludger.h"
-#include "sludge/builtin.h"
-#include "sludge/newfatal.h"
-#include "sludge/cursors.h"
-#include "sludge/statusba.h"
-#include "sludge/loadsave.h"
 #include "sludge/backdrop.h"
 #include "sludge/bg_effects.h"
-#include "sludge/sprites.h"
-#include "sludge/fonttext.h"
-#include "sludge/sprbanks.h"
-#include "sludge/people.h"
-#include "sludge/sound.h"
-#include "sludge/objtypes.h"
+#include "sludge/builtin.h"
+#include "sludge/cursors.h"
+#include "sludge/event.h"
 #include "sludge/floor.h"
-#include "sludge/zbuffer.h"
-#include "sludge/region.h"
+#include "sludge/fonttext.h"
+#include "sludge/freeze.h"
+#include "sludge/graphics.h"
 #include "sludge/language.h"
+#include "sludge/loadsave.h"
 #include "sludge/moreio.h"
 #include "sludge/movie.h"
+#include "sludge/newfatal.h"
+#include "sludge/objtypes.h"
+#include "sludge/people.h"
+#include "sludge/region.h"
 #include "sludge/savedata.h"
-#include "sludge/freeze.h"
-#include "sludge/language.h"
-#include "sludge/sludge.h"
+#include "sludge/sludger.h"
+#include "sludge/sound.h"
 #include "sludge/speech.h"
+#include "sludge/sprbanks.h"
+#include "sludge/sprites.h"
+#include "sludge/statusba.h"
+#include "sludge/sludge.h"
 #include "sludge/utf8.h"
-#include "sludge/graphics.h"
-#include "sludge/event.h"
+#include "sludge/zbuffer.h"
 
 namespace Sludge {
 
diff --git a/engines/sludge/floor.cpp b/engines/sludge/floor.cpp
index 45a7501..71aa75c 100644
--- a/engines/sludge/floor.cpp
+++ b/engines/sludge/floor.cpp
@@ -23,12 +23,12 @@
 #include "graphics/surface.h"
 
 #include "sludge/allfiles.h"
-#include "sludge/newfatal.h"
 #include "sludge/fileset.h"
+#include "sludge/floor.h"
 #include "sludge/graphics.h"
 #include "sludge/moreio.h"
+#include "sludge/newfatal.h"
 #include "sludge/sludge.h"
-#include "sludge/floor.h"
 
 namespace Sludge {
 
diff --git a/engines/sludge/fonttext.cpp b/engines/sludge/fonttext.cpp
index 787e95e..0f63c6e 100644
--- a/engines/sludge/fonttext.cpp
+++ b/engines/sludge/fonttext.cpp
@@ -21,11 +21,11 @@
  */
 
 #include "sludge/allfiles.h"
-#include "sludge/sprites.h"
 #include "sludge/fonttext.h"
 #include "sludge/graphics.h"
-#include "sludge/newfatal.h"
 #include "sludge/moreio.h"
+#include "sludge/newfatal.h"
+#include "sludge/sprites.h"
 #include "sludge/sludge.h"
 #include "sludge/version.h"
 
diff --git a/engines/sludge/freeze.cpp b/engines/sludge/freeze.cpp
index 9f55564..e90f270 100644
--- a/engines/sludge/freeze.cpp
+++ b/engines/sludge/freeze.cpp
@@ -21,8 +21,8 @@
  */
 
 #include "sludge/allfiles.h"
-#include "sludge/cursors.h"
 #include "sludge/backdrop.h"
+#include "sludge/cursors.h"
 #include "sludge/event.h"
 #include "sludge/fonttext.h"
 #include "sludge/freeze.h"
@@ -31,11 +31,11 @@
 #include "sludge/objtypes.h"
 #include "sludge/people.h"
 #include "sludge/region.h"
+#include "sludge/sludge.h"
+#include "sludge/sludger.h"
 #include "sludge/speech.h"
 #include "sludge/sprites.h"
 #include "sludge/sprbanks.h"
-#include "sludge/sludge.h"
-#include "sludge/sludger.h"
 #include "sludge/statusba.h"
 #include "sludge/zbuffer.h"
 
diff --git a/engines/sludge/language.cpp b/engines/sludge/language.cpp
index 8bd9d51..f2cde99 100644
--- a/engines/sludge/language.cpp
+++ b/engines/sludge/language.cpp
@@ -24,9 +24,9 @@
 
 #include "sludge/allfiles.h"
 #include "sludge/fileset.h"
-#include "sludge/newfatal.h"
-#include "sludge/moreio.h"
 #include "sludge/language.h"
+#include "sludge/moreio.h"
+#include "sludge/newfatal.h"
 #include "sludge/sludge.h"
 #include "sludge/version.h"
 
diff --git a/engines/sludge/loadsave.cpp b/engines/sludge/loadsave.cpp
index dc593a4..4cabbc7 100644
--- a/engines/sludge/loadsave.cpp
+++ b/engines/sludge/loadsave.cpp
@@ -23,30 +23,30 @@
 #include "common/savefile.h"
 
 #include "sludge/allfiles.h"
-#include "sludge/sprites.h"
+#include "sludge/backdrop.h"
+#include "sludge/bg_effects.h"
+#include "sludge/cursors.h"
 #include "sludge/event.h"
+#include "sludge/floor.h"
 #include "sludge/fonttext.h"
-#include "sludge/newfatal.h"
-#include "sludge/variable.h"
+#include "sludge/graphics.h"
 #include "sludge/language.h"
+#include "sludge/loadsave.h"
 #include "sludge/moreio.h"
-#include "sludge/sludge.h"
-#include "sludge/sludger.h"
-#include "sludge/people.h"
+#include "sludge/newfatal.h"
 #include "sludge/objtypes.h"
-#include "sludge/backdrop.h"
+#include "sludge/people.h"
 #include "sludge/region.h"
-#include "sludge/floor.h"
-#include "sludge/zbuffer.h"
-#include "sludge/cursors.h"
-#include "sludge/statusba.h"
+#include "sludge/sludge.h"
+#include "sludge/sludger.h"
 #include "sludge/sound.h"
-#include "sludge/loadsave.h"
-#include "sludge/bg_effects.h"
+#include "sludge/sprites.h"
+#include "sludge/statusba.h"
 #include "sludge/speech.h"
 #include "sludge/utf8.h"
+#include "sludge/variable.h"
 #include "sludge/version.h"
-#include "sludge/graphics.h"
+#include "sludge/zbuffer.h"
 
 namespace Sludge {
 
diff --git a/engines/sludge/loadsave.h b/engines/sludge/loadsave.h
index 120e638..269fadb 100644
--- a/engines/sludge/loadsave.h
+++ b/engines/sludge/loadsave.h
@@ -24,6 +24,10 @@
 
 namespace Sludge {
 
+struct LoadedFunction;
+struct Variable;
+struct VariableStack;
+
 bool saveGame(const Common::String &fname);
 bool loadGame(const Common::String &fname);
 
diff --git a/engines/sludge/movie.cpp b/engines/sludge/movie.cpp
index 0162a70..271728d 100644
--- a/engines/sludge/movie.cpp
+++ b/engines/sludge/movie.cpp
@@ -20,10 +20,10 @@
  *
  */
 
-#include "sludge/newfatal.h"
-#include "sludge/timing.h"
 #include "sludge/movie.h"
+#include "sludge/newfatal.h"
 #include "sludge/sound.h"
+#include "sludge/timing.h"
 
 namespace Sludge {
 
diff --git a/engines/sludge/newfatal.cpp b/engines/sludge/newfatal.cpp
index 70f6bd9..edd4a88 100644
--- a/engines/sludge/newfatal.cpp
+++ b/engines/sludge/newfatal.cpp
@@ -23,9 +23,9 @@
 #include "common/debug.h"
 
 #include "sludge/allfiles.h"
-#include "sludge/sound.h"
 #include "sludge/errors.h"
 #include "sludge/sludge.h"
+#include "sludge/sound.h"
 #include "sludge/version.h"
 
 namespace Sludge {
diff --git a/engines/sludge/objtypes.cpp b/engines/sludge/objtypes.cpp
index dc41249..12d4318 100644
--- a/engines/sludge/objtypes.cpp
+++ b/engines/sludge/objtypes.cpp
@@ -21,12 +21,12 @@
  */
 
 #include "sludge/allfiles.h"
-#include "sludge/objtypes.h"
-#include "sludge/variable.h"
-#include "sludge/newfatal.h"
+#include "sludge/fileset.h"
 #include "sludge/moreio.h"
+#include "sludge/newfatal.h"
+#include "sludge/objtypes.h"
 #include "sludge/sludge.h"
-#include "sludge/fileset.h"
+#include "sludge/variable.h"
 #include "sludge/version.h"
 
 namespace Sludge {
diff --git a/engines/sludge/people.cpp b/engines/sludge/people.cpp
index c4c0cfe..4aec5fa 100644
--- a/engines/sludge/people.cpp
+++ b/engines/sludge/people.cpp
@@ -21,23 +21,23 @@
  */
 
 #include "sludge/allfiles.h"
+#include "sludge/floor.h"
 #include "sludge/graphics.h"
-#include "sludge/sprites.h"
-#include "sludge/sprbanks.h"
-#include "sludge/sludger.h"
+#include "sludge/loadsave.h"
+#include "sludge/moreio.h"
+#include "sludge/newfatal.h"
 #include "sludge/objtypes.h"
-#include "sludge/region.h"
 #include "sludge/people.h"
-#include "sludge/newfatal.h"
-#include "sludge/variable.h"
-#include "sludge/moreio.h"
-#include "sludge/loadsave.h"
-#include "sludge/floor.h"
-#include "sludge/zbuffer.h"
+#include "sludge/region.h"
 #include "sludge/sludge.h"
+#include "sludge/sludger.h"
 #include "sludge/sound.h"
 #include "sludge/speech.h"
+#include "sludge/sprbanks.h"
+#include "sludge/sprites.h"
+#include "sludge/variable.h"
 #include "sludge/version.h"
+#include "sludge/zbuffer.h"
 
 #define ANGLEFIX (180.0 / 3.14157)
 #define ANI_STAND 0
diff --git a/engines/sludge/savedata.cpp b/engines/sludge/savedata.cpp
index 9b75e13..9e2c923 100644
--- a/engines/sludge/savedata.cpp
+++ b/engines/sludge/savedata.cpp
@@ -23,9 +23,9 @@
 #include "common/file.h"
 
 #include "sludge/allfiles.h"
-#include "sludge/variable.h"
-#include "sludge/newfatal.h"
 #include "sludge/moreio.h"
+#include "sludge/newfatal.h"
+#include "sludge/variable.h"
 
 #define LOAD_ERROR "Can't load custom data...\n\n"
 
diff --git a/engines/sludge/sound.cpp b/engines/sludge/sound.cpp
index 8f8284f..306fd49 100644
--- a/engines/sludge/sound.cpp
+++ b/engines/sludge/sound.cpp
@@ -31,11 +31,11 @@
 #include "audio/mods/mod_xm_s3m.h"
 
 #include "sludge/allfiles.h"
-#include "sludge/newfatal.h"
-#include "sludge/sound.h"
-#include "sludge/moreio.h"
 #include "sludge/fileset.h"
+#include "sludge/moreio.h"
+#include "sludge/newfatal.h"
 #include "sludge/sludge.h"
+#include "sludge/sound.h"
 
 namespace Sludge {
 
diff --git a/engines/sludge/speech.h b/engines/sludge/speech.h
index b33a528..98b6035 100644
--- a/engines/sludge/speech.h
+++ b/engines/sludge/speech.h
@@ -26,6 +26,8 @@
 
 namespace Sludge {
 
+struct ObjectType;
+
 struct SpeechLine {
 	Common::String textLine;
 	SpeechLine *next;
diff --git a/engines/sludge/sprbanks.cpp b/engines/sludge/sprbanks.cpp
index 5bc5de2..c566f65 100644
--- a/engines/sludge/sprbanks.cpp
+++ b/engines/sludge/sprbanks.cpp
@@ -24,10 +24,10 @@
 
 #include "sludge/allfiles.h"
 #include "sludge/graphics.h"
+#include "sludge/newfatal.h"
 #include "sludge/sludge.h"
 #include "sludge/sprites.h"
 #include "sludge/sprbanks.h"
-#include "sludge/newfatal.h"
 
 namespace Sludge {
 
diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index 81769cc..49c27db 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -25,18 +25,18 @@
 #include "graphics/transparent_surface.h"
 
 #include "sludge/allfiles.h"
+#include "sludge/backdrop.h"
 #include "sludge/event.h"
 #include "sludge/fileset.h"
 #include "sludge/graphics.h"
-#include "sludge/people.h"
-#include "sludge/sprites.h"
+#include "sludge/imgloader.h"
 #include "sludge/moreio.h"
 #include "sludge/newfatal.h"
-#include "sludge/backdrop.h"
+#include "sludge/people.h"
+#include "sludge/sludge.h"
 #include "sludge/sludger.h"
+#include "sludge/sprites.h"
 #include "sludge/zbuffer.h"
-#include "sludge/imgloader.h"
-#include "sludge/sludge.h"
 
 namespace Sludge {
 
diff --git a/engines/sludge/statusba.cpp b/engines/sludge/statusba.cpp
index 9e8546a..1aa2497 100644
--- a/engines/sludge/statusba.cpp
+++ b/engines/sludge/statusba.cpp
@@ -24,12 +24,12 @@
 
 #include "sludge/allfiles.h"
 #include "sludge/backdrop.h"
-#include "sludge/sprites.h"
 #include "sludge/fonttext.h"
 #include "sludge/graphics.h"
 #include "sludge/moreio.h"
 #include "sludge/newfatal.h"
 #include "sludge/sludge.h"
+#include "sludge/sprites.h"
 #include "sludge/statusba.h"
 
 namespace Sludge {
diff --git a/engines/sludge/thumbnail.cpp b/engines/sludge/thumbnail.cpp
index 285b43a..2c7e007 100644
--- a/engines/sludge/thumbnail.cpp
+++ b/engines/sludge/thumbnail.cpp
@@ -24,13 +24,13 @@
 #include "image/png.h"
 
 #include "sludge/allfiles.h"
+#include "sludge/backdrop.h"
 #include "sludge/errors.h"
 #include "sludge/graphics.h"
 #include "sludge/imgloader.h"
 #include "sludge/moreio.h"
-#include "sludge/sludger.h"
-#include "sludge/backdrop.h"
 #include "sludge/newfatal.h"
+#include "sludge/sludger.h"
 #include "sludge/version.h"
 
 namespace Sludge {
diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp
index 510c6f4..9cbb9f4 100644
--- a/engines/sludge/variable.cpp
+++ b/engines/sludge/variable.cpp
@@ -24,13 +24,13 @@
 #include "common/savefile.h"
 
 #include "sludge/allfiles.h"
-#include "sludge/variable.h"
+#include "sludge/fileset.h"
 #include "sludge/moreio.h"
 #include "sludge/newfatal.h"
 #include "sludge/objtypes.h"
 #include "sludge/people.h"
-#include "sludge/fileset.h"
 #include "sludge/sludge.h"
+#include "sludge/variable.h"
 
 namespace Sludge {
 
diff --git a/engines/sludge/zbuffer.cpp b/engines/sludge/zbuffer.cpp
index bc9a1cf..02dddd0 100644
--- a/engines/sludge/zbuffer.cpp
+++ b/engines/sludge/zbuffer.cpp
@@ -25,13 +25,13 @@
 #include "graphics/transparent_surface.h"
 
 #include "sludge/allfiles.h"
-#include "sludge/zbuffer.h"
 #include "sludge/fileset.h"
 #include "sludge/graphics.h"
 #include "sludge/moreio.h"
 #include "sludge/newfatal.h"
 #include "sludge/sludge.h"
 #include "sludge/sprites.h"
+#include "sludge/zbuffer.h"
 
 namespace Sludge {
 





More information about the Scummvm-git-logs mailing list