diff options
| author | Filippos Karapetis | 2008-12-16 09:56:21 +0000 | 
|---|---|---|
| committer | Filippos Karapetis | 2008-12-16 09:56:21 +0000 | 
| commit | 0b1d31383b6b7978903e4c8c40de010506709937 (patch) | |
| tree | 41e1e25060203b9af06b8af62465a2e99a623328 | |
| parent | 638a8e330666e99f0f0887eebab8b50f61624fd4 (diff) | |
| download | scummvm-rg350-0b1d31383b6b7978903e4c8c40de010506709937.tar.gz scummvm-rg350-0b1d31383b6b7978903e4c8c40de010506709937.tar.bz2 scummvm-rg350-0b1d31383b6b7978903e4c8c40de010506709937.zip  | |
- Added some comments
- Removed _paletteDidChange, as the virtual setPalette() function is called back on every palette change
- Some cleanup
- Removed unused/unneeded functions and variables
- Changed _frameTypes to hold bytes instead of 32-bit integers (since frame types are held within a byte)
svn-id: r35391
| -rw-r--r-- | engines/scumm/he/animation_he.cpp | 2 | ||||
| -rw-r--r-- | graphics/smk_player.cpp | 20 | ||||
| -rw-r--r-- | graphics/smk_player.h | 14 | 
3 files changed, 17 insertions, 19 deletions
diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index 3691f7cae1..666660a573 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -92,7 +92,7 @@ void MoviePlayer::handleNextFrame() {  		_vm->markRectAsDirty(kMainVirtScreen, 0, 0, getWidth(), getHeight());  	} -	if (getCurFrame() == _framesCount) { +	if (getCurFrame() == getFrameCount()) {  		closeFile();  	}  } diff --git a/graphics/smk_player.cpp b/graphics/smk_player.cpp index 33fc715317..ccecea7b07 100644 --- a/graphics/smk_player.cpp +++ b/graphics/smk_player.cpp @@ -138,7 +138,7 @@ private:  int SmallHuffmanTree::decodeTree(int length) {  	if (!_bs.getBit()) { // Leaf -		uint16 v = _bs.getBits8();	// was uint32 +		uint16 v = _bs.getBits8();  		_tree.push_back(v);  		return 1; @@ -340,7 +340,7 @@ int32 SMKPlayer::getCurFrame() {  int32 SMKPlayer::getFrameCount() {  	if (!_fileStream)  		return 0; -	return _framesCount; +	return _header.frames;  }  int32 SMKPlayer::getFrameRate() { @@ -372,7 +372,6 @@ bool SMKPlayer::loadFile(const char *fileName) {  	_header.width = _fileStream->readUint32LE();  	_header.height = _fileStream->readUint32LE();  	_header.frames = _fileStream->readUint32LE(); -	_framesCount = _header.frames;  	_header.frameRate = (int32)_fileStream->readUint32LE();  	_header.flags = _fileStream->readUint32LE(); @@ -395,7 +394,7 @@ bool SMKPlayer::loadFile(const char *fileName) {  	for (i = 0; i < _header.frames; ++i)  		_frameSizes[i] = _fileStream->readUint32LE(); -	_frameTypes = (uint32 *)malloc(_header.frames * sizeof(uint32)); +	_frameTypes = (byte *)malloc(_header.frames);  	for (i = 0; i < _header.frames; ++i)  		_frameTypes[i] = _fileStream->readByte(); @@ -455,10 +454,11 @@ bool SMKPlayer::decodeNextFrame() {  	uint32 startPos = _fileStream->pos(); -	_paletteDidChange = false; +	// Check if we got a frame with palette data, and +	// call back the virtual setPalette function to set +	// the current palette  	if (_frameTypes[_currentSMKFrame] & 1) {  		unpackPalette(); -		_paletteDidChange = true;  		setPalette(_palette);  	} @@ -511,7 +511,7 @@ bool SMKPlayer::decodeNextFrame() {  			while (run-- && block < blocks) {  				clr = _MClrTree->getCode(bs);  				map = _MMapTree->getCode(bs); -				out = getCurSMKImage() + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; +				out = _image + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4;  				hi = clr >> 8;  				lo = clr & 0xff;  				for (i = 0; i < 4; i++) { @@ -544,7 +544,7 @@ bool SMKPlayer::decodeNextFrame() {  			}  			while (run-- && block < blocks) { -				out = getCurSMKImage() + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; +				out = _image + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4;  				switch (mode) {  					case 0:  						for (i = 0; i < 4; ++i) { @@ -578,7 +578,7 @@ bool SMKPlayer::decodeNextFrame() {  					case 2:  						for(i = 0; i < 2; i++) {  							// We first get p2 and then p1 -							// Check thread "[PATCH] Smacker video decoder bug fix" +							// Check ffmpeg thread "[PATCH] Smacker video decoder bug fix"  							// http://article.gmane.org/gmane.comp.video.ffmpeg.devel/78768  							p2 = _FullTree->getCode(bs);  							p1 = _FullTree->getCode(bs); @@ -610,7 +610,7 @@ bool SMKPlayer::decodeNextFrame() {  			uint32 col;  			mode = type >> 8;  			while (run-- && block < blocks) { -				out = getCurSMKImage() + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; +				out = _image + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4;  				col = mode * 0x01010101;  				for (i = 0; i < 4 * doubleY; ++i) {  					out[0] = out[1] = out[2] = out[3] = col; diff --git a/graphics/smk_player.h b/graphics/smk_player.h index a3b7625711..796789949e 100644 --- a/graphics/smk_player.h +++ b/graphics/smk_player.h @@ -110,12 +110,6 @@ protected:  	 */  	bool decodeNextFrame(); -	byte *getCurSMKImage() { return _image; } -	bool paletteDidChange() { return _paletteDidChange; } -	byte *palette() { return _palette; } - -	uint16 _framesCount; -  	Common::SeekableReadStream *_fileStream;  private: @@ -141,7 +135,12 @@ private:  	} _header;  	uint32 *_frameSizes; -	uint32 *_frameTypes; +	// The FrameTypes section of a Smacker file contains an array of bytes, where +	// the 8 bits of each byte describe the contents of the corresponding frame. +	// The highest 7 bits correspond to audio frames (bit 7 is track 6, bit 6 track 5 +	// and so on), so there can be up to 7 different audio tracks. When the lowest bit +	// (bit 0) is set, it denotes a frame that contains a palette record +	byte *_frameTypes;  	BigHuffmanTree *_MMapTree;  	BigHuffmanTree *_MClrTree; @@ -151,7 +150,6 @@ private:  	byte *_frameData;  	byte *_image; -	bool _paletteDidChange;  	byte *_palette;  	// Possible runs of blocks  	uint getBlockRun(int index) { return (index <= 58) ? index + 1 : 128 << (index - 59); }  | 
