public Frame GetFrame(IAnimationOwner owner, int BodyID, int ActionID, int Direction, int Frame, int xCenter, int yCenter, IHue h, ref int TextureX, ref int TextureY, bool preserveHue) { Frames animation; if (BodyID <= 0) { return(Frame.Empty); } this.m_Action = ActionID; Direction &= 7; int direction = Direction; if (Direction > 4) { direction -= (Direction - 4) * 2; } this.Translate(ref BodyID, ref h); this.m_BodyID = BodyID; int realID = this.GetRealIDNoMap(BodyID, ActionID, direction); if ((realID < 0) || (realID >= this.m_Count)) { return(Frame.Empty); } if (owner == null) { animation = h.GetAnimation(realID); } else { animation = owner.GetOwnedFrames(h, realID); } if ((Frame >= animation.FrameCount) || (Frame < 0)) { return(Frame.Empty); } Frame frame = animation.FrameList[Frame]; if (((frame != null) && (frame.Image != null)) && !frame.Image.IsEmpty()) { if (Direction > 4) { TextureX = xCenter + (frame.CenterX - frame.Image.Width); } else { TextureX = xCenter - frame.CenterX; } TextureY = (yCenter - frame.Image.Height) - frame.CenterY; } frame.Image.Flip = Direction > 4; return(frame); }
public Frame GetFrame(IAnimationOwner owner, int BodyID, int ActionID, int Direction, int Frame, int xCenter, int yCenter, IHue h, ref int TextureX, ref int TextureY, bool preserveHue) { Frames animation; if (BodyID <= 0) { return Frame.Empty; } this.m_Action = ActionID; Direction &= 7; int direction = Direction; if (Direction > 4) { direction -= (Direction - 4) * 2; } this.Translate(ref BodyID, ref h); this.m_BodyID = BodyID; int realID = this.GetRealIDNoMap(BodyID, ActionID, direction); if ((realID < 0) || (realID >= this.m_Count)) { return Frame.Empty; } if (owner == null) { animation = h.GetAnimation(realID); } else { animation = owner.GetOwnedFrames(h, realID); } if ((Frame >= animation.FrameCount) || (Frame < 0)) { return Frame.Empty; } Frame frame = animation.FrameList[Frame]; if (((frame != null) && (frame.Image != null)) && !frame.Image.IsEmpty()) { if (Direction > 4) { TextureX = xCenter + (frame.CenterX - frame.Image.Width); } else { TextureX = xCenter - frame.CenterX; } TextureY = (yCenter - frame.Image.Height) - frame.CenterY; } frame.Image.Flip = Direction > 4; return frame; }