public bool IsZUnderObjectOrGround(sbyte z, out GameObject entity, out GameObject ground) { List <GameObject> list = (List <GameObject>)ObjectsOnTiles; entity = null; ground = null; for (int i = list.Count - 1; i >= 0; i--) { if (list[i].Position.Z <= z) { continue; } if (list[i] is IDynamicItem dyn) { StaticTiles itemdata = dyn.ItemData; if (IO.Resources.TileData.IsRoof((long)itemdata.Flags) || IO.Resources.TileData.IsSurface((long)itemdata.Flags) || IO.Resources.TileData.IsWall((long)itemdata.Flags) && IO.Resources.TileData.IsImpassable((long)itemdata.Flags)) { if (entity == null || list[i].Position.Z < entity.Position.Z) { entity = list[i]; } } } else if (list[i] is Tile tile && tile.AverageZ >= z + 12) { ground = list[i]; } } return(entity != null || ground != null); }
public static bool IsNoDrawable(ushort g) { switch (g) { case 0x0001: case 0x21BC: case 0x9E4C: case 0x9E64: case 0x9E65: case 0x9E7D: return(true); } if (g != 0x63D3) { if (g >= 0x2198 && g <= 0x21A4) { return(true); } ref StaticTiles data = ref FileManager.TileData.StaticData[g]; if (!data.IsNoDiagonal || data.IsAnimated && World.Player != null && World.Player.Race == RaceType.GARGOYLE) { return(false); } }
public static bool TryGetStaticData(GameObject obj, out StaticTiles itemdata) { switch (obj) { case Static st: itemdata = st.OriginalGraphic != st.Graphic ? FileManager.TileData.StaticData[st.OriginalGraphic] : st.ItemData; return(true); case Item item: itemdata = item.ItemData; return(true); case Multi multi: itemdata = multi.ItemData; return(true); case AnimatedItemEffect ef when ef.Source is Static s: itemdata = s.ItemData; return(true); default: itemdata = default; return(false); } }
public static void Target(ushort graphic, ushort x, ushort y, short z, bool wet = false) { if (!IsTargeting) { return; } if (graphic == 0) { if (TargetingState == CursorTarget.Object) { return; } } else { if (graphic >= TileDataLoader.Instance.StaticData.Length) { return; } ref StaticTiles itemData = ref TileDataLoader.Instance.StaticData[graphic]; if (Client.Version >= ClientVersion.CV_7090 && itemData.IsSurface) { z += itemData.Height; } }
public static bool TryGetStaticData(GameObject obj, out StaticTiles itemdata) { switch (obj) { case Static st: if (st.OriginalGraphic != st.Graphic) { itemdata = FileManager.TileData.StaticData[st.OriginalGraphic]; } else { itemdata = st.ItemData; } return(true); case Item item: itemdata = item.ItemData; return(true); case Multi multi: itemdata = multi.ItemData; return(true); default: itemdata = default; return(false); } }
public static bool IsNoDrawable(ushort g) { switch (g) { case 0x0001: case 0x21BC: //case 0x5690: return(true); case 0x9E4C: case 0x9E64: case 0x9E65: case 0x9E7D: ref StaticTiles data = ref TileDataLoader.Instance.StaticData[g]; return(data.IsBackground || data.IsSurface); } if (g != 0x63D3) { if (g >= 0x2198 && g <= 0x21A4) { return(true); } ref StaticTiles data = ref TileDataLoader.Instance.StaticData[g]; if (!data.IsNoDiagonal || (data.IsAnimated && World.Player != null && World.Player.Race == RaceType.GARGOYLE)) { return(false); } }
private static bool GetStaticData ( int index, ref ulong flags, ref byte weight, ref byte layer, ref int count, ref ushort animid, ref ushort lightidx, ref byte height, ref string name ) { if (index >= 0 && index < Constants.MAX_STATIC_DATA_INDEX_COUNT) { ref StaticTiles st = ref TileDataLoader.Instance.StaticData[index]; flags = (ulong)st.Flags; weight = st.Weight; layer = st.Layer; count = st.Count; animid = st.AnimID; lightidx = st.LightIndex; height = st.Height; name = st.Name; return(true); }
public void AddGameObject(GameObject obj) { //if (_firstNode != null) { short priorityZ = obj.Position.Z; switch (obj) { case Land tile: if (tile.IsStretched) { priorityZ = (short)(tile.AverageZ - 1); } else { priorityZ--; } break; case Mobile _: priorityZ++; break; case Item item when item.IsCorpse: priorityZ++; break; case GameEffect _: priorityZ += 2; break; default: { ref StaticTiles data = ref FileManager.TileData.StaticData[obj.Graphic]; if (data.IsBackground) { priorityZ--; } if (data.Height > 0) { priorityZ++; } } break; } obj.PriorityZ = priorityZ; }
public static bool IsNoDrawable(ushort g) { switch (g) { case 0x0001: case 0x21BC: //case 0x5690: return(true); case 0x9E4C: case 0x9E64: case 0x9E65: case 0x9E7D: ref StaticTiles data = ref TileDataLoader.Instance.StaticData[g]; return(data.IsBackground || data.IsSurface); } if (g != 0x63D3) { if (g >= 0x2198 && g <= 0x21A4) { return(true); } // Easel fix. // In older clients the tiledata flag for this // item contains NoDiagonal for some reason. // So the next check will make the item invisible. if (g == 0x0F65 && Client.Version < ClientVersion.CV_60144) { return(false); } if (g < TileDataLoader.Instance.StaticData.Length) { ref StaticTiles data = ref TileDataLoader.Instance.StaticData[g]; if (!data.IsNoDiagonal || data.IsAnimated && World.Player != null && World.Player.Race == RaceType.GARGOYLE) { return(false); } } }
private static bool IsOK(bool ignoreDoors, int ourZ, int ourTop, List <Static> tiles, List <IDynamicItem> items) { for (int i = 0; i < tiles.Count; ++i) { Static item = tiles[i]; if ((item.ItemData.Flags & IMPASSABLE_SURFACE) != 0) // Impassable || Surface { int checkZ = item.Position.Z; int checkTop = checkZ + ((item.ItemData.Flags & 0x00000400) != 0 ? item.ItemData.Height / 2 : item.ItemData.Height); if (checkTop > ourZ && ourTop > checkZ) { return(false); } } } for (int i = 0; i < items.Count; ++i) { IDynamicItem item = items[i]; int itemID = item.Graphic & FileManager.GraphicMask; StaticTiles itemData = TileData.StaticData[itemID]; ulong flags = itemData.Flags; if ((flags & IMPASSABLE_SURFACE) != 0) // Impassable || Surface { if (ignoreDoors && (TileData.IsDoor((long)flags) || itemID == 0x692 || itemID == 0x846 || itemID == 0x873 || itemID >= 0x6F5 && itemID <= 0x6F6)) { continue; } int checkZ = item.Position.Z; int checkTop = checkZ + ((item.ItemData.Flags & 0x00000400) != 0 ? item.ItemData.Height / 2 : item.ItemData.Height); if (checkTop > ourZ && ourTop > checkZ) { return(false); } } } return(true); }
public static bool TryGetStaticData(GameObject obj, out StaticTiles itemdata) { switch (obj) { case Static st: itemdata = st.ItemData; return(true); case Item item: itemdata = item.ItemData; return(true); case Multi multi: itemdata = multi.ItemData; return(true); default: itemdata = default; return(false); } }
private static void GetStartZ(GameObject e, Position loc, List <IDynamicItem> itemList, out sbyte zLow, out sbyte zTop) { int xCheck = loc.X, yCheck = loc.Y; Tile mapTile = World.Map.GetTile(xCheck, yCheck); if (mapTile == null) { zLow = sbyte.MinValue; zTop = sbyte.MinValue; return; } bool landBlocks = TileData.IsImpassable((long)mapTile.TileData.Flags); sbyte landLow = 0, landTop = 0; int landCenter = World.Map.GetAverageZ((short)xCheck, (short)yCheck, ref landLow, ref landTop); bool considerLand = !mapTile.IsIgnored; int zCenter = 0; zLow = 0; zTop = 0; bool isSet = false; if (considerLand && !landBlocks && loc.Z >= landCenter) { zLow = landLow; zCenter = landCenter; if (!isSet || landTop > zTop) { zTop = landTop; } isSet = true; } List <Static> staticTiles = mapTile.GetStatics(); for (int i = 0; i < staticTiles.Count; i++) { Static tile = staticTiles[i]; StaticTiles id = tile.ItemData; int calcTop = tile.Position.Z + ((id.Flags & 0x00000400) != 0 ? id.Height / 2 : id.Height); if ((!isSet || calcTop >= zCenter) && (id.Flags & 0x00000200) != 0 && loc.Z >= calcTop) { // || (m.CanSwim && (id.Flags & TileFlag.Wet) != 0) // if (m.CantWalk && (id.Flags & TileFlag.Wet) == 0) // continue; zLow = tile.Position.Z; zCenter = calcTop; sbyte top = (sbyte)(tile.Position.Z + id.Height); if (!isSet || top > zTop) { zTop = top; } isSet = true; } } for (int i = 0; i < itemList.Count; i++) { IDynamicItem item = itemList[i]; StaticTiles id = item.ItemData; int calcTop = item.Position.Z + ((id.Flags & 0x00000400) != 0 ? id.Height / 2 : id.Height); if ((!isSet || calcTop >= zCenter) && (id.Flags & 0x00000200) != 0 && loc.Z >= calcTop) { // || (m.CanSwim && (id.Flags & TileFlag.Wet) != 0) // if (m.CantWalk && (id.Flags & TileFlag.Wet) == 0) // continue; zLow = item.Position.Z; zCenter = calcTop; sbyte top = (sbyte)(item.Position.Z + id.Height); if (!isSet || top > zTop) { zTop = top; } isSet = true; } } if (!isSet) { zLow = zTop = loc.Z; } else if (loc.Z > zTop) { zTop = loc.Z; } }
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(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(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); }
private static bool Check(Mobile m, List <IDynamicItem> items, int x, int y, int startTop, sbyte startZ, out sbyte newZ) { newZ = 0; Tile mapTile = World.Map.GetTile(x, y); if (mapTile == null) { return(false); } LandTiles id = mapTile.TileData; List <Static> tiles = mapTile.GetStatics(); bool landBlocks = (id.Flags & 0x00000040) != 0; bool considerLand = !mapTile.IsIgnored; sbyte landCenter = 0; sbyte landLow = 0, landTop = 0; landCenter = (sbyte)World.Map.GetAverageZ((short)x, (short)y, ref landLow, ref landTop); bool moveIsOk = false; int stepTop = startTop + STEP_HEIGHT; int checkTop = startZ + PERSON_HEIGHT; bool ignoreDoors = m.IsDead || m.Graphic == 0x3DB; for (int i = 0; i < tiles.Count; ++i) { Static tile = tiles[i]; if ((tile.ItemData.Flags & IMPASSABLE_SURFACE) == 0x00000200) // || (canSwim && (flags & TileFlag.Wet) != 0) Surface && !Impassable { // if (cantWalk && (flags & TileFlag.Wet) == 0) // continue; int itemZ = tile.Position.Z; int itemTop = itemZ; sbyte ourZ = (sbyte)(itemZ + ((tile.ItemData.Flags & 0x00000400) != 0 ? tile.ItemData.Height / 2 : tile.ItemData.Height)); int ourTop = ourZ + PERSON_HEIGHT; int testTop = checkTop; if (moveIsOk) { int cmp = Math.Abs(ourZ - m.Position.Z) - Math.Abs(newZ - m.Position.Z); if (cmp > 0 || cmp == 0 && ourZ > newZ) { continue; } } if (ourZ + PERSON_HEIGHT > testTop) { testTop = ourZ + PERSON_HEIGHT; } if ((tile.ItemData.Flags & 0x00000400) == 0) { itemTop += tile.ItemData.Height; } if (stepTop >= itemTop) { int landCheck = itemZ; if (tile.ItemData.Height >= STEP_HEIGHT) { landCheck += STEP_HEIGHT; } else { landCheck += tile.ItemData.Height; } if (considerLand && landCheck < landCenter && landCenter > ourZ && testTop > landLow) { continue; } if (IsOK(ignoreDoors, ourZ, testTop, tiles, items)) { newZ = ourZ; moveIsOk = true; } } } } for (int i = 0; i < items.Count; ++i) { IDynamicItem item = items[i]; StaticTiles itemData = item.ItemData; ulong flags = itemData.Flags; if ((flags & IMPASSABLE_SURFACE) == 0x00000200) // Surface && !Impassable && !Movable { // || (m.CanSwim && (flags & TileFlag.Wet) != 0)) // !item.Movable && // if (cantWalk && (flags & TileFlag.Wet) == 0) // continue; int itemZ = item.Position.Z; int itemTop = itemZ; sbyte ourZ = (sbyte)(itemZ + ((item.ItemData.Flags & 0x00000400) != 0 ? item.ItemData.Height / 2 : item.ItemData.Height)); int ourTop = ourZ + PERSON_HEIGHT; int testTop = checkTop; if (moveIsOk) { int cmp = Math.Abs(ourZ - m.Position.Z) - Math.Abs(newZ - m.Position.Z); if (cmp > 0 || cmp == 0 && ourZ > newZ) { continue; } } if (ourZ + PERSON_HEIGHT > testTop) { testTop = ourZ + PERSON_HEIGHT; } if ((itemData.Flags & 0x00000400) == 0) { itemTop += itemData.Height; } if (stepTop >= itemTop) { int landCheck = itemZ; if (itemData.Height >= STEP_HEIGHT) { landCheck += STEP_HEIGHT; } else { landCheck += itemData.Height; } if (considerLand && landCheck < landCenter && landCenter > ourZ && testTop > landLow) { continue; } if (IsOK(ignoreDoors, ourZ, testTop, tiles, items)) { newZ = ourZ; moveIsOk = true; } } } } if (considerLand && !landBlocks && stepTop >= landLow) { sbyte ourZ = landCenter; int ourTop = ourZ + PERSON_HEIGHT; int testTop = checkTop; if (ourZ + PERSON_HEIGHT > testTop) { testTop = ourZ + PERSON_HEIGHT; } bool shouldCheck = true; if (moveIsOk) { int cmp = Math.Abs(ourZ - m.Position.Z) - Math.Abs(newZ - m.Position.Z); if (cmp > 0 || cmp == 0 && ourZ > newZ) { shouldCheck = false; } } if (shouldCheck && IsOK(ignoreDoors, ourZ, testTop, tiles, items)) { newZ = ourZ; moveIsOk = true; } } return(moveIsOk); }
public void UpdateMaxDrawZ(bool force = false) { int playerX = World.Player.X; int playerY = World.Player.Y; int playerZ = World.Player.Z; if (playerX == _oldPlayerX && playerY == _oldPlayerY && playerZ == _oldPlayerZ && !force) { return; } _oldPlayerX = playerX; _oldPlayerY = playerY; _oldPlayerZ = playerZ; sbyte maxGroundZ = 127; _maxGroundZ = 127; _maxZ = 127; _noDrawRoofs = !ProfileManager.CurrentProfile.DrawRoofs; int bx = playerX; int by = playerY; Chunk chunk = World.Map.GetChunk(bx, by, false); if (chunk != null) { int x = playerX % 8; int y = playerY % 8; int pz14 = playerZ + 14; int pz16 = playerZ + 16; for (GameObject obj = chunk.GetHeadObject(x, y); obj != null; obj = obj.TNext) { sbyte tileZ = obj.Z; if (obj is Land l) { if (l.IsStretched) { tileZ = l.AverageZ; } if (pz16 <= tileZ) { maxGroundZ = (sbyte)pz16; _maxGroundZ = (sbyte)pz16; _maxZ = _maxGroundZ; break; } continue; } if (obj is Mobile) { continue; } //if (obj is Item it && !it.ItemData.IsRoof || !(obj is Static) && !(obj is Multi)) // continue; if (tileZ > pz14 && _maxZ > tileZ) { ref StaticTiles itemdata = ref TileDataLoader.Instance.StaticData[obj.Graphic]; //if (GameObjectHelper.TryGetStaticData(obj, out var itemdata) && ((ulong) itemdata.Flags & 0x20004) == 0 && (!itemdata.IsRoof || itemdata.IsSurface)) if (((ulong)itemdata.Flags & 0x20004) == 0 && (!itemdata.IsRoof || itemdata.IsSurface)) { _maxZ = tileZ; _noDrawRoofs = true; } } } int tempZ = _maxZ; _maxGroundZ = (sbyte)_maxZ; playerX++; playerY++; bx = playerX; by = playerY; chunk = World.Map.GetChunk(bx, by, false); if (chunk != null) { x = playerX % 8; y = playerY % 8; for (GameObject obj2 = chunk.GetHeadObject(x, y); obj2 != null; obj2 = obj2.TNext) { //if (obj is Item it && !it.ItemData.IsRoof || !(obj is Static) && !(obj is Multi)) // continue; if (obj2 is Mobile) { continue; } sbyte tileZ = obj2.Z; if (tileZ > pz14 && _maxZ > tileZ) { if (!(obj2 is Land)) { ref StaticTiles itemdata = ref TileDataLoader.Instance.StaticData[obj2.Graphic]; if (((ulong)itemdata.Flags & 0x204) == 0 && itemdata.IsRoof) { _maxZ = tileZ; World.Map.ClearBockAccess(); _maxGroundZ = World.Map.CalculateNearZ(tileZ, playerX, playerY, tileZ); _noDrawRoofs = true; } } //if (GameObjectHelper.TryGetStaticData(obj2, out var itemdata) && ((ulong) itemdata.Flags & 0x204) == 0 && itemdata.IsRoof) //{ // _maxZ = tileZ; // World.Map.ClearBockAccess(); // _maxGroundZ = World.Map.CalculateNearZ(tileZ, playerX, playerY, tileZ); // _noDrawRoofs = true; //} } } tempZ = _maxGroundZ; }
private void AddTileToRenderList(GameObject obj, int worldX, int worldY, bool useObjectHandles, int maxZ) { for (; obj != null; obj = obj.Right) { if (obj.CurrentRenderIndex == _renderIndex || obj.IsDisposed) { continue; } if (_updateDrawPosition && obj.CurrentRenderIndex != _renderIndex || obj.IsPositionChanged) { obj.UpdateRealScreenPosition(_offset); } //obj.UseInRender = 0xFF; float drawX = obj.RealScreenPosition.X; float drawY = obj.RealScreenPosition.Y; if (drawX < _minPixel.X || drawX > _maxPixel.X) { break; } int z = obj.Z; int maxObjectZ = obj.PriorityZ; bool ismobile = false; StaticTiles itemData = default; switch (obj) { case Mobile _: maxObjectZ += Constants.DEFAULT_CHARACTER_HEIGHT; ismobile = true; break; default: if (GameObjectHelper.TryGetStaticData(obj, out itemData)) { if (obj is Static st) { if (StaticFilters.IsTree(st.OriginalGraphic)) { if (Engine.Profile.Current.TreeToStumps && st.Graphic != Constants.TREE_REPLACE_GRAPHIC) { st.SetGraphic(Constants.TREE_REPLACE_GRAPHIC); } else if (st.OriginalGraphic != st.Graphic && !Engine.Profile.Current.TreeToStumps) { st.RestoreOriginalGraphic(); } } } if (_noDrawRoofs && itemData.IsRoof || (Engine.Profile.Current.TreeToStumps && itemData.IsFoliage) || (Engine.Profile.Current.HideVegetation && StaticFilters.IsVegetation(obj.Graphic))) { continue; } maxObjectZ += itemData.Height; } break; } if (maxObjectZ > maxZ) { break; } obj.CurrentRenderIndex = _renderIndex; bool iscorpse = !ismobile && obj is Item item && item.IsCorpse; if (!ismobile && !iscorpse && itemData.IsInternal) { continue; } bool island = !ismobile && !iscorpse && obj is Land; if (!island && z >= _maxZ) { continue; } int testMinZ = (int)drawY + z * 4; int testMaxZ = (int)drawY; if (island) { Land t = obj as Land; if (t.IsStretched) { testMinZ -= t.MinZ * 4; } else { testMinZ = testMaxZ; } } else { testMinZ = testMaxZ; } if (testMinZ < _minPixel.Y || testMaxZ > _maxPixel.Y) { continue; } if (ismobile || iscorpse) { AddOffsetCharacterTileToRenderList(obj, useObjectHandles); } if (_renderListCount >= _renderList.Length) { int newsize = _renderList.Length + 1000; Array.Resize(ref _renderList, newsize); } _renderList[_renderListCount] = obj; //obj.UseInRender = (byte) _renderIndex; _renderListCount++; } }
private void AddTileToRenderList(GameObject obj, int worldX, int worldY, bool useObjectHandles, int maxZ) { for (; obj != null; obj = obj.Right) { if (obj.CurrentRenderIndex == _renderIndex || obj.IsDisposed) { continue; } if (_updateDrawPosition && obj.CurrentRenderIndex != _renderIndex || obj.IsPositionChanged) { obj.UpdateRealScreenPosition(_offset); } //obj.UseInRender = 0xFF; float drawX = obj.RealScreenPosition.X; float drawY = obj.RealScreenPosition.Y; if (drawX < _minPixel.X || drawX > _maxPixel.X) { break; } int z = obj.Z; int maxObjectZ = obj.PriorityZ; bool mounted = false; bool ismobile = false; StaticTiles itemData = default; bool changinAlpha = false; switch (obj) { case Mobile mob: maxObjectZ += Constants.DEFAULT_CHARACTER_HEIGHT; ismobile = true; mounted = mob.IsMounted; break; default: if (GameObjectHelper.TryGetStaticData(obj, out itemData)) { if (obj is Static st) { if (StaticFilters.IsCave(st.OriginalGraphic)) { if (Engine.Profile.Current.EnableCaveBorder && !st.IsBordered()) { st.SetBorder(true); } else if (!Engine.Profile.Current.EnableCaveBorder && st.IsBordered()) { st.SetBorder(false); } } else if (StaticFilters.IsTree(st.OriginalGraphic)) { if (Engine.Profile.Current.TreeToStumps && st.Graphic != Constants.TREE_REPLACE_GRAPHIC) { st.SetGraphic(Constants.TREE_REPLACE_GRAPHIC); } else if (st.OriginalGraphic != st.Graphic && !Engine.Profile.Current.TreeToStumps) { st.RestoreOriginalGraphic(); } } } if (_noDrawRoofs && itemData.IsRoof) { if (_alphaChanged) { changinAlpha = obj.ProcessAlpha(0); } else { changinAlpha = obj.AlphaHue != 0; } if (!changinAlpha) { continue; } } if ((Engine.Profile.Current.TreeToStumps && itemData.IsFoliage) || (Engine.Profile.Current.HideVegetation && StaticFilters.IsVegetation(obj.Graphic))) { continue; } maxObjectZ += itemData.Height; } break; } if (maxObjectZ > maxZ) { break; } obj.CurrentRenderIndex = _renderIndex; bool iscorpse = !ismobile && obj is Item item && item.IsCorpse; if (!ismobile && !iscorpse && itemData.IsInternal) { continue; } bool island = !ismobile && !iscorpse && obj is Land; if (!island && z >= _maxZ) { if (!changinAlpha) { if (_alphaChanged) { changinAlpha = obj.ProcessAlpha(0); } else { changinAlpha = obj.AlphaHue != 0; } if (!changinAlpha) { continue; } } } int testMinZ = (int)drawY + z * 4; int testMaxZ = (int)drawY; if (island) { Land t = obj as Land; if (t.IsStretched) { testMinZ -= t.MinZ * 4; } else { testMinZ = testMaxZ; } } else { testMinZ = testMaxZ; } if (testMinZ < _minPixel.Y || testMaxZ > _maxPixel.Y) { continue; } if (obj.Overheads != null && obj.Overheads.Count != 0) { int offY; if (ismobile && !mounted || iscorpse) { offY = -22; } else { switch (obj) { case Multi _: case Static _: offY = -44; break; //case Item _: // offY = 44; //break; default: offY = 0; break; } } for (int i = 0; i < obj.Overheads.Count; i++) { TextOverhead v = obj.Overheads[i]; v.Bounds.X = (v.Texture.Width >> 1) - 22; v.Bounds.Y = offY + v.Texture.Height; v.Bounds.Width = v.Texture.Width; v.Bounds.Height = v.Texture.Height; Overheads.AddOverhead(v); offY += v.Texture.Height; if (_alphaChanged) { if (v.TimeToLive > 0 && v.TimeToLive <= Constants.TIME_FADEOUT_TEXT) { if (!v.IsOverlapped) { v.ProcessAlpha(0); } } else if (!v.IsOverlapped && v.AlphaHue != 0xFF) { v.ProcessAlpha(0xFF); } } } } if (ismobile || iscorpse) { AddOffsetCharacterTileToRenderList(obj, useObjectHandles); } else if (itemData.IsFoliage) { if (obj is Static st) { bool check = World.Player.X <= worldX && World.Player.Y <= worldY; if (!check) { check = World.Player.Y <= worldY && World.Player.Position.X <= worldX + 1; if (!check) { check = World.Player.X <= worldX && World.Player.Y <= worldY + 1; } } if (check) { Rectangle rect = new Rectangle((int)drawX - st.FrameInfo.X, (int)drawY - st.FrameInfo.Y, st.FrameInfo.Width, st.FrameInfo.Height); check = rect.InRect(World.Player.GetOnScreenRectangle()); } st.CharacterIsBehindFoliage = check; } else if (obj is Multi m) { bool check = World.Player.X <= worldX && World.Player.Y <= worldY; if (!check) { check = World.Player.Y <= worldY && World.Player.Position.X <= worldX + 1; if (!check) { check = World.Player.X <= worldX && World.Player.Y <= worldY + 1; } } if (check) { Rectangle rect = new Rectangle((int)drawX - m.FrameInfo.X, (int)drawY - m.FrameInfo.Y, m.FrameInfo.Width, m.FrameInfo.Height); check = rect.InRect(World.Player.GetOnScreenRectangle()); } m.CharacterIsBehindFoliage = check; } } if (_alphaChanged && !changinAlpha) { if (itemData.IsTranslucent) { obj.ProcessAlpha(178); } else if (!itemData.IsFoliage && obj.AlphaHue != 0xFF) { obj.ProcessAlpha(0xFF); } } if (_renderListCount >= _renderList.Length) { int newsize = _renderList.Length + 1000; Array.Resize(ref _renderList, newsize); } if (useObjectHandles) { obj.UseObjectHandles = (ismobile || iscorpse || obj is Item it && !it.IsLocked && !it.IsMulti) && !obj.ClosedObjectHandles; _objectHandlesCount++; } else if (obj.ClosedObjectHandles) { obj.ClosedObjectHandles = false; obj.ObjectHandlesOpened = false; } else if (obj.UseObjectHandles) { obj.ObjectHandlesOpened = false; obj.UseObjectHandles = false; } _renderList[_renderListCount] = obj; //obj.UseInRender = (byte) _renderIndex; _renderListCount++; } }
public void AddLight(GameObject obj, GameObject lightObject, int x, int y) { if (_lightCount >= Constants.MAX_LIGHTS_DATA_INDEX_COUNT || !UseLights && !UseAltLights || obj == null) { return; } bool canBeAdded = true; int testX = obj.X + 1; int testY = obj.Y + 1; GameObject tile = World.Map.GetTile(testX, testY); if (tile != null) { sbyte z5 = (sbyte)(obj.Z + 5); for (GameObject o = tile; o != null; o = o.TNext) { if ((!(o is Static s) || s.ItemData.IsTransparent) && (!(o is Multi m) || m.ItemData.IsTransparent) || !o.AllowedToDraw) { continue; } if (o.Z < _maxZ && o.Z >= z5) { canBeAdded = false; break; } } } if (canBeAdded) { ref LightData light = ref _lights[_lightCount]; ushort graphic = lightObject.Graphic; if (graphic >= 0x3E02 && graphic <= 0x3E0B || graphic >= 0x3914 && graphic <= 0x3929 || graphic == 0x0B1D) { light.ID = 2; } else { if (obj == lightObject && obj is Item item) { light.ID = item.LightID; } else if (lightObject is Item it) { light.ID = (byte)it.ItemData.LightIndex; } else if (obj is Mobile _) { light.ID = 1; } else { ref StaticTiles data = ref TileDataLoader.Instance.StaticData[obj.Graphic]; light.ID = data.Layer; } }
private void AddTileToRenderList(GameObject obj, int worldX, int worldY, bool useObjectHandles, int maxZ) { for (; obj != null; obj = obj.Right) { if (obj.CurrentRenderIndex == _renderIndex || obj.IsDestroyed || !obj.AllowedToDraw) { continue; } if (_updateDrawPosition && obj.CurrentRenderIndex != _renderIndex || obj.IsPositionChanged) { obj.UpdateRealScreenPosition(_offset); } //obj.UseInRender = 0xFF; float drawX = obj.RealScreenPosition.X; float drawY = obj.RealScreenPosition.Y; if (drawX < _minPixel.X || drawX > _maxPixel.X) { break; } int z = obj.Z; int maxObjectZ = obj.PriorityZ; bool ismobile = false; StaticTiles itemData = default; bool changinAlpha = false; switch (obj) { case Mobile _: maxObjectZ += Constants.DEFAULT_CHARACTER_HEIGHT; ismobile = true; break; default: if (GameObjectHelper.TryGetStaticData(obj, out itemData)) { if (obj is Static st) { if (StaticFilters.IsCave(st.OriginalGraphic)) { if (Engine.Profile.Current.EnableCaveBorder && !st.IsBordered()) { st.SetBorder(true); } else if (!Engine.Profile.Current.EnableCaveBorder && st.IsBordered()) { st.SetBorder(false); } } else if (StaticFilters.IsTree(st.OriginalGraphic)) { if (Engine.Profile.Current.TreeToStumps && st.Graphic != Constants.TREE_REPLACE_GRAPHIC) { st.SetGraphic(Constants.TREE_REPLACE_GRAPHIC); } else if (st.OriginalGraphic != st.Graphic && !Engine.Profile.Current.TreeToStumps) { st.RestoreOriginalGraphic(); } } } if (_noDrawRoofs && itemData.IsRoof) { if (_alphaChanged) { changinAlpha = obj.ProcessAlpha(0); } else { changinAlpha = obj.AlphaHue != 0; } if (!changinAlpha) { continue; } } if ((Engine.Profile.Current.TreeToStumps && itemData.IsFoliage) || (Engine.Profile.Current.HideVegetation && StaticFilters.IsVegetation(obj.Graphic))) { continue; } maxObjectZ += itemData.Height; } break; } if (maxObjectZ > maxZ) { break; } obj.CurrentRenderIndex = _renderIndex; bool iscorpse = !ismobile && obj is Item item && item.IsCorpse; if (!ismobile && !iscorpse && itemData.IsInternal) { continue; } bool island = !ismobile && !iscorpse && obj is Land; if (!island && z >= _maxZ) { if (!changinAlpha) { if (_alphaChanged) { changinAlpha = obj.ProcessAlpha(0); } else { changinAlpha = obj.AlphaHue != 0; } if (!changinAlpha) { continue; } } } int testMinZ = (int)drawY + z * 4; int testMaxZ = (int)drawY; if (island) { Land t = obj as Land; if (t.IsStretched) { testMinZ -= t.MinZ * 4; } else { testMinZ = testMaxZ; } } else { testMinZ = testMaxZ; } if (testMinZ < _minPixel.Y || testMaxZ > _maxPixel.Y) { continue; } if (obj.OverheadMessageContainer != null && !obj.OverheadMessageContainer.IsEmpty) { _overheadManager.AddOverhead(obj.OverheadMessageContainer); } if (ismobile || iscorpse) { AddOffsetCharacterTileToRenderList(obj, useObjectHandles); } else if (itemData.IsFoliage) { bool check = World.Player.X <= worldX && World.Player.Y <= worldY; if (!check) { check = World.Player.Y <= worldY && World.Player.Position.X <= worldX + 1; if (!check) { check = World.Player.X <= worldX && World.Player.Y <= worldY + 1; } } if (check) { Rectangle rect = new Rectangle((int)drawX - obj.FrameInfo.X, (int)drawY - obj.FrameInfo.Y, obj.FrameInfo.Width, obj.FrameInfo.Height); Rectangle r = World.Player.GetOnScreenRectangle(); check = Exstentions.InRect(ref rect, ref r); } if (obj is Static st) { st.CharacterIsBehindFoliage = check; } else if (obj is Multi m) { m.CharacterIsBehindFoliage = check; } else if (obj is Item it) { it.CharacterIsBehindFoliage = check; } } if (_alphaChanged && !changinAlpha) { if (itemData.IsTranslucent) { obj.ProcessAlpha(178); } else if (!itemData.IsFoliage && obj.AlphaHue != 0xFF) { obj.ProcessAlpha(0xFF); } } if (_renderListCount >= _renderList.Length) { int newsize = _renderList.Length + 1000; //_renderList.Resize(newsize); Array.Resize(ref _renderList, newsize); } if (useObjectHandles) { obj.UseObjectHandles = (ismobile || iscorpse || obj is Item it && !it.IsLocked && !it.IsMulti) && !obj.ClosedObjectHandles; _objectHandlesCount++; } else if (obj.ClosedObjectHandles) { obj.ClosedObjectHandles = false; obj.ObjectHandlesOpened = false; } else if (obj.UseObjectHandles) { obj.ObjectHandlesOpened = false; obj.UseObjectHandles = false; } //ref var weak = ref _renderList[_renderListCount]; //if (weak == null) // weak = new WeakReference<GameObject>(obj); //else // weak.SetTarget(obj); _renderList[_renderListCount] = obj; //_renderList.Enqueue(obj); //obj.UseInRender = (byte) _renderIndex; _renderListCount++; } }
private static bool CreateItemList(List <PathObject> list, int x, int y, int stepState) { GameObject tile = World.Map.GetTile(x, y, false); if (tile == null) { return(false); } bool ignoreGameCharacters = ProfileManager.CurrentProfile.IgnoreStaminaCheck || stepState == (int)PATH_STEP_STATE.PSS_DEAD_OR_GM || World.Player.IgnoreCharacters || !(World.Player.Stamina < World.Player.StaminaMax && World.Map.Index == 0); bool isGM = World.Player.Graphic == 0x03DB; GameObject obj = tile; while (obj.TPrevious != null) { obj = obj.TPrevious; } for (; obj != null; obj = obj.TNext) { if (World.CustomHouseManager != null && obj.Z < World.Player.Z) { continue; } ushort graphicHelper = obj.Graphic; switch (obj) { case Land tile1: if (graphicHelper < 0x01AE && graphicHelper != 2 || graphicHelper > 0x01B5 && graphicHelper != 0x01DB) { uint flags = (uint)PATH_OBJECT_FLAGS.POF_IMPASSABLE_OR_SURFACE; if (stepState == (int)PATH_STEP_STATE.PSS_ON_SEA_HORSE) { if (tile1.TileData.IsWet) { flags = (uint)(PATH_OBJECT_FLAGS.POF_IMPASSABLE_OR_SURFACE | PATH_OBJECT_FLAGS.POF_SURFACE | PATH_OBJECT_FLAGS.POF_BRIDGE); } } else { if (!tile1.TileData.IsImpassable) { flags = (uint)(PATH_OBJECT_FLAGS.POF_IMPASSABLE_OR_SURFACE | PATH_OBJECT_FLAGS.POF_SURFACE | PATH_OBJECT_FLAGS.POF_BRIDGE); } if (stepState == (int)PATH_STEP_STATE.PSS_FLYING && tile1.TileData.IsNoDiagonal) { flags |= (uint)PATH_OBJECT_FLAGS.POF_NO_DIAGONAL; } } int landMinZ = tile1.MinZ; int landAverageZ = tile1.AverageZ; int landHeight = landAverageZ - landMinZ; list.Add ( new PathObject ( flags, landMinZ, landAverageZ, landHeight, obj ) ); } break; case GameEffect _: break; default: bool canBeAdd = true; bool dropFlags = false; switch (obj) { case Mobile mobile: { if (!ignoreGameCharacters && !mobile.IsDead && !mobile.IgnoreCharacters) { list.Add ( new PathObject ( (uint)PATH_OBJECT_FLAGS.POF_IMPASSABLE_OR_SURFACE, mobile.Z, mobile.Z + Constants.DEFAULT_CHARACTER_HEIGHT, Constants.DEFAULT_CHARACTER_HEIGHT, mobile ) ); } canBeAdd = false; break; } case Item item when item.IsMulti || item.ItemData.IsInternal: { canBeAdd = false; break; } case Item item2: if (stepState == (int)PATH_STEP_STATE.PSS_DEAD_OR_GM && (item2.ItemData.IsDoor || item2.ItemData.Weight <= 0x5A || isGM && !item2.IsLocked)) { dropFlags = true; } else if (ProfileManager.CurrentProfile.SmoothDoors && item2.ItemData.IsDoor) { dropFlags = true; } else { dropFlags = graphicHelper >= 0x3946 && graphicHelper <= 0x3964 || graphicHelper == 0x0082; } break; case Multi m: if ((World.CustomHouseManager != null && m.IsCustom && (m.State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_GENERIC_INTERNAL) == 0) || m.IsHousePreview) { canBeAdd = false; } if ((m.State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER) != 0) { dropFlags = true; } break; } if (canBeAdd) { uint flags = 0; if (!(obj is Mobile)) { ref StaticTiles itemdata = ref TileDataLoader.Instance.StaticData[obj.Graphic]; if (stepState == (int)PATH_STEP_STATE.PSS_ON_SEA_HORSE) { if (itemdata.IsWet) { flags = (uint)(PATH_OBJECT_FLAGS.POF_SURFACE | PATH_OBJECT_FLAGS.POF_BRIDGE); } } else { if (itemdata.IsImpassable || itemdata.IsSurface) { flags = (uint)PATH_OBJECT_FLAGS.POF_IMPASSABLE_OR_SURFACE; } if (!itemdata.IsImpassable) { if (itemdata.IsSurface) { flags |= (uint)PATH_OBJECT_FLAGS.POF_SURFACE; } if (itemdata.IsBridge) { flags |= (uint)PATH_OBJECT_FLAGS.POF_BRIDGE; } } if (stepState == (int)PATH_STEP_STATE.PSS_DEAD_OR_GM) { if (graphicHelper <= 0x0846) { if (!(graphicHelper != 0x0846 && graphicHelper != 0x0692 && (graphicHelper <= 0x06F4 || graphicHelper > 0x06F6))) { dropFlags = true; } } else if (graphicHelper == 0x0873) { dropFlags = true; } } if (dropFlags) { flags &= 0xFFFFFFFE; } if (stepState == (int)PATH_STEP_STATE.PSS_FLYING && itemdata.IsNoDiagonal) { flags |= (uint)PATH_OBJECT_FLAGS.POF_NO_DIAGONAL; } } if (flags != 0) { int objZ = obj.Z; int staticHeight = itemdata.Height; int staticAverageZ = staticHeight; if (itemdata.IsBridge) { staticAverageZ /= 2; } list.Add ( new PathObject ( flags, objZ, staticAverageZ + objZ, staticHeight, obj ) ); } } } break; } }
private bool OnLeftMouseUp() { if (UIManager.PopupMenu != null && !UIManager.PopupMenu.Bounds.Contains(Mouse.Position.X, Mouse.Position.Y)) { UIManager.ShowGamePopup(null); } if (_isMouseLeftDown) { _isMouseLeftDown = false; _holdMouse2secOverItemTime = 0; } // drag-select code comes first to allow selection finish on mouseup outside of viewport if (_selectionStart.X == Mouse.Position.X && _selectionStart.Y == Mouse.Position.Y) { _isSelectionActive = false; } if (_isSelectionActive) { DoDragSelect(); return(true); } if (!UIManager.IsMouseOverWorld) { return(false); } if (UIManager.SystemChat != null && !UIManager.SystemChat.IsFocused) { UIManager.KeyboardFocusControl = null; UIManager.SystemChat.SetFocus(); } if (!ProfileManager.CurrentProfile.DisableAutoMove && _rightMousePressed) { _continueRunning = true; } BaseGameObject lastObj = SelectedObject.LastLeftDownObject; SelectedObject.LastLeftDownObject = null; if (UIManager.IsDragging) { return(false); } if (ItemHold.Enabled && !ItemHold.IsFixedPosition) { uint drop_container = 0xFFFF_FFFF; bool can_drop = false; ushort dropX = 0; ushort dropY = 0; sbyte dropZ = 0; GameObject gobj = SelectedObject.LastObject as GameObject; if (gobj is Entity obj) { can_drop = obj.Distance <= Constants.DRAG_ITEMS_DISTANCE; if (can_drop) { if (obj is Item it && it.ItemData.IsContainer || obj is Mobile) { dropX = 0xFFFF; dropY = 0xFFFF; dropZ = 0; drop_container = obj.Serial; } else if (obj is Item it2 && (it2.ItemData.IsSurface || it2.ItemData.IsStackable && it2.Graphic == ItemHold.Graphic)) { dropX = obj.X; dropY = obj.Y; dropZ = obj.Z; if (it2.ItemData.IsSurface) { dropZ += (sbyte)(it2.ItemData.Height == 0xFF ? 0 : it2.ItemData.Height); } else { drop_container = obj.Serial; } } } else { Client.Game.Scene.Audio.PlaySound(0x0051); } } else if (gobj is Land || gobj is Static || gobj is Multi) { can_drop = gobj.Distance <= Constants.DRAG_ITEMS_DISTANCE; if (can_drop) { dropX = gobj.X; dropY = gobj.Y; dropZ = gobj.Z; if (gobj is Land land) { } else { ref StaticTiles itemData = ref TileDataLoader.Instance.StaticData[gobj.Graphic]; if (itemData.IsSurface) { dropZ += (sbyte)(itemData.Height == 0xFF ? 0 : itemData.Height); } } } else { Client.Game.Scene.Audio.PlaySound(0x0051); } }
private void AddTileToRenderList(GameObject obj, int worldX, int worldY, bool useObjectHandles, int maxZ /*, GameObject entity*/) { /*sbyte HeightChecks = 0; * if(entity != null) * { * if(entity.X < worldX && entity.Y > worldY) * { * HeightChecks = 1; * } * else if (entity.Y < worldY && entity.X > worldX) * { * HeightChecks = -1; * } * }*/ for (; obj != null; obj = obj.Right) { if (obj.CurrentRenderIndex == _renderIndex || !obj.AllowedToDraw) { continue; } if (UpdateDrawPosition && obj.CurrentRenderIndex != _renderIndex || obj.IsPositionChanged) { obj.UpdateRealScreenPosition(_offset.X, _offset.Y); } obj.UseInRender = 0xFF; int drawX = obj.RealScreenPosition.X; int drawY = obj.RealScreenPosition.Y; if (drawX < _minPixel.X || drawX > _maxPixel.X) { break; } int maxObjectZ = obj.PriorityZ; StaticTiles itemData = _emptyStaticTiles; bool changinAlpha = false; bool island = false; bool iscorpse = false; bool ismobile = false; switch (obj) { case Mobile _: maxObjectZ += Constants.DEFAULT_CHARACTER_HEIGHT; ismobile = true; break; case Land _: island = true; goto SKIP_HANDLES_CHECK; case Item it when it.IsCorpse: iscorpse = true; goto default; default: if (GameObjectHelper.TryGetStaticData(obj, out itemData)) { if (itemData.IsFoliage && World.Season >= Seasons.Winter) { continue; } if (obj is Static st) { if (StaticFilters.IsTree(st.OriginalGraphic)) { if (Engine.Profile.Current.TreeToStumps && st.Graphic != Constants.TREE_REPLACE_GRAPHIC) { st.SetGraphic(Constants.TREE_REPLACE_GRAPHIC); } else if (st.OriginalGraphic != st.Graphic && !Engine.Profile.Current.TreeToStumps) { st.RestoreOriginalGraphic(); } } } if (_noDrawRoofs && itemData.IsRoof) { if (_alphaChanged) { changinAlpha = obj.ProcessAlpha(0); } else { changinAlpha = obj.AlphaHue != 0; } if (!changinAlpha) { continue; } } if (Engine.Profile.Current.TreeToStumps && itemData.IsFoliage || Engine.Profile.Current.HideVegetation && StaticFilters.IsVegetation(obj.Graphic)) { continue; } //if (HeightChecks <= 0 && (!itemData.IsBridge || ((itemData.Flags & TileFlag.StairBack | TileFlag.StairRight) != 0) || itemData.IsWall)) { maxObjectZ += itemData.Height; } } break; } if (useObjectHandles && NameOverHeadManager.IsAllowed(obj as Entity)) { obj.UseObjectHandles = (ismobile || iscorpse || obj is Item it && (!it.IsLocked || it.IsLocked && itemData.IsContainer) && !it.IsMulti) && !obj.ClosedObjectHandles && _objectHandlesCount <= 400; if (obj.UseObjectHandles) { _objectHandlesCount++; } } else if (obj.ClosedObjectHandles) { obj.ClosedObjectHandles = false; obj.ObjectHandlesOpened = false; } else if (obj.UseObjectHandles) { obj.ObjectHandlesOpened = false; obj.UseObjectHandles = false; } SKIP_HANDLES_CHECK: if (maxObjectZ > maxZ) { break; } obj.CurrentRenderIndex = _renderIndex; if (!island) { obj.UpdateTextCoords(); } else { goto SKIP_INTERNAL_CHECK; } if (!ismobile && !iscorpse && !island && itemData.IsInternal) { continue; } SKIP_INTERNAL_CHECK: int z = obj.Z; if (!island && z >= _maxZ) { if (!changinAlpha) { if (_alphaChanged) { changinAlpha = obj.ProcessAlpha(0); } else { changinAlpha = obj.AlphaHue != 0; } if (!changinAlpha) { obj.UseInRender = (byte)_renderIndex; continue; } } } int testMaxZ = drawY; if (testMaxZ > _maxPixel.Y) { continue; } int testMinZ = drawY + (z << 2); if (island) { Land t = obj as Land; if (t.IsStretched) { testMinZ -= t.MinZ << 2; } else { testMinZ = testMaxZ; } } else { testMinZ = testMaxZ; } if (testMinZ < _minPixel.Y) { continue; } if (ismobile || iscorpse) { AddOffsetCharacterTileToRenderList(obj, useObjectHandles); } else if (!island && itemData.IsFoliage) { bool check = World.Player.X <= worldX && World.Player.Y <= worldY; if (!check) { check = World.Player.Y <= worldY && World.Player.X <= worldX + 1; if (!check) { check = World.Player.X <= worldX && World.Player.Y <= worldY + 1; } } if (check) { _rectangleObj.X = drawX - obj.FrameInfo.X; _rectangleObj.Y = drawY - obj.FrameInfo.Y; _rectangleObj.Width = obj.FrameInfo.Width; _rectangleObj.Height = obj.FrameInfo.Height; check = Exstentions.InRect(ref _rectangleObj, ref _rectanglePlayer); } switch (obj) { case Static st: st.CharacterIsBehindFoliage = check; break; case Multi m: m.CharacterIsBehindFoliage = check; break; case Item it: it.CharacterIsBehindFoliage = check; break; } } if (!island && _alphaChanged && !changinAlpha) { if (itemData.IsTranslucent) { obj.ProcessAlpha(178); } else if (!itemData.IsFoliage && obj.AlphaHue != 0xFF) { obj.ProcessAlpha(0xFF); } } if (_renderListCount >= _renderList.Length) { int newsize = _renderList.Length + 1000; Array.Resize(ref _renderList, newsize); } _renderList[_renderListCount++] = obj; obj.UseInRender = (byte)_renderIndex; } }