diff options
author | Paul Gilbert | 2014-08-20 20:22:35 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-20 20:22:35 -0400 |
commit | 4e5eb04e47c96f98cdc6519ae79b908efc9888e7 (patch) | |
tree | 20df4603098f23f782e45348a9a3453014af67b0 /engines/access | |
parent | 5870b18e175b8beee29654978d711d94ad92ddf5 (diff) | |
download | scummvm-rg350-4e5eb04e47c96f98cdc6519ae79b908efc9888e7.tar.gz scummvm-rg350-4e5eb04e47c96f98cdc6519ae79b908efc9888e7.tar.bz2 scummvm-rg350-4e5eb04e47c96f98cdc6519ae79b908efc9888e7.zip |
ACCESS: Fix freeing player sprites when the scene changes
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/animation.cpp | 3 | ||||
-rw-r--r-- | engines/access/player.cpp | 6 | ||||
-rw-r--r-- | engines/access/room.cpp | 12 | ||||
-rw-r--r-- | engines/access/room.h | 2 | ||||
-rw-r--r-- | engines/access/scripts.cpp | 2 |
5 files changed, 12 insertions, 13 deletions
diff --git a/engines/access/animation.cpp b/engines/access/animation.cpp index d9a24e7a58..b286237bfb 100644 --- a/engines/access/animation.cpp +++ b/engines/access/animation.cpp @@ -293,9 +293,6 @@ void AnimationManager::freeAnimationData() { } void AnimationManager::clearTimers() { - for (uint i = 0; i < _animationTimers.size(); ++i) - delete _animationTimers[i]; - _animationTimers.clear(); } diff --git a/engines/access/player.cpp b/engines/access/player.cpp index 063aa76c56..e85b68a24d 100644 --- a/engines/access/player.cpp +++ b/engines/access/player.cpp @@ -155,8 +155,7 @@ void Player::load() { } void Player::loadSprites(const Common::String &name) { - delete _playerSprites1; - _playerSprites = nullptr; + freeSprites(); const byte *data = _vm->_files->loadFile(name); _playerSprites1 = new SpriteResource(_vm, data, _vm->_files->_filesize, @@ -164,7 +163,8 @@ void Player::loadSprites(const Common::String &name) { } void Player::freeSprites() { - delete _playerSprites; + delete _playerSprites1; + _playerSprites1 = nullptr; _playerSprites = nullptr; } diff --git a/engines/access/room.cpp b/engines/access/room.cpp index e7008c5ab7..f45ffe7afb 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -88,17 +88,17 @@ void Room::doRoom() { doCommands(); // DOROOMFLASHBACK jump point - if (_function == 1) { + if (_function == FN_CLEAR1) { clearRoom(); break; - } else if (_function == 2) { + } else if (_function == FN_CLEAR2) { clearRoom(); return; - } else if (_function == 3) { + } else if (_function == FN_RELOAD) { reloadRoom1(); reloadFlag = true; break; - } else if (_function == 4) { + } else if (_function == FN_BREAK) { break; } @@ -108,7 +108,7 @@ void Room::doRoom() { _function = 0; roomLoop(); - if (_function == 1) { + if (_function == FN_CLEAR1) { clearRoom(); break; } else { @@ -122,7 +122,7 @@ void Room::doRoom() { _function = 0; roomLoop(); - if (_function == 1) { + if (_function == FN_CLEAR1) { clearRoom(); break; } else { diff --git a/engines/access/room.h b/engines/access/room.h index c76bd7021b..9b3f922528 100644 --- a/engines/access/room.h +++ b/engines/access/room.h @@ -58,6 +58,8 @@ public: } }; +enum Function { FN_NONE = 0, FN_CLEAR1 = 1, FN_CLEAR2 = 2, FN_RELOAD = 3, FN_BREAK = 4 }; + class Room: public Manager { private: void roomLoop(); diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp index 70a8d6a7a9..f6879584f3 100644 --- a/engines/access/scripts.cpp +++ b/engines/access/scripts.cpp @@ -303,7 +303,7 @@ void Scripts::cmdNewRoom() { if (roomNumber != CURRENT_ROOM) _vm->_player->_roomNumber = roomNumber; - _vm->_room->_function = 1; + _vm->_room->_function = FN_CLEAR1; _vm->freeChar(); _vm->_converseMode = 0; cmdRetPos(); |