I think I understand the animation code now, and I would like to move all of the logic into PIE files.
Adding the following directives after TEXTURE:
Code: Select all
ANIM3DTRANS 375 0
EVENT 0 blderik_burning.pie
EVENT 3 blderik_explosion.pie
In ANIM3DTRANS <number> <cycles>, the <number> gives the total animation time, so frame time is that divided by the number of animation frames for the level. (The idea is that each level may have a different number of animation frames. Which is not possible currently.) The <cycles> says how many times to cycle the animation before it is stopped, or zero for infinity (a non-zero number does not make sense for normal models, at least not for now).
The EVENT <type> directive tells the code that this model supports the given event <type>, and so when that kind of event happens to a game object with this model, switch to the given model for the duration of that model's animation time times its number of cycles.
Then in each level, after POLYGONS, new optional segment:
Code: Select all
ANIMOBJECT 25
0 0 0 0 0 0 0 999 1000 1000
1 0 0 544 0 0 0 999 1000 1000
2 0 0 2056 0 0 0 999 1000 1000
3 0 0 4349 0 0 0 999 1000 1000
4 0 0 7242 0 0 0 999 1000 1000
5 0 0 10548 0 0 0 999 1000 1000
6 0 0 14085 0 0 0 999 1000 1000
7 0 0 17668 0 0 0 999 1000 1000
8 0 0 21112 0 0 0 999 1000 1000
9 0 0 24235 0 0 0 999 1000 1000
10 0 0 26851 0 0 0 999 1000 1000
11 0 0 28776 0 0 0 999 1000 1000
12 0 0 29827 0 0 0 999 1000 1000
13 0 0 29827 0 0 0 999 1000 1000
14 0 0 28776 0 0 0 999 1000 1000
15 0 0 26851 0 0 0 999 1000 1000
16 0 0 24235 0 0 0 999 1000 1000
17 0 0 21112 0 0 0 999 1000 1000
18 0 0 17668 0 0 0 999 1000 1000
19 0 0 14085 0 0 0 999 1000 1000
20 0 0 10548 0 0 0 999 1000 1000
21 0 0 7242 0 0 0 999 1000 1000
22 0 0 4349 0 0 0 999 1000 1000
23 0 0 2056 0 0 0 999 1000 1000
24 0 0 544 0 0 0 999 1000 1000
This is basically a copy and paste of the animation setup in a .ani file.
This should remove much of the hard-coded mess and all of the anim data directory files.
Looks feasible to implement, but could hit interesting challenges on the way.
Not sure how easy it would be to make our tools support this structure, though. Opinions / ideas?