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; }
/// <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); } }
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(); } }
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); }
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; }
/// <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); } }
/// <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")); }
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); }
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(); } }
/// <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; }