@Robert
DBC 1.20 is irritating when it comes to animations! You've done a great job with your program! Keep up the good work - and it's interface ties in quite nicely with lightning lights. In writing an animator for DBC, I decided to write my own key generator and am working on a limb angle return function that I can trust. I would recommend you do the same. It will allow you much more flexibility (though the initial work is a pain).
As far as wanting to get the parent limb? There's a secret command called CHECK LIMB LINK(obj,limb) that supposed to tell if the limb is linked in the hierarchy - don't know if it works or what it's supposed to return - but maybe you can get something from it.
You can figure out the parent-child relationships from an x file. There is a template name inside the X file called
Frame
Each frame represents an individual limb and mesh definition. You can have multiple mesh defintions without a Frame, but in that case those all add up to a single solid mesh. The trick is to go through the X file and parse out each Frame and find it's name which is defined immediately after it's declared:
Frame right_leg {
Once you find the Frame, you'll have to keep track of it's opening and closing braces. If there is another Frame contained within the frame you are currently checking, that is a child of the current frame. You'll have to do the same search on the child frame for it's beginning and ending braces.
If you store the name and/or number of each frame and whether it's a parent or a child of what frame, you'll end up with your limb heirarchy. This is where knowledge and use of strings can come in real handy.
Be careful. Sometimes in the header area of the file, the actual definitions of the template types will be present. If your search flags on a definition of the Frame type as opposed to the actual occurrence of a Frame as a container, it could throw off your results.
If you use PERFORM CHECKLIST FOR OBJECT LIMBS you can already be armed with the name of the frames. If you search through the X file for
Frame <that name> you can search upwards to see if it is contained within another frame. For that, you might want to initally load the Direct X file into an array, one string at a time so you can search forward and backward - you might also want to load it into a memblock so you can search as fine as 1 byte at a time, forward and backward. Starting with the name may allow you a dynamic method of retrieving the parent. Though I think parsing out the whole file and storing all of the parent child relationships will be better to have at hand while the program is running.
Enjoy your day.