public override void Init(ObjectData data) { subtypeNames = new[] { "Collapsing", "Pushable", "Stationary", "Floating" }; var subtypes = new byte[subtypeNames.Length]; for (var index = 0; index < subtypeNames.Length; index++) { subtypes[index] = (byte)(index << 1); } this.subtypes = new ReadOnlyCollection <byte>(subtypes); sprites = new Sprite[3][]; sprites[0] = BuildFlippedSprites(ObjectHelper.MapASMToBmp(LevelData.ReadFile( "../Levels/ICZ/Nemesis Art/Misc Art 1.bin", CompressionType.Nemesis), "../Levels/ICZ/Misc Object Data/Map - Platforms.asm", 0, 2)); var indexer = new MultiFileIndexer <byte>(); indexer.AddFile(new List <byte>(LevelData.ReadFile("LevelArt", 0)), -32); var extra = ObjectHelper.MapASMToBmp(indexer.ToArray(), "../Levels/ICZ/Misc Object Data/Map - Wall and Column.asm", 8, 2); extra.Offset(-16, 16); sprites[1] = new Sprite[4]; for (var index = 0; index < 4; index++) { sprites[1][index] = new Sprite(extra, sprites[0][index]); } sprites[2] = BuildFlippedSprites(ObjectHelper.UnknownObject); overlays = new Sprite[2]; var overlay = new BitmapBits(0x80, 1); overlay.DrawLine(LevelData.ColorWhite, 0x00, 0, 0x03, 0); overlay.DrawLine(LevelData.ColorWhite, 0x08, 0, 0x0B, 0); overlay.DrawLine(LevelData.ColorWhite, 0x10, 0, 0x13, 0); overlay.DrawLine(LevelData.ColorWhite, 0x18, 0, 0x67, 0); overlay.DrawLine(LevelData.ColorWhite, 0x6C, 0, 0x6F, 0); overlay.DrawLine(LevelData.ColorWhite, 0x74, 0, 0x77, 0); overlay.DrawLine(LevelData.ColorWhite, 0x7C, 0, 0x7F, 0); overlays[0] = new Sprite(overlay, -0x40, 0); overlay = new BitmapBits(1, 0x40); overlay.DrawLine(LevelData.ColorWhite, 0, 0x00, 0, 0x1F); overlay.DrawLine(LevelData.ColorWhite, 0, 0x24, 0, 0x27); overlay.DrawLine(LevelData.ColorWhite, 0, 0x2C, 0, 0x2F); overlay.DrawLine(LevelData.ColorWhite, 0, 0x34, 0, 0x37); overlay.DrawLine(LevelData.ColorWhite, 0, 0x3C, 0, 0x3F); overlays[1] = new Sprite(overlay); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var count = (obj.SubType >> 4) & 7; var range = ((obj.SubType & 0x0F) + 4) << 4; var bitmap = new BitmapBits(17, range); bitmap.DrawLine(LevelData.ColorWhite, 0, 0, 16, 0); bitmap.DrawLine(LevelData.ColorWhite, 8, 0, 8, range); var overlay = new Sprite(bitmap, -8 - count * 16, -range); for (var index = 0; index < count; index++) { overlay = new Sprite(new Sprite(overlay, 32, 0), overlay); } if (obj.XFlip && obj.SubType >= 0x80) { bitmap = new BitmapBits(97, 1); bitmap.DrawLine(LevelData.ColorWhite, 0, 0, 96, 0); overlay = new Sprite(new Sprite(bitmap, -48, 0), overlay); } return(overlay); }
public override void Init(ObjectData data) { properties = new PropertySpec[1]; subtypes = new ReadOnlyCollection <byte>(new byte[0]); unknownSprite = BuildFlippedSprites(ObjectHelper.UnknownObject); properties[0] = new PropertySpec("Path ID", typeof(int), "Extended", "The path information associated with this object.", null, (obj) => obj.SubType >> 1, (obj, value) => obj.SubType = (byte)((int)value << 1)); startCoords = new Point[4]; paths = new Sprite[4]; BuildPathsCoords(0, 0x1390, 0x2D0, 0x1230, 0x2D0, 0x1230, 0x300); BuildPathsCoords(1, 0x13F0, 0x2D0, 0x1560, 0x2D0, 0x1560, 0x280); BuildPathsCoords(2, 0x2090, 0x650, 0x2030, 0x650, 0x2030, 0x680); BuildPathsCoords(3, 0x20F0, 0x650, 0x21E0, 0x650, 0x21E0, 0x600); var bitmap = new BitmapBits(129, 401); bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 128, 32); bitmap.DrawLine(LevelData.ColorWhite, 64, 32, 64, 400); bitmap.DrawLine(LevelData.ColorBlack, 65, 32, 65, 400); overlay = new Sprite(bitmap, -64, -16); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var x = (obj.SubType & 0x7F) << 4; var y = x >> 2; var overlay = new BitmapBits(x, y); overlay.DrawLine(LevelData.ColorWhite, 0, 0, x, y); var sprite = new Sprite(overlay, 0, 0x41); overlay = new BitmapBits(1, 0x41); overlay.DrawLine(LevelData.ColorWhite, 0, 0x00, 0, 0x07); overlay.DrawLine(LevelData.ColorWhite, 0, 0x10, 0, 0x17); overlay.DrawLine(LevelData.ColorWhite, 0, 0x20, 0, 0x27); overlay.DrawLine(LevelData.ColorWhite, 0, 0x30, 0, 0x37); sprite = new Sprite(sprite, new Sprite(overlay, x, y)); if ((obj.SubType & 0x80) == 0) { overlay = new BitmapBits(0x81, 0x81); overlay.DrawCircle(LevelData.ColorWhite, 0x40, 0x40, 0x40); sprite = new Sprite(sprite, new Sprite(overlay, x - 0x40, y - 0x40)); } return(sprite); }
public override void Init(ObjectData data) { img = ObjectHelper.UnknownObject; List <Sprite> sprs = new List <Sprite>(); int left = -208; int right = 208; int top = 0; int bottom = 0; for (int i = 0; i < Obj06_CosineTable.Length; i++) { top = Math.Min(Obj06_CosineTable[i], top); bottom = Math.Max(Obj06_CosineTable[i], bottom); } Point offset = new Point(left, top); BitmapBits bmp = new BitmapBits(right - left, bottom - top); for (int x = 0; x < 0x1A0; x++) { int y = Obj06_CosineTable[x] - top; if (x < bmp.Width & y >= 0 & y < bmp.Height) { bmp[x, y] = 0x1C; } } sprs.Add(new Sprite(bmp, offset)); offset = new Point(-192, 0); bmp = new BitmapBits(0x180, 53); bmp.DrawLine(0x1C, 192, 0, 192, 52); bmp.DrawLine(0x1C, 0, 52, 0x180, 52); sprs.Add(new Sprite(bmp, offset)); sprs.Add(img); sprite = new Sprite(sprs.ToArray()); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var index = obj.SubType & 0x1F; if (index >= paths.Length) return null; int minX = obj.X, maxX = obj.X, minY = obj.Y, maxY = obj.Y; var coord = obj.SubType < 0x80 ? startCoords[index] : endCoords[index]; if (coord.X < minX) minX = coord.X; else if (coord.X > maxX) maxX = coord.X; if (coord.Y < minY) minY = coord.Y; else if (coord.Y > maxY) maxY = coord.Y; var white = new BitmapBits(maxX - minX + 1, maxY - minY + 1); var black = new BitmapBits(white.Width + 1, white.Height + 1); int x1 = obj.X - minX, y1 = obj.Y - minY; int x2 = coord.X - minX, y2 = coord.Y - minY; white.DrawLine(LevelData.ColorWhite, x1, y1, x2, y2); black.DrawLine(LevelData.ColorBlack, x1, y1 + 1, x2, y2 + 1); black.DrawLine(LevelData.ColorBlack, x1 + 1, y1, x2 + 1, y2); black.DrawLine(LevelData.ColorBlack, x1 + 1, y1 + 1, x2 + 1, y2 + 1); var overlay = new Sprite( new Sprite(black, minX, minY), paths[index], new Sprite(white, minX, minY)); overlay.Offset(-obj.X, -obj.Y); return overlay; }
public override Sprite GetDebugOverlay(ObjectEntry obj) { if (obj.SubType == 0x02) { var overlay = new BitmapBits(0x80, 1); overlay.DrawLine(LevelData.ColorWhite, 0x00, 0, 0x03, 0); overlay.DrawLine(LevelData.ColorWhite, 0x08, 0, 0x0B, 0); overlay.DrawLine(LevelData.ColorWhite, 0x10, 0, 0x13, 0); overlay.DrawLine(LevelData.ColorWhite, 0x18, 0, 0x67, 0); overlay.DrawLine(LevelData.ColorWhite, 0x6C, 0, 0x6F, 0); overlay.DrawLine(LevelData.ColorWhite, 0x74, 0, 0x77, 0); overlay.DrawLine(LevelData.ColorWhite, 0x7C, 0, 0x7F, 0); return(new Sprite(overlay, -0x40, 0)); } if (obj.SubType == 0x06) { var overlay = new BitmapBits(1, 0x40); overlay.DrawLine(LevelData.ColorWhite, 0, 0x00, 0, 0x1F); overlay.DrawLine(LevelData.ColorWhite, 0, 0x24, 0, 0x27); overlay.DrawLine(LevelData.ColorWhite, 0, 0x2C, 0, 0x2F); overlay.DrawLine(LevelData.ColorWhite, 0, 0x34, 0, 0x37); overlay.DrawLine(LevelData.ColorWhite, 0, 0x3C, 0, 0x3F); return(new Sprite(overlay)); } return(null); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { if (obj.SubType == 0) { var bitmap = new BitmapBits(225, 39); bitmap.DrawLine(LevelData.ColorWhite, 0, 0, 0, 38); bitmap.DrawLine(LevelData.ColorWhite, 0, 19, 224, 19); bitmap.DrawLine(LevelData.ColorWhite, 224, 0, 224, 38); return(new Sprite(bitmap, -112, -19)); } else { var height = obj.SubType << 8; var bitmap = new BitmapBits(225, height + 39); bitmap.DrawLine(LevelData.ColorWhite, 0, 0, 0, 38); bitmap.DrawLine(LevelData.ColorWhite, 0, 19, 112, 19); bitmap.DrawSine(LevelData.ColorWhite, 112, 19, 112, 128, height); bitmap.DrawLine(LevelData.ColorWhite, 112, height + 19, 224, height + 19); bitmap.DrawLine(LevelData.ColorWhite, 224, height, 224, height + 38); if (!obj.XFlip) { return(new Sprite(bitmap, -112, -19)); } var overlay = new Sprite(bitmap, -113, -20); overlay.Flip(true, true); return(overlay); } }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var direction = obj.SubType & 0x70; if (direction > 0x40) { return(null); } if (direction == 0x10) { var horz = new BitmapBits(8, 32); horz.DrawRectangle(LevelData.ColorWhite, 0, 0, 7, 31); return(new Sprite(horz, obj.XFlip ? 24 : 32, -16)); } if (direction < 0x30) { var vert = new BitmapBits(32, 8); vert.DrawRectangle(LevelData.ColorWhite, 0, 0, 31, 7); return(new Sprite(vert, -16, obj.YFlip ? 32 : 24)); } var diag = new BitmapBits(28, 28); diag.DrawLine(LevelData.ColorWhite, 0, 4, 4, 0); diag.DrawLine(LevelData.ColorWhite, 5, 0, 27, 22); diag.DrawLine(LevelData.ColorWhite, 0, 5, 22, 27); diag.DrawLine(LevelData.ColorWhite, 23, 27, 27, 23); var overlay = new Sprite(diag, -16, -16); overlay.Flip(obj.XFlip, obj.YFlip ^ direction == 0x40); overlay.Offset(obj.XFlip ^ direction == 0x40 ? 32 : -32, 32); return(overlay); }
public override void Init(ObjectData data) { properties = new PropertySpec[1]; subtypes = new ReadOnlyCollection <byte>(new byte[0]); sprite = BuildFlippedSprites(ObjectHelper.UnknownObject); overlay = new Sprite[2]; var bitmap = new BitmapBits(161, 161); bitmap.DrawLine(LevelData.ColorWhite, 0, 32, 32, 0); bitmap.DrawLine(LevelData.ColorWhite, 32, 0, 160, 128); bitmap.DrawLine(LevelData.ColorWhite, 0, 32, 128, 160); bitmap.DrawLine(LevelData.ColorWhite, 128, 160, 160, 128); overlay[0] = new Sprite(bitmap, -80, -80); overlay[1] = new Sprite(overlay[0], true, false); properties[0] = new PropertySpec("Direction", typeof(int), "Extended", "The object's orientation.", null, new Dictionary <string, int> { { "Left", 0 }, { "Right", 1 } }, (obj) => obj.SubType == 0 ? 1 : 0, (obj, value) => obj.SubType = (byte)((int)value == 0 ? 1 : 0)); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var range = ((obj.SubType & 0x0F) + 8) << 4; var overlay = new BitmapBits(17, range); overlay.DrawLine(LevelData.ColorWhite, 0, 0, 16, 0); overlay.DrawLine(LevelData.ColorWhite, 8, 0, 8, range); return(new Sprite(overlay, -8, -range - 4)); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { if (obj.SubType > 2) { return(null); } int minX = obj.X, maxX = obj.X, minY = obj.Y + 384, maxY = obj.Y + 384; for (var index = 0; index < 2; index++) { var coord = startCoords[obj.SubType + index]; if (coord.X < minX) { minX = coord.X; } else if (coord.X > maxX) { maxX = coord.X; } if (coord.Y < minY) { minY = coord.Y; } else if (coord.Y > maxY) { maxY = coord.Y; } } var white = new BitmapBits(maxX - minX + 1, maxY - minY + 1); var black = new BitmapBits(white.Width + 1, white.Height + 1); int x1 = obj.X - minX, y1 = obj.Y - minY + 384; for (var index = 0; index < 2; index++) { var coord = startCoords[obj.SubType + index]; int x2 = coord.X - minX, y2 = coord.Y - minY; white.DrawLine(LevelData.ColorWhite, x1, y1, x2, y2); black.DrawLine(LevelData.ColorBlack, x1, y1 + 1, x2, y2 + 1); black.DrawLine(LevelData.ColorBlack, x1 + 1, y1, x2 + 1, y2); black.DrawLine(LevelData.ColorBlack, x1 + 1, y1 + 1, x2 + 1, y2 + 1); } var overlay = new Sprite( new Sprite(black, minX, minY), new Sprite(this.overlay, obj.X, obj.Y), paths[obj.SubType], paths[obj.SubType + 1], new Sprite(white, minX, minY)); overlay.Offset(-obj.X, -obj.Y); return(overlay); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { if (obj.SubType == 0) { return(null); } var range = obj.SubType << 4; var overlay = new BitmapBits(32, range); overlay.DrawLine(LevelData.ColorWhite, 0, 0, 32, 0); overlay.DrawLine(LevelData.ColorWhite, 16, 0, 16, range); return(new Sprite(overlay, -16, -range - 16)); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var up = (obj.SubType & 0x30) == 0; var height = (obj.SubType & 0x0F) * 96 + 32; int xoffset, width; bool left; if (obj.SubType >= 0x80) { left = up && obj.XFlip; var distance = up ? obj.XFlip ? obj.X - 0x2AE0 : 0x16C0 - obj.X : 0x2B20 - obj.X; xoffset = left ? distance + 32 : distance > 32 ? 0 : 32 - distance; width = distance > 32 ? distance + (left ? 33 : 32) : 64; } else { left = ((obj.SubType & 1) == 0) ^ obj.XFlip; xoffset = left ? 96 : 0; width = left ? 97 : 96; } var overlay = new BitmapBits(width, height); overlay.DrawLine(LevelData.ColorWhite, xoffset, 0, xoffset, height); var x = left ? 0 : width - 64; if (up) { overlay.DrawRectangle(LevelData.ColorWhite, x, 0, 63, 31); } else { overlay.DrawRectangle(LevelData.ColorWhite, x, height - 32, 63, 31); } if (width > 64) { var y = up ? 16 : height - 16; if (left) { overlay.DrawLine(LevelData.ColorWhite, 64, y, width, y); } else { overlay.DrawLine(LevelData.ColorWhite, 0, y, width - 64, y); } } return(new Sprite(overlay, -xoffset, up ? 16 - height : -16)); }
private void BuildPathsCoords(int index, int startX, int startY, params int[] waypoints) { startCoords[index] = new Point(startX, startY); int minX = startX, maxX = startX, minY = startY, maxY = startY; for (var i = 0; i < waypoints.Length; i += 2) { var curX = waypoints[i]; if (curX < minX) { minX = curX; } else if (curX > maxX) { maxX = curX; } var curY = waypoints[i + 1]; if (curY < minY) { minY = curY; } else if (curY > maxY) { maxY = curY; } } var bitmap = new BitmapBits(maxX - minX + 2, maxY - minY + 2); int x1 = startX - minX, y1 = startY - minY; var previous = new Point(x1, y1); for (var i = 0; i < waypoints.Length; i += 2) { int x2 = waypoints[i] - minX, y2 = waypoints[i + 1] - minY; bitmap.DrawLine(LevelData.ColorBlack, x1, y1 + 1, x2, y2 + 1); bitmap.DrawLine(LevelData.ColorBlack, x1 + 1, y1, x2 + 1, y2); bitmap.DrawLine(LevelData.ColorBlack, x1 + 1, y1 + 1, x2 + 1, y2 + 1); x1 = x2; y1 = y2; } for (var i = 0; i < waypoints.Length; i += 2) { var current = new Point(waypoints[i] - minX, waypoints[i + 1] - minY); bitmap.DrawLine(LevelData.ColorWhite, previous, current); previous = current; } previous.Offset(minX, minY); paths[index] = new Sprite(bitmap, minX, minY); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var range = ((obj.SubType & 0x7F) << 4) + 15; var height = range < 32 ? 32 : range + 1; var overlay = new BitmapBits(32, height); overlay.DrawRectangle(LevelData.ColorWhite, 0, 0, 31, 31); overlay.DrawLine(LevelData.ColorWhite, 0, range, 31, range); if (height > 32) { overlay.DrawLine(LevelData.ColorWhite, 16, 32, 16, height); } return(new Sprite(overlay, -16, -16)); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var routine = obj.SubType & 0x70; if (routine == 0x00 || routine > 0x40) { return(null); } if (routine == 0x30) { var overlay = new BitmapBits(129, 129); overlay.DrawCircle(LevelData.ColorWhite, 64, 64, 64); return(new Sprite(overlay, -64, -64)); } else { var length = routine == 0x20 ? 128 : 64; var offset = -length / 2; if (routine == 0x40) { length = lengths[obj.SubType & 0x0F]; offset = obj.XFlip ? -length : 0; } var overlay = new BitmapBits(1, length); overlay.DrawLine(LevelData.ColorWhite, 0, 0, 0, length); return(new Sprite(overlay, 0, offset)); } }
protected Sprite Line(int width, int height) { var overlay = new BitmapBits(width + 1, height + 1); overlay.DrawLine(LevelData.ColorWhite, 0, height, width, 0); return(new Sprite(overlay, 0, -height)); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var overlay = new BitmapBits(161, 1); overlay.DrawLine(LevelData.ColorWhite, 0, 0, 160, 0); return(new Sprite(overlay, -80, 12)); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var routine = obj.SubType & 0x0F; var frame = obj.SubType >> 4; if (routine == 0 || routine > 6 || frame >= sprites.Length) { return(null); } var length = 64 << ((routine - 1) % 3); var adjust = frame == 0 ? 0 : frame == 1 ^ obj.YFlip ? 16 : -16; if (routine > 3) { var offset = (obj.XFlip ? length : -length) / 2; var bitmap = new BitmapBits(64, 128); bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 63, 127); return(new Sprite(bitmap, -32, offset + adjust - 64)); } else { var bitmap = new BitmapBits(length, 1); bitmap.DrawLine(LevelData.ColorWhite, 0, 0, length, 0); return(new Sprite(bitmap, -length / 2, adjust)); } }
public override Sprite GetDebugOverlay(ObjectEntry obj) { if (obj.SubType == 0) return null; var bitmap = new BitmapBits(obj.SubType, 1); bitmap.DrawLine(LevelData.ColorWhite, 0, 0, obj.SubType, 0); return new Sprite(bitmap, -obj.SubType / 2, obj.YFlip ? -9 : 8); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var height = (obj.SubType & 0x7F) << 3; if (height == 0) { return(null); } var overlay = new BitmapBits(32, height + 1); overlay.DrawLine(LevelData.ColorWhite, 0, 0, 31, 0); overlay.DrawLine(LevelData.ColorWhite, 16, 0, 16, height); overlay.DrawLine(LevelData.ColorWhite, 0, height, 31, height); return(new Sprite(overlay, -16, obj.XFlip ? -height - 4 : -4)); }
public override void Init(ObjectData data) { var version = LevelData.Game.MappingsVersion; var art = LevelData.ReadFile("../Levels/LBZ/Nemesis Art/Misc Art.bin", CompressionType.Nemesis); var map = LevelData.ASMToBin("../Levels/LBZ/Misc Object Data/Map - Moving Platform.asm", version); BuildSprites(art, map, 0x00); slidingSprite = ObjectHelper.MapToBmp(art, map, 1, 2); var overlays = new Sprite[15]; this.overlays.CopyTo(overlays, 0); this.overlays = overlays; var bitmap = new BitmapBits(1, 0x1C); bitmap.DrawLine(LevelData.ColorWhite, 0, 0x00, 0, 0x03); bitmap.DrawLine(LevelData.ColorWhite, 0, 0x08, 0, 0x0B); bitmap.DrawLine(LevelData.ColorWhite, 0, 0x10, 0, 0x13); bitmap.DrawLine(LevelData.ColorWhite, 0, 0x18, 0, 0x1B); overlays[13] = new Sprite(bitmap, 0, 4); overlays[14] = overlays[13]; var routines = properties[0].Enumeration; routines.Remove(System.Linq.Enumerable.Single(routines, entry => entry.Value == 7).Key); routines.Add("Falling (delay)", 13); routines.Add("Falling (instant)", 14); routines.Add("Sliding", 0x80); properties = new[] { properties[0], new PropertySpec("Distance", typeof(string), "Extended", "Horizontal distance for the sliding behavior, in pixels.", null, (obj) => obj.SubType < 0x80 ? "N/A" : ((obj.SubType & 0x7F) << 4).ToString(), (obj, value) => { if (obj.SubType >= 0x80) { obj.SubType = (byte)(0x80 | ((int.Parse((string)value) >> 4) & 0x7F)); } }) }; }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var distance = (obj.SubType << 3) + 8; var overlay = new BitmapBits(distance, 1); overlay.DrawLine(LevelData.ColorWhite, 0, 0, distance, 0); return(new Sprite(overlay)); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var ceiling = FindCeiling(obj); var width = obj.SubType << 3; var height = Math.Abs(obj.Y - 20 - ceiling); var bitmap = new BitmapBits(width + 1, height + 1); var xoffset = obj.XFlip ? width : 0; bitmap.DrawLine(LevelData.ColorWhite, xoffset, 0, xoffset, height); bitmap.DrawLine(LevelData.ColorWhite, 0, 0, width, 0); var yflip = obj.Y - 20 < ceiling; var overlay = new Sprite(bitmap, -xoffset, yflip ? -height - 1 : -height); overlay.Flip(false, yflip); return(overlay); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { var range = ((obj.SubType & 0x7F) << 3) + 8; var height = range > 64 ? range : 64; range = height - range; var overlay = new BitmapBits(128, height); overlay.DrawRectangle(LevelData.ColorWhite, 0, height - 64, 127, 63); overlay.DrawLine(LevelData.ColorWhite, 0, range, 128, range); if (range < 48) { overlay.DrawLine(LevelData.ColorWhite, 64, range, 64, height - 16); } return(new Sprite(overlay, -64, 8 - height)); }
public override void Init(ObjectData data) { var indexer = new MultiFileIndexer <byte>(); indexer.AddFile(new List <byte>(LevelData.ReadFile( "../Levels/SSZ/Nemesis Art/Misc.bin", CompressionType.Nemesis)), -3712); subtypes = new ReadOnlyCollection <byte>(new byte[0]); sprite = ObjectHelper.MapASMToBmp(indexer.ToArray(), "../Levels/SSZ/Misc Object Data/Map - Elevator Bar.asm", 0, 2); var bitmap = new BitmapBits(32, 129); bitmap.DrawLine(LevelData.ColorWhite, 0, 0, 31, 0); bitmap.DrawLine(LevelData.ColorWhite, 16, 0, 16, 128); bitmap.DrawLine(LevelData.ColorWhite, 0, 128, 31, 128); overlay = new Sprite(bitmap, -16, -64); }
public override Sprite GetDebugOverlay(ObjectEntry obj) { if (obj.SubType == 0) { return(null); } var range = obj.SubType * 2; var bitmap = new BitmapBits(range, 1); bitmap.DrawLine(LevelData.ColorWhite, 0, 0, range, 0); return(new Sprite(bitmap, -obj.SubType, 0)); }
private void TilePicture_MouseMove(object sender, MouseEventArgs e) { if (tool == Tool.Pencil && e.Button == System.Windows.Forms.MouseButtons.Left) { if (new Rectangle(Point.Empty, TilePicture.Size).Contains(e.Location)) { tile.DrawLine((byte)((selectedColor.Y * 16) + selectedColor.X), lastpoint, new Point(e.X / (int)numericUpDown1.Value, e.Y / (int)numericUpDown1.Value)); tile[e.X / (int)numericUpDown1.Value, e.Y / (int)numericUpDown1.Value] = (byte)((selectedColor.Y * 16) + selectedColor.X); } lastpoint = new Point(e.X / (int)numericUpDown1.Value, e.Y / (int)numericUpDown1.Value); DrawTile(); } }
public static void DrawSine(this BitmapBits bitmap, byte index, int x, int y, int amplitude, int period, int height) { int x1 = x, y2 = y; int max = height + y; while (y2 < max) { var y1 = y2++; var radians = (y2 - y) * 2 * Math.PI / period; var x2 = x + (int)Math.Round(amplitude * Math.Sin(radians)); bitmap.DrawLine(index, x1, y1, x2, y2); x1 = x2; } }
public override void Init(ObjectData data) { img = ObjectHelper.UnknownObject; List<Sprite> sprs = new List<Sprite>(); int left = -208; int right = 208; int top = 0; int bottom = 0; for (int i = 0; i < Obj06_CosineTable.Length; i++) { top = Math.Min(Obj06_CosineTable[i], top); bottom = Math.Max(Obj06_CosineTable[i], bottom); } Point offset = new Point(left, top); BitmapBits bmp = new BitmapBits(right - left, bottom - top); for (int x = 0; x < 0x1A0; x++) { int y = Obj06_CosineTable[x] - top; if (x < bmp.Width & y >= 0 & y < bmp.Height) bmp[x, y] = 0x1C; } sprs.Add(new Sprite(bmp, offset)); offset = new Point(-192, 0); bmp = new BitmapBits(0x180, 53); bmp.DrawLine(0x1C, 192, 0, 192, 52); bmp.DrawLine(0x1C, 0, 52, 0x180, 52); sprs.Add(new Sprite(bmp, offset)); sprs.Add(img); sprite = new Sprite(sprs.ToArray()); }