Extracting images from GRAPHICS.DAT palette issues

Discuss anything about the original Dungeon Master on any of the original platforms (Amiga, Atari, etc.).
This forum may contain spoilers.

Moderator: Ameena

Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
RedHatDude
Neophyte
Posts: 3
Joined: Mon Oct 18, 2004 11:54 am

Extracting images from GRAPHICS.DAT palette issues

Post by RedHatDude »

Hello,
I'm a long time player, first time poster.

I wanted to extract the graphics from the GRAPHICS.DAT (PC 3.4 English) file. I couldn't run the extraction programs on dmweb.free.fr on my computer since at the time I was on a mac, so I read the specs on http://dmweb.free.fr and I downloaded the code for dmdecode and wrote a Python program. After quite a while with endian fun I got it working and extracted all of the graphics.

There's only one problem, the graphics for certain monsters are colored wrong (worms are orange-ish-tan-ish). So I tried running dmdecode on a PC, and it yielded the same results.

I found a program called: DMGHL_Sample2.SR1.Rev0 which is a program that uses the DMGHL library to extract the graphics. This program worked correctly. Now I have my images, but I'm still curious about how I could make my program work correctly. I downloaded the source to the DMGHL library, but cannot see any differences in the algorithm WRT the palettes. It looks like it uses the same palette that I do, so I think that the correction might occurr in the sample program itself, which I don't have the source to.

Now, from what I understand, DM has two palettes, one for the interface elements, and one for the dungeon. I know that I'm using the wrong palette for some of these images. I could fairly easily fix it by hand, but was wondering if there were a better way.

Is there a way for me to determine from any of the DM data files what these palettes are, or is that stored in the exe?
Last edited by RedHatDude on Tue Oct 19, 2004 6:25 am, edited 1 time in total.
RedHatDude
Neophyte
Posts: 3
Joined: Mon Oct 18, 2004 11:54 am

Post by RedHatDude »

It seems that color indexes 9 and 10 are the ones that can change from monster to monster. These must be the two level dependent colors I've seen references to.
User avatar
Gambit37
Should eat more pies
Posts: 13776
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

Exactly. There is another lookup table in the graphics dat that determines which colours are replaced in those locations. I'm not sure where it's stored or how, but look in the CSBWin forums for a post about file 0558, which should lead you to some downloadable docs with info about those colours...

By default, the palette uses the flesh/orange colours for those two indexes on ALL images that are extracted. DMHGL must account for that and put the correct colours into certain images...
RedHatDude
Neophyte
Posts: 3
Joined: Mon Oct 18, 2004 11:54 am

Post by RedHatDude »

Okay, I've read the posts concerning file 0558, but I haven't seen anything that describes where this file is (or where it is in the DM .DAT files if it isn't a file by itself which I'm suspecting).

Is there a document or link that explains the story from the beginning?
User avatar
Gambit37
Should eat more pies
Posts: 13776
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

0558 is one of the structures that is extracted from GRAPHICS.DAT when you use the DMExtract tool. "Charlatan" spent a long time decoding it and documented his findings, though it is in French. This data structure contains tons of info about the graphics for the game, including bytes for monsters that tell the game which colours to use for indexes 9 & 10.

In the notes, there is a detailed description of how it works plus a graphic of the colour table. I don't know how much of that will be useful to you though.

The post you want is here:

http://www.dungeon-master.com/forum/vie ... hp?t=23191

And the download links are here (can be found in that post):

http://pageperso.aol.fr/TheCharlatan75/Lucyle/0558.zip
http://pageperso.aol.fr/TheCharlatan75/ ... atures.zip
User avatar
ChristopheF
Encyclopedist
Posts: 1623
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Post by ChristopheF »

The color table in item 558 is found in the graphics.dat file from DM and CSB Atari ST versions, but not in all graphics.dat files (not in the PC version for example, where it is hardcoded in the executable file itself)
Post Reply