aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2020-04-15 15:33:50 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2020-04-15 15:33:50 +0200
commit771e522a17b7724a698191ba6f6fe59054161125 (patch)
tree04d021bc6434fdadd913bbf440a08b7c4040f58e
parented6c9f8a7b4c723b02361bf75fdccdc40eb427cc (diff)
downloadnihav-771e522a17b7724a698191ba6f6fe59054161125.tar.gz
vmd: fix RLE decoding
-rw-r--r--nihav-game/src/codecs/vmd.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/nihav-game/src/codecs/vmd.rs b/nihav-game/src/codecs/vmd.rs
index b81b4f5..520b57c 100644
--- a/nihav-game/src/codecs/vmd.rs
+++ b/nihav-game/src/codecs/vmd.rs
@@ -85,9 +85,11 @@ fn rle_unpack(br: &mut ByteReader, len: usize, dst: &mut [u8]) -> DecoderResult<
let dst = &mut dst[dpos..][..len];
br.read_buf(dst)?;
} else {
- let val = br.read_byte()?;
- for i in 0..len {
- dst[dpos + i] = val;
+ let val1 = br.read_byte()?;
+ let val2 = br.read_byte()?;
+ for i in (0..len).step_by(2) {
+ dst[dpos + i] = val1;
+ dst[dpos + i + 1] = val2;
}
}
dpos += len;