===== Tournament File Format (.TRN) ===== |[[omf2097_file_formats| char palette[256][3]; char temp[3]; for(int i = 128; i < 168; i++) { read_data(temp, 3); // Read a single palette color from the file palette[i][0] = ((temp[0] << 2) | (temp[0] >> 4)); palette[i][1] = ((temp[1] << 2) | (temp[1] >> 4)); palette[i][2] = ((temp[2] << 2) | (temp[2] >> 4)); } ==== PIC Section ==== This section starts directly after the palette, and contains simply the name of the related [[openomf:pic|PIC file]]. The string is in the same format as the quote strings. ==== Tournament descriptions ==== This section starts just after the PIC section. It contains the titles and descriptions of the tournament. There are 10 title-description pairs, each string in the same format as the quote strings. for(int i = 0; i < 10; i++) { int title_len = read_uword(); if(title_len > 0) { string title_text = read_text(title_len); } int desc_len = read_uword(); if(desc_len > 0) { string desc_text = read_text(desc_len); } } ==== Victory texts ==== Victory texts start directly after the tournament descriptions. The offset can also be found in the file header. This is the last section of the file; after the victory texts the file ends. For each language, there are defined 11 HARs. Each HAR may contain 10 strings of test ("pages"). The strings are in the same format as the quote strings. The reading can be done with simple nedted for-loops. int language, har, page; for(language = 0; language < 10; language++) { for(har = 0; har < 11; har++) { for(page = 0; page < 10; page++) { int length = read_uword(); if(length > 0) { string text = read_text(length); } } } }