Skip to content

Commit

Permalink
MORTEVIELLE: Simplify loadDesFile and loadAniFile
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Jul 22, 2013
1 parent ecb62e2 commit 6085668
Showing 1 changed file with 6 additions and 36 deletions.
42 changes: 6 additions & 36 deletions engines/mortevielle/outtext.cpp
Expand Up @@ -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];
}

/**
Expand All @@ -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() {
Expand Down

0 comments on commit 6085668

Please sign in to comment.