[Scummvm-cvs-logs] CVS: scummex resource.cpp,1.7,1.8 scummex.cpp,1.8,1.9 sound.cpp,1.3,1.4 sound.h,1.2,1.3
Adrien Mercier
yoshizf at users.sourceforge.net
Sat Sep 20 17:46:09 CEST 2003
Update of /cvsroot/scummvm/scummex
In directory sc8-pr-cvs1:/tmp/cvs-serv20437
Modified Files:
resource.cpp scummex.cpp sound.cpp sound.h
Log Message:
We do not need a dedicated function for .SOU anymore
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/resource.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- resource.cpp 20 Sep 2003 23:59:07 -0000 1.7
+++ resource.cpp 21 Sep 2003 00:45:16 -0000 1.8
@@ -675,10 +675,11 @@
case SOU:
_blockTable[index].blockSize = _input.readUint32BE();
if (_blockTable[index].blockSize == 0) {
- stopflag = 1;
+ _blockTable[index].blockSize = 8;
+ _input.seek(_blockTable[index].offset + _blockTable[index].blockSize, SEEK_SET);
_gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
index++;
- break;
+ return index;
}
_gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
bufindex = index;
Index: scummex.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/scummex.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- scummex.cpp 19 Sep 2003 19:57:07 -0000 1.8
+++ scummex.cpp 21 Sep 2003 00:45:16 -0000 1.9
@@ -62,13 +62,9 @@
case MKID('RNAM'):
case MKID('LECF'):
case MKID('ANIM'):
- _input.seek(0, SEEK_SET);
- _resource->searchBlocks(_blockTable, _input);
- return;
-
case MKID('SOU '):
_input.seek(0, SEEK_SET);
- _sound->parseSOU(_blockTable, _input);
+ _resource->searchBlocks(_blockTable, _input);
return;
}
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/sound.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sound.cpp 18 Sep 2003 22:13:12 -0000 1.3
+++ sound.cpp 21 Sep 2003 00:45:16 -0000 1.4
@@ -106,119 +106,6 @@
delete _mixer;
}
-void Sound::parseSOU(BlockTable *_blockTable, File& _input) {
-
- int index = 0, level = 1, block_type;
- uint size = 0;
- int rate, comp, real_rate;
- byte work[8];
- char ident[8];
- int filesize, curpos = 0;
-
- enum {
- SOUND_HEADER_SIZE = 26,
- SOUND_HEADER_BIG_SIZE = 26 + 8
- };
-
- filesize = _input.size();
-
- // SOU block
- _input.read(_blockTable[index].blockName, 3);
- _blockTable[index].blockName[3] = '\0';
- _input.seek(5, SEEK_CUR);
- strcpy(_blockTable[index].blockType, _blockTable[index].blockName);
- _blockTable[index].blockTypeID = _resource->getBlockType(_blockTable[index].blockName);
- strcpy(_blockTable[index].blockDescription, blocksInfo[_blockTable[index].blockTypeID].description);
- _blockTable[index].blockSize = filesize;
- _blockTable[index].offset = 0;
-
- _gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
- index++;
- level++;
-
- while (curpos < filesize) {
- // VCTL block
- while (memcmp(ident, "VCTL", 4)) {
- _input.read(ident, 4);
- }
- sprintf(_blockTable[index].blockName, "VCTL");
- strcpy(_blockTable[index].blockType, _blockTable[index].blockName);
- _blockTable[index].blockTypeID = _resource->getBlockType(_blockTable[index].blockName);
- strcpy(_blockTable[index].blockDescription, blocksInfo[_blockTable[index].blockTypeID].description);
- _blockTable[index].offset = _input.pos() - 4;
-
- int ret = 0;
- int count = 4;
- while (count > 0) {
- int c = _input.readByte();
- ret <<= 8;
- ret |= c;
- count--;
- }
- _blockTable[index].blockSize = ret;
-
- _input.seek(_blockTable[index].blockSize-8, SEEK_CUR);
- _gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
- index++;
-
- // Crea or VTLK block
- if (_input.read(ident, 8) != 8)
- return;
-
- _blockTable[index].offset = _input.pos() - 8;
-
- if (!memcmp(ident, "VTLK", 4)) {
- sprintf(_blockTable[index].blockName, "VTLK");
- _input.seek(SOUND_HEADER_BIG_SIZE - 8, SEEK_CUR);
- } else if (!memcmp(ident, "Creative", 8)) {
- sprintf(_blockTable[index].blockName, "Crea");
- _input.seek(SOUND_HEADER_SIZE - 8, SEEK_CUR);
- } else {
- printf("parseSOU: invalid header at pos: %d\n", _input.pos() - 8);
- return;
- }
-
- _blockTable[index].blockTypeID = _resource->getBlockType(_blockTable[index].blockName);
- strcpy(_blockTable[index].blockDescription, blocksInfo[_blockTable[index].blockTypeID].description);
- strcpy(_blockTable[index].blockType, _blockTable[index].blockName);
-
- block_type = _input.readByte();
- if (block_type != 1) {
- printf("Expecting block_type == 1, got %d\n", block_type);
- return;
- }
-
- _input.read(work, 3);
-
- size = (work[0] | (work[1] << 8) | (work[2] << 16)) - 2;
- size += 28;
- _blockTable[index].blockSize = size;
- rate = _input.readByte();
- comp = _input.readByte();
-
- if (comp != 0) {
- printf("Unsupported compression type %d\n", comp);
- return;
- }
-
- if (rate == 0xa5 || rate == 0xa6) {
- _blockTable[index].variables = 11025;
- } else if (rate == 0xd2 || rate == 0xd3) {
- _blockTable[index].variables = 22050;
- } else {
- _blockTable[index].variables = 1000000L / (256L - rate);
- }
-
- _input.seek(_blockTable[index].blockSize + _blockTable[index].offset + 5, SEEK_SET);
-
- curpos = _input.pos();
-
- _gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
- index++;
- }
-
-}
-
int Sound::playSOU(BlockTable *_blockTable, File& _input, int index, File& _output, int save)
{
SDL_RWops *rw;
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/sound.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sound.h 18 Sep 2003 19:37:14 -0000 1.2
+++ sound.h 21 Sep 2003 00:45:16 -0000 1.3
@@ -49,7 +49,6 @@
~Sound();
int playiMUSE(File& _input, BlockTable *_blockTable, int index, File& _output, int save = 0);
int playSOU(BlockTable *_blockTable, File& _input, int index, File& _output, int save = 0);
- void parseSOU(BlockTable *_blockTable, File& _input);
};
More information about the Scummvm-git-logs
mailing list