mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-09 04:16:34 +00:00
SLUDGE: Move PersonAnimation functions into struct Variable
This commit is contained in:
parent
805a47b74a
commit
04ef7becf3
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user