aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/objects.h
diff options
context:
space:
mode:
authorNicola Mettifogo2007-08-25 11:45:05 +0000
committerNicola Mettifogo2007-08-25 11:45:05 +0000
commit1e8ebaa7bda5becdb9c89604a6abacf7be69dfb0 (patch)
tree38f276530cf5135cb5dff7fbb110becf3930e272 /engines/parallaction/objects.h
parent487f22d8c32b4095b153562c13773f33bcaa1bfa (diff)
downloadscummvm-rg350-1e8ebaa7bda5becdb9c89604a6abacf7be69dfb0.tar.gz
scummvm-rg350-1e8ebaa7bda5becdb9c89604a6abacf7be69dfb0.tar.bz2
scummvm-rg350-1e8ebaa7bda5becdb9c89604a6abacf7be69dfb0.zip
Cleanup script routines.
svn-id: r28718
Diffstat (limited to 'engines/parallaction/objects.h')
-rw-r--r--engines/parallaction/objects.h64
1 files changed, 35 insertions, 29 deletions
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index 3f8635eb0d..3699e98f01 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -299,29 +299,36 @@ struct LocalVariable {
}
};
-union ScriptVar {
+enum ParaFlags {
+ kParaImmediate = 1, // instruction is using an immediate parameter
+ kParaLocal = 2, // instruction is using a local variable
+ kParaField = 0x10, // instruction is using an animation's field
+ kParaRandom = 0x100
+};
+
+
+struct ScriptVar {
+ uint32 _flags;
+
int16 _value;
int16* _pvalue;
LocalVariable* _local;
- ScriptVar() {
- _local = NULL;
- }
+ ScriptVar();
+
+ int16 getRValue();
+ int16* getLValue();
+
+ void setLocal(LocalVariable *local);
+ void setField(int16 *field);
+ void setImmediate(int16 value);
+ void setRandom(int16 seed);
};
enum InstructionFlags {
- kInstUsesLiteral = 1,
- kInstUsesLocal = 2,
kInstMod = 4,
kInstMaskedPut = 8,
-
- kInstUsesField = 0x10, // this value wasn't originally in NS, but it has been added for completeness
-
- // BRA specific
- kInstUnk20 = 0x20,
- kInstUsesLLocal = 0x40,
- kInstUsesLField = 0x80,
- kInstRandom = 0x100
+ kInstUnk20 = 0x20
};
typedef ManagedList<Instruction*> InstructionList;
@@ -329,12 +336,11 @@ typedef ManagedList<Instruction*> InstructionList;
struct Instruction {
uint32 _index;
uint32 _flags;
- struct {
- Animation *_a;
- Zone *_z;
- uint32 _index;
- ScriptVar _loopCounter;
- } _opBase;
+
+ // common
+ Animation *_a;
+ Zone *_z;
+ int16 _immediate;
ScriptVar _opA;
ScriptVar _opB;
@@ -346,28 +352,28 @@ struct Instruction {
int _y;
InstructionList::iterator _endif;
- Instruction() {
- memset(this, 0, sizeof(Instruction));
- }
+ Instruction();
+ ~Instruction();
- ~Instruction() {
- if (_text)
- free(_text);
- if (_text2)
- free(_text2);
- }
};
+
struct Program {
LocalVariable *_locals;
+
uint16 _loopCounter;
+ uint16 _numLocals;
+
InstructionList::iterator _ip;
InstructionList::iterator _loopStart;
InstructionList _instructions;
Program();
~Program();
+
+ int16 findLocal(const char* name);
+ int16 addLocal(const char *name, int16 value = 0, int16 min = -10000, int16 max = 10000);
};