From dd0d454da94d5afb2c2437b44310404fe9581772 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Sat, 9 Oct 2004 16:41:35 +0000 Subject: ScummEngine_v90he::processWizImage() cases 3 & 4 svn-id: r15490 --- scumm/script_v90he.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'scumm') diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index 3789535117..1abbddeacd 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -563,9 +563,55 @@ void ScummEngine_v90he::processWizImage(const WizParameters *params) { case 1: displayWizComplexImage(params); break; - case 2: case 3: + if (params->processFlags & 0x800) { + File f; + if (!f.open((const char *)params->filename, File::kFileReadMode)) { + warning("Unable to open for read '%s'", params->filename); + } else { + uint32 id = f.readUint32BE(); + if (id != MKID('AWIZ') && id != MKID('MULT')) { + VAR(0x20) = -1; + } else { + uint32 size = f.readUint32BE(); + f.seek(0, SEEK_SET); + byte *p = createResource(rtImage, params->img.resNum, size); + if (f.read(p, size) != size) { + nukeResource(rtImage, params->img.resNum); + warning("i/o error when reading '%s'", params->filename); + VAR(0x20) = -2; + } else { + VAR(0x20) = 0; + } + } + f.close(); + } + } + break; case 4: + if (params->processFlags & 0x800) { + if (params->unk_14C != 0) { + VAR(0x77) = -1; + } else { + File f; + if (!f.open((const char *)params->filename, File::kFileWriteMode)) { + warning("Unable to open for write '%s'", params->filename); + VAR(0x77) = -3; + } else { + byte *p = getResourceAddress(rtImage, params->img.resNum); + uint32 size = READ_BE_UINT32(p + 4); + if (f.write(p, size) != size) { + warning("i/o error when writing '%s'", params->filename); + VAR(0x77) = -2; + } else { + VAR(0x77) = 0; + } + f.close(); + } + } + } + break; + case 2: case 6: // HE 99+ case 7: -- cgit v1.2.3