Contents

Technical Documentation - File Formats - LAY1 items (Item 696, DMCOORD.DAT, DMII type 4 entries)

Overview

This page describes the structure of LAY1 items. These items describe the layout of graphics on screen and they are found in:

  • The DMCOORD.DAT file from Dungeon Master II for PC version 0.9 Beta
  • Entries of type 4 as specified in ENT1 item in graphics.dat file (see Technical Documentation - File Formats - Data Files) from all other versions of Dungeon Master II
  • Item 696 in the graphics.dat files from all versions 3.x of the game engine:
    • Dungeon Master for Amiga version 3.6 (English, French, German)
    • Dungeon Master for PC versions 3.4 (English) and 3.4 (English, French, German)
    • Chaos Strikes Back for Amiga versions 3.1 (English), 3.1 (English, French, German), 3.3 (English, French, German) and 3.5 (English).
    • Chaos Strikes Back for FM-Towns versions 3.1 (English) and 3.1 (Japanese)
    • Chaos Strikes Back for PC-9801 version 3.1 (Japanese)
    • Chaos Strikes Back for X68000 version 3.1 (Japanese)

    This item is not found in any other version of the games.

There are 6 variations in the content of this item with 3 possible sizes:

  • Dungeon Master for Amiga version 3.6 (English, French, German), Chaos Strikes Back for Amiga versions 3.1 (English) and 3.1 (English, French, German). (9176 bytes)
  • Chaos Strikes Back for Amiga versions 3.3 (English, French, German) and 3.5 (English). (9160 bytes)
  • Dungeon Master for PC versions 3.4 (English), 3.4 (English, French, German) and Chaos Strikes Back for FM-Towns version 3.1 (English). (9160 bytes)
  • Chaos Strikes Back for PC-9801 version 3.1 (Japanese) and Chaos Strikes Back for FM-Towns version 3.1 (Japanese). (9160 bytes)
  • Chaos Strikes Back for X68000 version 3.1 (Japanese). (9160 bytes)
  • Dungeon Master II for PC version 0.9 Beta DMCOORD.DAT. (18480 bytes)

The data entirely consists of signed words. Depending on the platform, the words are stored as little endian (PC, PC-9801 or FM-Towns) or big endian (like Amiga or X68000).
If you compare items 696 between a big endian version and a little endian version , they are always nearly identical if you swap bytes in each word of little endian data. There are only very few differing bytes. The 9176 bytes large version has 16 bytes added somewhere in the middle of the item, but all other parts remain very similar with other variants.

The data represents hierachical storage of screen coordinates and area dimensions that are used to position things on screen. Each record in the file refers to a parent record so that they define lists of records. Some records contain coordinates relative to the position of their parent area. In order to get the absolute coordinates, the full list of linked records must be processed.
Some record lists define the screen coordinates for buttons (screen areas that will trigger an event when clicked on) but the buttons themselves are defined elsewhere (in file FIRES in the case of Dungeon Master for PC) and refer to indices in item 696 for coordinates. Please check the Excel spreadsheet available on Technical Documentation - File Formats - Dungeon File (DUNGEON.DAT) for button declarations.

Detailed structure

Offset 0: A word: File signature 0xFC0D
Offset 2: A word: Number of index ranges (23 ranges in item 696, 29 ranges in DMCOORD.DAT)
Offset 4: Ranges. Each range has the following structure:

  • Word: First index
  • Word: Last index

In each range, First index < Last index. The [First index..Last index] intervals never overlap. The sum of all (Last index - First index + 1) is the number of 8 bytes records found in the rest of the file.
Offset X (X = 4 + 4 x number of index ranges): A series of 8 bytes records until the end of the item.
Each record has the following structure:

  • Word: Record type. Values found in item 696:
    • 0: Center at coordinates (Data words are X and Y coordinates)
    • 1: Align top left at coordinates (Data words are X and Y coordinates)
    • 2: Align top right at coordinates (Data words are X and Y coordinates)
    • 3: Align bottom right at coordinates (Data words are X and Y coordinates)
    • 4: Align bottom left at coordinates (Data words are X and Y coordinates)
    • 5: Align top and center horizontally at coordinates (Data words are X and Y coordinates)
    • 6: Align right and center vertically at coordinates (Data words are X and Y coordinates)
    • 7: Align bottom and center horizontally at coordinates (Data words are X and Y coordinates)
    • 8: Align left and center vertically at coordinates (Data words are X and Y coordinates)
    • 9: Dimensions Width x Height (Data words are width and height). Only type that never starts a list.
    • 10: Unknown
    • 11: Unknown
    • 12: Unknown
    • 14: Unknown
    • 15: Apply margins from top left, align top and center horizontally in container box (Data words are margin values from top left corner of container box)
    • 17: Unknown
    • 18: Apply margins from top left, align left and center vertically in container box (Data words are margin values from top left corner of container box)
  • Word: Index of parent record. 0 means no parent (end of list of records)
  • Word: Data word whose meaning depends on the type of record (see above).
  • Word: Data word whose meaning depends on the type of record (see above).

Dungeon Master for PC

Technical_Documentation~Dungeon_Master~PC~Item_696_Description~Document.7z Technical_Documentation~Dungeon_Master~PC~Item_696_Description~Document.7z
This archive contains an Excel spreadsheet detailing the contents of item 696 found in the graphics.dat file from Dungeon Master for PC.
[Supplied by Jean-Claude]

Hypothesis

Note: the text below was written before understanding the content of some data records.
I believe the data contains coordinates to display things on screen for the following reasons:

  • Item 696 is only found in versions 3.x of the games. In these versions, the dungeon viewport is drawn differently than in previous versions: the perspective is different and the wall graphics are stored differently in the graphics.dat file. Item 696 may replace parts of item 558 that was present in older versions and not found in versions 3.x (although please note that some versions do not have item 558 nor item 696, like Dungeon Master for Apple IIGS, Dungeon Master for FM-Towns, Dungeon Master for PC-9801, or all versions of Dungeon Master for Amiga except 2.0 English and 3.6)
  • The DMCOORD.DAT file name suggests storage of coordinates
  • Some data values look like coordinates or sizes: the first two 8 bytes records contain values 320 & 200 and 224 & 136 which are respectively the size of the screen and the size of the viewport (as well as the dimensions of some images).