Ultima.Animations.GetAnimLength C# (CSharp) Method

GetAnimLength() public static method

Actioncount of given Body in given anim file
public static GetAnimLength ( int body, int fileType ) : int
body int
fileType int
return int
        public static int GetAnimLength(int body, int fileType)
        {
            int length = 0;
            switch (fileType)
            {
                default:
                case 1:
                    if (body < 200)
                        length = 22; //high
                    else if (body < 400)
                        length = 13; //low
                    else
                        length = 35; //people
                    break;
                case 2:
                    if (body < 200)
                        length = 22; //high
                    else
                        length = 13; //low
                    break;
                case 3:
                    if (body < 300)
                        length = 13;
                    else if (body < 400)
                        length = 22;
                    else
                        length = 35;
                    break;
                case 4:
                    if (body < 200)
                        length = 22;
                    else if (body < 400)
                        length = 13;
                    else
                        length = 35;
                    break;
                case 5:
                    if (body < 200)
                        length = 22;
                    else if (body < 400)
                        length = 13;
                    else
                        length = 35;
                    break;
            }
            return length;
        }

Usage Example

Beispiel #1
0
        public static void LoadFromVD(int filetype, int body, BinaryReader bin)
        {
            AnimIdx[] cache = GetCache(filetype);
            FileIndex fileIndex;
            int       index;

            GetFileIndex(body, filetype, 0, 0, out fileIndex, out index);
            int animlength = Animations.GetAnimLength(body, filetype) * 5;

            Entry3D[] entries = new Entry3D[animlength];

            for (int i = 0; i < animlength; ++i)
            {
                entries[i].lookup = bin.ReadInt32();
                entries[i].length = bin.ReadInt32();
                entries[i].extra  = bin.ReadInt32();
            }

            foreach (Entry3D entry in entries)
            {
                if ((entry.lookup > 0) && (entry.lookup < bin.BaseStream.Length) && (entry.length > 0))
                {
                    bin.BaseStream.Seek(entry.lookup, SeekOrigin.Begin);
                    cache[index] = new AnimIdx(bin, entry.extra);
                }

                ++index;
            }
        }
All Usage Examples Of Ultima.Animations::GetAnimLength