aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb
diff options
context:
space:
mode:
authorEugene Sandulenko2019-07-06 16:40:19 +0200
committerEugene Sandulenko2019-09-03 17:17:14 +0200
commit6559b7181900e8b174d92ff9b32759495c566bfb (patch)
treec0757d309a42b0919b75973cf17278459d35d8fc /engines/hdb
parentcdf8d2548fc06b52e42019ae719d675f6a576f33 (diff)
downloadscummvm-rg350-6559b7181900e8b174d92ff9b32759495c566bfb.tar.gz
scummvm-rg350-6559b7181900e8b174d92ff9b32759495c566bfb.tar.bz2
scummvm-rg350-6559b7181900e8b174d92ff9b32759495c566bfb.zip
HDB: Fix removeBGTileAnimation() and removeFGTileAnimation() implementations
Diffstat (limited to 'engines/hdb')
-rw-r--r--engines/hdb/map.cpp82
1 files changed, 34 insertions, 48 deletions
diff --git a/engines/hdb/map.cpp b/engines/hdb/map.cpp
index be1cfe6632..b6e6774665 100644
--- a/engines/hdb/map.cpp
+++ b/engines/hdb/map.cpp
@@ -984,61 +984,47 @@ void Map::addFGTileAnimation(int x, int y) {
}
void Map::removeBGTileAnimation(int x, int y) {
- int i = y * _width + x;
+ uint idx = y * _width + x;
- Tile *tile = g_hdb->_gfx->getTile(_background[i]);
- if (!tile)
- return;
- uint32 flags = tile->_flags;
+ for (uint i = 0; i < _listBGAnimFast.size(); i++)
+ if (_listBGAnimFast[i] == idx) {
+ _listBGAnimFast.remove_at(i);
+ return;
+ }
- if (flags & kFlagAnimFast) {
- for (Common::Array<uint32>::iterator it = _listBGAnimFast.begin(); it!=_listBGAnimFast.end(); it++)
- if ((uint)i == (*it)) {
- _listBGAnimFast.erase(it);
- break;
- }
- } else if (flags & kFlagAnimSlow) {
- for (Common::Array<uint32>::iterator it = _listBGAnimSlow.begin(); it != _listBGAnimSlow.end(); it++)
- if ((uint)i == (*it)) {
- _listBGAnimSlow.erase(it);
- break;
- }
- } else if (flags & kFlagAnimMedium) {
- for (Common::Array<uint32>::iterator it = _listBGAnimMedium.begin(); it != _listBGAnimMedium.end(); it++)
- if ((uint)i == (*it)) {
- _listBGAnimMedium.erase(it);
- break;
- }
- }
+ for (uint i = 0; i < _listBGAnimSlow.size(); i++)
+ if (_listBGAnimSlow[i] == idx) {
+ _listBGAnimSlow.remove_at(i);
+ return;
+ }
+
+ for (uint i = 0; i < _listBGAnimMedium.size(); i++)
+ if (_listBGAnimMedium[i] == idx) {
+ _listBGAnimMedium.remove_at(i);
+ return;
+ }
}
void Map::removeFGTileAnimation(int x, int y) {
- int i = y * _width + x;
+ uint idx = y * _width + x;
- Tile *tile = g_hdb->_gfx->getTile(_foreground[i]);
- if (!tile)
- return;
- uint32 flags = tile->_flags;
+ for (uint i = 0; i < _listFGAnimFast.size(); i++)
+ if (_listFGAnimFast[i] == idx) {
+ _listFGAnimFast.remove_at(i);
+ return;
+ }
- if (flags & kFlagAnimFast) {
- for (Common::Array<uint32>::iterator it = _listFGAnimFast.begin(); it!=_listFGAnimFast.end(); it++)
- if ((uint)i == (*it)) {
- _listFGAnimFast.erase(it);
- break;
- }
- } else if (flags & kFlagAnimSlow) {
- for (Common::Array<uint32>::iterator it = _listFGAnimSlow.begin(); it != _listFGAnimSlow.end(); it++)
- if ((uint)i == (*it)) {
- _listFGAnimSlow.erase(it);
- break;
- }
- } else if (flags & kFlagAnimMedium) {
- for (Common::Array<uint32>::iterator it = _listFGAnimMedium.begin(); it != _listFGAnimMedium.end(); it++)
- if ((uint)i == (*it)) {
- _listFGAnimMedium.erase(it);
- break;
- }
- }
+ for (uint i = 0; i < _listFGAnimSlow.size(); i++)
+ if (_listFGAnimSlow[i] == idx) {
+ _listFGAnimSlow.remove_at(i);
+ return;
+ }
+
+ for (uint i = 0; i < _listFGAnimMedium.size(); i++)
+ if (_listFGAnimMedium[i] == idx) {
+ _listFGAnimMedium.remove_at(i);
+ return;
+ }
}
void Map::getMapXY(int *x, int *y) {