Script support for AColors. All colors in script related code are now AColor.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@852 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-05-16 20:51:16 +00:00
parent b0c0d8e97c
commit 1b516e781f
16 changed files with 115 additions and 44 deletions
+23
View File
@@ -29,6 +29,9 @@ void instrBinary (BinaryInstructionType i, ScriptValueP& a, const ScriptValueP&
// Perform a ternary simple instruction, store the result in a (not in *a)
void instrTernary(TernaryInstructionType i, ScriptValueP& a, const ScriptValueP& b, const ScriptValueP& c);
// Perform a quaternary simple instruction, store the result in a (not in *a)
void instrQuaternary(QuaternaryInstructionType i, ScriptValueP& a, const ScriptValueP& b, const ScriptValueP& c, const ScriptValueP& d);
ScriptValueP Context::eval(const Script& script, bool useScope) {
size_t stack_size = stack.size();
@@ -172,6 +175,16 @@ ScriptValueP Context::eval(const Script& script, bool useScope) {
ScriptValueP b = stack.back(); stack.pop_back();
ScriptValueP& a = stack.back();
instrTernary(i.instr3, a, b, c);
// cout << "\t\t-> " << (String)*stack.back() << endl;
break;
}
// Simple instruction: quaternary
case I_QUATERNARY: {
ScriptValueP d = stack.back(); stack.pop_back();
ScriptValueP c = stack.back(); stack.pop_back();
ScriptValueP b = stack.back(); stack.pop_back();
ScriptValueP& a = stack.back();
instrQuaternary(i.instr4, a, b, c, d);
// cout << "\t\t-> " << (String)*stack.back() << endl;
break;
}
@@ -370,6 +383,16 @@ void instrTernary(TernaryInstructionType i, ScriptValueP& a, const ScriptValueP&
}
}
// ----------------------------------------------------------------------------- : Simple instructions : quaternary
void instrQuaternary(QuaternaryInstructionType i, ScriptValueP& a, const ScriptValueP& b, const ScriptValueP& c, const ScriptValueP& d) {
switch (i) {
case I_RGBA:
a = to_script(AColor((int)*a, (int)*b, (int)*c, (int)*d));
break;
}
}
// ----------------------------------------------------------------------------- : Simple instructions : object
void Context::makeObject(size_t n) {