1 cof have a variable amount of layers, 1 layer beeing the head, the torso, the legs, etc... There is is total of 12059 layers for all this 3512 cof.
# layers : between 1 & 11
# frame per direction : between 1 & 200
# directions : between 1 & 16
total frames of 1 cof : between 1 & 592
in the begening of the cof file, there is a byte at a value of 20 (14 in hexa). It is always this value in all the cof. Right after : 1 byte, that can be either 0 or 1. Then some values than are never the same. Then the 3 bytes right before the 1st bytes of the 9 bytes string : 1st byte is either 0, 1 or 2. The 2 bytes right after are always set to 0.
Now, the 9 bytes string ...
There is 1 string for each layer.
Byte 1 is between 0 & 15. Check composit.txt in d2data.mpq, you'll get the relation between these number and the part of the body.
Bytes 2 & 3 : between 0 & 1 (don't know what they are for)
Bytes 4 & 5 controls transparency drawins mode :
this zip make the clay golem transparent (alpha blended) just by seting this 2 bytes to 1 & 3 for all its cof). Transparency in cof is similar to the trans column in missiles.txt Seting theses bytes to 1 & 3 make the layer transparent (alpha blending is : the more dark the pixel is, the more it will be transparent, the lighter the pixel is, the more opaque it will be). Here are all the conbinations, and the number of layers in which they appeared :
0 0 : 6647 layers
0 3 : 1 layer
0 4 : 1 layer
0 5 : 4701 layers
1 0 : 9 layers
1 1 : 15 layers
1 2 : 3 layer
1 3 : 651 layers
1 4 : 1 layer
1 6 : 29 layers
Bytes 6, 7, 8 & 9 a 3-letter weapon's class code, with a zero termination.
After these 9 bytes string come some data for each [strike]layer[/strike] frames (# of bytes = # of frames per direction, NOT total amount of frames). Theses bytes range all from 0 to 3. They are use to tell for instance which is the frame that do the hit.
I'll make some .txt with all these infos, but I need to rewrite my prog before.Alkalund" wrote:In the hardcoded animation sequences in d2common.dll, there is a dword for every frame in the sequence that controls event information as well, and in there 04 is also a valid value:
00 No Event
01 Attack
02 Missile
03 Sound
04 Skill
So perhaps 04 can also be used here in the COF files. How this works is still unknown (at least to me), but perhaps in the future this may be of use somehow. My naive guess is this is tied to AI in some way.
The golem have only 1 layer, so making this Torso transparent make the whole golem to be transparent. But you can make transparent just 1 layer of 1 animation. Imagine a fire-sword, with animated flame when you swing. You can make just the sword layer alpha blended to have the darkest flame be very transparent, while the lightest flame beeing opaque. Or what about only a shield tranparent, only the armor...
EDIT : corrected an error ("After these 9 bytes string come some data for each [strike]layer[/strike] ...")
EDIT 2 : quoted Alkalund, about that tag '04' in the frame datas.
EDIT 3 : new infos about bytes 4 and 5.
Byte 4 is a boolean. 0 disable special drawing effect, non-zero (01 to FF) enable it.
if Byte 4 is enable, then byte 5 is check to know which mode will be used to draw that layer :
00 = 75 % transparency (colormaps 561-816 in a .pl2)
01 = 50 % transparency (colormaps 305-560 in a .pl2)
02 = 25 % transparency (colormaps 49-304 in a .pl2)
03 = [strike]alpha blending[/strike] screen (colormaps 817-1072 in a .pl2)
04 = luminance (colormaps 1073-1328 in a .pl2)
06 = bright alpha blending (colormaps 1457-1712 in a .pl2)
if you try to use 05 or >= 07, then it'll draw the layer normally instead, withtout any special effect.
Luminance mode works like this : the pixel of the sprite takes its luminance value from the background, hue & saturation are not changed. Now, imagine a monster that is dark when over dark flrors, and normal when on white floors... you have a Lurker that is almost invisible in dark areas, and only visible when he's in light, out of his beloved shadows.
Of course you can combine drawing mode for different layers. For instance the Arcane Teleport Pad is draw like that :
* a 75% transparency dark mask
* the red aura with alpha blending
* the stone, normal mode
The mask is usefull here to darken the background a bit before the red aura is draw over it, which makes it more visible.
EDIT 4 : 2 usefull infos but for expert only.
In fact the so-called 'alpha blending' mode is not that, but a 'screen' blending mode. I made some tests with pl2 and paint shop pro, and there's a noticable difference. So if you're the owner of Paint Shop Pro and want to reproduce the effect of "alpha blending" layer (like the red aura of the Arcane stone portal) you should avoid using a 'mask' but use the 'screen' blending mode instead, that's the closest to what D2 use.
The COF that is using the Luminance blending mode is the object 'Flies' (token FL). If you hexedit this cof and make it use 50% transparency blending mode instead, then you have 1 colormap free to your own need in the pl2... in 2D mode at least, I'm not sure if it'll work in 3D and I doubt it in fact. I'll test that later.