diff options
| -rw-r--r-- | engines/gob/coktelvideo.cpp | 3 | ||||
| -rw-r--r-- | engines/gob/coktelvideo.h | 10 | ||||
| -rw-r--r-- | engines/gob/demoplayer.cpp | 54 | ||||
| -rw-r--r-- | engines/gob/demoplayer.h | 3 | ||||
| -rw-r--r-- | engines/gob/driver_vga.cpp | 37 | ||||
| -rw-r--r-- | engines/gob/driver_vga.h | 2 | ||||
| -rw-r--r-- | engines/gob/video.cpp | 6 | ||||
| -rw-r--r-- | engines/gob/video.h | 3 | ||||
| -rw-r--r-- | engines/gob/videoplayer.cpp | 44 | ||||
| -rw-r--r-- | engines/gob/videoplayer.h | 8 | 
10 files changed, 159 insertions, 11 deletions
| diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp index 1c19e4b513..55b5e61c31 100644 --- a/engines/gob/coktelvideo.cpp +++ b/engines/gob/coktelvideo.cpp @@ -1006,6 +1006,9 @@ bool Vmd::load(Common::SeekableReadStream &stream) {  		}  	} +	if (_externalCodec && _codecIndeo3) +		_features |= kFeaturesSupportsDouble; +  	_soundFreq = _stream->readSint16LE();  	_soundSliceSize = _stream->readSint16LE();  	_soundSlicesCount = _stream->readSint16LE(); diff --git a/engines/gob/coktelvideo.h b/engines/gob/coktelvideo.h index 54a72f0623..c2590dc503 100644 --- a/engines/gob/coktelvideo.h +++ b/engines/gob/coktelvideo.h @@ -56,7 +56,9 @@ public:  		/** Has video. */  		kFeaturesVideo = 0x400,  		/** Is a full color (non-paletted) video. */ -		kFeaturesFullColor = 0x4000 +		kFeaturesFullColor = 0x4000, +		/** Supports automatic doubling. */ +		kFeaturesSupportsDouble = 0x40000000  	};  	enum StateFlags { @@ -95,7 +97,7 @@ public:  	virtual ~CoktelVideo() { }  	/** Returns the features the loaded video possesses. */ -	virtual uint16 getFeatures() const = 0; +	virtual uint32 getFeatures() const = 0;  	/** Returns the flags the loaded video possesses. */  	virtual uint16 getFlags() const = 0;  	/** Returns the x coordinate of the video. */ @@ -196,7 +198,7 @@ public:  	Imd();  	~Imd(); -	uint16 getFeatures() const { return _features; } +	uint32 getFeatures() const { return _features; }  	uint16 getFlags() const { return _flags; }  	int16 getX() const { return _x; }  	int16 getY() const { return _y; } @@ -255,7 +257,7 @@ protected:  	Common::SeekableReadStream *_stream;  	uint16 _version; -	uint16 _features; +	uint32 _features;  	uint16 _flags;  	int16 _x, _y, _width, _height;  	int16 _stdX, _stdY, _stdWidth, _stdHeight; diff --git a/engines/gob/demoplayer.cpp b/engines/gob/demoplayer.cpp index cbc65dfed7..4f6327aeed 100644 --- a/engines/gob/demoplayer.cpp +++ b/engines/gob/demoplayer.cpp @@ -93,19 +93,67 @@ void DemoPlayer::playVideo(const char *fileName) {  	debugC(1, kDebugDemo, "Playing video \"%s\"", file); -	// Playing the video  	if (_vm->_vidPlayer->primaryOpen(file)) { -		_vm->_vidPlayer->slotSetDoubleMode(-1, _doubleMode); -		_vm->_vidPlayer->primaryPlay(); +		bool videoSupportsDouble = +			((_vm->_vidPlayer->getFeatures() & CoktelVideo::kFeaturesSupportsDouble) != 0); + +		if (_doubleMode) { +			if (videoSupportsDouble) { +				_vm->_vidPlayer->slotSetDoubleMode(-1, true); +				playVideoNormal(); +			} else +				playVideoDoubled(); +		} else +			playVideoNormal(); +  		_vm->_vidPlayer->primaryClose();  		if (waitTime > 0)  			_vm->_util->longDelay(waitTime);  	} +  	delete[] filePtr;  } +void DemoPlayer::playVideoNormal() { +	_vm->_vidPlayer->primaryPlay(); +} + +void DemoPlayer::playVideoDoubled() { +	const char *fileNameOpened; +	char *fileName; + +	fileNameOpened = _vm->_vidPlayer->getFileName(); + +	fileName = new char[strlen(fileNameOpened) + 1]; +	strcpy(fileName, fileNameOpened); + +	_vm->_vidPlayer->primaryClose(); + +	if (_vm->_vidPlayer->primaryOpen(fileName, 0, -1, VideoPlayer::kFlagOtherSurface)) { +		for (int i = 0; i < _vm->_vidPlayer->getFramesCount(); i++) { +			if (_vm->_vidPlayer->primaryPlay(i, i)) +				break; + +			CoktelVideo::State state = _vm->_vidPlayer->getState(); + +			int16 w = state.right - state.left + 1; +			int16 h = state.bottom - state.top + 1; +			int16 wD = (state.left * 2) + (w * 2); +			int16 hD = (state.top * 2) + (h * 2); + +			_vm->_video->drawSpriteDouble(_vm->_draw->_spritesArray[0], _vm->_draw->_frontSurface, +					state.left, state.top, state.right, state.bottom, state.left, state.top, 0); +			_vm->_draw->dirtiedRect(_vm->_draw->_frontSurface, +					state.left * 2, state.top * 2, wD, hD); +			_vm->_video->retrace(); +		} +	} + +	delete[] fileName; +} +  void DemoPlayer::evaluateVideoMode(const char *mode) {  	debugC(2, kDebugDemo, "Video mode \"%s\"", mode); diff --git a/engines/gob/demoplayer.h b/engines/gob/demoplayer.h index 8663426649..c26ecacaa9 100644 --- a/engines/gob/demoplayer.h +++ b/engines/gob/demoplayer.h @@ -52,6 +52,9 @@ protected:  	void evaluateVideoMode(const char *mode);  	void clearScreen();  	void playVideo(const char *fileName); + +	void playVideoNormal(); +	void playVideoDoubled();  };  } // End of namespace Gob diff --git a/engines/gob/driver_vga.cpp b/engines/gob/driver_vga.cpp index b182700dba..24c2d8e37b 100644 --- a/engines/gob/driver_vga.cpp +++ b/engines/gob/driver_vga.cpp @@ -163,6 +163,43 @@ void VGAVideoDriver::drawSprite(SurfaceDesc *source, SurfaceDesc *dest,  	}  } +void VGAVideoDriver::drawSpriteDouble(SurfaceDesc *source, SurfaceDesc *dest, +		int16 left, int16 top, int16 right, int16 bottom, +		int16 x, int16 y, int16 transp) { + +	if ((x >= dest->getWidth()) || (x < 0) || +	    (y >= dest->getHeight()) || (y < 0)) +		return; + +	int16 width = MIN<int>((right - left) + 1, dest->getWidth() / 2); +	int16 height = MIN<int>((bottom - top) + 1, dest->getHeight() / 2); + +	if ((width < 1) || (height < 1)) +		return; + +	const byte *srcPos = source->getVidMem() + (top * source->getWidth()) + left; +	byte *destPos = dest->getVidMem() + ((y * 2) * dest->getWidth()) + (x * 2); + +	while (height--) { +		const byte *srcBak = srcPos; + +		for (int i = 0; i < 2; i++) { +			srcPos = srcBak; + +			for (int16 j = 0; j < width; j++) { +				if (!transp || srcPos[i]) { +					destPos[2 * j + 0] = srcPos[j]; +					destPos[2 * j + 1] = srcPos[j]; +				} +			} + +			destPos += dest->getWidth(); +		} + +		srcPos = srcBak + source->getWidth(); +	} +} +  void VGAVideoDriver::drawPackedSprite(byte *sprBuf, int16 width, int16 height,  		int16 x, int16 y, byte transp, SurfaceDesc *dest) {  	int destRight = x + width; diff --git a/engines/gob/driver_vga.h b/engines/gob/driver_vga.h index 79c2cb513b..c67fd1cb2f 100644 --- a/engines/gob/driver_vga.h +++ b/engines/gob/driver_vga.h @@ -45,6 +45,8 @@ public:  			byte transp, SurfaceDesc *dest);  	void drawSprite(SurfaceDesc *source, SurfaceDesc *dest, int16 left,  			int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp); +	void drawSpriteDouble(SurfaceDesc *source, SurfaceDesc *dest, int16 left, +			int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp);  	void drawPackedSprite(byte *sprBuf, int16 width, int16 height,  			int16 x, int16 y, byte transp, SurfaceDesc *dest);  }; diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index ab39c5e7e7..7901ec223a 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -378,6 +378,12 @@ void Video::drawSprite(SurfaceDesc *source, SurfaceDesc *dest,  	_videoDriver->drawSprite(source, dest, left, top, right, bottom, x, y, transp);  } +void Video::drawSpriteDouble(SurfaceDesc *source, SurfaceDesc *dest, +	    int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) { + +	_videoDriver->drawSpriteDouble(source, dest, left, top, right, bottom, x, y, transp); +} +  void Video::drawLetter(int16 item, int16 x, int16 y, FontDesc *fontDesc,  		int16 color1, int16 color2, int16 transp, SurfaceDesc *dest) {  	byte *dataPtr; diff --git a/engines/gob/video.h b/engines/gob/video.h index 14bae430f1..38fdb2bf6f 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -149,6 +149,8 @@ public:  	void drawSprite(SurfaceDesc *source, SurfaceDesc *dest,  			int16 left, int16 top, int16 right, int16 bottom,  			int16 x, int16 y, int16 transp); +	void drawSpriteDouble(SurfaceDesc *source, SurfaceDesc *dest, +	    int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp);  	void drawLetter(int16 item, int16 x, int16 y, FontDesc *fontDesc,  			int16 color1, int16 color2, int16 transp, SurfaceDesc *dest);  	void drawPackedSprite(byte *sprBuf, int16 width, int16 height, @@ -258,6 +260,7 @@ public:  	VideoDriver() {}  	virtual ~VideoDriver() {}  	virtual void drawSprite(SurfaceDesc *source, SurfaceDesc *dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) = 0; +	virtual void drawSpriteDouble(SurfaceDesc *source, SurfaceDesc *dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) = 0;  	virtual void fillRect(SurfaceDesc *dest, int16 left, int16 top, int16 right, int16 bottom, byte color) = 0;  	virtual void putPixel(int16 x, int16 y, byte color, SurfaceDesc *dest) = 0;  	virtual void drawLetter(unsigned char item, int16 x, int16 y, Video::FontDesc *fontDesc, byte color1, byte color2, byte transp, SurfaceDesc *dest) = 0; diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index ba34e675ec..76b574f44f 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -114,6 +114,10 @@ const CoktelVideo *VideoPlayer::Video::getVideo() const {  	return _video;  } +uint32 VideoPlayer::Video::getFeatures() const { +	return _video->getFeatures(); +} +  CoktelVideo::State VideoPlayer::Video::getState() const {  	return _state;  } @@ -286,12 +290,12 @@ bool VideoPlayer::primaryOpen(const char *videoFile, int16 x, int16 y,  	return true;  } -void VideoPlayer::primaryPlay(int16 startFrame, int16 lastFrame, int16 breakKey, +bool VideoPlayer::primaryPlay(int16 startFrame, int16 lastFrame, int16 breakKey,  		uint16 palCmd, int16 palStart, int16 palEnd,  		int16 palFrame, int16 endFrame, bool fade, int16 reverseTo, bool forceSeek) {  	if (!_primaryVideo->isOpen()) -		return; +		return false;  	CoktelVideo &video = *(_primaryVideo->getVideo()); @@ -318,9 +322,13 @@ void VideoPlayer::primaryPlay(int16 startFrame, int16 lastFrame, int16 breakKey,  	if (fade)  		_vm->_palAnim->fade(0, -2, 0); +	bool canceled = false; +  	while (startFrame <= lastFrame) { -		if (doPlay(startFrame, breakKey, palCmd, palStart, palEnd, palFrame, endFrame)) +		if (doPlay(startFrame, breakKey, palCmd, palStart, palEnd, palFrame, endFrame)) { +			canceled = true;  			break; +		}  		evalBgShading(video); @@ -355,6 +363,8 @@ void VideoPlayer::primaryPlay(int16 startFrame, int16 lastFrame, int16 breakKey,  	}  	evalBgShading(video); + +	return canceled;  }  void VideoPlayer::primaryClose() { @@ -493,6 +503,15 @@ VideoPlayer::Video *VideoPlayer::getVideoBySlot(int slot) {  	return 0;  } +const char *VideoPlayer::getFileName(int slot) const { +	const Video *video = getVideoBySlot(slot); + +	if (video) +		return video->getFileName(); + +	return ""; +} +  uint16 VideoPlayer::getFlags(int slot) const {  	const Video *video = getVideoBySlot(slot); @@ -556,6 +575,25 @@ int16 VideoPlayer::getDefaultY(int slot) const {  	return 0;  } +uint32 VideoPlayer::getFeatures(int slot) const { +	const Video *video = getVideoBySlot(slot); + +	if (video) +		return video->getFeatures(); + +	return 0; +} + +CoktelVideo::State VideoPlayer::getState(int slot) const { +	const Video *video = getVideoBySlot(slot); +	CoktelVideo::State state; + +	if (video) +		state = video->getState(); + +	return state; +} +  bool VideoPlayer::hasExtraData(const char *fileName, int slot) const {  	const Video *video = getVideoBySlot(slot); diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h index 61f264975a..07837eb6c2 100644 --- a/engines/gob/videoplayer.h +++ b/engines/gob/videoplayer.h @@ -57,7 +57,7 @@ public:  	bool primaryOpen(const char *videoFile, int16 x = -1, int16 y = -1,  			int16 flags = kFlagFrontSurface, Type which = kVideoTypeTry); -	void primaryPlay(int16 startFrame = -1, int16 lastFrame = -1, int16 breakKey = 27, +	bool primaryPlay(int16 startFrame = -1, int16 lastFrame = -1, int16 breakKey = 27,  			uint16 palCmd = 8, int16 palStart = 0, int16 palEnd = 255,  			int16 palFrame = -1, int16 endFrame = -1, bool fade = false,  			int16 reverseTo = -1, bool forceSeek = false); @@ -76,6 +76,7 @@ public:  	bool slotIsOpen(int slot) const; +	const char *getFileName(int slot = -1) const;  	uint16 getFlags(int slot = -1) const;  	int16 getFramesCount(int slot = -1) const;  	int16 getCurrentFrame(int slot = -1) const; @@ -84,6 +85,9 @@ public:  	int16 getDefaultX(int slot = -1) const;  	int16 getDefaultY(int slot = -1) const; +	CoktelVideo::State getState(int slot = -1) const; +	uint32 getFeatures(int slot = -1) const; +  	bool hasExtraData(const char *fileName, int slot = -1) const;  	Common::MemoryReadStream *getExtraData(const char *fileName, int slot = -1); @@ -106,7 +110,9 @@ private:  			const char *getFileName() const;  			CoktelVideo *getVideo();  			const CoktelVideo *getVideo() const; +  			CoktelVideo::State getState() const; +			uint32 getFeatures() const;  			int16 getDefaultX() const;  			int16 getDefaultY() const; | 
