Last Update: 2010/11/01 22:33 +0900
At the next table.
Short name | bpp | compress | local pal color cnt |
suffix palette |
DM2 versions |
---|---|---|---|---|---|
C4 | 4 | Yes | 6 | Yes | (Almost) |
C4Overlay | 4 | Yes | 5 | Yes | (Almost) |
C4Sega (IMG3/IMG4) | 4 | Yes | 6 | No | Sega, PC Beta |
C4SegaOverlay (IMG7/IMG8) | 4 | Yes | 5 | No | Sega, PC Beta |
C4Towns (IMG2) | 4 | Yes | 0 | No | FM-Towns |
U4 | 4 | No | 0 | Yes | PC98 |
U4Towns (IMG6) | 4 | No | 0 | No | FM-Towns |
C8 | 8 | Yes | 0 | No | PC, Mac |
U8 | 8 | No | 0 | No | PC, Mac |
Accidentally I wanted to know it. Because I knew DM2GDED choiced wrong image encoder for recently supported platforms like FM-Towns version when I paste an image accidentally.
Version | Byte order | Supported image formats |
---|---|---|
Amiga | Big | C4 C4Overlay |
FM-Towns | Little | IMG2 (C4Towns) IMG6 (U4Towns) |
IBM PS/V | Little | C4 C4Overlay U4 |
Mac | Big | C4 C8 U8 |
Mac JP | Big | C4 C4Overlay |
PC | Little | C4 C8 U8 |
PC Beta | Little | IMG3 (C4Sega) IMG7 (C4SegaOverlay) |
PC-9801 | Little | C4 U4 |
PC-9821 | Little | ? |
Sega CD/Mega CD | Big | IMG4 (C4Sega) IMG8 (C4SegaOverlay) |
The list are taken from DM Encyclopaedia site: Dungeon Master II Game Versions - Dungeon Master Encyclopaedia
IMG1 … Big endian, used by early(Atari ST ver) DM1 versions.
IMG2 … Little endian, used by early DM1 versions.
IMG3 … Big endian, used by later(PC ver) DM1 versions. Has local palette 6
colors.
IMG4 … Little endian, used by later DM1 versions. Has local palette 6 colors.
IMG5 … Amiga specific, not used in graphics.dat.
IMG6 … Little endian, FM-Towns, is uncompressed 4bpp.
IMG7 … Little endian, used by DM2 version, is compressed 4bpp. Has local palette
5 colors.
IMG8 … Big endian, used by DM2 version, is compressed 4bpp. Has local palette 5
colors.
The following image records contain unknown compression tag in compressed body. The image format is IMG2. They are found in FM-Towns' graphics.dat.
09-41-01-09 #2142 X
09-41-01-0D #2143 X
09-41-01-11 #2144 X
09-55-01-09 #1788 X
09-55-01-0D #1789 X
09-55-01-11 #1790 X
Assumes: Little-endian.
Header occupies 7 bytes.
Sample of C structure representation.
typedef struct { __int16 width; __int16 height; __int8 color01; __int8 color23; __int8 color45; } C4Header; |
Width has 2 meanings. Image width and X-axis image offset.
Width is 10-bits unsigned integer. (0 to 1023)
Image offset x is 6-bits signed integer. (-32 to 31)
If Image offset x = -32, refer the "Word Value 0Ch" to obtain real image offset. In that case, Simply ignore image offset x and y in image.
If you want Image offset x is -32, set image's Image offset x = -32 and create "Word Value type 0Ch" with value 0xE000.
Height has 2 meanings also. Image height and Y-axis image offset.
Height is 10-bits unsigned integer. (0 to 1023)
Image offset y is 6-bits signed integer. (-32 to 31)
If Image offset y = -32, it means image format is either U4 or U8 (not C4).
If you want Image offset y is -32, set image's Image offset x = -32 and create "Word Value type 0Ch" with value 0x00E0.
Check IMG3/IMG4 format at File Formats - Data Files section in DM/CSB Encyclopaedia.
C4 format occupies 16 bytes for suffix palette. C4Sega has no suffix palette.
Non-Sega versions of DM2 have a logical palette set with 256 colors. Each color can be represented in 1 byte. Suffix palette select 16 colors from the logical palette set.
Here is a sample logical palette set representation.
Header occupies 8 bytes.
Sample representation of C8 header format for C.
typedef struct { __int16 width; __int16 height; __int8 imageOffsetX; __int8 imageOffsetY; __int8 compressionType; __int8 zero; } C8Header; |
C8 compression body consists from command sets.
C8 compression can be applied to generic data compression other than image compression.
Every projection command occupies 2 bytes. The format depends on Comression type field found in header part.
PC and Mac version shares same projection command format.
If Compression type is 2, format is:
If Compression type is 3, format is:
Negative offset is a positive unsigned integer.
TO-DO: Copy Length bytes from current write buffer offset decreased by Negative offset. Then advance the offset by Length.
Every projection command occupies 1 byte.
TO-DO: Write 1 pixel at current write buffer offset. Then advance the offset by 1.
C8 has no suffix palette. Each output pixel directs to the logical palette set.
Header occupies 10 bytes.
Sample C structure.
struct { __int16 width; __int16 height; __int8 bpp; __int8 zero; __int16 width2; __int16 height2; }; |
Each byte represents 2 pixels. The first pixel is at higher part. The second pixel is at lower part.
Each scanline is rounded to byte align. (e.g. if Width is 11, scanline pitch is (11 ÷ 2) → 5.5 bytes. 5.5 is rounded up to 6.)
Suffix occupies 16 bytes for palette.
Header occupies 10 bytes.
Sample C structure.
struct { __int16 width; __int16 height; __int8 bpp; __int8 zero; __int16 width2; __int16 height2; }; |
Each byte represents 1 pixel.
No suffix palette for U8 format.