mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
SLUDGE: Move costume functions to struct Variable
This commit is contained in:
parent
04ef7becf3
commit
719f5842fa
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user