aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKari Salminen2008-06-10 20:57:22 +0000
committerKari Salminen2008-06-10 20:57:22 +0000
commitfdf3f36bc6e22d1934e97852c7709ff39867ba5f (patch)
treee2a9c8dbe4a03bca720bd23cab0916ae97b5e09f
parente03bd801d6606b17b792356aece75cf5d2d3eb8c (diff)
downloadscummvm-rg350-fdf3f36bc6e22d1934e97852c7709ff39867ba5f.tar.gz
scummvm-rg350-fdf3f36bc6e22d1934e97852c7709ff39867ba5f.tar.bz2
scummvm-rg350-fdf3f36bc6e22d1934e97852c7709ff39867ba5f.zip
Properly renamed some of the functions in the Delphine unpacker after understanding what they really do.
svn-id: r32649
-rw-r--r--engines/cine/unpack.cpp28
-rw-r--r--engines/cine/unpack.h8
2 files changed, 17 insertions, 19 deletions
diff --git a/engines/cine/unpack.cpp b/engines/cine/unpack.cpp
index ef761e87f1..85841631af 100644
--- a/engines/cine/unpack.cpp
+++ b/engines/cine/unpack.cpp
@@ -45,7 +45,7 @@ int CineUnpacker::rcr(int CF) {
return rCF;
}
-int CineUnpacker::nextChunk() {
+int CineUnpacker::nextBit() {
int CF = rcr(0);
if (_chk == 0) {
_chk = readSource();
@@ -55,28 +55,26 @@ int CineUnpacker::nextChunk() {
return CF;
}
-uint16 CineUnpacker::getCode(byte numChunks) {
+uint16 CineUnpacker::getBits(byte numBits) {
uint16 c = 0;
- while (numChunks--) {
+ while (numBits--) {
c <<= 1;
- if (nextChunk()) {
- c |= 1;
- }
+ c |= nextBit();
}
return c;
}
-void CineUnpacker::unpackHelper1(byte numChunks, byte addCount) {
- uint16 count = getCode(numChunks) + addCount + 1;
+void CineUnpacker::unpackHelper1(byte numBits, byte addCount) {
+ uint16 count = getBits(numBits) + addCount + 1;
_datasize -= count;
while (count--) {
- *_dst = (byte)getCode(8);
+ *_dst = (byte)getBits(8);
--_dst;
}
}
-void CineUnpacker::unpackHelper2(byte numChunks) {
- uint16 i = getCode(numChunks);
+void CineUnpacker::unpackHelper2(byte numBits) {
+ uint16 i = getBits(numBits);
uint16 count = _size + 1;
_datasize -= count;
while (count--) {
@@ -94,22 +92,22 @@ bool CineUnpacker::unpack(byte *dst, const byte *src, int srcLen) {
_chk = readSource();
_crc ^= _chk;
do {
- if (!nextChunk()) {
+ if (!nextBit()) {
_size = 1;
- if (!nextChunk()) {
+ if (!nextBit()) {
unpackHelper1(3, 0);
} else {
unpackHelper2(8);
}
} else {
- uint16 c = getCode(2);
+ uint16 c = getBits(2);
if (c == 3) {
unpackHelper1(8, 8);
} else if (c < 2) {
_size = c + 2;
unpackHelper2(c + 9);
} else {
- _size = getCode(8);
+ _size = getBits(8);
unpackHelper2(12);
}
}
diff --git a/engines/cine/unpack.h b/engines/cine/unpack.h
index 9433fafa58..bd658e51e6 100644
--- a/engines/cine/unpack.h
+++ b/engines/cine/unpack.h
@@ -39,10 +39,10 @@ private:
/** Reads a single big endian 32-bit integer from the source and goes backwards 4 bytes. */
uint32 readSource();
int rcr(int CF);
- int nextChunk();
- uint16 getCode(byte numChunks);
- void unpackHelper1(byte numChunks, byte addCount);
- void unpackHelper2(byte numChunks);
+ int nextBit();
+ uint16 getBits(byte numBits);
+ void unpackHelper1(byte numBits, byte addCount);
+ void unpackHelper2(byte numBits);
private:
int _size, _datasize;
uint32 _crc;