diff options
Diffstat (limited to 'engines/cryomni3d')
-rw-r--r-- | engines/cryomni3d/sprites.cpp | 12 | ||||
-rw-r--r-- | engines/cryomni3d/sprites.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/engines/cryomni3d/sprites.cpp b/engines/cryomni3d/sprites.cpp index b1c5f95b0e..df09afb24f 100644 --- a/engines/cryomni3d/sprites.cpp +++ b/engines/cryomni3d/sprites.cpp @@ -146,6 +146,18 @@ void Sprites::replaceSprite(unsigned int oldSpriteId, unsigned int newSpriteId) _cursors[oldSpriteId]->refCnt++; } +void Sprites::replaceSpriteColor(unsigned int spriteId, byte currentColor, byte newColor) { + MAP_ID(spriteId); + + byte *data = _cursors[spriteId]->_data; + unsigned int size = _cursors[spriteId]->_width * _cursors[spriteId]->_height; + for (; size > 0; size--, data++) { + if (*data == currentColor) { + *data = newColor; + } + } +} + unsigned int Sprites::getSpritesCount() const { if (_map) { return _map->size(); diff --git a/engines/cryomni3d/sprites.h b/engines/cryomni3d/sprites.h index 5721ea8532..bd4a8673db 100644 --- a/engines/cryomni3d/sprites.h +++ b/engines/cryomni3d/sprites.h @@ -52,6 +52,8 @@ public: unsigned int getSpritesCount() const; + void replaceSpriteColor(unsigned int spriteId, byte currentColor, byte newColor); + const Graphics::Surface &getSurface(unsigned int spriteId) const; const Graphics::Cursor &getCursor(unsigned int spriteId) const; |