tmp.put(transparency[i].buff);
}
fillLine(tmp);
ro=tmp.position();
for(int i=0;i<transparency.length;i++){
AnimSubStructure temp=new AnimSubStructure();
temp.setnValues(1);
temp.setofsValues(ro+i*Short.SIZE+AnimSubStructure.end*transparency.length+(16-(AnimSubStructure.end*transparency.length)%16)+AnimSubStructure.end*transparency.length+(16-(AnimSubStructure.end*transparency.length)%16));
temp.render();
tmp.put(temp.buff);
}
fillLine(tmp);
ro=tmp.position();
for(int i=0;i<transparency.length;i++){
AnimSubStructure temp=new AnimSubStructure();
temp.setnValues(1); //+(transparency.length*Short.SIZE)
temp.setofsValues(ro+(AnimSubStructure.end*transparency.length)+(16-(AnimSubStructure.end*transparency.length)%16)+(i*Short.SIZE)+(16-(transparency.length*Short.SIZE)%16));
temp.render();
tmp.put(temp.buff);
}
fillLine(tmp);
ro=tmp.position();
for(int i=0;i<transparency.length;i++){
tmp.putShort((short) 0);
}
fillLine(tmp);
ro=tmp.position();
for(int i=0;i<transparency.length;i++){
tmp.putShort((short) 0x7fff);
}
fillLine(tmp);
ro=tmp.position();
header.setnTransLookup(transparency.length);
header.setofsTransLookup(ro);
for(int i=0;i<transparency.length;i++){
tmp.putShort((short) i);
}
fillLine(tmp);
ro=tmp.position();
}
if(texdefs!=null){
ro=tmp.position();
header.setnTextures(texdefs.length);
header.setofsTextures(ro);
for(int i=0;i<texdefs.length;i++){
int texofs=0;
texofs+=ro+texdefs.length*TexDef.end+(16-(texdefs.length*TexDef.end)%0x10);
for(int j=0;j<i;j++){
texofs+=textures[j].toString().length()+1+(16-(textures[j].toString().length()+1)%0x10);
}
texdefs[i].setlenFilename(textures[i].toString().length()+1);
texdefs[i].setofsFilename(texofs);
texdefs[i].render();
tmp.put(texdefs[i].buff);
}
fillLine(tmp);
int[] texpos=new int[textures.length];
for(int i=0;i<textures.length;i++){
texpos[i]=tmp.position();
textures[i].render();
tmp.put(textures[i].toString().getBytes());
tmp.put((byte) 0);
fillLine(tmp);
}
ro=tmp.position();
}
if(texturelookup!=null){
header.setnTexLookup(texturelookup.length);
header.setofsTexLookup(ro);
for(int i=0;i<texturelookup.length;i++){
tmp.putShort(texturelookup[i]);
}
fillLine(tmp);
ro=tmp.position();
}
if(texunits!=null){
header.setnTexUnits(texunits.length);
header.setofsTexUnits(ro);
for(int i=0;i<texunits.length;i++){
tmp.putShort(texunits[i]);
}
fillLine(tmp);
ro=tmp.position();
}
if(texreplace!=null){
header.setnTexReplace(texreplace.length);
header.setofsTexReplace(ro);
for(int i=0;i<texreplace.length;i++){
tmp.putShort(texreplace[i]);
}
fillLine(tmp);
ro=tmp.position();
}
if(texanimlookup!=null){
header.setnTexAnimLookup(texanimlookup.length);
header.setofsTexAnimLookup(ro);
for(int i=0;i<texanimlookup.length;i++){
tmp.putShort(texanimlookup[i]);
}
fillLine(tmp);
ro=tmp.position();
}
if(renderflags!=null){
header.setnRenderFlags(renderflags.length);
header.setofsRenderFlags(ro);
for(int i=0;i<renderflags.length;i++){
renderflags[i].render();
tmp.put(renderflags[i].buff);
}
fillLine(tmp);
ro=tmp.position();
}
if(boundingtriangles!=null){
header.setnBoundingTriangles(boundingtriangles.length);
header.setofsBoundingTriangles(ro);
for(int i=0;i<boundingtriangles.length;i++){
for(int k=0;k<3;k++){
tmp.putShort(boundingtriangles[i][k]);
}
}
fillLine(tmp);
ro=tmp.position();
}
if(boundingvertices!=null){
header.setnBoundingVertices(boundingvertices.length);
header.setofsBoundingVertices(ro);
for(int i=0;i<boundingvertices.length;i++){
for(int k=0;k<3;k++){
tmp.putFloat(boundingvertices[i][k]);
}
}
fillLine(tmp);
ro=tmp.position();
}
if(boundingnormals!=null){
header.setnBoundingNormals(boundingnormals.length);
header.setofsBoundingNormals(ro);
for(int i=0;i<boundingnormals.length;i++){
for(int k=0;k<3;k++){
tmp.putFloat(boundingnormals[i][k]);
}
}
fillLine(tmp);
ro=tmp.position();
}
if(attachments!=null){
header.setnAttachment(attachments.length);
header.setofsAttachment(ro);
for(int i=0;i<attachments.length;i++){
attachments[i].render();
tmp.put(attachments[i].buff);
}
fillLine(tmp);
ro=tmp.position();
header.setnAttachmentlookup(attachments.length);
header.setofsAttachmentlookup(ro);
for(int i=0;i<attachments.length;i++){
tmp.putShort((short) i);
}
fillLine(tmp);
ro=tmp.position();
}
if(ribbon!=null){
header.setnRibbons(ribbon.length);
header.setofsRibbons(ro);
for(int i=0;i<ribbon.length;i++){
ribbon[i].Color.setnTimeSubstructures(1);
ribbon[i].Color.setofsTimeSubstructures(ro+(i*AnimSubStructure.end)+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16));
ribbon[i].Opacity.setnTimeSubstructures(1);
ribbon[i].Opacity.setofsTimeSubstructures(ro+(i*AnimSubStructure.end)+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+1*(ribbon.length*AnimSubStructure.end)+1*(16-(AnimSubStructure.end*ribbon.length)%16));
ribbon[i].Above.setnTimeSubstructures(1);
ribbon[i].Above.setofsTimeSubstructures(ro+(i*AnimSubStructure.end)+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+2*(ribbon.length*AnimSubStructure.end)+2*(16-(AnimSubStructure.end*ribbon.length)%16));
ribbon[i].Below.setnTimeSubstructures(1);
ribbon[i].Below.setofsTimeSubstructures(ro+(i*AnimSubStructure.end)+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+3*(ribbon.length*AnimSubStructure.end)+3*(16-(AnimSubStructure.end*ribbon.length)%16));
ribbon[i].Unk1.setnTimeSubstructures(1);
ribbon[i].Unk1.setofsTimeSubstructures(ro+(i*AnimSubStructure.end)+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+4*(ribbon.length*AnimSubStructure.end)+4*(16-(AnimSubStructure.end*ribbon.length)%16));
ribbon[i].Unk2.setnTimeSubstructures(1);
ribbon[i].Unk2.setofsTimeSubstructures(ro+(i*AnimSubStructure.end)+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+5*(ribbon.length*AnimSubStructure.end)+5*(16-(AnimSubStructure.end*ribbon.length)%16));
ribbon[i].Color.setnKeySubstructures(1);
ribbon[i].Color.setofsKeySubstructures(ro+(i*AnimSubStructure.end)+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+6*(ribbon.length*AnimSubStructure.end)+6*(16-(AnimSubStructure.end*ribbon.length)%16));
ribbon[i].Opacity.setnKeySubstructures(1);
ribbon[i].Opacity.setofsKeySubstructures(ro+(i*AnimSubStructure.end)+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+7*(ribbon.length*AnimSubStructure.end)+7*(16-(AnimSubStructure.end*ribbon.length)%16));
ribbon[i].Above.setnKeySubstructures(1);
ribbon[i].Above.setofsKeySubstructures(ro+(i*AnimSubStructure.end)+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+8*(ribbon.length*AnimSubStructure.end)+8*(16-(AnimSubStructure.end*ribbon.length)%16));
ribbon[i].Below.setnKeySubstructures(1);
ribbon[i].Below.setofsKeySubstructures(ro+(i*AnimSubStructure.end)+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+9*(ribbon.length*AnimSubStructure.end)+9*(16-(AnimSubStructure.end*ribbon.length)%16));
ribbon[i].Unk1.setnKeySubstructures(1);
ribbon[i].Unk1.setofsKeySubstructures(ro+(i*AnimSubStructure.end)+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+10*(ribbon.length*AnimSubStructure.end)+10*(16-(AnimSubStructure.end*ribbon.length)%16));
ribbon[i].Unk2.setnKeySubstructures(1);
ribbon[i].Unk2.setofsKeySubstructures(ro+(i*AnimSubStructure.end)+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+11*(ribbon.length*AnimSubStructure.end)+11*(16-(AnimSubStructure.end*ribbon.length)%16));
int temp=0;
ribbon[i].setnInt(ribbonintegers[i].length);
for(int k=0;k<i;k++){
temp+=ribbonintegers[k].length*Integer.SIZE+(16-(ribbonintegers[k].length*Integer.SIZE)%16);
}
ribbon[i].setofsInt(ro+temp+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+12*(ribbon.length*AnimSubStructure.end)+12*(16-(AnimSubStructure.end*ribbon.length)%16));
ribbon[i].setnTexture(ribbonreftex[i].length);
temp=0;
for(int k=0;k<ribbon.length;k++){
temp+=ribbonintegers[k].length*Integer.SIZE+(16-(ribbonintegers[k].length*Integer.SIZE)%16);
}
for(int k=0;k<ribbon.length;k++){
temp+=ribbonreftex[k].length*Integer.SIZE+(16-(ribbonreftex[k].length*Integer.SIZE)%16);
}
ribbon[i].setofsTextures(ro+temp+ribbons.end*ribbon.length+(16-(ribbons.end*ribbon.length)%16)+12*(ribbon.length*AnimSubStructure.end)+12*(16-(AnimSubStructure.end*ribbon.length)%16));
ribbon[i].render();
tmp.put(ribbon[i].buff);
}
fillLine(tmp);
ro=tmp.position();
for(int k=0;k<6;k++){
for(int i=0;i<ribbon.length;i++){
AnimSubStructure temp=new AnimSubStructure();
temp.render();
tmp.put(temp.buff);
}
fillLine(tmp);
}
ro=tmp.position();
int calc=0;
for(int k=0;k<ribbon.length;k++){
calc+=ribbonintegers[k].length*Integer.SIZE+(16-(ribbonintegers[k].length*Integer.SIZE)%16);
}
for(int k=0;k<ribbon.length;k++){
calc+=ribbonreftex[k].length*Integer.SIZE+(16-(ribbonreftex[k].length*Integer.SIZE)%16);
}
for(int i=0;i<ribbon.length;i++){
AnimSubStructure temp=new AnimSubStructure();
temp.setnValues(1);
temp.setofsValues(calc+ro
+i*3*Float.SIZE+
6*(AnimSubStructure.end*ribbon.length)+6*(16-(AnimSubStructure.end*ribbon.length)%16)+AnimSubStructure.end*transparency.length+(16-(AnimSubStructure.end*transparency.length)%16));
temp.render();
tmp.put(temp.buff);
}
fillLine(tmp);
ro=tmp.position();
for(int i=0;i<ribbon.length;i++){
AnimSubStructure temp=new AnimSubStructure();
temp.setnValues(1);
temp.setofsValues(ro+calc+
i*Short.SIZE
+ribbon.length*3*Float.SIZE+(16-(ribbon.length*3*Float.SIZE)%16)+6*(AnimSubStructure.end*ribbon.length)+6*(16-(AnimSubStructure.end*ribbon.length)%16)+AnimSubStructure.end*transparency.length+(16-(AnimSubStructure.end*transparency.length)%16));
temp.render();
tmp.put(temp.buff);
}
fillLine(tmp);
ro=tmp.position();
for(int i=0;i<ribbon.length;i++){
AnimSubStructure temp=new AnimSubStructure();
temp.setnValues(1);
temp.setofsValues(ro+calc
+i*Float.SIZE
+ribbon.length*Short.SIZE+(16-(ribbon.length*Short.SIZE)%16)+ribbon.length*3*Float.SIZE+(16-(ribbon.length*3*Float.SIZE)%16)+6*(AnimSubStructure.end*ribbon.length)+6*(16-(AnimSubStructure.end*ribbon.length)%16)+AnimSubStructure.end*transparency.length+(16-(AnimSubStructure.end*transparency.length)%16));
temp.render();
tmp.put(temp.buff);
}
fillLine(tmp);
ro=tmp.position();
for(int i=0;i<ribbon.length;i++){
AnimSubStructure temp=new AnimSubStructure();
temp.setnValues(1);
temp.setofsValues(ro+calc
+i*Float.SIZE+ribbon.length*Float.SIZE+(16-(ribbon.length*Float.SIZE)%16)+ribbon.length*Short.SIZE+(16-(ribbon.length*Short.SIZE)%16)+ribbon.length*3*Float.SIZE+(16-(ribbon.length*3*Float.SIZE)%16)+6*(AnimSubStructure.end*ribbon.length)+6*(16-(AnimSubStructure.end*ribbon.length)%16)+AnimSubStructure.end*transparency.length+(16-(AnimSubStructure.end*transparency.length)%16));
temp.render();
tmp.put(temp.buff);
}
fillLine(tmp);
ro=tmp.position();
for(int i=0;i<ribbon.length;i++){
AnimSubStructure temp=new AnimSubStructure();
temp.setnValues(1);
temp.setofsValues(ro+calc
+i*Integer.SIZE+2*ribbon.length*Float.SIZE+2*(16-(ribbon.length*Float.SIZE)%16)+ribbon.length*Short.SIZE+(16-(ribbon.length*Short.SIZE)%16)+ribbon.length*3*Float.SIZE+(16-(ribbon.length*3*Float.SIZE)%16)+6*(AnimSubStructure.end*ribbon.length)+6*(16-(AnimSubStructure.end*ribbon.length)%16)+AnimSubStructure.end*transparency.length+(16-(AnimSubStructure.end*transparency.length)%16));
temp.render();
tmp.put(temp.buff);
}
fillLine(tmp);
ro=tmp.position();
for(int i=0;i<ribbon.length;i++){
AnimSubStructure temp=new AnimSubStructure();
temp.setnValues(1);
temp.setofsValues(ro+calc
+i*Integer.SIZE+ribbon.length*Integer.SIZE+(16-(ribbon.length*Integer.SIZE)%16)+2*ribbon.length*Float.SIZE+2*(16-(ribbon.length*Float.SIZE)%16)+ribbon.length*Short.SIZE+(16-(ribbon.length*Short.SIZE)%16)+ribbon.length*3*Float.SIZE+(16-(ribbon.length*3*Float.SIZE)%16)+6*(AnimSubStructure.end*ribbon.length)+6*(16-(AnimSubStructure.end*ribbon.length)%16)+AnimSubStructure.end*transparency.length+(16-(AnimSubStructure.end*transparency.length)%16));
temp.render();
tmp.put(temp.buff);
}
fillLine(tmp);
ro=tmp.position();
for(int i=0;i<ribbon.length;i++){