public void save(FileOutput f) { f.writeHex("030401017735BB750000000201"); f.writeString(name.PadRight(0x38, (char)0)); f.writeByte(1); f.writeString(subname.PadRight(0x40, (char)0)); f.writeByte(1); foreach (float i in startPos) { f.writeFloat(i); } f.writeFlag(useStartPos); f.writeByte(1); f.writeInt(unk2); f.writeByte(1); f.writeBytes(unk3); f.writeHex("FFFFFFFF01"); f.writeChars(unk4); f.writeFlag(flag1); f.writeFlag(flag2); f.writeFlag(flag3); f.writeFlag(flag4); f.writeByte(1); f.writeInt(verts.Count); foreach (Vector2D v in verts) { f.writeByte(1); f.writeFloat(v.x); f.writeFloat(v.y); } f.writeByte(1); f.writeInt(normals.Count); foreach (Vector2D n in normals) { f.writeByte(1); f.writeFloat(n.x); f.writeFloat(n.y); } f.writeByte(1); f.writeInt(0); f.writeByte(1); f.writeInt(materials.Count); foreach (CollisionMat m in materials) { f.writeByte(1); f.writeBytes(m.material); } }
public void save(FileOutput f) { f.writeHex(magic); f.writeByte(1); f.writeString(name.PadRight(0x38, (char)0)); f.writeByte(1); f.writeString(subname.PadRight(0x40, (char)0)); f.writeByte(1); for (int i = 0; i < 3; i++) { f.writeFloat(startPos[i]); } f.writeFlag(useStartPos); f.writeByte(1); f.writeInt(unk1); f.writeByte(1); foreach (float i in unk2) { f.writeFloat(i); } f.writeInt(unk3); f.writeByte(1); f.writeChars(boneName); }
public void save(FileOutput f) { base.save(f); f.writeFlag(flag1); f.writeFlag(flag2); f.writeFlag(flag3); f.writeFlag(flag4); f.writeByte(1); f.writeInt(verts.Count); foreach (Vector2D v in verts) { f.writeByte(1); f.writeFloat(v.x); f.writeFloat(v.y); } f.writeByte(1); f.writeInt(normals.Count); foreach (Vector2D n in normals) { f.writeByte(1); f.writeFloat(n.x); f.writeFloat(n.y); } f.writeByte(1); f.writeInt(cliffs.Count); foreach (CollisionCliff c in cliffs) { c.save(f); } f.writeByte(1); f.writeInt(materials.Count); foreach (CollisionMat m in materials) { f.writeByte(1); f.writeBytes(m.material); } }
public byte[] Rebuild(int pos) { FileOutput f = new FileOutput(); f.Endian = Endianness.Big; f.writeInt(pos + f.pos() + 0x20); f.writeInt(matHash); f.writeInt(properties.Count); int nameOffset = pos + f.pos() + 0x15 + name.Length; while (nameOffset % 4 != 0) { nameOffset++; } f.writeInt(nameOffset); f.writeFlag(hasPat); f.writeBytes(new byte[3]); //Write all the mat data into a buffer (g) then write pat offset int pos2 = pos + f.pos() + 4; FileOutput g = new FileOutput(); g.Endian = Endianness.Big; if (matHash2 != 0) { g.writeInt(pos2 + g.pos() + 0x8); g.writeInt(matHash); } else { g.writeBytes(new byte[8]); } g.writeString(name); g.writeByte(0); while ((pos2 + g.pos()) % 0x10 != 0) { g.writeByte(0); } int position = pos2 + g.pos() + properties.Count * 4; while (position % 16 != 0) { position++; } List <byte[]> builtProperties = new List <byte[]>(); foreach (MatData prop in properties) { g.writeInt(position); byte[] b = prop.Rebuild(position); builtProperties.Add(b); position += b.Length; while (position % 16 != 0) { position++; } } while ((pos2 + g.pos()) % 16 != 0) { g.writeByte(0); } foreach (byte[] b in builtProperties) { g.writeBytes(b); while ((pos2 + g.pos()) % 16 != 0) { g.writeByte(0); } } f.writeInt(pos2 + g.pos()); f.writeBytes(g.getBytes()); if (hasPat) { f.writeBytes(pat0.Rebuild(f.pos())); } return(f.getBytes()); }