2010-09-13, 07:36 PM
I just came across this thread.
I just felt it was necessary to explain what a .cp is. Frankly I'm not sure how ML could've achieved any of the stated results by monkeying with .cp files. Except for maybe the shadow being able to be manipulated. But even that might have unwelcome side effects.
The name .cp comes presumably from "control points" and that is because that is what the entire file is. A) there is no original information in the file. It's simply a cache of calculated data derived from the .mdl file. It's cached so the control points can be easily queried during animation playback.
Basically the file is simply a snapshot of each control points per the sum of the number of frames in all animations. If you don't have the exact number of animations in the file as the .mdl file all with the exact number of frames, you're going to run into problems. You could in theory add control points which are not in the mdl file, but it's easier to not do that!!
Changing the data in the file after the top section which maps out the file, assuming you don't corrupt the 32bit floating point triplets formatting is only going to change the location of the control points at any instance of a given animation.
All cp files have one control point... even if it's not in the mdl file. It defaults to (0,0,0) of the root node. This is also presumably the center of the shadow. When an animation moves off its center... eg. while walking, this control point should follow. It's basically how Som tracks movement. So if you tried to move the shadow this way I'm guessing you'd also move the monster relative to it's center. But I don't know this for sure/could be wrong. It might only be a shadow, but I doubt it. Because the only other reference point would be (0,0,0) of the root node and that's just not accurate.
The remainder of the control points for monsters anyway seems to come in pairs that trace a line, usually from the base of a weapon (or claw for example) to the tip. They also form "guns" from which magic spell are fired. These are red in mdl files. There are a number of monsters without any of these. I can only guess that the prf file chooses a node to represent a weapon or the entire monster becomes a weapon during its attack animation. My guess is without the red cp setups for a weapon multi-hit attacks are not possible.
Another type of control point (blue) appears at the bottom of monsters feet. These might've been there so to eventually implement inverse kinematics (walking up hills realistically) but where never used and are filtered out of .cp files so not to waste space.
The root control point (cyan) generally appears in soft animation files because they don't have nodes to delineate them so to speak, and it just sets the center/ground level of the monster/npc. This is the only control point an NPC might have afaik.
There may be other control point types for doors. I can't think of anything else off the top of my head, other than the "black arrow" John mentions in another thread for controlling texture animations (in a mdo file I think)
If you are choosing the colour of your control points. For the reds, the green channel sets their order. I don't know if it's important, but for the first one in the .cp file it will be pure red in the .mdl file. And the next will be red plus 1 green, and so on. My guess is save for the root cp, the cps are sorted by their hexadecimal codes (like in html) ie. FF0000 for red, or 255.000.000 ... so it is FF0100 (or 255.001.000) is higher.
Anyway, that's literally all there is to a .cp file.
I just felt it was necessary to explain what a .cp is. Frankly I'm not sure how ML could've achieved any of the stated results by monkeying with .cp files. Except for maybe the shadow being able to be manipulated. But even that might have unwelcome side effects.
The name .cp comes presumably from "control points" and that is because that is what the entire file is. A) there is no original information in the file. It's simply a cache of calculated data derived from the .mdl file. It's cached so the control points can be easily queried during animation playback.
Basically the file is simply a snapshot of each control points per the sum of the number of frames in all animations. If you don't have the exact number of animations in the file as the .mdl file all with the exact number of frames, you're going to run into problems. You could in theory add control points which are not in the mdl file, but it's easier to not do that!!
Changing the data in the file after the top section which maps out the file, assuming you don't corrupt the 32bit floating point triplets formatting is only going to change the location of the control points at any instance of a given animation.
All cp files have one control point... even if it's not in the mdl file. It defaults to (0,0,0) of the root node. This is also presumably the center of the shadow. When an animation moves off its center... eg. while walking, this control point should follow. It's basically how Som tracks movement. So if you tried to move the shadow this way I'm guessing you'd also move the monster relative to it's center. But I don't know this for sure/could be wrong. It might only be a shadow, but I doubt it. Because the only other reference point would be (0,0,0) of the root node and that's just not accurate.
The remainder of the control points for monsters anyway seems to come in pairs that trace a line, usually from the base of a weapon (or claw for example) to the tip. They also form "guns" from which magic spell are fired. These are red in mdl files. There are a number of monsters without any of these. I can only guess that the prf file chooses a node to represent a weapon or the entire monster becomes a weapon during its attack animation. My guess is without the red cp setups for a weapon multi-hit attacks are not possible.
Another type of control point (blue) appears at the bottom of monsters feet. These might've been there so to eventually implement inverse kinematics (walking up hills realistically) but where never used and are filtered out of .cp files so not to waste space.
The root control point (cyan) generally appears in soft animation files because they don't have nodes to delineate them so to speak, and it just sets the center/ground level of the monster/npc. This is the only control point an NPC might have afaik.
There may be other control point types for doors. I can't think of anything else off the top of my head, other than the "black arrow" John mentions in another thread for controlling texture animations (in a mdo file I think)
If you are choosing the colour of your control points. For the reds, the green channel sets their order. I don't know if it's important, but for the first one in the .cp file it will be pure red in the .mdl file. And the next will be red plus 1 green, and so on. My guess is save for the root cp, the cps are sorted by their hexadecimal codes (like in html) ie. FF0000 for red, or 255.000.000 ... so it is FF0100 (or 255.001.000) is higher.
Anyway, that's literally all there is to a .cp file.