Ejemplo n.º 1
0
        public static string GetAnimationName(EditorScope escope, VMAnimationScope scope, ushort id)
        {
            STR animTable = GetAnimTable(escope, scope);
            if (animTable == null) return "Unknown animation (bad source)";

            var animationName = animTable.GetString(id);
            return (animationName == null)?"Unknown animation #" + id:animationName;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get an animation
        /// </summary>
        /// <param name="scope"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Animation GetAnimation(VMStackFrame context, VMAnimationScope scope, ushort id)
        {
            STR  animTable = null;
            bool child     = ((VMAvatar)context.Caller).GetPersonData(VMPersonDataVariable.PersonsAge) < 18 && context.VM.TS1;

            //a2o, c2o, a2c, c2a

            switch (scope)
            {
            case VMAnimationScope.Object:
                var obj        = context.CodeOwner;
                var anitableID = (ushort)(obj.OBJ.AnimationTableID + (child ? 1 : 0));
                animTable = obj.Resource.Get <STR>(anitableID);
                if (animTable == null)
                {
                    animTable = obj.Resource.Get <STR>((ushort)(child ? 130 : 129));
                }
                break;

            case VMAnimationScope.Misc:
                animTable = context.Global.Resource.Get <STR>((ushort)(child ? 157 : 156));
                break;

            case VMAnimationScope.PersonStock:
                animTable = context.Global.Resource.Get <STR>(130);
                break;

            case VMAnimationScope.Global:
                animTable = context.Global.Resource.Get <STR>(128);
                break;

            case VMAnimationScope.StackObject:
                var obj2        = context.StackObject.Object;
                var anitableID2 = (ushort)(obj2.OBJ.AnimationTableID + (child ? 1 : 0));
                animTable = obj2.Resource.Get <STR>(anitableID2);
                if (animTable == null)
                {
                    animTable = obj2.Resource.Get <STR>((ushort)(child ? 130 : 129));
                }
                break;
            }

            if (animTable == null)
            {
                return(null);
            }

            var animationName = animTable.GetString(id);

            if (animationName != null)
            {
                return(FSO.Content.Content.Get().AvatarAnimations.Get(animationName + ".anim"));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
 public void Read(byte[] bytes)
 {
     using (var io = IoBuffer.FromBytes(bytes, ByteOrder.LITTLE_ENDIAN)){
         AnimationID        = io.ReadUInt16();
         LocalEventNumber   = io.ReadByte();
         _pad               = io.ReadByte();
         Source             = (VMAnimationScope)io.ReadByte();
         Flags              = io.ReadByte();
         ExpectedEventCount = io.ReadByte();
     }
 }
Ejemplo n.º 4
0
        public static string GetAnimationName(EditorScope escope, VMAnimationScope scope, ushort id)
        {
            STR animTable = GetAnimTable(escope, scope);

            if (animTable == null)
            {
                return("Unknown animation (bad source)");
            }

            var animationName = animTable.GetString(id);

            return((animationName == null)?"Unknown animation #" + id:animationName);
        }
Ejemplo n.º 5
0
 public static STR GetAnimTable(EditorScope escope, VMAnimationScope scope)
 {
     switch (scope)
     {
         case VMAnimationScope.Object:
             var anitableID = escope.GetOBJD().AnimationTableID;
             anitableID = 129;
             return escope.GetResource<STR>(anitableID, ScopeSource.Private);
         case VMAnimationScope.Misc:
             return EditorScope.Globals.Resource.Get<STR>(156);
         case VMAnimationScope.PersonStock:
             return EditorScope.Globals.Resource.Get<STR>(130);
         case VMAnimationScope.Global:
             return EditorScope.Globals.Resource.Get<STR>(128);
     }
     return null;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Get an animation
        /// </summary>
        /// <param name="scope"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Animation GetAnimation(VMStackFrame context, VMAnimationScope scope, ushort id)
        {
            STR animTable = null;

            switch (scope)
            {
            case VMAnimationScope.Object:
                var obj        = context.CodeOwner;
                var anitableID = obj.OBJ.AnimationTableID;
                animTable = obj.Resource.Get <STR>(anitableID);
                if (animTable == null)
                {
                    animTable = obj.Resource.Get <STR>(129);
                }
                break;

            case VMAnimationScope.Misc:
                animTable = context.Global.Resource.Get <STR>(156);
                break;

            case VMAnimationScope.PersonStock:
                animTable = context.Global.Resource.Get <STR>(130);
                break;

            case VMAnimationScope.Global:
                animTable = context.Global.Resource.Get <STR>(128);
                break;
            }

            if (animTable == null)
            {
                return(null);
            }

            var animationName = animTable.GetString(id);

            if (animationName != null)
            {
                return(FSO.Content.Content.Get().AvatarAnimations.Get(animationName + ".anim"));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Get an animation
        /// </summary>
        /// <param name="scope"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Animation GetAnimation(VMStackFrame context, VMAnimationScope scope, ushort id)
        {
            STR animTable = null;

            switch (scope)
            {
            case VMAnimationScope.Object:
                var obj        = context.Callee.Object;
                var anitableID = obj.OBJ.AnimationTableID;
                anitableID = 129;

                /*
                 * Fridge has an animtable of 0
                 * if (anitableID == 0){
                 *  return null;
                 * }*/
                //if (anitableID == 0){
                //    anitableID = 129;
                //}
                //129
                animTable = obj.Resource.Get <STR>(anitableID);
                break;

            case VMAnimationScope.Misc:
                animTable = context.Global.Resource.Get <STR>(156);
                break;

            case VMAnimationScope.PersonStock:
                animTable = context.Global.Resource.Get <STR>(130);
                break;

            case VMAnimationScope.Global:
                animTable = context.Global.Resource.Get <STR>(128);
                break;
            }

            if (animTable == null)
            {
                return(null);
            }

            var animationName = animTable.GetString(id);

            return(TSO.Content.Content.Get().AvatarAnimations.Get(animationName + ".anim"));
        }
Ejemplo n.º 8
0
        public static STR GetAnimTable(EditorScope escope, VMAnimationScope scope)
        {
            switch (scope)
            {
            case VMAnimationScope.Object:
                var anitableID = escope.GetOBJD().AnimationTableID;
                if (anitableID == 0)
                {
                    anitableID = 129;
                }
                return(escope.GetResource <STR>(anitableID, ScopeSource.Private));

            case VMAnimationScope.Misc:
                return(EditorScope.Globals.Resource.Get <STR>(156));

            case VMAnimationScope.PersonStock:
                return(EditorScope.Globals.Resource.Get <STR>(130));

            case VMAnimationScope.Global:
                return(EditorScope.Globals.Resource.Get <STR>(128));
            }
            return(null);
        }
Ejemplo n.º 9
0
 public void Read(byte[] bytes)
 {
     using (var io = IoBuffer.FromBytes(bytes, ByteOrder.LITTLE_ENDIAN)){
         AnimationID = io.ReadUInt16();
         LocalEventNumber = io.ReadByte();
         _pad = io.ReadByte();
         Source = (VMAnimationScope)io.ReadByte();
         Flags = io.ReadByte();
         ExpectedEventCount = io.ReadByte();
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Get an animation
        /// </summary>
        /// <param name="scope"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Animation GetAnimation(VMStackFrame context, VMAnimationScope scope, ushort id)
        {
            STR animTable = null;

            switch (scope){
                case VMAnimationScope.Object:
                    var obj = context.Callee.Object;
                    var anitableID = obj.OBJ.AnimationTableID;
                    anitableID = 129;
                    /*
                     * Fridge has an animtable of 0
                     * if (anitableID == 0){
                        return null;
                    }*/
                    //if (anitableID == 0){
                    //    anitableID = 129;
                    //}
                    //129
                    animTable = obj.Resource.Get<STR>(anitableID);
                    break;
                case VMAnimationScope.Misc:
                    animTable = context.Global.Resource.Get<STR>(156);
                    break;
                case VMAnimationScope.PersonStock:
                    animTable = context.Global.Resource.Get<STR>(130);
                    break;
                case VMAnimationScope.Global:
                    animTable = context.Global.Resource.Get<STR>(128);
                    break;
            }

            if (animTable == null){
                return null;
            }

            var animationName = animTable.GetString(id);
            if (animationName != null) return FSO.Content.Content.Get().AvatarAnimations.Get(animationName + ".anim");
            else return null;
        }