Author Topic: [FF7 Batlle model] Weapons...  (Read 10145 times)

seb

  • Guest
[FF7 Batlle model] Weapons...
« on: 2007-11-17 12:45:51 »
Hi,

I subscribed so I could share some pieces of informations I didn't see mention anywhere else: How to draw weapons for battle models.
What I found is that: 2 of the unknown values of the skeleton header actually mean something :lol: and that you should not discard too quickly some of the 94 anims you found for Cloud.

So the skeleton header looks like this:

struct s_header
{
   unsigned long   u1[3];          //0
   unsigned long   bones;         //12   
   unsigned long   u2[3];          //16
   unsigned long   body_anims;    //28
    unsigned long   u3[2];          //32
    unsigned long   weapon_anims;   //40
    unsigned long   u4[2];          //44
}header;   //size is 52 bytes

body_anims is the number of animations for the body and weapon_anims is the number of animations for the weapons. So for example for Cloud (model si), you find 94 anims, with body_anims = 52 and weapon_anims = 42. Note that the 52 first anims have nb_bones = 24 (the body + 1) and the following 42 have nb_bones = 1 (the weapon) -> that fits.

So, to draw the weapon at its right place, you just have to apply the translation (found in the anim header) and the rotation found in the weapon anim (for weapon anims, do not skip the 1st bone obviously !).

It works:


Sorry if old. :-D
Seb

Borde

  • *
  • Posts: 891
    • View Profile
Re: [FF7 Batlle model] Weapons...
« Reply #1 on: 2007-11-17 13:24:31 »
Hey, that's an intersting pice of information seb. Don't know if the other knew about this, but it certainly explains some problems I had loading animations in Kimera. I'll keep in mind this information for my new version (yeah, when I finish my damn project, that is).
Thanks a lot.

seb

  • Guest
Re: [FF7 Batlle model] Weapons...
« Reply #2 on: 2007-11-26 12:27:29 »
Ok, I'm done with battle model + weapon anims. It works beautifully  8-)



Only a couple of models/anims have a problem where the weapon seems to detach from the model sometime but I'm confident it's fixable.

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
Re: [FF7 Batlle model] Weapons...
« Reply #3 on: 2007-11-29 14:54:02 »
very nice news !

can you tell us how do you decode all of the model animations ? from what I know so far, only first animation frame is decoded properly, and we don't know how to move on to next animation / where does it start.

Borde

  • *
  • Posts: 891
    • View Profile
Re: [FF7 Batlle model] Weapons...
« Reply #4 on: 2007-11-29 17:58:28 »
Well mirex, actually even I got It working on Kimera... sort of (some bone don't rotate properly). It's all explained on the wiki right now.

seb

  • Guest
Re: [FF7 Batlle model] Weapons...
« Reply #5 on: 2007-11-30 12:30:26 »
What Borde said. Most informations are on the wiki (except that of my first post) although not very well presented + I'm allergic to assembler :) Would it be possible to contribute C functions ?

Cyberman

  • *
  • Posts: 1572
    • View Profile
Re: [FF7 Batlle model] Weapons...
« Reply #6 on: 2007-11-30 22:29:45 »
Actually C would do quite well for it.
It's more portable than assembler and you can translate it to assembler without much grief (or at least I can I can't speak for other people).

Cyb

MrAdults

  • Guest
Re: [FF7 Batlle model] Weapons...
« Reply #7 on: 2007-12-04 15:03:30 »
Nice find, I still hadn't figured out what that extra animation data was for. Regarding the C-ification of those x86 functions, I generally did that work already when I was writing a FF7 battle model exporter for my own model conversion tool. Here is the code for the whole module:

http://www.telefragged.com/thefatal/other/model_ff7.cpp

The functions of importance would probably be Model_FF7_ParseAnim, Model_FF7_GetFrameOffsetDelta, Model_FF7_GetRotationDelta, and Model_FF7_ReadBits.

L. Spiro

  • *
  • Posts: 797
    • View Profile
    • http://www.memoryhacking.com/index.php
Re: [FF7 Batlle model] Weapons...
« Reply #8 on: 2007-12-25 15:13:45 »
For mirex: Battle Animations.

For the rest: The C versions of the functions are at the bottom.  Although they are named differently from the ASM versions it explains which functions are which.

Merry Christmas all.


