[Scummvm-cvs-logs] CVS: scummex scummex.cpp,1.23,1.24
Adrien Mercier
yoshizf at users.sourceforge.net
Thu Sep 25 00:33:03 CEST 2003
Update of /cvsroot/scummvm/scummex
In directory sc8-pr-cvs1:/tmp/cvs-serv10444
Modified Files:
scummex.cpp
Log Message:
Cleaned up loading code
Index: scummex.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/scummex.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- scummex.cpp 24 Sep 2003 11:49:30 -0000 1.23
+++ scummex.cpp 25 Sep 2003 07:32:19 -0000 1.24
@@ -25,6 +25,10 @@
#include "scummex.h"
#include "descumm.h"
+static const byte encBytesTable[] = {
+ 0x00, 0x69, 0xFF
+};
+
ScummEX::ScummEX() {
_image = new Image();
_sound = new Sound();
@@ -46,8 +50,6 @@
if (_input.isOpen()) {
_input.close();
}
-
- _input.open(filename, 1, _encbyte);
sprintf(buf, "ScummEX - %s", filename);
_gui->SetTitle(buf);
@@ -55,61 +57,41 @@
_gui->EnableToolbarTool(wxID_CLOSE);
_gui->EnableToolbarTool(ID_FileInfo);
- _input.read(&tag, 4);
-
- switch (tag) {
- case MKID('LB83'):
- case MKID('LABN'):
- case MKID('RNAM'):
- case MKID('LECF'):
- case MKID('ANIM'):
- case MKID('SOU '):
- _input.seek(0, SEEK_SET);
- _resource->searchBlocks(_blockTable, _input);
- return;
+ for (uint i=0; i<sizeof(encBytesTable); i++) {
+ _encbyte = encBytesTable[i];
+ _input.open(filename, 1, _encbyte);
- }
+ tag = 0;
+ _input.read(&tag, 4);
+ switch (tag) {
+ case MKID('LB83'):
+ case MKID('LABN'):
+ case MKID('RNAM'):
+ case MKID('LECF'):
+ case MKID('ANIM'):
+ case MKID('SOU '):
+ _input.seek(0, SEEK_SET);
+ _resource->searchBlocks(_blockTable, _input);
+ return;
- tag = 0;
- _input.read(&tag, 2);
+ }
- switch(tag) {
- case 21040: // OR
- case 20306: // RO
- case 20050: // RN
- _input.seek(0, SEEK_SET);
- _resource->searchOldBlocks(_blockTable, _input);
- return;
+ tag = 0;
+ _input.read(&tag, 2);
+ switch(tag) {
+ case 21040: // OR
+ case 20306: // RO
+ case 20050: // RN
+ case 17740: // LE
+ _input.seek(0, SEEK_SET);
+ _resource->searchOldBlocks(_blockTable, _input);
+ return;
- }
+ }
- _input.close();
- _encbyte = 0x69;
- _input.open(filename, 1, _encbyte);
- _input.read(&tag, 4);
-
- switch (tag) {
- case MKID('RNAM'):
- _input.seek(0, SEEK_SET);
- _resource->searchBlocks(_blockTable, _input);
- return;
-
- case MKID('LECF'):
- _input.seek(0, SEEK_SET);
- _resource->searchBlocks(_blockTable, _input);
- return;
- }
-
- tag = 0;
- _input.read(&tag, 2);
-
- switch(tag) {
- case 17740: // LE
- _input.seek(0, SEEK_SET);
- _resource->searchOldBlocks(_blockTable, _input);
- return;
+ _input.close();
}
-
+
_gui->SetTitle("ScummEX");
_gui->DisableToolbarTool(wxID_CLOSE);
_gui->DisableToolbarTool(ID_FileInfo);
More information about the Scummvm-git-logs
mailing list