// differentiation between various picture formats can NOT get done using sci-version checks. // Games like PQ1 use the "old" vector data picture format, but are actually SCI1.1 // We should leave this that way to decide the format on-the-fly instead of hardcoding it in any way void GfxPicture::draw(int16 animationNr, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) { uint16 headerSize; _animationNr = animationNr; _mirroredFlag = mirroredFlag; _addToFlag = addToFlag; _EGApaletteNo = EGApaletteNo; _priority = 0; headerSize = READ_LE_UINT16(_resource->data); switch (headerSize) { case 0x26: // SCI 1.1 VGA picture _resourceType = SCI_PICTURE_TYPE_SCI11; drawSci11Vga(); break; #ifdef ENABLE_SCI32 case 0x0e: // SCI32 VGA picture _resourceType = SCI_PICTURE_TYPE_SCI32; //drawSci32Vga(); break; #endif default: // VGA, EGA or Amiga vector data _resourceType = SCI_PICTURE_TYPE_REGULAR; drawVectorData(_resource->data, _resource->size); } }
void Renderer::draw() { if (!mMesh) return; // nothing to do if (mOutputContour) drawContourData(mOutputContour); if (mCfg.mesh.mRenderMesh) drawMesh(); if (mOutputVector && mOutputVector->dataSet->type() == DataSet::Vector) drawVectorData(mOutputVector); }
void GfxPicture::drawSci11Vga() { byte *inbuffer = _resource->data; int size = _resource->size; int priorityBandsCount = inbuffer[3]; int has_cel = inbuffer[4]; int vector_dataPos = READ_LE_UINT32(inbuffer + 16); int vector_size = size - vector_dataPos; int palette_data_ptr = READ_LE_UINT32(inbuffer + 28); int cel_headerPos = READ_LE_UINT32(inbuffer + 32); int cel_RlePos = READ_LE_UINT32(inbuffer + cel_headerPos + 24); int cel_LiteralPos = READ_LE_UINT32(inbuffer + cel_headerPos + 28); Palette palette; // Header // [headerSize:WORD] [unknown:BYTE] [priorityBandCount:BYTE] [hasCel:BYTE] [unknown:BYTE] // [unknown:WORD] [unknown:WORD] [unknown:WORD] [unknown:WORD] [unknown:WORD] // Offset 16 // [vectorDataOffset:DWORD] [unknown:DWORD] [unknown:DWORD] [paletteDataOffset:DWORD] // Offset 32 // [celHeaderOffset:DWORD] [unknown:DWORD] // [priorityBandData:WORD] * priorityBandCount // [priority:BYTE] [unknown:BYTE] // priority bands are supposed to be 14 for sci1.1 pictures assert(priorityBandsCount == 14); if (_addToFlag) { _priority = inbuffer[40 + priorityBandsCount * 2] & 0xF; } // display Cel-data if (has_cel) { // Create palette and set it _palette->createFromData(inbuffer + palette_data_ptr, size - palette_data_ptr, &palette); _palette->set(&palette, true); drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, 0, 0, 0); } // process vector data drawVectorData(inbuffer + vector_dataPos, vector_size); // Set priority band information _ports->priorityBandsInitSci11(inbuffer + 40); }
void GfxPicture::drawSci11Vga() { SciSpan<const byte> inbuffer(*_resource); int priorityBandsCount = inbuffer[3]; int has_cel = inbuffer[4]; int vector_dataPos = inbuffer.getUint32LEAt(16); int vector_size = _resource->size() - vector_dataPos; int palette_data_ptr = inbuffer.getUint32LEAt(28); int cel_headerPos = inbuffer.getUint32LEAt(32); int cel_RlePos = inbuffer.getUint32LEAt(cel_headerPos + 24); int cel_LiteralPos = inbuffer.getUint32LEAt(cel_headerPos + 28); Palette palette; // Header // [headerSize:WORD] [unknown:BYTE] [priorityBandCount:BYTE] [hasCel:BYTE] [unknown:BYTE] // [unknown:WORD] [unknown:WORD] [unknown:WORD] [unknown:WORD] [unknown:WORD] // Offset 16 // [vectorDataOffset:DWORD] [unknown:DWORD] [unknown:DWORD] [paletteDataOffset:DWORD] // Offset 32 // [celHeaderOffset:DWORD] [unknown:DWORD] // [priorityBandData:WORD] * priorityBandCount // [priority:BYTE] [unknown:BYTE] // priority bands are supposed to be 14 for sci1.1 pictures assert(priorityBandsCount == 14); if (_addToFlag) { _priority = inbuffer[40 + priorityBandsCount * 2] & 0xF; } // display Cel-data if (has_cel) { // Create palette and set it _palette->createFromData(inbuffer.subspan(palette_data_ptr), &palette); _palette->set(&palette, true); drawCelData(inbuffer, cel_headerPos, cel_RlePos, cel_LiteralPos, 0, 0, 0, 0, false); } // process vector data drawVectorData(inbuffer.subspan(vector_dataPos, vector_size)); // Set priority band information _ports->priorityBandsInitSci11(inbuffer.subspan(40)); }
// differentiation between various picture formats can NOT get done using sci-version checks. // Games like PQ1 use the "old" vector data picture format, but are actually SCI1.1 // We should leave this that way to decide the format on-the-fly instead of hardcoding it in any way void GfxPicture::draw(int16 animationNr, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) { uint16 headerSize; _animationNr = animationNr; _mirroredFlag = mirroredFlag; _addToFlag = addToFlag; _EGApaletteNo = EGApaletteNo; _priority = 0; headerSize = _resource->getUint16LEAt(0); switch (headerSize) { case 0x26: // SCI 1.1 VGA picture _resourceType = SCI_PICTURE_TYPE_SCI11; drawSci11Vga(); break; default: // VGA, EGA or Amiga vector data _resourceType = SCI_PICTURE_TYPE_REGULAR; drawVectorData(*_resource); } }