aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-07-22 10:59:52 +0200
committerStrangerke2013-07-22 10:59:52 +0200
commit4bba7fcb9048e856eeb8f35beb844890f110736e (patch)
tree1a1a988f73747afe27e8bce90fa8d69c44418051 /engines
parentb481096d87d3a24cc8c0e0e3a6c0cf60e2d55e8a (diff)
downloadscummvm-rg350-4bba7fcb9048e856eeb8f35beb844890f110736e.tar.gz
scummvm-rg350-4bba7fcb9048e856eeb8f35beb844890f110736e.tar.bz2
scummvm-rg350-4bba7fcb9048e856eeb8f35beb844890f110736e.zip
MORTEVIELLE: Simplify loadDesFile and loadAniFile
Diffstat (limited to 'engines')
-rw-r--r--engines/mortevielle/outtext.cpp42
1 files changed, 6 insertions, 36 deletions
diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp
index 8e27e471eb..1e25aea229 100644
--- a/engines/mortevielle/outtext.cpp
+++ b/engines/mortevielle/outtext.cpp
@@ -133,24 +133,10 @@ void TextHandler::loadDesFile(Common::String filename, int32 skipSize, int lengt
if (!f.open(filename))
error("Missing file %s", filename.c_str());
- int skipBlock = skipSize / 128;
- skipSize %= 128;
-
- if (skipBlock != 0)
- f.seek(skipBlock * 0x80);
-
- int remainingSkipSize = abs(skipSize);
- int totalLength = length + remainingSkipSize;
- int memIndx = kAdrPictureDecomp * 16;
- while (totalLength > 0) {
- f.read(&_vm->_mem[memIndx], 128);
- totalLength -= 128;
- memIndx += 128;
- }
+ assert(skipSize + length <= f.size());
+ f.seek(skipSize);
+ f.read(&_vm->_mem[(kAdrPictureComp * 16)], length);
f.close();
-
- for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i)
- _vm->_mem[(kAdrPictureComp * 16) + i - remainingSkipSize] = _vm->_mem[(kAdrPictureDecomp * 16) + i];
}
/**
@@ -162,26 +148,10 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt
if (!f.open(filename))
error("Missing file - %s", filename.c_str());
- int skipBlock = 0;
- while (skipSize > 127) {
- skipSize = skipSize - 128;
- ++skipBlock;
- }
- if (skipBlock != 0)
- f.seek(skipBlock * 0x80);
-
- int remainingSkipSize = abs(skipSize);
- int fullLength = length + remainingSkipSize;
- int memIndx = kAdrPictureDecomp * 16;
- while (fullLength > 0) {
- f.read(&_vm->_mem[memIndx], 128);
- fullLength -= 128;
- memIndx += 128;
- }
+ assert(skipSize + length <= f.size());
+ f.seek(skipSize);
+ f.read(&_vm->_mem[(kAdrAni * 16)], length);
f.close();
-
- for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i)
- _vm->_mem[(kAdrAni * 16) + i - remainingSkipSize] = _vm->_mem[(kAdrPictureDecomp * 16) + i];
}
void TextHandler::taffich() {