The following is a breakdown by ChillyWilly:
Note that this can also work for PNG sprite sets too, which avoids you having to define every entry for, say, a 60 image PNG set -- this way will allow you to set them all-at-once.The things.ddf defines all the info the sprites need BESIDES how they look. What states they use, the timing, etc. That will stay there.
What sprites.ddf will do is make it easy to define how sprites LOOK.
Toward that end, you get to define certain things.
static const commandlist_t spr_commands[] =
{
DDF_FIELD("LUMP_NAME", lump_name, DDF_MainGetLumpName),
DDF_FIELD("FILE_NAME", file_name, DDF_MainGetString),
DDF_FIELD("DATA_TYPE", data_type, DDF_SpriteGetType),
DDF_FIELD("SPRITE_NAME", sprite_name, DDF_MainGetString),
DDF_FIELD("FOFFSET", foffset, DDF_SprGetCoords),
DDF_FIELD("SOFFSET", soffset, DDF_SprGetCoords),
DDF_FIELD("SSIZE", ssize, DDF_SprGetCoords),
DDF_CMD_END
};
You start with a lump or file name. While you could do one for every sprite you're replacing, what is intended is you actually have ONE image that has ALL the sprite images you are replacing. Then you follow that file name command with multiple sprite names and offsets and such. So it would look something like this
FILE_NAME="sprites/new-zombie.png"
DATA_TYPE=PNG
FOFFSET=14,50
SOFFSET=0,0
SSIZE=28,52
SPRITE_NAME="POSSA0"
SOFFSET=28,0
SPRITE_NAME="POSSA1"
SOFFSET=56,0
SPRITE_NAME="POSSA2"
and so on.
The FOFFSET sets the position of the foot inside the sprite rectangle.
The SSIZE sets how big that rectangle is, and SOFFSET tells where the rectangle is inside the main image.
If fields don't change (like FOFFSET and SSIZE in the example), you don't need to include them. Only fields that change need to be specified. Each time it encounters a sprite name, it uses all the currently set info to set
the sprite info the game uses. You can change all the data, or none (for identical sprites), between sprite names.
Of course, PNGs can just as well have their offsets defined by the internal grAb chunk, like Slade offers.If you just wish to change some attributes of existing sprites, you'd do so like this
SOFFSET=0,0
SSIZE=34,48
FOFFSET=17,40
LUMP_NAME="CSAWA1"
FOFFSET=19,40
LUMP_NAME="CSAWA2A8"
and so on. The lump names would be the already existing lump names, the soffset would always be 0,0, and the ssize would be the same as it already is. Then you would simply keep changing the foot offset for each lump... and the size if it also changes.
So, what do you all think? This system was very much needed, so we have to thank ChillyWilly for taking time to write it all out.
After that is finished, I will document it in the DDF/Wiki formats. Terrain.ddf will come shortly after.