public override bool MouseOver(Point p) { if (BodyLibrary != null && BodyLibrary.VisiblePixel(ArmourFrame, new Point(p.X - DrawX, p.Y - DrawY), false, true)) { return(true); } if (HairType >= 0 && HairLibrary != null && HairLibrary.VisiblePixel(HairFrame, new Point(p.X - DrawX, p.Y - DrawY), false, true)) { return(true); } if (HelmetShape >= 0 && HelmetLibrary != null && HelmetLibrary.VisiblePixel(HelmetFrame, new Point(p.X - DrawX, p.Y - DrawY), false, true)) { return(true); } if (LibraryWeaponShape >= 0 && WeaponLibrary1 != null && WeaponLibrary1.VisiblePixel(WeaponFrame, new Point(p.X - DrawX, p.Y - DrawY), false, true)) { return(true); } if (LibraryWeaponShape >= 0 && WeaponLibrary2 != null && WeaponLibrary2.VisiblePixel(WeaponFrame, new Point(p.X - DrawX, p.Y - DrawY), false, true)) { return(true); } switch (CurrentAnimation) { case MirAnimation.HorseStanding: case MirAnimation.HorseWalking: case MirAnimation.HorseRunning: case MirAnimation.HorseStruck: if (HorseLibrary != null && HorseLibrary.VisiblePixel(HorseFrame, new Point(p.X - DrawX, p.Y - DrawY), false, true)) { return(true); } break; } return(false); }
public void DrawBody(bool shadow) { Surface oldSurface = DXManager.CurrentSurface; DXManager.SetSurface(DXManager.ScratchSurface); DXManager.Device.Clear(ClearFlags.Target, 0, 0, 0); DXManager.Sprite.Flush(); int l = int.MaxValue, t = int.MaxValue, r = int.MinValue, b = int.MinValue; MirImage image; switch (Direction) { case MirDirection.Up: case MirDirection.DownLeft: case MirDirection.Left: case MirDirection.UpLeft: if (!DrawWeapon) { break; } image = WeaponLibrary1?.GetImage(WeaponFrame); if (image == null) { break; } WeaponLibrary1.Draw(WeaponFrame, DrawX, DrawY, Color.White, true, 1F, ImageType.Image); l = Math.Min(l, DrawX + image.OffSetX); t = Math.Min(t, DrawY + image.OffSetY); r = Math.Max(r, image.Width + DrawX + image.OffSetX); b = Math.Max(b, image.Height + DrawY + image.OffSetY); break; default: if (!DrawWeapon) { break; } image = WeaponLibrary2?.GetImage(WeaponFrame); if (image == null) { break; } WeaponLibrary2.Draw(WeaponFrame, DrawX, DrawY, Color.White, true, 1F, ImageType.Image); l = Math.Min(l, DrawX + image.OffSetX); t = Math.Min(t, DrawY + image.OffSetY); r = Math.Max(r, image.Width + DrawX + image.OffSetX); b = Math.Max(b, image.Height + DrawY + image.OffSetY); break; } image = BodyLibrary?.GetImage(ArmourFrame); if (image != null) { BodyLibrary.Draw(ArmourFrame, DrawX, DrawY, Color.White, true, 1F, ImageType.Image); if (ArmourColour.ToArgb() != 0) { BodyLibrary.Draw(ArmourFrame, DrawX, DrawY, ArmourColour, true, 1F, ImageType.Overlay); } l = Math.Min(l, DrawX + image.OffSetX); t = Math.Min(t, DrawY + image.OffSetY); r = Math.Max(r, image.Width + DrawX + image.OffSetX); b = Math.Max(b, image.Height + DrawY + image.OffSetY); } if (HelmetShape > 0) { image = HelmetLibrary?.GetImage(HelmetFrame); if (image != null) { HelmetLibrary.Draw(HelmetFrame, DrawX, DrawY, Color.White, true, 1F, ImageType.Image); l = Math.Min(l, DrawX + image.OffSetX); t = Math.Min(t, DrawY + image.OffSetY); r = Math.Max(r, image.Width + DrawX + image.OffSetX); b = Math.Max(b, image.Height + DrawY + image.OffSetY); } } else { image = HairLibrary.GetImage(HairFrame); if (HairType > 0 && image != null) { HairLibrary.Draw(HairFrame, DrawX, DrawY, HairColour, true, 1F, ImageType.Image); l = Math.Min(l, DrawX + image.OffSetX); t = Math.Min(t, DrawY + image.OffSetY); r = Math.Max(r, image.Width + DrawX + image.OffSetX); b = Math.Max(b, image.Height + DrawY + image.OffSetY); } } switch (Direction) { case MirDirection.UpRight: case MirDirection.Right: case MirDirection.DownRight: case MirDirection.Down: if (!DrawWeapon) { break; } image = WeaponLibrary1?.GetImage(WeaponFrame); if (image == null) { break; } WeaponLibrary1.Draw(WeaponFrame, DrawX, DrawY, Color.White, true, 1F, ImageType.Image); l = Math.Min(l, DrawX + image.OffSetX); t = Math.Min(t, DrawY + image.OffSetY); r = Math.Max(r, image.Width + DrawX + image.OffSetX); b = Math.Max(b, image.Height + DrawY + image.OffSetY); break; default: if (!DrawWeapon) { break; } image = WeaponLibrary2?.GetImage(WeaponFrame); if (image == null) { break; } WeaponLibrary2.Draw(WeaponFrame, DrawX, DrawY, Color.White, true, 1F, ImageType.Image); l = Math.Min(l, DrawX + image.OffSetX); t = Math.Min(t, DrawY + image.OffSetY); r = Math.Max(r, image.Width + DrawX + image.OffSetX); b = Math.Max(b, image.Height + DrawY + image.OffSetY); break; } DXManager.SetSurface(oldSurface); float oldOpacity = DXManager.Opacity; if (shadow) { switch (CurrentAnimation) { case MirAnimation.HorseStanding: case MirAnimation.HorseWalking: case MirAnimation.HorseRunning: case MirAnimation.HorseStruck: HorseLibrary?.Draw(HorseFrame, DrawX, DrawY, Color.Black, true, 0.5F, ImageType.Shadow); break; default: DrawShadow2(l, t, r, b); break; } } if (oldOpacity != Opacity && !DXManager.Blending) { DXManager.SetOpacity(Opacity); } switch (CurrentAnimation) { case MirAnimation.HorseStanding: case MirAnimation.HorseWalking: case MirAnimation.HorseRunning: case MirAnimation.HorseStruck: switch (HorseShape) { case 0: HorseLibrary?.Draw(HorseFrame, DrawX, DrawY, Color.White, true, Opacity, ImageType.Image); break; case 1: case 2: case 3: HorseShapeLibrary?.Draw(HorseFrame, DrawX, DrawY, Color.White, true, Opacity, ImageType.Image); break; case 4: HorseShapeLibrary?.Draw(DrawFrame, DrawX, DrawY, Color.White, true, Opacity, ImageType.Image); break; case 5: HorseShapeLibrary?.Draw(DrawFrame, DrawX, DrawY, Color.White, true, Opacity, ImageType.Image); if (shadow) { HorseShapeLibrary2?.DrawBlend(DrawFrame, DrawX, DrawY, Color.White, true, Opacity, ImageType.Image); } break; } break; } DXManager.Sprite.Draw(DXManager.ScratchTexture, Rectangle.FromLTRB(l, t, r, b), Vector3.Zero, new Vector3(l, t, 0), DrawColour); CEnvir.DPSCounter++; if (oldOpacity != Opacity && !DXManager.Blending) { DXManager.SetOpacity(oldOpacity); } }