C93: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
m (categorize, link BTC)
(grammar fixes, slight reformatting)
Line 1: Line 1:
C93 is a video format used in Interplay's game Cyberia. It is not seems that is has been used anywhere else (Cyberia 2 comes with a slightly modified version named [[M95]]). 93 is most likely refers to format creation year.
* Company: [[Interplay Entertainment]]


C93 operates in standard VGA 320x200x256 resolution and based on [[BTC]] encoding and simple block copying.
C93 is a video format used in the game Cyberia. It seems that is has not been used anywhere else (Cyberia 2 comes with a slightly modified version named [[M95]]). 93 most likely refers to the format creation year.
 
C93 operates in standard VGA 320x200x256 resolution and is based on [[BTC]] encoding and simple block copying.


== File structure ==
== File structure ==


File begins with a 512-entries blocks table:
Files begin with a 512-entries blocks table:


   word sector  - index of the frames block
   word sector  - index of the frames block
   byte length  - length of the block's data (in sectors)
   byte length  - length of the block data (in sectors)
   byte frames  - number of frames in the block
   byte frames  - number of frames in the block


Zero length field indicates end of the table. Sector means 2048-bytes chunk of data. Thus, block with sector index 1 starts at offset 2048, 2 - 4096, etc.
A zero length field indicates the end of the table. Sector means 2048-bytes chunk of data. Thus, a block with sector index 1 starts at offset 2048, 2 at 4096, etc.


Each block contains variable number of actual frames (usually 11) and starts with it's own index table, holding (dword) offsets of the particular frame, relative to the block base.
Each block contains a variable number of actual frames (usually 11) and starts with its own index table, holding (dword) offsets of the particular frame, relative to the block base.




Line 26: Line 28:
== Video compression ==
== Video compression ==


Video encoded as a pairs of adjacent 8x8 blocks. Each pair starts with a byte, describing block's (de)compression mode. Lower nybble used for the first (left) block, high - for the second (right) block. Compression modes, in hex:
Video is encoded as pairs of adjacent 8x8 blocks. Each pair starts with a byte describing the block's (de)compression mode. The lower nibble is used for the first (left) block, the higher for the second (right) block. Compression modes, in hex:


* 2
* 2
Read two bytes of the offset. Copy 8x8 block at that offset from the previous frame.
Read two bytes at the offset. Copy 8x8 block at that offset from the previous frame.


* 6
* 6
Same as method 2, but split 8x8 block on to four 4x4 block and copy each one independingly. Left to right, top to bottom.
Same as method 2, but split 8x8 blocks into four 4x4 blocks and copy each one independently, left to right, top to bottom.


* 7
* 7
Line 38: Line 40:


* 8
* 8
Here comes BTC encoding. Read one byte for color0 and next one for color1. Now, for each row of pixels, read mask byte and paint pixels either with color1 if it's bit (starting from the 0) is set or color0 if it's not.
Here comes BTC encoding. Read one byte for color0 and next one for color1. Now, for each row of pixels, read mask byte and paint pixels either with color1 if its bit (starting from the 0) is set or color0 if it's not set.


* A
* A
Exactly as 8, but for four 4x4 blocks, each with it's own pair of color0/color1 and mask.
Exactly as 8, but for four 4x4 blocks, each with its own pair of color0/color1 and mask.


* B
* B
This one similar to A, with small enhancement. For each 4x4 block read 4 color bytes. Paint pixels using following colors combinations:
This one is similar to A, with a small enhancement. For each 4x4 block read 4 color bytes. Paint pixels using following color combinations:
  01 01 02 02
  01 01 02 02
  01 01 02 02
  01 01 02 02
Line 54: Line 56:


* E
* E
Draw nothing
Draw nothing.


* F
* F
Just read 8*8 bytes from the stream and use them to draw whole block.
Just read 8*8 bytes from the stream and use them to draw the whole block.


[[Category:Game Formats]]
[[Category:Game Formats]]

Revision as of 02:06, 11 July 2006

C93 is a video format used in the game Cyberia. It seems that is has not been used anywhere else (Cyberia 2 comes with a slightly modified version named M95). 93 most likely refers to the format creation year.

C93 operates in standard VGA 320x200x256 resolution and is based on BTC encoding and simple block copying.

File structure

Files begin with a 512-entries blocks table:

 word sector  - index of the frames block
 byte length  - length of the block data (in sectors)
 byte frames  - number of frames in the block

A zero length field indicates the end of the table. Sector means 2048-bytes chunk of data. Thus, a block with sector index 1 starts at offset 2048, 2 at 4096, etc.

Each block contains a variable number of actual frames (usually 11) and starts with its own index table, holding (dword) offsets of the particular frame, relative to the block base.


Frame structure:

 word video_size        - size of the following video data
 byte video[video_size] - compressed frame
 word palette_size      - size of the following palette
 byte palette[256 * 3]  - 256 BGR triplets of the palette
 word sound_size        - size of the following sound chunk
 byte sound[sound_size] - sound data, stored as a complete VOC file

Video compression

Video is encoded as pairs of adjacent 8x8 blocks. Each pair starts with a byte describing the block's (de)compression mode. The lower nibble is used for the first (left) block, the higher for the second (right) block. Compression modes, in hex:

  • 2

Read two bytes at the offset. Copy 8x8 block at that offset from the previous frame.

  • 6

Same as method 2, but split 8x8 blocks into four 4x4 blocks and copy each one independently, left to right, top to bottom.

  • 7

Similar to method 6, but copy blocks from the current frame.

  • 8

Here comes BTC encoding. Read one byte for color0 and next one for color1. Now, for each row of pixels, read mask byte and paint pixels either with color1 if its bit (starting from the 0) is set or color0 if it's not set.

  • A

Exactly as 8, but for four 4x4 blocks, each with its own pair of color0/color1 and mask.

  • B

This one is similar to A, with a small enhancement. For each 4x4 block read 4 color bytes. Paint pixels using following color combinations:

01 01 02 02
01 01 02 02
31 31 32 32
31 31 32 32
  • D

Again, work with four 4x4 blocks. Read 4 colors from the stream. Now, for every pixel of the block, read 2 bits from the stream and use it as the index of the color you just read before.

  • E

Draw nothing.

  • F

Just read 8*8 bytes from the stream and use them to draw the whole block.