diff options
35 files changed, 481 insertions, 481 deletions
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp index b1c9e5f344..e9f0c2296f 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 920be44e1c..d0c8068a27 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 8cfde0e6ae..f1d312e8df 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 63568d046b..fe327f4070 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 1683b4f87c..b2274c22e9 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 10e67cfc97..1960844646 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 2d81c39957..9bc5b82806 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 dc40ec7ac5..1884b449c8 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 c543c3f76d..4db7e22deb 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 ebd91a30a9..776a6f80a8 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 ff2d67c43c..7373d02613 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 e139e52008..d2d8e9d954 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 df8fa69c25..1914ea741e 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 1ca12a6668..79dde932e3 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 8de291d1a5..120e638369 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 1d329aa38e..1c5beb8ab5 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 65b603065c..66e338e980 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 c34322f9bc..c1aa1191a3 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 e0941a0399..1021829955 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 470f35282d..95b8e923b6 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 ec4e66a838..d7fba70d42 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 ce4157fed7..afbe80ef32 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 280d2dcbfe..9b75e137f3 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 5031e766b5..956df93f35 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 029257c643..12d76b9924 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 fe5d9b85e6..fe00cc6300 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 702a8c9c5b..5d6b426bc9 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 3255c31cdf..8e9038dcbb 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 7c9f9f16bc..6a0421ed98 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 04902ed8a6..e46736a07d 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 96404fca05..2f98f366f0 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 32bad40110..4e8cd3fb61 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 de535add3f..0d7fa80f0f 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 5b03dadda8..541d13b75d 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 6c0aff4e19..005eb1cd05 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 |