diff options
author | Sven Hesse | 2009-07-24 21:35:57 +0000 |
---|---|---|
committer | Sven Hesse | 2009-07-24 21:35:57 +0000 |
commit | c4baedc6dbffbec01cf9a0f7d57f1922b0bceaec (patch) | |
tree | d4d4c6743fbf82c0087386e7e1fa24d3c6c9e7cb /graphics/video/coktelvideo | |
parent | 8396e2071330957121ad765df80aeaf0ffe5c4d0 (diff) | |
download | scummvm-rg350-c4baedc6dbffbec01cf9a0f7d57f1922b0bceaec.tar.gz scummvm-rg350-c4baedc6dbffbec01cf9a0f7d57f1922b0bceaec.tar.bz2 scummvm-rg350-c4baedc6dbffbec01cf9a0f7d57f1922b0bceaec.zip |
Renaming getAnchor() to getFrameCoords()
svn-id: r42713
Diffstat (limited to 'graphics/video/coktelvideo')
-rw-r--r-- | graphics/video/coktelvideo/coktelvideo.cpp | 81 | ||||
-rw-r--r-- | graphics/video/coktelvideo/coktelvideo.h | 43 |
2 files changed, 81 insertions, 43 deletions
diff --git a/graphics/video/coktelvideo/coktelvideo.cpp b/graphics/video/coktelvideo/coktelvideo.cpp index 64f968888c..8dd3d4f328 100644 --- a/graphics/video/coktelvideo/coktelvideo.cpp +++ b/graphics/video/coktelvideo/coktelvideo.cpp @@ -857,6 +857,40 @@ void Imd::deLZ77(byte *dest, byte *src) { } } + +Vmd::ExtraData::ExtraData() { + memset(name, 0, 16); + + offset = 0; + size = 0; + realSize = 0; +} + + +Vmd::Part::Part() { + type = kPartTypeSeparator; + field_1 = 0; + field_E = 0; + size = 0; + left = 0; + top = 0; + right = 0; + bottom = 0; + id = 0; + flags = 0; +} + + +Vmd::Frame::Frame() { + parts = 0; + offset = 0; +} + +Vmd::Frame::~Frame() { + delete[] parts; +} + + const uint16 Vmd::_tableDPCM[128] = { 0x0000, 0x0008, 0x0010, 0x0020, 0x0030, 0x0040, 0x0050, 0x0060, 0x0070, 0x0080, 0x0090, 0x00A0, 0x00B0, 0x00C0, 0x00D0, 0x00E0, 0x00F0, 0x0100, 0x0110, 0x0120, @@ -1990,45 +2024,42 @@ void Vmd::filledSoundSlices(uint32 size, uint32 mask) { filledSoundSlice((_soundSlicesCount - 32) * _soundDataSize + _soundHeaderSize); } -bool Vmd::getAnchor(int16 frame, uint16 partType, +bool Vmd::getPartCoords(int16 frame, PartType type, int16 &x, int16 &y, int16 &width, int16 &height) { - uint32 pos = _stream->pos(); + if (frame >= _framesCount) + return false; - _stream->seek(_frameInfoOffset); - // Offsets to frames - _stream->skip(_framesCount * 6); - // Jump to the specified frame - _stream->skip(_partsPerFrame * frame * 16); + Frame &f = _frames[frame]; - // Find the anchor part - uint16 i; - for (i = 0; i < _partsPerFrame; i++) { - byte type = _stream->readByte(); + // Look for a part matching the requested type, stopping at a separator + Part *part = 0; + for (int i = 0; i < _partsPerFrame; i++) { + Part &p = f.parts[i]; - if ((type == kPartTypeSeparator) || (type == partType)) + if ((p.type == kPartTypeSeparator) || (p.type == type)) { + part = &p; break; - - _stream->skip(15); + } } - if (i == _partsPerFrame) { - // No anchor - - _stream->seek(pos); + if (!part) return false; - } - _stream->skip(5); - x = _stream->readSint16LE(); - y = _stream->readSint16LE(); - width = _stream->readSint16LE() - x + 1; - height = _stream->readSint16LE() - y + 1; + x = part->left; + y = part->top; + width = part->right - part->left + 1; + height = part->bottom - part->top + 1; - _stream->seek(pos); return true; } +bool Vmd::getFrameCoords(int16 frame, + int16 &x, int16 &y, int16 &width, int16 &height) { + + return getPartCoords(frame, kPartTypeVideo, x, y, width, height); +} + bool Vmd::hasExtraData(const char *fileName) const { for (uint i = 0; i < _extraData.size(); i++) if (!scumm_stricmp(_extraData[i].name, fileName)) diff --git a/graphics/video/coktelvideo/coktelvideo.h b/graphics/video/coktelvideo/coktelvideo.h index 49986d30c7..874df8e290 100644 --- a/graphics/video/coktelvideo/coktelvideo.h +++ b/graphics/video/coktelvideo/coktelvideo.h @@ -127,8 +127,8 @@ public: /** Returns the current frame's palette. */ virtual const byte *getPalette() const = 0; - /** Reads the video's anchor pointer */ - virtual bool getAnchor(int16 frame, uint16 partType, + /** Returns the frame's coordinates */ + virtual bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height) = 0; /** Returns whether that extra data file exists */ @@ -218,7 +218,7 @@ public: uint32 getSyncLag() const { return _skipFrames; } const byte *getPalette() const { return _palette; } - bool getAnchor(int16 frame, uint16 partType, + bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height) { return false; } bool hasExtraData(const char *fileName) const { return false; } @@ -317,7 +317,7 @@ public: Vmd(Graphics::PaletteLUT *palLUT = 0); ~Vmd(); - bool getAnchor(int16 frame, uint16 partType, + bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height); bool hasExtraData(const char *fileName) const; @@ -353,38 +353,42 @@ protected: }; struct ExtraData { - char name[16]; + char name[16]; uint32 offset; uint32 size; uint32 realSize; + + ExtraData(); } PACKED_STRUCT; struct Part { PartType type; - byte field_1; - byte field_E; - uint32 size; - int16 left; - int16 top; - int16 right; - int16 bottom; - uint16 id; - byte flags; + byte field_1; + byte field_E; + uint32 size; + int16 left; + int16 top; + int16 right; + int16 bottom; + uint16 id; + byte flags; + + Part(); } PACKED_STRUCT; struct Frame { uint32 offset; - Part *parts; + Part *parts; - Frame() : parts(0) { } - ~Frame() { delete[] parts; } + Frame(); + ~Frame(); } PACKED_STRUCT; static const uint16 _tableDPCM[128]; static const int32 _tableADPCM[]; static const int32 _tableADPCMStep[]; - bool _hasVideo; + bool _hasVideo; uint32 _videoCodec; uint32 _frameInfoOffset; @@ -414,6 +418,9 @@ protected: void clear(bool del = true); + bool getPartCoords(int16 frame, PartType type, + int16 &x, int16 &y, int16 &width, int16 &height); + bool assessVideoProperties(); bool assessAudioProperties(); void readFrameTable(int &numExtraData); |