Contents

Technical Documentation - Dungeon Master and Chaos Strikes Back Graphics.dat: Item 562

This page is a raw work in progress.

Overview

This page describes the content of item 562 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 1826 bytes but there are four variations in the content of this item:

  • Dungeon Master for Atari ST versions 1.0 English (1987-12-08), 1.0 English (1987-12-11), 1.1 English, 1.2 English, Dungeon Master for Amiga version 2.0 English.
  • Dungeon Master for Atari ST version 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.

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 http://dmweb.free.fr/Stuff/ReDMCSB_WIP20210206.7z (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".

Credits

Paul Stevens (CSBwin source code)
rain` (ADGE source code)

Item 562

Offset    CSB2xST DM12ST/20AM
000005C8: 02      00
000005C9: 10      60

000h (0000) 2 bytes, 'Line Feed' character

i8 Byte1830[2]; // Start of graphic 0x232
String containing a single 'Line Feed' character
Values: 0A00
This string is used by a function to print a 'Line Feed' character in the message area on the bottom of the screen.

002h (0002) 32 bytes, Masks to print text

Two arrays of 4 longs containing masks
These masks are used when a character is printed over two consecutive blocks of 16 pixels in video memory.
The character is printed in two steps using a pair of masks, one from each array. The combination of the two masks contain 5 clear bits (each character is 5 pixels wide).
7FFF7FFF 3FFF3FFF 1FFF1FFF 0FFF0FFF
FFF0FFF0 FFF8FFF8 FFFCFFFC FFFEFFFE

Structure: 2x4 dwords
i32 Long1828[4]; // masks for text !not reversed!
i32 Long1812[4]; // masks for text !not reversed!

022h (0034) 24 bytes, Rectangle areas

RectPos wRectPos1796; // ... bottom of screen rect
RectPos wRectPos1788; // ... right side of screen rect
RectPos wRectPos1780; // ... top of screen rect

03Ah (0058) 176 bytes,

Structure: 22x8 bytes
SOUND sound1772[22]; // [Offset 58]
word[0-1] ... graphic address. index de l'item SNDx dans le graphics.dat
byte[2] ... unused
byte[3] ... Timer type, always 0x70 (now unused)
byte[4] ... length of time sound exists
byte[5] ... unused
byte[6] ... distance sound will travel as 'loud'
byte[7] ... distance sound will travel as 'soft'
struct SOUND
{
i16 word0;
i8 byte2;
i8 byte3;
i8 byte4;
i8 byte5;
i8 byte6;
i8 byte7;
};

0EAh (0234) 8 bytes, Tile type to timer type conversion table

This array contains the type of timer to create for each type of tile targetted by an actuator.
i8 Byte1596[8];

0F2h (0242) 2 bytes, Unused

This word is modified by a copy protection routine but it is never used afterwards.
i16 Word1588;

0F4h (0244) 60 bytes, Possessions drop order

This array contains the carry location indices in the order in which they are dropped on the floor when a champion dies.
i16 DropOrder[30];//1586

130h (0304) 24 bytes, Bar graphs offsets

3 word values per champion (one for each bar graph).
Offset in bytes from the left of screen to the first 16 pixels block containing the bar graph
Structure:
i16 Word1526[4][3];

148h (0328) 48 bytes, Bar graphs masks

Each bar graph can be over two 16 pixels blocks. There are two words for each bar. Each bit in these words indicate if the corresponding pixel is to be drawn for the bar (there are exactly 4 consecutive bits set in each pair of words, all other bits are clear)
i16 Word1502[4][6];

178h (0376) 32 bytes, Rectangles for champion position icons

RectPos wRectPos1454[4];

198h (0408) 6 bytes, Special characters when reincarnating

i8 SpecialChars[6]; //1422 comma,period,semi-colon,colon,space
Values: 44 46 59 58 32 0

19Eh (0414) 4 bytes, Strings used when reincarnating

i8 Byte1416[2]; String containing a single space character. Values: 32 0
i8 Byte1414[2]; String containing a underscore character. Values: 95 0

1A2h (0418) 6 bytes, Resistance to injuries multipliers

For each carry location (body parts only), this array contains a multiplier that is used when computing resistance to injuries.
i8 Byte1412[6]; // resistances to ouches (getting hurt...) :P

1A8h (0424) 16 bytes, Rectangles for Eye and Mouth

i16 Word1406[4]; // eye rectangle
i16 Word1398[4]; // mouth rectangle

1B8h (0440) 4 bytes, Rectangle for champion portraits

This rectangle is used to extract a single portrait from the graphic containing all champion portraits
i8 Byte1390[4];

1BCh (0444) 4 bytes, Champion colors

For each champion, this array contains the color index to use to draw the champion position icon and text messages about the champion
i8 Byte1386[4];
The color palette is available on Technical Documentation - File Formats - Portrait Files (.CMP).

1C0h (0448) 32 bytes, Palette changes for mouse cursor icon

When holding an object in hand, the mouse cursor represents the object with a shadow.
Palette changes are used to substitute some colors by others when drawing the cursor.

Each byte in a "Palette changes" is the replacement color index multiplied by 10.
For example, if the second byte is $3C = 60 this means the second color (index 1) must be replaced by color index 6.

Palette changes to apply to an icon to draw its shadow in a mouse cursor (objects in hand and champion position icon)
i8 Byte1382[16];

Palette changes to apply to an icon to draw the icon over its shadow in a mouse cursor (objects in hand and champion position icon)
These replacement colors allow the cursor to be displayed over the viewport without being affected by the dungeon luminance
i8 Byte1366[16];

1E0h (0480) 128 bytes, Hand cursor

The graphic is in Atari ST planar mode, 16x16 pixels, 4 colors.
i8 Byte1350[128];

260h (0608) 128 bytes, Arrow cursor

The graphic is in Atari ST planar mode, 16x16 pixels, 4 colors.
i8 Byte1222[128];

2E0h (0736) 8 bytes, Rectangle to hide icons in viewport

Viewport area containing the floppy disk, Zzz and Cross icons. This rectangle is used to hide the icons when viewing a potential champion (a champion that is not yet in the party, before reincarnation of resurrection).
i8 Byte1094[8];

2E8h (0744) 12 bytes, Palette index to total luminance

Table used to determine which color palette to use for the dungeon view based on the total luminance (Magical luminance + luminance produced by torches held in champion hands)
i16 PaletteBrightness[6];//1086
Values: 99 75 50 25 1 0

For example, with a luminance of 30, the 4th color palette would be used.

2F4h (0756) 32 bytes, Luminous Power To Luminance

Table used to determine the luminance produced by:
- Spell 'Torch' (Luminous Power is 3, 4, 5, 6, 7 or 8 based on spell power)
- Spell 'Light' (Luminous Power is 3, 5, 7, 9, 11 or 13 based on spell power)
- Spell 'Darkness' (Luminous Power is 2, 3, 4 ,5 ,6 or 7 based on spell power)
- Action 'Light' on objects 'Yew Staff' and 'Sceptre of Lyf' (Luminous Power is 2)
- Object 'Illumulet' (Luminous Power is 2)
- Object 'Torch' (Luminous Power is stored in the Torch object itself, ranging from 0 to 15)

i16 Word1074[16];
Values: 0 5 12 24 33 40 46 51 59 68 76 82 89 94 97 100
For example, an Illumulet (Luminous Power = 2) would add 12 to the total Luminance.

314h (0788) 76 bytes, Carry Locations Masks

This array contains a mask for each carry location (30 in chanmpion inventory and 8 in chest) describing what kind of objects can be stored in that carry location.
i16 CarryLocation[38];
Check Technical Documentation - Dungeon Master and Chaos Strikes Back - Items properties for the meaning of each bit in the masks.

360h (0864) 48 bytes, Rectangles for champion panel

Poisoned
Water
Food
Object Description Circle
Arrow Or Eye
Resurrect or Reincarnate Buttons / Open Scroll

RectPos wRectPos966;// poisoned draw rect box (static 48x12);
RectPos wRectPos958;// water (24x12) 12 = transparent pixel?
RectPos wRectPos950;// food (24x12) 12 = transparent pixel?
RectPos wRectPos942;// item circle (16x12) 12 = transparent pixel?
RectPos wRectPos934;// arrow/eye (8x8) 8 = transparent pixel?
RectPos wRectPos926;// empty inventory box rect: 8 = transparent pixel?

390h (0912) 2 bytes, Copy protection

This word is used by the copy protection of the game.
i16 Unused918;//Word918; //

392h (0914) 276 bytes, Icon display descriptors

This array contains 46 entries: 8 for hands in portraits, 30 for clothing/backpack and 8 for chest.
Each entry is 6 bytes large:
1 word: X coordinate
1 word: Y coordinate
2 bytes: Object full type

ICONDISPLAY IconDisplay[46]; //916

4A6h (1190) 16 bytes, Torch Type Per Charges Count

For each torch charge count (0..15) this array contains the graphic to use to draw the torch.
i8 Byte640[1];
FILL(639,624)

4B6h (1206) 8 bytes, Rectangle to clear held object name

This rectangle is used to clear the screen area where the name of the object held in hand is printed.
RectPos wRectPos624;

4BEh (1214) 4 bytes, Unused data

This data is never used in the game code. Probably a rectangle for an icon.
FILL(616,612)
Values: 00 0F 00 0F

4C2h (1218) 14 bytes, First icon index in icon graphics

This array contains the first object full type in each of the 7 graphics containing object icons.
i16 Word612[7];

4D0h (1232) 8 bytes, Unused data

This data is never used in the game code.
FILL(598,590)
Values: 0A 0B 0D 0C 0A 0D 06 0D

4D8h (1240) 4 bytes, Creature injury masks

Each creature descriptor contains probabilities of injuring a champion Head, Torso, Legs or Feet. These 4 masks are used to apply the injuries to the champion.
ui8 uByte590[4];
Values:
$20: 32 Feet
$10: 16 Legs
$08: 8 Torso
$04: 4 Head

A creature's word22 has direct relation to this. If a creature hits you, it
has a chance to do injuries from this table. it takes a nibble off the
least significant side of word22, if it is less than a random(0-15),
it landed a critical and uses the mask of ubyte590[0]. It then takes another nibble
and tests if that is less than the same random(0-15) as before. If it is
still less than it, it uses the mask of ubyte590[1], and moves all the way up
to ubyte590[3]. Creatures with low values for the least significant nibbles in
word22 will do 'deep' criticals which I assume deal many injuries. This explains why
a single hit from a dragon almost is a guaranteed injury

4DCh (1244) 32 bytes, Ordered positions to attack

i8 Byte586[8][4];
[adamo]
These bytes might be filled with 0, 1, 2 or 3 and are responsible for the priority of sub-cells choosen by a monster to attack a character.
This doesn`t works for creature that have the "attack every position" flag set. In that case, the creature attacks random subcells.

