aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2004-06-01 20:59:14 +0000
committerEugene Sandulenko2004-06-01 20:59:14 +0000
commit6a314c99a97844d3250a9fbb51862d990522bb74 (patch)
tree7d65b30c176baa196f9d3de1f03b79cf0e883b43
parentcd0c2dfdeb928d2f71da9bb7e941aedc17caf40b (diff)
downloadscummvm-rg350-6a314c99a97844d3250a9fbb51862d990522bb74.tar.gz
scummvm-rg350-6a314c99a97844d3250a9fbb51862d990522bb74.tar.bz2
scummvm-rg350-6a314c99a97844d3250a9fbb51862d990522bb74.zip
Fix o6_writeFile.
svn-id: r13920
-rw-r--r--scumm/script_v6he.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp
index 24c2810578..6e3c40c7d8 100644
--- a/scumm/script_v6he.cpp
+++ b/scumm/script_v6he.cpp
@@ -1198,9 +1198,11 @@ void ScummEngine_v6he::o6_rename() {
int ScummEngine_v6he::readFileToArray(int slot, int32 size) {
if (size == 0)
size = _hFileTable[slot].size() - _hFileTable[slot].pos();
+
writeVar(0, 0);
- ArrayHeader *ah = defineArray(0, rtCostume, 0, size);
+ // define size as size-1 because in defineArray it gets incremented
+ ArrayHeader *ah = defineArray(0, rtCostume, 0, size-1);
_hFileTable[slot].read(ah->data, size);
return readVar(0);
@@ -1231,9 +1233,8 @@ void ScummEngine_v6he::o6_readFile() {
void ScummEngine_v6he::writeFileFromArray(int slot, int resID) {
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, resID);
- // FIXME: hack for proper size: / 2 - 5
- // does it really needed? Needs checking
- int32 size = getResourceSize(rtString, resID) / 2 - 5;
+ int32 size = FROM_LE_16(ah->dim1) * FROM_LE_16(ah->dim2);
+
_hFileTable[slot].write(ah->data, size);
}
@@ -1262,10 +1263,10 @@ void ScummEngine_v6he::o6_setVolume() {
int soundVolumeMaster;
int volume = pop();
switch (subOp) {
- case 222:
+ case 0xde:
_mixer->setMusicVolume(volume);
break;
- case 224:
+ case 0xe0:
soundVolumeMaster = ConfMan.getInt("master_volume");
_mixer->setVolume(volume * soundVolumeMaster / 255);
break;