Technical Documentation - Graphics.dat Item 559

Overview

This page describes the content of item 559 found in the graphics.dat file from:

  • Dungeon Master for Atari ST versions 1.0 English (1987-12-08), 1.0 English (1987-12-11), 1.1 English, 1.2 English, 1.2 German and 1.3 French.
  • Chaos Strikes Back for Atari ST versions 2.0 English and 2.1 English.
  • Dungeon Master for Amiga version 2.0 English.

This item is not found in any other version of the games (even in other Dungeon Master for Amiga 2.x versions).
The size of this item is always 3086 bytes but there are three variations in the content of this item:

  • Dungeon Master for Atari ST versions 1.0 English (1987-12-08) and 1.0 English (1987-12-11).
  • Dungeon Master for Atari ST versions 1.1 English, 1.2 English and 1.2 German.
  • Dungeon Master for Atari ST version 1.3 French, Chaos Strikes Back for Atari ST versions 2.0 English and 2.1 English, Dungeon Master for Amiga version 2.0 English.

The whole item is described except a few parts of the creature descriptors that are not understood yet.

Credits

Meynaf (Detailed notes)
Paul Stevens (CSBwin source code)
rain` (ADGE source code)
Adamo
Pierre Monnot

Detailed structure

000h (0000) 4 bytes, Creature facing bytes

(byte10340 in CSBwin)
In each byte, there are two bits for each creature.
Values: 00 55 AA FF
0000,1111,2222,3333 coded on two bits

004h (0004) 256 bytes, Extended strings for escape character 1Eh in dungeon.dat texts for wall texts only

(byte10336 in CSBwin)
Structure: 32x8 bytes
This section is a table of zero terminated strings of 8 bytes (7 characters maximum plus a 00h byte terminating the string).
These extended strings are used in wall texts only. These strings are not encoded in ASCII but rather use the encoding used by strings in dungeon.dat.
When character 1Eh is found in a dungeon.dat wall text, the next character identifies the string to display in this table.
Values:

  • '0' and '1': Empty strings
  • '2': 'THE '
  • '3': 'YOU '
  • '4' to '1F': Empty strings

104h (260) 64 bytes, Extended strings for escape character 1Dh in dungeon.dat

(byte10080 in CSBwin)
Structure: 32x2 bytes
This section is a table of zero terminated strings of 2 bytes (1 character maximum plus a 00h byte terminating the string. This is because these strings are copied using strcpy.).
These extended strings can be used in all texts. These strings are encoded in ASCII.
When character 1Dh is found in a dungeon.dat text, the next character identifies the string to display in this table.
Values: First symbol is missing, digits 8-9 cannot be done...

144h (324) 256 bytes, Extended strings for escape character 1Eh in dungeon.dat texts other than wall texts

(byte10016 in CSBwin)
Structure: 32x8 bytes
This section is a table of zero terminated strings of 8 bytes (7 characters maximum plus a 00h byte terminating the string).
These extended strings are used in all texts except wall texts. These strings are encoded in ASCII.
When character 1Eh is found in a dungeon.dat text other than a wall text, the next character identifies the string to display in this table.
Values:

  • '0': '?'
  • '1': '!'
  • '2': 'THE'
  • '3': 'YOU'
  • '4' to '1F': Empty strings

244h (580) 8 bytes, Door characteristics

Structure: 4x2 bytes
(Copied in DoorTOC in CSBwin)
There are two bytes for each type of door:

  • Byte 0
    • Bits 7-3: Unused
    • Bit 2: Animated (the graphic is periodically reversed)
    • Bit 1: Thrown items can pass through door
    • Bit 0: Creatures can see the party through the door
  • Byte 1: Resistance to destruction
    Values:
    • Grate door: Not animated, items can pass through, creatures can see through, Resistance = 6E
    • Wooden door: Not animated, items cannot pass through, creatures cannot see through, Resistance = 2A
    • Iron door: Not animated, items cannot pass through, creatures cannot see through, Resistance = E6
    • Ra door: Animated, items cannot pass through, creatures can see through, Resistance = FF

24Ch (588) 80 bytes, Creature droppings

Structure: 40 words
These words define which items are created when a creature is killed. This is separate from the explicit possessions creatures may have (defined in dungeon.dat or items stolen or absorbed while fighting).
There is a list of words for each creature that drops items, the end of the list is marked by a 0000h word. The start of each of the lists is hard coded in the program.
The format of each word is:

  • Bit 15: If '1' then the item has a 50% probability of being dropped. If '0' it is always dropped.
  • Bits 14-8: Unused
  • Bits 7-0: Item number. 23-68: Weapon (item number), 69-126: Clothe (item number + 69), 127-255: Miscellaneous (item number + 127)

Here are the hard coded indices:

  • 0: Dragon
  • 11: Worm
  • 15: Screamer
  • 18: Hell Hound (Rat)
  • 21: Rock Pile
  • 26: Deth Knight (The 'Cursed' is set by the code).
  • 33: Ant Man
  • 35: Stone Golem
  • 37: Skeleton

29Ch (668) 8 bytes, Creature attack sound numbers

(ubyte9672 in CSBwin)
This table contains the indices of the 8 creature attack sounds among the sounds table found in item 562, which in turn contains the corresponding sound item numbers in the graphics.dat.
Values: 3 7 14 15 19 21 4 16

2A4h (676) 702 bytes, Creature descriptors

Structure: 27x26 bytes

  • 00h (00) 1 byte: Creature graphic number (identical to the creature number)
  • 01h (01) 1 byte: Attack sound. If this value is 0, the creature does not have an attack sound. If the value is not 0, value - 1 is used as an index in the 'Creature attack sound numbers' table above.
    Values:
    • 0: No sound
    • 1: Dragon, Rat
    • 2: Ghost, Mummy
    • 3: Screamer, Oitu
    • 4: Scorpion
    • 5: Worm
    • 6: Giggler
    • 7: Hit 1 (like a falling item)
    • 8: Hit 2 (like champions)
  • 02h (02) 1 word (big endian): Flags 1
    • Bits 15-14 Unused, always 0
    • Bit 13: When this bit is set, the creature never takes any damage (health is not decreased), it can teleport up to two tiles away and it cannot move to a tile containing a Fluxcage.
    • Bit 12: Can see in darkness (ignores the view distance reduction because of a low light level)
    • Bit 11: Can see invisible champions (ignores the invisibility spell)
    • Bit 10: Absorbs items thrown at the creature (like the Mummy). The list of items that can be absorbed is hard coded in the program (Arrows, Slayers, Darts, Stars and Daggers). If a thrown item is not absorbed by the creature, it falls on the floor (it is never destroyed).
    • Bit 9: Drops items when killed. If this bit is set to '1', the creature droppings list is used.
    • Bit 8-7: Height (Short 1/4 and Short 1/2). Missiles can fly over smaller creatures. This value is also used to define how to animate a door that is closed upon the creature:
      • '0': the door is not animated.
      • '1': the door is animated from the top to 1/4th of its size.
      • '2': the door is animated between 1/4th of its size to half of its size.
      • '3': the door is animated from half of its size to 3/4th of its size.
    • Bit 6: Non material creature. These creatures ignore normal attacks but take damage from the Vorpal Blade. Fire damage is also reduced by a half. All missiles except 'Dispell' pass through these creatures (this is hard coded). These creatures can pass through all doors of any type.
    • Bit 5: [*] Levitates. The creature will not fall through pits.
    • Bit 4: [*] Attack Every Position
      The creature can attack all four champion positions.
      If both 'Prefer back row' and 'Attack every position' flags are not set, the creature will move to the front row of its tile. In other cases the creature has a 25% chance of moving to the front row.
    • Bit 3: [*] Prefer back row. The creature will tend to stay in the back row while other creatures will step up to the front row when the party is near and they want to attack. (CSBwin comment: Tested when checking for 'Blocked').
    • Bit 2: Can attack from all sides. The creature can attack the party from the front, back and side positions. This flag is set only for creatures that have the same image for all sides. It affects their attack frequency because they don't need to turn to face the party and attack.
    • Bits 1-0: Size:
      • 0: Quarter of tile, 4 creatures per tile maximum (Example: Screamer)
      • 1: Half a tile, 2 creatures per tile maximum (Example: Worm)
      • 2: Full tile, 1 creature per tile maximum (Example: Dragon)
      • 3: Unused
  • 04h (04) 1 word (big endian): Flags 2
    • Bits 15-14: Defines the maximum vertical offset to display the creature graphics:
      • 0: No animation
      • 1: -1 to +1 pixels
      • 2: -2 to +2 pixels
      • 3: -3 to +3 pixels
    • Bits 13-12: Defines the maximum horizontal offset to display the creature graphics. This value should have probably been similar to the vertical offset, but there seems to be a mistake in the code that produces this effect (a random modulo n output a number between 0 and 0-1, not between 0 and n. See function NextMonsterUpdateTime in CSBwin and the call to STRandom):
      • 0: No animation
      • 1: No animation
      • 2: -1 to +1 pixels. In this case, the probabilities are:
        Chances of having -1: 1/4
        Chances of having 0: 2/4
        Chances of having +1: 1/4
      • 3: -2 to +2 pixels In this case, the probabilities are:
        Chances of having -2: 1/6
        Chances of having -1: 1/6
        Chances of having 0: 2/6
        Chances of having +1: 1/6
        Chances of having +2: 1/6

      For example, the Ruster should have been animated 1 pixel in both directions but it is not. No creature has a 3 pixels animation (as the Wasp should have).

    • Bit 11: Unused, always 0.
    • Bit 10: Mirror attack image during attack. When enabled the attack image is displayed both normally and then mirrored during a single attack. '0': Enabled, '1': Disabled.
    • Bit 9: Mirror attack image. When enabled, for each attack, the attack image is displayed either normally or mirrored. '0': Disabled, '1': Enabled
    • Bit 8-7: These two bits are used together in the code in a way that the effect of one bit is only applied if the other bit is also set:
      • '00', '01', '10': No effect.
      • '11': Can mirror and horizontally shift the front image of the creature when it is exactly 2 tiles away from the party (with 1 empty tile between the party and the creature). This only applies to the front image.
    • Bit 6: Unused, always 0.
    • Bit 5: The creature has an attack graphic.
    • Bit 4: The creature has a back graphic.
    • Bit 3: The creature has a side graphic. All the creatures that has bit 4 set also have bit 3 set, but it is not mandatory.
    • Bit 2: Mirror front image. When this bit is set, the creature front image is periodically mirrored horizontally for animation. This bit is also used in the code that manages creatures behavior.
    • Bit 1-0: Additional front image graphics (the other creature images are not affected by this value).
      • '0': No additional graphics generated.
      • '1': One set of two additional graphics is generated with a scaled down size (factor 16).
      • '2': Two sets of two additional graphics are generated with a scaled down size (factors 16 and 20). This value is not used for any creature.
      • '3': -
  • 06h (06) 1 Byte: Number of ticks per movement (Movement speed). FFh: does not move.
  • 07h (07) 1 Byte: [*] Attack speed. The minimum amount of time required between each attack.
  • 08h (08) 1 Byte: Armor. This is the resistance to damage including Dispell on non material creatures.
  • 09h (09) 1 Byte: Base health. This value is used to compute the health of a new creatures as detailed on Technical Documentation - Dungeon Master and Chaos Strikes Back Creature Generators.
  • 0Ah (10) 1 Byte: [*] Attack power. The base value for computing how much damage a creature's attack will inflict.
  • 0Bh (11) 1 Byte: [*] Poison. The amount of poison inflicted when the creature successfully hits a character.
  • 0Ch (12) 1 Byte: Defense (Hit probability). This value represents the difficulty for champions to hit the creature.
  • 0Dh (13) 1 Byte: Unused, always 0.
  • 0Eh (14) 1 word (big endian):
    • Bits 15-12: [*] Spell casting range. Maximum number of tiles between creature and party needed to perform a distance attack (cast a spell).
    • Bits 11-8: [*] Detection range (Awareness). Maximum number of tiles between creature and party needed to detect and "turn" towards the party, perhaps to shoot a projectile.
    • Bits 7-4: Unused. (X1, values 0 to 10)
    • Bits 3-0: Sight range. Maximum number of tiles between creature and party needed to see the party. This value is affected by the current light level in the dungeon (the value is halved for each level of darkness).
  • 10h (16) 1 word (big endian):
    • Bits 15-12: [*] Avoid suicide by teleportation (Teleport, Self preservation).
      If this value is greater then or equal to 10, then the creature will not step into a teleporter if its destination is on a level where that kind of creature is not allowed. If the value is less then 10, the creature may enter such a teleporter and would then be instantly killed upon arrival at the destination.
      Note: the developers probably designed something more complex with this value, but it is only used as a flag in the code (by comparing the value with 10).
    • Bits 11-8: Experience class of the creature (Skill). This value is used as a multiplier to computer the experience earned by champions when killing the creature.
    • Bits 7-4: Bravery. Resistance to War Cry, Calm, Brandish and Blow Horn. With a value of 15, the creature is never afraid.
    • Bits 3-0: Unused (X2)
  • 12h (18) 1 word (big endian):
    • Bits 15-12: Unused, always 0.
    • Bits 11-8: Poison resistance (Clouds and Bolts). Value 15 means the creature is immune.
    • Bits 7-4: Fire resistance (Magic resistance). Value 15 means the creature is immune. Does it apply only to fire or all magic?
    • Bits 3-0: Unused (X3)
  • 14h (20) 1 word (big endian):
    • Bits 15-12: Unused, always 0.
    • Bits 11-8: [*] Attack status speed. Used for creature graphics animation. Probability of left/right mirroring and slightly changing its screen position when the creature is attacking the party. Value 15 means there is no animation.
    • Bits 7-4: [*] Status speed. Used for creature graphics animation. Probability of left/right mirroring and slightly changing its screen position when the creature is in front of the party and not attacking. Value 15 means there is no animation.
    • Bits 3-0: [*] Attack length. The amount of time while the attack graphic is displayed.
  • 16h (22) 1 word (big endian): This word is used to define how the creature can wound champions.
    When a creature attacks a champion, there is a 75% chance that it can cause wounds to the champion. In this case, to determine the wounds caused by the attack, the engine generates a random number between 0 and 15. This value is compared to each of the four nibbles in this word starting from the least significant nibble until the number value is lesser than or equal to the nibble value. In order to prevent an infinite loop, the last nibble is always set to 15. The index of the nibble (0 to 3) is used to refer to a table in item 562 (ubyte590 in CSBwin) that contains masks defining which body parts are wounded.

    Define the probabilities that the creature will hit each part of the body.

    • Bits 15-12: Head
    • Bits 11-8: Torso
    • Bits 7-4: Legs
    • Bits 3-0: Feet

    No matter the value of the number, there is always a 1/8 probability that one hand or the other (random) is wounded.
    Example with the Worm that has this word defined to FFC5h. When hit by a Worm:
    The champion has 1/8 chance of being wounded to one hand and 7/8 chances of being wounded elsewhere.
    6/16 chances of being wounded to the feet (values 5 to 0)
    7/16 chances of being wounded to the legs (values 12 to 6)
    3/16 chances of being wounded to the torso (values 15 to 13)
    0/16 chances of being wounded to the head
    (Look in tag f6ee in CSBwin for the code)

  • 18h (24) 1 byte: Damage type (Attack type)
    • 00: No damage. This value is used elsewhere for damages when stamina is 0.
    • 01: Fire. The damage is modified by the champion's Anti-Fire attribute.
    • 02: Unused for creatures. This value is used elsewhere for example when bumping in a wall. The armor of the champion is halved when calculating damage. No creature use this in the game.
    • 03: Hit. Normal attack.
    • 04: Sharp (Piercing attack). Armor is then computed differently.
    • 05: Magical. The damage is modified by the champion's Anti-Magic attribute.
    • 06: Energy. The damage is modified by the champion's Wisdom attribute.
  • 19h (25) 1 byte: Unused, always 0.

562h (1378) 16 bytes, Food values of consumable items

Structure: 8 words
A table of eight bytes with one byte for each consumable item, containing the food value of this item. The program substracts the item number of the 'Apple' to the item number to get an index in this table.
Values:

  • 1F4 (Apple)
  • 258 (Corn)
  • 28A (Bread)
  • 334 (Cheese)
  • 226 (Screamer Slice)
  • 15E (Worm round)
  • 3DE (Drumstick / Shank)
  • 578 (Dragon steak)

572h (1394) 54 bytes, Miscellaneous items descriptors

(byte8946 in CSBwin)
One byte per item of type 10 (Miscellaneous items).
Weight of item in 1/10th of Kg (100 g)
Values: From Compass (0.1 Kg) to Bones (0.8 Kg)

5A8h (1448) 2 bytes, Value for copy protection

(word8892 in CSBwin)
Structure: 1 word
Value: 0004h
This value is used by the copy protection scheme in the game. Its exact role is still unknown. The value is initialized when item 559 is read in memory and is modified when copy protection checks fails (and maybe also when it succeeds).
This value is at -$22bc in CSB for Atari ST version 2.1 and at -$22b8 in DM for Atari ST version 1.2.

5AA (1450) 232 bytes, Clothe items descriptors

Structure: 58x4 bytes

  • 1 byte: item weight (100 g units)
  • 1 byte: Protection efficiency value
  • 1 byte:
    • Bit 7: '0': Armor / '1' Shield
    • Bits 6-3: Unused, always 0
    • Bits 2-0: Sharp Resistance (type 4), in 1/8th of the protection value (minimum 0, maximum 7/8)
  • 1 byte: Unused, always 0

692h (1682) 276 bytes, Weapons items descriptors

Structure: 46x6 bytes

  • 1 byte: item weight (100 g units)
  • 1 byte: Weapon class, with delta value for range weapons (the value substracted from the energy of the missile at each of its movement). This value is used to determine if ammunition fits with a weapon.
    The lowest delta values of range weapons should correspond to the best weapons but in the data it is the opposite.
    • 00 Normal weapon
    • 01-0F Range weapon (Axes are incorrectly set as type 02). 0Ah is for Arrows (used with Bow) and 0Bh is for Rocks (used with Sling)
    • 10-1F Bow (Remove 16 from this value to obtain the delta value).
    • 20-2F Sling (Remove 32 from this value to obtain the delta value).
    • 30-6F No such weapons
    • 70-7F Weapons that can throw missiles (Fury is of type 00)
    • 80-9F Magical item (like Staff or Ring)
    • C0-FF Not a weapon (like Horn of fear, Firestaff)
  • 1 byte: Damage. Applies to both normal and range weapons.
  • 1 byte: Initial energy when the weapon is thrown (Distance).
  • 1 word (big endian):
    • Bits 15-14: Unused, always 0
    • Bit 13: Unused. This bit is sometimes 0 and sometimes 1, but it is not used anywhere in the code and does not have any obvious meaning.
    • Bits 12-8: Missile image to display when the item is thrown. This index refers to the 'Missile graphics definitions' in item 558.
      • 0: Same graphic as the one used to display the item on floor
      • 1: Arrow
      • 2: Dagger
      • 3: Axe
      • 4: Unused (it would be a lightning)
      • 5: Slayer arrow
      • 6: Stone club
      • 7: Wooden club
      • 8: Dart
      • 9: Sword
      • A: Throwing star
    • Bits 7-0: Shoot damage bonus applied when the weapon is used with ammunition (signed value). It applies both to physical and magical missiles shot with the weapon.

7A6h (1958) 1080 bytes, Item descriptors

Structure: 180x6 bytes
This structure defines some attributes for all items of all types.

  • 1 word (big endian): Global item index: Each item type in the game has a unique global item index. This is the index value to use in the data field of some actuators that only apply to a specific item type. This value is used as an index in item 556 to find the name of the item. It is also used to obtain the item image from graphics items 42 to 47. Values range from 00h to C6h. This value is returned by getbasicobjecttype.
  • 1 byte: Item on floor graphics index: this is the index of the graphics to use to display the item when it is on the dungeon floor. This index is added to a base index of 361 indicating which graphics.dat item is the first graphics of this category. There is an exception for the Chest where this byte is 00h and that has two graphic items 360 and 361 (one on the floor and one in an alcove).
  • 1 byte: Attack combo: This is the number of the attack combo associated with the item. An attack combo is a combination of one to three attacks. (an index in tab 19570 in CSBwin)
  • 1 word: Carry locations: For each item, this word defines the possible carry locations. Each bit of this word defines a location:
    An item with this word set to 0 cannot be carried (apart from the hand mouse cursor, like the Zokathra spell). All items with a non zero value can also be placed in hands and in the backpack. Items that can only be placed in hands and in the backpack must have at least one bit in bit 9 and bit 11-15 set to 1 (the game performs an AND operation between this word and FFFFh). However, bit 9 is reserved for this use.
    • Bits 15-11: Unused, always 0
    • Bit 10: Chest
    • Bit 9: Hands
    • Bit 8: Pouch (indique aussi que l'objet peut être lancé à travers une herse)
    • Bit 7: Quiver 2 (other items in quiver)
    • Bit 6: Quiver 1 (First item in quiver)
    • Bit 5: Feet
    • Bit 4: Legs
    • Bit 3: Torso
    • Bit 2: Neck
    • Bit 1: Head
    • Bit 0: Consumable

The descriptors are stored in the following order:

  • 0: Scroll
  • 1: Chest
  • 2-22: Potions
  • 23-68: Weapons
  • 69-126: Clothes
  • 127-179: Miscellaneous items

Values are listed on Technical Documentation - Dungeon Master and Chaos Strikes Back Items properties.

BDEh (3038) 16 bytes, Additional object entries created when loading dungeon.dat

(byte7302 in CSBwin)
When loading a dungeon.dat file, the game engine will allocate additional space for more entries of each type of object in the file in order to accommodate for new objects created while playing. There is one byte for each object type:
Values:

  • 00h (Doors)
  • 00h (Teleporters)
  • 00h (Texts)
  • 00h (Actuators)
  • 4Bh (Creatures)
  • 64h (Weapons)
  • 78h (Clothes)
  • 00h (Scrolls)
  • 05h (Potions)
  • 00h (Containers)
  • 8Ch (Miscellaneous items)
  • 00h (Unused object type)
  • 00h (Unused object type)
  • 00h (Unused object type)
  • 3Ch (Missiles)
  • 32h (Clouds)

BEEh (3054) 16 bytes, Size of object types in dungeon.dat

Each byte contains the size in bytes of entries in dungeon.dat. For example, each creature in the dungeon.dat file occupies 16 bytes (10h).
As there are no objects of type 11, 12 and 13, their size is defined to 0 here.
Values:

  • 04h (Doors)
  • 06h (Teleporters)
  • 04h (Texts)
  • 08h (Actuators)
  • 10h (Creatures)
  • 04h (Weapons)
  • 04h (Clothes)
  • 04h (Scrolls)
  • 04h (Potions)
  • 08h (Containers)
  • 04h (Miscellaneous items)
  • 00h (Unused object type)
  • 00h (Unused object type)
  • 00h (Unused object type)
  • 08h (Missiles)
  • 04h (Clouds)

BFEh (3070) 8 bytes, Coordinates delta for Y movement

Structure: 4 words
These values are added to the Y coordinate when moving, depending on the direction of the movement.
Values: -1, 0, 1, 0 for North, East, South, West

C06h (3078) 8 bytes, Coordinates delta for X movement

Structure: 4 words
These values are added to the X coordinate when moving, depending on the direction of the movement.
ajout à coordonnée x suivant direction
Values: 0, 1, 0, -1 for North, East, South, West