I will use that notation:

Code: Select all
L   R    - L- left monster, R- right monster

A | B    - A and B - 1st and 2nd char in a party
------
D | C    - C and D - 3rd and 4th char in a party

So you can see that monster L stays right in front of a character occupying subcell A and monster R stays right in front of a character occupying subcell B.

In original code, there are four eight-byte words:

0 1 3 2 1 0 2 3
1 2 0 3 2 1 3 0
3 2 0 1 2 3 1 0
0 3 1 2 3 0 2 1

wchich you can read as:

Code: Select all
-----------------------------------
|     LEFT       |     RIGHT      |
|     monster    |     monster    |
|     attack     |     attack     |
|     priority   |     priority   |
| I   II  III IV | I   II  III IV |
-----------------------------------
| 0   1   3   2  | 1   0   2   3  | <= for party facing NORTH:
|                |                |      0=A 1=B 2=C 3=D
| 1   2   0   3  | 2   1   3   0  | <= for party facing EAST:
|                |                |      0=D 1=A 2=B 3=C
| 3   2   0   1  | 2   3   1   0  | <= for party facing SOUTH:
|                |                |      0=C 1=D 2=A 3=B
| 0   3   1   2  | 3   0   2   1  | <= for party facing WEST:
|                |                |      0=B 1=C 2=D 3=A
-----------------------------------

