void AddFadingAnimations()
        {
            foreach (int chrID in Mod.Characters.Keys)
            {
                if (chrID == 0)
                {
                    continue;
                }

                TAE           enemyTAE = Mod[chrID].GetTAE(chrID);
                TAE.Animation standing = enemyTAE.Animations[0];

                TAE.Animation fadeIn = new TAE.Animation(10, standing.MiniHeader, standing.AnimFileName);
                fadeIn.CloneReference(standing, 0, true);
                TAE.Event fadeInEvent = new TAE.Event(0.0f, 2.0f, 193, 0, false, DS1[0][193]);
                fadeInEvent.Parameters["GhostVal1"] = 0.0f;
                fadeInEvent.Parameters["GhostVal2"] = 1.0f;
                fadeIn.Events.Add(fadeInEvent);
                enemyTAE.Animations.Add(fadeIn);

                TAE.Animation fadeOut = new TAE.Animation(11, standing.MiniHeader, standing.AnimFileName);
                fadeOut.CloneReference(standing, 0, true);
                TAE.Event fadeOutEvent = new TAE.Event(0.0f, 2.0f, 193, 0, false, DS1[0][193]);
                fadeOutEvent.Parameters["GhostVal1"] = 1.0f;
                fadeOutEvent.Parameters["GhostVal2"] = 0.0f;
                TAE.Event invisibleEvent = new TAE.Event(2.0f, 10.0f, 193, 0, false, DS1[0][193]);
                invisibleEvent.Parameters["GhostVal1"] = 0.0f;
                invisibleEvent.Parameters["GhostVal2"] = 0.0f;
                fadeOut.Events.Add(fadeOutEvent);
                fadeOut.Events.Add(invisibleEvent);
                enemyTAE.Animations.Add(fadeOut);
            }
        }
 public static void ApplyRounding(this TAE.Event ev)
 {
     if (Main.TAE_EDITOR.Config.EnableSnapTo30FPSIncrements)
     {
         ev.StartTime = ev.GetStartTimeFr();
         ev.EndTime   = ev.GetEndTimeFr();
     }
 }
