[Scummvm-cvs-logs] SF.net SVN: scummvm:[47703] tools/trunk/engines/mohawk/construct_mohawk.cpp
tdhs at users.sourceforge.net
tdhs at users.sourceforge.net
Sat Jan 30 08:03:45 CET 2010
Revision: 47703
http://scummvm.svn.sourceforge.net/scummvm/?rev=47703&view=rev
Author: tdhs
Date: 2010-01-30 07:03:45 +0000 (Sat, 30 Jan 2010)
Log Message:
-----------
Corrections to construct_mohawk tool :
Original archiver placed type name table in Alphabetical order by name, rather than resource Id.
File table flags issue was due to errorneous use of logical rather than boolean OR.
Modified Paths:
--------------
tools/trunk/engines/mohawk/construct_mohawk.cpp
Modified: tools/trunk/engines/mohawk/construct_mohawk.cpp
===================================================================
--- tools/trunk/engines/mohawk/construct_mohawk.cpp 2010-01-30 04:33:46 UTC (rev 47702)
+++ tools/trunk/engines/mohawk/construct_mohawk.cpp 2010-01-30 07:03:45 UTC (rev 47703)
@@ -268,13 +268,16 @@
}
}
-// Order of Name Table in same order as Resource Table cross referenced by index
void sortNameTable(Common::Array<TypeConstructNameEntries> *tempNameTable, uint16 i) {
- for (uint16 j = 0; j < _types[i].resTable.resources; j++) {
- for (uint16 k = 0; k < _types[i].nameTable.num; k++) {
- if (_types[i].resTable.entries[j].index == _types[i].nameTable.entries[k].index)
- tempNameTable->push_back(_types[i].nameTable.entries[k]);
+ uint16 k, j;
+
+ // Insert in Type Name Table ordered Alphabetically by Name
+ for (k = 0; k < _types[i].nameTable.num; k++) {
+ for (j = 0; j < tempNameTable->size(); j++) {
+ if ((*tempNameTable)[j].name > _types[i].nameTable.entries[k].name)
+ break;
}
+ tempNameTable->insert_at(j, _types[i].nameTable.entries[k]);
}
assert(tempNameTable->size() == _types[i].nameTable.num);
@@ -347,7 +350,7 @@
mohawkFile->writeUint16BE(_types[i].nameTable.num);
Common::Array<TypeConstructNameEntries> tempNameTable;
- // _types[i].resTable.entries sorted into resource order output into tempNameTable
+ // _types[i].nameTable.entries sorted into alphabetical order by name into tempNameTable
sortNameTable(&tempNameTable, i);
for (uint16 j = 0; j < _types[i].nameTable.num; j++) {
@@ -368,11 +371,7 @@
mohawkFile->writeUint32BE(_fileTable[i].offset);
mohawkFile->writeUint16BE(_fileTable[i].dataSize & 0xFFFF);
mohawkFile->writeByte((_fileTable[i].dataSize >> 16) & 0xFF);
-
- // TODO: The following should be correct, but doesn't match up.
- //mohawkFile->writeByte((_fileTable[i].dataSize >> 24) & 0x07) || (_fileTable[i].flags & 0xF8));
- mohawkFile->writeByte(_fileTable[i].flags);
-
+ mohawkFile->writeByte(((_fileTable[i].dataSize >> 24) & 0x07) | (_fileTable[i].flags & 0xF8));
mohawkFile->writeUint16BE(_fileTable[i].unk);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list