[Scummvm-cvs-logs] CVS: scummex image.cpp,1.21,1.22 resource.cpp,1.23,1.24 wxwindows.cpp,1.33,1.34
Adrien Mercier
yoshizf at users.sourceforge.net
Tue Sep 30 04:43:01 CEST 2003
Update of /cvsroot/scummvm/scummex
In directory sc8-pr-cvs1:/tmp/cvs-serv3015
Modified Files:
image.cpp resource.cpp wxwindows.cpp
Log Message:
Added support for v3 objects, I think that all backgrounds/objects are supported now.
Index: image.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- image.cpp 30 Sep 2003 08:46:12 -0000 1.21
+++ image.cpp 30 Sep 2003 11:41:28 -0000 1.22
@@ -149,17 +149,17 @@
}
void Image::drawBoxes(BlockTable *_blockTable, int id, File& _input) {
- int nBox, RMHDindex, version = 5;
+ int nBox, headerID, version = 5;
if (_blockTable[id].blockTypeID == BM || _blockTable[id].blockTypeID == BX) {
version = 3;
- RMHDindex = _resource->findBlock(0, _blockTable, id, "HD", NULL);
+ headerID = _resource->findBlock(0, _blockTable, id, "HD", NULL);
} else {
- RMHDindex = _resource->findBlock(0, _blockTable, id, "RMHD", NULL);
+ headerID = _resource->findBlock(0, _blockTable, id, "RMHD", NULL);
}
- _width = _blockTable[RMHDindex].width;
- _height = _blockTable[RMHDindex].height;
+ _width = _blockTable[headerID].width;
+ _height = _blockTable[headerID].height;
if ( _resource->findBlock(0, _blockTable, id, "IMAG", NULL) != -1) {
version = 8;
@@ -253,9 +253,9 @@
}
for (int j = 0; j < 256; j++) {
- _rgbTable[j].red = _input.readByte(); // red
- _rgbTable[j].green = _input.readByte(); // green
- _rgbTable[j].blue = _input.readByte(); // blue
+ _rgbTable[j].red = _input.readByte();
+ _rgbTable[j].green = _input.readByte();
+ _rgbTable[j].blue = _input.readByte();
}
_width = _blockTable[id].width;
@@ -314,23 +314,23 @@
void Image::drawBG(File& _input, BlockTable *_blockTable, int id)
{
- int RMHDindex, CLUTindex, SMAPindex, TRNSindex, version;
+ int headerID, paletteID, dataID, version;
int32 blockSize;
byte *dst, *dstorg, *src, *dstFinal;
if (_blockTable[id].blockTypeID == BM) {
version = 3;
- RMHDindex = _resource->findBlock(0, _blockTable, id, "HD", NULL);
+ headerID = _resource->findBlock(0, _blockTable, id, "HD", NULL);
} else if (_blockTable[id-1].blockTypeID == IMHD) {
version = 8;
- RMHDindex = id-1;
+ headerID = id-1;
} else {
version = 5;
- RMHDindex = _resource->findBlock(0, _blockTable, id, "RMHD", NULL);
+ headerID = _resource->findBlock(0, _blockTable, id, "RMHD", NULL);
}
- _width = _blockTable[RMHDindex].width;
- _height = _blockTable[RMHDindex].height;
+ _width = _blockTable[headerID].width;
+ _height = _blockTable[headerID].height;
if (_blockTable[id].image == NULL)
_image = _blockTable[id].image = new ImageWindow("Room Image", wxSize(_width, _height), id, IMAGE_BOXES);
@@ -338,16 +338,14 @@
_image = _blockTable[id].image;
if (version > 4) {
- TRNSindex = _resource->findBlock(0, _blockTable, id, "TRNS", NULL);
- _transp = _blockTable[TRNSindex].trans;
- CLUTindex = _resource->findBlock(0, _blockTable, id, "CLUT", "APAL", "NPAL", NULL);
- _input.seek(_blockTable[CLUTindex].offset + 8, SEEK_SET);
+ paletteID = _resource->findBlock(0, _blockTable, id, "CLUT", "APAL", "NPAL", NULL);
+ _input.seek(_blockTable[paletteID].offset + 8, SEEK_SET);
} else {
_transp = 260;
- CLUTindex = _resource->findBlock(0, _blockTable, id, "PA", NULL);
- if (CLUTindex != -1) {
+ paletteID = _resource->findBlock(0, _blockTable, id, "PA", NULL);
+ if (paletteID != -1) {
version = 4;
- _input.seek(_blockTable[CLUTindex].offset + 8, SEEK_SET);
+ _input.seek(_blockTable[paletteID].offset + 8, SEEK_SET);
} else {
version = 3;
}
@@ -355,32 +353,31 @@
if (version > 3) {
for (int j = 0; j < 256; j++) {
- _rgbTable[j].red = _input.readByte(); // red
- _rgbTable[j].green = _input.readByte(); // green
- _rgbTable[j].blue = _input.readByte(); // blue
+ _rgbTable[j].red = _input.readByte();
+ _rgbTable[j].green = _input.readByte();
+ _rgbTable[j].blue = _input.readByte();
}
} else {
setupEGAPalette();
}
if (version > 4) {
- SMAPindex = _resource->findBlock(1, _blockTable, id, "SMAP", NULL);
+ dataID = _resource->findBlock(1, _blockTable, id, "SMAP", NULL);
} else {
- SMAPindex = id;
+ dataID = id;
}
- blockSize = _blockTable[SMAPindex].blockSize;
+ blockSize = _blockTable[dataID].blockSize;
if (_blockTable[id].blockTypeID == IMAG) {
version = 8;
- SMAPindex = _resource->findBlock(1, _blockTable, SMAPindex, "OFFS", NULL);
- blockSize = _blockTable[SMAPindex-1].blockSize - 8;
+ dataID = _resource->findBlock(1, _blockTable, dataID, "OFFS", NULL);
+ blockSize = _blockTable[dataID-1].blockSize - 8;
}
_offsets = new uint32[_width/8];
-
- _input.seek(_blockTable[SMAPindex].offset + 8, SEEK_SET);
+ _input.seek(_blockTable[dataID].offset + 8, SEEK_SET);
if (version > 4) {
for (int x = 0; x < _width/8; x++)
@@ -395,7 +392,7 @@
_offsets[x] = _input.readUint16LE() + 6;
}
- _input.seek(_blockTable[SMAPindex].offset, SEEK_SET);
+ _input.seek(_blockTable[dataID].offset, SEEK_SET);
dstorg = dst = (byte *)malloc(_width * _height);
src = (byte *)malloc(blockSize);
_input.read(src, blockSize);
@@ -430,52 +427,84 @@
void Image::drawObject(File& _input, BlockTable *_blockTable, int id)
{
- int RMHDindex, CLUTindex, SMAPindex, TRNSindex;
+ int headerID, paletteID, dataID, version = 5;
byte *dst, *dstorg, *src, *dstFinal;
if (_blockTable[id].blockTypeID == OBIM) {
- RMHDindex = _resource->findBlock(1, _blockTable, id, "IMHD", NULL);
+ headerID = _resource->findBlock(1, _blockTable, id, "IMHD", NULL);
+ } else if (_blockTable[id].blockTypeID == OI) {
+ version = 3;
+ headerID = id;
+ while (1) {
+ headerID = _resource->findBlock(1, _blockTable, headerID, "OC", NULL);
+ if (_blockTable[headerID].numFiles == _blockTable[id].numFiles)
+ break;
+ }
+ paletteID = _resource->findBlock(0, _blockTable, id, "PA", NULL);
+ if (paletteID != -1) {
+ version = 4;
+ _input.seek(_blockTable[paletteID].offset + 8, SEEK_SET);
+ }
} else {
- RMHDindex = _resource->findBlock(0, _blockTable, id, "IMHD", NULL);
+ headerID = _resource->findBlock(0, _blockTable, id, "IMHD", NULL);
}
- _width = _blockTable[RMHDindex].width;
- _height = _blockTable[RMHDindex].height;
+ _width = _blockTable[headerID].width;
+ _height = _blockTable[headerID].height;
if (_blockTable[id].image == NULL)
_image = _blockTable[id].image = new ImageWindow("Object", wxSize(_width, _height), id);
else
_image = _blockTable[id].image;
- TRNSindex = _resource->findBlock(0, _blockTable, id, "TRNS", NULL);
-
- _transp = _blockTable[TRNSindex].trans;
+ if (version > 4) {
+ paletteID = _resource->findBlock(0, _blockTable, id, "CLUT", "APAL", "NPAL", NULL);
+ _input.seek(_blockTable[paletteID].offset + 8, SEEK_SET);
+ }
- CLUTindex = _resource->findBlock(0, _blockTable, id, "CLUT", "APAL", "NPAL", NULL);
-
- _input.seek(_blockTable[CLUTindex].offset + 8, SEEK_SET);
-
- for (int j = 0; j < 256; j++) {
- _rgbTable[j].red = _input.readByte(); // red
- _rgbTable[j].green = _input.readByte(); // green
- _rgbTable[j].blue = _input.readByte(); // blue
+ if (version > 3) {
+ for (int j = 0; j < 256; j++) {
+ _rgbTable[j].red = _input.readByte(); // red
+ _rgbTable[j].green = _input.readByte(); // green
+ _rgbTable[j].blue = _input.readByte(); // blue
+ }
+ } else {
+ setupEGAPalette();
}
- SMAPindex = _resource->findBlock(1, _blockTable, id, "SMAP", NULL);
-
- _offsets = new uint32[_width/8];
+ if (version > 4) {
+ dataID = _resource->findBlock(1, _blockTable, id, "SMAP", NULL);
+ _input.seek(_blockTable[dataID].offset + 8, SEEK_SET);
+ } else {
+ dataID = id;
+ _input.seek(_blockTable[dataID].offset + 10, SEEK_SET);
+ }
- _input.seek(_blockTable[SMAPindex].offset + 8, SEEK_SET);
- for (int x = 0; x < _width/8; x++)
- _offsets[x] = _input.readUint32LE();
+ _offsets = new uint32[_width/8];
- _input.seek(_blockTable[SMAPindex].offset, SEEK_SET);
+ if (version > 4) {
+ for (int x = 0; x < _width/8; x++)
+ _offsets[x] = _input.readUint32LE();
+ } else if (version == 4) {
+ for (int x = 0; x < _width/8; x++) {
+ _input.seek(2, SEEK_CUR);
+ _offsets[x] = _input.readUint16LE() + 8;
+ }
+ } else {
+ for (int x = 0; x < _width/8; x++)
+ _offsets[x] = _input.readUint16LE() + 8;
+ }
+
+ _input.seek(_blockTable[dataID].offset, SEEK_SET);
dstorg = dst = (byte *)malloc(_width * _height);
- src = (byte *)malloc(_blockTable[SMAPindex].blockSize);
- _input.read(src, _blockTable[SMAPindex].blockSize);
+ src = (byte *)malloc(_blockTable[dataID].blockSize);
+ _input.read(src, _blockTable[dataID].blockSize);
for (int x = 0; x < _width/8; x++) {
- GetStrip(dst + (8 * x), src + _offsets[x], _height);
+ if (version > 3)
+ GetStrip(dst + (8 * x), src + _offsets[x], _height);
+ else
+ decodeStripEGA(dst + (8 * x), src + _offsets[x], _height);
}
free(src);
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/resource.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- resource.cpp 29 Sep 2003 10:58:20 -0000 1.23
+++ resource.cpp 30 Sep 2003 11:41:28 -0000 1.24
@@ -849,7 +849,25 @@
_input.seek(_blockTable[index].blockSize + _blockTable[index].offset, SEEK_SET);
index++;
break;
-
+
+ case OI:
+ _blockTable[index].numFiles = _input.readUint16LE(); // Object ID
+ _gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
+ _input.seek(_blockTable[index].blockSize + _blockTable[index].offset, SEEK_SET);
+ index++;
+ break;
+
+ case OC:
+ _blockTable[index].numFiles = _input.readUint16LE(); // Object ID
+ _input.seek(3, SEEK_CUR);
+ _blockTable[index].width = _input.readByte() * 8;
+ _input.seek(5, SEEK_CUR);
+ _blockTable[index].height = _input.readByte() & 0xF8;
+ _gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
+ _input.seek(_blockTable[index].blockSize + _blockTable[index].offset, SEEK_SET);
+ index++;
+ break;
+
default:
_gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
_input.seek(_blockTable[index].blockSize + _blockTable[index].offset, SEEK_SET);
Index: wxwindows.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/wxwindows.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- wxwindows.cpp 30 Sep 2003 08:46:12 -0000 1.33
+++ wxwindows.cpp 30 Sep 2003 11:41:28 -0000 1.34
@@ -309,6 +309,14 @@
break;
case OBIM:
+ if (g_scummex->getBlockTable(_blockId+3).blockTypeID == 35) {
+ SpecButton1->SetLabel("View Object");
+ SpecButton1->Show(TRUE);
+ Connect( ID_SpecButton1, wxEVT_COMMAND_BUTTON_CLICKED,
+ (wxObjectEventFunction) &MainWindow::objectDraw );
+ }
+ break;
+
case IM01:
case IM02:
case IM03:
@@ -324,10 +332,13 @@
case IM0D:
case IM0E:
case IM0F:
+ case OI:
+ if (g_scummex->getBlockTable(_blockId).blockSize > 8) {
SpecButton1->SetLabel("View Object");
SpecButton1->Show(TRUE);
Connect( ID_SpecButton1, wxEVT_COMMAND_BUTTON_CLICKED,
(wxObjectEventFunction) &MainWindow::objectDraw );
+ }
break;
case Crea:
@@ -479,91 +490,44 @@
updateLabel(_SpecLabel[0], "Number of items:", block.numFiles);
break;
- case cus2:
- SetButton(block.blockTypeID);
- break;
-
case COMP:
updateLabel(_SpecLabel[0], "Number of samples:", block.numFiles);
break;
- case CLUT:
- case APAL:
- case PA:
- case NPAL:
- case AHDR:
- case RGBS:
- SetButton(block.blockTypeID);
- break;
-
- case RMIM:
- case BM:
- case IMAG:
- SetButton(block.blockTypeID);
- break;
-
- case OBIM:
- if (g_scummex->getBlockTable(blockid+3).blockTypeID == 35) {
- SetButton(block.blockTypeID);
- }
- break;
-
- case IM01:
- case IM02:
- case IM03:
- case IM04:
- case IM05:
- case IM06:
- case IM07:
- case IM08:
- case IM09:
- case IM0A:
- case IM0B:
- case IM0C:
- case IM0D:
- case IM0E:
- case IM0F:
- SetButton(block.blockTypeID);
- break;
-
case IMHD:
- updateLabel(_SpecLabel[0], "Room Width:", block.width);
- updateLabel(_SpecLabel[1], "Room Height:", block.height);
+ updateLabel(_SpecLabel[0], "Object Width:", block.width);
+ updateLabel(_SpecLabel[1], "Object Height:", block.height);
updateLabel(_SpecLabel[2], "Number of Images:", block.numFiles);
break;
case Crea:
case AUdt:
updateLabel(_SpecLabel[0], "Sample Rate:", block.variables);
- SetButton(block.blockTypeID);
- break;
-
- case LSCR:
- case SCRP:
- case ENCD:
- case EXCD:
- case VERB:
- case LS:
- case SC:
- case EN:
- case EX:
- case OC:
- SetButton(block.blockTypeID);
break;
case FOBJ:
updateLabel(_SpecLabel[0], "Frame Width:", block.width);
updateLabel(_SpecLabel[1], "Frame Height:", block.height);
updateLabel(_SpecLabel[2], "Codec:", block.variables);
- SetButton(block.blockTypeID);
break;
case BOXD:
case BX:
updateLabel(_SpecLabel[0], "No. of Boxes:", block.numFiles);
- SetButton(block.blockTypeID);
break;
+
+ case OI:
+ updateLabel(_SpecLabel[0], "Object ID:", block.numFiles);
+ break;
+
+ case OC:
+ updateLabel(_SpecLabel[0], "Object ID:", block.numFiles);
+ updateLabel(_SpecLabel[1], "Object Width:", block.width);
+ updateLabel(_SpecLabel[2], "Object Height:", block.height);
+ break;
+
}
+ SetButton(block.blockTypeID);
}
BEGIN_EVENT_TABLE(MainWindow, wxFrame)
More information about the Scummvm-git-logs
mailing list