wchich means:
If party is facing NORTH, then LEFT monster attack priority is subcell A (priority I). If this subcell is empty (for example you have one character in party occupying subcell B, or character is dead), then a monster tries to attack character on subcell B (priority II). Then subcell C (priority III), and then subcell D (priority IV). RIGHT monster do the same, but in different order (BACD).

Second line is for a case when a party is facing EAST, but the current values for each line will be different (because each line represents different world quarter!). Third line is for party facing SOUTH and fourth for party facing WEST.

Originally, the code is set for monsters L and R to attack every possible subcell, but it can be chaged depending on the party facing set. For example, if we change the second line to 00003333, that would mean that when party facing WEST, the LEFT monster will attack only subcell D (priority order set to DDDD) and RIGHT monster will attack only subcell A (priority order AAAA). So if you have only two characters in a party, you could place them in subcells B and C so the monsters wouldn`t attack at all (the party would be safe in front of four skeletons when facing WEST).

For example, the code can be rearranged in a way that RIGHT monster doesn`t attack subcell B when party facing SOUTH. Or LEFT monster attacks subcell C only when party facing NORTH. Or all monsters attacks subcells C and D first (if they are empty, tries to attack A and B- so if you have a full party, they will attack back characters first). Or when a party is facing NORTH, monsters attacks only subcell A, when SOUTH- only B. Or when party is facing EAST, LEFT monster tries to attack C first, then AD (but doesn`t attack B at all), and when party is facing WEST, RIGHT monster attacks D first, then BC (but doesn`t attack A at all). Or whenever party is facing SOUTH, monsters only attack subcell A (so characters occupying BCD would be safe). Etc, etc. It`s up to the designer.
[/adamo]

4FCh (1276) 2 bytes, Copy protection

This value is used by the copy protection of the game.
i16 Word554;

4FEh (1278) 256 bytes, Color palettes

Each color palette is an arry of 16 integers (32 bytes). Each integer defines a color (512 colors possible).
Bits 15-12: unused
Bits 11-8: Red component
Bits 7-4: Green component
Bits 3-0: Blue component

Dungeon View Palettes (6 levels of luminance, from lightest to darkest)
Main Menu Color Palette
Credits Color Palette

Note the first dungeon view palette is always used to draw the top and bottom of the screen. The middle of the screen is drawn with one of the 6 palettes depending on the luminance in the dungeon.
The first dungeon view palette is the one described on Technical Documentation - File Formats - Portrait Files (.CMP).

PALETTE Palette552[6];
PALETTE Palette360;
PALETTE Palette328;

5FEh (1534) 140 bytes, Graphic items to always load

This array contains the indices of graphics that are always loaded in memory
ui16 DefaultGraphicList[70];

68Ah (1674) 16 bytes, Palette changes for no changes

This array is used as palette changes when no changes are required: it replaces each color by itself. It is used to draw Clouds (D1 to D4), Missiles (D1), Damange Done, ...
Values: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150
i8 Byte156[16];

69Ah (1690) 136 bytes, Rectangles

This section contains 17 rectangles:
Endgame Champion Portrait (This is for the first portrait, X+48 for other portraits)
Endgame Champion Mirror (This is for the first portrait, X+48 for other portraits)
Endgame_Restart_Inner
Endgame_Restart_Outer
Endgame_TheEnd
Dungeon Entrance Door Right
Dungeon Entrance Door Left
Dungeon Entrance Viewport
Dungeon Entrance Door Right (modifyable)
Dungeon Entrance Door Left (modifyable)
Dungeon Entrance Dungeon View
Title Screen_Presents
Title Screen_StrikesBack_Source
Title Screen_StrikesBack_Destination
Movement Arrows
Action Area
Spell Casting Area

i16 Word140[4]; // rect of first character's graphic on screen,
i16 Word132[4]; // rect of first character's death graphic. +48 again.
i16 Word124[4]; // some rect for 'restarting' the game, cleared when used
i16 Word116[4]; // some rect for 'restarting' the game, cleared when used
i16 Word108[4]; // "THE END" label rect (for graphic 6)
i16 Word100[4]; // entrance door (right) rect
i16 Word92[4]; // entrance door (left) rect
i16 Word84[4]; // saved rect from before opening doors (saves a quick ss of this rect)
i16 Word76[4]; // modifyable entrance door (right) rect
i16 Word68[4]; // modifyable entrance door (left) rect (moves it as u open)
i16 Word60[4]; // left part of interior rect as you open doors
i16 Word52[4]; // intro graphic rect to delay display (its around "presents");
i16 Word44[4]; // into graphic rect to delay display ("presents" again???)
i16 Word36[4]; // into graphic rect for "stikes back"
i16 Word28[4]; // movement arrow key rects
i16 Word20[4]; // attack damage rect
i16 Word12[4]; // magic spell area rect