Many thanks go to Isolde, Paul Siramy and Myhrginoc, in fact all I'm doing here is using the info they provided to solve our problem.
Now lets get to business; this is our feared assertion:
Code: Select all
Assertion Failure
Location : C:\Projects\Diablo2\Source\D2Client\Engine\GfxUtil.cpp, line #1352
Expression : eComponent < NUM_COMPONENTS
We then suspected it had something to do with the .cof files, but no solution could be given. Finally, Isolde enlightened us:
Assertion provided:Isolde" wrote: The blinking is probably due to incorrect frame counts in animdata.d2
Could you give me the exact assertion you get for the components thing?
And the confirmation:Alkalund" wrote: Sure, here it is:
In this thread there is info on how we currently edit the framecount in animdata.d2:Code: Select all
Assertion Failure Location : C:\Projects\Diablo2\Source\D2Client\Engine\GfxUtil.cpp, line #1352 Expression : eComponent < NUM_COMPONENTS
viewtopic.php?t=1919
Even with supposedly correct framecount editing the blinking can appear sometimes. That's why I thought maybe editing .cof files is also required for framecount editing.
Still, the fix would be more than just editing cof files. There are other .d2 files we hadn't messed with until that point, and Paul Siramy discussed about them in the following thread:Isolde" wrote: you're right about the cof files. you're getting that assertion because of a cof error.
chars_cof.d2 & cmncof_a*.cof format, & stats
Again Isolde provided crucial information here:
Ok, so here's how to get rid of this error:Isolde" wrote: The cof records in these files are pre loaded every time the game starts, so if you're changing a cof that is listed in one of these files, you should change it in the cmncof file, otherwise change the individual file.
1 - If the cof file corresponding to your animation is not listed in the cmncof_a#.d2 files (or chars_cof.d2, if you're working with character animations), edit the .cof file itself (I'll explain how later).
2 - If the cof file corresponding to your animation is is listed in the cmncof_a#.d2 files (or chars_cof.d2, if you're working with character animations), edit all cmncof_a#.d2 files that contain entries of this cof (or chars_cof.d2).
Animdata.d2 still must be edited in this method, in all cases. Also notice that for the expansion the chars_cof.d2 used is the one found in d2exp.mpq.
To show how I fixed the error, I'll give as an example my test with the walking animation of the Yeti: grab a 160-frame animation to use as the new Yeti walk animation. If you edit only animdata.d2, you will crash with our feared assertion. Ok, now open cmncof_a1.d2, and do a string search for yewlhth (and yes, it is lowercase ). You will find it. You will also find this string in cmncof_a2.d2 and cmncof_a3.d2, which means you will have to modify these 3 files.
Paul Siramy detailed the structure of the cmncof_a#.d2 files in the thread I mentioned above. I'll paste here the entry corresponding to the cof file in question, yewlhth.cof, color coding the important stuff for the fix:
EDIT: ignore the rest of this post, for it is incomplete. Read the rest of the explanation here.
FF FF FF FF 00 00 00 00 91 00 00 00 79 65 77 6C 68 74 68 00 FF FF FF FF 01 0C 08 14 01 F0 FD 7F 95 FF FF FF 37 00 00 00 9F FF FF FF 15 00 00 00 00 01 00 00 01 01 01 00 00 68 74 68 00 00 00 00 00 00 00 00 00 00 00 00 00 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
The violet byte contains the size (in bytes) of the cof file. The red byte contains the number of frames per direction of your animation. The blue section I'm not really sure how it works, it is related to layer information of your animation. In our example, we have a monster composed only of a torso, so it is going to be easy (basicaly we have the 01 byte repeated 96 times, which is the original framecount of the animation, as can be seen in the red byte).
We want the Yeti's walk animation to have 160 frames, so replace the red byte with a 14 (20 in hexadecimal), and change the blue section so it has 160 bytes in the end (again, this is only because we have a 1-part moster, for multiple part monster the number of bytes in the blue section is (total frames)*(number of parts)). Finally, you must change the violet byte so it contains the correct size for this entry; we added 64 bytes to this entry (we had 96 bytes in the blue section, wanted 160, so 160 - 96 = 64). Simply add 64 to the size entry, this should give you D1 (D1 = 91 (original) + 40 (64 in hex)). The whole changed section looks like
FF FF FF FF 00 00 00 00 D1 00 00 00 79 65 77 6C 68 74 68 00 FF FF FF FF 01 14 08 14 01 F0 FD 7F 95 FF FF FF 37 00 00 00 9F FF FF FF 15 00 00 00 00 01 00 00 01 01 01 00 00 68 74 68 00 00 00 00 00 00 00 00 00 00 00 00 00 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
This is all there is to it. If your cof file isn't mentioned in the .d2 files, edit the cof file itself.
I'm sorry if any of this sounds confusing, its 2am here and I wanted to post this before going to sleep... feel free to comment/add/correct anything
Oh, and this should fix the blinking problems as well. It is too good to believe, being able to solve both problems, after carrying them for over six months 8)
EDIT: this fix is INCOMPLETE and will NOT work. See one of my posts below for the correct solution.