public static unsafe void Process() { if (_static_infos == null || _static_infos.Count == 0 || ProcessTime >= Time.Ticks) { return; } UOFile file = AnimDataLoader.Instance.AnimDataFile; if (file == null) { return; } // fix static animations time to reflect the standard client uint delay = Constants.ITEM_EFFECT_ANIMATION_DELAY * 2; uint next_time = Time.Ticks + 250; bool no_animated_field = ProfileManager.Current != null && ProfileManager.Current.FieldsType != 0; long startAddr = file.StartAddress.ToInt64(); UOFileIndex[] static_data = ArtLoader.Instance.Entries; for (int i = 0; i < _static_infos.Count; i++) { ref static_animation_info o = ref _static_infos[i]; if (no_animated_field && o.is_field) { o.anim_index = 0; continue; } if (o.time < Time.Ticks) { uint addr = (uint)(o.index * 68 + 4 * (o.index / 8 + 1)); AnimDataFrame2 *info = (AnimDataFrame2 *)(startAddr + addr); byte offset = o.anim_index; if (info->FrameInterval > 0) { o.time = Time.Ticks + info->FrameInterval * delay + 1; } else { o.time = Time.Ticks + delay; } if (offset < info->FrameCount) { static_data[o.index + 0x4000] .AnimOffset = info->FrameData[offset++]; } if (offset >= info->FrameCount) { offset = 0; } o.anim_index = offset; } if (o.time < next_time) { next_time = o.time; } }
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 (ProfileManager.Current.FieldsType == 1 && StaticFilters.IsField(Graphic)) // static { unsafe { IntPtr ptr = UOFileManager.AnimData.GetAddressToAnim(Graphic); if (ptr != IntPtr.Zero) { AnimDataFrame2 *animData = (AnimDataFrame2 *)ptr; if (animData->FrameCount != 0) { _originalGraphic = (Graphic)(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 = UOFileManager.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 (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 (!IsCorpse && !IsMulti && Amount > 1 && ItemData.IsStackable && DisplayedGraphic == Graphic && _originalGraphic == Graphic) { base.Draw(batcher, posX - 5, posY - 5); } if (ItemData.IsLight) { CUOEnviroment.Client.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); } ushort graphic = Graphic; if (ItemData.IsAnimated && _lastAnimationFrameTime < Time.Ticks) { IntPtr ptr = AnimDataLoader.Instance.GetAddressToAnim(Graphic); if (ptr != IntPtr.Zero) { unsafe { AnimDataFrame2 *animData = (AnimDataFrame2 *)ptr; if (animData->FrameCount != 0) { graphic = (ushort)(Graphic + animData->FrameData[AnimIndex++]); if (AnimIndex >= animData->FrameCount) { AnimIndex = 0; } _lastAnimationFrameTime = Time.Ticks + (uint)(animData->FrameInterval * Constants.ITEM_EFFECT_ANIMATION_DELAY); } } } } ResetHueVector(); if (Texture == null || Texture.IsDisposed || Graphic != graphic) { SetTextureByGraphic(graphic); } 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 { ShaderHuesTraslator.GetHueVector(ref HueVector, Hue, ItemData.IsPartialHue, 0); } //Engine.DebugInfo.StaticsRendered++; //if ((StaticFilters.IsTree(Graphic) || ItemData.IsFoliage || StaticFilters.IsRock(Graphic))) //{ // batcher.DrawSpriteShadow(Texture, posX - Bounds.X, posY - Bounds.Y /*- 10*/, false); //} if (base.Draw(batcher, posX, posY)) { if (ItemData.IsLight) { Client.Game.GetScene <GameScene>() .AddLight(this, this, posX + 22, posY + 22); } return(true); } return(false); }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (!AllowedToDraw || IsDestroyed) { return(false); } ResetHueVector(); ushort hue = Hue; float alpha = 0; if (State != 0) { if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER) != 0) { return(false); } if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_INCORRECT_PLACE) != 0) { hue = 0x002B; } if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_TRANSPARENT) != 0) { if (AlphaHue >= 192) { alpha = 0.25f; AlphaHue = 0xFF; } else { ProcessAlpha(192); } } } ushort graphic = Graphic; if (ItemData.IsFoliage) { if (CharacterIsBehindFoliage) { if (AlphaHue != Constants.FOLIAGE_ALPHA) { ProcessAlpha(Constants.FOLIAGE_ALPHA); } } else { if (AlphaHue != 0xFF) { ProcessAlpha(0xFF); } } } else if (ItemData.IsAnimated && _lastAnimationFrameTime < Time.Ticks) { IntPtr ptr = UOFileManager.AnimData.GetAddressToAnim(Graphic); if (ptr != IntPtr.Zero) { unsafe { AnimDataFrame2 *animData = (AnimDataFrame2 *)ptr; if (animData->FrameCount != 0) { graphic = (Graphic)(Graphic + animData->FrameData[AnimIndex++]); if (AnimIndex >= animData->FrameCount) { AnimIndex = 0; } _lastAnimationFrameTime = Time.Ticks + (uint)(animData->FrameInterval != 0 ? animData->FrameInterval * Constants.ITEM_EFFECT_ANIMATION_DELAY + 25 : Constants.ITEM_EFFECT_ANIMATION_DELAY); } } } } if (Texture == null || Texture.IsDisposed || Graphic != graphic) { ArtTexture texture = UOFileManager.Art.GetTexture(graphic); Texture = texture; Bounds = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height); FrameInfo.Width = texture.ImageRectangle.Width; FrameInfo.Height = texture.ImageRectangle.Height; FrameInfo.X = (Texture.Width >> 1) - 22 - texture.ImageRectangle.X; FrameInfo.Y = Texture.Height - 44 - texture.ImageRectangle.Y; } 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 { ShaderHuesTraslator.GetHueVector(ref HueVector, hue, ItemData.IsPartialHue, alpha); } //Engine.DebugInfo.MultiRendered++; if (IsFromTarget) { HueVector.Z = 0.5f; } base.Draw(batcher, posX, posY); if (ItemData.IsLight) { CUOEnviroment.Client.GetScene <GameScene>() .AddLight(this, this, posX + 22, posY + 22); } return(true); }