aboutsummaryrefslogtreecommitdiff
path: root/engines/sludge
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sludge')
-rw-r--r--engines/sludge/builtin.cpp6
-rw-r--r--engines/sludge/variable.cpp18
-rw-r--r--engines/sludge/variable.h8
3 files changed, 17 insertions, 15 deletions
diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index f282d681cd..2aacead453 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -865,7 +865,7 @@ builtIn(costume) {
}
// Return value
- newCostumeVariable(fun->reg, newPersona);
+ fun->reg.makeCostumeVariable(newPersona);
return BR_CONTINUE;
}
@@ -1407,7 +1407,7 @@ builtIn(addCharacter) {
Persona *p;
int x, y, objectNumber;
- p = getCostumeFromVar(fun->stack->thisVar);
+ p = fun->stack->thisVar.getCostumeFromVar();
if (p == NULL)
return BR_ERROR;
@@ -1568,7 +1568,7 @@ builtIn(animate) {
builtIn(setCostume) {
UNUSEDALL
int obj;
- Persona *pp = getCostumeFromVar(fun->stack->thisVar);
+ Persona *pp = fun->stack->thisVar.getCostumeFromVar();
if (pp == NULL)
return BR_ERROR;
trimStack(fun->stack);
diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp
index 27b38dbbb6..d431077235 100644
--- a/engines/sludge/variable.cpp
+++ b/engines/sludge/variable.cpp
@@ -99,16 +99,16 @@ PersonaAnimation *Variable::getAnimationFromVar() {
return NULL;
}
-void newCostumeVariable(Variable &thisVar, Persona *i) {
- thisVar.unlinkVar();
- thisVar.varType = SVT_COSTUME;
- thisVar.varData.costumeHandler = i;
+void Variable::makeCostumeVariable(Persona *i) {
+ unlinkVar();
+ varType = SVT_COSTUME;
+ varData.costumeHandler = i;
}
-Persona *getCostumeFromVar(Variable &thisVar) {
+Persona *Variable::getCostumeFromVar() {
Persona *p = NULL;
- switch (thisVar.varType) {
+ switch (varType) {
case SVT_ANIM:
p = new Persona;
if (!checkNew(p))
@@ -119,16 +119,16 @@ Persona *getCostumeFromVar(Variable &thisVar) {
return NULL;
for (int iii = 0; iii < 3; iii++)
- p->animation[iii] = new PersonaAnimation(thisVar.varData.animHandler);
+ p->animation[iii] = new PersonaAnimation(varData.animHandler);
break;
case SVT_COSTUME:
- return thisVar.varData.costumeHandler;
+ return varData.costumeHandler;
break;
default:
- fatal("Expecting an animation variable; found Variable of type", typeName[thisVar.varType]);
+ fatal("Expecting an animation variable; found Variable of type", typeName[varType]);
}
return p;
diff --git a/engines/sludge/variable.h b/engines/sludge/variable.h
index 5a0369375d..2537c6e318 100644
--- a/engines/sludge/variable.h
+++ b/engines/sludge/variable.h
@@ -91,9 +91,13 @@ struct Variable {
Common::String getTextFromAnyVar();
// Animation variable
- void makeAnimationVariable(struct PersonaAnimation *i);
+ void makeAnimationVariable(PersonaAnimation *i);
struct PersonaAnimation *getAnimationFromVar();
+ // Custome variable
+ void makeCostumeVariable(Persona *i);
+ struct Persona *getCostumeFromVar();
+
};
struct VariableStack {
@@ -102,13 +106,11 @@ struct VariableStack {
};
// Setting variables
-void newCostumeVariable(Variable &thisVar, struct Persona *i);
void addVariablesInSecond(Variable &var1, Variable &var2);
void compareVariablesInSecond(const Variable &var1, Variable &var2);
// Misc.
-struct Persona *getCostumeFromVar(Variable &thisVar);
bool getBoolean(const Variable &from);
bool getValueType(int &toHere, VariableType vT, const Variable &v);