From 819cad3a179260d0b0a973342765a0caff4b13b4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Aug 2014 07:36:11 -0400 Subject: ACCESS: Implemented setVideo --- engines/access/access.cpp | 3 +++ engines/access/access.h | 1 + engines/access/video.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ engines/access/video.h | 20 ++++++++++++++++++-- 4 files changed, 65 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 7189ebb799..92ded4facf 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -71,6 +71,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) _scaleI = 0; _scaleFlag = false; _eseg = nullptr; + _plotBuffer = nullptr; _conversation = 0; _currentMan = 0; @@ -128,6 +129,8 @@ AccessEngine::~AccessEngine() { delete _inactive; delete _music; delete _title; + delete _eseg; + delete _plotBuffer; } void AccessEngine::setVGA() { diff --git a/engines/access/access.h b/engines/access/access.h index 55810e8a16..8e05da7104 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -129,6 +129,7 @@ public: ASurface *_current; ASurface _buffer1; ASurface _buffer2; + byte *_plotBuffer; Common::Array _charTable; SpriteResource *_objectsTable[100]; bool _establishTable[100]; diff --git a/engines/access/video.cpp b/engines/access/video.cpp index 4774703a03..da397a4359 100644 --- a/engines/access/video.cpp +++ b/engines/access/video.cpp @@ -45,7 +45,37 @@ void VideoPlayer::setVideo(ASurface *vidSurface, const Common::Point &pt, FileId _videoData = _vm->_files->loadFile(videoFile); // Load in header + _frameCount = _videoData->_stream->readUint16LE(); + _header._width = _videoData->_stream->readUint16LE(); + _header._height = _videoData->_stream->readUint16LE(); + _videoData->_stream->skip(1); + _header._flags = (VideoFlags)_videoData->_stream->readByte(); + _startCoord = (byte *)vidSurface->getBasePtr(pt.x, pt.y); + _frameCount = _header._frameCount - 2; + _xCount = _header._width; + _scanCount = _header._height; + _vidFrame = 0; + + getFrame(); + + if (_header._flags == VIDEOFLAG_BG) { + // Draw the background + const byte *pSrc = _vm->_plotBuffer; + for (int y = 0; y < _scanCount; ++y) { + byte *pDest = (byte *)vidSurface->getBasePtr(pt.x, pt.y + y); + Common::copy(pSrc, pSrc + _xCount, pDest); + pSrc += _xCount; + } + + if (vidSurface == _vm->_screen) + _vm->_newRects.push_back(Common::Rect(pt.x, pt.y, pt.x + _xCount, pt.y + _scanCount)); + + + getFrame(); + } + + _videoEnd = false; } void VideoPlayer::freeVideo() { @@ -53,5 +83,18 @@ void VideoPlayer::freeVideo() { _videoData = nullptr; } +void VideoPlayer::getFrame() { + _frameSize = _videoData->_stream->readUint16LE(); + _videoData->_stream->read(_vm->_plotBuffer, _frameSize); +} + +void VideoPlayer::playVideo() { + if (_vm->_timers[31]._flag) + return; + ++_vm->_timers[31]._flag; + + +} + } // End of namespace Access diff --git a/engines/access/video.h b/engines/access/video.h index a87c90ccb8..7fa1ad2d27 100644 --- a/engines/access/video.h +++ b/engines/access/video.h @@ -31,13 +31,29 @@ namespace Access { +enum VideoFlags { VIDEOFLAG_NONE = 0, VIDEOFLAG_BG = 1 }; + class VideoPlayer: public Manager { + struct VideoHeader { + int _frameCount; + int _width, _height; + VideoFlags _flags; + }; private: ASurface *_vidSurface; Resource *_videoData; + VideoHeader _header; + byte *_startCoord; int _frameCount; - int _width, _height; - int _flags; + int _xCount; + int _scanCount; + int _vidFrame; + int _frameSize; + bool _videoEnd; + + void getFrame(); + + void playVideo(); public: VideoPlayer(AccessEngine *vm); ~VideoPlayer(); -- cgit v1.2.3