private void CreateMap() { _gumpTexture = UOFileManager.Gumps.GetTexture(_useLargeMap ? (ushort)5011 : (ushort)5010); Width = _gumpTexture.Width; Height = _gumpTexture.Height; CreateMiniMapTexture(true); }
private void CreateMap() { _gumpTexture = GumpsLoader.Instance.GetTexture(_useLargeMap ? (ushort)5011 : (ushort)5010); Width = _gumpTexture.Width; Height = _gumpTexture.Height; CreateMiniMapTexture(true); }
private void GenerateVirtualTextures() { _shopGumpParts = new UOTexture[12]; UOTexture16 t = GumpsLoader.Instance.GetTexture(0x0870, true); UOTexture[][] splits = new UOTexture[4][]; splits[0] = Utility.GraphicHelper.SplitTexture16(t, new int[3, 4] { { 0, 0, t.Width, 64 }, { 0, 64, t.Width, 124 }, { 0, 124, t.Width, t.Height - 124 } }); t = GumpsLoader.Instance.GetTexture(0x0871, true); splits[1] = Utility.GraphicHelper.SplitTexture16(t, new int[3, 4] { { 0, 0, t.Width, 64 }, { 0, 64, t.Width, 94 }, { 0, 94, t.Width, t.Height - 94 } }); t = GumpsLoader.Instance.GetTexture(0x0872, true); splits[2] = Utility.GraphicHelper.SplitTexture16(t, new int[3, 4] { { 0, 0, t.Width, 64 }, { 0, 64, t.Width, 124 }, { 0, 124, t.Width, t.Height - 124 } }); t = GumpsLoader.Instance.GetTexture(0x0873, true); splits[3] = Utility.GraphicHelper.SplitTexture16(t, new int[3, 4] { { 0, 0, t.Width, 64 }, { 0, 64, t.Width, 94 }, { 0, 94, t.Width, t.Height - 94 } }); for (int i = 0, idx = 0; i < splits.Length; i++) { for (int ii = 0; ii < splits[i].Length; ii++) { _shopGumpParts[idx++] = splits[i][ii]; } } }
public UOTexture16 GetLandTexture(uint g) { if (!_landDictionary.TryGetValue(g, out UOTexture16 texture) || texture.IsDisposed) { const int SIZE = 44; ushort[] pixels = ReadLandArt((ushort)g); texture = new UOTexture16(SIZE, SIZE); texture.PushData(pixels); _landDictionary.Add(g, texture); } //else // texture.Ticks = Engine.Ticks + 3000; return(texture); }
/// <summary> /// Splits a texture into an array of smaller textures of the specified size. /// </summary> /// <param name="original">The texture to be split into smaller textures</param> /// <param name="partXYplusWidthHeight"> /// We must specify here an array with size of 'parts' for the first dimension, /// for each part, in the second dimension, we specify: /// starting x and y, plus width and height for that specified part (4 as size in second dimension). /// </param> internal static UOTexture16[] SplitTexture16(UOTexture original, int[,] partXYplusWidthHeight) { if (partXYplusWidthHeight.GetLength(0) == 0 || partXYplusWidthHeight.GetLength(1) < 4) { return(null); } UOTexture16[] r = new UOTexture16[partXYplusWidthHeight.GetLength(0)]; int pwidth = ((original.Width + 1) >> 1) << 1; int pheight = ((original.Height + 1) >> 1) << 1; ushort[] originalData = new ushort[pwidth * pheight]; original.GetData(originalData, 0, pwidth * pheight); int index = 0; for (int p = 0; p < partXYplusWidthHeight.GetLength(0); p++) { int x = partXYplusWidthHeight[p, 0], y = partXYplusWidthHeight[p, 1], width = partXYplusWidthHeight[p, 2], height = partXYplusWidthHeight[p, 3]; UOTexture16 part = new UOTexture16(width, height); ushort[] partData = new ushort[width * height]; for (int py = 0; py < height; py++) { for (int px = 0; px < width; px++) { int partIndex = px + py * width; //If a part goes outside of the source texture, then fill the overlapping part with transparent if (y + py >= pheight || x + px >= pwidth) { partData[partIndex] = 0; } else { partData[partIndex] = originalData[x + px + (y + py) * pwidth]; } } } part.PushData(partData); r[index++] = part; } return(r); }
public override UOTexture GetTexture(uint g) { if (!ResourceDictionary.TryGetValue(g, out UOTexture texture) || texture.IsDisposed) { ushort[] pixels = GetTextmapTexture((ushort)g, out int size); if (pixels == null || pixels.Length == 0) { return(null); } texture = new UOTexture16(size, size); texture.SetData(pixels); //_usedIndex.Add(g); ResourceDictionary.Add(g, texture); } //else // texture.Ticks = Time.Ticks + 3000; return(texture); }
public ButtonTileArt(List <string> gparams) : base(gparams) { X = int.Parse(gparams[1]); Y = int.Parse(gparams[2]); ushort graphic = UInt16Converter.Parse(gparams[8]); _hue = UInt16Converter.Parse(gparams[9]); _tileX = int.Parse(gparams[10]); _tileY = int.Parse(gparams[11]); ContainsByBounds = true; _texture = ArtLoader.Instance.GetTexture(graphic); if (_texture == null) { Dispose(); return; } _isPartial = TileDataLoader.Instance.StaticData[graphic].IsPartialHue; }
private TopBarGump() : base(0, 0) { CanMove = true; AcceptMouseInput = true; CanCloseWithRightClick = false; // little Add(new ResizePic(0x13BE) { Width = 30, Height = 27 }, 2); Add(new Button(0, 0x15A1, 0x15A1, 0x15A1) { X = 5, Y = 3, ToPage = 1 }, 2); // big UOTexture16 th1 = GumpsLoader.Instance.GetTexture(0x098B); UOTexture16 th2 = GumpsLoader.Instance.GetTexture(0x098D); int smallWidth = 50; if (th1 != null) { smallWidth = th1.Width; } int largeWidth = 100; if (th2 != null) { largeWidth = th2.Width; } int[][] textTable = { new [] { 0, (int)Buttons.Map }, new [] { 1, (int)Buttons.Paperdoll }, new [] { 1, (int)Buttons.Inventory }, new [] { 1, (int)Buttons.Journal }, new [] { 0, (int)Buttons.Chat }, new [] { 0, (int)Buttons.Help }, new [] { 1, (int)Buttons.WorldMap }, new [] { 0, (int)Buttons.Info }, new [] { 0, (int)Buttons.Debug }, new [] { 1, (int)Buttons.UOStore }, new [] { 1, (int)Buttons.GlobalChat }, }; string[] texts = { "Map", "Paperdoll", "Inventory", "Journal", "Chat", "Help", "World Map", "< ? >", "Debug", "UOStore", "Global Chat" }; bool hasUOStore = Client.Version >= ClientVersion.CV_706400; ResizePic background; Add(background = new ResizePic(0x13BE) { Height = 27 }, 1); Add(new Button(0, 0x15A4, 0x15A4, 0x15A4) { X = 5, Y = 3, ToPage = 2 }, 1); int startX = 30; for (int i = 0; i < textTable.Length; i++) { ushort graphic = (ushort)(textTable[i][0] != 0 ? 0x098D : 0x098B); Add(new RighClickableButton(textTable[i][1], graphic, graphic, graphic, texts[i], 1, true, 0, 0x0036) { ButtonAction = ButtonAction.Activate, X = startX, Y = 1, FontCenter = true }, 1); startX += (textTable[i][0] != 0 ? largeWidth : smallWidth) + 1; background.Width = startX; if (!hasUOStore && i >= 8) { break; } } background.Width = startX + 1; //layer ControlInfo.Layer = UILayer.Over; }
private void CreateMiniMapTexture(bool force = false) { if (_gumpTexture == null || _gumpTexture.IsDisposed) { return; } ushort lastX = World.Player.X; ushort lastY = World.Player.Y; if (_x != lastX || _y != lastY) { _x = lastX; _y = lastY; } else if (!force) { return; } if (_mapTexture != null && !_mapTexture.IsDisposed) { _mapTexture.Dispose(); } int blockOffsetX = Width >> 2; int blockOffsetY = Height >> 2; int gumpCenterX = Width >> 1; //int gumpCenterY = Height >> 1; //0xFF080808 - pixel32 //0x8421 - pixel16 int minBlockX = ((lastX - blockOffsetX) >> 3) - 1; int minBlockY = ((lastY - blockOffsetY) >> 3) - 1; int maxBlockX = ((lastX + blockOffsetX) >> 3) + 1; int maxBlockY = ((lastY + blockOffsetY) >> 3) + 1; if (minBlockX < 0) { minBlockX = 0; } if (minBlockY < 0) { minBlockY = 0; } int maxBlockIndex = World.Map.BlocksCount; int mapBlockHeight = MapLoader.Instance.MapBlocksSize[World.MapIndex, 1]; ushort[] data = GumpsLoader.Instance.GetGumpPixels(_useLargeMap ? (uint)5011 : 5010, out _, out _); Point[] table = new Point[2] { new Point(0, 0), new Point(0, 1) }; for (int i = minBlockX; i <= maxBlockX; i++) { int blockIndexOffset = i * mapBlockHeight; for (int j = minBlockY; j <= maxBlockY; j++) { int blockIndex = blockIndexOffset + j; if (blockIndex >= maxBlockIndex) { break; } RadarMapBlock?mbbv = MapLoader.Instance.GetRadarMapBlock(World.MapIndex, i, j); if (!mbbv.HasValue) { break; } RadarMapBlock mb = mbbv.Value; Chunk block = World.Map.Chunks[blockIndex]; int realBlockX = i << 3; int realBlockY = j << 3; for (int x = 0; x < 8; x++) { int px = realBlockX + x - lastX + gumpCenterX; for (int y = 0; y < 8; y++) { int py = realBlockY + y - lastY; int gx = px - py; int gy = px + py; int color = mb.Cells[x, y].Graphic; bool island = mb.Cells[x, y].IsLand; if (block != null) { GameObject obj = block.Tiles[x, y]; while (obj?.TNext != null) { obj = obj.TNext; } for (; obj != null; obj = obj.TPrevious) { if (obj is Multi) { if (obj.Hue == 0) { color = obj.Graphic; island = false; } else { color = obj.Hue + 0x4000; } break; } } } if (!island) { color += 0x4000; } int tableSize = 2; if (island && color > 0x4000) { color = HuesLoader.Instance.GetColor16(16384, (ushort)(color - 0x4000));//28672 is an arbitrary position in hues.mul, is the 14 position in the range } else { color = HuesLoader.Instance.GetRadarColorData(color); } CreatePixels(data, 0x8000 | color, gx, gy, Width, Height, table, tableSize); } } } } _mapTexture = new UOTexture16(Width, Height); _mapTexture.PushData(data); }
public HealthLinesManager() { _background_texture = GumpsLoader.Instance.GetTexture(0x1068); _hp_texture = GumpsLoader.Instance.GetTexture(0x1069); }
private void CreateMiniMapTexture(bool force = false) { if (_gumpTexture == null || _gumpTexture.IsDisposed) { return; } ushort lastX = World.Player.Position.X; ushort lastY = World.Player.Position.Y; if (_x != lastX || _y != lastY) { _x = lastX; _y = lastY; } else if (!force) { return; } if (_mapTexture != null && !_mapTexture.IsDisposed) { _mapTexture.Dispose(); } int blockOffsetX = Width >> 2; int blockOffsetY = Height >> 2; int gumpCenterX = Width >> 1; int gumpCenterY = Height >> 1; //0xFF080808 - pixel32 //0x8421 - pixel16 int minBlockX = ((lastX - blockOffsetX) >> 3) - 1; int minBlockY = ((lastY - blockOffsetY) >> 3) - 1; int maxBlockX = ((lastX + blockOffsetX) >> 3) + 1; int maxBlockY = ((lastY + blockOffsetY) >> 3) + 1; if (minBlockX < 0) { minBlockX = 0; } if (minBlockY < 0) { minBlockY = 0; } int maxBlockIndex = World.Map.MapBlockIndex; int mapBlockHeight = FileManager.Map.MapBlocksSize[World.MapIndex, 1]; ushort[] data = FileManager.Gumps.GetGumpPixels(_useLargeMap ? (uint)5011 : 5010, out _, out _); Point[] table = new Point[2] { new Point(0, 0), new Point(0, 1) }; for (int i = minBlockX; i <= maxBlockX; i++) { int blockIndexOffset = i * mapBlockHeight; for (int j = minBlockY; j <= maxBlockY; j++) { int blockIndex = blockIndexOffset + j; if (blockIndex >= maxBlockIndex) { break; } RadarMapBlock?mbbv = FileManager.Map.GetRadarMapBlock(World.MapIndex, i, j); if (!mbbv.HasValue) { break; } RadarMapBlock mb = mbbv.Value; Chunk block = World.Map.Chunks[blockIndex]; int realBlockX = i << 3; int realBlockY = j << 3; for (int x = 0; x < 8; x++) { int px = realBlockX + x - lastX + gumpCenterX; for (int y = 0; y < 8; y++) { int py = realBlockY + y - lastY; int gx = px - py; int gy = px + py; uint color = mb.Cells[x, y].Graphic; bool island = mb.Cells[x, y].IsLand; if (block != null) { GameObject obj = block.Tiles[x, y].FirstNode; while (obj?.Right != null) { obj = obj.Right; } for (; obj != null; obj = obj.Left) { if (obj is Multi) { color = obj.Graphic; island = false; break; } } } if (!island) { color += 0x4000; } int tableSize = 2; color = (uint)(0x8000 | FileManager.Hues.GetRadarColorData((int)color)); CreatePixels(data, (int)color, gx, gy, Width, Height, table, tableSize); } } } } _mapTexture = new UOTexture16(Width, Height); _mapTexture.PushData(data); }