LAB: Get rid of _isBM

This commit is contained in:
Filippos Karapetis 2015-12-08 11:29:23 +02:00 committed by Willem Jan Palenstijn
parent ae056a767b
commit 21fc36bfad
5 changed files with 16 additions and 20 deletions

View file

@ -37,7 +37,6 @@ Anim::Anim(LabEngine *vm) : _vm(vm) {
_header = 0;
_curBit = 0;
_numChunks = 1;
_isBM = false;
_headerdata._width = 0;
_headerdata._height = 0;
_headerdata._fps = 0;
@ -78,7 +77,7 @@ void Anim::readBlock(void *Buffer, uint32 Size, byte **File) {
(*File) += Size;
}
void Anim::diffNextFrame() {
void Anim::diffNextFrame(bool onlyDiffData) {
if (_header == 65535) /* Already done. */
return;
@ -96,7 +95,7 @@ void Anim::diffNextFrame() {
if (_curBit >= _numChunks) {
_vm->_event->mouseShow();
if (!_isBM) {
if (!onlyDiffData) {
if (_headerdata._fps) {
_vm->waitForTime(_waitSec, _waitMicros);
_vm->addCurTime(0L, _delayMicros, &_waitSec, &_waitMicros);
@ -110,7 +109,7 @@ void Anim::diffNextFrame() {
_donePal = true;
}
if (_isPal && !_noPalChange && !_isBM && !_donePal) {
if (_isPal && !_noPalChange && !onlyDiffData && !_donePal) {
_vm->_graphics->setPalette(_diffPalette, 256);
_isPal = false;
}
@ -147,7 +146,7 @@ void Anim::diffNextFrame() {
case 10L:
_rawDiffBM._planes[_curBit] = _diffFile;
if (_isBM)
if (onlyDiffData)
_diffFile += _size;
else {
readBlock(DrawBitMap->_planes[_curBit], _size, &_diffFile);
@ -246,7 +245,7 @@ void Anim::diffNextFrame() {
/**
* A separate task launched by readDiff. Plays the DIFF.
*/
void Anim::playDiff(byte *buffer) {
void Anim::playDiff(byte *buffer, bool onlyDiffData) {
_waitSec = 0L;
_waitMicros = 0L;
_delayMicros = 0L;
@ -325,9 +324,9 @@ void Anim::playDiff(byte *buffer) {
if (_playOnce) {
while (_header != 65535)
diffNextFrame();
diffNextFrame(onlyDiffData);
} else
diffNextFrame();
diffNextFrame(onlyDiffData);
}
/**
@ -354,9 +353,9 @@ void Anim::stopDiffEnd() {
/**
* Reads in a DIFF file.
*/
bool Anim::readDiff(byte *buffer, bool playOnce) {
bool Anim::readDiff(byte *buffer, bool playOnce, bool onlyDiffData) {
_playOnce = playOnce;
playDiff(buffer);
playDiff(buffer, onlyDiffData);
return true;
}

View file

@ -86,21 +86,20 @@ private:
BitMap *DrawBitMap;
void readBlock(void *Buffer, uint32 Size, byte **File);
void playDiff(byte *buffer);
void playDiff(byte *buffer, bool onlyDiffData = false);
public:
Anim(LabEngine *vm);
DIFFHeader _headerdata;
char _diffPalette[256 * 3];
bool _isBM; /* Just fill in the RawDIFFBM structure */
bool _waitForEffect; /* Wait for each sound effect to finish before continuing. */
bool _doBlack; /* Black the screen before new picture */
bool _noPalChange; /* Don't change the palette. */
BitMap _rawDiffBM;
bool readDiff(byte *buffer, bool playOnce);
void diffNextFrame();
bool readDiff(byte *buffer, bool playOnce, bool onlyDiffData = false);
void diffNextFrame(bool onlyDiffData = false);
void stopDiff();
void stopDiffEnd();
};

View file

@ -77,7 +77,7 @@ void DisplayMan::loadPict(const char *filename) {
/**
* Reads in a picture into the dest bitmap.
*/
void DisplayMan::readPict(const char *filename, bool playOnce) {
void DisplayMan::readPict(const char *filename, bool playOnce, bool onlyDiffData) {
_vm->_anim->stopDiff();
loadPict(filename);
@ -91,7 +91,7 @@ void DisplayMan::readPict(const char *filename, bool playOnce) {
_dispBitMap._rows = _screenHeight;
_dispBitMap._flags = BITMAPF_VIDEO;
_vm->_anim->readDiff(_curBitmap, playOnce);
_vm->_anim->readDiff(_curBitmap, playOnce, onlyDiffData);
}
/**

View file

@ -75,7 +75,7 @@ public:
virtual ~DisplayMan();
void loadPict(const char *filename);
void readPict(const char *filename, bool playOnce);
void readPict(const char *filename, bool playOnce, bool onlyDiffData = false);
void freePict();
byte *readPictToMem(const char *filename, uint16 x, uint16 y);
void doScrollBlack();

View file

@ -147,10 +147,8 @@ void DisplayMan::doScrollWipe(char *filename) {
_vm->waitTOF();
}
_vm->_anim->_isBM = true;
readPict(filename, true);
readPict(filename, true, true);
setPalette(_vm->_anim->_diffPalette, 256);
_vm->_anim->_isBM = false;
byte *mem = _vm->_anim->_rawDiffBM._planes[0];
_vm->_music->updateMusic();