This page describes the content of item 559 found in the graphics.dat file from:
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:
This item is only used in Atari ST versions. All Amiga versions contain the equivalent data in the executable file itself and never read any data from this item.
It contains initialization data for global variables that was not included in the source code as an optimization to reduce the executable file size. This was because of the special way the C compiler worked on Atari ST, and this trick was not used on any other platform.
You may consult the names, values and usage of all these variables in the source code of ReDMCSB (search the source code for variable names containing “Graphic558”, “Graphic559”, “Graphic560”, “Graphic561” and “Graphic562”).
You may extract all values to text files with the data file decoder script at DM, CSB and DMII Data Files and Animations Decoders for PC.
All the notes below are the results of older research by credited people. They are incomplete and presented “as-is”.
Meynaf (Detailed notes)
Paul Stevens (CSBwin source code)
rain` (ADGE source code)
Adamo
Sophia
Pierre Monnot
(byte10340 in CSBwin)
There is a function in the game that returns the facing byte of a creature group. This byte contains the facing direction of each creature in the group (2 bits per creature in the group).
For each creature located on the same map as the party, the engine maintains an ’extended creature data’ structure in addition to the basic creature data. The function simply returns the facing byte stored in this ’extended creature data’.
For creatures not located on the same map as the party, there is only basic creature data. It contains only 2 bits for the facing direction and thus all creatures in the group face the same direction. In that case, the function will use the two bits of data as an index in this table to get the corresponding facing byte.
In each byte, there are two bits for each creature.
Values: 00 55 AA FF
0000,1111,2222,3333 coded on two bits
(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.
When character 1Eh is found in a dungeon.dat wall text, the next character identifies the string to display in this table.
Values:
(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:
(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:
Structure: 4x2 bytes
(Copied in DoorTOC in CSBwin)
There are two bytes for each type of door:
Values:
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:
Here are the hard coded indices (these are the indices of the first dropped object. The program loops until the end of each list):
Values: Please refer to Dungeon Master Creatures and Chaos Strikes Back Creatures.
(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
Structure: 27x26 bytes
Values: Please refer to Dungeon Master and Chaos Strikes Back Creature Details.
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)
Bits 15-14 Unused, always 0.
Bit 13: Archenemy. 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: Night vision. When this bit is set to ‘1’, the creature can see the party in darkness because it ignores the sight range reduction caused by low light levels in the dungeon.
Bit 11: See invisible. When this bit is set to ‘1’, the creature can see the party even if it is under the effect of the ‘Invisibility’ spell.
Bit 10: Absorb items. When this bit is set to ‘1’, the creature can absorb some items when they are thrown at the creature (like the Mummy). The list of items that can be absorbed is hard coded in the program (Arrow, Slayer, Poison Dart, Throwing Star and Dagger). If a thrown item is not absorbed by the creature, it falls on the floor (it is never destroyed).
This is not linked to the ability of the Giggler to steal items in champion hands which is hard coded.
Bit 9: Drop items. If this bit is set to ‘1’, the creature will drop some items when it is killed. The ‘Creature droppings definitions’ above are used to determine which items are dropped by the creature.
Bit 8-7: Height. These two bits define the height of the creature. This value is used to define how to animate a door that is closed upon the creature:
Notes: This value is ignored for non material creatures and the door always closes normally without causing any damage to such creatures.
Projectiles cannot fly over creatures, even the small ones.
Bit 6: Nonmaterial. If this bit is set to ‘1’, the creature is nonmaterial. These creatures ignore normal attacks but take damage from the ‘Disrupt’ action of 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: Levitation. If this bit is set to ‘1’, the creature can pass over pits without falling.
Bit 4: Attack any champion. If this bit is set to ‘1’, the creature can attack any champion in the party, even the ones in the back.
If both ‘Prefer back row’ and ‘Attack any champion’ flags are set to ‘0’, 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: Side attack. The creature does not need to face the party to attack, it can see the party in all directions. 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 before attacking.
Bits 1-0: Size:
Bits 15-14: Maximum vertical offset range. Defines the maximum vertical offset range to display the creature graphics. The exact value is randomly chosen in the range:
This value should probably have had the following effect:
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):
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).
Bits 13-12: Maximum horizontal offset range. Defines the maximum horizontal offset range to display the creature graphics. The exact value is randomly chosen in the range. This value behaves like the maximum vertical offset.
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: Mirror and shift front image at distance 2. 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:
Bit 6: Unused, always 0.
Bit 5: Attack graphic. The creature has an attack graphic.
Bit 4: Back graphic. The creature has a back graphic.
Bit 3: Side graphic. 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: Number of sets of 3 additional front image graphics. Other creature images are not affected by this value.
The 3 additional images in each set are: one full size for display at D1 distance from the party, and two scaled down for display at D2 and D3 distances.
This value is set to ‘1’ for creatures that mirror their front image and set to ‘0’ for all others. Values ‘2’ and ‘3’ are not used in the game.
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. This applies even if the creature is not facing the party.
Bits 7-4: Unknown range value that is only used in Dungeon Master for PC and Amiga 3.6, and in all Chaos Strikes Back versions except the Atari ST one (values 0 to 10).
Bits 3-0: Sight range. Maximum number of tiles between creature and party needed to see the party. This applies only if the creature is facing the party. This value is affected by the current light level in the dungeon (the value is halved for each level of darkness).
Bits 15-12: Suicidal (Teleport, Self preservation).
If this value is greater than or equal to 10, then the creature will not step into a teleporter if its destination is on a map 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. This amount of experience is added to skill 07: Parry (Hidden Fighter skill) of a champion when attacked by the creature. This value is also used as a multiplier to compute the experience earned by champions when killing the creature.
Bits 7-4: Bravery. Resistance to War Cry, Calm, Brandish, Blow Horn and Confuse (hard coded list of actions). With a value of 15, the creature is never afraid. If the value is not 15 then a creature may flee after another creature in the same group was killed.
Bits 3-0: Experience (X2, values 1 to 15)
Unused.
Bits 15-12: Unused, always 0.
Bits 11-8: Poison resistance (Clouds). Values range from 0 to 15. Value 15 means the creature is immune.
In the CSBwin source code, the poison resistance value is used in the function DeterminePoisonDamage() defined in Code11f52.cpp and used in function ProcessTT_25 in Timer.cpp.
It is used for computing the damage caused by a Poison Cloud. The formula is:
If CreaturePoisonResistance = 15 Then
Damage = 0
Else
Damage = 8 * (Max(1, Min(CloudStrength / 32, 4) + Random(1)) + Random(3)) / (CreaturePoisonResistance + 1)
End If
The following table shows the possible range of Damage values depending on the cloud strength and the poison resistance of the creature.
Cloud Strength range Poison Resistance | 0-31 | 32-63 | 64-95 | 96-127 | 128-159 | 160-191 | 192-223 | 224-255 |
---|---|---|---|---|---|---|---|---|
0 | 8-32 | 8-40 | 16-48 | 24-56 | 32-64 | 32-64 | 32-64 | 32-64 |
1 | 4-16 | 4-20 | 8-24 | 12-28 | 16-32 | 16-32 | 16-32 | 16-32 |
2 | 2-10 | 2-13 | 5-16 | 8-18 | 10-21 | 10-21 | 10-21 | 10-21 |
3 | 2-8 | 2-10 | 4-12 | 6-14 | 8-16 | 8-16 | 8-16 | 8-16 |
4 | 1-6 | 1-8 | 3-9 | 4-11 | 6-12 | 6-12 | 6-12 | 6-12 |
5 | 1-5 | 1-6 | 2-8 | 4-9 | 5-10 | 5-10 | 5-10 | 5-10 |
6 | 1-4 | 1-5 | 2-6 | 3-8 | 4-9 | 4-9 | 4-9 | 4-9 |
7 | 1-4 | 1-5 | 2-6 | 3-7 | 4-8 | 4-8 | 4-8 | 4-8 |
8 | 0-3 | 0-4 | 1-5 | 2-6 | 3-7 | 3-7 | 3-7 | 3-7 |
9 | 0-3 | 0-4 | 1-4 | 2-5 | 3-6 | 3-6 | 3-6 | 3-6 |
10 | 0-2 | 0-3 | 1-4 | 2-5 | 2-5 | 2-5 | 2-5 | 2-5 |
11 | 0-2 | 0-3 | 1-4 | 2-4 | 2-5 | 2-5 | 2-5 | 2-5 |
12 | 0-2 | 0-3 | 1-3 | 1-4 | 2-4 | 2-4 | 2-4 | 2-4 |
13 | 0-2 | 0-2 | 1-3 | 1-4 | 2-4 | 2-4 | 2-4 | 2-4 |
14 | 0-2 | 0-2 | 1-3 | 1-3 | 2-4 | 2-4 | 2-4 | 2-4 |
15 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Bits 7-4: Fire resistance. This value is used when a Fireball or Lightning Bolt explosion is created on the square of the creature. Value 15 means the creature is immune.
Bits 3-0: Unused (X3, values 1 to 15)
Bits 15-12: Unused, always 0.
Bits 11-8: Attack animation 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: Animation 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 display duration. The amount of time while the attack graphic is displayed.
Define the probabilities that the creature will hit each part of the body.
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)
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: Please refer to Dungeon Master Items and Chaos Strikes Back Items.
(byte8946 in CSBwin)
One byte per item of type 10 (Miscellaneous items).
Weight of item in 1/10th of Kg (100 g)
Values: Please refer to Dungeon Master Items and Chaos Strikes Back Items.
(word8892 in CSBwin)
Structure: 1 word
Value: 0004h
This value is used by the copy protection scheme in the game. 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.
Structure: 58x4 bytes
Values: Please refer to Dungeon Master Items and Chaos Strikes Back Items.
Structure: 46x6 bytes
Values: Please refer to Dungeon Master Items and Chaos Strikes Back Items.
Structure: 180x6 bytes
Values: Please refer to Dungeon Master and Chaos Strikes Back Items properties.
This structure defines some attributes for all items of all types.
The descriptors are stored in the following order:
(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:
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:
Structure: 4 words (big endian, signed)
This table gives the value to add to an Y coordinate to get the Y coordinate of the next tile in each direction (note that directions are absolute). These values are used by many functions in the game engine, including when the player moves the party.
Values: -1, 0, 1, 0 for North, East, South, West
For example, the Y coordinate of tile B located directly south of tile A is the Y coordinate of tile A + 1
Structure: 4 words (big endian, signed)
This table gives the value to add to an X coordinate to get the X coordinate of the next tile in each direction (note that directions are absolute). These values are used by many functions in the game engine, including when the player moves the party.
Values: 0, 1, 0, -1 for North, East, South, West
For example, the X coordinate of tile B located directly West of tile A is the X coordinate of tile A - 1