=============================================== === Final Fantasy 7 battle models structure === ======================= written by mirex ====== Final Fantasy 7 battle models are stored in file 'battle.lpg' under FF7/DATA/BATTLE directory. Data can be unpacked by my program Unmass (you can get it at my web, http://mirex.mypage.sk) or by other programs like Ficedula's LGPtools (at http://ficedula.cjb.net) Lpg file contains many small files with 4-letters long filenames. File classification can be determined by first two letters of the filename. Files with same first two letters belong to same 3d model. Files 'aa'-'of' are monster models, 'og'-'rr' are battle scenes, and 'rs'-'sm' are player models. For example files starting with 'rt' belong to Cloud's model. More info can be found in Alhexx's battle database (http://www.alhexx.com/descriptions/other/battle_database.txt) or in mine database (http://mirex.mypage.sk/FILES/monsters.txt) Every character model has around 20-40 files, depends on its complexity. File type can be determined by 3rd and 4th character of filename. Files that end with 'aa', are skeleton informations, 'ac'-'al' are textures (.TEX files) 'am'-'cj' are body parts (.P files), 'ck'-'cz' are player's weapons(.P files), 'da' are animations files. I have no idea what is inside 'ab' file. For example 'rtck' is model file which contains Cloud's first weapon, Buster sword, because 'rt' = clouds files and 'ck' = 1st weapon file. Summon models are stored similairy to battle models, but they are stored in magic.lgp, and their filenames are different. Models (P-files) have names "creature.p??" where ?? is model part number, textures have names "creature.t??", skelet info has name "creature.d" and animations are in files "creature.a??". --- file structure info --- -- 'AA' - skeleton - file consists of these parts: -- header - (see structure FF7AAheader below, 52 bytes) it is followed by bone info for each bone (FF7AAbone structure, 12 bytes each) And thats it. Nothing more there. If bone's parent is -1 then it begins at center of coordinate system. Else it is child of its parent bone //offset struct { unsigned long u1[3]; //0 unsigned long bones; //12 number of model bones unsigned long u2[3]; //16 unsigned long a; //28 unsigned long b; //32 maybe number of body part models unsigned long u3[4]; //36 } FF7AAheader; //size is 52 bytes struct { long parent; //0 index of parent bone, -1 = root node float length; //4 length of bone, always is negative. unsigned long model; //8 1=bone has body part, 0=has no body part } FF7AAbone; //size is 12 bytes -- 'DA' - animations - file consists of these parts: -- First there is 4 bytes long integer which holds number of animations in the file Then for each animation there is: FF7AAanimHdr structure (see below) and animation data (see below too) struct s_FF7AAanimHdr { unsigned long rec_a; //0 unsigned long rec_b; //4 unsigned long block_len; //8 unsigned short block_a; //12 unsigned short real_data_len; //14 unsigned short translat[3]; //16 unsigned char u1; //22 } FF7AAanimHdr; //size = 23 bytes size of animation data is ( FF7AAanimHdr.block_len - 11 ), because variables (block_a, real_data_len, translat, u1 are in it) are included in data length. animation data In the animation data there are rotation angles for each bone of the 3d model. Angles are not stored as its usual, in 4 byte floats, but in 12bit integers (that means one integer takes 1.5 byte, 3 angles (rotations for one bone) take up 4.5 bytes !). 4.5 bytes = 36 bits = 3 * 12 bits, so for example if model has 10 bones all rotations are stored in 45 bytes. 12bits can hold value from 0 to 4095. It can be translated into usual angles 0 euler = 0 degrees and 4096 euler = 360 degrees, so formula is degrees = euler * 360 / 4096 But animation data are not understood well yet, so usually only first frame and few other frames look as they should when you read them this way. example of rotation data: data in hex: DC BF FE 00 3E data in binary D C B F F E 0 0 3 E 1101 1100 1011 1111 1111 1110 0000 0000 0011 1110 | angle X | angle Y | angle Z | beginning of another rotation X Y Z DCB FFE 003 E data in decimal, euler X Y Z 3531 4094 3 data in degrees ( * 360 / 4096 ) X Y Z 310.3 359.8 0.2 thats all you need to know to read Final Fantasy 7 battle models. Other file types like .P 3d models and .TEX textures are described in other of mine documents, which can be found at my documents page. cheers mirex for you to know, Phaeron has found out how the rotation data are stored, so praise him ! mail: mirex at centrum dot sk web: http://mirex.mypage.sk