private static sbyte DrawInternal ( UltimaBatcher2D batcher, Mobile owner, Item entity, int x, int y, bool mirror, sbyte frameIndex, bool hasShadow, ushort id, byte animGroup, byte dir, bool isHuman, bool isParent = true, bool isMount = false, bool forceUOP = false, float alpha = 0 ) { if (id >= Constants.MAX_ANIMATIONS_DATA_INDEX_COUNT || owner == null) { return(0); } ushort hueFromFile = _viewHue; AnimationDirection direction = AnimationsLoader.Instance.GetBodyAnimationGroup ( ref id, ref animGroup, ref hueFromFile, isParent, forceUOP ) .Direction[dir]; if (direction == null || direction.Address == -1 || direction.FileIndex == -1) { if (!(_transform && entity == null && !hasShadow)) { return(0); } } if (direction == null || (direction.FrameCount == 0 || direction.Frames == null) && !AnimationsLoader.Instance.LoadAnimationFrames(id, animGroup, dir, ref direction)) { if (!(_transform && entity == null && !hasShadow)) { return(0); } } if (direction == null) { return(0); } direction.LastAccessTime = Time.Ticks; int fc = direction.FrameCount; if (fc > 0 && frameIndex >= fc || frameIndex < 0) { frameIndex = 0; } if (frameIndex < direction.FrameCount) { AnimationFrameTexture frame = direction.Frames[frameIndex]; if (frame == null || frame.IsDisposed) { if (!(_transform && entity == null && !hasShadow)) { return(0); } goto SKIP; } frame.Ticks = Time.Ticks; if (mirror) { x -= frame.Width - frame.CenterX; } else { x -= frame.CenterX; } y -= frame.Height + frame.CenterY; SKIP: if (hasShadow) { batcher.DrawSpriteShadow(frame, x, y, mirror); } else { ushort hue = _viewHue; bool partialHue = false; if (hue == 0) { hue = entity?.Hue ?? owner.Hue; partialHue = !isMount && entity != null && entity.ItemData.IsPartialHue; if ((hue & 0x8000) != 0) { partialHue = true; hue &= 0x7FFF; } if (hue == 0) { hue = hueFromFile; if (hue == 0 && _equipConvData.HasValue) { hue = _equipConvData.Value.Color; } partialHue = false; } } ResetHueVector(); ShaderHueTranslator.GetHueVector(ref HueVector, hue, partialHue, alpha); // this is an hack to make entities partially hued. OG client seems to ignore this. /*if (entity != null && entity.ItemData.AnimID == 0 && entity.ItemData.IsLight) * { * HueVector.X = entity.Hue == 0 ? owner.Hue : entity.Hue; * HueVector.Y = ShaderHueTranslator.SHADER_LIGHTS; * HueVector.Z = alpha; * } */ if (_transform) { const float UPPER_BODY_RATIO = 0.35f; const float MID_BODY_RATIO = 0.60f; const float LOWER_BODY_RATIO = 0.94f; if (entity == null && isHuman) { int frameHeight = frame?.Height ?? 61; _characterFrameStartY = y - (frame != null ? 0 : frameHeight - SIT_OFFSET_Y); _characterFrameHeight = frameHeight; _startCharacterWaistY = (int)(frameHeight * UPPER_BODY_RATIO) + _characterFrameStartY; _startCharacterKneesY = (int)(frameHeight * MID_BODY_RATIO) + _characterFrameStartY; _startCharacterFeetY = (int)(frameHeight * LOWER_BODY_RATIO) + _characterFrameStartY; if (frame == null) { return(0); } } float h3mod = UPPER_BODY_RATIO; float h6mod = MID_BODY_RATIO; float h9mod = LOWER_BODY_RATIO; if (entity != null) { float itemsEndY = y + frame.Height; if (y >= _startCharacterWaistY) { h3mod = 0; } else if (itemsEndY <= _startCharacterWaistY) { h3mod = 1.0f; } else { float upperBodyDiff = _startCharacterWaistY - y; h3mod = upperBodyDiff / frame.Height; if (h3mod < 0) { h3mod = 0; } } if (_startCharacterWaistY >= itemsEndY || y >= _startCharacterKneesY) { h6mod = 0; } else if (_startCharacterWaistY <= y && itemsEndY <= _startCharacterKneesY) { h6mod = 1.0f; } else { float midBodyDiff; if (y >= _startCharacterWaistY) { midBodyDiff = _startCharacterKneesY - y; } else if (itemsEndY <= _startCharacterKneesY) { midBodyDiff = itemsEndY - _startCharacterWaistY; } else { midBodyDiff = _startCharacterKneesY - _startCharacterWaistY; } h6mod = h3mod + midBodyDiff / frame.Height; if (h6mod < 0) { h6mod = 0; } } if (itemsEndY <= _startCharacterKneesY) { h9mod = 0; } else if (y >= _startCharacterKneesY) { h9mod = 1.0f; } else { float lowerBodyDiff = itemsEndY - _startCharacterKneesY; h9mod = h6mod + lowerBodyDiff / frame.Height; if (h9mod < 0) { h9mod = 0; } } } batcher.DrawCharacterSitted ( frame, x, y, mirror, h3mod, h6mod, h9mod, ref HueVector ); } else if (frame != null) { batcher.DrawSprite ( frame, x, y, mirror, ref HueVector ); int yy = -(frame.Height + frame.CenterY + 3); int xx = -frame.CenterX; if (mirror) { xx = -(frame.Width - frame.CenterX); } if (xx < owner.FrameInfo.X) { owner.FrameInfo.X = xx; } if (yy < owner.FrameInfo.Y) { owner.FrameInfo.Y = yy; } if (owner.FrameInfo.Width < xx + frame.Width) { owner.FrameInfo.Width = xx + frame.Width; } if (owner.FrameInfo.Height < yy + frame.Height) { owner.FrameInfo.Height = yy + frame.Height; } } if (frame.Contains(mirror ? x + frame.Width - SelectedObject.TranslatedMousePositionByViewport.X : SelectedObject.TranslatedMousePositionByViewport.X - x, SelectedObject.TranslatedMousePositionByViewport.Y - y)) { SelectedObject.Object = owner; } if (entity != null && entity.ItemData.IsLight) { Client.Game.GetScene <GameScene>().AddLight(owner, entity, mirror ? x + frame.Width : x, y); } } return(AnimationsLoader.Instance.DataIndex[id].MountedHeightOffset); } return(0); }
//public MobileView(Mobile mobile) : base(mobile) //{ //} public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList) { if (IsDisposed) { return(false); } //mobile.AnimIndex = 0; bool mirror = false; byte dir = (byte)GetDirectionForAnimation(); FileManager.Animations.GetAnimDirection(ref dir, ref mirror); IsFlipped = mirror; SetupLayers(dir, this, out int mountOffset); if (Graphic == 0) { return(false); } AnimationFrameTexture bodyFrame = _frames[0].Hash; // FileManager.Animations.GetTexture(_frames[0].Hash); if (bodyFrame == null) { return(false); } int drawCenterY = bodyFrame.CenterY; int drawX; int drawY = mountOffset + drawCenterY + (int)(Offset.Z / 4) - 22 - (int)(Offset.Y - Offset.Z - 3); if (IsFlipped) { drawX = -22 + (int)Offset.X; } else { drawX = -22 - (int)Offset.X; } /*if (_frames[0].IsSitting) * { * int x1 = 0, y1 = 0; * FileManager.Animations.FixSittingDirection(ref dir, ref mirror, ref x1, ref y1); * }*/ FrameInfo = Rectangle.Empty; Rectangle rect = Rectangle.Empty; Hue hue = 0, targetColor = 0; if (Engine.Profile.Current.HighlightMobilesByFlags) { if (IsPoisoned) { hue = 0x0044; } if (IsParalyzed) { hue = 0x014C; } if (NotorietyFlag != NotorietyFlag.Invulnerable && IsYellowHits) { hue = 0x0030; } } bool isAttack = Serial == World.LastAttack; bool isUnderMouse = IsSelected && (TargetManager.IsTargeting || World.Player.InWarMode); bool needHpLine = false; if (this != World.Player && (isAttack || isUnderMouse || TargetManager.LastGameObject == Serial)) { targetColor = Notoriety.GetHue(NotorietyFlag); if (isAttack || this == TargetManager.LastGameObject) { Engine.UI.SetTargetLineGump(this); //if (TargetLineGump.TTargetLineGump?.Mobile != this) //{ // if (TargetLineGump.TTargetLineGump == null || TargetLineGump.TTargetLineGump.IsDisposed) // { // TargetLineGump.TTargetLineGump = new TargetLineGump(); // Engine.UI.Add(TargetLineGump.TTargetLineGump); // } // else // { // TargetLineGump.TTargetLineGump.SetMobile(this); // } //} needHpLine = true; } if (isAttack || isUnderMouse) { hue = targetColor; } } for (int i = 0; i < _layerCount; i++) { ViewLayer vl = _frames[i]; AnimationFrameTexture frame = vl.Hash; //FileManager.Animations.GetTexture(vl.Hash); if (frame.IsDisposed) { continue; } int x = drawX + frame.CenterX; int y = -drawY - (frame.Height + frame.CenterY) + drawCenterY - vl.OffsetY; int yy = -(frame.Height + frame.CenterY + 3); int xx = -frame.CenterX; if (mirror) { xx = -(frame.Width - frame.CenterX); } if (xx < rect.X) { rect.X = xx; } if (yy < rect.Y) { rect.Y = yy; } if (rect.Width < xx + frame.Width) { rect.Width = xx + frame.Width; } if (rect.Height < yy + frame.Height) { rect.Height = yy + frame.Height; } Texture = frame; Bounds = new Rectangle(x, -y, frame.Width, frame.Height); if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange) { HueVector = new Vector3(Constants.OUT_RANGE_COLOR, 1, HueVector.Z); } else if (World.Player.IsDead && Engine.Profile.Current.EnableBlackWhiteEffect) { HueVector = new Vector3(Constants.DEAD_RANGE_COLOR, 1, HueVector.Z); } else { HueVector = ShaderHuesTraslator.GetHueVector(IsHidden ? 0x038E : hue == 0 ? vl.Hue : hue, vl.IsPartial, 0, false); } base.Draw(batcher, position, objectList); Pick(frame, Bounds, position, objectList); } FrameInfo.X = Math.Abs(rect.X); FrameInfo.Y = Math.Abs(rect.Y); FrameInfo.Width = FrameInfo.X + rect.Width; FrameInfo.Height = FrameInfo.Y + rect.Height; //if (needHpLine) //{ // //position.X += Engine.Profile.Current.GameWindowPosition.X + 9; // //position.Y += Engine.Profile.Current.GameWindowPosition.Y + 30; // //TargetLineGump.TTargetLineGump.X = (int)(position.X /*+ 22*/ + Offset.X); // //TargetLineGump.TTargetLineGump.Y = (int)(position.Y /*+ 22 + (mobile.IsMounted ? 22 : 0) */+ Offset.Y - Offset.Z - 3); // //TargetLineGump.TTargetLineGump.BackgroudHue = targetColor; // //if (IsPoisoned) // // TargetLineGump.TTargetLineGump.HpHue = 63; // //else if (IsYellowHits) // // TargetLineGump.TTargetLineGump.HpHue = 53; // //else // // TargetLineGump.TTargetLineGump.HpHue = 90; // Engine.UI.SetTargetLineGumpHue(targetColor); //} //if (_edge == null) //{ // _edge = new Texture2D(batcher.GraphicsDevice, 1, 1); // _edge.SetData(new Color[] { Color.LightBlue }); //} //batcher.DrawRectangle(_edge, GetOnScreenRectangle(), Vector3.Zero); Engine.DebugInfo.MobilesRendered++; return(true); }
public static bool IsPointInMobile(Mobile mobile, int xx, int yy) { bool mirror = false; byte dir = (byte)mobile.GetDirectionForAnimation(); FileManager.Animations.GetAnimDirection(ref dir, ref mirror); sbyte animIndex = mobile.AnimIndex; for (int i = -2; i < Constants.USED_LAYER_COUNT; i++) { Layer layer = i == -2 ? Layer.Invalid : i == -1 ? Layer.Mount : LayerOrder.UsedLayers[dir, i]; ushort graphic; if (layer == Layer.Invalid) { graphic = mobile.GetGraphicForAnimation(); } else if (mobile.HasEquipment) { Item item = mobile.Equipment[(int)layer]; if (item == null) { continue; } if (layer == Layer.Mount) { graphic = item.GetGraphicForAnimation(); } else if (item.ItemData.AnimID != 0) { if (Mobile.IsCovered(mobile, layer)) { continue; } graphic = item.ItemData.AnimID; if (FileManager.Animations.EquipConversions.TryGetValue(mobile.Graphic, out Dictionary <ushort, EquipConvData> map)) { if (map.TryGetValue(item.ItemData.AnimID, out EquipConvData data)) { graphic = data.Graphic; } } } else { continue; } } else { continue; } byte animGroup = Mobile.GetGroupForAnimation(mobile, graphic, layer == Layer.Invalid); ushort hue = 0; ref var direction = ref FileManager.Animations.GetBodyAnimationGroup(ref graphic, ref animGroup, ref hue, true).Direction[dir]; FileManager.Animations.AnimID = graphic; FileManager.Animations.AnimGroup = animGroup; FileManager.Animations.Direction = dir; if ((direction.FrameCount == 0 || direction.Frames == null) && !FileManager.Animations.LoadDirectionGroup(ref direction)) { continue; } int fc = direction.FrameCount; if (fc != 0 && animIndex >= fc) { animIndex = 0; } if (animIndex < direction.FrameCount) { AnimationFrameTexture frame = direction.Frames[animIndex]; if (frame == null || frame.IsDisposed) { continue; } int drawX; int drawCenterY = frame.CenterY; int yOff = ((int)mobile.Offset.Z >> 2) - 22 - (int)(mobile.Offset.Y - mobile.Offset.Z - 3); int drawY = drawCenterY + yOff; if (mirror) { drawX = -22 + (int)mobile.Offset.X; } else { drawX = -22 - (int)mobile.Offset.X; } int x = drawX + frame.CenterX; int y = -drawY - (frame.Height + frame.CenterY) + drawCenterY; if (mirror) { x = xx + x + 44 - TranslatedMousePositionByViewport.X; } else { x = TranslatedMousePositionByViewport.X - xx + x; } y = TranslatedMousePositionByViewport.Y - yy - y; if (frame.Contains(x, y)) { return(true); } } }
private bool DrawCorpse(Batcher2D batcher, Vector3 position, MouseOverList objectList) { if (GameObject.IsDisposed) { return(false); } Item item = (Item)GameObject; byte dir = (byte)((byte)item.Layer & 0x7F & 7); bool mirror = false; FileManager.Animations.GetAnimDirection(ref dir, ref mirror); IsFlipped = mirror; FileManager.Animations.Direction = dir; byte animIndex = (byte)GameObject.AnimIndex; for (int i = 0; i < Constants.USED_LAYER_COUNT; i++) { Layer layer = LayerOrder.UsedLayers[dir, i]; if (layer == Layer.Mount) { continue; } Graphic graphic; Hue color; if (layer == Layer.Invalid) { graphic = item.GetGraphicForAnimation(); //graphic = item.DisplayedGraphic; FileManager.Animations.AnimGroup = FileManager.Animations.GetDieGroupIndex(item.GetGraphicForAnimation(), item.UsedLayer); color = GameObject.Hue; } else { Item itemEquip = item.Equipment[(int)layer]; if (itemEquip == null) { continue; } graphic = itemEquip.ItemData.AnimID; if (FileManager.Animations.EquipConversions.TryGetValue(itemEquip.Graphic, out Dictionary <ushort, EquipConvData> map)) { if (map.TryGetValue(itemEquip.ItemData.AnimID, out EquipConvData data)) { graphic = data.Graphic; } } color = itemEquip.Hue; } FileManager.Animations.AnimID = graphic; ref AnimationDirection direction = ref FileManager.Animations.DataIndex[FileManager.Animations.AnimID].Groups[FileManager.Animations.AnimGroup].Direction[FileManager.Animations.Direction]; if ((direction.FrameCount == 0 || direction.FramesHashes == null) && !FileManager.Animations.LoadDirectionGroup(ref direction)) { return(false); } direction.LastAccessTime = Engine.Ticks; int fc = direction.FrameCount; if (fc > 0 && animIndex >= fc) { animIndex = (byte)(fc - 1); } if (animIndex < direction.FrameCount) { AnimationFrameTexture frame = FileManager.Animations.GetTexture(direction.FramesHashes[animIndex]); if (frame == null || frame.IsDisposed) { return(false); } int drawCenterY = frame.CenterY; const int drawX = -22; int drawY = drawCenterY - 22 - 3; int x = drawX + frame.CenterX; int y = -drawY - (frame.Height + frame.CenterY) + drawCenterY; Texture = frame; Bounds = new Rectangle(x, -y, frame.Width, frame.Height); if (Engine.Profile.Current.NoColorObjectsOutOfRange && GameObject.Distance > World.ViewRange) { HueVector = new Vector3(0x038E, 1, HueVector.Z); } else { HueVector = ShaderHuesTraslator.GetHueVector(color); } base.Draw(batcher, position, objectList); Pick(frame, Bounds, position, objectList); } }
public static bool IsPointInCorpse(Item corpse, int xx, int yy) { if (corpse == null || World.CorpseManager.Exists(corpse.Serial, 0)) { return(false); } byte dir = (byte)((byte)corpse.Layer & 0x7F & 7); bool mirror = false; AnimationsLoader.Instance.GetAnimDirection(ref dir, ref mirror); AnimationsLoader.Instance.Direction = dir; byte animIndex = (byte)corpse.AnimIndex; for (int i = -1; i < Constants.USED_LAYER_COUNT; i++) { Layer layer = i == -1 ? Layer.Mount : LayerOrder.UsedLayers[dir, i]; ushort graphic; ushort color = 0; if (layer == Layer.Invalid) { graphic = corpse.GetGraphicForAnimation(); AnimationsLoader.Instance.AnimGroup = AnimationsLoader.Instance.GetDieGroupIndex(graphic, corpse.UsedLayer); } else if (corpse.HasEquipment && MathHelper.InRange(corpse.Amount, 0x0190, 0x0193) || MathHelper.InRange(corpse.Amount, 0x00B7, 0x00BA) || MathHelper.InRange(corpse.Amount, 0x025D, 0x0260) || MathHelper.InRange(corpse.Amount, 0x029A, 0x029B) || MathHelper.InRange(corpse.Amount, 0x02B6, 0x02B7) || corpse.Amount == 0x03DB || corpse.Amount == 0x03DF || corpse.Amount == 0x03E2 || corpse.Amount == 0x02E8 || corpse.Amount == 0x02E9) { Item itemEquip = corpse.Equipment[(int)layer]; if (itemEquip == null) { continue; } graphic = itemEquip.ItemData.AnimID; if (AnimationsLoader.Instance.EquipConversions.TryGetValue(corpse.Amount, out Dictionary <ushort, EquipConvData> map)) { if (map.TryGetValue(graphic, out EquipConvData data)) { graphic = data.Graphic; } } } else { continue; } byte animGroup = AnimationsLoader.Instance.AnimGroup; AnimationGroup gr = layer == Layer.Invalid ? AnimationsLoader.Instance.GetCorpseAnimationGroup(ref graphic, ref animGroup, ref color) : AnimationsLoader.Instance.GetBodyAnimationGroup(ref graphic, ref animGroup, ref color); AnimationDirection direction = gr.Direction[AnimationsLoader.Instance.Direction]; if (direction == null || ((direction.FrameCount == 0 || direction.Frames == null) && !AnimationsLoader.Instance.LoadDirectionGroup(ref direction))) { continue; } int fc = direction.FrameCount; if (fc > 0 && animIndex >= fc) { animIndex = (byte)(fc - 1); } if (animIndex < direction.FrameCount) { AnimationFrameTexture frame = direction.Frames[animIndex]; if (frame == null || frame.IsDisposed) { continue; } int drawCenterY = frame.CenterY; const int drawX = -22; int drawY = drawCenterY - 22; drawY -= 3; int x = drawX + frame.CenterX; int y = -drawY - (frame.Height + frame.CenterY) + drawCenterY; if (mirror) { x = xx + x + 44 - TranslatedMousePositionByViewport.X; } else { x = TranslatedMousePositionByViewport.X - xx + x; } y = TranslatedMousePositionByViewport.Y - yy + y; if (frame.Contains(x, y)) { return(true); } } } return(false); }
private void DrawLayer(UltimaBatcher2D batcher, int posX, int posY, Layer layer, byte animIndex, bool ishuman) { _equipConvData = null; ushort graphic; ushort color = 0; bool ispartialhue = false; if (layer == Layer.Invalid) { graphic = GetGraphicForAnimation(); AnimationsLoader.Instance.AnimGroup = AnimationsLoader.Instance.GetDieGroupIndex(graphic, UsedLayer); if (color == 0) { color = Hue; } } else if (HasEquipment && ishuman) { Item itemEquip = Equipment[(int)layer]; if (itemEquip == null) { return; } graphic = itemEquip.ItemData.AnimID; ispartialhue = itemEquip.ItemData.IsPartialHue; ushort mobGraphic = Amount; AnimationsLoader.Instance.ConvertBodyIfNeeded(ref mobGraphic); if (AnimationsLoader.Instance.EquipConversions.TryGetValue(mobGraphic, out Dictionary <ushort, EquipConvData> map)) { if (map.TryGetValue(graphic, out EquipConvData data)) { _equipConvData = data; graphic = data.Graphic; } } color = itemEquip.Hue; } else { return; } byte animGroup = AnimationsLoader.Instance.AnimGroup; ushort newHue = 0; AnimationGroup gr = layer == Layer.Invalid ? AnimationsLoader.Instance.GetCorpseAnimationGroup(ref graphic, ref animGroup, ref newHue) : AnimationsLoader.Instance.GetBodyAnimationGroup(ref graphic, ref animGroup, ref newHue); AnimationsLoader.Instance.AnimID = graphic; if (color == 0) { color = newHue; } var direction = gr.Direction[AnimationsLoader.Instance.Direction]; if (direction == null) { return; } if ((direction.FrameCount == 0 || direction.Frames == null) && !AnimationsLoader.Instance.LoadDirectionGroup(ref direction)) { return; } direction.LastAccessTime = Time.Ticks; int fc = direction.FrameCount; if (fc > 0 && animIndex >= fc) { animIndex = (byte)(fc - 1); } if (animIndex < direction.FrameCount) { AnimationFrameTexture frame = direction.Frames[animIndex]; if (frame == null || frame.IsDisposed) { return; } frame.Ticks = Time.Ticks; if (IsFlipped) { posX -= frame.Width - frame.CenterX; } else { posX -= frame.CenterX; } posY -= frame.Height + frame.CenterY; if (color == 0) { if ((color & 0x8000) != 0) { ispartialhue = true; color &= 0x7FFF; } if (color == 0 && _equipConvData.HasValue) { color = _equipConvData.Value.Color; ispartialhue = false; } } ResetHueVector(); if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { HueVector.X = Constants.OUT_RANGE_COLOR; HueVector.Y = 1; } else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect) { HueVector.X = Constants.DEAD_RANGE_COLOR; HueVector.Y = 1; } else { if (ProfileManager.Current.GridLootType > 0 && SelectedObject.CorpseObject == this) { color = 0x0034; } else if (ProfileManager.Current.HighlightGameObjects && SelectedObject.LastObject == this) { color = 0x0023; } ShaderHuesTraslator.GetHueVector(ref HueVector, color, ispartialhue, 0); } Texture = frame; batcher.DrawSprite(frame, posX, posY, IsFlipped, ref HueVector); Select(IsFlipped ? posX + frame.Width - SelectedObject.TranslatedMousePositionByViewport.X : SelectedObject.TranslatedMousePositionByViewport.X - posX, SelectedObject.TranslatedMousePositionByViewport.Y - posY); } }
public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList) { if (GameObject.IsDisposed) { return(false); } Mobile mobile = (Mobile)GameObject; bool mirror = false; byte dir = (byte)mobile.GetDirectionForAnimation(); Animations.GetAnimDirection(ref dir, ref mirror); IsFlipped = mirror; SetupLayers(dir, mobile, out int mountOffset); AnimationFrameTexture bodyFrame = Animations.GetTexture(_frames[0].Hash); if (bodyFrame == null) { return(false); } int drawCenterY = bodyFrame.CenterY; int drawX; int drawY = mountOffset + drawCenterY + (int)(mobile.Offset.Z / 4) - 22 - (int)(mobile.Offset.Y - mobile.Offset.Z - 3); if (IsFlipped) { drawX = -22 + (int)mobile.Offset.X; } else { drawX = -22 - (int)mobile.Offset.X; } FrameInfo = Rectangle.Empty; Rectangle rect = Rectangle.Empty; for (int i = 0; i < _layerCount; i++) { ViewLayer vl = _frames[i]; AnimationFrameTexture frame = Animations.GetTexture(vl.Hash); if (frame.IsDisposed) { continue; } int x = drawX + frame.CenterX; int y = -drawY - (frame.Height + frame.CenterY) + drawCenterY - vl.OffsetY; int yy = -(frame.Height + frame.CenterY + 3); int xx = -frame.CenterX; if (mirror) { xx = -(frame.Width - frame.CenterX); } if (xx < rect.X) { rect.X = xx; } if (yy < rect.Y) { rect.Y = yy; } if (rect.Width < xx + frame.Width) { rect.Width = xx + frame.Width; } if (rect.Height < yy + frame.Height) { rect.Height = yy + frame.Height; } Texture = frame; Bounds = new Rectangle(x, -y, frame.Width, frame.Height); HueVector = ShaderHuesTraslator.GetHueVector(mobile.IsHidden ? 0x038E : vl.Hue, vl.IsParital, 0, false); base.Draw(batcher, position, objectList); Pick(frame, Bounds, position, objectList); } FrameInfo.X = Math.Abs(rect.X); FrameInfo.Y = Math.Abs(rect.Y); FrameInfo.Width = FrameInfo.X + rect.Width; FrameInfo.Height = FrameInfo.Y + rect.Height; MessageOverHead(batcher, position, mobile.IsMounted ? 0 : -22); //OverheadManager damageManager = Engine.SceneManager.GetScene<GameScene>().Overheads; //if (mobile.Name != null && mobile.Name.ToLower().Contains("trunks")) //{ //} //if (damageManager.HasOverhead(GameObject) || damageManager.HasDamage(GameObject)) //{ // GetAnimationDimensions(mobile, 0xFF, out int height, out int centerY); // var overheadPosition = new Vector3 // { // X = position.X + mobile.Offset.X, // Y = position.Y + (mobile.Offset.Y - mobile.Offset.Z) - (height + centerY + 8), // Z = position.Z // }; // damageManager.UpdatePosition(mobile, overheadPosition); //} //if (_edge == null) //{ // _edge = new Texture2D(batcher.GraphicsDevice, 1, 1); // _edge.SetData(new Color[] { Color.LightBlue }); //} //batcher.DrawRectangle(_edge, GetOnScreenRectangle(), Vector3.Zero); return(true); }