diff options
author | Simei Yin | 2018-05-31 20:14:33 +0200 |
---|---|---|
committer | Simei Yin | 2018-05-31 23:15:09 +0200 |
commit | 04ef7becf37fbc5ed0ac9183aa8355ffa838df4b (patch) | |
tree | 7f475fe6980671b48c8d124df22789d454f4b6e1 /engines | |
parent | 805a47b74ab9b2ffa299d5c8401f178db022d4d8 (diff) | |
download | scummvm-rg350-04ef7becf37fbc5ed0ac9183aa8355ffa838df4b.tar.gz scummvm-rg350-04ef7becf37fbc5ed0ac9183aa8355ffa838df4b.tar.bz2 scummvm-rg350-04ef7becf37fbc5ed0ac9183aa8355ffa838df4b.zip |
SLUDGE: Move PersonAnimation functions into struct Variable
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sludge/builtin.cpp | 10 | ||||
-rw-r--r-- | engines/sludge/variable.cpp | 18 | ||||
-rw-r--r-- | engines/sludge/variable.h | 6 |
3 files changed, 17 insertions, 17 deletions
diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp index 20b4ba8328..f282d681cd 100644 --- a/engines/sludge/builtin.cpp +++ b/engines/sludge/builtin.cpp @@ -165,7 +165,7 @@ builtIn(howFrozen) { builtIn(setCursor) { UNUSEDALL - PersonaAnimation *aa = getAnimationFromVar(fun->stack->thisVar); + PersonaAnimation *aa = fun->stack->thisVar.getAnimationFromVar(); g_sludge->_cursorMan->pickAnimCursor(aa); trimStack(fun->stack); return BR_CONTINUE; @@ -370,7 +370,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 = fun->stack->thisVar.getAnimationFromVar(); trimStack(fun->stack); if (pp == NULL) return BR_CONTINUE; @@ -840,7 +840,7 @@ builtIn(anim) { ba->theSprites = sprBanky; // Return value - newAnimationVariable(fun->reg, ba); + fun->reg.makeAnimationVariable(ba); return BR_CONTINUE; } @@ -860,7 +860,7 @@ builtIn(costume) { if (!checkNew(newPersona->animation)) return BR_ERROR; for (iii = numParams - 1; iii >= 0; iii--) { - newPersona->animation[iii] = getAnimationFromVar(fun->stack->thisVar); + newPersona->animation[iii] = fun->stack->thisVar.getAnimationFromVar(); trimStack(fun->stack); } @@ -1553,7 +1553,7 @@ builtIn(pasteCharacter) { builtIn(animate) { UNUSEDALL int obj; - PersonaAnimation *pp = getAnimationFromVar(fun->stack->thisVar); + PersonaAnimation *pp = fun->stack->thisVar.getAnimationFromVar(); if (pp == NULL) return BR_ERROR; trimStack(fun->stack); diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp index 8385476c0a..27b38dbbb6 100644 --- a/engines/sludge/variable.cpp +++ b/engines/sludge/variable.cpp @@ -82,20 +82,20 @@ void Variable::setVariable(VariableType vT, int value) { varData.intValue = value; } -void newAnimationVariable(Variable &thisVar, PersonaAnimation *i) { - thisVar.unlinkVar(); - thisVar.varType = SVT_ANIM; - thisVar.varData.animHandler = i; +void Variable::makeAnimationVariable(PersonaAnimation *i) { + unlinkVar(); + varType = SVT_ANIM; + varData.animHandler = i; } -PersonaAnimation *getAnimationFromVar(Variable &thisVar) { - if (thisVar.varType == SVT_ANIM) - return new PersonaAnimation(thisVar.varData.animHandler); +PersonaAnimation *Variable::getAnimationFromVar() { + if (varType == SVT_ANIM) + return new PersonaAnimation(varData.animHandler); - if (thisVar.varType == SVT_INT && thisVar.varData.intValue == 0) + if (varType == SVT_INT && varData.intValue == 0) return new PersonaAnimation(); - fatal("Expecting an animation variable; found Variable of type", typeName[thisVar.varType]); + fatal("Expecting an animation variable; found Variable of type", typeName[varType]); return NULL; } diff --git a/engines/sludge/variable.h b/engines/sludge/variable.h index aa1e2aa802..5a0369375d 100644 --- a/engines/sludge/variable.h +++ b/engines/sludge/variable.h @@ -90,7 +90,9 @@ struct Variable { bool loadStringToVar(int value); Common::String getTextFromAnyVar(); - // Get Text + // Animation variable + void makeAnimationVariable(struct PersonaAnimation *i); + struct PersonaAnimation *getAnimationFromVar(); }; @@ -100,7 +102,6 @@ struct VariableStack { }; // Setting variables -void newAnimationVariable(Variable &thisVar, struct PersonaAnimation *i); void newCostumeVariable(Variable &thisVar, struct Persona *i); void addVariablesInSecond(Variable &var1, Variable &var2); void compareVariablesInSecond(const Variable &var1, Variable &var2); @@ -108,7 +109,6 @@ void compareVariablesInSecond(const Variable &var1, Variable &var2); // Misc. struct Persona *getCostumeFromVar(Variable &thisVar); -struct PersonaAnimation *getAnimationFromVar(Variable &thisVar); bool getBoolean(const Variable &from); bool getValueType(int &toHere, VariableType vT, const Variable &v); |