aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-06-20 10:53:06 +0000
committerMax Horn2003-06-20 10:53:06 +0000
commitf301d1fa47f1218b7d2817ada2c70fc91b49e7fb (patch)
treed41e878487884dca6e5bf6e8e5bf4b16716f0be7 /scumm
parent2a1b3d633d2ed96a9d51a517c67e95575296502e (diff)
downloadscummvm-rg350-f301d1fa47f1218b7d2817ada2c70fc91b49e7fb.tar.gz
scummvm-rg350-f301d1fa47f1218b7d2817ada2c70fc91b49e7fb.tar.bz2
scummvm-rg350-f301d1fa47f1218b7d2817ada2c70fc91b49e7fb.zip
fixed Zak256 (and possibly other V3 games); Not quite sure if the behaviour is correct for V4 games, that needs testing
svn-id: r8568
Diffstat (limited to 'scumm')
-rw-r--r--scumm/object.cpp3
-rw-r--r--scumm/script_v5.cpp14
2 files changed, 12 insertions, 5 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 06e660b404..cb23185a69 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -932,7 +932,10 @@ const byte *Scumm::getObjOrActorName(int obj) {
offset = *(objptr + 14);
else if (_features & GF_OLD_BUNDLE)
offset = *(objptr + 16);
+ else if (_version == 3)
+ offset = *(objptr + 18);
else
+ // FIXME: is this really correct?
offset = READ_LE_UINT16(objptr + 18);
return (objptr + offset);
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index 65fa28371e..3407ab890b 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -1897,7 +1897,7 @@ void Scumm_v5::o5_setObjectName() {
work[i++] = fetchScriptByte();
}
}
- work[i] = 0;
+ work[i++] = 0;
if (obj < _numActors)
error("Can't set actor %d name with new-name-of", obj);
@@ -1921,7 +1921,10 @@ void Scumm_v5::o5_setObjectName() {
if (_features & GF_OLD_BUNDLE)
offset = *(objptr + 16);
+ else if (_version == 3)
+ offset = *(objptr + 18);
else
+ // FIXME: is this really correct?
offset = READ_LE_UINT16(objptr + 18);
size = READ_LE_UINT16(objptr) - offset;
@@ -1978,12 +1981,13 @@ void Scumm_v5::o5_setObjectName() {
return; // Silently bail out
- if (i >= size) {
- warning("New name of object %d too long (old *%s* new *%s*)", obj, name, work);
- i = size - 1;
+ if (i > size) {
+ warning("New name of object %d too long: old 's' (%d), new '%s' (%d))",
+ obj, name, i, work, size);
+ i = size;
}
- memcpy(name, work, i+1);
+ memcpy(name, work, i);
runInventoryScript(0);
}