diff options
author | Nicola Mettifogo | 2009-01-12 13:14:09 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2009-01-12 13:14:09 +0000 |
commit | e5d75d1f7b8a677e4f4e5f5d5da8fff413265ed6 (patch) | |
tree | 54855c1f61d9e5f327b7fffd245a954185f17271 | |
parent | 5afb4ad1659242baaa91cc948d49dace21be6ae6 (diff) | |
download | scummvm-rg350-e5d75d1f7b8a677e4f4e5f5d5da8fff413265ed6.tar.gz scummvm-rg350-e5d75d1f7b8a677e4f4e5f5d5da8fff413265ed6.tar.bz2 scummvm-rg350-e5d75d1f7b8a677e4f4e5f5d5da8fff413265ed6.zip |
Fixed regression from revision 35765. Mask and path patches were destroyed before getting a chance to be used.
svn-id: r35835
-rw-r--r-- | engines/parallaction/gfxbase.cpp | 8 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 32 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 20 | ||||
-rw-r--r-- | engines/parallaction/parser_br.cpp | 4 |
4 files changed, 32 insertions, 32 deletions
diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp index 2c9039c275..9a3d204569 100644 --- a/engines/parallaction/gfxbase.cpp +++ b/engines/parallaction/gfxbase.cpp @@ -156,7 +156,7 @@ void Gfx::freeCharacterObjects() { clearGfxObjects(kGfxObjCharacter); } -void Gfx::loadGfxObjMask(const char *name, GfxObj *obj) { +void BackgroundInfo::loadGfxObjMask(const char *name, GfxObj *obj) { Common::Rect rect; obj->getRect(0, rect); @@ -164,11 +164,11 @@ void Gfx::loadGfxObjMask(const char *name, GfxObj *obj) { buf->create(rect.width(), rect.height()); _vm->_disk->loadMask(name, *buf); - obj->_maskId = _backgroundInfo->addMaskPatch(buf); + obj->_maskId = addMaskPatch(buf); obj->_hasMask = true; } -void Gfx::loadGfxObjPath(const char *name, GfxObj *obj) { +void BackgroundInfo::loadGfxObjPath(const char *name, GfxObj *obj) { Common::Rect rect; obj->getRect(0, rect); @@ -176,7 +176,7 @@ void Gfx::loadGfxObjPath(const char *name, GfxObj *obj) { buf->create(rect.width(), rect.height()); _vm->_disk->loadPath(name, *buf); - obj->_pathId = _backgroundInfo->addPathPatch(buf); + obj->_pathId = addPathPatch(buf); obj->_hasPath = true; } diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 118b4f5c93..42d6d39e84 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -843,9 +843,9 @@ bool BackgroundInfo::hasMask() { void BackgroundInfo::clearMaskData() { // free mask data - MaskPatchMap::iterator it = _maskPatches.begin(); + MaskPatches::iterator it = _maskPatches.begin(); for ( ; it != _maskPatches.end(); it++) { - delete (*it)._value; + delete *it; } _maskPatches.clear(); delete _mask; @@ -865,20 +865,20 @@ void BackgroundInfo::finalizeMask() { } } -int BackgroundInfo::addMaskPatch(MaskBuffer *patch) { - int id = _maskPatches.size(); - _maskPatches.setVal(id, patch); +uint BackgroundInfo::addMaskPatch(MaskBuffer *patch) { + uint id = _maskPatches.size(); + _maskPatches.push_back(patch); return id; } -void BackgroundInfo::toggleMaskPatch(int id, int x, int y, bool apply) { +void BackgroundInfo::toggleMaskPatch(uint id, int x, int y, bool apply) { if (!hasMask()) { return; } - if (!_maskPatches.contains(id)) { + if (id >= _maskPatches.size()) { return; } - MaskBuffer *patch = _maskPatches.getVal(id); + MaskBuffer *patch = _maskPatches[id]; if (apply) { _mask->bltOr(x, y, *patch, 0, 0, patch->w, patch->h); } else { @@ -904,9 +904,9 @@ bool BackgroundInfo::hasPath() { void BackgroundInfo::clearPathData() { // free mask data - PathPatchMap::iterator it = _pathPatches.begin(); + PathPatches::iterator it = _pathPatches.begin(); for ( ; it != _pathPatches.end(); it++) { - delete (*it)._value; + delete *it; } _pathPatches.clear(); delete _path; @@ -926,20 +926,20 @@ void BackgroundInfo::finalizePath() { } } -int BackgroundInfo::addPathPatch(PathBuffer *patch) { - int id = _pathPatches.size(); - _pathPatches.setVal(id, patch); +uint BackgroundInfo::addPathPatch(PathBuffer *patch) { + uint id = _pathPatches.size(); + _pathPatches.push_back(patch); return id; } -void BackgroundInfo::togglePathPatch(int id, int x, int y, bool apply) { +void BackgroundInfo::togglePathPatch(uint id, int x, int y, bool apply) { if (!hasPath()) { return; } - if (!_pathPatches.contains(id)) { + if (id >= _pathPatches.size()) { return; } - PathBuffer *patch = _pathPatches.getVal(id); + PathBuffer *patch = _pathPatches[id]; if (apply) { _path->bltOr(x, y, *patch, 0, 0, patch->w, patch->h); } else { diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 69e048ff15..e165f51da7 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -345,13 +345,13 @@ public: */ struct BackgroundInfo { protected: - typedef Common::HashMap<int, MaskBuffer*> MaskPatchMap; - MaskPatchMap _maskPatches; + typedef Common::Array<MaskBuffer*> MaskPatches; + MaskPatches _maskPatches; MaskBuffer _maskBackup; void clearMaskData(); - typedef Common::HashMap<int, PathBuffer*> PathPatchMap; - PathPatchMap _pathPatches; + typedef Common::Array<PathBuffer*> PathPatches; + PathPatches _pathPatches; PathBuffer _pathBackup; void clearPathData(); @@ -377,16 +377,18 @@ public: // mask management bool hasMask(); - int addMaskPatch(MaskBuffer *patch); - void toggleMaskPatch(int id, int x, int y, bool apply); + uint addMaskPatch(MaskBuffer *patch); + void toggleMaskPatch(uint id, int x, int y, bool apply); uint16 getMaskLayer(uint16 z) const; void finalizeMask(); + void loadGfxObjMask(const char *name, GfxObj *obj); // path management bool hasPath(); - int addPathPatch(PathBuffer *patch); - void togglePathPatch(int id, int x, int y, bool apply); + uint addPathPatch(PathBuffer *patch); + void togglePathPatch(uint id, int x, int y, bool apply); void finalizePath(); + void loadGfxObjPath(const char *name, GfxObj *obj); }; @@ -437,8 +439,6 @@ public: void freeLocationObjects(); void showGfxObj(GfxObj* obj, bool visible); void clearGfxObjects(uint filter); - void loadGfxObjMask(const char *name, GfxObj *obj); - void loadGfxObjPath(const char *name, GfxObj *obj); void sortScene(); void blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor); void unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor); diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp index 04ffb5c083..15f9d7a785 100644 --- a/engines/parallaction/parser_br.cpp +++ b/engines/parallaction/parser_br.cpp @@ -788,11 +788,11 @@ void LocationParser_br::parseGetData(ZonePtr z) { } if (!scumm_stricmp(_tokens[0], "mask")) { - _vm->_gfx->loadGfxObjMask(_tokens[1], data->gfxobj); + ctxt.info->loadGfxObjMask(_tokens[1], data->gfxobj); } if (!scumm_stricmp(_tokens[0], "path")) { - _vm->_gfx->loadGfxObjPath(_tokens[1], data->gfxobj); + ctxt.info->loadGfxObjPath(_tokens[1], data->gfxobj); } if (!scumm_stricmp(_tokens[0], "icon")) { |