public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (!AllowedToDraw || IsDestroyed) { return(false); } //Engine.DebugInfo.ItemsRendered++; ResetHueVector(); DrawTransparent = false; posX += (int)Offset.X; posY += (int)(Offset.Y + Offset.Z); if (ItemData.IsTranslucent) { HueVector.Z = 0.5f; } if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } if (IsCorpse) { return(DrawCorpse(batcher, posX, posY - 3)); } ushort hue = Hue; ushort graphic = DisplayedGraphic; bool partial = ItemData.IsPartialHue; if (OnGround && ItemData.IsAnimated) { if (ProfileManager.Current.FieldsType == 2) { if (StaticFilters.IsFireField(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0020; } else if (StaticFilters.IsParalyzeField(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0058; } else if (StaticFilters.IsEnergyField(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0070; } else if (StaticFilters.IsPoisonField(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0044; } else if (StaticFilters.IsWallOfStone(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x038A; } } } if (ProfileManager.Current.HighlightGameObjects && SelectedObject.LastObject == this) { hue = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE; partial = false; } else if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { hue = Constants.OUT_RANGE_COLOR; } else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect) { hue = Constants.DEAD_RANGE_COLOR; } else { if (!IsLocked && !IsMulti && SelectedObject.LastObject == this) { // TODO: check why i put this. //isPartial = ItemData.Weight == 0xFF; hue = 0x0035; } else if (IsHidden) { hue = 0x038E; } } ShaderHuesTraslator.GetHueVector(ref HueVector, hue, partial, HueVector.Z); if (!IsMulti && !IsCoin && Amount > 1 && ItemData.IsStackable) { DrawStaticAnimated(batcher, graphic, posX - 5, posY - 5, ref HueVector, ref DrawTransparent); } if (ItemData.IsLight) { Client.Game.GetScene <GameScene>() .AddLight(this, this, posX + 22, posY + 22); } if (!SerialHelper.IsValid(Serial) && IsMulti && TargetManager.TargetingState == CursorTarget.MultiPlacement) { HueVector.Z = 0.5f; } DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector, ref DrawTransparent); if (SelectedObject.Object == this || TargetManager.TargetingState == CursorTarget.MultiPlacement) { return(false); } var texture = ArtLoader.Instance.GetTexture(graphic); if (texture != null) { ref var index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000); posX -= index.Width; posY -= index.Height; if (SelectedObject.IsPointInStatic(texture, posX, posY)) { SelectedObject.Object = this; } }
public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList) { if (IsDisposed) { return(false); } if (AnimationGraphic == Graphic.INVALID) { return(false); } Hue hue = Hue; if (Source is Item i) { if (Engine.Profile.Current.FieldsType == 1 && StaticFilters.IsField(AnimationGraphic)) { AnimIndex = 0; } else if (Engine.Profile.Current.FieldsType == 2) { if (StaticFilters.IsFireField(Graphic)) { AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0020; } else if (StaticFilters.IsParalyzeField(Graphic)) { AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0058; } else if (StaticFilters.IsEnergyField(Graphic)) { AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0070; } else if (StaticFilters.IsPoisonField(Graphic)) { AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0044; } else if (StaticFilters.IsWallOfStone(Graphic)) { AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x038A; } } else if (i.IsHidden) { hue = 0x038E; } } if ((AnimationGraphic != _displayedGraphic || Texture == null || Texture.IsDisposed) && AnimationGraphic != Graphic.INVALID) { _displayedGraphic = AnimationGraphic; Texture = FileManager.Art.GetTexture(AnimationGraphic); Bounds = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height); } Bounds.X = (Texture.Width >> 1) - 22 - (int)Offset.X; Bounds.Y = Texture.Height - 44 + (int)(Offset.Z - Offset.Y); ref readonly StaticTiles data = ref FileManager.TileData.StaticData[Graphic];
public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList) { if (IsDisposed) { return(false); } if (AnimationGraphic == Graphic.INVALID) { return(false); } Hue hue = Hue; if (Source is Item i) { if (Engine.Profile.Current.FieldsType == 1 && StaticFilters.IsField(AnimationGraphic)) { AnimIndex = 0; } else if (Engine.Profile.Current.FieldsType == 2) { if (StaticFilters.IsFireField(Graphic)) { AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0020; } else if (StaticFilters.IsParalyzeField(Graphic)) { AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0058; } else if (StaticFilters.IsEnergyField(Graphic)) { AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0070; } else if (StaticFilters.IsPoisonField(Graphic)) { AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0044; } else if (StaticFilters.IsWallOfStone(Graphic)) { AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x038A; } } else if (i.IsHidden) { hue = 0x038E; } } if ((AnimationGraphic != _displayedGraphic || Texture == null || Texture.IsDisposed) && AnimationGraphic != Graphic.INVALID) { _displayedGraphic = AnimationGraphic; Texture = FileManager.Art.GetTexture(AnimationGraphic); Bounds = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height); } Bounds.X = (Texture.Width >> 1) - 22 - (int)Offset.X; Bounds.Y = Texture.Height - 44 + (int)(Offset.Z - Offset.Y); StaticTiles data = FileManager.TileData.StaticData[_displayedGraphic]; bool isPartial = data.IsPartialHue; bool isTransparent = data.IsTranslucent; if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange) { HueVector = new Vector3(0x038E, 1, HueVector.Z); } else { HueVector = ShaderHuesTraslator.GetHueVector(hue, isPartial, isTransparent ? .5f : 0, false); } switch (Blend) { case GraphicEffectBlendMode.Multiply: batcher.SetBlendState(_multiplyBlendState.Value); base.Draw(batcher, position, objectList); batcher.SetBlendState(null); break; case GraphicEffectBlendMode.Screen: case GraphicEffectBlendMode.ScreenMore: batcher.SetBlendState(_screenBlendState.Value); base.Draw(batcher, position, objectList); batcher.SetBlendState(null); break; case GraphicEffectBlendMode.ScreenLess: batcher.SetBlendState(_screenLessBlendState.Value); base.Draw(batcher, position, objectList); batcher.SetBlendState(null); break; case GraphicEffectBlendMode.NormalHalfTransparent: batcher.SetBlendState(_normalHalfBlendState.Value); base.Draw(batcher, position, objectList); batcher.SetBlendState(null); break; case GraphicEffectBlendMode.ShadowBlue: batcher.SetBlendState(_shadowBlueBlendState.Value); base.Draw(batcher, position, objectList); batcher.SetBlendState(null); break; default: base.Draw(batcher, position, objectList); break; } Engine.DebugInfo.EffectsRendered++; return(true); }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (!AllowedToDraw || IsDestroyed) { return(false); } Engine.DebugInfo.ItemsRendered++; ResetHueVector(); if (IsCorpse) { return(DrawCorpse(batcher, posX, posY - 3)); } ushort hue = Hue; if (Engine.Profile.Current.FieldsType == 1 && StaticFilters.IsField(Graphic)) // static { unsafe { _originalGraphic = (Graphic)(Graphic + _animDataFrame.FrameData[_animDataFrame.FrameCount >> 1]); } _force = false; } else if (Engine.Profile.Current.FieldsType == 2) { if (StaticFilters.IsFireField(Graphic)) { _originalGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0020; } else if (StaticFilters.IsParalyzeField(Graphic)) { _originalGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0058; } else if (StaticFilters.IsEnergyField(Graphic)) { _originalGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0070; } else if (StaticFilters.IsPoisonField(Graphic)) { _originalGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0044; } else if (StaticFilters.IsWallOfStone(Graphic)) { _originalGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x038A; } } if (_originalGraphic != DisplayedGraphic || _force || Texture == null || Texture.IsDisposed) { if (_originalGraphic == 0) { _originalGraphic = DisplayedGraphic; } Texture = FileManager.Art.GetTexture(_originalGraphic); Bounds.X = (Texture.Width >> 1) - 22; Bounds.Y = Texture.Height - 44; Bounds.Width = Texture.Width; Bounds.Height = Texture.Height; _force = false; } if (ItemData.IsFoliage) { if (CharacterIsBehindFoliage) { if (AlphaHue != Constants.FOLIAGE_ALPHA) { ProcessAlpha(Constants.FOLIAGE_ALPHA); } } else { if (AlphaHue != 0xFF) { ProcessAlpha(0xFF); } } } if (Engine.Profile.Current.HighlightGameObjects && SelectedObject.LastObject == this) { HueVector.X = 0x0023; HueVector.Y = 1; } else if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { HueVector.X = Constants.OUT_RANGE_COLOR; HueVector.Y = 1; } else if (World.Player.IsDead && Engine.Profile.Current.EnableBlackWhiteEffect) { HueVector.X = Constants.DEAD_RANGE_COLOR; HueVector.Y = 1; } else { bool isPartial = ItemData.IsPartialHue; if (SelectedObject.LastObject == this && !IsLocked && !IsMulti) { isPartial = ItemData.Weight == 255; hue = 0x0035; } else if (IsHidden) { hue = 0x038E; } ShaderHuesTraslator.GetHueVector(ref HueVector, hue, isPartial, ItemData.IsTranslucent ? .5f : 0); } if (!IsCorpse && !IsMulti && Amount > 1 && ItemData.IsStackable && DisplayedGraphic == Graphic && _originalGraphic == Graphic) { base.Draw(batcher, posX - 5, posY - 5); } if (ItemData.IsLight) { Engine.SceneManager.GetScene <GameScene>() .AddLight(this, this, posX + 22, posY + 22); } if (!Serial.IsValid && IsMulti && TargetManager.TargetingState == CursorTarget.MultiPlacement) { HueVector.Z = 0.5f; } return(base.Draw(batcher, posX, posY)); }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (!AllowedToDraw || IsDestroyed) { return(false); } //Engine.DebugInfo.ItemsRendered++; ResetHueVector(); posX += (int)Offset.X; posY += (int)(Offset.Y + Offset.Z); if (IsCorpse) { return(DrawCorpse(batcher, posX, posY - 3)); } ushort hue = Hue; if (ProfileManager.Current.FieldsType == 1 && StaticFilters.IsField(Graphic)) // static { unsafe { IntPtr ptr = AnimDataLoader.Instance.GetAddressToAnim(Graphic); if (ptr != IntPtr.Zero) { AnimDataFrame2 *animData = (AnimDataFrame2 *)ptr; if (animData->FrameCount != 0) { _originalGraphic = (ushort)(Graphic + animData->FrameData[animData->FrameCount >> 1]); } } } _force = false; } else if (ProfileManager.Current.FieldsType == 2) { if (StaticFilters.IsFireField(Graphic)) { _originalGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0020; } else if (StaticFilters.IsParalyzeField(Graphic)) { _originalGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0058; } else if (StaticFilters.IsEnergyField(Graphic)) { _originalGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0070; } else if (StaticFilters.IsPoisonField(Graphic)) { _originalGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0044; } else if (StaticFilters.IsWallOfStone(Graphic)) { _originalGraphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x038A; } } if (_originalGraphic != DisplayedGraphic || _force || Texture == null || Texture.IsDisposed) { if (_originalGraphic == 0) { _originalGraphic = DisplayedGraphic; } Texture = ArtLoader.Instance.GetTexture(_originalGraphic); Bounds.X = (Texture.Width >> 1) - 22; Bounds.Y = Texture.Height - 44; Bounds.Width = Texture.Width; Bounds.Height = Texture.Height; _force = false; } if (ProfileManager.Current.HighlightGameObjects && SelectedObject.LastObject == this) { HueVector.X = 0x0023; HueVector.Y = 1; } else 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 { bool isPartial = ItemData.IsPartialHue; if (SelectedObject.LastObject == this && !IsLocked && !IsMulti) { isPartial = ItemData.Weight == 255; hue = 0x0035; } else if (IsHidden) { hue = 0x038E; } ShaderHuesTraslator.GetHueVector(ref HueVector, hue, isPartial, ItemData.IsTranslucent ? .5f : 0); } if (!IsMulti && !IsCoin && Amount > 1 && ItemData.IsStackable) { base.Draw(batcher, posX - 5, posY - 5); } if (ItemData.IsLight) { Client.Game.GetScene <GameScene>() .AddLight(this, this, posX + 22, posY + 22); } if (!SerialHelper.IsValid(Serial) && IsMulti && TargetManager.TargetingState == CursorTarget.MultiPlacement) { HueVector.Z = 0.5f; } return(base.Draw(batcher, posX, posY)); }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY, float depth) { if (!AllowedToDraw || IsDestroyed) { return(false); } //Engine.DebugInfo.ItemsRendered++; Vector3 hueVec; posX += (int)Offset.X; posY += (int)(Offset.Y + Offset.Z); float alpha = AlphaHue / 255f; if (IsCorpse) { hueVec = ShaderHueTranslator.GetHueVector(0, false, alpha); return(DrawCorpse(batcher, posX, posY - 3, hueVec, depth)); } ushort hue = Hue; ushort graphic = DisplayedGraphic; bool partial = ItemData.IsPartialHue; if (OnGround) { if (ItemData.IsAnimated) { if (ProfileManager.CurrentProfile.FieldsType == 2) { if (StaticFilters.IsFireField(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0020; } else if (StaticFilters.IsParalyzeField(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0058; } else if (StaticFilters.IsEnergyField(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0070; } else if (StaticFilters.IsPoisonField(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0044; } else if (StaticFilters.IsWallOfStone(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x038A; } } } if (ItemData.IsContainer && SelectedObject.SelectedContainer == this) { hue = 0x0035; partial = false; } } if (ProfileManager.CurrentProfile.HighlightGameObjects && ReferenceEquals(SelectedObject.LastObject, this)) { hue = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE; partial = false; } else if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { hue = Constants.OUT_RANGE_COLOR; } else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect) { hue = Constants.DEAD_RANGE_COLOR; } else { if (!IsLocked && !IsMulti && ReferenceEquals(SelectedObject.LastObject, this)) { // TODO: check why i put this. //isPartial = ItemData.Weight == 0xFF; hue = 0x0035; } else if (IsHidden) { hue = 0x038E; } } hueVec = ShaderHueTranslator.GetHueVector(hue, partial, alpha); if (!IsMulti && !IsCoin && Amount > 1 && ItemData.IsStackable) { DrawStaticAnimated ( batcher, graphic, posX - 5, posY - 5, hueVec, false, depth ); } if (ItemData.IsLight || graphic >= 0x3E02 && graphic <= 0x3E0B || graphic >= 0x3914 && graphic <= 0x3929) { Client.Game.GetScene <GameScene>().AddLight(this, this, posX + 22, posY + 22); } if (!SerialHelper.IsValid(Serial) && IsMulti && TargetManager.TargetingState == CursorTarget.MultiPlacement) { hueVec.Z = 0.5f; } DrawStaticAnimated ( batcher, graphic, posX, posY, hueVec, false, depth ); return(true); }