fixed Zak256 (and possibly other V3 games); Not quite sure if the behaviour is correct for V4 games, that needs testing

svn-id: r8568
This commit is contained in:
Max Horn 2003-06-20 10:53:06 +00:00
parent 2a1b3d633d
commit f301d1fa47
2 changed files with 12 additions and 5 deletions

View file

@ -932,7 +932,10 @@ const byte *Scumm::getObjOrActorName(int obj) {
offset = *(objptr + 14); offset = *(objptr + 14);
else if (_features & GF_OLD_BUNDLE) else if (_features & GF_OLD_BUNDLE)
offset = *(objptr + 16); offset = *(objptr + 16);
else if (_version == 3)
offset = *(objptr + 18);
else else
// FIXME: is this really correct?
offset = READ_LE_UINT16(objptr + 18); offset = READ_LE_UINT16(objptr + 18);
return (objptr + offset); return (objptr + offset);

View file

@ -1897,7 +1897,7 @@ void Scumm_v5::o5_setObjectName() {
work[i++] = fetchScriptByte(); work[i++] = fetchScriptByte();
} }
} }
work[i] = 0; work[i++] = 0;
if (obj < _numActors) if (obj < _numActors)
error("Can't set actor %d name with new-name-of", obj); 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) if (_features & GF_OLD_BUNDLE)
offset = *(objptr + 16); offset = *(objptr + 16);
else if (_version == 3)
offset = *(objptr + 18);
else else
// FIXME: is this really correct?
offset = READ_LE_UINT16(objptr + 18); offset = READ_LE_UINT16(objptr + 18);
size = READ_LE_UINT16(objptr) - offset; size = READ_LE_UINT16(objptr) - offset;
@ -1978,12 +1981,13 @@ void Scumm_v5::o5_setObjectName() {
return; // Silently bail out return; // Silently bail out
if (i >= size) { if (i > size) {
warning("New name of object %d too long (old *%s* new *%s*)", obj, name, work); warning("New name of object %d too long: old 's' (%d), new '%s' (%d))",
i = size - 1; obj, name, i, work, size);
i = size;
} }
memcpy(name, work, i+1); memcpy(name, work, i);
runInventoryScript(0); runInventoryScript(0);
} }