-
-
Notifications
You must be signed in to change notification settings - Fork 4
DM2 File Formats
Dungeon Master II (DOS). All multi-byte values are little-endian unless noted otherwise.
| Field | Value |
|---|---|
| Size | ~8.6 MB |
| Format | GDAT typed record graph |
| Categories | 240 (vs DM1's 29) |
| Category limit | 0xF0 |
DM2's GRAPHICS.DAT is NOT a flat sprite sheet. It is a structured GDAT archive containing all graphics, sound, music, text, and interface data in a typed record graph.
Each entry consists of 6 classification bytes plus a 2-byte data index:
Offset Size Description
0x00 6 cls1-cls6 (classification bytes)
0x06 2 data_index (uint16)
| Type | ID | Description |
|---|---|---|
| IMAGE | 0x01 | Bitmap image |
| SOUND | 0x02 | Sound effect |
| HMP | 0x03 | HMP music |
| RAW4 | 0x04 | Raw type 4 |
| TEXT | 0x05 | Text string |
| RAW6 | 0x06 | Raw type 6 |
| RAW7 | 0x07 | Raw type 7 |
| RAW8 | 0x08 | Raw type 8 |
| PAL_IRGB | 0x09 | IRGB palette |
| WORD_VALUE | 0x0B | 16-bit value |
| IMAGE_OFFSET | 0x0C | Image offset reference |
| PAL_16 | 0x0D | 16-color palette |
| ID | Name | Description |
|---|---|---|
| 0x00 | TECHDATA | Technical/system data |
| 0x01 | INTERFACE_GENERAL | General UI elements |
| 0x02 | SPELL_DEF | Spell definitions |
| 0x03 | MESSAGES | Game messages/text |
| 0x04 | MUSICS | Music tracks (HMP) |
| 0x05 | TITLE | Title screen |
| 0x06 | CREDITS | Credits screen |
| 0x07 | INTERFACE_CHARSHEET | Character sheet UI |
| 0x08 | GRAPHICSSET | Graphics set definitions |
| 0x09 | WALL_GFX | Wall textures |
| 0x0A | FLOOR_GFX | Floor textures |
| 0x0B | DOOR_GFX | Door textures |
| 0x0F | CREATURES | Creature sprites (64 types) |
| 0x10 | WEAPONS | Weapon sprites |
| 0x17 | ENVIRONMENT | Outdoor assets |
| 0x1C | JAPANESE_FONT | Japanese font data |
| Field | Value |
|---|---|
| Type ID | 3 |
| BPP | 4 |
| Encoding | Nibble run-length encoding |
Used for simple textures. Reads nibbles and durations via read_nibble
and read_duration functions. Has underlay and overlay variants for
doors and panels.
| Field | Value |
|---|---|
| Type ID | 9 |
| BPP | 9 |
Used for complex wall textures requiring more color depth.
| Field | Value |
|---|---|
| Type ID | 4 |
| BPP | 4 |
Uncompressed 4-bit source, returned as 8-bit indexed pixels.
| Field | Value |
|---|---|
| Type ID | 8 |
| BPP | 8 |
Uncompressed 8-bit palette index data.
| Field | Type | Description |
|---|---|---|
| Width | uint16 | Image width |
| Height | uint16 | Image height |
| Bits per pixel | uint8 | Color depth |
| Query offset X | int16 | X draw offset |
| Query offset Y | int16 | Y draw offset |
| Graphicsset offset | flag | Uses graphics set offset |
| Image offset | flag | Uses image offset reference |
The palette chain flows through multiple stages:
dtPalIRGB → dtPalette16 → material/interface palette → framebuffer
- Main palette: 256 colors, VGA 6-bit RGB components (>>2 step)
- 16-color logical index table for per-texture palette selection
- Each map selects a graphics set; wall textures decoded for one set cannot be reused for another
- Day/night palette variants with runtime switching for outdoor levels
| Mode | Resolution | Use |
|---|---|---|
| Standard | 320x200 | Indoor dungeon levels |
| Extended | 640x400 | Outdoor levels |
| Field | Value |
|---|---|
| Size | ~39 KB |
DM2's dungeon format extends DM1 with outdoor area support and room
structures. Loaded through dm2_v1_boot_enter_game() after hash
verification.
- Room descriptors (referenced via room helper functions)
- Outdoor area support
- Extended thing types for DM2-specific objects
HMP music is stored as original GDAT payload within GRAPHICS.DAT (GDAT type 0x03), not as a separate host-side file. The music system processes HMP data directly from the GDAT record graph.
GRAPHICS.DAT identity is verified by content hash (low 32 bits of MD5). DUNGEON.DAT is loaded only after hash verification.