public static Multi Create(ushort graphic) { Multi m = _pool.GetOne(); m.Graphic = m._originalGraphic = graphic; m.UpdateGraphicBySeason(); m.AllowedToDraw = !GameObjectHelper.IsNoDrawable(m.Graphic); if (m.ItemData.Height > 5) { m._canBeTransparent = 1; } else if (m.ItemData.IsRoof || m.ItemData.IsSurface && m.ItemData.IsBackground || m.ItemData.IsWall) { m._canBeTransparent = 1; } else if (m.ItemData.Height == 5 && m.ItemData.IsSurface && !m.ItemData.IsBackground) { m._canBeTransparent = 1; } else { m._canBeTransparent = 0; } return(m); }
public Multi Add ( ushort graphic, ushort hue, int x, int y, sbyte z, bool iscustom ) { Item item = World.Items.Get(Serial); Multi m = Multi.Create(graphic); m.Hue = hue; m.X = (ushort)(item.X + x); m.Y = (ushort)(item.Y + y); m.Z = z; m.UpdateScreenPosition(); m.IsCustom = iscustom; m.AddToTile(); //if (iscustom) Components.Add(m); return(m); }
public Multi Add ( ushort graphic, ushort hue, ushort x, ushort y, sbyte z, bool iscustom, bool ismovable ) { Multi m = Multi.Create(graphic); m.Hue = hue; m.X = x; m.Y = y; m.Z = z; m.UpdateScreenPosition(); m.IsCustom = iscustom; m.IsMovable = ismovable; m.AddToTile(); Components.Add(m); return(m); }
public MultiView(Multi st) : base(st) { AllowedToDraw = !GameObjectHelper.IsNoDrawable(st.Graphic); if (TileData.IsTranslucent(st.ItemData.Flags)) { _alpha = 0.5f; } }
public void GenerateOriginal(Multi multi) { foreach (MultiComponent c in multi.Components) { Tile tile = World.Map.GetTile(c.Position.X, c.Position.Y); tile.AddGameObject(new Static(c.Graphic, 0, 0) { Position = c.Position }); } }
public void ClearCustomHouseComponents(CUSTOM_HOUSE_MULTI_OBJECT_FLAGS state) { Item item = World.Items.Get(Serial); if (item != null) { int checkZ = item.Z + 7; for (int i = 0; i < Components.Count; i++) { Multi component = Components[i]; component.State = component.State & ~(CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_TRANSPARENT | CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER | CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_VALIDATED_PLACE | CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_INCORRECT_PLACE); if (component.IsCustom) { if (component.Z <= item.Z) { if ((component.State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_STAIR) == 0) { component.State |= CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_DONT_REMOVE; } } if (state == 0 || (component.State & state) != 0) { component.Destroy(); } } else if (component.Z <= checkZ) { component.State = component.State | CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_FLOOR | CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER; } if (component.IsDestroyed) { Components.RemoveAt(i--); } } } }
public void GenerateOriginal(Multi multi) { foreach (MultiComponent c in multi.Components) { //ref Tile tile = ref World.Map.GetTile(c.Position.X, c.Position.Y); //tile.AddGameObject(); new Static(c.Graphic, 0, 0) { Position = c.Position }; //tile.AddGameObject(new Static(c.Graphic, 0, 0) //{ // Position = c.Position //}); } }
public MultiView(Multi st) : base(st) { AllowedToDraw = !GameObjectHelper.IsNoDrawable(st.Graphic); if (st.ItemData.Height > 5) { _canBeTransparent = 1; } else if (st.ItemData.IsRoof || (st.ItemData.IsSurface && st.ItemData.IsBackground) || st.ItemData.IsWall) { _canBeTransparent = 1; } else if (st.ItemData.Height == 5 && st.ItemData.IsSurface && !st.ItemData.IsBackground) { _canBeTransparent = 1; } else { _canBeTransparent = 0; } }
public void ClearComponents(bool removeCustomOnly = false) { Item item = World.Items.Get(Serial); if (item != null && !item.IsDestroyed) { item.WantUpdateMulti = true; } for (int i = 0; i < Components.Count; i++) { Multi s = Components[i]; if (!s.IsCustom && removeCustomOnly) { continue; } s.Destroy(); Components.RemoveAt(i--); } //Components.Clear(); }
public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList) { if (!AllowedToDraw || GameObject.IsDisposed) { return(false); } Multi st = (Multi)GameObject; if (Texture == null || Texture.IsDisposed) { ArtTexture texture = FileManager.Art.GetTexture(GameObject.Graphic); Texture = texture; Bounds = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height); FrameInfo.X = texture.ImageRectangle.X; FrameInfo.Y = texture.ImageRectangle.Y; FrameInfo.Width = texture.ImageRectangle.Width; FrameInfo.Height = texture.ImageRectangle.Height; } float alpha = 0; if (Engine.Profile.Current.UseCircleOfTransparency) { int z = World.Player.Z + 5; bool r = true; if (st.Z <= z - st.ItemData.Height) { r = false; } else if (z < st.Z && (_canBeTransparent & 0xFF) == 0) { r = false; } if (r) { int distanceMax = Engine.Profile.Current.CircleOfTransparencyRadius + 1; int distance = GameObject.Distance; if (distance <= distanceMax) { alpha = 1.0f - 1.0f / (distanceMax / (float)distance); } } } if (Engine.Profile.Current.NoColorObjectsOutOfRange && GameObject.Distance > World.ViewRange) { HueVector = new Vector3(0x038E, 1, HueVector.Z); } else { HueVector = ShaderHuesTraslator.GetHueVector(GameObject.Hue, false, alpha, false); } MessageOverHead(batcher, position, Bounds.Y - 44); Engine.DebugInfo.MultiRendered++; return(base.Draw(batcher, position, objectList)); }