diff options
author | lukaslw | 2014-05-30 19:44:43 +0200 |
---|---|---|
committer | lukaslw | 2014-06-22 20:08:24 +0200 |
commit | 775944de6217c85d139e226a00ca700e81d4753d (patch) | |
tree | ce7d10f2c00c9f8d4d350c70057919ab1ef9549e | |
parent | a2b1f2fb7bac421074aee600f86900162be9c834 (diff) | |
download | scummvm-rg350-775944de6217c85d139e226a00ca700e81d4753d.tar.gz scummvm-rg350-775944de6217c85d139e226a00ca700e81d4753d.tar.bz2 scummvm-rg350-775944de6217c85d139e226a00ca700e81d4753d.zip |
PRINCE: clearBackAnimList function implementation
-rw-r--r-- | engines/prince/prince.cpp | 33 | ||||
-rw-r--r-- | engines/prince/prince.h | 2 |
2 files changed, 15 insertions, 20 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 859db8c3e3..74c9820e6a 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -115,15 +115,7 @@ PrinceEngine::~PrinceEngine() { } _objList.clear(); - for (uint i = 0; i < _backAnimList.size(); i++) { - int anims = _backAnimList[i]._seq._anims != 0 ? _backAnimList[i]._seq._anims : 1; - for (int j = 0; j < anims; j++) { - delete _backAnimList[i].backAnims[j]._animData; - delete _backAnimList[i].backAnims[j]._shadowData; - } - _backAnimList[i].backAnims.clear(); - } - _backAnimList.clear(); + clearBackAnimList(); for (uint i = 0; i < _mainHero->_moveSet.size(); i++) { delete _mainHero->_moveSet[i]; @@ -328,16 +320,7 @@ bool PrinceEngine::loadLocation(uint16 locationNr) { _mainHero->setShadowScale(_script->getShadowScale(_locationNr)); _room->loadRoom(_script->getRoomOffset(_locationNr)); - for (uint i = 0; i < _backAnimList.size(); i++) { - int anims = _backAnimList[i]._seq._anims != 0 ? _backAnimList[i]._seq._anims : 1; - for (int j = 0; j < anims; j++) { - delete _backAnimList[i].backAnims[j]._animData; - delete _backAnimList[i].backAnims[j]._shadowData; - } - _backAnimList[i].backAnims.clear(); - } - _backAnimList.clear(); - + clearBackAnimList(); _script->installBackAnims(_backAnimList, _room->_backAnim); _graph->makeShadowTable(70, _graph->_shadowTable70); @@ -919,6 +902,18 @@ void PrinceEngine::showBackAnims() { } } +void PrinceEngine::clearBackAnimList() { + for (uint i = 0; i < _backAnimList.size(); i++) { + int anims = _backAnimList[i]._seq._anims != 0 ? _backAnimList[i]._seq._anims : 1; + for (int j = 0; j < anims; j++) { + delete _backAnimList[i].backAnims[j]._animData; + delete _backAnimList[i].backAnims[j]._shadowData; + } + _backAnimList[i].backAnims.clear(); + } + _backAnimList.clear(); +} + void PrinceEngine::drawScreen() { const Graphics::Surface *roomSurface = _roomBmp->getSurface(); if (roomSurface) { diff --git a/engines/prince/prince.h b/engines/prince/prince.h index 034255290b..5a32f8e580 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -201,7 +201,6 @@ public: Image::BitmapDecoder *_roomBmp; Common::Array<AnimListItem> _animList; - //Common::Array<Anim> _backAnimList; Common::Array<BackgroundAnim> _backAnimList; Common::RandomSource _randomSource; @@ -223,6 +222,7 @@ private: void init(); void showLogo(); void showBackAnims(); + void clearBackAnimList(); bool spriteCheck(Graphics::Surface *backAnimSurface, int destX, int destY); void showSprite(Graphics::Surface *backAnimSurface, int destX, int destY); void showSpriteShadow(Graphics::Surface *shadowSurface, int destX, int destY); |