aboutsummaryrefslogtreecommitdiff
path: root/scumm/script_v6.cpp
diff options
context:
space:
mode:
authorMax Horn2002-12-23 00:23:36 +0000
committerMax Horn2002-12-23 00:23:36 +0000
commit58f2ee45cdcdf9b9f644dc9a9119ec0b80aac8a8 (patch)
treea6aa76512abc7198721be5edc2bc6e2ac55be306 /scumm/script_v6.cpp
parent11a48a2b01db68a81bc5c0a1c15098c3cf4dc7c6 (diff)
downloadscummvm-rg350-58f2ee45cdcdf9b9f644dc9a9119ec0b80aac8a8.tar.gz
scummvm-rg350-58f2ee45cdcdf9b9f644dc9a9119ec0b80aac8a8.tar.bz2
scummvm-rg350-58f2ee45cdcdf9b9f644dc9a9119ec0b80aac8a8.zip
word size for V8 games is 4 bytes, as opposed to 2 bytes in V6/V7 games. Hence we adjust fetchScriptWord - this way we can reuse all sorts of code (and no, this is not really a hack - word size by tradition is something which varies depending on the architecture, so it is even consistent)
svn-id: r6064
Diffstat (limited to 'scumm/script_v6.cpp')
-rw-r--r--scumm/script_v6.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp
index c5210839b8..af7b9fc77b 100644
--- a/scumm/script_v6.cpp
+++ b/scumm/script_v6.cpp
@@ -422,6 +422,9 @@ int Scumm::readArray(int array, int idx, int base)
if (ah->type == 4) {
return ah->data[base];
+ } else if (_features & GF_AFTER_V8) {
+ // FIXME - this is just a guess, might be wrong
+ return (int32)READ_LE_UINT32(ah->data + base * 4);
} else {
return (int16)READ_LE_UINT16(ah->data + base * 2);
}
@@ -438,6 +441,9 @@ void Scumm::writeArray(int array, int idx, int base, int value)
if (ah->type == 4) {
ah->data[base] = value;
+ } else if (_features & GF_AFTER_V8) {
+ // FIXME - this is just a guess, might be wrong
+ ((uint32 *)ah->data)[base] = TO_LE_32(value);
} else {
((uint16 *)ah->data)[base] = TO_LE_16(value);
}
@@ -470,7 +476,7 @@ void Scumm_v6::o6_pushByte()
void Scumm_v6::o6_pushWord()
{
- push((int16)fetchScriptWord());
+ push(fetchScriptWordSigned());
}
void Scumm_v6::o6_pushByteVar()
@@ -722,7 +728,7 @@ void Scumm_v6::o6_jumpFalse()
void Scumm_v6::o6_jump()
{
- _scriptPointer += (int16)fetchScriptWord();
+ _scriptPointer += fetchScriptWordSigned();
}
void Scumm_v6::o6_startScriptEx()
@@ -2047,7 +2053,7 @@ void Scumm_v6::o6_wait()
{
switch (fetchScriptByte()) {
case 168:{
- int offs = (int16)fetchScriptWord();
+ int offs = fetchScriptWordSigned();
if (derefActorSafe(pop(), "o6_wait")->moving) {
_scriptPointer += offs;
o6_breakHere();
@@ -2092,7 +2098,7 @@ void Scumm_v6::o6_wait()
case 226:{ /* wait until actor drawn */
int actnum = pop();
Actor *a = derefActorSafe(actnum, "o6_wait:226");
- int offs = (int16)fetchScriptWord();
+ int offs = fetchScriptWordSigned();
if (a && a->isInCurrentRoom() && a->needRedraw) {
_scriptPointer += offs;
o6_breakHere();
@@ -2102,7 +2108,7 @@ void Scumm_v6::o6_wait()
case 232:{ /* wait until actor stops turning */
int actnum = pop();
Actor *a = derefActorSafe(actnum, "o6_wait:232");
- int offs = (int16)fetchScriptWord();
+ int offs = fetchScriptWordSigned();
if (a && a->isInCurrentRoom() && a->moving & MF_TURN) {
_scriptPointer += offs;
o6_breakHere();