diff options
author | Sven Hesse | 2008-12-15 05:16:23 +0000 |
---|---|---|
committer | Sven Hesse | 2008-12-15 05:16:23 +0000 |
commit | 6b043aa05b8b59e1b938b88e98df38e027e1b8bf (patch) | |
tree | d698c2e8f212d3ff40041db49e7311fa6c31168a /engines | |
parent | a59890ed649650588d2aaed198db4ce015476ba2 (diff) | |
download | scummvm-rg350-6b043aa05b8b59e1b938b88e98df38e027e1b8bf.tar.gz scummvm-rg350-6b043aa05b8b59e1b938b88e98df38e027e1b8bf.tar.bz2 scummvm-rg350-6b043aa05b8b59e1b938b88e98df38e027e1b8bf.zip |
Support for Urban Runner's new cursors (frames out of 16bit color VMDs)
svn-id: r35376
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/coktelvideo.cpp | 82 | ||||
-rw-r--r-- | engines/gob/coktelvideo.h | 8 | ||||
-rw-r--r-- | engines/gob/inter_v6.cpp | 75 | ||||
-rw-r--r-- | engines/gob/video_v6.cpp | 14 | ||||
-rw-r--r-- | engines/gob/videoplayer.cpp | 2 |
5 files changed, 123 insertions, 58 deletions
diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp index 377cb8a3a5..34a27b03a0 100644 --- a/engines/gob/coktelvideo.cpp +++ b/engines/gob/coktelvideo.cpp @@ -920,18 +920,17 @@ bool Vmd::load(Common::SeekableReadStream &stream) { } } - if (handle == 0) { - // _field_463 = 1; - } else if (handle == 1) { - // _field_463 = 0; - } else if (handle == 2) { - // _field_463 = 2; - } else { + if (handle > 2) { warning("VMD Version incorrect (%d, %d, %d)", headerLength, handle, _version); unload(); return false; } + _bytesPerPixel = handle + 1; + + if (_bytesPerPixel > 1) + _features |= kFeaturesFullColor; + _flags = _stream->readUint16LE(); _partsPerFrame = _stream->readUint16LE(); _firstFramePos = _stream->readUint32LE(); @@ -946,14 +945,15 @@ bool Vmd::load(Common::SeekableReadStream &stream) { _frameDataSize = _stream->readUint32LE(); _vidBufferSize = _stream->readUint32LE(); + if (_bytesPerPixel > 1) + _frameDataSize = _vidBufferSize = 0; // 0x322 (802) if (_hasVideo) { - _vidBufferSize = _frameDataSize = 312200; -/* if ((_frameDataSize == 0) || (_frameDataSize > 1048576)) - _frameDataSize = _width * _height + 500; + if ((_frameDataSize == 0) || (_frameDataSize > 1048576)) + _frameDataSize = _width * _height + 1000; if ((_vidBufferSize == 0) || (_vidBufferSize > 1048576)) - _vidBufferSize = _frameDataSize;*/ + _vidBufferSize = _frameDataSize; _frameData = new byte[_frameDataSize]; assert(_frameData); @@ -1092,6 +1092,13 @@ void Vmd::unload() { clear(); } +int16 Vmd::getWidth() const { + if (_bytesPerPixel == 2) + return _width >> 1; + + return _width; +} + void Vmd::setXY(int16 x, int16 y) { for (int i = 0; i < _framesCount; i++) { @@ -1166,6 +1173,8 @@ void Vmd::clear(bool del) { _soundBytesPerSample = 1; _soundStereo = 0; + + _bytesPerPixel = 1; } CoktelVideo::State Vmd::processFrame(uint16 frame) { @@ -1613,4 +1622,55 @@ Common::MemoryReadStream *Vmd::getExtraData(const char *fileName) { return stream; } +void Vmd::copyCurrentFrame(byte *dest, + uint16 left, uint16 top, uint16 width, uint16 height, + uint16 x, uint16 y, uint16 pitch, int16 transp) { + + if (_bytesPerPixel != 2) + Imd::copyCurrentFrame(dest, left, top, width, height, x, y, pitch, transp); + + if (!_vidMem) + return; + + int16 vWidth = _width >> 1; + + if (((left + width) > vWidth) || ((top + height) > _height)) + return; + + assert(_palLUT); + + SierraLight *dither = new SierraLight(width, height, _palLUT); + + uint16 *vidMem = (uint16 *) _vidMem; + dest += pitch * y; + vidMem += vWidth * top; + + for (int i = 0; i < height; i++) { + byte *d = dest + x; + uint16 *s = vidMem + left; + + for (int j = 0; j < width; j++, s++) { + byte r = ((*s & 0x7C00) >> 10) << 1; + byte g = ((*s & 0x03E0) >> 5) << 1; + byte b = ((*s & 0x001F) >> 0) << 1; + byte dY, dU, dV; + + PaletteLUT::RGB2YUV(r << 2, g << 2, b << 2, dY, dU, dV); + + byte p = dither->dither(dY, dU, dV, j); + + if ((dY == 0) || ((r == 0) && (g == 0) && (b == 0))) + *d++ = 0; + else + *d++ = p; + } + + dither->nextLine(); + dest += pitch; + vidMem += vWidth; + } + + delete dither; +} + } // End of namespace Gob diff --git a/engines/gob/coktelvideo.h b/engines/gob/coktelvideo.h index 5acb4de4c7..c6c78011d6 100644 --- a/engines/gob/coktelvideo.h +++ b/engines/gob/coktelvideo.h @@ -315,12 +315,18 @@ public: bool load(Common::SeekableReadStream &stream); void unload(); + int16 getWidth() const; + void setXY(int16 x, int16 y); void seekFrame(int32 frame, int16 whence = SEEK_SET, bool restart = false); State nextFrame(); + virtual void copyCurrentFrame(byte *dest, + uint16 left, uint16 top, uint16 width, uint16 height, + uint16 x, uint16 y, uint16 pitch, int16 transp = -1); + protected: enum PartType { kPartTypeSeparator = 0, @@ -366,6 +372,8 @@ protected: byte _soundBytesPerSample; byte _soundStereo; // (0: mono, 1: old-style stereo, 2: new-style stereo) + byte _bytesPerPixel; + PaletteLUT *_palLUT; Indeo3 *_codecIndeo3; diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index 20186a165d..5234db33b0 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -753,51 +753,64 @@ void Inter_v6::o6_playVmdOrMusic() { } bool Inter_v6::o6_loadCursor(OpFuncParams ¶ms) { - int16 width, height; - byte *dataBuf; - int16 id; - int8 index; + int16 id = load16(); - id = load16(); + if ((id == -1) || (id == -2)) { + char file[10]; - if (id == -1) { - byte str[10]; + if (id == -1) { + for (int i = 0; i < 9; i++) + file[i] = *_vm->_global->_inter_execPtr++; + } else + strncpy(file, GET_VAR_STR(load16()), 10); - for (int i = 0; i < 9; i++) - str[i] = *_vm->_global->_inter_execPtr++; + file[9] = '\0'; - str[9] = '\0'; + uint16 start = load16(); + int8 index = (int8) *_vm->_global->_inter_execPtr++; - uint16 var1 = load16(); - int8 var2 = *_vm->_global->_inter_execPtr++; + int vmdSlot = _vm->_vidPlayer->slotOpen(file); - warning("Urban Stub: loadCursor %d: \"%s\", %d, %d", id, str, var1, var2); + if (vmdSlot == -1) { + warning("Can't open video \"%s\" as cursor", file); + return false; + } - } else if (id == -2) { + int16 framesCount = _vm->_vidPlayer->getFramesCount(vmdSlot); - uint16 var1 = load16(); - uint16 var2 = load16(); - int8 var3 = *_vm->_global->_inter_execPtr++; + for (int i = 0; i < framesCount; i++) { + _vm->_vidPlayer->slotPlay(vmdSlot); + _vm->_vidPlayer->slotCopyFrame(vmdSlot, _vm->_draw->_cursorSprites->getVidMem(), + 0, 0, _vm->_draw->_cursorWidth, _vm->_draw->_cursorWidth, + (start + i) * _vm->_draw->_cursorWidth, 0, + _vm->_draw->_cursorSprites->getWidth()); + } - warning("Urban Stub: loadCursor %d: %d, %d, %d", id, var1, var2, var3); + _vm->_vidPlayer->slotClose(vmdSlot); - } else { - index = (int8) *_vm->_global->_inter_execPtr++; + _vm->_draw->_cursorAnimLow[index] = start; + _vm->_draw->_cursorAnimHigh[index] = framesCount + start - 1; + _vm->_draw->_cursorAnimDelays[index] = 10; - if ((index * _vm->_draw->_cursorWidth) >= _vm->_draw->_cursorSprites->getWidth()) - return false; + return false; + } - dataBuf = _vm->_game->loadTotResource(id, 0, &width, &height); + int8 index = (int8) *_vm->_global->_inter_execPtr++; - _vm->_video->fillRect(_vm->_draw->_cursorSprites, - index * _vm->_draw->_cursorWidth, 0, - index * _vm->_draw->_cursorWidth + _vm->_draw->_cursorWidth - 1, - _vm->_draw->_cursorHeight - 1, 0); + if ((index * _vm->_draw->_cursorWidth) >= _vm->_draw->_cursorSprites->getWidth()) + return false; - _vm->_video->drawPackedSprite(dataBuf, width, height, - index * _vm->_draw->_cursorWidth, 0, 0, _vm->_draw->_cursorSprites); - _vm->_draw->_cursorAnimLow[index] = 0; - } + int16 width, height; + byte *dataBuf = _vm->_game->loadTotResource(id, 0, &width, &height); + + _vm->_video->fillRect(_vm->_draw->_cursorSprites, + index * _vm->_draw->_cursorWidth, 0, + index * _vm->_draw->_cursorWidth + _vm->_draw->_cursorWidth - 1, + _vm->_draw->_cursorHeight - 1, 0); + + _vm->_video->drawPackedSprite(dataBuf, width, height, + index * _vm->_draw->_cursorWidth, 0, 0, _vm->_draw->_cursorSprites); + _vm->_draw->_cursorAnimLow[index] = 0; return false; } diff --git a/engines/gob/video_v6.cpp b/engines/gob/video_v6.cpp index c32b98d99f..8e49a04ff4 100644 --- a/engines/gob/video_v6.cpp +++ b/engines/gob/video_v6.cpp @@ -107,20 +107,6 @@ void Video_v6::drawYUVData(const byte *srcData, SurfaceDesc *destDesc, const byte *dataU = dataY + (dataWidth * dataHeight); const byte *dataV = dataU + ((dataWidth * dataHeight) >> 4); -/* - if (destDesc->field_14 == 1) { - SurfaceDesc *tmpSurf = _vid_initSurfDesc(2, width, height, 0); - - sub_46126(tmpSurf, 0, 0, dataWidth, dataHeight, width, height, dataY, dataU, dataV); - - _vid_drawSprite(tmpSurf, destDesc, 0, 0, width - 1, height - 1, x, y, 0); - - _vid_freeSurfDesc(tmpSurf); - - return; - } -*/ - drawYUV(destDesc, x, y, dataWidth, dataHeight, width, height, dataY, dataU, dataV); } diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 403fa12408..0285bf2014 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -360,8 +360,6 @@ int VideoPlayer::slotOpen(const char *videoFile, Type which) { return -1; } - assert((video->getVideo()->getFeatures() & CoktelVideo::kFeaturesFullColor) == 0); - video->getVideo()->setVideoMemory(); video->getVideo()->enableSound(*_vm->_mixer); |