From 6c1dc0c03bcdbfeeb3bf8be7285d43228f244846 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Wed, 24 Dec 2008 09:51:07 +0000 Subject: Simplified destructions of Balloon objects. svn-id: r35521 --- engines/parallaction/balloons.cpp | 17 ++++++----------- engines/parallaction/callables_ns.cpp | 4 +--- engines/parallaction/graphics.cpp | 15 +++++---------- engines/parallaction/graphics.h | 11 +++-------- engines/parallaction/parallaction.cpp | 2 +- 5 files changed, 16 insertions(+), 33 deletions(-) (limited to 'engines') diff --git a/engines/parallaction/balloons.cpp b/engines/parallaction/balloons.cpp index f46370849a..cb80ee75db 100644 --- a/engines/parallaction/balloons.cpp +++ b/engines/parallaction/balloons.cpp @@ -267,7 +267,7 @@ public: BalloonManager_ns(Gfx *gfx, Font *font); ~BalloonManager_ns(); - void freeBalloons(); + void reset(); int setLocationBalloon(const char *text, bool endGame); int setDialogueBalloon(const char *text, uint16 winding, TextColor textColor); int setSingleBalloon(const char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor); @@ -429,14 +429,11 @@ int BalloonManager_ns::hitTestDialogueBalloon(int x, int y) { return -1; } -void BalloonManager_ns::freeBalloons() { - _gfx->destroyBalloons(); - +void BalloonManager_ns::reset() { for (uint i = 0; i < _numBalloons; i++) { _intBalloons[i].obj = 0; - _intBalloons[i].surface = 0; // no need to delete surface, since it is done by destroyBalloons + _intBalloons[i].surface = 0; // no need to delete surface, since it is done by Gfx } - _numBalloons = 0; } @@ -566,7 +563,7 @@ public: BalloonManager_br(Disk *disk, Gfx *gfx, Font *font); ~BalloonManager_br(); - void freeBalloons(); + void reset(); int setLocationBalloon(const char *text, bool endGame); int setDialogueBalloon(const char *text, uint16 winding, TextColor textColor); int setSingleBalloon(const char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor); @@ -724,12 +721,10 @@ int BalloonManager_br::hitTestDialogueBalloon(int x, int y) { return -1; } -void BalloonManager_br::freeBalloons() { - _gfx->destroyBalloons(); - +void BalloonManager_br::reset() { for (uint i = 0; i < _numBalloons; i++) { _intBalloons[i].obj = 0; - _intBalloons[i].surface = 0; // no need to delete surface, since it is done by destroyBalloons + _intBalloons[i].surface = 0; // no need to delete surface, since it is done by Gfx } _numBalloons = 0; diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp index 70ea732b9a..b45a30c317 100644 --- a/engines/parallaction/callables_ns.cpp +++ b/engines/parallaction/callables_ns.cpp @@ -310,9 +310,7 @@ void Parallaction_ns::_c_endComment(void *param) { } _input->waitForButtonEvent(kMouseLeftUp); - _balloonMan->freeBalloons(); - - return; + _gfx->freeDialogueObjects(); } void Parallaction_ns::_c_frankenstein(void *parm) { diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 26360e3a64..c30eb837bf 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -768,22 +768,17 @@ GfxObj* Gfx::registerBalloon(Frames *frames, const char *text) { return obj; } -void Gfx::destroyBalloons() { +void Gfx::freeDialogueObjects() { + _items.clear(); + + _vm->_balloonMan->reset(); + for (uint i = 0; i < _balloons.size(); i++) { delete _balloons[i]; } _balloons.clear(); } -void Gfx::freeDialogueObjects() { - freeItems(); - _vm->_balloonMan->freeBalloons(); -} - -void Gfx::freeItems() { - _items.clear(); -} - void Gfx::setBackground(uint type, BackgroundInfo *info) { delete _backgroundInfo; _backgroundInfo = info; diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 856c43c360..daf54fda0f 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -483,7 +483,7 @@ public: virtual ~BalloonManager() { } - virtual void freeBalloons() = 0; + virtual void reset() = 0; virtual int setLocationBalloon(const char *text, bool endGame) = 0; virtual int setDialogueBalloon(const char *text, uint16 winding, TextColor textColor) = 0; virtual int setSingleBalloon(const char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor) = 0; @@ -525,16 +525,11 @@ public: void hideLabel(uint id); void freeLabels(); - // dialogue balloons + // dialogue handling GfxObj* registerBalloon(Frames *frames, const char *text); - void destroyBalloons(); - - void freeDialogueObjects(); - - // other items int setItem(GfxObj* obj, uint16 x, uint16 y, byte transparentColor = 0); void setItemFrame(uint item, uint16 f); - void freeItems(); + void freeDialogueObjects(); // background surface BackgroundInfo *_backgroundInfo; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 6d583cf966..cfadb9602e 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -384,7 +384,7 @@ void Parallaction::doLocationEnterTransition() { _gfx->updateScreen(); _input->waitForButtonEvent(kMouseLeftUp); - _balloonMan->freeBalloons(); + _gfx->freeDialogueObjects(); // fades maximum intensity palette towards approximation of main palette for (uint16 _si = 0; _si<6; _si++) { -- cgit v1.2.3