[Scummvm-cvs-logs] SF.net SVN: scummvm:[42713] scummvm/trunk

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Fri Jul 24 23:35:57 CEST 2009


Revision: 42713
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42713&view=rev
Author:   drmccoy
Date:     2009-07-24 21:35:57 +0000 (Fri, 24 Jul 2009)

Log Message:
-----------
Renaming getAnchor() to getFrameCoords()

Modified Paths:
--------------
    scummvm/trunk/engines/gob/videoplayer.cpp
    scummvm/trunk/graphics/video/coktelvideo/coktelvideo.cpp
    scummvm/trunk/graphics/video/coktelvideo/coktelvideo.h

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2009-07-24 21:35:06 UTC (rev 42712)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2009-07-24 21:35:57 UTC (rev 42713)
@@ -772,7 +772,7 @@
 		height = _primaryVideo->getVideo()->getHeight();
 
 		if (VAR_OFFSET(varX) == 0xFFFFFFFF)
-			_primaryVideo->getVideo()->getAnchor(1, 2, x, y, width, height);
+			_primaryVideo->getVideo()->getFrameCoords(1, x, y, width, height);
 
 		WRITE_VAR_OFFSET(varX, x);
 		WRITE_VAR_OFFSET(varY, y);

Modified: scummvm/trunk/graphics/video/coktelvideo/coktelvideo.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktelvideo/coktelvideo.cpp	2009-07-24 21:35:06 UTC (rev 42712)
+++ scummvm/trunk/graphics/video/coktelvideo/coktelvideo.cpp	2009-07-24 21:35:57 UTC (rev 42713)
@@ -857,6 +857,40 @@
 	}
 }
 
+
+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 @@
 		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))

Modified: scummvm/trunk/graphics/video/coktelvideo/coktelvideo.h
===================================================================
--- scummvm/trunk/graphics/video/coktelvideo/coktelvideo.h	2009-07-24 21:35:06 UTC (rev 42712)
+++ scummvm/trunk/graphics/video/coktelvideo/coktelvideo.h	2009-07-24 21:35:57 UTC (rev 42713)
@@ -127,8 +127,8 @@
 	/** 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 @@
 	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 @@
 	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 @@
 	};
 
 	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 @@
 
 	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);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list