[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.73,2.74 script.cpp,1.69,1.70 script_v2.cpp,2.38,2.39 scummvm.cpp,2.123,2.124
Max Horn
fingolfin at users.sourceforge.net
Sat May 3 19:14:04 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv24028
Modified Files:
intern.h script.cpp script_v2.cpp scummvm.cpp
Log Message:
more v2 fixes; cleanup
Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.73
retrieving revision 2.74
diff -u -d -r2.73 -r2.74
--- intern.h 4 May 2003 01:10:45 -0000 2.73
+++ intern.h 4 May 2003 02:10:49 -0000 2.74
@@ -197,6 +197,8 @@
virtual void decodeParseString();
+ virtual int readVar(uint var);
+
virtual void ifStateCommon(byte type);
virtual void ifNotStateCommon(byte type);
virtual void setStateCommon(byte type);
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- script.cpp 30 Apr 2003 13:23:30 -0000 1.69
+++ script.cpp 4 May 2003 02:10:49 -0000 1.70
@@ -371,11 +371,7 @@
checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)");
- if ((_features & GF_AFTER_V2) && (var >= 14) && (var <= 16)) {
- return _vars[_vars[var]];
- } else {
- return _vars[var];
- }
+ return _vars[var];
}
if (var & 0x2000 && !(_features & GF_NEW_OPCODES)) {
@@ -386,9 +382,6 @@
var += a & 0xFFF;
var &= ~0x2000;
}
-
- if (!(var & 0xF000))
- return _vars[var];
if (var & 0x8000) {
if ((_gameId == GID_ZAK256) || (_features & GF_OLD_BUNDLE)) {
Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.38
retrieving revision 2.39
diff -u -d -r2.38 -r2.39
--- script_v2.cpp 4 May 2003 01:10:45 -0000 2.38
+++ script_v2.cpp 4 May 2003 02:10:49 -0000 2.39
@@ -366,6 +366,42 @@
return _opcodesV2[i].desc;
}
+void Scumm_v2::decodeParseString() {
+ byte buffer[256]; // FIXME
+ byte *ptr = buffer;
+ byte c;
+ while ((c = fetchScriptByte())) {
+ if (c & 0x80) {
+ *ptr++ = c & 0x7f;
+ *ptr++ = ' ';
+ } else if (c < 8) {
+ // Special codes as seen in CHARSET_1 etc. My guess is that they
+ // have a similar function as the corresponding embedded stuff in modern
+ // games. Hence for now we convert them to the modern format.
+ // This might allow us to reuse the existing code.
+ *ptr++ = 0xFF;
+ *ptr++ = c;
+ if (c > 3) {
+ *ptr++ = 0;
+ *ptr++ = fetchScriptByte();
+ }
+ } else
+ *ptr++ = c;
+ }
+ *ptr = 0;
+
+ printf("TODO: Scumm_v2::decodeParseString(\"%s\")\n", buffer);
+}
+
+int Scumm_v2::readVar(uint var) {
+ debug(6, "readvar=%d", var);
+ if (var >= 14 && var <= 16)
+ var = _vars[var];
+
+ checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)");
+ return _vars[var];
+}
+
void Scumm_v2::setStateCommon(byte type) {
int obj = getVarOrDirectWord(0x80);
putState(obj, getState(obj) | type);
@@ -457,15 +493,15 @@
}
void Scumm_v2::o2_setBitVar() {
- byte hi = fetchScriptByte();
byte lo = fetchScriptByte();
+ byte hi = fetchScriptByte();
byte a = getVarOrDirectByte(0x80);
int bit_var = (hi << 8) + lo + a;
int bit_offset = bit_var & 0x0f;
bit_var >>= 4;
- if (getVarOrDirectByte(0x80))
+ if (getVarOrDirectByte(0x40))
_vars[bit_var] |= (1 << bit_offset);
else
_vars[bit_var] &= ~(1 << bit_offset);
@@ -473,8 +509,8 @@
void Scumm_v2::o2_getBitVar() {
getResultPos();
- byte hi = fetchScriptByte();
byte lo = fetchScriptByte();
+ byte hi = fetchScriptByte();
byte a = getVarOrDirectByte(0x80);
int bit_var = (hi << 8) + lo + a;
@@ -561,12 +597,12 @@
Actor *a = derefActorSafe(act, "actorSet");
int i;
+ _opcode = fetchScriptByte();
if (!a) {
- fetchScriptByte();
return;
}
- switch (fetchScriptByte()) {
+ switch (_opcode) {
case 1: // Actor Sound
a->sound[0] = arg;
break;
@@ -588,6 +624,8 @@
case 5: // Talk Color
a->talkColor = arg;
break;
+ default:
+ warning("o2_actorSet: opcode %d not yet supported", _opcode);
}
}
@@ -830,33 +868,6 @@
case 2:
break;
}
-}
-
-void Scumm_v2::decodeParseString() {
- byte buffer[256]; // FIXME
- byte *ptr = buffer;
- byte c;
- while ((c = fetchScriptByte())) {
- if (c & 0x80) {
- *ptr++ = c & 0x7f;
- *ptr++ = ' ';
- } else if (c < 8) {
- // Special codes as seen in CHARSET_1 etc. My guess is that they
- // have a similar function as the corresponding embedded stuff in modern
- // games. Hence for now we convert them to the modern format.
- // This might allow us to reuse the existing code.
- *ptr++ = 0xFF;
- *ptr++ = c;
- if (c > 3) {
- *ptr++ = 0;
- *ptr++ = fetchScriptByte();
- }
- } else
- *ptr++ = c;
- }
- *ptr = 0;
-
- printf("TODO: Scumm_v2::decodeParseString(\"%s\")\n", buffer);
}
void Scumm_v2::o2_ifClassOfIs() {
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.123
retrieving revision 2.124
diff -u -d -r2.123 -r2.124
--- scummvm.cpp 4 May 2003 01:08:16 -0000 2.123
+++ scummvm.cpp 4 May 2003 02:10:49 -0000 2.124
@@ -1746,9 +1746,7 @@
Actor *Scumm::derefActorSafe(int id, const char *errmsg) {
if (id < 1 || id >= NUM_ACTORS) {
- if (_debugLevel > 1)
- warning
- ("Invalid actor %d in %s (script %d, opcode 0x%x) - This is potentially a BIG problem.",
+ debug(2, "Invalid actor %d in %s (script %d, opcode 0x%x) - This is potentially a BIG problem.",
id, errmsg, vm.slot[_curExecScript].number, _opcode);
return NULL;
}
More information about the Scummvm-git-logs
mailing list