コード例 #1
0
        public void load(ContentReader input)
        {
            int textures_count = input.ReadInt32();
            loadTextures(input, textures_count);
            int md3_count = input.ReadInt32();
            //read md3 data
            for (int i = 0; i < md3_count; ++i)
            {
                MD3Object o = new MD3Object(TMD3Part.HEAD);
                loadMD3Data(input, o);
                if (o.part == TMD3Part.HEAD)
                    head_md3.Add(o);
                else if (o.part == TMD3Part.UPPER)
                    upper_md3.Add(o);
                else
                    lower_md3.Add(o);
            }
            Debug.Assert(head_md3.Count >= 1, "PK3 invalid format, not found head md3 file!");
            Debug.Assert(upper_md3.Count >= 1, "PK3 invalid format, not found upper md3 file!");
            Debug.Assert(lower_md3.Count >= 1, "PK3 invalid format, not found lower md3 file!");

            int anim_count = input.ReadInt32();
            for (int i = 0; i < anim_count; ++i)
            {
                MD3animation anim = new MD3animation();
                anim.strName = input.ReadString();
                anim.startFrame = input.ReadInt32();
                anim.numFrames = input.ReadInt32();
                anim.loopingFrames = input.ReadInt32();
                anim.framesPerSecond = input.ReadInt32();
                animations.Add(anim.strName, anim);
            }
        }
コード例 #2
0
 public void setAnimation(MD3animation current)
 {
     if (current != null)
     {
         current_frame = current.startFrame;
         finish_animation = false;
     }
     else
     {
         current_frame = 0;
     }
     seconds = 0.0f;
     current_animation = current;
 }
コード例 #3
0
 private void addNewAnimation(string[] s)
 {
     MD3animation anim = new MD3animation();
       int count = 0;
       for (int i = 0; i < s.Length; ++i)
       {
     if (s[i].Length > 0)
     {
       int result;
       if (int.TryParse(s[i], out result))
       {
     switch (count)
     {
       case 0:
         anim.startFrame = result;
         break;
       case 1:
         anim.numFrames = result;
         break;
       case 2:
         anim.loopingFrames = result;
         break;
       case 3:
         anim.framesPerSecond = result;
         break;
     }
     ++count;
       }
       else if (count > 3 && s[i].Length > 4 )
       {
     anim.strName = s[i];
     if (anim.strName.IndexOf("TORSO") >= 0)
     {
       torso_frames += anim.numFrames;
     }
     else if (anim.strName.IndexOf("LEGS") >= 0)
     {
       anim.startFrame -= torso_frames;
     }
     break;
       }
     }
       }
       animations_list.Add(anim);
 }