public static void Write(this Stream IO, ref AetObject Anim, ref List <int> NullValPointers) { if (Anim.Type == ObjType.Pic) { if (Anim.Pic.Value.Marker.Count > 0) { Anim.Pic.Value.Marker.Offset = IO.Position; for (int i = 0; i < Anim.Pic.Value.Marker.Count; i++) { IO.Write(0L); } } IO.Write(ref Anim.Pic.Value.Data, ref NullValPointers); } else if (Anim.Type == ObjType.Aif) { IO.Write(ref Anim.Aif); } else if (Anim.Type == ObjType.Eff) { if (Anim.Eff.Value.Marker.Count > 0) { Anim.Eff.Value.Marker.Offset = IO.Position; for (int i = 0; i < Anim.Eff.Value.Marker.Count; i++) { IO.Write(0L); } } IO.Write(ref Anim.Eff.Value.Data, ref NullValPointers); } }
public static void Write(this Stream IO, ref AetObject Anim, ref int Offset) { Offset = IO.Position; IO.Write(0); IO.Write(Anim.StartTime0); IO.Write(Anim.LoopDuration); IO.Write(Anim.StartTime1); IO.Write(Anim.PlaybackSpeed); IO.Write(Anim.Unk0); IO.Write(Anim.Unk1); IO.Write(Anim.Unk2); IO.Write((byte)Anim.Type); if (Anim.Type == ObjType.Pic) { Anim.Pic.Offset = IO.Position; IO.Write(0L); if (Anim.Pic.Value.Marker.Count > 0) { IO.Write(Anim.Pic.Value.Marker.Count); IO.Write(Anim.Pic.Value.Marker.Offset); } else { IO.Write(0L); } IO.Write(Anim.Pic.Value.Data.Offset); IO.Write(0); } else if (Anim.Type == ObjType.Aif) { Anim.Aif.Offset = IO.Position; IO.Write(Anim.Aif.Value.Value.Offset); IO.Write(0L); IO.Write(0L); IO.Write(Anim.Aif.Value.Pointer); } else if (Anim.Type == ObjType.Eff) { Anim.Eff.Offset = IO.Position; IO.Write(0L); if (Anim.Eff.Value.Marker.Count > 0) { IO.Write(Anim.Eff.Value.Marker.Count); IO.Write(Anim.Eff.Value.Marker.Offset); } else { IO.Write(0L); } IO.Write(Anim.Eff.Value.Data.Offset); IO.Write(0); } else { IO.Write(0L); IO.Write(0L); IO.Write(0L); } }
public static AetObject ReadAetObject(this Stream IO) { AetObject Anim = new AetObject() { Offset = IO.Position }; Anim.Name = IO.ReadPointerString(); Anim.StartTime0 = IO.ReadSingle(); Anim.LoopDuration = IO.ReadSingle(); Anim.StartTime1 = IO.ReadSingle(); Anim.PlaybackSpeed = IO.ReadSingle(); Anim.Unk0 = IO.ReadByte(); Anim.Unk1 = IO.ReadByte(); Anim.Unk2 = IO.ReadByte(); Anim.Type = (AetObject.ObjType)IO.ReadByte(); if (Anim.Type == AetObject.ObjType.Pic) { Anim.Pic = new Pointer <AetObject.Picture> { Offset = IO.Position, Value = new AetObject.Picture { SpriteEntryID = IO.ReadInt32(), ParentObjectID = IO.ReadInt32(), Marker = IO.ReadCountPointer <Marker>() } }; ref AetObject.Picture Pic = ref Anim.Pic.Value; Pic.Data.Offset = IO.ReadInt32(); IO.ReadAnimData(ref Pic.Data); IO.Position = Pic.Marker.Offset; for (int i = 0; i < Pic.Marker.Count; i++) { Pic.Marker[i] = new Marker() { Frame = IO.ReadSingle(), Name = IO.ReadPointerStringShiftJIS() } } ; }
public static int ReadAetObject(this Stream IO, ref Dictionary <int, AetObject> ObjectsDict) { AetObject Anim = new AetObject(); int AnimOffset = IO.Position; if (ObjectsDict.ContainsKey(AnimOffset)) { return(AnimOffset); } Anim.Name = IO.ReadPointerString(); Anim.StartTime0 = IO.ReadSingle(); Anim.LoopDuration = IO.ReadSingle(); Anim.StartTime1 = IO.ReadSingle(); Anim.PlaybackSpeed = IO.ReadSingle(); Anim.Unk0 = IO.ReadByte(); Anim.Unk1 = IO.ReadByte(); Anim.Unk2 = IO.ReadByte(); Anim.Type = (ObjType)IO.ReadByte(); if (Anim.Type == ObjType.Pic) { Anim.Pic = IO.ReadPic(ref ObjectsDict); } else if (Anim.Type == ObjType.Aif) { Anim.Aif = IO.ReadAif(); } else if (Anim.Type == ObjType.Eff) { Anim.Eff = IO.ReadEff(ref ObjectsDict); } IO.Position = AnimOffset + 0x30; if (!ObjectsDict.ContainsKey(AnimOffset)) { ObjectsDict.Add(AnimOffset, Anim); } return(AnimOffset); }