aboutsummaryrefslogtreecommitdiff
path: root/engines/drascula
diff options
context:
space:
mode:
authorMax Horn2010-03-09 23:36:18 +0000
committerMax Horn2010-03-09 23:36:18 +0000
commitfc50408ce38d562d73fea2182659a4800852dcb5 (patch)
treedcf253b8187399d85382605d0ae8134c494295cf /engines/drascula
parentc6f752ce30c6b13cc46990e507c2db443558c35a (diff)
downloadscummvm-rg350-fc50408ce38d562d73fea2182659a4800852dcb5.tar.gz
scummvm-rg350-fc50408ce38d562d73fea2182659a4800852dcb5.tar.bz2
scummvm-rg350-fc50408ce38d562d73fea2182659a4800852dcb5.zip
DRASCULA: Simplify playFLI and its subroutines
svn-id: r48217
Diffstat (limited to 'engines/drascula')
-rw-r--r--engines/drascula/drascula.cpp1
-rw-r--r--engines/drascula/drascula.h6
-rw-r--r--engines/drascula/graphics.cpp73
3 files changed, 11 insertions, 69 deletions
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index 1b40626b11..1fb3a53429 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -221,7 +221,6 @@ Common::Error DrasculaEngine::run() {
term_int = 0;
musicStopped = 0;
selectionMade = 0;
- _useMemForArj = false;
globalSpeed = 0;
curExcuseLook = 0;
curExcuseAction = 0;
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 84faea2c0b..9a7997659b 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -394,8 +394,6 @@ public:
byte *extraSurface; // not sure about this one, was "dir_hare_dch"
byte *screenSurface;
byte *frontSurface;
- byte *memPtr;
- byte *mSession;
byte cPal[768];
@@ -575,12 +573,8 @@ public:
void mixVideo(byte *OldScreen, byte *NewScreen);
void decodeRLE(byte *BufferRLE, byte *MiVideoRLE);
void decodeOffset(byte *BufferOFF, byte *MiVideoOFF, int length);
- byte *TryInMem(Common::SeekableReadStream *stream);
int playFrameSSN(Common::SeekableReadStream *stream);
- bool _useMemForArj;
- byte CHUNK;
- byte CMP, dacSSN[768];
int FrameSSN;
int globalSpeed;
uint32 LastFrame;
diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp
index 40edf42e41..80cfa05b8d 100644
--- a/engines/drascula/graphics.cpp
+++ b/engines/drascula/graphics.cpp
@@ -476,12 +476,7 @@ void DrasculaEngine::playFLI(const char *filefli, int vel) {
// Open file
globalSpeed = 1000 / vel;
FrameSSN = 0;
- _useMemForArj = false;
Common::SeekableReadStream *stream = _archives.open(filefli);
- // TODO: mSession is treated like a stream from playFrameSSN, so turn it
- // into a stream, and pass it to playFrameSSN. Get rid of _useMemForArj
- // as well.
- mSession = TryInMem(stream);
LastFrame = _system->getMillis();
while (playFrameSSN(stream) && (!term_int)) {
@@ -489,9 +484,6 @@ void DrasculaEngine::playFLI(const char *filefli, int vel) {
term_int = 1;
}
- if (_useMemForArj)
- free(memPtr);
-
delete stream;
}
@@ -500,48 +492,24 @@ int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) {
uint32 length;
byte *BufferSSN;
- if (!_useMemForArj)
- CHUNK = stream->readByte();
- else {
- memcpy(&CHUNK, mSession, 1);
- mSession += 1;
- }
+ byte CHUNK = stream->readByte();
switch (CHUNK) {
- case kFrameSetPal:
- if (!_useMemForArj) {
- for (int i = 0; i < 256; i++) {
- dacSSN[i * 3 + 0] = stream->readByte();
- dacSSN[i * 3 + 1] = stream->readByte();
- dacSSN[i * 3 + 2] = stream->readByte();
- }
- } else {
- memcpy(dacSSN, mSession, 768);
- mSession += 768;
- }
+ case kFrameSetPal: {
+ byte dacSSN[768];
+ stream->read(dacSSN, 768);
setPalette(dacSSN);
break;
+ }
case kFrameEmptyFrame:
waitFrameSSN();
break;
- case kFrameInit:
- if (!_useMemForArj) {
- CMP = stream->readByte();
- length = stream->readUint32LE();
- } else {
- memcpy(&CMP, mSession, 1);
- mSession += 1;
- length = READ_LE_UINT32(mSession);
- mSession += 4;
- }
+ case kFrameInit: {
+ byte CMP = stream->readByte();
+ length = stream->readUint32LE();
if (CMP == kFrameCmpRle) {
BufferSSN = (byte *)malloc(length);
- if (!_useMemForArj) {
- stream->read(BufferSSN, length);
- } else {
- memcpy(BufferSSN, mSession, length);
- mSession += length;
- }
+ stream->read(BufferSSN, length);
decodeRLE(BufferSSN, screenSurface);
free(BufferSSN);
waitFrameSSN();
@@ -558,12 +526,7 @@ int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) {
} else {
if (CMP == kFrameCmpOff) {
BufferSSN = (byte *)malloc(length);
- if (!_useMemForArj) {
- stream->read(BufferSSN, length);
- } else {
- memcpy(BufferSSN, mSession, length);
- mSession += length;
- }
+ stream->read(BufferSSN, length);
decodeOffset(BufferSSN, screenSurface, length);
free(BufferSSN);
waitFrameSSN();
@@ -579,6 +542,7 @@ int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) {
}
}
break;
+ }
case kFrameEndAnim:
Exit = 1;
break;
@@ -590,21 +554,6 @@ int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) {
return (!Exit);
}
-byte *DrasculaEngine::TryInMem(Common::SeekableReadStream *stream) {
- int length;
-
- stream->seek(0, SEEK_END);
- length = stream->pos();
- stream->seek(0, SEEK_SET);
- memPtr = (byte *)malloc(length);
- if (memPtr == NULL)
- return NULL;
- stream->read(memPtr, length);
- _useMemForArj = true;
-
- return memPtr;
-}
-
void DrasculaEngine::decodeOffset(byte *BufferOFF, byte *MiVideoOFF, int length) {
int x = 0;
int size;