Open main menu

Difference between revisions of "Auto detection"

1,216 bytes added ,  22:05, 4 March 2006
no edit summary
Line 94: Line 94:


TODO: Finish this
TODO: Finish this
=== Incomplete code snippets ===
The following snippets are sketches. We may end up doing things totally different. It's just a way for me to make visible what goes on in my head right now, and is neither complete nor necessarily the best way to handle things. You have been warned :-)
For regular use (e.g. in ScummEngine::openRoomm, and most places where
generateSubstResFileName is currently being used), we could use a new function like this one:
<pre>
Common::String generateFilename(int room, int diskNumber) {
char buf[128];
if (_game.version == 4) {
if (room == 0 || room >= 900) {
sprintf(buf, "%.3d.lfl", room);
} else {
sprintf(buf, "disk%.2d.lec", diskNumber);
}
} else if (_game.heversion >= 98) {
char c;
int disk = 0;
if (_heV7DiskOffsets)
disk = _heV7DiskOffsets[room];
switch(disk) {
case 2:
c = 'b';
break;
case 1:
c = 'a';
break;
default:
c = '0';
}
sprintf(buf, _substEntry.formatStr, c);
} else if (_substEntry.method == kGenDiskNum) {
sprintf(buf, _substEntry.formatStr, diskNumber);
} else if (_substEntry.method == kGenRoomNum) {
sprintf(buf, _substEntry.formatStr, room);
} else {
error("FOO");
}
return buf;
}
</pre>


== Standardized descriptions ==
== Standardized descriptions ==
1,079

edits