From 20a96733a5f982e427a9143ded14e2af418ac6df Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 8 Jul 2012 00:19:48 +0200 Subject: GOB: Add CMPFile::recolor() and ANIFile::recolor() --- engines/gob/anifile.cpp | 5 +++++ engines/gob/anifile.h | 3 +++ engines/gob/cmpfile.cpp | 5 +++++ engines/gob/cmpfile.h | 2 ++ 4 files changed, 15 insertions(+) diff --git a/engines/gob/anifile.cpp b/engines/gob/anifile.cpp index e6bf30f4d7..085ac800cd 100644 --- a/engines/gob/anifile.cpp +++ b/engines/gob/anifile.cpp @@ -289,4 +289,9 @@ void ANIFile::drawLayer(Surface &dest, uint16 layer, uint16 part, _layers[layer]->draw(dest, part, x, y, transp); } +void ANIFile::recolor(uint8 from, uint8 to) { + for (LayerArray::iterator l = _layers.begin(); l != _layers.end(); ++l) + (*l)->recolor(from, to); +} + } // End of namespace Gob diff --git a/engines/gob/anifile.h b/engines/gob/anifile.h index b6d9c735b5..c930aafc6b 100644 --- a/engines/gob/anifile.h +++ b/engines/gob/anifile.h @@ -92,6 +92,9 @@ public: /** Draw an animation frame. */ void draw(Surface &dest, uint16 animation, uint16 frame, int16 x, int16 y) const; + /** Recolor the animation sprites. */ + void recolor(uint8 from, uint8 to); + private: typedef Common::Array LayerArray; typedef Common::Array AnimationArray; diff --git a/engines/gob/cmpfile.cpp b/engines/gob/cmpfile.cpp index 1cd1375879..d304958f76 100644 --- a/engines/gob/cmpfile.cpp +++ b/engines/gob/cmpfile.cpp @@ -250,4 +250,9 @@ uint16 CMPFile::addSprite(uint16 left, uint16 top, uint16 right, uint16 bottom) return _coordinates->add(left, top, right, bottom); } +void CMPFile::recolor(uint8 from, uint8 to) { + if (_surface) + _surface->recolor(from, to); +} + } // End of namespace Gob diff --git a/engines/gob/cmpfile.h b/engines/gob/cmpfile.h index 2b669e4d38..9c858238af 100644 --- a/engines/gob/cmpfile.h +++ b/engines/gob/cmpfile.h @@ -70,6 +70,8 @@ public: uint16 addSprite(uint16 left, uint16 top, uint16 right, uint16 bottom); + void recolor(uint8 from, uint8 to); + private: GobEngine *_vm; -- cgit v1.2.3