SCI: fixing mirrored sci32 pictures

fixes lsl6, also slight cleanup and adding comments about sci32 picture resources

svn-id: r51162
This commit is contained in:
Martin Kiewitz 2010-07-22 20:11:53 +00:00
parent 9b347782ed
commit 0e9291e929
2 changed files with 21 additions and 27 deletions

View File

@ -152,22 +152,14 @@ int16 GfxPicture::getSci32celPriority(int16 celNo) {
return READ_LE_UINT16(inbuffer + cel_headerPos + 36);
}
int16 GfxPicture::getSci32celHeight(int16 celNo) {
byte *inbuffer = _resource->data;
int header_size = READ_LE_UINT16(inbuffer);
int cel_headerPos = header_size + 42 * celNo;
return READ_LE_UINT16(inbuffer + cel_headerPos + 2);
}
void GfxPicture::drawSci32Vga(int16 celNo, int16 callerX, int16 callerY, bool mirrored) {
byte *inbuffer = _resource->data;
int size = _resource->size;
int header_size = READ_LE_UINT16(inbuffer);
int palette_data_ptr = READ_LE_UINT16(inbuffer + 6);
int celCount = inbuffer[2];
// int celCount = inbuffer[2];
int cel_headerPos = header_size;
int cel_RlePos, cel_LiteralPos;
// int cel_relXpos, cel_relYpos;
Palette palette;
// HACK
@ -175,30 +167,33 @@ void GfxPicture::drawSci32Vga(int16 celNo, int16 callerX, int16 callerY, bool mi
_addToFlag = false;
_resourceType = SCI_PICTURE_TYPE_SCI32;
if ((celNo == -1) || (celNo == 0)) {
if (celNo == 0) {
// Create palette and set it
_palette->createFromData(inbuffer + palette_data_ptr, size - palette_data_ptr, &palette);
_palette->set(&palette, true);
}
if (celNo != -1) {
cel_headerPos += 42 * celNo;
celCount = 1;
// Header
// [headerSize:WORD] [celCount:BYTE] [Unknown:BYTE] [Unknown:WORD] [paletteOffset:DWORD] [Unknown:DWORD]
// cel-header follow afterwards, each is 42 bytes
// Cel-Header
// [width:WORD] [height:WORD] [displaceX:WORD] [displaceY:WORD] [clearColor:BYTE] [compressed:BYTE]
// offset 10-23 is unknown
// [rleOffset:DWORD] [literalOffset:DWORD] [Unknown:WORD] [Unknown:WORD] [priority:WORD] [relativeXpos:WORD] [relativeYpos:WORD]
cel_headerPos += 42 * celNo;
if (mirrored) {
// switch around relativeXpos
Common::Rect displayArea = _coordAdjuster->pictureGetDisplayArea();
callerX = displayArea.width() - callerX - READ_LE_UINT16(inbuffer + cel_headerPos + 0);
}
while (celCount > 0) {
cel_RlePos = READ_LE_UINT32(inbuffer + cel_headerPos + 24);
cel_LiteralPos = READ_LE_UINT32(inbuffer + cel_headerPos + 28);
//cel_relXpos = READ_LE_UINT16(inbuffer + cel_headerPos + 38);
//cel_relYpos = READ_LE_UINT16(inbuffer + cel_headerPos + 40);
cel_RlePos = READ_LE_UINT32(inbuffer + cel_headerPos + 24);
cel_LiteralPos = READ_LE_UINT32(inbuffer + cel_headerPos + 28);
// This is really weird, adjusting picture data to plane resolution - why...
//cel_relYpos = ((cel_relYpos * g_sci->_gfxScreen->getHeight()) / planeResY);
//cel_relXpos = ((cel_relXpos * g_sci->_gfxScreen->getWidth()) / planeResX);
drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, callerX, callerY);
cel_headerPos += 42;
celCount--;
}
drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, callerX, callerY);
cel_headerPos += 42;
}
#endif

View File

@ -59,7 +59,6 @@ public:
int16 getSci32celY(int16 celNo);
int16 getSci32celX(int16 celNo);
int16 getSci32celPriority(int16 celNo);
int16 getSci32celHeight(int16 celNo);
void drawSci32Vga(int16 celNo, int16 callerX, int16 callerY, bool mirrored);
#endif