@@ -29,6 +29,17 @@ public void RecalcSectionSize()
2929 }
3030 new_size += 12 ;
3131 SectionSize = new_size ;
32+
33+ // Recalc second section size
34+ new_size = 2 ; // motions count ( short )
35+
36+ foreach ( AnimationParams anim in AnimsParams )
37+ new_size += ( uint ) anim . Size ( bone_cont . OGF_V ) ;
38+
39+ new_size += ( uint ) bone_cont . Size ( ) ;
40+
41+ bone_cont . SectionSize = new_size ;
42+
3243 }
3344
3445 public void RecalcAnimNum ( )
@@ -45,8 +56,16 @@ public void RecalcAllAnimIndex()
4556 anm . MotionID = i ;
4657 i ++ ;
4758 }
59+ i = 1 ;
60+ foreach ( AnimVector anm in Anims )
61+ {
62+ anm . SectionId = i ;
63+ i ++ ;
64+ }
4865 }
4966
67+
68+
5069 public BoneContainer bone_cont ;
5170
5271 public void AddAnim ( AnimVector vector )
@@ -142,12 +161,28 @@ public class BoneParts
142161 public short Count ;
143162
144163 public List < BoneVector > bones = new List < BoneVector > ( ) ;
164+
165+ public int Size ( )
166+ {
167+ int new_size = 0 ;
168+ foreach ( BoneVector bone in bones )
169+ {
170+ new_size += bone . Size ( ) ;
171+ }
172+
173+ return new_size + Name . Length + 3 ;
174+ }
145175 }
146176
147177 public class BoneVector
148178 {
149179 public string Name ;
150180 public uint ID ;
181+
182+ public int Size ( )
183+ {
184+ return Name . Length + 5 ;
185+ }
151186 }
152187
153188 public class BoneContainer
@@ -157,6 +192,17 @@ public class BoneContainer
157192 public short OGF_V ;
158193 public short Count ;
159194
195+ public int Size ( )
196+ {
197+ int new_size = 0 ;
198+ foreach ( BoneParts bonesparts in parts )
199+ {
200+ new_size += bonesparts . Size ( ) ;
201+ }
202+
203+ return new_size + 4 ;
204+ }
205+
160206 public List < BoneParts > parts = new List < BoneParts > ( ) ;
161207
162208 public BoneContainer ( BinaryReader reader , OMFEditor editor )
@@ -264,6 +310,18 @@ public class AnimationParams
264310 public float Falloff { get ; set ; }
265311 public int MarksCount { get ; set ; }
266312
313+ public int Size ( short motion_version )
314+ {
315+ int new_size = 0 ;
316+
317+ if ( motion_version == 4 )
318+ {
319+ new_size += ( 8 * MarksCount ) + 4 ;
320+ }
321+
322+ return new_size + Name . Length + 25 ;
323+ }
324+
267325 public List < MotionMark > m_marks ; // = new List<MotionMark>();
268326
269327 public AnimationParams ( BinaryReader reader , OMFEditor editor , short motion_version )
0 commit comments