diff options
author | Colin Snover | 2017-11-12 13:47:51 -0600 |
---|---|---|
committer | Eugene Sandulenko | 2017-11-18 22:35:12 +0100 |
commit | 0cc0b1932e7feb97b15810ed9748a55a20947763 (patch) | |
tree | 6ad3de78cc2ff5621911d37f679d74206bca0665 /engines/fullpipe/scene.cpp | |
parent | 8e0c53de180d2e0de613934f1dedbfd4aa5fdf7c (diff) | |
download | scummvm-rg350-0cc0b1932e7feb97b15810ed9748a55a20947763.tar.gz scummvm-rg350-0cc0b1932e7feb97b15810ed9748a55a20947763.tar.bz2 scummvm-rg350-0cc0b1932e7feb97b15810ed9748a55a20947763.zip |
FULLPIPE: Fix memory leaks, ownership issues, and endianness issues in graphics code
Diffstat (limited to 'engines/fullpipe/scene.cpp')
-rw-r--r-- | engines/fullpipe/scene.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 5e92c5f1eb..ee0e5e5c1f 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -129,7 +129,6 @@ Scene::Scene() { Scene::~Scene() { delete _soundList; delete _shadows; - delete _palette; // _faObjlist is not used @@ -216,10 +215,16 @@ bool Scene::load(MfcArchive &file) { Common::strlcpy(fname, _bgname.c_str(), 260); Common::strlcpy(strrchr(fname, '.') + 1, "col", 260); - MemoryObject *col = new MemoryObject(); + Common::ScopedPtr<MemoryObject> col(new MemoryObject()); col->loadFile(fname); - - _palette = col; + if (col->getDataSize()) { + assert(col->getDataSize() == 256 * sizeof(uint32)); + const byte *data = col->getData(); + for (int i = 0; i < 256; ++i) { + _palette.push_back(READ_LE_UINT32(data)); + data += sizeof(uint32); + } + } } Common::String shdname = genFileName(0, _sceneId, "shd"); @@ -670,8 +675,8 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) { if (!_picObjList.size() && !_bigPictureArray1Count) return; - if (_palette) { - g_fp->_globalPalette = _palette->_data; + if (_palette.size()) { + g_fp->_globalPalette = &_palette; } debugC(1, kDebugDrawing, "Scene::drawContent(>%d, <%d, %d)", minPri, maxPri, drawBg); |