void fadeIn(void *sourcePal) { char localPalette[0x300]; copyPalette((char *)sourcePal, localPalette); fadeInSub1(localPalette); flipOtherPalette(localPalette); }
bool VideoPlayer::playFrame(int slot, Properties &properties) { Video *video = getVideoBySlot(slot); if (!video) return false; bool primary = slot == 0; if (video->decoder->getCurFrame() != properties.startFrame) { if (properties.startFrame != -1) { // Seek into the middle of the video if (video->decoder->hasSound()) { // But there's sound if (properties.forceSeek) { // And we force seeking => Seek video->decoder->disableSound(); video->decoder->seek(properties.startFrame + 1, SEEK_SET, true); } } else // No sound => We can safely seek video->decoder->seek(properties.startFrame + 1, SEEK_SET, true); } else { // Seek to the start => We can safely seek video->decoder->disableSound(); video->decoder->seek(0, SEEK_SET, true); video->decoder->enableSound(); } } if (video->decoder->getCurFrame() > properties.startFrame) // If the video is already beyond the wanted frame, skip return true; bool modifiedPal = false; if (primary) { // Pre-decoding palette and blitting, only for primary videos if ((properties.startFrame == properties.palFrame) || ((properties.startFrame == properties.endFrame) && (properties.palCmd == 8))) { modifiedPal = true; _vm->_draw->_applyPal = true; if (properties.palCmd >= 4) copyPalette(*video, properties.palStart, properties.palEnd); } if (modifiedPal && (properties.palCmd == 8) && (video->surface != _vm->_draw->_backSurface)) _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); if (_needBlit) _vm->_draw->forceBlit(); } const Graphics::Surface *surface = video->decoder->decodeNextFrame(); WRITE_VAR(11, video->decoder->getCurFrame()); uint32 ignoreBorder = 0; if (_woodruffCohCottWorkaround && (properties.startFrame == 31)) { // WORKAROUND: This frame mistakenly masks Coh Cott, making her vanish // To prevent that, we'll never draw that part ignoreBorder = 50; } if (surface && primary) { // Post-decoding palette and blitting, only for primary videos if (_needBlit) _vm->_draw->forceBlit(true); if (modifiedPal && (properties.palCmd == 16)) { if (video->surface == _vm->_draw->_backSurface) _vm->_draw->forceBlit(); _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, -2, 0); _vm->_draw->_noInvalidated = true; _vm->_video->dirtyRectsAll(); } if (video->decoder->hasPalette() && (properties.palCmd > 1)) { copyPalette(*video, properties.palStart, properties.palEnd); if (video->surface != _vm->_draw->_backSurface) _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); else _vm->_draw->_applyPal = true; } const Common::List<Common::Rect> &dirtyRects = video->decoder->getDirtyRects(); if (modifiedPal && (properties.palCmd == 8) && (video->surface == _vm->_draw->_backSurface)) _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); if (video->surface == _vm->_draw->_backSurface) { for (Common::List<Common::Rect>::const_iterator rect = dirtyRects.begin(); rect != dirtyRects.end(); ++rect) _vm->_draw->invalidateRect(rect->left + ignoreBorder, rect->top, rect->right - 1, rect->bottom - 1); if (!video->live) _vm->_draw->blitInvalidated(); } else if (video->surface == _vm->_draw->_frontSurface) { for (Common::List<Common::Rect>::const_iterator rect = dirtyRects.begin(); rect != dirtyRects.end(); ++rect) _vm->_video->dirtyRectsAdd(rect->left + ignoreBorder, rect->top, rect->right - 1, rect->bottom - 1); } if (!video->live && ((video->decoder->getCurFrame() - 1) == properties.startFrame)) // Only retrace if we're playing the frame we actually want to play _vm->_video->retrace(); int32 subtitle = video->decoder->getSubtitleIndex(); if (subtitle != -1) _vm->_draw->printTotText(subtitle); if (modifiedPal && ((properties.palCmd == 2) || (properties.palCmd == 4))) _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, -2, 0); } if (primary && properties.waitEndFrame) checkAbort(*video, properties); if ((video->decoder->getCurFrame() - 1) < properties.startFrame) // The video played a frame we actually didn't want, so we have to adjust properties.startFrame--; return true; }