aboutsummaryrefslogtreecommitdiff
path: root/engines/drascula/graphics.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2008-06-17 18:27:03 +0000
committerFilippos Karapetis2008-06-17 18:27:03 +0000
commitcca355acd73ca648309714ba2185876aea8eda23 (patch)
tree107e55b3ee6d1213dd6bfbfbab28c53cf42d8c73 /engines/drascula/graphics.cpp
parentbc01acd18f6a0fae36497826d3a21baf3fec958d (diff)
downloadscummvm-rg350-cca355acd73ca648309714ba2185876aea8eda23.tar.gz
scummvm-rg350-cca355acd73ca648309714ba2185876aea8eda23.tar.bz2
scummvm-rg350-cca355acd73ca648309714ba2185876aea8eda23.zip
Removed duplicate code
svn-id: r32727
Diffstat (limited to 'engines/drascula/graphics.cpp')
-rw-r--r--engines/drascula/graphics.cpp31
1 files changed, 10 insertions, 21 deletions
diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp
index 64591a856e..67993bfb6c 100644
--- a/engines/drascula/graphics.cpp
+++ b/engines/drascula/graphics.cpp
@@ -89,31 +89,21 @@ void DrasculaEngine::setCursorTable() {
}
void DrasculaEngine::loadPic(const char *NamePcc, byte *targetSurface, int colorCount) {
- unsigned int con, x = 0;
- unsigned int fExit = 0;
- byte ch, rep;
+ uint dataSize = 0;
+ byte *pcxData;
_arj.open(NamePcc);
if (!_arj.isOpen())
error("missing game data %s %c", NamePcc, 7);
- _arj.seek(128);
- while (!fExit) {
- ch = _arj.readByte();
- rep = 1;
- if ((ch & 192) == 192) {
- rep = (ch & 63);
- ch = _arj.readByte();
- }
- for (con = 0; con < rep; con++) {
- x++;
- if (x > 64000) {
- fExit = 1;
- break;
- }
- *targetSurface++ = ch;
- }
- }
+ dataSize = _arj.size() - 128 - (256 * 3);
+ pcxData = (byte *)malloc(dataSize);
+
+ _arj.seek(128, SEEK_SET);
+ _arj.read(pcxData, dataSize);
+
+ decodeRLE(pcxData, targetSurface);
+ free(pcxData);
for (int i = 0; i < 256; i++) {
cPal[i * 3 + 0] = _arj.readByte();
@@ -141,7 +131,6 @@ void DrasculaEngine::showFrame(bool firstFrame) {
memcpy(prevFrame, VGA, 64000);
decodeRLE(pcxData, VGA);
-
free(pcxData);
if (!firstFrame)