From 775944de6217c85d139e226a00ca700e81d4753d Mon Sep 17 00:00:00 2001 From: lukaslw Date: Fri, 30 May 2014 19:44:43 +0200 Subject: PRINCE: clearBackAnimList function implementation --- engines/prince/prince.cpp | 33 ++++++++++++++------------------- 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 _animList; - //Common::Array _backAnimList; Common::Array _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); -- cgit v1.2.3