Exemple #1
0
        private void CheckForUnreferencedConstant()
        {
            TAE.AnimDataStruct animData   = tae.data.animDatas[listBox1.SelectedIndex];
            List <int>         references = new List <int> (new int [(int)animData.timeConstantsCount]);

            foreach (TAE.EventStruct Event in animData.events)
            {
                references[(int)Event.startTimeOffset / 4]++;
                references[(int)Event.endTimeOffset / 4]++;
            }

            bool l = false;
            int  i = 0;

            while (!l && i < animData.timeConstantsCount)
            {
                if (references[i] == 0)
                {
                    animData.timeConstants.Remove(animData.timeConstants[i]);
                    animData.timeConstantsCount--;

                    l = true;
                }
                else
                {
                    i++;
                }
            }

            if (l)
            {
                for (int j = 0; j < animData.eventCount; j++)
                {
                    if (animData.events[j].startTimeOffset > i * 4)
                    {
                        animData.events[j].startTimeOffset -= 4;
                    }

                    if (animData.events[j].endTimeOffset > i * 4)
                    {
                        animData.events[j].endTimeOffset -= 4;
                    }
                }
            }

            tae.data.animDatas[listBox1.SelectedIndex] = animData;
        }
Exemple #2
0
        private void AddAnim(int newId)
        {
            TAE.AnimDataStruct animData = new TAE.AnimDataStruct();
            TAE.IdStruct       id       = new TAE.IdStruct();
            TAE.GroupStruct    group    = new TAE.GroupStruct();

            animData.animFile      = new TAE.AnimFileStruct();
            animData.animFile.name = new TAE.NameStruct();

            List <byte> name = new List <byte> (Encoding.Unicode.GetBytes(Path.GetFileName(textBox1.Text).Split('.')[0] + "_" + newId.ToString().PadLeft(4, '0') + ".hkxwin"));

            name.Add(0x00);
            name.Add(0x00);

            animData.animFile.name.name = Encoding.UTF8.GetString(name.ToArray());
            animData.events             = new List <TAE.EventStruct> {
            };
            animData.timeConstants      = new List <float> {
            };

            id.id = (uint)newId;

            group.firstId = id.id;
            group.lastId  = id.id;

            tae.data.animDatas.Add(animData);
            tae.header.dataCount++;

            tae.data.ids.Add(id);
            tae.header.idCount++;

            tae.data.groups.Add(group);
            tae.data.groupCount++;

            listBox1.Items.Add(newId);
        }