Exemple #3
0
        public static TaeEditAnimEventBox ClipToEvent(TaeEditAnimEventGraph graph, Clip c, bool isBigEndian)
        {
            var newEvent    = new TAE.Event(c.EventStartTime, c.EventEndTime, c.EventType, c.EventUnk04, c.EventParamBytes, isBigEndian);
            var newEventBox = new TaeEditAnimEventBox(graph, newEvent);

            newEventBox.Row = c.EventRow;
            return(newEventBox);
        }
 /// <summary>
 /// Removes and returns the nth occurance of the specified event type in the animation.
 /// </summary>
 public static Event RemoveEvent(this Animation anim, int id, int n = 0)
 {
     TAE.Event evt = anim.FindEvent(id, n);
     if (evt != null)
     {
         anim.Events.Remove(evt);
     }
     return(evt);
 }
 /// <summary>
 /// Removes and returns the nth occurance of a jumptable entry with the specified value in the animation.
 /// </summary>
 public static Event RemoveJumpTable(this Animation anim, int id, int n = 0, bool setValue = false)
 {
     TAE.Event evt = anim.FindJumpTable(id, n, setValue);
     if (evt != null)
     {
         anim.Events.Remove(evt);
     }
     return(evt);
 }
        public NPCAnimationInfo(TAE.Animation anim, int characterID, SoulsMod mod)
        {
            ChrHandler chrHandler = mod[characterID];

            if (chrHandler.ID == 0)
            {
                throw new ArgumentException("`NPCAnimationInfo` must receive a non-player `chrHandler`.");
            }
            InvokeAttackEvent     = anim.FindEvent(1);
            AllInvokeAttackEvents = new List <TAE.Event>(anim.Events.Where(e => e.Type == 1));
            InvokeBulletEvent     = anim.FindEvent(2);
            AllInvokeBulletEvents = new List <TAE.Event>(anim.Events.Where(e => e.Type == 2));
            PushEvent             = anim.FindEvent(307);

            CurrentAnim = anim;
            Mod         = mod;

            IsDeath = anim.FindJumpTable(12) != null;
            IsMove  = anim.InRange(200, 599);
            IsDash  = DashIds.Contains(anim.ID);
            IsThrow = chrHandler.ThrowAnimIds.Contains((int)anim.ID);
            HasInvokeBehaviorEvent = InvokeAttackEvent != null || InvokeBulletEvent != null || PushEvent != null;
            IsInjury = anim.InRange(2000, 2299);

            TAE.Event animationCancelEvent = anim.FindJumpTable(86);
            if (animationCancelEvent != null)
            {
                AnimationCancelEventEnd = animationCancelEvent.EndTime;
            }

            if (AllInvokeAttackEvents.Count != 0)
            {
                foreach (var invokeAttackEvent in AllInvokeAttackEvents)
                {
                    int  behaviorSubId   = Convert.ToInt32(invokeAttackEvent.Parameters["BehaviorSubID"]);
                    long behaviorParamId = 200000000 + 10000 * chrHandler.ID + behaviorSubId;
                    AllAttackBehaviorParamIds.Add(behaviorParamId);
                }
                AttackBehaviorParamId = AllAttackBehaviorParamIds[0];
            }

            if (AllInvokeBulletEvents.Count != 0)
            {
                foreach (var invokeBulletEvent in AllInvokeBulletEvents)
                {
                    int  behaviorSubId   = Convert.ToInt32(invokeBulletEvent.Parameters["BehaviorSubID"]);
                    long behaviorParamId = 200000000 + 10000 * chrHandler.ID + behaviorSubId;
                    AllBulletBehaviorParamIds.Add(behaviorParamId);
                    int behaviorDummyPolyId = Convert.ToInt32(invokeBulletEvent.Parameters["DummyPolyID"]);
                    AllBulletDummyPolyIds.Add(behaviorDummyPolyId);
                }
                BulletBehaviorParamId = AllBulletBehaviorParamIds[0];
                BulletDummyPolyId     = AllBulletDummyPolyIds[0];
            }
        }
        public static void ApplyRounding(this TAE.Event ev)
        {
            ev.StartTime = ev.GetStartTimeFr();
            ev.EndTime   = ev.GetEndTimeFr();

            if (Main.TAE_EDITOR.Config.EventSnapType == TaeConfigFile.EventSnapTypes.FPS30)
            {
                ev.EndTime = (float)Math.Max(ev.EndTime, ev.StartTime + TAE_FRAME_30);
            }
            else if (Main.TAE_EDITOR.Config.EventSnapType == TaeConfigFile.EventSnapTypes.FPS60)
            {
                ev.EndTime = (float)Math.Max(ev.EndTime, ev.StartTime + TAE_FRAME_60);
            }
            else
            {
                ev.EndTime = (float)Math.Max(ev.EndTime, ev.StartTime + 0.001f);
            }
        }
        void AddFadingAnimations()
        {
            TAE.Animation standing = Mod.Player.TAEs[0].tae.Animations[0];

            TAE.Animation fadeIn = new TAE.Animation(10, standing.MiniHeader, standing.AnimFileName);
            fadeIn.CloneReference(standing, 0, true);
            TAE.Event fadeInEvent = new TAE.Event(0.0f, 2.0f, 193, 0, false, DS1[0][193]);
            fadeInEvent.Parameters["GhostVal1"] = 0.0f;
            fadeInEvent.Parameters["GhostVal2"] = 1.0f;
            fadeIn.Events.Add(fadeInEvent);
            Mod.Player.TAEs[0].tae.Animations.Add(fadeIn);

            TAE.Animation fadeOut = new TAE.Animation(11, standing.MiniHeader, standing.AnimFileName);
            fadeOut.CloneReference(standing, 0, true);
            TAE.Event fadeOutEvent = new TAE.Event(0.0f, 2.0f, 193, 0, false, DS1[0][193]);
            fadeOutEvent.Parameters["GhostVal1"] = 1.0f;
            fadeOutEvent.Parameters["GhostVal2"] = 0.0f;
            TAE.Event invisibleEvent = new TAE.Event(2.0f, 10.0f, 193, 0, false, DS1[0][193]);
            invisibleEvent.Parameters["GhostVal1"] = 0.0f;
            invisibleEvent.Parameters["GhostVal2"] = 0.0f;
            fadeOut.Events.Add(fadeOutEvent);
            fadeOut.Events.Add(invisibleEvent);
            Mod.Player.TAEs[0].tae.Animations.Add(fadeOut);
        }
        //public static int GetStartFrame(this TAE.Event ev, double frameDuration)
        //{
        //    return (int)Math.Floor(ev.StartTime / frameDuration);
        //}

        //public static int GetEndFrame(this TAE.Event ev, double frameDuration)
        //{
        //    return (int)Math.Floor(ev.EndTime / frameDuration);
        //}

        //public static int GetStartTAEFrame(this TAE.Event ev)
        //{
        //    return (int)Math.Floor(ev.StartTime / TAE_FRAME);
        //}

        //public static int GetEndTAEFrame(this TAE.Event ev)
        //{
        //    return (int)Math.Floor(ev.EndTime / TAE_FRAME);
        //}

        public static float GetEndTimeFr(this TAE.Event ev)
        {
            return(RoundTimeToCurrentSnapInterval(ev.EndTime));
        }
 public static float GetEndTimeFr(this TAE.Event ev)
 {
     return(RoundTimeToFrame(ev.EndTime));
 }
 public static float GetEndTimeFr(this TAE.Event ev)
 {
     return(Main.TAE_EDITOR.Config.EnableSnapTo30FPSIncrements
         ? RoundTimeToFrame(ev.EndTime, TAE_FRAME) : ev.EndTime);
 }
 public static int GetEndTAEFrame(this TAE.Event ev)
 {
     return((int)Math.Round(ev.EndTime / TAE_FRAME));
 }
 public static int GetEndFrame(this TAE.Event ev, double frameDuration)
 {
     return((int)Math.Round(ev.EndTime / frameDuration));
 }
 public static float GetRealEventEndTime(TAE.Animation animation, TAE.Event taeEvent, Dictionary <int, float> speedEffects)
 {
     return(GetRealTAETime(animation, taeEvent.EndTime, speedEffects));
 }