From 8d01148b797f66af457434284b3a41bd18b86098 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 18 Apr 2005 11:19:54 +0000 Subject: Sound size should only include sound data. svn-id: r17667 --- scumm/script_v100he.cpp | 12 ++++++++---- scumm/script_v72he.cpp | 11 +++++------ scumm/script_v80he.cpp | 21 ++++++++++----------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp index 9fd166246d..1494cdc40f 100644 --- a/scumm/script_v100he.cpp +++ b/scumm/script_v100he.cpp @@ -2191,6 +2191,7 @@ void ScummEngine_v100he::o100_writeFile() { } void ScummEngine_v100he::o100_getResourceSize() { + const byte *ptr; int size, type; int resid = pop(); @@ -2214,15 +2215,18 @@ void ScummEngine_v100he::o100_getResourceSize() { int offs; _sound->getHEMusicDetails(resid, offs, size); push(size); - return; + } else { + ptr = getResourceAddress(rtSound, resid); + assert(ptr); + size = READ_BE_UINT32(ptr + 4) - 40; + push(size); } - type = rtSound; - break; + return; default: error("o100_getResourceSize: default type %d", subOp); } - const byte *ptr = getResourceAddress(type, resid); + ptr = getResourceAddress(type, resid); assert(ptr); size = READ_BE_UINT32(ptr + 4) - 8; push(size); diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index f69587084b..b20716e850 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -2163,13 +2163,12 @@ void ScummEngine_v72he::o72_getResourceSize() { int offs; _sound->getHEMusicDetails(resid, offs, size); push(size); - return; + } else { + const byte *ptr = getResourceAddress(rtSound, resid); + assert(ptr); + size = READ_BE_UINT32(ptr + 4) - 40; + push(size); } - - const byte *ptr = getResourceAddress(rtSound, resid); - assert(ptr); - size = getResourceDataSize(ptr); - push(size); } void ScummEngine_v72he::o72_setFilePath() { diff --git a/scumm/script_v80he.cpp b/scumm/script_v80he.cpp index 875d900091..8e523d90dc 100644 --- a/scumm/script_v80he.cpp +++ b/scumm/script_v80he.cpp @@ -806,6 +806,7 @@ void ScummEngine_v80he::o80_pickVarRandom() { } void ScummEngine_v80he::o80_getResourceSize() { + const byte *ptr; int size, type; int resid = pop(); @@ -817,10 +818,13 @@ void ScummEngine_v80he::o80_getResourceSize() { int offs; _sound->getHEMusicDetails(resid, offs, size); push(size); - return; + } else { + ptr = getResourceAddress(rtSound, resid); + assert(ptr); + size = READ_BE_UINT32(ptr + 4) - 40; + push(size); } - type = rtSound; - break; + return; case 14: type = rtRoomImage; break; @@ -837,14 +841,9 @@ void ScummEngine_v80he::o80_getResourceSize() { error("o80_getResourceSize: default type %d", subOp); } - const byte *ptr = getResourceAddress(type, resid); - if (ptr) { - size = getResourceDataSize(ptr); - } else { - debug(0, "o80_getResourceSize: invalid resource type %d id %d", type, resid); - size = 0; - } - + ptr = getResourceAddress(type, resid); + assert(ptr); + size = READ_BE_UINT32(ptr + 4) - 8; push(size); } -- cgit v1.2.3