diff options
author | Paul Gilbert | 2014-03-15 18:52:44 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-03-15 18:52:44 -0400 |
commit | ca6cf0eaf2692ac5c787b86e193e8e6980d2b7ee (patch) | |
tree | 1e397c008c06c381047a7d8c3a48ca78b2f27b60 /engines | |
parent | b652e2eafd3de5436b45619659b5299d945074be (diff) | |
download | scummvm-rg350-ca6cf0eaf2692ac5c787b86e193e8e6980d2b7ee.tar.gz scummvm-rg350-ca6cf0eaf2692ac5c787b86e193e8e6980d2b7ee.tar.bz2 scummvm-rg350-ca6cf0eaf2692ac5c787b86e193e8e6980d2b7ee.zip |
MADS: Fix display of user interface during animation
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/mads.h | 1 | ||||
-rw-r--r-- | engines/mads/msurface.cpp | 16 | ||||
-rw-r--r-- | engines/mads/msurface.h | 8 | ||||
-rw-r--r-- | engines/mads/user_interface.cpp | 5 |
4 files changed, 25 insertions, 5 deletions
diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 10f4badf75..f19abb3889 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -39,7 +39,6 @@ #include "mads/msurface.h" #include "mads/resources.h" #include "mads/sound.h" -#include "mads/user_interface.h" /** * This is the namespace of the MADS engine. diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index c8c66234cb..62807e5543 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -34,20 +34,32 @@ MADSEngine *MSurface::_vm = nullptr; MSurface::MSurface() { pixels = nullptr; + _freeFlag = false; } MSurface::MSurface(int width, int height) { pixels = nullptr; + _freeFlag = false; setSize(width, height); } MSurface::~MSurface() { - Graphics::Surface::free(); + if (_freeFlag) + Graphics::Surface::free(); } void MSurface::setSize(int width, int height) { - Graphics::Surface::free(); + if (_freeFlag) + Graphics::Surface::free(); Graphics::Surface::create(width, height, Graphics::PixelFormat::createFormatCLUT8()); + _freeFlag = true; +} + +void MSurface::setPixels(byte *pData, int horizSize, int vertSize) { + _freeFlag = false; + pixels = pData; + w = horizSize; + h = vertSize; } int MSurface::scaleValue(int value, int scale, int err) { diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index d5b8741188..37ab305fb0 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -50,6 +50,8 @@ struct SpriteInfo { * MADS graphics surface */ class MSurface : public Graphics::Surface { +private: + bool _freeFlag; protected: static MADSEngine *_vm; public: @@ -84,6 +86,12 @@ public: void setSize(int width, int height); /** + * Sets the pixels the surface is associated with + * @remarks The surface will not free the data block + */ + void setPixels(byte *pData, int horizSize, int vertSize); + + /** * Draws an arbitrary line on the screen using a specified color * @param startPos Starting position * @param endPos Ending position diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 6afbf4c09c..63a0ec0a80 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -39,6 +39,9 @@ void SceneNode::load(Common::SeekableReadStream *f) { UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) { _category = CAT_NONE; _screenObjectsCount = 0; + + byte *pData = _vm->_screen.getBasePtr(0, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); + setPixels(pData, MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); } void UserInterface::load(const Common::String &resName) { @@ -61,7 +64,6 @@ void UserInterface::load(const Common::String &resName) { delete palStream; // set the size for the interface - setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1); pixelsStream->read(getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); delete pixelsStream; @@ -84,7 +86,6 @@ void UserInterface::setup(int id) { resName += "A"; resName += ".INT"; - free(); load(resName); } scene._screenObjects._v832EC = id; |