[Scummvm-git-logs] scummvm master -> 28982aa9a5bd6389f30b62b3ad042897ffa7fd2a
yinsimei
roseline.yin at gmail.com
Thu Jul 20 19:10:47 CEST 2017
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
caa51ef49a SLUDGE: Change all structure names to Uppercase
0fb4a1ddd2 SLUDGE: Objectify input and event handler
28982aa9a5 SLUDGE: Remove useless zbuffer updating code
Commit: caa51ef49af5f6e92169a2f8095c08325823cb44
https://github.com/scummvm/scummvm/commit/caa51ef49af5f6e92169a2f8095c08325823cb44
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-07-20T19:10:01+02:00
Commit Message:
SLUDGE: Change all structure names to Uppercase
Changed paths:
engines/sludge/backdrop.cpp
engines/sludge/bg_effects.cpp
engines/sludge/bg_effects.h
engines/sludge/builtin.cpp
engines/sludge/builtin.h
engines/sludge/cursors.cpp
engines/sludge/cursors.h
engines/sludge/floor.cpp
engines/sludge/floor.h
engines/sludge/freeze.cpp
engines/sludge/freeze.h
engines/sludge/graphics.cpp
engines/sludge/graphics.h
engines/sludge/loadsave.cpp
engines/sludge/loadsave.h
engines/sludge/main_loop.cpp
engines/sludge/movie.cpp
engines/sludge/movie.h
engines/sludge/people.cpp
engines/sludge/people.h
engines/sludge/region.cpp
engines/sludge/region.h
engines/sludge/savedata.cpp
engines/sludge/savedata.h
engines/sludge/sludger.cpp
engines/sludge/sludger.h
engines/sludge/sound.cpp
engines/sludge/sound.h
engines/sludge/sprites.cpp
engines/sludge/statusba.cpp
engines/sludge/statusba.h
engines/sludge/talk.cpp
engines/sludge/talk.h
engines/sludge/variable.cpp
engines/sludge/variable.h
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index b1c9e5f..e9f0c22 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -44,7 +44,7 @@
namespace Sludge {
-extern inputType input;
+extern InputType input;
Parallax::Parallax() {
_parallaxLayers.clear();
@@ -472,12 +472,12 @@ void GraphicsManager::saveHSI(Common::WriteStream *stream) {
}
-bool GraphicsManager::getRGBIntoStack(uint x, uint y, stackHandler *sH) {
+bool GraphicsManager::getRGBIntoStack(uint x, uint y, StackHandler *sH) {
if (x >= _sceneWidth || y >= _sceneHeight) {
return fatal("Co-ordinates are outside current scene!");
}
- variable newValue;
+ Variable newValue;
newValue.varType = SVT_NULL;
diff --git a/engines/sludge/bg_effects.cpp b/engines/sludge/bg_effects.cpp
index 920be44..d0c8068 100644
--- a/engines/sludge/bg_effects.cpp
+++ b/engines/sludge/bg_effects.cpp
@@ -150,7 +150,7 @@ void blur_loadSettings(Common::SeekableReadStream *stream) {
}
}
-bool blur_createSettings(int numParams, variableStack *&stack) {
+bool blur_createSettings(int numParams, VariableStack *&stack) {
bool createNullThing = true;
Common::String error = "";
@@ -160,7 +160,7 @@ bool blur_createSettings(int numParams, variableStack *&stack) {
int height = numParams - 2;
int width = 0;
- variableStack *justToCheckSizes = stack;
+ VariableStack *justToCheckSizes = stack;
for (int a = 0; a < height; a++) {
if (justToCheckSizes->thisVar.varType != SVT_STACK) {
error = "Third and subsequent parameters in setBackgroundEffect should be arrays";
@@ -191,7 +191,7 @@ bool blur_createSettings(int numParams, variableStack *&stack) {
if (blur_allocateMemoryForEffect()) {
for (int y = height - 1; y >= 0; y--) {
- variableStack *eachNumber = stack->thisVar.varData.theStack->first;
+ VariableStack *eachNumber = stack->thisVar.varData.theStack->first;
if (error.empty()) {
for (int x = 0; x < width; x++) {
int arraySlot = x + (y * width);
diff --git a/engines/sludge/bg_effects.h b/engines/sludge/bg_effects.h
index 8cfde0e..f1d312e 100644
--- a/engines/sludge/bg_effects.h
+++ b/engines/sludge/bg_effects.h
@@ -30,7 +30,7 @@ namespace Sludge {
bool blurScreen();
void blur_saveSettings(Common::WriteStream *stream);
void blur_loadSettings(Common::SeekableReadStream *stream);
-bool blur_createSettings(int numParams, variableStack *&stack);
+bool blur_createSettings(int numParams, VariableStack *&stack);
} // End of namespace Sludge
diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index 63568d0..fe327f4 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -57,21 +57,21 @@ namespace Sludge {
int speechMode = 0;
SpritePalette pastePalette;
-variable *launchResult = NULL;
+Variable *launchResult = NULL;
extern int lastFramesPerSecond, thumbWidth, thumbHeight;
extern bool allowAnyFilename;
extern bool captureAllKeys;
extern int16 fontSpace;
-extern eventHandlers *currentEvents;
-extern variableStack *noStack;
-extern statusStuff *nowStatus;
-extern screenRegion *overRegion;
+extern EventHandlers *currentEvents;
+extern VariableStack *noStack;
+extern StatusStuff *nowStatus;
+extern ScreenRegion *overRegion;
extern int numBIFNames, numUserFunc;
extern Common::String *allUserFunc;
extern Common::String *allBIFNames;
-extern inputType input;
+extern InputType input;
extern float speechSpeed;
extern byte brightnessLevel;
@@ -125,17 +125,17 @@ bool failSecurityCheck(const Common::String &fn) {
return false;
}
-loadedFunction *saverFunc;
+LoadedFunction *saverFunc;
-typedef builtReturn (*builtInSludgeFunc)(int numParams, loadedFunction *fun);
+typedef BuiltReturn (*builtInSludgeFunc)(int numParams, LoadedFunction *fun);
struct builtInFunctionData {
builtInSludgeFunc func;
};
-#define builtIn(a) static builtReturn builtIn_ ## a (int numParams, loadedFunction *fun)
+#define builtIn(a) static BuiltReturn builtIn_ ## a (int numParams, LoadedFunction *fun)
#define UNUSEDALL (void) (0 && sizeof(numParams) && sizeof (fun));
-static builtReturn sayCore(int numParams, loadedFunction *fun, bool sayIt) {
+static BuiltReturn sayCore(int numParams, LoadedFunction *fun, bool sayIt) {
int fileNum = -1;
Common::String newText;
int objT, p;
@@ -201,7 +201,7 @@ builtIn(howFrozen) {
builtIn(setCursor) {
UNUSEDALL
- personaAnimation *aa = getAnimationFromVar(fun->stack->thisVar);
+ PersonaAnimation *aa = getAnimationFromVar(fun->stack->thisVar);
pickAnimCursor(aa);
trimStack(fun->stack);
return BR_CONTINUE;
@@ -245,7 +245,7 @@ builtIn(getMatchingFiles) {
// Return value
fun->reg.varType = SVT_STACK;
- fun->reg.varData.theStack = new stackHandler;
+ fun->reg.varData.theStack = new StackHandler;
if (!checkNew(fun->reg.varData.theStack))
return BR_ERROR;
fun->reg.varData.theStack->first = NULL;
@@ -412,7 +412,7 @@ builtIn(pasteImage) {
if (!getValueType(x, SVT_INT, fun->stack->thisVar))
return BR_ERROR;
trimStack(fun->stack);
- personaAnimation *pp = getAnimationFromVar(fun->stack->thisVar);
+ PersonaAnimation *pp = getAnimationFromVar(fun->stack->thisVar);
trimStack(fun->stack);
if (pp == NULL)
return BR_CONTINUE;
@@ -544,7 +544,7 @@ builtIn(newStack) {
// Return value
fun->reg.varType = SVT_STACK;
- fun->reg.varData.theStack = new stackHandler;
+ fun->reg.varData.theStack = new StackHandler;
if (!checkNew(fun->reg.varData.theStack))
return BR_ERROR;
fun->reg.varData.theStack->first = NULL;
@@ -742,7 +742,7 @@ builtIn(random) {
return BR_CONTINUE;
}
-static bool getRGBParams(int &red, int &green, int &blue, loadedFunction *fun) {
+static bool getRGBParams(int &red, int &green, int &blue, LoadedFunction *fun) {
if (!getValueType(blue, SVT_INT, fun->stack->thisVar))
return false;
trimStack(fun->stack);
@@ -867,7 +867,7 @@ builtIn(anim) {
}
// First store the frame numbers and take 'em off the stack
- personaAnimation *ba = createPersonaAnim(numParams - 1, fun->stack);
+ PersonaAnimation *ba = createPersonaAnim(numParams - 1, fun->stack);
// Only remaining paramter is the file number
int fileNumber;
@@ -889,7 +889,7 @@ builtIn(anim) {
builtIn(costume) {
UNUSEDALL
- persona *newPersona = new persona;
+ Persona *newPersona = new Persona;
if (!checkNew(newPersona))
return BR_ERROR;
newPersona->numDirections = numParams / 3;
@@ -898,7 +898,7 @@ builtIn(costume) {
return BR_ERROR;
}
int iii;
- newPersona->animation = new personaAnimation *[numParams];
+ newPersona->animation = new PersonaAnimation *[numParams];
if (!checkNew(newPersona->animation))
return BR_ERROR;
for (iii = numParams - 1; iii >= 0; iii--) {
@@ -1130,8 +1130,8 @@ builtIn(loopSound) {
// We have more than one sound to play!
int doLoop = 2;
- soundList *s = NULL;
- soundList *old = NULL;
+ SoundList*s = NULL;
+ SoundList*old = NULL;
// Should we loop?
if (fun->stack->thisVar.varType != SVT_FILE) {
@@ -1144,7 +1144,7 @@ builtIn(loopSound) {
fatal("Illegal parameter given built-in function loopSound().");
return BR_ERROR;
}
- s = new soundList;
+ s = new SoundList;
if (!checkNew(s))
return BR_ERROR;
@@ -1354,11 +1354,11 @@ builtIn(getObjectX) {
return BR_ERROR;
trimStack(fun->stack);
- onScreenPerson *pers = findPerson(objectNumber);
+ OnScreenPerson *pers = findPerson(objectNumber);
if (pers) {
setVariable(fun->reg, SVT_INT, pers->x);
} else {
- screenRegion *la = getRegionForObject(objectNumber);
+ ScreenRegion *la = getRegionForObject(objectNumber);
if (la) {
setVariable(fun->reg, SVT_INT, la->sX);
} else {
@@ -1375,11 +1375,11 @@ builtIn(getObjectY) {
return BR_ERROR;
trimStack(fun->stack);
- onScreenPerson *pers = findPerson(objectNumber);
+ OnScreenPerson *pers = findPerson(objectNumber);
if (pers) {
setVariable(fun->reg, SVT_INT, pers->y);
} else {
- screenRegion *la = getRegionForObject(objectNumber);
+ ScreenRegion *la = getRegionForObject(objectNumber);
if (la) {
setVariable(fun->reg, SVT_INT, la->sY);
} else {
@@ -1446,7 +1446,7 @@ builtIn(removeAllScreenRegions) {
builtIn(addCharacter) {
UNUSEDALL
- persona *p;
+ Persona *p;
int x, y, objectNumber;
p = getCostumeFromVar(fun->stack->thisVar);
@@ -1573,9 +1573,9 @@ builtIn(pasteCharacter) {
return BR_ERROR;
trimStack(fun->stack);
- onScreenPerson *thisPerson = findPerson(obj);
+ OnScreenPerson *thisPerson = findPerson(obj);
if (thisPerson) {
- personaAnimation *myAnim;
+ PersonaAnimation *myAnim;
myAnim = thisPerson->myAnim;
if (myAnim != thisPerson->lastUsedAnim) {
thisPerson->lastUsedAnim = myAnim;
@@ -1595,7 +1595,7 @@ builtIn(pasteCharacter) {
builtIn(animate) {
UNUSEDALL
int obj;
- personaAnimation *pp = getAnimationFromVar(fun->stack->thisVar);
+ PersonaAnimation *pp = getAnimationFromVar(fun->stack->thisVar);
if (pp == NULL)
return BR_ERROR;
trimStack(fun->stack);
@@ -1610,7 +1610,7 @@ builtIn(animate) {
builtIn(setCostume) {
UNUSEDALL
int obj;
- persona *pp = getCostumeFromVar(fun->stack->thisVar);
+ Persona *pp = getCostumeFromVar(fun->stack->thisVar);
if (pp == NULL)
return BR_ERROR;
trimStack(fun->stack);
@@ -1683,7 +1683,7 @@ builtIn(removeCharacter) {
return BR_CONTINUE;
}
-static builtReturn moveChr(int numParams, loadedFunction *fun, bool force, bool immediate) {
+static BuiltReturn moveChr(int numParams, LoadedFunction *fun, bool force, bool immediate) {
switch (numParams) {
case 3: {
int x, y, objectNumber;
@@ -1712,7 +1712,7 @@ static builtReturn moveChr(int numParams, loadedFunction *fun, bool force, bool
case 2: {
int toObj, objectNumber;
- screenRegion *reggie;
+ ScreenRegion*reggie;
if (!getValueType(toObj, SVT_OBJTYPE, fun->stack->thisVar))
return BR_ERROR;
@@ -1816,7 +1816,7 @@ builtIn(alignStatus) {
return BR_CONTINUE;
}
-static bool getFuncNumForCallback(int numParams, loadedFunction *fun, int &functionNum) {
+static bool getFuncNumForCallback(int numParams, LoadedFunction *fun, int &functionNum) {
switch (numParams) {
case 0:
functionNum = 0;
@@ -2019,7 +2019,7 @@ builtIn(spinCharacter) {
return BR_ERROR;
trimStack(fun->stack);
- onScreenPerson *thisPerson = findPerson(objectNumber);
+ OnScreenPerson *thisPerson = findPerson(objectNumber);
if (thisPerson) {
thisPerson->wantAngle = number;
thisPerson->spinning = true;
@@ -2038,7 +2038,7 @@ builtIn(getCharacterDirection) {
if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar))
return BR_ERROR;
trimStack(fun->stack);
- onScreenPerson *thisPerson = findPerson(objectNumber);
+ OnScreenPerson *thisPerson = findPerson(objectNumber);
if (thisPerson) {
setVariable(fun->reg, SVT_INT, thisPerson->direction);
} else {
@@ -2053,7 +2053,7 @@ builtIn(isCharacter) {
if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar))
return BR_ERROR;
trimStack(fun->stack);
- onScreenPerson *thisPerson = findPerson(objectNumber);
+ OnScreenPerson *thisPerson = findPerson(objectNumber);
setVariable(fun->reg, SVT_INT, thisPerson != NULL);
return BR_CONTINUE;
}
@@ -2064,7 +2064,7 @@ builtIn(normalCharacter) {
if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar))
return BR_ERROR;
trimStack(fun->stack);
- onScreenPerson *thisPerson = findPerson(objectNumber);
+ OnScreenPerson *thisPerson = findPerson(objectNumber);
if (thisPerson) {
thisPerson->myAnim = thisPerson->myPersona->animation[thisPerson->direction];
setVariable(fun->reg, SVT_INT, 1);
@@ -2080,7 +2080,7 @@ builtIn(isMoving) {
if (!getValueType(objectNumber, SVT_OBJTYPE, fun->stack->thisVar))
return BR_ERROR;
trimStack(fun->stack);
- onScreenPerson *thisPerson = findPerson(objectNumber);
+ OnScreenPerson *thisPerson = findPerson(objectNumber);
if (thisPerson) {
setVariable(fun->reg, SVT_INT, thisPerson->walking);
} else {
@@ -2185,7 +2185,7 @@ builtIn(setCharacterSpinSpeed) {
return BR_ERROR;
trimStack(fun->stack);
- onScreenPerson *thisPerson = findPerson(who);
+ OnScreenPerson *thisPerson = findPerson(who);
if (thisPerson) {
thisPerson->spinSpeed = speed;
@@ -2206,7 +2206,7 @@ builtIn(setCharacterAngleOffset) {
return BR_ERROR;
trimStack(fun->stack);
- onScreenPerson *thisPerson = findPerson(who);
+ OnScreenPerson *thisPerson = findPerson(who);
if (thisPerson) {
thisPerson->angleOffset = angle;
@@ -2239,7 +2239,7 @@ builtIn(_rem_updateDisplay) {
builtIn(getSoundCache) {
UNUSEDALL
fun->reg.varType = SVT_STACK;
- fun->reg.varData.theStack = new stackHandler;
+ fun->reg.varData.theStack = new StackHandler;
if (!checkNew(fun->reg.varData.theStack))
return BR_ERROR;
fun->reg.varData.theStack->first = NULL;
@@ -2284,7 +2284,7 @@ builtIn(loadCustomData) {
unlinkVar(fun->reg);
fun->reg.varType = SVT_STACK;
- fun->reg.varData.theStack = new stackHandler;
+ fun->reg.varData.theStack = new StackHandler;
if (!checkNew(fun->reg.varData.theStack))
return BR_ERROR;
fun->reg.varData.theStack->first = NULL;
@@ -2359,7 +2359,7 @@ builtIn(getPixelColour) {
unlinkVar(fun->reg);
fun->reg.varType = SVT_STACK;
- fun->reg.varData.theStack = new stackHandler;
+ fun->reg.varData.theStack = new StackHandler;
if (!checkNew(fun->reg.varData.theStack))
return BR_ERROR;
fun->reg.varData.theStack->first = NULL;
@@ -2402,7 +2402,7 @@ builtIn(getCharacterScale) {
return BR_ERROR;
trimStack(fun->stack);
- onScreenPerson *pers = findPerson(objectNumber);
+ OnScreenPerson *pers = findPerson(objectNumber);
if (pers) {
setVariable(fun->reg, SVT_INT, pers->scale * 100);
} else {
@@ -2570,7 +2570,7 @@ builtIn(doBackgroundEffect) {
namespace Sludge {
-builtReturn callBuiltIn(int whichFunc, int numParams, loadedFunction *fun) {
+BuiltReturn callBuiltIn(int whichFunc, int numParams, LoadedFunction *fun) {
if (numBIFNames) {
setFatalInfo((fun->originalNumber < numUserFunc) ? allUserFunc[fun->originalNumber] : "Unknown user function",
(whichFunc < numBIFNames) ? allBIFNames[whichFunc] : "Unknown built-in function");
diff --git a/engines/sludge/builtin.h b/engines/sludge/builtin.h
index 1683b4f..b2274c2 100644
--- a/engines/sludge/builtin.h
+++ b/engines/sludge/builtin.h
@@ -25,9 +25,9 @@
namespace Sludge {
-struct loadedFunction;
+struct LoadedFunction;
-enum builtReturn {
+enum BuiltReturn {
BR_KEEP_AND_PAUSE,
BR_ERROR,
BR_CONTINUE,
@@ -37,7 +37,7 @@ enum builtReturn {
};
bool failSecurityCheck(const Common::String &fn);
-builtReturn callBuiltIn(int whichFunc, int numParams, loadedFunction *fun);
+BuiltReturn callBuiltIn(int whichFunc, int numParams, LoadedFunction *fun);
} // End of namespace Sludge
diff --git a/engines/sludge/cursors.cpp b/engines/sludge/cursors.cpp
index 10e67cf..1960844 100644
--- a/engines/sludge/cursors.cpp
+++ b/engines/sludge/cursors.cpp
@@ -31,13 +31,13 @@
namespace Sludge {
-personaAnimation *mouseCursorAnim;
+PersonaAnimation *mouseCursorAnim;
int mouseCursorFrameNum = 0;
int mouseCursorCountUp = 0;
-extern inputType input;
+extern InputType input;
-void pickAnimCursor(personaAnimation *pp) {
+void pickAnimCursor(PersonaAnimation *pp) {
deleteAnim(mouseCursorAnim);
mouseCursorAnim = pp;
mouseCursorFrameNum = 0;
@@ -82,7 +82,7 @@ void displayCursor() {
}
}
-void pasteCursor(int x, int y, personaAnimation *c) {
+void pasteCursor(int x, int y, PersonaAnimation *c) {
if (c->numFrames)
g_sludge->_gfxMan->pasteSpriteToBackDrop(x, y, c->theSprites->bank.sprites[c->frames[0].frameNum], c->theSprites->bank.myPalette);
}
diff --git a/engines/sludge/cursors.h b/engines/sludge/cursors.h
index 2d81c39..9bc5b82 100644
--- a/engines/sludge/cursors.h
+++ b/engines/sludge/cursors.h
@@ -25,9 +25,9 @@
namespace Sludge {
-void pickAnimCursor(struct personaAnimation *pp);
+void pickAnimCursor(struct PersonaAnimation *pp);
void displayCursor();
-void pasteCursor(int x, int y, struct personaAnimation *c);
+void pasteCursor(int x, int y, struct PersonaAnimation *c);
} // End of namespace Sludge
diff --git a/engines/sludge/floor.cpp b/engines/sludge/floor.cpp
index dc40ec7..1884b44 100644
--- a/engines/sludge/floor.cpp
+++ b/engines/sludge/floor.cpp
@@ -32,9 +32,9 @@
namespace Sludge {
-flor *currentFloor = NULL;
+Floor *currentFloor = NULL;
-bool pointInFloorPolygon(floorPolygon &floorPoly, int x, int y) {
+bool pointInFloorPolygon(FloorPolygon &floorPoly, int x, int y) {
int i = 0, j, c = 0;
float xp_i, yp_i;
float xp_j, yp_j;
@@ -53,7 +53,7 @@ bool pointInFloorPolygon(floorPolygon &floorPoly, int x, int y) {
return c;
}
-bool getMatchingCorners(floorPolygon &a, floorPolygon &b, int &cornerA, int &cornerB) {
+bool getMatchingCorners(FloorPolygon &a, FloorPolygon &b, int &cornerA, int &cornerB) {
int sharedVertices = 0;
int i, j;
@@ -73,7 +73,7 @@ bool getMatchingCorners(floorPolygon &a, floorPolygon &b, int &cornerA, int &cor
return false;
}
-bool polysShareSide(floorPolygon &a, floorPolygon &b) {
+bool polysShareSide(FloorPolygon &a, FloorPolygon &b) {
int sharedVertices = 0;
int i, j;
@@ -97,7 +97,7 @@ void noFloor() {
}
bool initFloor() {
- currentFloor = new flor;
+ currentFloor = new Floor;
if (!checkNew(currentFloor))
return false;
noFloor();
@@ -137,7 +137,7 @@ bool setFloor(int fileNum) {
currentFloor->originalNum = fileNum;
currentFloor->numPolygons = g_sludge->_resMan->getData()->readByte();
- currentFloor->polygon = new floorPolygon[currentFloor->numPolygons];
+ currentFloor->polygon = new FloorPolygon[currentFloor->numPolygons];
if (!checkNew(currentFloor->polygon))
return false;
diff --git a/engines/sludge/floor.h b/engines/sludge/floor.h
index c543c3f..4db7e22 100644
--- a/engines/sludge/floor.h
+++ b/engines/sludge/floor.h
@@ -26,16 +26,16 @@
namespace Sludge {
-struct floorPolygon {
+struct FloorPolygon {
int numVertices;
int *vertexID;
};
-struct flor {
+struct Floor {
int originalNum;
Common::Point *vertex;
int numPolygons;
- floorPolygon *polygon;
+ FloorPolygon *polygon;
int **matrix;
};
@@ -44,7 +44,7 @@ void setFloorNull();
bool setFloor(int fileNum);
void drawFloor();
int inFloor(int x, int y);
-bool getMatchingCorners(floorPolygon &, floorPolygon &, int &, int &);
+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
diff --git a/engines/sludge/freeze.cpp b/engines/sludge/freeze.cpp
index ebd91a3..776a6f8 100644
--- a/engines/sludge/freeze.cpp
+++ b/engines/sludge/freeze.cpp
@@ -38,13 +38,13 @@
namespace Sludge {
-extern onScreenPerson *allPeople;
-extern screenRegion *allScreenRegions;
-extern screenRegion *overRegion;
-extern speechStruct *speech;
-extern inputType input;
-extern eventHandlers *currentEvents;
-extern personaAnimation *mouseCursorAnim;
+extern OnScreenPerson *allPeople;
+extern ScreenRegion *allScreenRegions;
+extern ScreenRegion *overRegion;
+extern SpeechStruct *speech;
+extern InputType input;
+extern EventHandlers *currentEvents;
+extern PersonaAnimation *mouseCursorAnim;
extern int mouseCursorFrameNum;
void GraphicsManager::freezeGraphics() {
@@ -92,7 +92,7 @@ bool GraphicsManager::freeze() {
newFreezer->allPeople = allPeople;
allPeople = NULL;
- statusStuff *newStatusStuff = new statusStuff;
+ StatusStuff *newStatusStuff = new StatusStuff ;
if (!checkNew(newStatusStuff))
return false;
newFreezer->frozenStatus = copyStatusBarStuff(newStatusStuff);
@@ -110,10 +110,10 @@ bool GraphicsManager::freeze() {
initSpeech();
newFreezer->currentEvents = currentEvents;
- currentEvents = new eventHandlers;
+ currentEvents = new EventHandlers;
if (!checkNew(currentEvents))
return false;
- memset(currentEvents, 0, sizeof(eventHandlers));
+ memset(currentEvents, 0, sizeof(EventHandlers));
newFreezer->next = _frozenStuff;
_frozenStuff = newFreezer;
diff --git a/engines/sludge/freeze.h b/engines/sludge/freeze.h
index ff2d67c..7373d02 100644
--- a/engines/sludge/freeze.h
+++ b/engines/sludge/freeze.h
@@ -26,25 +26,25 @@
namespace Sludge {
-struct onScreenPerson;
-struct screenRegion;
-struct speechStruct;
-struct statusStuff;
-struct eventHandlers;
+struct OnScreenPerson;
+struct ScreenRegion;
+struct SpeechStruct;
+struct StatusStuff ;
+struct EventHandlers;
struct FrozenStuffStruct {
- onScreenPerson *allPeople;
- screenRegion *allScreenRegions;
+ OnScreenPerson *allPeople;
+ ScreenRegion *allScreenRegions;
Graphics::Surface backdropSurface;
Graphics::Surface lightMapSurface;
Graphics::Surface *zBufferSprites;
int zPanels;
Parallax *parallaxStuff;
int lightMapNumber, zBufferNumber;
- speechStruct *speech;
- statusStuff *frozenStatus;
- eventHandlers *currentEvents;
- personaAnimation *mouseCursorAnim;
+ SpeechStruct *speech;
+ StatusStuff *frozenStatus;
+ EventHandlers *currentEvents;
+ PersonaAnimation *mouseCursorAnim;
int mouseCursorFrameNum;
int cameraX, cameraY, sceneWidth, sceneHeight;
float cameraZoom;
diff --git a/engines/sludge/graphics.cpp b/engines/sludge/graphics.cpp
index e139e52..d2d8e9d 100644
--- a/engines/sludge/graphics.cpp
+++ b/engines/sludge/graphics.cpp
@@ -33,7 +33,7 @@
namespace Sludge {
-extern inputType input;
+extern InputType input;
GraphicsManager::GraphicsManager(SludgeEngine *vm) {
_vm = vm;
diff --git a/engines/sludge/graphics.h b/engines/sludge/graphics.h
index df8fa69..1914ea7 100644
--- a/engines/sludge/graphics.h
+++ b/engines/sludge/graphics.h
@@ -32,9 +32,9 @@ class Parallax;
class SludgeEngine;
class SpritePalette;
-struct stackHandler;
+struct StackHandler;
struct FrozenStuffStruct;
-struct onScreenPerson;
+struct OnScreenPerson;
struct SpriteBank;
struct Sprite;
struct SpriteLayers;
@@ -81,7 +81,7 @@ public:
void drawHorizontalLine(uint, uint, uint);
void drawVerticalLine(uint, uint, uint);
void hardScroll(int distance);
- bool getRGBIntoStack(uint x, uint y, stackHandler *sH);
+ bool getRGBIntoStack(uint x, uint y, StackHandler *sH);
// Lightmap
int _lightMapMode;
@@ -126,10 +126,10 @@ public:
void fontSprite(int x1, int y1, Sprite &single, const SpritePalette &fontPal);
void flipFontSprite(int x1, int y1, Sprite &single, const SpritePalette &fontPal);
- bool scaleSprite(Sprite &single, const SpritePalette &fontPal, onScreenPerson *thisPerson, bool mirror);
+ bool scaleSprite(Sprite &single, const SpritePalette &fontPal, OnScreenPerson *thisPerson, bool mirror);
void pasteSpriteToBackDrop(int x1, int y1, Sprite &single, const SpritePalette &fontPal);
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 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);
void resetSpriteLayers(ZBufferData *ptrZBuffer, int x, int y, bool upsidedown);
@@ -191,7 +191,7 @@ private:
// Sprites
SpriteLayers *_spriteLayers;
void fontSprite(bool flip, int x, int y, Sprite &single, const SpritePalette &fontPal);
- uint32 getDrawColor(onScreenPerson *thisPerson);
+ uint32 getDrawColor(OnScreenPerson *thisPerson);
// ZBuffer
ZBufferData *_zBuffer;
diff --git a/engines/sludge/loadsave.cpp b/engines/sludge/loadsave.cpp
index 1ca12a6..79dde93 100644
--- a/engines/sludge/loadsave.cpp
+++ b/engines/sludge/loadsave.cpp
@@ -54,13 +54,13 @@ namespace Sludge {
// From elsewhere
//----------------------------------------------------------------------
-extern loadedFunction *allRunningFunctions; // In sludger.cpp
+extern LoadedFunction *allRunningFunctions; // In sludger.cpp
extern const char *typeName[]; // In variable.cpp
extern int numGlobals; // In sludger.cpp
-extern variable *globalVars; // In sludger.cpp
-extern flor *currentFloor; // In floor.cpp
-extern speechStruct *speech; // In talk.cpp
-extern personaAnimation *mouseCursorAnim; // In cursor.cpp
+extern Variable *globalVars; // In sludger.cpp
+extern Floor *currentFloor; // In floor.cpp
+extern SpeechStruct *speech; // In talk.cpp
+extern PersonaAnimation *mouseCursorAnim; // In cursor.cpp
extern int mouseCursorFrameNum; // " " "
extern int loadedFontNum, fontHeight; // In fonttext.cpp
extern uint fontTableSize; //
@@ -79,7 +79,7 @@ extern uint16 saveEncoding; // in savedata.cpp
//----------------------------------------------------------------------
struct stackLibrary {
- stackHandler *stack;
+ StackHandler *stack;
stackLibrary *next;
};
@@ -89,11 +89,11 @@ stackLibrary *stackLib = NULL;
//----------------------------------------------------------------------
// For saving and loading stacks...
//----------------------------------------------------------------------
-void saveStack(variableStack *vs, Common::WriteStream *stream) {
+void saveStack(VariableStack *vs, Common::WriteStream *stream) {
int elements = 0;
int a;
- variableStack *search = vs;
+ VariableStack *search = vs;
while (search) {
elements++;
search = search->next;
@@ -107,14 +107,14 @@ void saveStack(variableStack *vs, Common::WriteStream *stream) {
}
}
-variableStack *loadStack(Common::SeekableReadStream *stream, variableStack **last) {
+VariableStack *loadStack(Common::SeekableReadStream *stream, VariableStack **last) {
int elements = stream->readUint16BE();
int a;
- variableStack *first = NULL;
- variableStack **changeMe = &first;
+ VariableStack *first = NULL;
+ VariableStack **changeMe = &first;
for (a = 0; a < elements; a++) {
- variableStack *nS = new variableStack;
+ VariableStack *nS = new VariableStack;
if (!checkNew(nS))
return NULL;
loadVariable(&(nS->thisVar), stream);
@@ -129,7 +129,7 @@ variableStack *loadStack(Common::SeekableReadStream *stream, variableStack **las
return first;
}
-bool saveStackRef(stackHandler *vs, Common::WriteStream *stream) {
+bool saveStackRef(StackHandler *vs, Common::WriteStream *stream) {
stackLibrary *s = stackLib;
int a = 0;
while (s) {
@@ -163,7 +163,7 @@ void clearStackLib() {
stackLibTotal = 0;
}
-stackHandler *getStackFromLibrary(int n) {
+StackHandler *getStackFromLibrary(int n) {
n = stackLibTotal - n;
while (n) {
stackLib = stackLib->next;
@@ -172,8 +172,8 @@ stackHandler *getStackFromLibrary(int n) {
return stackLib->stack;
}
-stackHandler *loadStackRef(Common::SeekableReadStream *stream) {
- stackHandler *nsh;
+StackHandler *loadStackRef(Common::SeekableReadStream *stream) {
+ StackHandler *nsh;
if (stream->readByte()) { // It's one we've loaded already...
nsh = getStackFromLibrary(stream->readUint16BE());
@@ -181,7 +181,7 @@ stackHandler *loadStackRef(Common::SeekableReadStream *stream) {
} else {
// Load the new stack
- nsh = new stackHandler;
+ nsh = new StackHandler;
if (!checkNew(nsh))
return NULL;
nsh->last = NULL;
@@ -204,7 +204,7 @@ stackHandler *loadStackRef(Common::SeekableReadStream *stream) {
//----------------------------------------------------------------------
// For saving and loading variables...
//----------------------------------------------------------------------
-bool saveVariable(variable *from, Common::WriteStream *stream) {
+bool saveVariable(Variable *from, Common::WriteStream *stream) {
stream->writeByte(from->varType);
switch (from->varType) {
case SVT_INT:
@@ -239,8 +239,8 @@ bool saveVariable(variable *from, Common::WriteStream *stream) {
return true;
}
-bool loadVariable(variable *to, Common::SeekableReadStream *stream) {
- to->varType = (variableType)stream->readByte();
+bool loadVariable(Variable *to, Common::SeekableReadStream *stream) {
+ to->varType = (VariableType)stream->readByte();
switch (to->varType) {
case SVT_INT:
case SVT_FUNC:
@@ -259,14 +259,14 @@ bool loadVariable(variable *to, Common::SeekableReadStream *stream) {
return true;
case SVT_COSTUME:
- to->varData.costumeHandler = new persona;
+ to->varData.costumeHandler = new Persona;
if (!checkNew(to->varData.costumeHandler))
return false;
loadCostume(to->varData.costumeHandler, stream);
return true;
case SVT_ANIM:
- to->varData.animHandler = new personaAnimation;
+ to->varData.animHandler = new PersonaAnimation ;
if (!checkNew(to->varData.animHandler))
return false;
loadAnim(to->varData.animHandler, stream);
@@ -281,7 +281,7 @@ bool loadVariable(variable *to, Common::SeekableReadStream *stream) {
//----------------------------------------------------------------------
// For saving and loading functions
//----------------------------------------------------------------------
-void saveFunction(loadedFunction *fun, Common::WriteStream *stream) {
+void saveFunction(LoadedFunction *fun, Common::WriteStream *stream) {
int a;
stream->writeUint16BE(fun->originalNumber);
if (fun->calledBy) {
@@ -306,12 +306,12 @@ void saveFunction(loadedFunction *fun, Common::WriteStream *stream) {
}
}
-loadedFunction *loadFunction(Common::SeekableReadStream *stream) {
+LoadedFunction *loadFunction(Common::SeekableReadStream *stream) {
int a;
// Reserve memory...
- loadedFunction *buildFunc = new loadedFunction;
+ LoadedFunction *buildFunc = new LoadedFunction;
if (!checkNew(buildFunc))
return NULL;
@@ -396,7 +396,7 @@ bool saveGame(const Common::String &fname) {
fp->writeUint16BE(mouseCursorFrameNum);
// Save functions
- loadedFunction *thisFunction = allRunningFunctions;
+ LoadedFunction *thisFunction = allRunningFunctions;
int countFunctions = 0;
while (thisFunction) {
countFunctions++;
@@ -561,15 +561,15 @@ bool loadGame(const Common::String &fname) {
loadHandlers(fp);
loadRegions(fp);
- mouseCursorAnim = new personaAnimation;
+ mouseCursorAnim = new PersonaAnimation ;
if (!checkNew(mouseCursorAnim))
return false;
if (!loadAnim(mouseCursorAnim, fp))
return false;
mouseCursorFrameNum = fp->readUint16BE();
- loadedFunction *rFunc;
- loadedFunction **buildList = &allRunningFunctions;
+ LoadedFunction *rFunc;
+ LoadedFunction **buildList = &allRunningFunctions;
int countFunctions = fp->readUint16BE();
while (countFunctions--) {
diff --git a/engines/sludge/loadsave.h b/engines/sludge/loadsave.h
index 8de291d..120e638 100644
--- a/engines/sludge/loadsave.h
+++ b/engines/sludge/loadsave.h
@@ -27,15 +27,15 @@ namespace Sludge {
bool saveGame(const Common::String &fname);
bool loadGame(const Common::String &fname);
-bool saveVariable(variable *from, Common::WriteStream *stream);
-bool loadVariable(variable *to, Common::SeekableReadStream *stream);
+bool saveVariable(Variable *from, Common::WriteStream *stream);
+bool loadVariable(Variable *to, Common::SeekableReadStream *stream);
-variableStack *loadStack(Common::SeekableReadStream *stream, variableStack **last);
-bool saveStackRef(stackHandler *vs, Common::WriteStream *stream);
-stackHandler *loadStackRef(Common::SeekableReadStream *stream);
+VariableStack *loadStack(Common::SeekableReadStream *stream, VariableStack **last);
+bool saveStackRef(StackHandler *vs, Common::WriteStream *stream);
+StackHandler *loadStackRef(Common::SeekableReadStream *stream);
-loadedFunction *loadFunction(Common::SeekableReadStream *stream);
-void saveFunction(loadedFunction *fun, Common::WriteStream *stream);
+LoadedFunction *loadFunction(Common::SeekableReadStream *stream);
+void saveFunction(LoadedFunction *fun, Common::WriteStream *stream);
} // End of namespace Sludge
diff --git a/engines/sludge/main_loop.cpp b/engines/sludge/main_loop.cpp
index 1d329aa..1c5beb8 100644
--- a/engines/sludge/main_loop.cpp
+++ b/engines/sludge/main_loop.cpp
@@ -54,8 +54,8 @@ HWND hMainWindow = NULL;
int realWinWidth = 640, realWinHeight = 480;
-extern inputType input;
-extern variableStack *noStack;
+extern InputType input;
+extern VariableStack *noStack;
int dialogValue = 0;
diff --git a/engines/sludge/movie.cpp b/engines/sludge/movie.cpp
index 65b6030..66e338e 100644
--- a/engines/sludge/movie.cpp
+++ b/engines/sludge/movie.cpp
@@ -41,7 +41,7 @@ int initMovieSound(int f, ALenum format, int audioChannels, ALuint samplerate,
ALuint(*callback)(void *userdata, ALubyte *data, ALuint bytes));
#endif
-movieStates movieIsPlaying = nothing;
+MovieStates movieIsPlaying = nothing;
int movieIsEnding = 0;
diff --git a/engines/sludge/movie.h b/engines/sludge/movie.h
index c34322f..c1aa119 100644
--- a/engines/sludge/movie.h
+++ b/engines/sludge/movie.h
@@ -27,10 +27,10 @@ namespace Sludge {
/*
movieIsPlaying tracks the state of movie playing
*/
-enum movieStates {
+enum MovieStates {
nothing = 0, playing, paused
};
-extern movieStates movieIsPlaying;
+extern MovieStates movieIsPlaying;
int playMovie(int fileNumber);
int stopMovie();
diff --git a/engines/sludge/people.cpp b/engines/sludge/people.cpp
index e0941a0..1021829 100644
--- a/engines/sludge/people.cpp
+++ b/engines/sludge/people.cpp
@@ -46,31 +46,31 @@
namespace Sludge {
-extern speechStruct *speech;
+extern SpeechStruct *speech;
-extern variableStack *noStack;
+extern VariableStack *noStack;
extern int ssgVersion;
-screenRegion personRegion;
-extern screenRegion *lastRegion;
-extern flor *currentFloor;
+ScreenRegion personRegion;
+extern ScreenRegion *lastRegion;
+extern Floor *currentFloor;
-onScreenPerson *allPeople = NULL;
+OnScreenPerson *allPeople = NULL;
int16 scaleHorizon = 75;
int16 scaleDivide = 150;
-extern screenRegion *allScreenRegions;
+extern ScreenRegion *allScreenRegions;
-void setFrames(onScreenPerson &m, int a) {
+void setFrames(OnScreenPerson &m, int a) {
m.myAnim = m.myPersona->animation[(a * m.myPersona->numDirections) + m.direction];
}
-personaAnimation *createPersonaAnim(int num, variableStack *&stacky) {
- personaAnimation *newP = new personaAnimation;
+PersonaAnimation *createPersonaAnim(int num, VariableStack *&stacky) {
+ PersonaAnimation *newP = new PersonaAnimation ;
checkNew(newP);
newP->numFrames = num;
- newP->frames = new animFrame[num];
+ newP->frames = new AnimFrame [num];
checkNew(newP->frames);
int a = num, frameNum, howMany;
@@ -97,8 +97,8 @@ personaAnimation *createPersonaAnim(int num, variableStack *&stacky) {
return newP;
}
-personaAnimation *makeNullAnim() {
- personaAnimation *newAnim = new personaAnimation;
+PersonaAnimation *makeNullAnim() {
+ PersonaAnimation *newAnim = new PersonaAnimation ;
if (!checkNew(newAnim))
return NULL;
@@ -108,10 +108,10 @@ personaAnimation *makeNullAnim() {
return newAnim;
}
-personaAnimation *copyAnim(personaAnimation *orig) {
+PersonaAnimation *copyAnim(PersonaAnimation *orig) {
int num = orig->numFrames;
- personaAnimation *newAnim = new personaAnimation;
+ PersonaAnimation *newAnim = new PersonaAnimation ;
if (!checkNew(newAnim))
return NULL;
@@ -121,9 +121,9 @@ personaAnimation *copyAnim(personaAnimation *orig) {
if (num) {
- // Argh!Frames!We need a whole NEW array of animFrame structures...
+ // Argh!Frames!We need a whole NEW array of AnimFrame structures...
- newAnim->frames = new animFrame[num];
+ newAnim->frames = new AnimFrame [num];
if (!checkNew(newAnim->frames))
return NULL;
@@ -139,7 +139,7 @@ personaAnimation *copyAnim(personaAnimation *orig) {
return newAnim;
}
-void deleteAnim(personaAnimation *orig) {
+void deleteAnim(PersonaAnimation *orig) {
if (orig) {
if (orig->numFrames) {
@@ -150,7 +150,7 @@ void deleteAnim(personaAnimation *orig) {
}
}
-void turnMeAngle(onScreenPerson *thisPerson, int direc) {
+void turnMeAngle(OnScreenPerson *thisPerson, int direc) {
int d = thisPerson->myPersona->numDirections;
thisPerson->angle = direc;
direc += (180 / d) + 180 + thisPerson->angleOffset;
@@ -168,7 +168,7 @@ bool initPeople() {
return true;
}
-void spinStep(onScreenPerson *thisPerson) {
+void spinStep(OnScreenPerson *thisPerson) {
int diff = (thisPerson->angle + 360) - thisPerson->wantAngle;
int eachSlice = thisPerson->spinSpeed ? thisPerson->spinSpeed : (360 / thisPerson->myPersona->numDirections);
while (diff > 180) {
@@ -185,7 +185,7 @@ void spinStep(onScreenPerson *thisPerson) {
}
}
-void rethinkAngle(onScreenPerson *thisPerson) {
+void rethinkAngle(OnScreenPerson *thisPerson) {
int d = thisPerson->myPersona->numDirections;
int direc = thisPerson->angle + (180 / d) + 180 + thisPerson->angleOffset;
while (direc >= 360)
@@ -194,7 +194,7 @@ void rethinkAngle(onScreenPerson *thisPerson) {
}
bool turnPersonToFace(int thisNum, int direc) {
- onScreenPerson *thisPerson = findPerson(thisNum);
+ OnScreenPerson *thisPerson = findPerson(thisNum);
if (thisPerson) {
if (thisPerson->continueAfterWalking)
abortFunction(thisPerson->continueAfterWalking);
@@ -209,7 +209,7 @@ bool turnPersonToFace(int thisNum, int direc) {
}
bool setPersonExtra(int thisNum, int extra) {
- onScreenPerson *thisPerson = findPerson(thisNum);
+ OnScreenPerson *thisPerson = findPerson(thisNum);
if (thisPerson) {
thisPerson->extra = extra;
if (extra & EXTRA_NOSCALE)
@@ -224,15 +224,15 @@ void setScale(int16 h, int16 d) {
scaleDivide = d;
}
-void moveAndScale(onScreenPerson &me, float x, float y) {
+void moveAndScale(OnScreenPerson &me, float x, float y) {
me.x = x;
me.y = y;
if (!(me.extra & EXTRA_NOSCALE) && scaleDivide)
me.scale = (me.y - scaleHorizon) / scaleDivide;
}
-onScreenPerson *findPerson(int v) {
- onScreenPerson *thisPerson = allPeople;
+OnScreenPerson *findPerson(int v) {
+ OnScreenPerson *thisPerson = allPeople;
while (thisPerson) {
if (v == thisPerson->thisType->objectNum)
break;
@@ -242,13 +242,13 @@ onScreenPerson *findPerson(int v) {
}
void movePerson(int x, int y, int objNum) {
- onScreenPerson *moveMe = findPerson(objNum);
+ OnScreenPerson *moveMe = findPerson(objNum);
if (moveMe)
moveAndScale(*moveMe, x, y);
}
void setShown(bool h, int ob) {
- onScreenPerson *moveMe = findPerson(ob);
+ OnScreenPerson *moveMe = findPerson(ob);
if (moveMe)
moveMe->show = h;
}
@@ -277,7 +277,7 @@ enum drawModes {
numDrawModes
};
-void setMyDrawMode(onScreenPerson *moveMe, int h) {
+void setMyDrawMode(OnScreenPerson *moveMe, int h) {
switch (h) {
case drawModeTransparent3:
moveMe->r = moveMe->g = moveMe->b = 0;
@@ -384,7 +384,7 @@ void setMyDrawMode(onScreenPerson *moveMe, int h) {
}
void setDrawMode(int h, int ob) {
- onScreenPerson *moveMe = findPerson(ob);
+ OnScreenPerson *moveMe = findPerson(ob);
if (!moveMe)
return;
@@ -392,7 +392,7 @@ void setDrawMode(int h, int ob) {
}
void setPersonTransparency(int ob, byte x) {
- onScreenPerson *moveMe = findPerson(ob);
+ OnScreenPerson *moveMe = findPerson(ob);
if (!moveMe)
return;
@@ -402,7 +402,7 @@ void setPersonTransparency(int ob, byte x) {
}
void setPersonColourise(int ob, byte r, byte g, byte b, byte colourmix) {
- onScreenPerson *moveMe = findPerson(ob);
+ OnScreenPerson *moveMe = findPerson(ob);
if (!moveMe)
return;
@@ -412,11 +412,11 @@ void setPersonColourise(int ob, byte r, byte g, byte b, byte colourmix) {
moveMe->colourmix = colourmix;
}
-extern screenRegion *overRegion;
+extern ScreenRegion *overRegion;
void shufflePeople() {
- onScreenPerson **thisReference = &allPeople;
- onScreenPerson *A, *B;
+ OnScreenPerson **thisReference = &allPeople;
+ OnScreenPerson *A, *B;
if (!allPeople)
return;
@@ -445,8 +445,8 @@ void shufflePeople() {
void drawPeople() {
shufflePeople();
- onScreenPerson *thisPerson = allPeople;
- personaAnimation *myAnim = NULL;
+ OnScreenPerson *thisPerson = allPeople;
+ PersonaAnimation *myAnim = NULL;
overRegion = NULL;
while (thisPerson) {
@@ -512,11 +512,11 @@ void drawPeople() {
}
}
-void makeTalker(onScreenPerson &me) {
+void makeTalker(OnScreenPerson &me) {
setFrames(me, ANI_TALK);
}
-void makeSilent(onScreenPerson &me) {
+void makeSilent(OnScreenPerson &me) {
setFrames(me, ANI_STAND);
}
@@ -563,7 +563,7 @@ bool handleClosestPoint(int &setX, int &setY, int &setPoly) {
return true;
}
-bool doBorderStuff(onScreenPerson *moveMe) {
+bool doBorderStuff(OnScreenPerson *moveMe) {
if (moveMe->inPoly == moveMe->walkToPoly) {
moveMe->inPoly = -1;
moveMe->thisStepX = moveMe->walkToX;
@@ -633,7 +633,7 @@ bool doBorderStuff(onScreenPerson *moveMe) {
return true;
}
-bool walkMe(onScreenPerson *thisPerson, bool move = true) {
+bool walkMe(OnScreenPerson *thisPerson, bool move = true) {
float xDiff, yDiff, maxDiff, s;
for (;;) {
@@ -674,12 +674,12 @@ bool walkMe(onScreenPerson *thisPerson, bool move = true) {
return false;
}
-bool makeWalkingPerson(int x, int y, int objNum, loadedFunction *func, int di) {
+bool makeWalkingPerson(int x, int y, int objNum, LoadedFunction *func, int di) {
if (x == 0 && y == 0)
return false;
if (currentFloor->numPolygons == 0)
return false;
- onScreenPerson *moveMe = findPerson(objNum);
+ OnScreenPerson *moveMe = findPerson(objNum);
if (!moveMe)
return false;
@@ -714,7 +714,7 @@ bool makeWalkingPerson(int x, int y, int objNum, loadedFunction *func, int di) {
}
bool stopPerson(int o) {
- onScreenPerson *moveMe = findPerson(o);
+ OnScreenPerson *moveMe = findPerson(o);
if (moveMe)
if (moveMe->continueAfterWalking) {
abortFunction(moveMe->continueAfterWalking);
@@ -727,10 +727,10 @@ bool stopPerson(int o) {
return false;
}
-bool forceWalkingPerson(int x, int y, int objNum, loadedFunction *func, int di) {
+bool forceWalkingPerson(int x, int y, int objNum, LoadedFunction *func, int di) {
if (x == 0 && y == 0)
return false;
- onScreenPerson *moveMe = findPerson(objNum);
+ OnScreenPerson *moveMe = findPerson(objNum);
if (!moveMe)
return false;
@@ -760,7 +760,7 @@ bool forceWalkingPerson(int x, int y, int objNum, loadedFunction *func, int di)
void jumpPerson(int x, int y, int objNum) {
if (x == 0 && y == 0)
return;
- onScreenPerson *moveMe = findPerson(objNum);
+ OnScreenPerson *moveMe = findPerson(objNum);
if (!moveMe)
return;
if (moveMe->continueAfterWalking)
@@ -772,7 +772,7 @@ void jumpPerson(int x, int y, int objNum) {
}
bool floatCharacter(int f, int objNum) {
- onScreenPerson *moveMe = findPerson(objNum);
+ OnScreenPerson *moveMe = findPerson(objNum);
if (!moveMe)
return false;
moveMe->floaty = f;
@@ -782,7 +782,7 @@ bool floatCharacter(int f, int objNum) {
bool setCharacterWalkSpeed(int f, int objNum) {
if (f <= 0)
return false;
- onScreenPerson *moveMe = findPerson(objNum);
+ OnScreenPerson *moveMe = findPerson(objNum);
if (!moveMe)
return false;
moveMe->walkSpeed = f;
@@ -790,7 +790,7 @@ bool setCharacterWalkSpeed(int f, int objNum) {
}
void walkAllPeople() {
- onScreenPerson *thisPerson = allPeople;
+ OnScreenPerson *thisPerson = allPeople;
while (thisPerson) {
if (thisPerson->walking) {
@@ -807,8 +807,8 @@ void walkAllPeople() {
}
}
-bool addPerson(int x, int y, int objNum, persona *p) {
- onScreenPerson *newPerson = new onScreenPerson;
+bool addPerson(int x, int y, int objNum, Persona *p) {
+ OnScreenPerson *newPerson = new OnScreenPerson;
if (!checkNew(newPerson))
return false;
@@ -856,7 +856,7 @@ bool addPerson(int x, int y, int objNum, persona *p) {
}
// NOW ADD IT IN THE RIGHT PLACE
- onScreenPerson **changethat = &allPeople;
+ OnScreenPerson **changethat = &allPeople;
while (((*changethat) != NULL) && ((*changethat)->y < y))
changethat = &((*changethat)->next);
@@ -867,7 +867,7 @@ bool addPerson(int x, int y, int objNum, persona *p) {
return (bool)(newPerson->thisType != NULL);
}
-int timeForAnim(personaAnimation *fram) {
+int timeForAnim(PersonaAnimation *fram) {
int total = 0;
for (int a = 0; a < fram->numFrames; a++) {
total += fram->frames[a].howMany;
@@ -875,8 +875,8 @@ int timeForAnim(personaAnimation *fram) {
return total;
}
-void animatePerson(int obj, personaAnimation *fram) { // Set a new SINGLE animation
- onScreenPerson *moveMe = findPerson(obj);
+void animatePerson(int obj, PersonaAnimation *fram) { // Set a new SINGLE animation
+ OnScreenPerson *moveMe = findPerson(obj);
if (moveMe) {
if (moveMe->continueAfterWalking)
abortFunction(moveMe->continueAfterWalking);
@@ -887,8 +887,8 @@ void animatePerson(int obj, personaAnimation *fram) { // Set a new SINGLE animat
}
}
-void animatePerson(int obj, persona *per) { // Set a new costume
- onScreenPerson *moveMe = findPerson(obj);
+void animatePerson(int obj, Persona *per) { // Set a new costume
+ OnScreenPerson *moveMe = findPerson(obj);
if (moveMe) {
// if (moveMe->continueAfterWalking) abortFunction (moveMe->continueAfterWalking);
// moveMe->continueAfterWalking = NULL;
@@ -905,7 +905,7 @@ void animatePerson(int obj, persona *per) { // Set a new costume
}
void killAllPeople() {
- onScreenPerson *killPeople;
+ OnScreenPerson *killPeople;
while (allPeople) {
if (allPeople->continueAfterWalking)
abortFunction(allPeople->continueAfterWalking);
@@ -918,8 +918,8 @@ void killAllPeople() {
}
void killMostPeople() {
- onScreenPerson *killPeople;
- onScreenPerson **lookyHere = &allPeople;
+ OnScreenPerson *killPeople;
+ OnScreenPerson **lookyHere = &allPeople;
while (*lookyHere) {
if ((*lookyHere)->extra & EXTRA_NOREMOVE) {
@@ -941,7 +941,7 @@ void killMostPeople() {
}
void removeOneCharacter(int i) {
- onScreenPerson *p = findPerson(i);
+ OnScreenPerson *p = findPerson(i);
if (p) {
if (overRegion == &personRegion && overRegion->thisType == p->thisType) {
@@ -951,7 +951,7 @@ void removeOneCharacter(int i) {
if (p->continueAfterWalking)
abortFunction(p->continueAfterWalking);
p->continueAfterWalking = NULL;
- onScreenPerson **killPeople;
+ OnScreenPerson **killPeople;
for (killPeople = &allPeople; *killPeople != p; killPeople = &((*killPeople)->next)) {
;
@@ -963,7 +963,7 @@ void removeOneCharacter(int i) {
}
}
-bool saveAnim(personaAnimation *p, Common::WriteStream *stream) {
+bool saveAnim(PersonaAnimation *p, Common::WriteStream *stream) {
stream->writeUint16BE(p->numFrames);
if (p->numFrames) {
stream->writeUint32LE(p->theSprites->ID);
@@ -977,12 +977,12 @@ bool saveAnim(personaAnimation *p, Common::WriteStream *stream) {
return true;
}
-bool loadAnim(personaAnimation *p, Common::SeekableReadStream *stream) {
+bool loadAnim(PersonaAnimation *p, Common::SeekableReadStream *stream) {
p->numFrames = stream->readUint16BE();
if (p->numFrames) {
int a = stream->readUint32LE();
- p->frames = new animFrame[p->numFrames];
+ p->frames = new AnimFrame [p->numFrames];
if (!checkNew(p->frames))
return false;
p->theSprites = loadBankForAnim(a);
@@ -1003,7 +1003,7 @@ bool loadAnim(personaAnimation *p, Common::SeekableReadStream *stream) {
return true;
}
-bool saveCostume(persona *cossy, Common::WriteStream *stream) {
+bool saveCostume(Persona *cossy, Common::WriteStream *stream) {
int a;
stream->writeUint16BE(cossy->numDirections);
for (a = 0; a < cossy->numDirections * 3; a++) {
@@ -1014,14 +1014,14 @@ bool saveCostume(persona *cossy, Common::WriteStream *stream) {
return true;
}
-bool loadCostume(persona *cossy, Common::SeekableReadStream *stream) {
+bool loadCostume(Persona *cossy, Common::SeekableReadStream *stream) {
int a;
cossy->numDirections = stream->readUint16BE();
- cossy->animation = new personaAnimation *[cossy->numDirections * 3];
+ cossy->animation = new PersonaAnimation *[cossy->numDirections * 3];
if (!checkNew(cossy->animation))
return false;
for (a = 0; a < cossy->numDirections * 3; a++) {
- cossy->animation[a] = new personaAnimation;
+ cossy->animation[a] = new PersonaAnimation ;
if (!checkNew(cossy->animation[a]))
return false;
@@ -1033,7 +1033,7 @@ bool loadCostume(persona *cossy, Common::SeekableReadStream *stream) {
}
bool savePeople(Common::WriteStream *stream) {
- onScreenPerson *me = allPeople;
+ OnScreenPerson *me = allPeople;
int countPeople = 0, a;
stream->writeSint16LE(scaleHorizon);
@@ -1100,8 +1100,8 @@ bool savePeople(Common::WriteStream *stream) {
}
bool loadPeople(Common::SeekableReadStream *stream) {
- onScreenPerson **pointy = &allPeople;
- onScreenPerson *me;
+ OnScreenPerson **pointy = &allPeople;
+ OnScreenPerson *me;
scaleHorizon = stream->readSint16LE();
scaleDivide = stream->readSint16LE();
@@ -1111,15 +1111,15 @@ bool loadPeople(Common::SeekableReadStream *stream) {
allPeople = NULL;
for (a = 0; a < countPeople; a++) {
- me = new onScreenPerson;
+ me = new OnScreenPerson;
if (!checkNew(me))
return false;
- me->myPersona = new persona;
+ me->myPersona = new Persona;
if (!checkNew(me->myPersona))
return false;
- me->myAnim = new personaAnimation;
+ me->myAnim = new PersonaAnimation ;
if (!checkNew(me->myAnim))
return false;
diff --git a/engines/sludge/people.h b/engines/sludge/people.h
index 470f352..95b8e92 100644
--- a/engines/sludge/people.h
+++ b/engines/sludge/people.h
@@ -26,7 +26,7 @@
namespace Sludge {
-struct animFrame {
+struct AnimFrame {
int frameNum, howMany;
int noise;
};
@@ -40,28 +40,28 @@ struct animFrame {
#define EXTRA_NOREMOVE 32
#define EXTRA_RECTANGULAR 64
-struct personaAnimation {
+struct PersonaAnimation {
struct LoadedSpriteBank *theSprites;
- animFrame *frames;
+ AnimFrame *frames;
int numFrames;
};
-struct persona {
- personaAnimation **animation;
+struct Persona {
+ PersonaAnimation **animation;
int numDirections;
};
-struct onScreenPerson {
+struct OnScreenPerson {
float x, y;
int height, floaty, walkSpeed;
float scale;
- onScreenPerson *next;
+ OnScreenPerson *next;
int walkToX, walkToY, thisStepX, thisStepY, inPoly, walkToPoly;
bool walking, spinning;
- struct loadedFunction *continueAfterWalking;
- personaAnimation *myAnim;
- personaAnimation *lastUsedAnim;
- persona *myPersona;
+ struct LoadedFunction *continueAfterWalking;
+ PersonaAnimation *myAnim;
+ PersonaAnimation *lastUsedAnim;
+ Persona *myPersona;
int frameNum, frameTick, angle, wantAngle, angleOffset;
bool show;
int direction, directionWhenDoneWalking;
@@ -72,7 +72,7 @@ struct onScreenPerson {
// Initialisation and creation
bool initPeople();
-bool addPerson(int x, int y, int objNum, persona *p);
+bool addPerson(int x, int y, int objNum, Persona *p);
// Draw to screen and to backdrop
void drawPeople();
@@ -84,12 +84,12 @@ void killMostPeople();
void removeOneCharacter(int i);
// Things which affect or use all characters
-onScreenPerson *findPerson(int v);
+OnScreenPerson *findPerson(int v);
void setScale(int16 h, int16 d);
// Things which affect one character
-void makeTalker(onScreenPerson &me);
-void makeSilent(onScreenPerson &me);
+void makeTalker(OnScreenPerson &me);
+void makeSilent(OnScreenPerson &me);
void setShown(bool h, int ob);
void setDrawMode(int h, int ob);
void setPersonTransparency(int ob, byte x);
@@ -97,8 +97,8 @@ void setPersonColourise(int ob, byte r, byte g, byte b, byte colourmix);
// Moving 'em
void movePerson(int x, int y, int objNum);
-bool makeWalkingPerson(int x, int y, int objNum, struct loadedFunction *func, int di);
-bool forceWalkingPerson(int x, int y, int objNum, struct loadedFunction *func, int di);
+bool makeWalkingPerson(int x, int y, int objNum, struct LoadedFunction *func, int di);
+bool forceWalkingPerson(int x, int y, int objNum, struct LoadedFunction *func, int di);
void jumpPerson(int x, int y, int objNum);
void walkAllPeople();
bool turnPersonToFace(int thisNum, int direc);
@@ -107,25 +107,25 @@ bool floatCharacter(int f, int objNum);
bool setCharacterWalkSpeed(int f, int objNum);
// Animating 'em
-void animatePerson(int obj, personaAnimation *);
-void animatePerson(int obj, persona *per);
-personaAnimation *createPersonaAnim(int num, struct variableStack *&stacky);
-inline void setBankFile(personaAnimation *newP, LoadedSpriteBank *sB) {
+void animatePerson(int obj, PersonaAnimation *);
+void animatePerson(int obj, Persona *per);
+PersonaAnimation *createPersonaAnim(int num, struct VariableStack *&stacky);
+inline void setBankFile(PersonaAnimation *newP, LoadedSpriteBank *sB) {
newP->theSprites = sB;
}
bool setPersonExtra(int f, int newSetting);
-int timeForAnim(personaAnimation *fram);
-personaAnimation *copyAnim(personaAnimation *orig);
-personaAnimation *makeNullAnim();
-void deleteAnim(personaAnimation *orig);
+int timeForAnim(PersonaAnimation *fram);
+PersonaAnimation *copyAnim(PersonaAnimation *orig);
+PersonaAnimation *makeNullAnim();
+void deleteAnim(PersonaAnimation *orig);
// Loading and saving
-bool saveAnim(personaAnimation *p, Common::WriteStream *stream);
-bool loadAnim(personaAnimation *p, Common::SeekableReadStream *stream);
+bool saveAnim(PersonaAnimation *p, Common::WriteStream *stream);
+bool loadAnim(PersonaAnimation *p, Common::SeekableReadStream *stream);
bool savePeople(Common::WriteStream *stream);
bool loadPeople(Common::SeekableReadStream *stream);
-bool saveCostume(persona *cossy, Common::WriteStream *stream);
-bool loadCostume(persona *cossy, Common::SeekableReadStream *stream);
+bool saveCostume(Persona *cossy, Common::WriteStream *stream);
+bool loadCostume(Persona *cossy, Common::SeekableReadStream *stream);
} // End of namespace Sludge
diff --git a/engines/sludge/region.cpp b/engines/sludge/region.cpp
index ec4e66a..d7fba70 100644
--- a/engines/sludge/region.cpp
+++ b/engines/sludge/region.cpp
@@ -32,12 +32,12 @@
namespace Sludge {
-screenRegion *allScreenRegions = NULL;
-screenRegion *overRegion = NULL;
-extern inputType input;
+ScreenRegion *allScreenRegions = NULL;
+ScreenRegion *overRegion = NULL;
+extern InputType input;
void showBoxes() {
- screenRegion *huntRegion = allScreenRegions;
+ ScreenRegion*huntRegion = allScreenRegions;
while (huntRegion) {
g_sludge->_gfxMan->drawVerticalLine(huntRegion->x1, huntRegion->y1, huntRegion->y2);
@@ -49,8 +49,8 @@ void showBoxes() {
}
void removeScreenRegion(int objectNum) {
- screenRegion **huntRegion = &allScreenRegions;
- screenRegion *killMe;
+ ScreenRegion **huntRegion = &allScreenRegions;
+ ScreenRegion *killMe;
while (*huntRegion) {
if ((*huntRegion)->thisType->objectNum == objectNum) {
@@ -69,7 +69,7 @@ void removeScreenRegion(int objectNum) {
void saveRegions(Common::WriteStream *stream) {
int numRegions = 0;
- screenRegion *thisRegion = allScreenRegions;
+ ScreenRegion *thisRegion = allScreenRegions;
while (thisRegion) {
thisRegion = thisRegion->next;
numRegions++;
@@ -93,11 +93,11 @@ void saveRegions(Common::WriteStream *stream) {
void loadRegions(Common::SeekableReadStream *stream) {
int numRegions = stream->readUint16BE();
- screenRegion *newRegion;
- screenRegion **pointy = &allScreenRegions;
+ ScreenRegion *newRegion;
+ ScreenRegion **pointy = &allScreenRegions;
while (numRegions--) {
- newRegion = new screenRegion;
+ newRegion = new ScreenRegion;
*pointy = newRegion;
pointy = &(newRegion->next);
@@ -114,7 +114,7 @@ void loadRegions(Common::SeekableReadStream *stream) {
}
void killAllRegions() {
- screenRegion *killRegion;
+ ScreenRegion *killRegion;
while (allScreenRegions) {
killRegion = allScreenRegions;
allScreenRegions = allScreenRegions->next;
@@ -126,7 +126,7 @@ void killAllRegions() {
bool addScreenRegion(int x1, int y1, int x2, int y2, int sX, int sY, int di,
int objectNum) {
- screenRegion *newRegion = new screenRegion;
+ ScreenRegion *newRegion = new ScreenRegion;
if (!checkNew(newRegion))
return false;
newRegion->di = di;
@@ -145,7 +145,7 @@ bool addScreenRegion(int x1, int y1, int x2, int y2, int sX, int sY, int di,
void getOverRegion() {
int cameraX = g_sludge->_gfxMan->getCamX();
int cameraY = g_sludge->_gfxMan->getCamY();
- screenRegion *thisRegion = allScreenRegions;
+ ScreenRegion *thisRegion = allScreenRegions;
while (thisRegion) {
if ((input.mouseX >= thisRegion->x1 - cameraX)
&& (input.mouseY >= thisRegion->y1 - cameraY)
@@ -160,8 +160,8 @@ void getOverRegion() {
return;
}
-screenRegion *getRegionForObject(int obj) {
- screenRegion *thisRegion = allScreenRegions;
+ScreenRegion *getRegionForObject(int obj) {
+ ScreenRegion *thisRegion = allScreenRegions;
while (thisRegion) {
if (obj == thisRegion->thisType->objectNum) {
diff --git a/engines/sludge/region.h b/engines/sludge/region.h
index ce4157f..afbe80e 100644
--- a/engines/sludge/region.h
+++ b/engines/sludge/region.h
@@ -24,15 +24,15 @@
namespace Sludge {
-struct screenRegion {
+struct ScreenRegion {
int x1, y1, x2, y2, sX, sY, di;
ObjectType *thisType;
- screenRegion *next;
+ ScreenRegion *next;
};
bool addScreenRegion(int x1, int y1, int x2, int y2, int, int, int, int objectNum);
void getOverRegion();
-screenRegion *getRegionForObject(int obj);
+ScreenRegion *getRegionForObject(int obj);
void removeScreenRegion(int objectNum);
void loadRegions(Common::SeekableReadStream *stream);
void saveRegions(Common::WriteStream *stream);
diff --git a/engines/sludge/savedata.cpp b/engines/sludge/savedata.cpp
index 280d2dc..9b75e13 100644
--- a/engines/sludge/savedata.cpp
+++ b/engines/sludge/savedata.cpp
@@ -94,9 +94,9 @@ char *readTextPlain(Common::File *fp) {
return reply;
}
-bool fileToStack(const Common::String &filename, stackHandler *sH) {
+bool fileToStack(const Common::String &filename, StackHandler *sH) {
- variable stringVar;
+ Variable stringVar;
stringVar.varType = SVT_NULL;
Common::String checker = saveEncoding ? "[Custom data (encoded)]\r\n" : "[Custom data (ASCII)]\n";
@@ -193,12 +193,12 @@ bool fileToStack(const Common::String &filename, stackHandler *sH) {
return true;
}
-bool stackToFile(const Common::String &filename, const variable &from) {
+bool stackToFile(const Common::String &filename, const Variable &from) {
#if 0
FILE *fp = fopen(filename, saveEncoding ? "wb" : "wt");
if (!fp) return fatal("Can't create file", filename);
- variableStack *hereWeAre = from.varData.theStack -> first;
+ VariableStack *hereWeAre = from.varData.theStack -> first;
encode1 = (byte)saveEncoding & 255;
encode2 = (byte)(saveEncoding >> 8);
diff --git a/engines/sludge/savedata.h b/engines/sludge/savedata.h
index 5031e76..956df93 100644
--- a/engines/sludge/savedata.h
+++ b/engines/sludge/savedata.h
@@ -24,8 +24,8 @@
namespace Sludge {
-bool fileToStack(const Common::String &filename, stackHandler *sH);
-bool stackToFile(const Common::String &filename, const variable &from);
+bool fileToStack(const Common::String &filename, StackHandler *sH);
+bool stackToFile(const Common::String &filename, const Variable &from);
} // End of namespace Sludge
diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp
index 029257c..12d76b9 100644
--- a/engines/sludge/sludger.cpp
+++ b/engines/sludge/sludger.cpp
@@ -53,9 +53,9 @@
namespace Sludge {
-extern personaAnimation *mouseCursorAnim;
+extern PersonaAnimation *mouseCursorAnim;
extern int dialogValue;
-extern variable *launchResult;
+extern Variable *launchResult;
int numBIFNames = 0;
Common::String *allBIFNames;
@@ -71,18 +71,18 @@ bool captureAllKeys = false;
byte brightnessLevel = 255;
-eventHandlers mainHandlers;
-eventHandlers *currentEvents = &mainHandlers;
+EventHandlers mainHandlers;
+EventHandlers *currentEvents = &mainHandlers;
-extern screenRegion *overRegion;
-extern speechStruct *speech;
-extern loadedFunction *saverFunc;
+extern ScreenRegion *overRegion;
+extern SpeechStruct *speech;
+extern LoadedFunction *saverFunc;
-loadedFunction *allRunningFunctions = NULL;
-screenRegion *lastRegion = NULL;
-variableStack *noStack = NULL;
-inputType input;
-variable *globalVars;
+LoadedFunction *allRunningFunctions = NULL;
+ScreenRegion *lastRegion = NULL;
+VariableStack *noStack = NULL;
+InputType input;
+Variable *globalVars;
int numGlobals;
const char *sludgeText[] = { "?????", "RETURN", "BRANCH", "BR_ZERO",
@@ -273,7 +273,7 @@ bool initSludge(const Common::String &filename) {
numGlobals = fp->readUint16BE();
debug(kSludgeDebugDataLoad, "numGlobals : %i", numGlobals);
- globalVars = new variable[numGlobals];
+ globalVars = new Variable[numGlobals];
if (!checkNew(globalVars))
return false;
for (a = 0; a < numGlobals; a++)
@@ -308,8 +308,8 @@ void sludgeDisplay() {
if (brightnessLevel < 255) fixBrightness();// This is for transitionLevel special effects
}
-void pauseFunction(loadedFunction *fun) {
- loadedFunction **huntAndDestroy = &allRunningFunctions;
+void pauseFunction(LoadedFunction *fun) {
+ LoadedFunction **huntAndDestroy = &allRunningFunctions;
while (*huntAndDestroy) {
if (fun == *huntAndDestroy) {
(*huntAndDestroy) = (*huntAndDestroy)->next;
@@ -320,13 +320,13 @@ void pauseFunction(loadedFunction *fun) {
}
}
-void restartFunction(loadedFunction *fun) {
+void restartFunction(LoadedFunction *fun) {
fun->next = allRunningFunctions;
allRunningFunctions = fun;
}
void killSpeechTimers() {
- loadedFunction *thisFunction = allRunningFunctions;
+ LoadedFunction *thisFunction = allRunningFunctions;
while (thisFunction) {
if (thisFunction->freezerLevel == 0 && thisFunction->isSpeech
@@ -341,7 +341,7 @@ void killSpeechTimers() {
}
void completeTimers() {
- loadedFunction *thisFunction = allRunningFunctions;
+ LoadedFunction *thisFunction = allRunningFunctions;
while (thisFunction) {
if (thisFunction->freezerLevel == 0)
@@ -350,7 +350,7 @@ void completeTimers() {
}
}
-void finishFunction(loadedFunction *fun) {
+void finishFunction(LoadedFunction *fun) {
int a;
pauseFunction(fun);
@@ -365,7 +365,7 @@ void finishFunction(loadedFunction *fun) {
fun = NULL;
}
-void abortFunction(loadedFunction *fun) {
+void abortFunction(LoadedFunction *fun) {
int a;
pauseFunction(fun);
@@ -382,11 +382,11 @@ void abortFunction(loadedFunction *fun) {
fun = NULL;
}
-int cancelAFunction(int funcNum, loadedFunction *myself, bool &killedMyself) {
+int cancelAFunction(int funcNum, LoadedFunction *myself, bool &killedMyself) {
int n = 0;
killedMyself = false;
- loadedFunction *fun = allRunningFunctions;
+ LoadedFunction *fun = allRunningFunctions;
while (fun) {
if (fun->originalNumber == funcNum) {
fun->cancelMe = true;
@@ -400,7 +400,7 @@ int cancelAFunction(int funcNum, loadedFunction *myself, bool &killedMyself) {
}
void freezeSubs() {
- loadedFunction *thisFunction = allRunningFunctions;
+ LoadedFunction *thisFunction = allRunningFunctions;
while (thisFunction) {
if (thisFunction->unfreezable) {
@@ -413,7 +413,7 @@ void freezeSubs() {
}
void unfreezeSubs() {
- loadedFunction *thisFunction = allRunningFunctions;
+ LoadedFunction *thisFunction = allRunningFunctions;
while (thisFunction) {
if (thisFunction->freezerLevel)
@@ -422,7 +422,7 @@ void unfreezeSubs() {
}
}
-bool continueFunction(loadedFunction *fun) {
+bool continueFunction(LoadedFunction *fun) {
bool keepLooping = true;
bool advanceNow;
uint param;
@@ -457,7 +457,7 @@ bool continueFunction(loadedFunction *fun) {
switch (com) {
case SLU_RETURN:
if (fun->calledBy) {
- loadedFunction *returnTo = fun->calledBy;
+ LoadedFunction *returnTo = fun->calledBy;
if (fun->returnSomething)
copyVariable(fun->reg, returnTo->reg);
finishFunction(fun);
@@ -493,7 +493,7 @@ bool continueFunction(loadedFunction *fun) {
case SVT_BUILT: {
debug(kSludgeDebugStackMachine, "Built-in init value: %i",
fun->reg.varData.intValue);
- builtReturn br = callBuiltIn(fun->reg.varData.intValue, param,
+ BuiltReturn br = callBuiltIn(fun->reg.varData.intValue, param,
fun);
switch (br) {
@@ -619,7 +619,7 @@ bool continueFunction(loadedFunction *fun) {
int ii;
if (!getValueType(ii, SVT_INT, fun->reg))
return false;
- variable *grab =
+ Variable *grab =
(fun->stack->thisVar.varType == SVT_FASTARRAY) ?
fastArrayGetByIndex(
fun->stack->thisVar.varData.fastArray,
@@ -685,7 +685,7 @@ bool continueFunction(loadedFunction *fun) {
int ii;
if (!getValueType(ii, SVT_INT, fun->reg))
return false;
- variable *v = fastArrayGetByIndex(
+ Variable *v = fastArrayGetByIndex(
fun->stack->thisVar.varData.fastArray, ii);
if (v == NULL)
return fatal("Not within bounds of fast array.");
@@ -897,8 +897,8 @@ bool continueFunction(loadedFunction *fun) {
bool runSludge() {
- loadedFunction *thisFunction = allRunningFunctions;
- loadedFunction *nextFunction;
+ LoadedFunction *thisFunction = allRunningFunctions;
+ LoadedFunction *nextFunction;
while (thisFunction) {
nextFunction = thisFunction->next;
@@ -939,7 +939,7 @@ bool runSludge() {
return true;
}
-bool loadFunctionCode(loadedFunction *newFunc) {
+bool loadFunctionCode(LoadedFunction *newFunc) {
uint numLines, numLinesRead;
if (!g_sludge->_resMan->openSubSlice(newFunc->originalNumber))
@@ -955,7 +955,7 @@ bool loadFunctionCode(loadedFunction *newFunc) {
debug(kSludgeDebugDataLoad, "numArgs: %i", newFunc->numArgs);
newFunc->numLocals = readStream->readUint16BE();
debug(kSludgeDebugDataLoad, "numLocals: %i", newFunc->numLocals);
- newFunc->compiledLines = new lineOfCode[numLines];
+ newFunc->compiledLines = new LineOfCode[numLines];
if (!checkNew(newFunc->compiledLines))
return false;
@@ -968,7 +968,7 @@ bool loadFunctionCode(loadedFunction *newFunc) {
g_sludge->_resMan->finishAccess();
// Now we need to reserve memory for the local variables
- newFunc->localVars = new variable[newFunc->numLocals];
+ newFunc->localVars = new Variable[newFunc->numLocals];
if (!checkNew(newFunc->localVars))
return false;
for (int a = 0; a < newFunc->numLocals; a++) {
@@ -979,8 +979,8 @@ bool loadFunctionCode(loadedFunction *newFunc) {
}
int startNewFunctionNum(uint funcNum, uint numParamsExpected,
- loadedFunction *calledBy, variableStack *&vStack, bool returnSommet) {
- loadedFunction *newFunc = new loadedFunction;
+ LoadedFunction *calledBy, VariableStack *&vStack, bool returnSommet) {
+ LoadedFunction *newFunc = new LoadedFunction;
checkNew(newFunc);
newFunc->originalNumber = funcNum;
@@ -989,7 +989,7 @@ int startNewFunctionNum(uint funcNum, uint numParamsExpected,
if (newFunc->numArgs != (int) numParamsExpected)
return fatal("Wrong number of parameters!");
if (newFunc->numArgs > newFunc->numLocals)
- return fatal("More arguments than local variable space!");
+ return fatal("More arguments than local Variable space!");
// Now, lets copy the parameters from the calling function's stack...
@@ -1050,7 +1050,7 @@ bool handleInput() {
input.justMoved = false;
if (lastRegion != overRegion && currentEvents->focusFunction) {
- variableStack *tempStack = new variableStack;
+ VariableStack *tempStack = new VariableStack;
if (!checkNew(tempStack))
return false;
@@ -1195,7 +1195,7 @@ bool handleInput() {
}
if (!tempString.empty()) {
- variableStack *tempStack = new variableStack;
+ VariableStack *tempStack = new VariableStack;
if (!checkNew(tempStack))
return false;
initVarNew(tempStack->thisVar);
diff --git a/engines/sludge/sludger.h b/engines/sludge/sludger.h
index fe5d9b8..fe00cc6 100644
--- a/engines/sludge/sludger.h
+++ b/engines/sludge/sludger.h
@@ -36,10 +36,10 @@ typedef struct _FILETIME {
uint32 dwHighDateTime;
} FILETIME;
-struct variable;
-struct variableStack;
+struct Variable;
+struct VariableStack;
-struct eventHandlers {
+struct EventHandlers {
int leftMouseFunction;
int leftMouseUpFunction;
int rightMouseFunction;
@@ -49,26 +49,26 @@ struct eventHandlers {
int spaceFunction;
};
-struct lineOfCode {
+struct LineOfCode {
sludgeCommand theCommand;
int32 param;
};
-struct loadedFunction {
+struct LoadedFunction {
int originalNumber;
- lineOfCode *compiledLines;
+ LineOfCode *compiledLines;
int numLocals, timeLeft, numArgs;
- variable *localVars;
- variableStack *stack;
- variable reg;
+ Variable *localVars;
+ VariableStack *stack;
+ Variable reg;
uint runThisLine;
- loadedFunction *calledBy;
- loadedFunction *next;
+ LoadedFunction *calledBy;
+ LoadedFunction *next;
bool returnSomething, isSpeech, unfreezable, cancelMe;
byte freezerLevel;
};
-struct inputType {
+struct InputType {
bool leftClick, rightClick, justMoved, leftRelease, rightRelease;
int mouseX, mouseY, keyPressed;
};
@@ -76,22 +76,22 @@ struct inputType {
bool initSludge(const Common::String &);
void displayBase();
void sludgeDisplay();
-int startNewFunctionNum(uint, uint, loadedFunction *, variableStack*&, bool = true);
+int startNewFunctionNum(uint, uint, LoadedFunction *, VariableStack*&, bool = true);
bool handleInput();
-void restartFunction(loadedFunction *fun);
-bool loadFunctionCode(loadedFunction *newFunc);
+void restartFunction(LoadedFunction *fun);
+bool loadFunctionCode(LoadedFunction *newFunc);
void loadHandlers(Common::SeekableReadStream *stream);
void saveHandlers(Common::WriteStream *stream);
-void finishFunction(loadedFunction *fun);
-void abortFunction(loadedFunction *fun);
+void finishFunction(LoadedFunction *fun);
+void abortFunction(LoadedFunction *fun);
Common::File *openAndVerify(const Common::String &filename, char extra1, char extra2, const char *er, int &fileVersion);
void freezeSubs();
void unfreezeSubs();
void completeTimers();
void killSpeechTimers();
-int cancelAFunction(int funcNum, loadedFunction *myself, bool &killedMyself);
+int cancelAFunction(int funcNum, LoadedFunction *myself, bool &killedMyself);
} // End of namespace Sludge
diff --git a/engines/sludge/sound.cpp b/engines/sludge/sound.cpp
index 702a8c9..5d6b426 100644
--- a/engines/sludge/sound.cpp
+++ b/engines/sludge/sound.cpp
@@ -48,7 +48,7 @@ bool soundOK = false;
bool SilenceIKillYou = false;
bool isHandlingSoundList = false;
// there's possibility that several sound list played at the same time
-typedef Common::List<soundList *> SoundListHandles;
+typedef Common::List<SoundList*> SoundListHandles;
SoundListHandles soundListHandles;
struct soundThing {
@@ -459,8 +459,8 @@ void loadSounds(Common::SeekableReadStream *stream) {
defVol = stream->readUint16BE();
}
-bool getSoundCacheStack(stackHandler *sH) {
- variable newFileHandle;
+bool getSoundCacheStack(StackHandler *sH) {
+ Variable newFileHandle;
newFileHandle.varType = SVT_NULL;
for (int a = 0; a < MAX_SAMPLES; a++) {
@@ -475,12 +475,12 @@ bool getSoundCacheStack(stackHandler *sH) {
return true;
}
-bool deleteSoundFromList(soundList *&s) {
+bool deleteSoundFromList(SoundList*&s) {
// Don't delete a playing sound.
if (s->cacheIndex)
return false;
- soundList *o = NULL;
+ SoundList*o = NULL;
if (!s->next) {
o = s->prev;
if (o)
@@ -505,7 +505,7 @@ void handleSoundLists() {
return;
isHandlingSoundList = true;
for (SoundListHandles::iterator it = soundListHandles.begin(); it != soundListHandles.end(); ++it) {
- soundList *s = (*it);
+ SoundList*s = (*it);
int a = s->cacheIndex;
bool remove = false;
if (!g_sludge->_mixer->isSoundHandleActive(soundCache[a].handle)) { // reach the end of stream
@@ -546,7 +546,7 @@ void handleSoundLists() {
}
// loop a list of sound
-void playSoundList(soundList *s) {
+void playSoundList(SoundList*s) {
if (soundOK) {
// Load sound
Audio::AudioStream *stream;
diff --git a/engines/sludge/sound.h b/engines/sludge/sound.h
index 3255c31..8e9038d 100644
--- a/engines/sludge/sound.h
+++ b/engines/sludge/sound.h
@@ -32,15 +32,15 @@
namespace Sludge {
// Sound list stuff
-struct soundList {
+struct SoundList{
int sound;
- struct soundList *next;
- struct soundList *prev;
+ struct SoundList*next;
+ struct SoundList*prev;
int cacheIndex;
int vol;
};
-bool deleteSoundFromList(soundList *&s);
-void playSoundList(soundList *s);
+bool deleteSoundFromList(SoundList*&s);
+void playSoundList(SoundList*s);
void handleSoundLists(); // to produce the same effects as end of stream call back functions
// GENERAL...
@@ -62,7 +62,7 @@ void setSoundVolume(int a, int v);
void setDefaultSoundVolume(int v);
void setSoundLoop(int a, int s, int e);
bool stillPlayingSound(int ch);
-bool getSoundCacheStack(stackHandler *sH);
+bool getSoundCacheStack(StackHandler *sH);
int findInSoundCache(int a);
void debugSounds();
diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index 7c9f9f1..6a0421e 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -38,7 +38,7 @@
namespace Sludge {
-extern inputType input;
+extern InputType input;
void GraphicsManager::forgetSpriteBank(SpriteBank &forgetme) {
if (forgetme.myPalette.pal) {
delete[] forgetme.myPalette.pal;
@@ -323,7 +323,7 @@ void GraphicsManager::flipFontSprite(int x, int y, Sprite &single, const SpriteP
fontSprite(true, x, y, single, fontPal);
}
-uint32 GraphicsManager::getDrawColor(onScreenPerson *thisPerson) {
+uint32 GraphicsManager::getDrawColor(OnScreenPerson *thisPerson) {
//TODO: how to mix secondary color
#if 0
if (thisPerson->colourmix) {
@@ -338,7 +338,7 @@ uint32 GraphicsManager::getDrawColor(onScreenPerson *thisPerson) {
(uint8)(_curLight[2] * (255 - thisPerson->colourmix) / 255.f));
}
-bool GraphicsManager::scaleSprite(Sprite &single, const SpritePalette &fontPal, onScreenPerson *thisPerson, bool mirror) {
+bool GraphicsManager::scaleSprite(Sprite &single, const SpritePalette &fontPal, OnScreenPerson *thisPerson, bool mirror) {
float x = thisPerson->x;
float y = thisPerson->y;
@@ -463,7 +463,7 @@ void GraphicsManager::killSpriteLayers() {
}
// Paste a scaled sprite onto the backdrop
-void GraphicsManager::fixScaleSprite(int x, int y, Sprite &single, const SpritePalette &fontPal, onScreenPerson *thisPerson, int camX, int camY, bool mirror) {
+void GraphicsManager::fixScaleSprite(int x, int y, Sprite &single, const SpritePalette &fontPal, OnScreenPerson *thisPerson, int camX, int camY, bool mirror) {
float scale = thisPerson->scale;
bool useZB = !(thisPerson->extra & EXTRA_NOZB);
diff --git a/engines/sludge/statusba.cpp b/engines/sludge/statusba.cpp
index 04902ed..e46736a 100644
--- a/engines/sludge/statusba.cpp
+++ b/engines/sludge/statusba.cpp
@@ -37,8 +37,8 @@ namespace Sludge {
SpritePalette verbLinePalette;
SpritePalette litVerbLinePalette;
-statusStuff mainStatus;
-statusStuff *nowStatus = & mainStatus;
+StatusStuff mainStatus;
+StatusStuff *nowStatus = & mainStatus;
extern int fontHeight;
void setLitStatus(int i) {
@@ -47,15 +47,15 @@ void setLitStatus(int i) {
void killLastStatus() {
if (nowStatus->firstStatusBar) {
- statusBar *kill = nowStatus->firstStatusBar;
+ StatusBar *kill = nowStatus->firstStatusBar;
nowStatus->firstStatusBar = kill->next;
delete kill;
}
}
void clearStatusBar() {
- statusBar *stat = nowStatus->firstStatusBar;
- statusBar *kill;
+ StatusBar *stat = nowStatus->firstStatusBar;
+ StatusBar *kill;
nowStatus->litStatus = -1;
while (stat) {
kill = stat;
@@ -66,7 +66,7 @@ void clearStatusBar() {
}
void addStatusBar() {
- statusBar *newStat = new statusBar;
+ StatusBar *newStat = new StatusBar;
if (checkNew(newStat)) {
newStat->next = nowStatus->firstStatusBar;
newStat->text.clear();
@@ -89,7 +89,7 @@ void positionStatus(int x, int y) {
void drawStatusBar() {
float cameraZoom = g_sludge->_gfxMan->getCamZoom();
int y = nowStatus->statusY, n = 0;
- statusBar *stat = nowStatus->firstStatusBar;
+ StatusBar *stat = nowStatus->firstStatusBar;
while (stat) {
switch (nowStatus->alignStatus) {
case IN_THE_CENTRE:
@@ -122,7 +122,7 @@ void statusBarLitColour(byte r, byte g, byte b) {
nowStatus->statusLB = b;
}
-statusStuff *copyStatusBarStuff(statusStuff *here) {
+StatusStuff *copyStatusBarStuff(StatusStuff *here) {
// Things we want to keep
here->statusLR = nowStatus->statusLR;
@@ -139,13 +139,13 @@ statusStuff *copyStatusBarStuff(statusStuff *here) {
here->litStatus = -1;
here->firstStatusBar = NULL;
- statusStuff *old = nowStatus;
+ StatusStuff *old = nowStatus;
nowStatus = here;
return old;
}
-void restoreBarStuff(statusStuff *here) {
+void restoreBarStuff(StatusStuff *here) {
delete nowStatus;
setFontColour(verbLinePalette, here->statusR, here->statusG, here->statusB);
setFontColour(litVerbLinePalette, here->statusLR, here->statusLG, here->statusLB);
@@ -172,7 +172,7 @@ const Common::String statusBarText() {
}
void saveStatusBars(Common::WriteStream *stream) {
- statusBar *viewLine = nowStatus->firstStatusBar;
+ StatusBar *viewLine = nowStatus->firstStatusBar;
stream->writeUint16BE(nowStatus->alignStatus);
stream->writeSint16LE(nowStatus->litStatus);
@@ -213,10 +213,10 @@ bool loadStatusBars(Common::SeekableReadStream *stream) {
setFontColour(verbLinePalette, nowStatus->statusR, nowStatus->statusG, nowStatus->statusB);
setFontColour(litVerbLinePalette, nowStatus->statusLR, nowStatus->statusLG, nowStatus->statusLB);
// Read what's being said
- statusBar **viewLine = & (nowStatus->firstStatusBar);
- statusBar *newOne;
+ StatusBar **viewLine = & (nowStatus->firstStatusBar);
+ StatusBar *newOne;
while (stream->readByte()) {
- newOne = new statusBar;
+ newOne = new StatusBar;
if (! checkNew(newOne)) return false;
newOne->text = readString(stream);
newOne->next = NULL;
diff --git a/engines/sludge/statusba.h b/engines/sludge/statusba.h
index 96404fc..2f98f36 100644
--- a/engines/sludge/statusba.h
+++ b/engines/sludge/statusba.h
@@ -26,13 +26,13 @@
namespace Sludge {
-struct statusBar {
+struct StatusBar {
Common::String text;
- statusBar *next;
+ StatusBar *next;
};
-struct statusStuff {
- statusBar *firstStatusBar;
+struct StatusStuff {
+ StatusBar *firstStatusBar;
uint16 alignStatus;
int litStatus;
int statusX, statusY;
@@ -58,8 +58,8 @@ bool loadStatusBars(Common::SeekableReadStream *stream);
void saveStatusBars(Common::WriteStream *stream);
// For freezing
-void restoreBarStuff(statusStuff *here);
-statusStuff *copyStatusBarStuff(statusStuff *here);
+void restoreBarStuff(StatusStuff *here);
+StatusStuff *copyStatusBarStuff(StatusStuff *here);
} // End of namespace Sludge
diff --git a/engines/sludge/talk.cpp b/engines/sludge/talk.cpp
index 32bad40..4e8cd3f 100644
--- a/engines/sludge/talk.cpp
+++ b/engines/sludge/talk.cpp
@@ -39,11 +39,11 @@
namespace Sludge {
extern int fontHeight, speechMode;
-speechStruct *speech;
+SpeechStruct *speech;
float speechSpeed = 1;
void initSpeech() {
- speech = new speechStruct;
+ speech = new SpeechStruct;
if (checkNew(speech)) {
speech->currentTalker = NULL;
speech->allSpeech = NULL;
@@ -63,7 +63,7 @@ void killAllSpeech() {
speech->currentTalker = NULL;
}
- speechLine *killMe;
+ SpeechLine *killMe;
while (speech->allSpeech) {
killMe = speech->allSpeech;
@@ -81,7 +81,7 @@ void addSpeechLine(const Common::String &theLine, int x, int &offset) {
int halfWidth = (stringWidth(theLine) >> 1) / cameraZoom;
int xx1 = x - (halfWidth);
int xx2 = x + (halfWidth);
- speechLine *newLine = new speechLine;
+ SpeechLine *newLine = new SpeechLine;
checkNew(newLine);
newLine->next = speech->allSpeech;
@@ -152,7 +152,7 @@ int wrapSpeechXY(const Common::String &theText, int x, int y, int wrap, int samp
+ (float) (g_system->getHeight() - fontHeight / 3) / cameraZoom;
if (offset) {
- speechLine *viewLine = speech->allSpeech;
+ SpeechLine *viewLine = speech->allSpeech;
while (viewLine) {
viewLine->x += offset;
viewLine = viewLine->next;
@@ -161,7 +161,7 @@ int wrapSpeechXY(const Common::String &theText, int x, int y, int wrap, int samp
return speechTime;
}
-int wrapSpeechPerson(const Common::String &theText, onScreenPerson &thePerson, int sampleFile, bool animPerson) {
+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,
@@ -182,12 +182,12 @@ int wrapSpeech(const Common::String &theText, int objT, int sampleFile, bool ani
int cameraY = g_sludge->_gfxMan->getCamY();
speech->lookWhosTalking = objT;
- onScreenPerson *thisPerson = findPerson(objT);
+ OnScreenPerson *thisPerson = findPerson(objT);
if (thisPerson) {
setObjFontColour(thisPerson->thisType);
i = wrapSpeechPerson(theText, *thisPerson, sampleFile, animPerson);
} else {
- screenRegion *thisRegion = getRegionForObject(objT);
+ ScreenRegion *thisRegion = getRegionForObject(objT);
if (thisRegion) {
setObjFontColour(thisRegion->thisType);
i = wrapSpeechXY(theText,
@@ -207,7 +207,7 @@ int wrapSpeech(const Common::String &theText, int objT, int sampleFile, bool ani
void viewSpeech() {
float cameraZoom = g_sludge->_gfxMan->getCamZoom();
int viewY = speech->speechY;
- speechLine *viewLine = speech->allSpeech;
+ SpeechLine *viewLine = speech->allSpeech;
while (viewLine) {
pasteString(viewLine->textLine, viewLine->x, viewY, speech->talkCol);
viewY -= fontHeight / cameraZoom;
@@ -215,8 +215,8 @@ void viewSpeech() {
}
}
-void saveSpeech(speechStruct *sS, Common::WriteStream *stream) {
- speechLine *viewLine = sS->allSpeech;
+void saveSpeech(SpeechStruct *sS, Common::WriteStream *stream) {
+ SpeechLine *viewLine = sS->allSpeech;
stream->writeByte(sS->talkCol.originalRed);
stream->writeByte(sS->talkCol.originalGreen);
@@ -246,7 +246,7 @@ void saveSpeech(speechStruct *sS, Common::WriteStream *stream) {
stream->writeByte(0);
}
-bool loadSpeech(speechStruct *sS, Common::SeekableReadStream *stream) {
+bool loadSpeech(SpeechStruct *sS, Common::SeekableReadStream *stream) {
speech->currentTalker = NULL;
killAllSpeech();
byte r = stream->readByte();
@@ -269,11 +269,11 @@ bool loadSpeech(speechStruct *sS, Common::SeekableReadStream *stream) {
}
// Read what's being said
- speechLine **viewLine = &sS->allSpeech;
- speechLine *newOne;
+ SpeechLine **viewLine = &sS->allSpeech;
+ SpeechLine *newOne;
speech->lastFile = -1;
while (stream->readByte()) {
- newOne = new speechLine;
+ newOne = new SpeechLine;
if (! checkNew(newOne)) return false;
newOne->textLine = readString(stream);
newOne->x = stream->readUint16BE();
diff --git a/engines/sludge/talk.h b/engines/sludge/talk.h
index de535ad..0d7fa80 100644
--- a/engines/sludge/talk.h
+++ b/engines/sludge/talk.h
@@ -26,15 +26,15 @@
namespace Sludge {
-struct speechLine {
+struct SpeechLine {
Common::String textLine;
- speechLine *next;
+ SpeechLine *next;
int x;
};
-struct speechStruct {
- onScreenPerson *currentTalker;
- speechLine *allSpeech;
+struct SpeechStruct {
+ OnScreenPerson *currentTalker;
+ SpeechLine *allSpeech;
int speechY, lastFile, lookWhosTalking;
SpritePalette talkCol;
};
@@ -44,8 +44,8 @@ void viewSpeech();
void killAllSpeech();
int isThereAnySpeechGoingOn();
void initSpeech();
-void saveSpeech(speechStruct *sS, Common::WriteStream *stream);
-bool loadSpeech(speechStruct *sS, Common::SeekableReadStream *stream);
+void saveSpeech(SpeechStruct *sS, Common::WriteStream *stream);
+bool loadSpeech(SpeechStruct *sS, Common::SeekableReadStream *stream);
} // End of namespace Sludge
diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp
index 5b03dad..541d13b 100644
--- a/engines/sludge/variable.cpp
+++ b/engines/sludge/variable.cpp
@@ -37,7 +37,7 @@ const char *typeName[] = { "undefined", "number", "user function", "string",
"built-in function", "file", "stack", "object type", "animation",
"costume" };
-void unlinkVar(variable &thisVar) {
+void unlinkVar(Variable &thisVar) {
switch (thisVar.varType) {
case SVT_STRING:
delete []thisVar.varData.theString;
@@ -72,45 +72,45 @@ void unlinkVar(variable &thisVar) {
}
}
-void setVariable(variable &thisVar, variableType vT, int value) {
+void setVariable(Variable &thisVar, VariableType vT, int value) {
unlinkVar(thisVar);
thisVar.varType = vT;
thisVar.varData.intValue = value;
}
-void newAnimationVariable(variable &thisVar, personaAnimation *i) {
+void newAnimationVariable(Variable &thisVar, PersonaAnimation *i) {
unlinkVar(thisVar);
thisVar.varType = SVT_ANIM;
thisVar.varData.animHandler = i;
}
-personaAnimation *getAnimationFromVar(variable &thisVar) {
+PersonaAnimation *getAnimationFromVar(Variable &thisVar) {
if (thisVar.varType == SVT_ANIM)
return copyAnim(thisVar.varData.animHandler);
if (thisVar.varType == SVT_INT && thisVar.varData.intValue == 0)
return makeNullAnim();
- fatal("Expecting an animation variable; found variable of type", typeName[thisVar.varType]);
+ fatal("Expecting an animation variable; found Variable of type", typeName[thisVar.varType]);
return NULL;
}
-void newCostumeVariable(variable &thisVar, persona *i) {
+void newCostumeVariable(Variable &thisVar, Persona *i) {
unlinkVar(thisVar);
thisVar.varType = SVT_COSTUME;
thisVar.varData.costumeHandler = i;
}
-persona *getCostumeFromVar(variable &thisVar) {
- persona *p = NULL;
+Persona *getCostumeFromVar(Variable &thisVar) {
+ Persona *p = NULL;
switch (thisVar.varType) {
case SVT_ANIM:
- p = new persona;
+ p = new Persona;
if (!checkNew(p))
return NULL;
p->numDirections = 1;
- p->animation = new personaAnimation *[3];
+ p->animation = new PersonaAnimation *[3];
if (!checkNew(p->animation))
return NULL;
@@ -124,15 +124,15 @@ persona *getCostumeFromVar(variable &thisVar) {
break;
default:
- fatal("Expecting an animation variable; found variable of type", typeName[thisVar.varType]);
+ fatal("Expecting an animation variable; found Variable of type", typeName[thisVar.varType]);
}
return p;
}
-int stackSize(const stackHandler *me) {
+int stackSize(const StackHandler *me) {
int r = 0;
- variableStack *a = me->first;
+ VariableStack *a = me->first;
while (a) {
r++;
a = a->next;
@@ -140,12 +140,12 @@ int stackSize(const stackHandler *me) {
return r;
}
-bool getSavedGamesStack(stackHandler *sH, const Common::String &ext) {
+bool getSavedGamesStack(StackHandler *sH, const Common::String &ext) {
#if 0
Common::String pattern = "*";
pattern += ext;
- variable newName;
+ Variable newName;
newName.varType = SVT_NULL;
DIR *dir = opendir(".");
@@ -173,15 +173,15 @@ bool getSavedGamesStack(stackHandler *sH, const Common::String &ext) {
return true;
}
-bool copyStack(const variable &from, variable &to) {
+bool copyStack(const Variable &from, Variable &to) {
to.varType = SVT_STACK;
- to.varData.theStack = new stackHandler;
+ to.varData.theStack = new StackHandler;
if (!checkNew(to.varData.theStack))
return false;
to.varData.theStack->first = NULL;
to.varData.theStack->last = NULL;
to.varData.theStack->timesUsed = 1;
- variableStack *a = from.varData.theStack->first;
+ VariableStack *a = from.varData.theStack->first;
while (a) {
addVarToStack(a->thisVar, to.varData.theStack->first);
@@ -194,7 +194,7 @@ bool copyStack(const variable &from, variable &to) {
return true;
}
-void addVariablesInSecond(variable &var1, variable &var2) {
+void addVariablesInSecond(Variable &var1, Variable &var2) {
if (var1.varType == SVT_INT && var2.varType == SVT_INT) {
var2.varData.intValue += var1.varData.intValue;
} else {
@@ -207,7 +207,7 @@ void addVariablesInSecond(variable &var1, variable &var2) {
}
}
-int compareVars(const variable &var1, const variable &var2) {
+int compareVars(const Variable &var1, const Variable &var2) {
int re = 0;
if (var1.varType == var2.varType) {
switch (var1.varType) {
@@ -238,7 +238,7 @@ int compareVars(const variable &var1, const variable &var2) {
return re;
}
-void compareVariablesInSecond(const variable &var1, variable &var2) {
+void compareVariablesInSecond(const Variable &var1, Variable &var2) {
setVariable(var2, SVT_INT, compareVars(var1, var2));
}
@@ -253,18 +253,18 @@ char *createCString(const Common::String &s) {
return res;
}
-void makeTextVar(variable &thisVar, const Common::String &txt) {
+void makeTextVar(Variable &thisVar, const Common::String &txt) {
unlinkVar(thisVar);
thisVar.varType = SVT_STRING;
thisVar.varData.theString = createCString(txt);
}
-bool loadStringToVar(variable &thisVar, int value) {
+bool loadStringToVar(Variable &thisVar, int value) {
makeTextVar(thisVar, g_sludge->_resMan->getNumberedString(value));
return (bool)(thisVar.varData.theString != NULL);
}
-Common::String getTextFromAnyVar(const variable &from) {
+Common::String getTextFromAnyVar(const Variable &from) {
switch (from.varType) {
case SVT_STRING:
return from.varData.theString;
@@ -288,7 +288,7 @@ Common::String getTextFromAnyVar(const variable &from) {
Common::String builder2 = "";
Common::String grabText = "";
- variableStack *stacky = from.varData.theStack->first;
+ VariableStack *stacky = from.varData.theStack->first;
while (stacky) {
builder2 = builder + " ";
@@ -323,7 +323,7 @@ Common::String getTextFromAnyVar(const variable &from) {
return typeName[from.varType];
}
-bool getBoolean(const variable &from) {
+bool getBoolean(const Variable &from) {
switch (from.varType) {
case SVT_NULL:
return false;
@@ -346,7 +346,7 @@ bool getBoolean(const variable &from) {
return true;
}
-bool copyMain(const variable &from, variable &to) {
+bool copyMain(const Variable &from, Variable &to) {
to.varType = from.varType;
switch (to.varType) {
case SVT_INT:
@@ -389,26 +389,26 @@ bool copyMain(const variable &from, variable &to) {
return false;
}
-bool copyVariable(const variable &from, variable &to) {
+bool copyVariable(const Variable &from, Variable &to) {
unlinkVar(to);
return copyMain(from, to);
}
-variable *fastArrayGetByIndex(fastArrayHandler *vS, uint theIndex) {
+Variable *fastArrayGetByIndex(FastArrayHandler *vS, uint theIndex) {
if ((int)theIndex >= vS->size)
return NULL;
return &vS->fastVariables[theIndex];
}
-bool makeFastArraySize(variable &to, int size) {
+bool makeFastArraySize(Variable &to, int size) {
if (size < 0)
return fatal("Can't create a fast array with a negative number of elements!");
unlinkVar(to);
to.varType = SVT_FASTARRAY;
- to.varData.fastArray = new fastArrayHandler;
+ to.varData.fastArray = new FastArrayHandler;
if (!checkNew(to.varData.fastArray))
return false;
- to.varData.fastArray->fastVariables = new variable[size];
+ to.varData.fastArray->fastVariables = new Variable[size];
if (!checkNew(to.varData.fastArray->fastVariables))
return false;
for (int i = 0; i < size; i++) {
@@ -419,14 +419,14 @@ bool makeFastArraySize(variable &to, int size) {
return true;
}
-bool makeFastArrayFromStack(variable &to, const stackHandler *stacky) {
+bool makeFastArrayFromStack(Variable &to, const StackHandler *stacky) {
int size = stackSize(stacky);
if (!makeFastArraySize(to, size))
return false;
// Now let's fill up the new array
- variableStack *allV = stacky->first;
+ VariableStack *allV = stacky->first;
size = 0;
while (allV) {
copyMain(allV->thisVar, to.varData.fastArray->fastVariables[size]);
@@ -437,15 +437,15 @@ bool makeFastArrayFromStack(variable &to, const stackHandler *stacky) {
}
/*
- bool moveVariable (variable & from, variable & to) {
+ bool moveVariable (Variable & from, Variable & to) {
unlinkVar (to);
memcpy (& to, & from, sizeof (variable));
from.varType = SVT_NULL;
}
*/
-bool addVarToStack(const variable &va, variableStack *&thisStack) {
- variableStack *newStack = new variableStack;
+bool addVarToStack(const Variable &va, VariableStack *&thisStack) {
+ VariableStack *newStack = new VariableStack;
if (!checkNew(newStack))
return false;
@@ -457,14 +457,14 @@ bool addVarToStack(const variable &va, variableStack *&thisStack) {
return true;
}
-bool addVarToStackQuick(variable &va, variableStack *&thisStack) {
- variableStack *newStack = new variableStack;
+bool addVarToStackQuick(Variable &va, VariableStack *&thisStack) {
+ VariableStack *newStack = new VariableStack;
if (!checkNew(newStack))
return false;
// if (! copyMain (va, newStack -> thisVar)) return false;
- memcpy(&(newStack->thisVar), &va, sizeof(variable));
+ memcpy(&(newStack->thisVar), &va, sizeof(Variable));
va.varType = SVT_NULL;
newStack->next = thisStack;
@@ -473,7 +473,7 @@ bool addVarToStackQuick(variable &va, variableStack *&thisStack) {
return true;
}
-bool stackSetByIndex(variableStack *vS, uint theIndex, const variable &va) {
+bool stackSetByIndex(VariableStack *vS, uint theIndex, const Variable &va) {
while (theIndex--) {
vS = vS->next;
if (!vS)
@@ -482,7 +482,7 @@ bool stackSetByIndex(variableStack *vS, uint theIndex, const variable &va) {
return copyVariable(va, vS->thisVar);
}
-variable *stackGetByIndex(variableStack *vS, uint theIndex) {
+Variable *stackGetByIndex(VariableStack *vS, uint theIndex) {
while (theIndex--) {
vS = vS->next;
if (!vS) {
@@ -492,9 +492,9 @@ variable *stackGetByIndex(variableStack *vS, uint theIndex) {
return &(vS->thisVar);
}
-int deleteVarFromStack(const variable &va, variableStack *&thisStack, bool allOfEm) {
- variableStack **huntVar = &thisStack;
- variableStack *killMe;
+int deleteVarFromStack(const Variable &va, VariableStack *&thisStack, bool allOfEm) {
+ VariableStack **huntVar = &thisStack;
+ VariableStack *killMe;
int reply = 0;
while (*huntVar) {
@@ -515,7 +515,7 @@ int deleteVarFromStack(const variable &va, variableStack *&thisStack, bool allOf
}
// Would be a LOT better just to keep this up to date in the above function... ah well
-variableStack *stackFindLast(variableStack *hunt) {
+VariableStack *stackFindLast(VariableStack *hunt) {
if (hunt == NULL)
return NULL;
@@ -525,7 +525,7 @@ variableStack *stackFindLast(variableStack *hunt) {
return hunt;
}
-bool getValueType(int &toHere, variableType vT, const variable &v) {
+bool getValueType(int &toHere, VariableType vT, const Variable &v) {
//if (! v) return false;
if (v.varType != vT) {
Common::String e1 = "Can only perform specified operation on a value which is of type ";
@@ -540,8 +540,8 @@ bool getValueType(int &toHere, variableType vT, const variable &v) {
return true;
}
-void trimStack(variableStack *&stack) {
- variableStack *killMe = stack;
+void trimStack(VariableStack *&stack) {
+ VariableStack *killMe = stack;
stack = stack->next;
//debug(kSludgeDebugStackMachine, "Variable %s was removed from stack", getTextFromAnyVar(killMe->thisVar));
diff --git a/engines/sludge/variable.h b/engines/sludge/variable.h
index 6c0aff4..005eb1c 100644
--- a/engines/sludge/variable.h
+++ b/engines/sludge/variable.h
@@ -24,10 +24,10 @@
namespace Sludge {
-struct variable;
-struct variableStack;
+struct Variable;
+struct VariableStack;
-enum variableType {
+enum VariableType {
SVT_NULL,
SVT_INT,
SVT_FUNC,
@@ -42,35 +42,35 @@ enum variableType {
SVT_NUM_TYPES
};
-struct fastArrayHandler {
- struct variable *fastVariables;
+struct FastArrayHandler {
+ struct Variable *fastVariables;
int size;
int timesUsed;
};
-struct stackHandler {
- struct variableStack *first;
- struct variableStack *last;
+struct StackHandler {
+ struct VariableStack *first;
+ struct VariableStack *last;
int timesUsed;
};
-union variableData {
+union VariableData {
signed int intValue;
const char *theString;
- stackHandler *theStack;
- struct personaAnimation *animHandler;
- struct persona *costumeHandler;
- fastArrayHandler *fastArray;
+ StackHandler *theStack;
+ struct PersonaAnimation *animHandler;
+ struct Persona *costumeHandler;
+ FastArrayHandler *fastArray;
};
-struct variable {
- variableType varType;
- variableData varData;
+struct Variable {
+ VariableType varType;
+ VariableData varData;
};
-struct variableStack {
- variable thisVar;
- variableStack *next;
+struct VariableStack {
+ Variable thisVar;
+ VariableStack *next;
};
// Initialisation
@@ -79,43 +79,43 @@ struct variableStack {
// Setting variables
-void setVariable(variable &thisVar, variableType vT, int value);
-bool copyVariable(const variable &from, variable &to);
-bool loadStringToVar(variable &thisVar, int value);
-void newAnimationVariable(variable &thisVar, struct personaAnimation *i);
-void newCostumeVariable(variable &thisVar, struct persona *i);
-void makeTextVar(variable &thisVar, const Common::String &txt);
-void addVariablesInSecond(variable &var1, variable &var2);
-void compareVariablesInSecond(const variable &var1, variable &var2);
+void setVariable(Variable &thisVar, VariableType vT, int value);
+bool copyVariable(const Variable &from, Variable &to);
+bool loadStringToVar(Variable &thisVar, int value);
+void newAnimationVariable(Variable &thisVar, struct PersonaAnimation *i);
+void newCostumeVariable(Variable &thisVar, struct Persona *i);
+void makeTextVar(Variable &thisVar, const Common::String &txt);
+void addVariablesInSecond(Variable &var1, Variable &var2);
+void compareVariablesInSecond(const Variable &var1, Variable &var2);
char *createCString(const Common::String &s);
// Misc.
-void unlinkVar(variable &thisVar);
+void unlinkVar(Variable &thisVar);
Common::String getNumberedString(int value);
-Common::String getTextFromAnyVar(const variable &from);
-struct persona *getCostumeFromVar(variable &thisVar);
-struct personaAnimation *getAnimationFromVar(variable &thisVar);
-bool getBoolean(const variable &from);
-bool getValueType(int &toHere, variableType vT, const variable &v);
+Common::String getTextFromAnyVar(const Variable &from);
+struct Persona *getCostumeFromVar(Variable &thisVar);
+struct PersonaAnimation *getAnimationFromVar(Variable &thisVar);
+bool getBoolean(const Variable &from);
+bool getValueType(int &toHere, VariableType vT, const Variable &v);
// Stacky stuff
-bool addVarToStack(const variable &va, variableStack *&thisStack);
-bool addVarToStackQuick(variable &va, variableStack *&thisStack);
-void trimStack(variableStack *&stack);
-int deleteVarFromStack(const variable &va, variableStack *&thisStack,
+bool addVarToStack(const Variable &va, VariableStack *&thisStack);
+bool addVarToStackQuick(Variable &va, VariableStack *&thisStack);
+void trimStack(VariableStack *&stack);
+int deleteVarFromStack(const Variable &va, VariableStack *&thisStack,
bool allOfEm = false);
-variableStack *stackFindLast(variableStack *hunt);
-bool copyStack(const variable &from, variable &to);
-int stackSize(const stackHandler *me);
-bool stackSetByIndex(variableStack *, uint, const variable &);
-variable *stackGetByIndex(variableStack *, uint);
-bool getSavedGamesStack(stackHandler *sH, const Common::String &ext);
-
-bool makeFastArrayFromStack(variable &to, const stackHandler *stacky);
-bool makeFastArraySize(variable &to, int size);
-variable *fastArrayGetByIndex(fastArrayHandler *vS, uint theIndex);
+VariableStack *stackFindLast(VariableStack *hunt);
+bool copyStack(const Variable &from, Variable &to);
+int stackSize(const StackHandler *me);
+bool stackSetByIndex(VariableStack *, uint, const Variable &);
+Variable *stackGetByIndex(VariableStack *, uint);
+bool getSavedGamesStack(StackHandler *sH, const Common::String &ext);
+
+bool makeFastArrayFromStack(Variable &to, const StackHandler *stacky);
+bool makeFastArraySize(Variable &to, int size);
+Variable *fastArrayGetByIndex(FastArrayHandler *vS, uint theIndex);
} // End of namespace Sludge
Commit: 0fb4a1ddd228cdcedb1313aa8df6ac2b9ba97530
https://github.com/scummvm/scummvm/commit/0fb4a1ddd228cdcedb1313aa8df6ac2b9ba97530
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-07-20T19:10:01+02:00
Commit Message:
SLUDGE: Objectify input and event handler
Changed paths:
A engines/sludge/event.cpp
A engines/sludge/event.h
engines/sludge/backdrop.cpp
engines/sludge/builtin.cpp
engines/sludge/cursors.cpp
engines/sludge/freeze.cpp
engines/sludge/freeze.h
engines/sludge/graphics.cpp
engines/sludge/graphics.h
engines/sludge/loadsave.cpp
engines/sludge/main_loop.cpp
engines/sludge/module.mk
engines/sludge/movie.cpp
engines/sludge/region.cpp
engines/sludge/region.h
engines/sludge/sludge.cpp
engines/sludge/sludge.h
engines/sludge/sludger.cpp
engines/sludge/sludger.h
engines/sludge/sprites.cpp
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index e9f0c22..9bc2a56 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -28,24 +28,23 @@
#include "graphics/palette.h"
#include "sludge/allfiles.h"
-#include "sludge/newfatal.h"
+#include "sludge/backdrop.h"
+#include "sludge/event.h"
#include "sludge/fileset.h"
#include "sludge/graphics.h"
-#include "sludge/backdrop.h"
+#include "sludge/imgloader.h"
#include "sludge/moreio.h"
+#include "sludge/newfatal.h"
#include "sludge/statusba.h"
-#include "sludge/talk.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"
-#include "sludge/imgloader.h"
namespace Sludge {
-extern InputType input;
-
Parallax::Parallax() {
_parallaxLayers.clear();
}
@@ -219,11 +218,11 @@ void GraphicsManager::killLightMap() {
bool GraphicsManager::reserveBackdrop() {
_cameraX = 0;
_cameraY = 0;
- input.mouseX = (int)((float)input.mouseX * _cameraZoom);
- input.mouseY = (int)((float)input.mouseY * _cameraZoom);
+ _vm->_evtMan->mouseX() = (int)((float)_vm->_evtMan->mouseX() * _cameraZoom);
+ _vm->_evtMan->mouseY() = (int)((float)_vm->_evtMan->mouseY() * _cameraZoom);
_cameraZoom = 1.0;
- input.mouseX = (int)((float)input.mouseX / _cameraZoom);
- input.mouseY = (int)((float)input.mouseY / _cameraZoom);
+ _vm->_evtMan->mouseX() = (int)((float)_vm->_evtMan->mouseX() / _cameraZoom);
+ _vm->_evtMan->mouseY() = (int)((float)_vm->_evtMan->mouseY() / _cameraZoom);
return true;
}
diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index fe327f4..d88ecb3 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -51,6 +51,7 @@
#include "sludge/sludge.h"
#include "sludge/utf8.h"
#include "sludge/graphics.h"
+#include "sludge/event.h"
namespace Sludge {
@@ -63,7 +64,6 @@ extern int lastFramesPerSecond, thumbWidth, thumbHeight;
extern bool allowAnyFilename;
extern bool captureAllKeys;
extern int16 fontSpace;
-extern EventHandlers *currentEvents;
extern VariableStack *noStack;
extern StatusStuff *nowStatus;
extern ScreenRegion *overRegion;
@@ -71,7 +71,6 @@ extern int numBIFNames, numUserFunc;
extern Common::String *allUserFunc;
extern Common::String *allBIFNames;
-extern InputType input;
extern float speechSpeed;
extern byte brightnessLevel;
@@ -135,6 +134,7 @@ struct builtInFunctionData {
#define builtIn(a) static BuiltReturn builtIn_ ## a (int numParams, LoadedFunction *fun)
#define UNUSEDALL (void) (0 && sizeof(numParams) && sizeof (fun));
+
static BuiltReturn sayCore(int numParams, LoadedFunction *fun, bool sayIt) {
int fileNum = -1;
Common::String newText;
@@ -209,25 +209,25 @@ builtIn(setCursor) {
builtIn(getMouseX) {
UNUSEDALL
- setVariable(fun->reg, SVT_INT, input.mouseX + g_sludge->_gfxMan->getCamX());
+ setVariable(fun->reg, SVT_INT, g_sludge->_evtMan->mouseX() + g_sludge->_gfxMan->getCamX());
return BR_CONTINUE;
}
builtIn(getMouseY) {
UNUSEDALL
- setVariable(fun->reg, SVT_INT, input.mouseY + g_sludge->_gfxMan->getCamY());
+ setVariable(fun->reg, SVT_INT, g_sludge->_evtMan->mouseY() + g_sludge->_gfxMan->getCamY());
return BR_CONTINUE;
}
builtIn(getMouseScreenX) {
UNUSEDALL
- setVariable(fun->reg, SVT_INT, input.mouseX * g_sludge->_gfxMan->getCamZoom());
+ setVariable(fun->reg, SVT_INT, g_sludge->_evtMan->mouseX() * g_sludge->_gfxMan->getCamZoom());
return BR_CONTINUE;
}
builtIn(getMouseScreenY) {
UNUSEDALL
- setVariable(fun->reg, SVT_INT, input.mouseY * g_sludge->_gfxMan->getCamZoom());
+ setVariable(fun->reg, SVT_INT, g_sludge->_evtMan->mouseY() * g_sludge->_gfxMan->getCamZoom());
return BR_CONTINUE;
}
@@ -1839,7 +1839,7 @@ builtIn(onLeftMouse) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents->leftMouseFunction = functionNum;
+ g_sludge->_evtMan->setEventFunction(kLeftMouse, functionNum);
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1849,7 +1849,7 @@ builtIn(onLeftMouseUp) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents->leftMouseUpFunction = functionNum;
+ g_sludge->_evtMan->setEventFunction(kLeftMouseUp, functionNum);
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1859,7 +1859,7 @@ builtIn(onRightMouse) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents->rightMouseFunction = functionNum;
+ g_sludge->_evtMan->setEventFunction(kRightMouse, functionNum);
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1869,7 +1869,7 @@ builtIn(onRightMouseUp) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents->rightMouseUpFunction = functionNum;
+ g_sludge->_evtMan->setEventFunction(kRightMouseUp, functionNum);
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1879,7 +1879,7 @@ builtIn(onFocusChange) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents->focusFunction = functionNum;
+ g_sludge->_evtMan->setEventFunction(kFocus, functionNum);
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1889,7 +1889,7 @@ builtIn(onMoveMouse) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents->moveMouseFunction = functionNum;
+ g_sludge->_evtMan->setEventFunction(kMoveMouse, functionNum);
return BR_CONTINUE;
}
return BR_ERROR;
@@ -1899,7 +1899,7 @@ builtIn(onKeyboard) {
UNUSEDALL
int functionNum;
if (getFuncNumForCallback(numParams, fun, functionNum)) {
- currentEvents->spaceFunction = functionNum;
+ g_sludge->_evtMan->setEventFunction(kSpace, functionNum);
return BR_CONTINUE;
}
return BR_ERROR;
diff --git a/engines/sludge/cursors.cpp b/engines/sludge/cursors.cpp
index 1960844..87a2bf7 100644
--- a/engines/sludge/cursors.cpp
+++ b/engines/sludge/cursors.cpp
@@ -22,10 +22,11 @@
#include "sludge/allfiles.h"
#include "sludge/cursors.h"
+#include "sludge/event.h"
#include "sludge/graphics.h"
+#include "sludge/people.h"
#include "sludge/sprites.h"
#include "sludge/sprbanks.h"
-#include "sludge/people.h"
#include "sludge/sludge.h"
#include "sludge/sludger.h"
@@ -35,8 +36,6 @@ PersonaAnimation *mouseCursorAnim;
int mouseCursorFrameNum = 0;
int mouseCursorCountUp = 0;
-extern InputType input;
-
void pickAnimCursor(PersonaAnimation *pp) {
deleteAnim(mouseCursorAnim);
mouseCursorAnim = pp;
@@ -63,12 +62,12 @@ void displayCursor() {
if (flipMe != 2) {
if (flipMe) {
g_sludge->_gfxMan->flipFontSprite(
- input.mouseX, input.mouseY,
+ g_sludge->_evtMan->mouseX(), g_sludge->_evtMan->mouseY(),
mouseCursorAnim->theSprites->bank.sprites[spriteNum],
mouseCursorAnim->theSprites->bank.myPalette /* ( spritePalette&) NULL*/);
} else {
g_sludge->_gfxMan->fontSprite(
- input.mouseX, input.mouseY,
+ g_sludge->_evtMan->mouseX(), g_sludge->_evtMan->mouseY(),
mouseCursorAnim->theSprites->bank.sprites[spriteNum],
mouseCursorAnim->theSprites->bank.myPalette /* ( spritePalette&) NULL*/);
}
diff --git a/engines/sludge/event.cpp b/engines/sludge/event.cpp
new file mode 100644
index 0000000..5ab237b
--- /dev/null
+++ b/engines/sludge/event.cpp
@@ -0,0 +1,355 @@
+/* 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 "common/events.h"
+#include "common/keyboard.h"
+
+#include "sludge/event.h"
+#include "sludge/freeze.h"
+#include "sludge/graphics.h"
+#include "sludge/newfatal.h"
+#include "sludge/region.h"
+#include "sludge/sludge.h"
+#include "sludge/sludger.h"
+#include "sludge/variable.h"
+
+namespace Sludge {
+
+extern Variable *launchResult;
+extern VariableStack *noStack;
+extern ScreenRegion *overRegion;
+extern ScreenRegion *lastRegion;
+
+EventManager::EventManager(SludgeEngine *vm) {
+ _vm = vm;
+
+ _weAreDoneSoQuit = 0;
+
+
+ for (uint i = 0; i < EVENT_FUNC_NB; ++i) {
+ _mainHandlers.func[i] = 0;
+ }
+ _currentEvents = &_mainHandlers;
+}
+
+EventManager::~EventManager() {
+
+}
+
+void EventManager::checkInput() {
+ float cameraZoom = _vm->_gfxMan->getCamZoom();
+#if 0
+ static bool fakeRightclick = false;
+#endif
+ Common::Event event;
+
+ /* Check for events */
+ while (g_system->getEventManager()->pollEvent(event)) {
+ switch (event.type) {
+#if 0
+ case SDL_VIDEORESIZE:
+ realWinWidth = event.resize.w;
+ realWinHeight = event.resize.h;
+ setGraphicsWindow(false, true, true);
+ break;
+#endif
+ case Common::EVENT_MOUSEMOVE:
+ _input.justMoved = true;
+ _input.mouseX = event.mouse.x * cameraZoom;
+ _input.mouseY = event.mouse.y * cameraZoom;
+ break;
+
+ case Common::EVENT_LBUTTONDOWN:
+ _input.leftClick = true;
+ _input.mouseX = event.mouse.x * cameraZoom;
+ _input.mouseY = event.mouse.y * cameraZoom;
+#if 0
+ if (SDL_GetModState() & KMOD_CTRL) {
+ input.rightClick = true;
+ fakeRightclick = true;
+ } else {
+ input.leftClick = true;
+ fakeRightclick = false;
+ }
+#endif
+ break;
+
+ case Common::EVENT_RBUTTONDOWN:
+ _input.rightClick = true;
+ _input.mouseX = event.mouse.x * cameraZoom;
+ _input.mouseY = event.mouse.y * cameraZoom;
+ break;
+
+ case Common::EVENT_LBUTTONUP:
+ _input.leftRelease = true;
+ _input.mouseX = event.mouse.x * cameraZoom;
+ _input.mouseY = event.mouse.y * cameraZoom;
+ break;
+
+ case Common::EVENT_RBUTTONUP:
+ _input.rightRelease = true;
+ _input.mouseX = event.mouse.x * cameraZoom;
+ _input.mouseY = event.mouse.y * cameraZoom;
+ break;
+
+ case Common::EVENT_KEYDOWN:
+ switch (event.kbd.keycode) {
+
+ case Common::KEYCODE_BACKSPACE:
+ // fall through
+ case Common::KEYCODE_DELETE:
+ _input.keyPressed = Common::KEYCODE_DELETE;
+ break;
+ default:
+ _input.keyPressed = event.kbd.keycode;
+ break;
+ }
+ break;
+
+ case Common::EVENT_QUIT:
+ _weAreDoneSoQuit = 1;
+ // TODO: if reallyWantToQuit, popup a message box to confirm
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+bool EventManager::handleInput() {
+ static int l = 0;
+
+ if (!g_sludge->launchMe.empty()) {
+ if (l) {
+ // Still paused because of spawned thingy...
+ } else {
+ l = 1;
+
+ setVariable(*launchResult, SVT_INT, 0/*launch(launchMe) > 31*/); //TODO:false value
+ g_sludge->launchMe.clear();
+ launchResult = nullptr;
+ }
+ return true;
+ } else {
+ l = 0;
+ }
+
+ if (!overRegion)
+ getOverRegion();
+
+ if (_input.justMoved) {
+ if (_currentEvents->func[kMoveMouse]) {
+ if (!startNewFunctionNum(_currentEvents->func[kMoveMouse], 0, nullptr, noStack))
+ return false;
+ }
+ }
+ _input.justMoved = false;
+
+ if (lastRegion != overRegion && _currentEvents->func[kFocus]) {
+ VariableStack *tempStack = new VariableStack;
+ if (!checkNew(tempStack))
+ return false;
+
+ initVarNew(tempStack->thisVar);
+ if (overRegion) {
+ setVariable(tempStack->thisVar, SVT_OBJTYPE, overRegion->thisType->objectNum);
+ } else {
+ setVariable(tempStack->thisVar, SVT_INT, 0);
+ }
+ tempStack->next = nullptr;
+ if (!startNewFunctionNum(_currentEvents->func[kFocus], 1, nullptr, tempStack))
+ return false;
+ }
+ if (_input.leftRelease && _currentEvents->func[kLeftMouseUp]) {
+ if (!startNewFunctionNum(_currentEvents->func[kLeftMouseUp], 0, nullptr, noStack))
+ return false;
+ }
+ if (_input.rightRelease && _currentEvents->func[kRightMouseUp]) {
+ if (!startNewFunctionNum(_currentEvents->func[kRightMouseUp], 0, nullptr, noStack))
+ return false;
+ }
+ if (_input.leftClick && _currentEvents->func[kLeftMouse])
+ if (!startNewFunctionNum(_currentEvents->func[kLeftMouse], 0, nullptr, noStack))
+ return false;
+ if (_input.rightClick && _currentEvents->func[kRightMouse]) {
+ if (!startNewFunctionNum(_currentEvents->func[kRightMouse], 0, nullptr, noStack))
+ return false;
+ }
+ if (_input.keyPressed && _currentEvents->func[kSpace]) {
+ Common::String tempString = "";
+ switch (_input.keyPressed) {
+ case 127:
+ tempString = "BACKSPACE";
+ break;
+ case 9:
+ tempString = "TAB";
+ break;
+ case 13:
+ tempString = "ENTER";
+ break;
+ case 27:
+ tempString = "ESCAPE";
+ break;
+ /*
+ case 1112: tempString = copyString ("ALT+F1"); break;
+ case 1113: tempString = copyString ("ALT+F2"); break;
+ case 1114: tempString = copyString ("ALT+F3"); break;
+ case 1115: tempString = copyString ("ALT+F4"); break;
+ case 1116: tempString = copyString ("ALT+F5"); break;
+ case 1117: tempString = copyString ("ALT+F6"); break;
+ case 1118: tempString = copyString ("ALT+F7"); break;
+ case 1119: tempString = copyString ("ALT+F8"); break;
+ case 1120: tempString = copyString ("ALT+F9"); break;
+ case 1121: tempString = copyString ("ALT+F10"); break;
+ case 1122: tempString = copyString ("ALT+F11"); break;
+ case 1123: tempString = copyString ("ALT+F12"); break;
+
+ case 2019: tempString = copyString ("PAUSE"); break;
+ */
+ case 63276:
+ tempString = "PAGE UP";
+ break;
+ case 63277:
+ tempString = "PAGE DOWN";
+ break;
+ case 63275:
+ tempString = "END";
+ break;
+ case 63273:
+ tempString = "HOME";
+ break;
+ case 63234:
+ tempString = "LEFT";
+ break;
+ case 63232:
+ tempString = "UP";
+ break;
+ case 63235:
+ tempString = "RIGHT";
+ break;
+ case 63233:
+ tempString = "DOWN";
+ break;
+ /*
+ case 2045: tempString = copyString ("INSERT"); break;
+ case 2046: tempString = copyString ("DELETE"); break;
+ */
+ case 63236:
+ tempString = "F1";
+ break;
+ case 63237:
+ tempString = "F2";
+ break;
+ case 63238:
+ tempString = "F3";
+ break;
+ case 63239:
+ tempString = "F4";
+ break;
+ case 63240:
+ tempString = "F5";
+ break;
+ case 63241:
+ tempString = "F6";
+ break;
+ case 63242:
+ tempString = "F7";
+ break;
+ case 63243:
+ tempString = "F8";
+ break;
+ case 63244:
+ tempString = "F9";
+ break;
+ case 63245:
+ tempString = "F10";
+ break;
+ case 63246:
+ tempString = "F11";
+ break;
+ case 63247:
+ tempString = "F12";
+ break;
+
+ default:
+ if (_input.keyPressed >= 256) {
+ char tmp[7] = "ABCDEF";
+ sprintf(tmp, "%i", _input.keyPressed);
+ tempString = tmp;
+ //}
+ } else {
+ char tmp[2] = " ";
+ tmp[0] = _input.keyPressed;
+ tempString = tmp;
+ }
+ }
+
+ if (!tempString.empty()) {
+ VariableStack *tempStack = new VariableStack;
+ if (!checkNew(tempStack))
+ return false;
+ initVarNew(tempStack->thisVar);
+ makeTextVar(tempStack->thisVar, tempString);
+ tempStack->next = nullptr;
+ if (!startNewFunctionNum(_currentEvents->func[kSpace], 1, nullptr, tempStack))
+ return false;
+ }
+ }
+ _input.rightClick = false;
+ _input.leftClick = false;
+ _input.rightRelease = false;
+ _input.leftRelease = false;
+ _input.keyPressed = 0;
+ lastRegion = overRegion;
+ return true;
+}
+
+void EventManager::loadHandlers(Common::SeekableReadStream *stream) {
+ for (uint i = 0; i < EVENT_FUNC_NB; ++i) {
+ _currentEvents->func[i] = stream->readUint16BE();
+ }
+}
+
+void EventManager::saveHandlers(Common::WriteStream *stream) {
+ for (uint i = 0; i < EVENT_FUNC_NB; ++i) {
+ stream->writeUint16BE(_currentEvents->func[i]);
+ }
+}
+
+bool EventManager::freeze(FrozenStuffStruct *frozenStuff) {
+ frozenStuff->currentEvents = _currentEvents;
+ _currentEvents = new EventHandlers;
+ if (!checkNew(_currentEvents))
+ return false;
+ for (uint i = 0; i < EVENT_FUNC_NB; ++i) {
+ _currentEvents->func[i] = 0;
+ }
+ return true;
+}
+
+void EventManager::restore(FrozenStuffStruct *frozenStuff) {
+ delete _currentEvents;
+ _currentEvents = frozenStuff->currentEvents;
+}
+
+} /* namespace Sludge */
diff --git a/engines/sludge/event.h b/engines/sludge/event.h
new file mode 100644
index 0000000..e857529
--- /dev/null
+++ b/engines/sludge/event.h
@@ -0,0 +1,90 @@
+/* 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_EVENT_H
+#define SLUDGE_EVENT_H
+
+#include "common/stream.h"
+
+namespace Sludge {
+
+struct FrozenStuffStruct;
+
+struct InputType {
+ bool leftClick, rightClick, justMoved, leftRelease, rightRelease;
+ int mouseX, mouseY, keyPressed;
+};
+
+enum EventFunctions {
+ kLeftMouse,
+ kLeftMouseUp,
+ kRightMouse,
+ kRightMouseUp,
+ kMoveMouse,
+ kFocus,
+ kSpace,
+ EVENT_FUNC_NB
+};
+
+struct EventHandlers {
+ int func[EVENT_FUNC_NB];
+};
+
+class SludgeEngine;
+
+class EventManager {
+public:
+ EventManager(SludgeEngine *vm);
+ virtual ~EventManager();
+
+ // Input
+ void checkInput();
+ bool handleInput();
+
+ int mouseX() const { return _input.mouseX; }
+ int mouseY() const { return _input.mouseY; }
+ int &mouseX() { return _input.mouseX; }
+ int &mouseY() { return _input.mouseY; }
+
+ // Events
+ void setEventFunction(EventFunctions event, int funcNum) { _currentEvents->func[event] = funcNum; } ;
+ void loadHandlers(Common::SeekableReadStream *stream);
+ void saveHandlers(Common::WriteStream *stream);
+ bool freeze(FrozenStuffStruct *frozenStuff);
+ void restore(FrozenStuffStruct *frozenStuff);
+
+ // Quit
+ bool quit() { return _weAreDoneSoQuit; }
+
+private:
+ SludgeEngine *_vm;
+ InputType _input;
+
+ int _weAreDoneSoQuit;
+
+ EventHandlers _mainHandlers;
+ EventHandlers *_currentEvents;
+};
+
+} /* namespace Sludge */
+
+#endif /* ENGINES_SLUDGE_EVENT_H_ */
diff --git a/engines/sludge/freeze.cpp b/engines/sludge/freeze.cpp
index 776a6f8..1bc2ad9 100644
--- a/engines/sludge/freeze.cpp
+++ b/engines/sludge/freeze.cpp
@@ -20,20 +20,21 @@
*
*/
#include "sludge/allfiles.h"
+#include "sludge/backdrop.h"
+#include "sludge/event.h"
+#include "sludge/fonttext.h"
+#include "sludge/freeze.h"
+#include "sludge/graphics.h"
#include "sludge/newfatal.h"
+#include "sludge/objtypes.h"
+#include "sludge/people.h"
+#include "sludge/region.h"
#include "sludge/sprites.h"
#include "sludge/sprbanks.h"
-#include "sludge/people.h"
#include "sludge/sludge.h"
#include "sludge/sludger.h"
-#include "sludge/objtypes.h"
-#include "sludge/region.h"
-#include "sludge/backdrop.h"
-#include "sludge/talk.h"
-#include "sludge/fonttext.h"
#include "sludge/statusba.h"
-#include "sludge/freeze.h"
-#include "sludge/graphics.h"
+#include "sludge/talk.h"
#include "sludge/zbuffer.h"
namespace Sludge {
@@ -42,8 +43,6 @@ extern OnScreenPerson *allPeople;
extern ScreenRegion *allScreenRegions;
extern ScreenRegion *overRegion;
extern SpeechStruct *speech;
-extern InputType input;
-extern EventHandlers *currentEvents;
extern PersonaAnimation *mouseCursorAnim;
extern int mouseCursorFrameNum;
@@ -109,11 +108,7 @@ bool GraphicsManager::freeze() {
newFreezer->speech = speech;
initSpeech();
- newFreezer->currentEvents = currentEvents;
- currentEvents = new EventHandlers;
- if (!checkNew(currentEvents))
- return false;
- memset(currentEvents, 0, sizeof(EventHandlers));
+ _vm->_evtMan->freeze(newFreezer);
newFreezer->next = _frozenStuff;
_frozenStuff = newFreezer;
@@ -142,11 +137,11 @@ void GraphicsManager::unfreeze(bool killImage) {
_cameraX = _frozenStuff->cameraX;
_cameraY = _frozenStuff->cameraY;
- input.mouseX = (int)(input.mouseX * _cameraZoom);
- input.mouseY = (int)(input.mouseY * _cameraZoom);
+ _vm->_evtMan->mouseX() = (int)(_vm->_evtMan->mouseX() * _cameraZoom);
+ _vm->_evtMan->mouseY() = (int)(_vm->_evtMan->mouseY() * _cameraZoom);
_cameraZoom = _frozenStuff->cameraZoom;
- input.mouseX = (int)(input.mouseX / _cameraZoom);
- input.mouseY = (int)(input.mouseY / _cameraZoom);
+ _vm->_evtMan->mouseX() = (int)(_vm->_evtMan->mouseX() / _cameraZoom);
+ _vm->_evtMan->mouseY() = (int)(_vm->_evtMan->mouseY() / _cameraZoom);
killAllPeople();
allPeople = _frozenStuff->allPeople;
@@ -184,8 +179,8 @@ void GraphicsManager::unfreeze(bool killImage) {
restoreBarStuff(_frozenStuff->frozenStatus);
- delete currentEvents;
- currentEvents = _frozenStuff->currentEvents;
+ _vm->_evtMan->restore(_frozenStuff);
+
killAllSpeech();
delete speech;
diff --git a/engines/sludge/freeze.h b/engines/sludge/freeze.h
index 7373d02..830c2d8 100644
--- a/engines/sludge/freeze.h
+++ b/engines/sludge/freeze.h
@@ -27,11 +27,14 @@
namespace Sludge {
struct OnScreenPerson;
+struct PersonaAnimation;
struct ScreenRegion;
struct SpeechStruct;
struct StatusStuff ;
struct EventHandlers;
+class Parallax;
+
struct FrozenStuffStruct {
OnScreenPerson *allPeople;
ScreenRegion *allScreenRegions;
diff --git a/engines/sludge/graphics.cpp b/engines/sludge/graphics.cpp
index d2d8e9d..626c8a2 100644
--- a/engines/sludge/graphics.cpp
+++ b/engines/sludge/graphics.cpp
@@ -23,6 +23,7 @@
#include "engines/util.h"
#include "sludge/backdrop.h"
+#include "sludge/event.h"
#include "sludge/freeze.h"
#include "sludge/graphics.h"
#include "sludge/newfatal.h"
@@ -33,8 +34,6 @@
namespace Sludge {
-extern InputType input;
-
GraphicsManager::GraphicsManager(SludgeEngine *vm) {
_vm = vm;
@@ -172,8 +171,8 @@ void GraphicsManager::aimCamera(int cameraX, int cameraY) {
}
void GraphicsManager::zoomCamera(int z) {
- input.mouseX = input.mouseX * _cameraZoom;
- input.mouseY = input.mouseY * _cameraZoom;
+ _vm->_evtMan->mouseX() = _vm->_evtMan->mouseX() * _cameraZoom;
+ _vm->_evtMan->mouseY() = _vm->_evtMan->mouseY() * _cameraZoom;
_cameraZoom = (float)z * 0.01;
if ((float)_winWidth / _cameraZoom > _sceneWidth)
@@ -181,8 +180,8 @@ void GraphicsManager::zoomCamera(int z) {
if ((float)_winHeight / _cameraZoom > _sceneHeight)
_cameraZoom = (float)_winHeight / _sceneHeight;
- input.mouseX = input.mouseX / _cameraZoom;
- input.mouseY = input.mouseY / _cameraZoom;
+ _vm->_evtMan->mouseX() = _vm->_evtMan->mouseX() / _cameraZoom;
+ _vm->_evtMan->mouseY() = _vm->_evtMan->mouseY() / _cameraZoom;
}
void GraphicsManager::saveColors(Common::WriteStream *stream) {
diff --git a/engines/sludge/graphics.h b/engines/sludge/graphics.h
index 1914ea7..69d1f5f 100644
--- a/engines/sludge/graphics.h
+++ b/engines/sludge/graphics.h
@@ -23,6 +23,8 @@
#ifndef SLUDGE_GRAPHICS_H
#define SLUDGE_GRAPHICS_H
+#include "common/stream.h"
+
#include "graphics/surface.h"
#include "graphics/transparent_surface.h"
diff --git a/engines/sludge/loadsave.cpp b/engines/sludge/loadsave.cpp
index 79dde93..8eb59fc 100644
--- a/engines/sludge/loadsave.cpp
+++ b/engines/sludge/loadsave.cpp
@@ -24,6 +24,7 @@
#include "sludge/allfiles.h"
#include "sludge/sprites.h"
+#include "sludge/event.h"
#include "sludge/fonttext.h"
#include "sludge/newfatal.h"
#include "sludge/variable.h"
@@ -387,7 +388,7 @@ bool saveGame(const Common::String &fname) {
g_sludge->_gfxMan->saveHSI(fp);
// Save event handlers
- saveHandlers(fp);
+ g_sludge->_evtMan->saveHandlers(fp);
// Save regions
saveRegions(fp);
@@ -558,7 +559,7 @@ bool loadGame(const Common::String &fname) {
brightnessLevel = fp->readByte();
g_sludge->_gfxMan->loadHSI(fp, 0, 0, true);
- loadHandlers(fp);
+ g_sludge->_evtMan->loadHandlers(fp);
loadRegions(fp);
mouseCursorAnim = new PersonaAnimation ;
diff --git a/engines/sludge/main_loop.cpp b/engines/sludge/main_loop.cpp
index 1c5beb8..a4851d7 100644
--- a/engines/sludge/main_loop.cpp
+++ b/engines/sludge/main_loop.cpp
@@ -22,13 +22,12 @@
#include "common/config-manager.h"
#include "common/debug.h"
-#include "common/events.h"
-#include "common/keyboard.h"
#include "graphics/surface.h"
#include "sludge/allfiles.h"
#include "sludge/backdrop.h"
+#include "sludge/event.h"
#include "sludge/floor.h"
#include "sludge/graphics.h"
#include "sludge/helpers.h"
@@ -52,98 +51,10 @@ namespace Sludge {
HWND hMainWindow = NULL;
-int realWinWidth = 640, realWinHeight = 480;
-
-extern InputType input;
extern VariableStack *noStack;
int dialogValue = 0;
-int weAreDoneSoQuit;
-
-void checkInput() {
- int winWidth = g_system->getWidth();
- int winHeight = g_system->getHeight();
- float cameraZoom = g_sludge->_gfxMan->getCamZoom();
-#if 0
- static bool fakeRightclick = false;
-#endif
- Common::Event event;
-
- /* Check for events */
- while (g_system->getEventManager()->pollEvent(event)) {
- switch (event.type) {
-#if 0
- case SDL_VIDEORESIZE:
- realWinWidth = event.resize.w;
- realWinHeight = event.resize.h;
- setGraphicsWindow(false, true, true);
- break;
-#endif
- case Common::EVENT_MOUSEMOVE:
- input.justMoved = true;
- input.mouseX = event.mouse.x * ((float)winWidth / cameraZoom) / realWinWidth;
- input.mouseY = event.mouse.y * ((float)winHeight / cameraZoom) / realWinHeight;
- break;
-
- case Common::EVENT_LBUTTONDOWN:
- input.leftClick = true;
- input.mouseX = event.mouse.x * ((float)winWidth / cameraZoom) / realWinWidth;
- input.mouseY = event.mouse.y * ((float)winHeight / cameraZoom) / realWinHeight;
-#if 0
- if (SDL_GetModState() & KMOD_CTRL) {
- input.rightClick = true;
- fakeRightclick = true;
- } else {
- input.leftClick = true;
- fakeRightclick = false;
- }
-#endif
- break;
-
- case Common::EVENT_RBUTTONDOWN:
- input.rightClick = true;
- input.mouseX = event.mouse.x * ((float)winWidth / cameraZoom) / realWinWidth;
- input.mouseY = event.mouse.y * ((float)winHeight / cameraZoom) / realWinHeight;
- break;
-
- case Common::EVENT_LBUTTONUP:
- input.leftRelease = true;
- input.mouseX = event.mouse.x * ((float)winWidth / cameraZoom) / realWinWidth;
- input.mouseY = event.mouse.y * ((float)winHeight / cameraZoom) / realWinHeight;
- break;
-
- case Common::EVENT_RBUTTONUP:
- input.rightRelease = true;
- input.mouseX = event.mouse.x * ((float)winWidth / cameraZoom) / realWinWidth;
- input.mouseY = event.mouse.y * ((float)winHeight / cameraZoom) / realWinHeight;
- break;
-
- case Common::EVENT_KEYDOWN:
- switch (event.kbd.keycode) {
-
- case Common::KEYCODE_BACKSPACE:
- // fall through
- case Common::KEYCODE_DELETE:
- input.keyPressed = Common::KEYCODE_DELETE;
- break;
- default:
- input.keyPressed = event.kbd.keycode;
- break;
- }
- break;
-
- case Common::EVENT_QUIT:
- weAreDoneSoQuit = 1;
- // TODO: if reallyWantToQuit, popup a message box to confirm
- break;
-
- default:
- break;
- }
- }
-}
-
int main_loop(const char *filename) {
if (!initSludge(filename)) {
@@ -173,11 +84,12 @@ int main_loop(const char *filename) {
g_sludge->_timer.init();
- weAreDoneSoQuit = 0;
- while (!weAreDoneSoQuit) {
- checkInput();
+ while (!g_sludge->_evtMan->quit()) {
+ g_sludge->_evtMan->checkInput();
walkAllPeople();
- handleInput();
+ if (g_sludge->_evtMan->handleInput()) {
+ runSludge();
+ }
sludgeDisplay();
handleSoundLists();
g_sludge->_timer.waitFrame();
diff --git a/engines/sludge/module.mk b/engines/sludge/module.mk
index ce45549..4d05e82 100644
--- a/engines/sludge/module.mk
+++ b/engines/sludge/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS := \
console.o \
cursors.o \
detection.o \
+ event.o \
fileset.o \
floor.o \
freeze.o \
diff --git a/engines/sludge/movie.cpp b/engines/sludge/movie.cpp
index 66e338e..0162a70 100644
--- a/engines/sludge/movie.cpp
+++ b/engines/sludge/movie.cpp
@@ -27,13 +27,6 @@
namespace Sludge {
-// in main.c
-int checkInput();
-extern int weAreDoneSoQuit;
-
-// Sludger.cpp
-bool handleInput();
-
// sound_openal.cpp
void playMovieStream(int a);
#if 0
diff --git a/engines/sludge/region.cpp b/engines/sludge/region.cpp
index d7fba70..af9e2b8 100644
--- a/engines/sludge/region.cpp
+++ b/engines/sludge/region.cpp
@@ -22,6 +22,7 @@
#include "sludge/allfiles.h"
#include "sludge/backdrop.h"
+#include "sludge/event.h"
#include "sludge/graphics.h"
#include "sludge/moreio.h"
#include "sludge/newfatal.h"
@@ -34,7 +35,6 @@ namespace Sludge {
ScreenRegion *allScreenRegions = NULL;
ScreenRegion *overRegion = NULL;
-extern InputType input;
void showBoxes() {
ScreenRegion*huntRegion = allScreenRegions;
@@ -147,10 +147,10 @@ void getOverRegion() {
int cameraY = g_sludge->_gfxMan->getCamY();
ScreenRegion *thisRegion = allScreenRegions;
while (thisRegion) {
- if ((input.mouseX >= thisRegion->x1 - cameraX)
- && (input.mouseY >= thisRegion->y1 - cameraY)
- && (input.mouseX <= thisRegion->x2 - cameraX)
- && (input.mouseY <= thisRegion->y2 - cameraY)) {
+ if ((g_sludge->_evtMan->mouseX() >= thisRegion->x1 - cameraX)
+ && (g_sludge->_evtMan->mouseY() >= thisRegion->y1 - cameraY)
+ && (g_sludge->_evtMan->mouseX() <= thisRegion->x2 - cameraX)
+ && (g_sludge->_evtMan->mouseY() <= thisRegion->y2 - cameraY)) {
overRegion = thisRegion;
return;
}
diff --git a/engines/sludge/region.h b/engines/sludge/region.h
index afbe80e..7429481 100644
--- a/engines/sludge/region.h
+++ b/engines/sludge/region.h
@@ -22,6 +22,8 @@
#ifndef SLUDGE_REGION_H
#define SLUDGE_REGION_H
+#include "sludge/objtypes.h"
+
namespace Sludge {
struct ScreenRegion {
diff --git a/engines/sludge/sludge.cpp b/engines/sludge/sludge.cpp
index 10b9aa3..fef2ebf 100644
--- a/engines/sludge/sludge.cpp
+++ b/engines/sludge/sludge.cpp
@@ -25,6 +25,7 @@
#include "common/debug-channels.h"
#include "common/error.h"
+#include "sludge/event.h"
#include "sludge/graphics.h"
#include "sludge/sludge.h"
#include "sludge/main_loop.h"
@@ -67,6 +68,7 @@ SludgeEngine::SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc)
_languageMan = new LanguageManager();
_objMan = new ObjectManager(this);
_gfxMan = new GraphicsManager(this);
+ _evtMan = new EventManager(this);
}
SludgeEngine::~SludgeEngine() {
@@ -89,6 +91,8 @@ SludgeEngine::~SludgeEngine() {
_pixelFormat = nullptr;
// Dispose managers
+ delete _evtMan;
+ _evtMan = nullptr;
delete _gfxMan;
_gfxMan = nullptr;
delete _objMan;
diff --git a/engines/sludge/sludge.h b/engines/sludge/sludge.h
index 78cf1df..74d5c07 100644
--- a/engines/sludge/sludge.h
+++ b/engines/sludge/sludge.h
@@ -38,6 +38,7 @@ namespace Sludge {
extern SludgeEngine *g_sludge;
+class EventManager;
class GraphicsManager;
class SludgeConsole;
@@ -74,6 +75,7 @@ public:
LanguageManager *_languageMan;
ObjectManager *_objMan;
GraphicsManager *_gfxMan;
+ EventManager *_evtMan;
SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc);
virtual ~SludgeEngine();
diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp
index 12d76b9..b890c78 100644
--- a/engines/sludge/sludger.cpp
+++ b/engines/sludge/sludger.cpp
@@ -71,18 +71,14 @@ bool captureAllKeys = false;
byte brightnessLevel = 255;
-EventHandlers mainHandlers;
-EventHandlers *currentEvents = &mainHandlers;
-
-extern ScreenRegion *overRegion;
extern SpeechStruct *speech;
extern LoadedFunction *saverFunc;
LoadedFunction *allRunningFunctions = NULL;
ScreenRegion *lastRegion = NULL;
VariableStack *noStack = NULL;
-InputType input;
Variable *globalVars;
+
int numGlobals;
const char *sludgeText[] = { "?????", "RETURN", "BRANCH", "BR_ZERO",
@@ -94,26 +90,6 @@ const char *sludgeText[] = { "?????", "RETURN", "BRANCH", "BR_ZERO",
"INC_LOCAL", "DEC_LOCAL", "INC_GLOBAL", "DEC_GLOBAL", "INDEXSET",
"INDEXGET", "INC_INDEX", "DEC_INDEX", "QUICK_PUSH" };
-void loadHandlers(Common::SeekableReadStream *stream) {
- currentEvents->leftMouseFunction = stream->readUint16BE();
- currentEvents->leftMouseUpFunction = stream->readUint16BE();
- currentEvents->rightMouseFunction = stream->readUint16BE();
- currentEvents->rightMouseUpFunction = stream->readUint16BE();
- currentEvents->moveMouseFunction = stream->readUint16BE();
- currentEvents->focusFunction = stream->readUint16BE();
- currentEvents->spaceFunction = stream->readUint16BE();
-}
-
-void saveHandlers(Common::WriteStream *stream) {
- stream->writeUint16BE(currentEvents->leftMouseFunction);
- stream->writeUint16BE(currentEvents->leftMouseUpFunction);
- stream->writeUint16BE(currentEvents->rightMouseFunction);
- stream->writeUint16BE(currentEvents->rightMouseUpFunction);
- stream->writeUint16BE(currentEvents->moveMouseFunction);
- stream->writeUint16BE(currentEvents->focusFunction);
- stream->writeUint16BE(currentEvents->spaceFunction);
-}
-
Common::File *openAndVerify(const Common::String &filename, char extra1, char extra2,
const char *er, int &fileVersion) {
Common::File *fp = new Common::File();
@@ -1019,199 +995,4 @@ int startNewFunctionNum(uint funcNum, uint numParamsExpected,
int lastFramesPerSecond = -1;
int thisFramesPerSecond = -1;
-bool handleInput() {
- static int l = 0;
-
- if (!g_sludge->launchMe.empty()) {
- if (l) {
- // Still paused because of spawned thingy...
- } else {
- l = 1;
-
- setVariable(*launchResult, SVT_INT, 0/*launch(launchMe) > 31*/); //TODO:false value
- g_sludge->launchMe.clear();
- launchResult = NULL;
- }
- return true;
- } else {
- l = 0;
- }
-
- if (!overRegion)
- getOverRegion();
-
- if (input.justMoved) {
- if (currentEvents->moveMouseFunction) {
- if (!startNewFunctionNum(currentEvents->moveMouseFunction, 0, NULL,
- noStack))
- return false;
- }
- }
- input.justMoved = false;
-
- if (lastRegion != overRegion && currentEvents->focusFunction) {
- VariableStack *tempStack = new VariableStack;
- if (!checkNew(tempStack))
- return false;
-
- initVarNew(tempStack->thisVar);
- if (overRegion) {
- setVariable(tempStack->thisVar, SVT_OBJTYPE,
- overRegion->thisType->objectNum);
- } else {
- setVariable(tempStack->thisVar, SVT_INT, 0);
- }
- tempStack->next = NULL;
- if (!startNewFunctionNum(currentEvents->focusFunction, 1, NULL,
- tempStack))
- return false;
- }
- if (input.leftRelease && currentEvents->leftMouseUpFunction) {
- if (!startNewFunctionNum(currentEvents->leftMouseUpFunction, 0, NULL,
- noStack))
- return false;
- }
- if (input.rightRelease && currentEvents->rightMouseUpFunction) {
- if (!startNewFunctionNum(currentEvents->rightMouseUpFunction, 0, NULL,
- noStack))
- return false;
- }
- if (input.leftClick && currentEvents->leftMouseFunction)
- if (!startNewFunctionNum(currentEvents->leftMouseFunction, 0, NULL,
- noStack))
- return false;
- if (input.rightClick && currentEvents->rightMouseFunction) {
- if (!startNewFunctionNum(currentEvents->rightMouseFunction, 0, NULL,
- noStack))
- return false;
- }
- if (input.keyPressed && currentEvents->spaceFunction) {
- Common::String tempString = "";
- switch (input.keyPressed) {
- case 127:
- tempString = "BACKSPACE";
- break;
- case 9:
- tempString = "TAB";
- break;
- case 13:
- tempString = "ENTER";
- break;
- case 27:
- tempString = "ESCAPE";
- break;
- /*
- case 1112: tempString = copyString ("ALT+F1"); break;
- case 1113: tempString = copyString ("ALT+F2"); break;
- case 1114: tempString = copyString ("ALT+F3"); break;
- case 1115: tempString = copyString ("ALT+F4"); break;
- case 1116: tempString = copyString ("ALT+F5"); break;
- case 1117: tempString = copyString ("ALT+F6"); break;
- case 1118: tempString = copyString ("ALT+F7"); break;
- case 1119: tempString = copyString ("ALT+F8"); break;
- case 1120: tempString = copyString ("ALT+F9"); break;
- case 1121: tempString = copyString ("ALT+F10"); break;
- case 1122: tempString = copyString ("ALT+F11"); break;
- case 1123: tempString = copyString ("ALT+F12"); break;
-
- case 2019: tempString = copyString ("PAUSE"); break;
- */
- case 63276:
- tempString = "PAGE UP";
- break;
- case 63277:
- tempString = "PAGE DOWN";
- break;
- case 63275:
- tempString = "END";
- break;
- case 63273:
- tempString = "HOME";
- break;
- case 63234:
- tempString = "LEFT";
- break;
- case 63232:
- tempString = "UP";
- break;
- case 63235:
- tempString = "RIGHT";
- break;
- case 63233:
- tempString = "DOWN";
- break;
- /*
- case 2045: tempString = copyString ("INSERT"); break;
- case 2046: tempString = copyString ("DELETE"); break;
- */
- case 63236:
- tempString = "F1";
- break;
- case 63237:
- tempString = "F2";
- break;
- case 63238:
- tempString = "F3";
- break;
- case 63239:
- tempString = "F4";
- break;
- case 63240:
- tempString = "F5";
- break;
- case 63241:
- tempString = "F6";
- break;
- case 63242:
- tempString = "F7";
- break;
- case 63243:
- tempString = "F8";
- break;
- case 63244:
- tempString = "F9";
- break;
- case 63245:
- tempString = "F10";
- break;
- case 63246:
- tempString = "F11";
- break;
- case 63247:
- tempString = "F12";
- break;
-
- default:
- if (input.keyPressed >= 256) {
- char tmp[7] = "ABCDEF";
- sprintf(tmp, "%i", input.keyPressed);
- tempString = tmp;
- //}
- } else {
- char tmp[2] = " ";
- tmp[0] = input.keyPressed;
- tempString = tmp;
- }
- }
-
- if (!tempString.empty()) {
- VariableStack *tempStack = new VariableStack;
- if (!checkNew(tempStack))
- return false;
- initVarNew(tempStack->thisVar);
- makeTextVar(tempStack->thisVar, tempString);
- tempStack->next = NULL;
- if (!startNewFunctionNum(currentEvents->spaceFunction, 1, NULL, tempStack))
- return false;
- }
- }
- input.rightClick = false;
- input.leftClick = false;
- input.rightRelease = false;
- input.leftRelease = false;
- input.keyPressed = 0;
- lastRegion = overRegion;
- return runSludge();
-}
-
} // End of namespace Sludge
diff --git a/engines/sludge/sludger.h b/engines/sludge/sludger.h
index fe00cc6..91efb24 100644
--- a/engines/sludge/sludger.h
+++ b/engines/sludge/sludger.h
@@ -39,16 +39,6 @@ typedef struct _FILETIME {
struct Variable;
struct VariableStack;
-struct EventHandlers {
- int leftMouseFunction;
- int leftMouseUpFunction;
- int rightMouseFunction;
- int rightMouseUpFunction;
- int moveMouseFunction;
- int focusFunction;
- int spaceFunction;
-};
-
struct LineOfCode {
sludgeCommand theCommand;
int32 param;
@@ -68,20 +58,14 @@ struct LoadedFunction {
byte freezerLevel;
};
-struct InputType {
- bool leftClick, rightClick, justMoved, leftRelease, rightRelease;
- int mouseX, mouseY, keyPressed;
-};
-
bool initSludge(const Common::String &);
+bool runSludge();
void displayBase();
void sludgeDisplay();
int startNewFunctionNum(uint, uint, LoadedFunction *, VariableStack*&, bool = true);
bool handleInput();
void restartFunction(LoadedFunction *fun);
bool loadFunctionCode(LoadedFunction *newFunc);
-void loadHandlers(Common::SeekableReadStream *stream);
-void saveHandlers(Common::WriteStream *stream);
void finishFunction(LoadedFunction *fun);
void abortFunction(LoadedFunction *fun);
diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index 6a0421e..6134d1d 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -24,6 +24,7 @@
#include "graphics/transparent_surface.h"
#include "sludge/allfiles.h"
+#include "sludge/event.h"
#include "sludge/fileset.h"
#include "sludge/graphics.h"
#include "sludge/people.h"
@@ -38,7 +39,6 @@
namespace Sludge {
-extern InputType input;
void GraphicsManager::forgetSpriteBank(SpriteBank &forgetme) {
if (forgetme.myPalette.pal) {
delete[] forgetme.myPalette.pal;
@@ -406,13 +406,14 @@ bool GraphicsManager::scaleSprite(Sprite &single, const SpritePalette &fontPal,
}
// Are we pointing at the sprite?
- if (input.mouseX >= x1 && input.mouseX <= x2 && input.mouseY >= y1 && input.mouseY <= y2) {
+ if (_vm->_evtMan->mouseX() >= x1 && _vm->_evtMan->mouseX() <= x2
+ && _vm->_evtMan->mouseY() >= y1 && _vm->_evtMan->mouseY() <= y2) {
if (thisPerson->extra & EXTRA_RECTANGULAR)
return true;
// check if point to non transparent part
- int pixelx = (int)(single.surface.w * (input.mouseX - x1) / (x2 - x1));
- int pixely = (int)(single.surface.h * (input.mouseY - y1) / (y2 - y1));
+ int pixelx = (int)(single.surface.w * (_vm->_evtMan->mouseX() - x1) / (x2 - x1));
+ int pixely = (int)(single.surface.h * (_vm->_evtMan->mouseY() - y1) / (y2 - y1));
uint32 *colorPtr = (uint32 *)single.surface.getBasePtr(pixelx, pixely);
uint8 a, r, g, b;
Commit: 28982aa9a5bd6389f30b62b3ad042897ffa7fd2a
https://github.com/scummvm/scummvm/commit/28982aa9a5bd6389f30b62b3ad042897ffa7fd2a
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-07-20T19:10:01+02:00
Commit Message:
SLUDGE: Remove useless zbuffer updating code
Changed paths:
engines/sludge/sprites.cpp
diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index 6134d1d..b35bde4 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -277,11 +277,6 @@ void GraphicsManager::pasteSpriteToBackDrop(int x1, int y1, Sprite &single, cons
Graphics::TransparentSurface tmp(single.surface, false);
tmp.blit(_backdropSurface, x1, y1, Graphics::FLIP_NONE, nullptr,
TS_RGB(fontPal.originalRed, fontPal.originalGreen, fontPal.originalBlue));
-
- // reset zBuffer with the new backdrop
- if (_zBuffer->numPanels) {
- setZBuffer(_zBuffer->originalNum);
- }
}
// burnSpriteToBackDrop adds text in the colour specified by setBurnColour
@@ -293,11 +288,6 @@ void GraphicsManager::burnSpriteToBackDrop(int x1, int y1, Sprite &single, const
Graphics::TransparentSurface tmp(single.surface, false);
tmp.blit(_backdropSurface, x1, y1, Graphics::FLIP_NONE, nullptr,
TS_RGB(_currentBurnR, _currentBurnG, _currentBurnB));
-
- // reset zBuffer with the new backdrop
- if (_zBuffer->numPanels) {
- setZBuffer(_zBuffer->originalNum);
- }
}
void GraphicsManager::fontSprite(bool flip, int x, int y, Sprite &single, const SpritePalette &fontPal) {
@@ -525,11 +515,6 @@ void GraphicsManager::fixScaleSprite(int x, int y, Sprite &single, const SpriteP
// copy screen to backdrop
_backdropSurface.copyFrom(_renderSurface);
-
- // reset zBuffer with the new backdrop
- if (_zBuffer->numPanels) {
- setZBuffer(_zBuffer->originalNum);
- }
}
} // End of namespace Sludge
More information about the Scummvm-git-logs
mailing list