void writeBedheadGroup(const BedheadEntry *data, int count) { for (int idx = 0; idx < count; ++idx, ++data) { outputFile.writeString(data->_name1); outputFile.writeString(data->_name2); outputFile.writeString(data->_name3); outputFile.writeString(data->_name4); outputFile.writeLong(data->_startFrame); outputFile.writeLong(data->_endFrame); } }
void writeParrotLobbyLinkUpdaterEntries() { static const int OFFSETS[3] = { 0x5A5B38, 0x5A5320, 0x5A4360 }; static const int COUNTS[5] = { 7, 5, 6, 9, 1 }; static const int SKIP[5] = { 36, 36, 40, 36, 0 }; uint recordOffset = OFFSETS[_version], linkOffset; byte vals[8]; outputFile.seek(dataOffset); for (int groupNum = 0; groupNum < 4; ++groupNum) { for (int entryNum = 0; entryNum < COUNTS[groupNum]; ++entryNum, recordOffset += 36) { inputFile.seek(recordOffset - FILE_DIFF[_version]); linkOffset = inputFile.readUint32LE(); for (int idx = 0; idx < 8; ++idx) vals[idx] = inputFile.readUint32LE(); // Write out the entry inputFile.seek(linkOffset - FILE_DIFF[_version]); outputFile.writeString(inputFile); outputFile.write(vals, 8); } // Skip space between groups recordOffset += SKIP[groupNum]; } uint size = outputFile.size() - dataOffset; writeEntryHeader("DATA/PARROT_LOBBY_LINK_UPDATOR", dataOffset, size); dataOffset += size; }
void writeScriptIndex(Common::File &target, RoomScripts *scripts, uint scriptCount) { target.writeLong(scriptCount); for (uint i = 0; i < scriptCount; i++) { target.writeString(scripts[i].room); target.writeLong(scripts[i].type); target.writeLong(scripts[i].targetOffset); target.writeLong(scripts[i].size); } }
void writeEntryHeader(const char *name, uint offset, uint size) { assert(headerOffset < HEADER_SIZE); outputFile.seek(headerOffset); outputFile.writeLong(offset); outputFile.writeLong(size); outputFile.writeString(name); headerOffset += 8 + strlen(name) + 1; }
void writeStringArray(const char *name, const char *const *strings, int count) { outputFile.seek(dataOffset); // Iterate through writing each string for (int idx = 0; idx < count; ++idx) { outputFile.writeString(strings[idx]); } uint size = outputFile.size() - dataOffset; writeEntryHeader(name, dataOffset, size); dataOffset += size; }
void writePhrases(const char *name, const CommonPhrase *phrases) { for (uint idx = 0; phrases->_str; ++idx, ++phrases) { outputFile.seek(dataOffset + idx * 4); outputFile.writeString(phrases->_str); outputFile.writeLong(phrases->_dialogueId); outputFile.writeLong(phrases->_roomNum); outputFile.writeLong(phrases->_val1); } uint size = outputFile.size() - dataOffset; writeEntryHeader("Phrases/Bellbot", dataOffset, size); dataOffset += size; }
void writeNumbers() { outputFile.seek(dataOffset); // Iterate through writing each string for (int idx = 0; idx < 76; ++idx) { outputFile.writeString(NUMBERS[idx]._text); outputFile.writeLong(NUMBERS[idx]._value); outputFile.writeLong(NUMBERS[idx]._flags); } uint size = outputFile.size() - dataOffset; writeEntryHeader("TEXT/NUMBERS", dataOffset, size); dataOffset += size; }
void writeStringArray(const char *name, uint offset, int count) { outputFile.seek(dataOffset); inputFile.seek(offset - FILE_DIFF[_version]); uint *offsets = new uint[count]; for (int idx = 0; idx < count; ++idx) offsets[idx] = inputFile.readLong(); // Iterate through reading each string for (int idx = 0; idx < count; ++idx) { if (offsets[idx]) { inputFile.seek(offsets[idx] - FILE_DIFF[_version]); outputFile.writeString(inputFile); } else { outputFile.writeString(""); } } uint size = outputFile.size() - dataOffset; writeEntryHeader(name, dataOffset, size); dataOffset += size; delete[] offsets; }
void writeMissiveOMatMessages() { outputFile.seek(dataOffset); for (int idx = 0; idx < 3; ++idx) outputFile.writeString(MISSIVEOMAT_MESSAGES[idx]); uint size = outputFile.size() - dataOffset; writeEntryHeader("TEXT/MISSIVEOMAT/WELCOME", dataOffset, size); dataOffset += size; static const int MESSAGES[3] = { 0x5A63C0, 0x5A5BA8, 0x5A4A18 }; writeStringArray("TEXT/MISSIVEOMAT/MESSAGES", MESSAGES[_version], 58); static const int FROM[3] = { 0x5A61F0, 0x5A59D8, 0x5A4BE8 }; writeStringArray("TEXT/MISSIVEOMAT/FROM", FROM[_version], 58); static const int TO[3] = { 0x5A62D8, 0x5A5AC0, 0x5A4B00 }; writeStringArray("TEXT/MISSIVEOMAT/TO", TO[_version], 58); }