public void write(ByteArrayOutputStream outp, ByteArrayOutputStream outn) { outp.writeUShort((ushort)id); outp.writeUShort((ushort)(outn.getPos()/16)); outp.writeUShort((ushort)(points.Count)); outp.writeUShort(0); //Unused values foreach (NSMBPathPoint p in points) p.write(outn); }
public void writeZone(ByteArrayOutputStream outp) { outp.writeUShort((ushort)X); outp.writeUShort((ushort)Y); outp.writeUShort((ushort)Width); outp.writeUShort((ushort)Height); outp.writeByte((byte)Number); outp.writeByte(0); outp.writeByte(0); outp.writeByte(0); }
public void write(ByteArrayOutputStream outp, ByteArrayOutputStream outn) { outp.writeUShort((ushort)id); outp.writeUShort((ushort)(outn.getPos() / 16)); outp.writeUShort((ushort)(points.Count)); outp.writeUShort(0); //Unused values foreach (NSMBPathPoint p in points) { p.write(outn); } }
public override void save() { ByteArrayOutputStream os = new ByteArrayOutputStream(); for (int i = 0; i < f.fileSize / 8; i++) { int x = (i % (width / 2)) * 2; int y = (i / (width / 2)) * 2; os.writeUShort(tileToShort(tiles[x, y])); os.writeUShort(tileToShort(tiles[x + 1, y])); os.writeUShort(tileToShort(tiles[x, y + 1])); os.writeUShort(tileToShort(tiles[x + 1, y + 1])); } f.replace(os.getArray(), this); }
public override void save() { ByteArrayOutputStream os = new ByteArrayOutputStream(); for (int i = 0; i < f.fileSize / 8; i++) { int x = (i % (width/2))*2; int y = (i / (width/2))*2; os.writeUShort(tileToShort(tiles[x, y])); os.writeUShort(tileToShort(tiles[x+1, y])); os.writeUShort(tileToShort(tiles[x, y+1])); os.writeUShort(tileToShort(tiles[x+1, y+1])); } f.replace(os.getArray(), this); }
public override void save() { ByteArrayOutputStream oo = new ByteArrayOutputStream(); for (int i = 0; i < pal.Length; i++) oo.writeUShort(NSMBTileset.toRGB15(pal[i])); f.replace(oo.getArray(), this); }
internal void write(ByteArrayOutputStream outn) { outn.writeUShort((ushort)X); outn.writeUShort((ushort)Y); outn.writeUShort(Unknown1); outn.writeUShort(Unknown2); outn.writeUShort(Unknown3); outn.writeUShort(Unknown4); outn.writeUShort(Unknown5); outn.writeUShort(Unknown6); }
public static byte[] paletteToRawData(Color[] pal) { ByteArrayOutputStream file = new ByteArrayOutputStream(); for (int i = 0; i < pal.Length; i++) { file.writeUShort(toRGB15(pal[i])); } return(file.getArray()); }
public override byte[] getRawData() { ByteArrayOutputStream oo = new ByteArrayOutputStream(); for (int i = 0; i < pal.Length; i++) { oo.writeUShort(NSMBTileset.toRGB15(pal[i])); } return(oo.getArray()); }
public override void save() { ByteArrayOutputStream oo = new ByteArrayOutputStream(); for (int i = 0; i < pal.Length; i++) { oo.writeUShort(NSMBTileset.toRGB15(pal[i])); } f.replace(oo.getArray(), this); }
public virtual void save() { ByteArrayOutputStream os = new ByteArrayOutputStream(); for (int i = 0; i < f.fileSize / 2; i++) { int x = i % width; int y = i / width; os.writeUShort(tileToShort(tiles[x, y])); } f.replace(os.getArray(), this); }
public void write(ByteArrayOutputStream outp, ByteArrayOutputStream cam, int camID) { outp.writeUShort((ushort)X); outp.writeUShort((ushort)Y); outp.writeUShort((ushort)Width); outp.writeUShort((ushort)Height); outp.writeByte((byte)Number); outp.writeByte((byte)camID); outp.writeByte((byte)Music); outp.writeByte((byte)Unknown1); outp.writeByte((byte)Unknown2); outp.writeByte((byte)Unknown3); outp.writeByte((byte)Lighting); outp.writeByte((byte)FlagpoleID); cam.writeInt(CameraTop); cam.writeInt(CameraBottom); cam.writeInt(CameraTopSpin); cam.writeInt(CameraBottomSpin); cam.writeUShort((ushort)camID); cam.writeUShort((ushort)CameraBottomStick); cam.writeUInt(0); //This seems just padding. }
public void saveObjects() { ByteArrayOutputStream eObjIndexFile = new ByteArrayOutputStream(); ByteArrayOutputStream eObjFile = new ByteArrayOutputStream(); for (int i = 0; i < Objects.Length; i++) { if (Objects[i] == null) { break; } eObjIndexFile.writeUShort((ushort)eObjFile.getPos()); eObjIndexFile.writeByte((byte)Objects[i].width); eObjIndexFile.writeByte((byte)Objects[i].height); Objects[i].save(eObjFile); } ObjFile.replace(eObjFile.getArray(), this); ObjIndexFile.replace(eObjIndexFile.getArray(), this); }
public virtual void save() { ByteArrayOutputStream os = new ByteArrayOutputStream(); for (int i = 0; i < f.fileSize / 2; i++) { int x = i % width; int y = i / width; os.writeUShort(tileToShort(tiles[x, y])); } f.replace(os.getArray(), this); }
public void saveObjects() { ByteArrayOutputStream eObjIndexFile = new ByteArrayOutputStream(); ByteArrayOutputStream eObjFile = new ByteArrayOutputStream(); for (int i = 0; i < Objects.Length; i++) { if (Objects[i] == null) break; eObjIndexFile.writeUShort((ushort)eObjFile.getPos()); eObjIndexFile.writeByte((byte)Objects[i].width); eObjIndexFile.writeByte((byte)Objects[i].height); Objects[i].save(eObjFile); } ObjFile.replace(eObjFile.getArray(), this); ObjIndexFile.replace(eObjIndexFile.getArray(), this); }
private void importPNGButton_Click(object sender, EventArgs e) { getFiles(); if (GFXFile == null) { return; } if (PalFile == null) { return; } if (LayoutFile == null) { return; } int offs = bg.topLayer ? 256 : 576; int palOffs = bg.topLayer ? 8 : 10; OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = LanguageManager.Get("Filters", "png"); ofd.CheckFileExists = true; if (ofd.ShowDialog() != DialogResult.OK) { return; } string filename = ofd.FileName; Bitmap b = new Bitmap(filename); ImageTiler ti = new ImageTiler(b); Color[] palette = ImageIndexer.createPaletteForImage(b); ByteArrayOutputStream oo = new ByteArrayOutputStream(); for (int i = 0; i < palette.Length; i++) { oo.writeUShort(NSMBTileset.toRGB15(palette[i])); } for (int i = 0; i < 256; i++) { oo.writeUShort(0); } PalFile.beginEdit(this); PalFile.replace(ROM.LZ77_Compress(oo.getArray()), this); PalFile.endEdit(this); GFXFile.beginEdit(this); GFXFile.replace(ROM.LZ77_Compress(ImageIndexer.indexImageWithPalette(ti.tileBuffer, palette)), this); GFXFile.endEdit(this); b.Dispose(); ByteArrayOutputStream layout = new ByteArrayOutputStream(); for (int y = 0; y < 64; y++) { for (int x = 0; x < 64; x++) { layout.writeUShort((ushort)((ti.tileMap[x, y] + offs) | (palOffs << 12))); } } LayoutFile.beginEdit(this); LayoutFile.replace(ROM.LZ77_Compress(layout.getArray()), this); LayoutFile.endEdit(this); }
public void writeZone(ByteArrayOutputStream outp) { outp.writeUShort((ushort)X); outp.writeUShort((ushort)Y); outp.writeUShort((ushort)Width); outp.writeUShort((ushort)Height); outp.writeByte((byte)Number); outp.writeByte(0); outp.writeByte(0); outp.writeByte(0); }
public void write(ByteArrayOutputStream outp, ByteArrayOutputStream cam, int camID) { outp.writeUShort((ushort)X); outp.writeUShort((ushort)Y); outp.writeUShort((ushort)Width); outp.writeUShort((ushort)Height); outp.writeByte((byte)Number); outp.writeByte((byte)camID); outp.writeByte((byte)Music); outp.writeByte((byte)Unknown1); outp.writeByte((byte)Unknown2); outp.writeByte((byte)Unknown3); outp.writeByte((byte)Lighting); outp.writeByte((byte)FlagpoleID); cam.writeInt(CameraTop); cam.writeInt(CameraBottom); cam.writeInt(CameraTopSpin); cam.writeInt(CameraBottomSpin); cam.writeUShort((ushort)camID); cam.writeUShort((ushort)CameraBottomStick); cam.writeUInt(0); //This seems just padding. }
public static byte[] paletteToRawData(Color[] pal) { ByteArrayOutputStream file = new ByteArrayOutputStream(); for (int i = 0; i < pal.Length; i++) { file.writeUShort(toRGB15(pal[i])); } return file.getArray(); }
private void importPNGButton_Click(object sender, EventArgs e) { getFiles(); if (GFXFile == null) return; if (PalFile == null) return; if (LayoutFile == null) return; int offs = bg.topLayer ? 256 : 576; int palOffs = bg.topLayer ? 8 : 10; OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = LanguageManager.Get("Filters", "png"); ofd.CheckFileExists = true; if (ofd.ShowDialog() != DialogResult.OK) return; string filename = ofd.FileName; Bitmap b = new Bitmap(filename); ImageTiler ti = new ImageTiler(b); Color[] palette = ImageIndexer.createPaletteForImage(b); ByteArrayOutputStream oo = new ByteArrayOutputStream(); for (int i = 0; i < palette.Length; i++) oo.writeUShort(NSMBTileset.toRGB15(palette[i])); for (int i = 0; i < 256; i++) oo.writeUShort(0); PalFile.beginEdit(this); PalFile.replace(ROM.LZ77_Compress(oo.getArray()), this); PalFile.endEdit(this); GFXFile.beginEdit(this); GFXFile.replace(ROM.LZ77_Compress(ImageIndexer.indexImageWithPalette(ti.tileBuffer, palette)), this); GFXFile.endEdit(this); b.Dispose(); ByteArrayOutputStream layout = new ByteArrayOutputStream(); for (int y = 0; y < 64; y++) for (int x = 0; x < 64; x++) layout.writeUShort((ushort)((ti.tileMap[x, y] + offs) | (palOffs<<12))); LayoutFile.beginEdit(this); LayoutFile.replace(ROM.LZ77_Compress(layout.getArray()), this); LayoutFile.endEdit(this); }
internal void write(ByteArrayOutputStream outn) { outn.writeUShort((ushort)X); outn.writeUShort((ushort)Y); outn.writeUShort(Unknown1); outn.writeUShort(Unknown2); outn.writeUShort(Unknown3); outn.writeUShort(Unknown4); outn.writeUShort(Unknown5); outn.writeUShort(Unknown6); }