L. Spiro

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
Re: [FF7 Batlle model] Weapons...
« Reply #9 on: 2008-01-09 08:29:10 »
Can someone show an example of the animation data file, and how do you read it ?
It would be sufficient to tell me position in the file where you find 2nd, 3rd and 4th frame ( so I can check what am I doing wrong because I can't find any frame past first one ). Thanks !

Borde

  • *
  • Posts: 891
    • View Profile
Re: [FF7 Batlle model] Weapons...
« Reply #10 on: 2008-01-18 15:41:17 »
Hope this helps you Mirex. This is what Kimera gives me when I open Hi-Res Cloud's animation pack (rtda):

Code: [Select]
anim  0
+Base offset at byte 5
 860
   -First frame at byte 22
   -Frame 2 at byte 136 (Bit 912 in the frames chunk)
   -Frame 3 at byte 175.25 (Bit 1226 in the frames chunk)
   -Frame 4 at byte 214.75 (Bit 1542 in the frames chunk)
   -Frame 5 at byte 253.625 (Bit 1853 in the frames chunk)
   -Frame 6 at byte 288.625 (Bit 2133 in the frames chunk)
   -Frame 7 at byte 323.875 (Bit 2415 in the frames chunk)
   -Frame 8 at byte 358.375 (Bit 2691 in the frames chunk)
   -Frame 9 at byte 398.5 (Bit 3012 in the frames chunk)
   -Frame 10 at byte 440.375 (Bit 3347 in the frames chunk)
   -Frame 11 at byte 480 (Bit 3664 in the frames chunk)
   -Frame 12 at byte 517.75 (Bit 3966 in the frames chunk)
   -Frame 13 at byte 557.375 (Bit 4283 in the frames chunk)
   -Frame 14 at byte 598.625 (Bit 4613 in the frames chunk)
   -Frame 15 at byte 641 (Bit 4952 in the frames chunk)
   -Frame 16 at byte 679.25 (Bit 5258 in the frames chunk)
   -Frame 17 at byte 713.375 (Bit 5531 in the frames chunk)
   -Frame 18 at byte 750.5 (Bit 5828 in the frames chunk)
   -Frame 19 at byte 792 (Bit 6160 in the frames chunk)
   -Frame 20 at byte 834.375 (Bit 6499 in the frames chunk)
anim  1
+Base offset at byte 877
 768
   -First frame at byte 894
   -Frame 2 at byte 1008 (Bit 912 in the frames chunk)
   -Frame 3 at byte 1044.25 (Bit 1202 in the frames chunk)
   -Frame 4 at byte 1080.125 (Bit 1489 in the frames chunk)
   -Frame 5 at byte 1120.375 (Bit 1811 in the frames chunk)
   -Frame 6 at byte 1157.125 (Bit 2105 in the frames chunk)
   -Frame 7 at byte 1193.25 (Bit 2394 in the frames chunk)
   -Frame 8 at byte 1228.375 (Bit 2675 in the frames chunk)
   -Frame 9 at byte 1260.875 (Bit 2935 in the frames chunk)
   -Frame 10 at byte 1289.125 (Bit 3161 in the frames chunk)
   -Frame 11 at byte 1312.375 (Bit 3347 in the frames chunk)
   -Frame 12 at byte 1336.625 (Bit 3541 in the frames chunk)
   -Frame 13 at byte 1365.375 (Bit 3771 in the frames chunk)
   -Frame 14 at byte 1398.375 (Bit 4035 in the frames chunk)
   -Frame 15 at byte 1434.125 (Bit 4321 in the frames chunk)
   -Frame 16 at byte 1470.75 (Bit 4614 in the frames chunk)
   -Frame 17 at byte 1507.625 (Bit 4909 in the frames chunk)
   -Frame 18 at byte 1548 (Bit 5232 in the frames chunk)
   -Frame 19 at byte 1583.875 (Bit 5519 in the frames chunk)
   -Frame 20 at byte 1620.5 (Bit 5812 in the frames chunk)
anim  2
+Base offset at byte 1657
 1192
   -First frame at byte 1674
   -Frame 2 at byte 1752 (Bit 624 in the frames chunk)
   -Frame 3 at byte 1795.375 (Bit 971 in the frames chunk)
   -Frame 4 at byte 1828.5 (Bit 1236 in the frames chunk)
   -Frame 5 at byte 1855.75 (Bit 1454 in the frames chunk)
   -Frame 6 at byte 1894.375 (Bit 1763 in the frames chunk)
   -Frame 7 at byte 1928.375 (Bit 2035 in the frames chunk)
   -Frame 8 at byte 1950.625 (Bit 2213 in the frames chunk)
   -Frame 9 at byte 1976.625 (Bit 2421 in the frames chunk)
   -Frame 10 at byte 2007 (Bit 2664 in the frames chunk)
   -Frame 11 at byte 2039.625 (Bit 2925 in the frames chunk)
   -Frame 12 at byte 2064 (Bit 3120 in the frames chunk)
   -Frame 13 at byte 2096.875 (Bit 3383 in the frames chunk)
   -Frame 14 at byte 2130 (Bit 3648 in the frames chunk)
   -Frame 15 at byte 2170.125 (Bit 3969 in the frames chunk)
   -Frame 16 at byte 2210.625 (Bit 4293 in the frames chunk)
   -Frame 17 at byte 2248.125 (Bit 4593 in the frames chunk)
   -Frame 18 at byte 2280.25 (Bit 4850 in the frames chunk)
   -Frame 19 at byte 2302.875 (Bit 5031 in the frames chunk)
   -Frame 20 at byte 2324 (Bit 5200 in the frames chunk)
   -Frame 21 at byte 2341.375 (Bit 5339 in the frames chunk)
   -Frame 22 at byte 2357.875 (Bit 5471 in the frames chunk)
   -Frame 23 at byte 2373.875 (Bit 5599 in the frames chunk)
   -Frame 24 at byte 2390.625 (Bit 5733 in the frames chunk)
   -Frame 25 at byte 2406.5 (Bit 5860 in the frames chunk)
   -Frame 26 at byte 2422.875 (Bit 5991 in the frames chunk)
   -Frame 27 at byte 2438.125 (Bit 6113 in the frames chunk)
   -Frame 28 at byte 2454.875 (Bit 6247 in the frames chunk)
   -Frame 29 at byte 2469.125 (Bit 6361 in the frames chunk)
   -Frame 30 at byte 2484.75 (Bit 6486 in the frames chunk)
   -Frame 31 at byte 2500.375 (Bit 6611 in the frames chunk)
   -Frame 32 at byte 2516.125 (Bit 6737 in the frames chunk)
   -Frame 33 at byte 2530.625 (Bit 6853 in the frames chunk)
   -Frame 34 at byte 2544.75 (Bit 6966 in the frames chunk)
   -Frame 35 at byte 2560.75 (Bit 7094 in the frames chunk)
   -Frame 36 at byte 2579.375 (Bit 7243 in the frames chunk)
   -Frame 37 at byte 2602.625 (Bit 7429 in the frames chunk)
   -Frame 38 at byte 2623.125 (Bit 7593 in the frames chunk)
   -Frame 39 at byte 2648.75 (Bit 7798 in the frames chunk)
   -Frame 40 at byte 2678 (Bit 8032 in the frames chunk)
   -Frame 41 at byte 2710.625 (Bit 8293 in the frames chunk)
   -Frame 42 at byte 2742 (Bit 8544 in the frames chunk)
   -Frame 43 at byte 2775.125 (Bit 8809 in the frames chunk)
   -Frame 44 at byte 2814.875 (Bit 9127 in the frames chunk)
   -Frame 45 at byte 2843.875 (Bit 9359 in the frames chunk)
anim  3
+Base offset at byte 2861
 488
   -First frame at byte 2878
   -Frame 2 at byte 2956 (Bit 624 in the frames chunk)
   -Frame 3 at byte 2986.875 (Bit 871 in the frames chunk)
   -Frame 4 at byte 3030 (Bit 1216 in the frames chunk)
   -Frame 5 at byte 3056.25 (Bit 1426 in the frames chunk)
   -Frame 6 at byte 3090.125 (Bit 1697 in the frames chunk)
   -Frame 7 at byte 3134.75 (Bit 2054 in the frames chunk)
   -Frame 8 at byte 3158.375 (Bit 2243 in the frames chunk)
   -Frame 9 at byte 3182.5 (Bit 2436 in the frames chunk)
   -Frame 10 at byte 3217.875 (Bit 2719 in the frames chunk)
   -Frame 11 at byte 3250 (Bit 2976 in the frames chunk)
   -Frame 12 at byte 3282.625 (Bit 3237 in the frames chunk)
   -Frame 13 at byte 3316.875 (Bit 3511 in the frames chunk)
   -Frame 14 at byte 3337.375 (Bit 3675 in the frames chunk)
 ...

For some reason It's very easy to mess up trying to load these animations. I supose handling bit offsets is allways quiet confusing. It took me a lot of time to get my algorithm to retrive reasonable values. If you want to check my code just tell me and I'll upload it again.