aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/callables_ns.cpp10
-rw-r--r--engines/parallaction/exec_br.cpp6
-rw-r--r--engines/parallaction/graphics.cpp86
-rw-r--r--engines/parallaction/graphics.h20
-rw-r--r--engines/parallaction/gui_ns.cpp194
-rw-r--r--engines/parallaction/objects.cpp2
-rw-r--r--engines/parallaction/objects.h2
-rw-r--r--engines/parallaction/parallaction.h2
-rw-r--r--engines/parallaction/parallaction_br.cpp6
-rw-r--r--engines/parallaction/parallaction_ns.cpp8
10 files changed, 234 insertions, 102 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp
index 65df3c4903..6cad03db35 100644
--- a/engines/parallaction/callables_ns.cpp
+++ b/engines/parallaction/callables_ns.cpp
@@ -409,12 +409,12 @@ void Parallaction_ns::_c_testResult(void *parm) {
parseLocation("common");
- uint id[2];
- id[0] = _gfx->createLabel(_menuFont, _location._slideText[0].c_str(), 1);
- id[1] = _gfx->createLabel(_menuFont, _location._slideText[1].c_str(), 1);
+ GfxObj *labels[2];
+ labels[0] = _gfx->createLabel(_menuFont, _location._slideText[0].c_str(), 1);
+ labels[1] = _gfx->createLabel(_menuFont, _location._slideText[1].c_str(), 1);
- _gfx->showLabel(id[0], CENTER_LABEL_HORIZONTAL, 38);
- _gfx->showLabel(id[1], CENTER_LABEL_HORIZONTAL, 58);
+ _gfx->showLabel(labels[0], CENTER_LABEL_HORIZONTAL, 38);
+ _gfx->showLabel(labels[1], CENTER_LABEL_HORIZONTAL, 58);
return;
}
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index ec9f846459..d5d89616d2 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -96,7 +96,7 @@ void Parallaction_br::setupSubtitles(char *s, char *s2, int y) {
_subtitle[1] = _gfx->createLabel(_labelFont, s2, color);
_gfx->showLabel(_subtitle[1], CENTER_LABEL_HORIZONTAL, _subtitleY + 5 + _labelFont->height());
} else {
- _subtitle[1] = -1;
+ _subtitle[1] = 0;
}
#if 0 // disabled because no references to lip sync has been found in the scripts
_subtitleLipSync = 0;
@@ -104,11 +104,11 @@ void Parallaction_br::setupSubtitles(char *s, char *s2, int y) {
}
void Parallaction_br::clearSubtitles() {
- if (_subtitle[0] != -1) {
+ if (_subtitle[0]) {
_gfx->hideLabel(_subtitle[0]);
}
- if (_subtitle[1] != -1) {
+ if (_subtitle[1]) {
_gfx->hideLabel(_subtitle[1]);
}
}
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index d5e798572d..bcafd4eb6d 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -524,7 +524,7 @@ void setupLabelSurface(Graphics::Surface &surf, uint w, uint h) {
surf.fillRect(Common::Rect(w,h), LABEL_TRANSPARENT_COLOR);
}
-uint Gfx::renderFloatingLabel(Font *font, char *text) {
+GfxObj *Gfx::renderFloatingLabel(Font *font, char *text) {
Graphics::Surface *cnv = new Graphics::Surface;
@@ -555,34 +555,32 @@ uint Gfx::renderFloatingLabel(Font *font, char *text) {
obj->transparentKey = LABEL_TRANSPARENT_COLOR;
obj->layer = LAYER_FOREGROUND;
- uint id = _labels.size();
- _labels.insert_at(id, obj);
-
- return id;
+ return obj;
}
-void Gfx::showFloatingLabel(uint label) {
- assert(label < _labels.size());
-
+void Gfx::showFloatingLabel(GfxObj *label) {
hideFloatingLabel();
- _labels[label]->x = -1000;
- _labels[label]->y = -1000;
- _labels[label]->setFlags(kGfxObjVisible);
-
- _floatingLabel = label;
+ if (label) {
+ label->x = -1000;
+ label->y = -1000;
+ label->setFlags(kGfxObjVisible);
+
+ _floatingLabel = label;
+ _labels.push_back(label);
+ }
}
void Gfx::hideFloatingLabel() {
- if (_floatingLabel != NO_FLOATING_LABEL) {
- _labels[_floatingLabel]->clearFlags(kGfxObjVisible);
+ if (_floatingLabel != 0) {
+ _floatingLabel->clearFlags(kGfxObjVisible);
}
- _floatingLabel = NO_FLOATING_LABEL;
+ _floatingLabel = 0;
}
void Gfx::updateFloatingLabel() {
- if (_floatingLabel == NO_FLOATING_LABEL) {
+ if (_floatingLabel == 0) {
return;
}
@@ -596,7 +594,7 @@ void Gfx::updateFloatingLabel() {
} *traits;
Common::Rect r;
- _labels[_floatingLabel]->getRect(0, r);
+ _floatingLabel->getRect(0, r);
if (_gameType == GType_Nippon) {
FloatingLabelTraits traits_NS = {
@@ -619,14 +617,14 @@ void Gfx::updateFloatingLabel() {
_vm->_input->getCursorPos(cursor);
Common::Point offset = (_vm->_input->_activeItem._id) ? traits->_offsetWithItem : traits->_offsetWithoutItem;
- _labels[_floatingLabel]->x = CLIP(cursor.x + offset.x, traits->_minX, traits->_maxX);
- _labels[_floatingLabel]->y = CLIP(cursor.y + offset.y, traits->_minY, traits->_maxY);
+ _floatingLabel->x = CLIP(cursor.x + offset.x, traits->_minX, traits->_maxX);
+ _floatingLabel->y = CLIP(cursor.y + offset.y, traits->_minY, traits->_maxY);
}
-uint Gfx::createLabel(Font *font, const char *text, byte color) {
+GfxObj *Gfx::createLabel(Font *font, const char *text, byte color) {
Graphics::Surface *cnv = new Graphics::Surface;
uint w, h;
@@ -652,19 +650,18 @@ uint Gfx::createLabel(Font *font, const char *text, byte color) {
obj->transparentKey = LABEL_TRANSPARENT_COLOR;
obj->layer = LAYER_FOREGROUND;
- int id = _labels.size();
-
- _labels.insert_at(id, obj);
-
- return id;
+ return obj;
}
-void Gfx::showLabel(uint id, int16 x, int16 y) {
- assert(id < _labels.size());
- _labels[id]->setFlags(kGfxObjVisible);
+void Gfx::showLabel(GfxObj *label, int16 x, int16 y) {
+ if (!label) {
+ return;
+ }
+
+ label->setFlags(kGfxObjVisible);
Common::Rect r;
- _labels[id]->getRect(0, r);
+ label->getRect(0, r);
if (x == CENTER_LABEL_HORIZONTAL) {
x = CLIP<int16>((_backgroundInfo->width - r.width()) / 2, 0, _backgroundInfo->width/2);
@@ -674,23 +671,32 @@ void Gfx::showLabel(uint id, int16 x, int16 y) {
y = CLIP<int16>((_vm->_screenHeight - r.height()) / 2, 0, _vm->_screenHeight/2);
}
- _labels[id]->x = x;
- _labels[id]->y = y;
+ label->x = x;
+ label->y = y;
+
+ _labels.push_back(label);
}
-void Gfx::hideLabel(uint id) {
- assert(id < _labels.size());
- _labels[id]->clearFlags(kGfxObjVisible);
+void Gfx::hideLabel(GfxObj *label) {
+ if (label) {
+ label->clearFlags(kGfxObjVisible);
+ unregisterLabel(label);
+ }
}
void Gfx::freeLabels() {
- for (uint i = 0; i < _labels.size(); i++) {
- delete _labels[i];
- }
_labels.clear();
- _floatingLabel = NO_FLOATING_LABEL;
+ _floatingLabel = 0;
}
+void Gfx::unregisterLabel(GfxObj *label) {
+ for (uint i = 0; i < _labels.size(); i++) {
+ if (_labels[i] == label) {
+ _labels.remove_at(i);
+ break;
+ }
+ }
+}
void Gfx::copyRect(const Common::Rect &r, Graphics::Surface &src, Graphics::Surface &dst) {
@@ -724,7 +730,7 @@ Gfx::Gfx(Parallaction* vm) :
setPalette(_palette);
- _floatingLabel = NO_FLOATING_LABEL;
+ _floatingLabel = 0;
_backgroundInfo = 0;
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index ba71656945..f4bccf3c44 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -444,14 +444,15 @@ public:
void unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor);
// labels
- void showFloatingLabel(uint label);
+ void showFloatingLabel(GfxObj *label);
void hideFloatingLabel();
- uint renderFloatingLabel(Font *font, char *text);
- uint createLabel(Font *font, const char *text, byte color);
- void showLabel(uint id, int16 x, int16 y);
- void hideLabel(uint id);
+ GfxObj *renderFloatingLabel(Font *font, char *text);
+ GfxObj *createLabel(Font *font, const char *text, byte color);
+ void showLabel(GfxObj *label, int16 x, int16 y);
+ void hideLabel(GfxObj *label);
void freeLabels();
+ void unregisterLabel(GfxObj *label);
// dialogue handling
GfxObj* registerBalloon(Frames *frames, const char *text);
@@ -528,11 +529,18 @@ protected:
void scroll();
#define NO_FLOATING_LABEL 1000
+ struct Label {
+ Common::String _text;
+ int _x, _y;
+ int color;
+ bool _floating;
+ };
+
GfxObjArray _labels;
GfxObjArray _balloons;
GfxObjArray _items;
- uint _floatingLabel;
+ GfxObj *_floatingLabel;
// overlay mode enables drawing of graphics with automatic screen-to-game coordinate translation
bool _overlayMode;
diff --git a/engines/parallaction/gui_ns.cpp b/engines/parallaction/gui_ns.cpp
index dc87d63b44..50bbc3f3fc 100644
--- a/engines/parallaction/gui_ns.cpp
+++ b/engines/parallaction/gui_ns.cpp
@@ -107,6 +107,7 @@ class ChooseLanguageInputState_NS : public MenuInputState {
bool _allowChoice;
Common::String _nextState;
+ GfxObj *_label;
static const Common::Rect _dosLanguageSelectBlocks[4];
static const Common::Rect _amigaLanguageSelectBlocks[4];
const Common::Rect *_blocks;
@@ -135,9 +136,20 @@ public:
_blocks = _dosLanguageSelectBlocks;
}
+ _label = 0;
_language = -1;
_allowChoice = true;
}
+
+ ~ChooseLanguageInputState_NS() {
+ destroyLabels();
+ }
+
+ void destroyLabels() {
+ _vm->_gfx->unregisterLabel(_label);
+ delete _label;
+ _label = 0;
+ }
virtual MenuInputState* run() {
if (!_allowChoice) {
@@ -157,7 +169,7 @@ public:
if (_blocks[i].contains(p)) {
_vm->setInternLanguage(i);
_vm->beep();
- _vm->_gfx->freeLabels();
+ destroyLabels();
return _helper->getState(_nextState);
}
}
@@ -175,8 +187,8 @@ public:
// user can choose language in this version
_vm->showSlide("lingua");
- uint id = _vm->_gfx->createLabel(_vm->_introFont, "SELECT LANGUAGE", 1);
- _vm->_gfx->showLabel(id, 60, 30);
+ _label = _vm->_gfx->createLabel(_vm->_introFont, "SELECT LANGUAGE", 1);
+ _vm->_gfx->showLabel(_label, 60, 30);
_vm->_input->setArrowCursor();
}
@@ -201,7 +213,7 @@ class SelectGameInputState_NS : public MenuInputState {
int _choice, _oldChoice;
Common::String _nextState[2];
- uint _labels[2];
+ GfxObj *_labels[2];
Parallaction *_vm;
@@ -215,6 +227,22 @@ public:
_nextState[0] = "newgame";
_nextState[1] = "loadgame";
+
+ _labels[0] = 0;
+ _labels[1] = 0;
+ }
+
+ ~SelectGameInputState_NS() {
+ destroyLabels();
+ }
+
+ void destroyLabels() {
+ _vm->_gfx->unregisterLabel(_labels[0]);
+ _vm->_gfx->unregisterLabel(_labels[1]);
+ delete _labels[0];
+ delete _labels[1];
+ _labels[0] = 0;
+ _labels[1] = 0;
}
@@ -222,7 +250,7 @@ public:
int event = _vm->_input->getLastButtonEvent();
if (event == kMouseLeftUp) {
- _vm->_gfx->freeLabels();
+ destroyLabels();
return _helper->getState(_nextState[_choice]);
}
@@ -293,10 +321,19 @@ public:
class NewGameInputState_NS : public MenuInputState {
Parallaction_ns *_vm;
+ GfxObj *_labels[4];
static const char *introMsg3[4];
public:
NewGameInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("newgame", helper), _vm(vm) {
+ _labels[0] = 0;
+ _labels[1] = 0;
+ _labels[2] = 0;
+ _labels[3] = 0;
+ }
+
+ ~NewGameInputState_NS() {
+ destroyLabels();
}
virtual MenuInputState* run() {
@@ -304,7 +341,7 @@ public:
if (event == kMouseLeftUp || event == kMouseRightUp) {
_vm->_input->setMouseState(MOUSE_ENABLED_SHOW);
- _vm->_gfx->freeLabels();
+ destroyLabels();
if (event == kMouseLeftUp) {
_vm->scheduleLocationSwitch("fogne.dough");
@@ -317,19 +354,33 @@ public:
return this;
}
+ void destroyLabels() {
+ _vm->_gfx->unregisterLabel(_labels[0]);
+ _vm->_gfx->unregisterLabel(_labels[1]);
+ _vm->_gfx->unregisterLabel(_labels[2]);
+ _vm->_gfx->unregisterLabel(_labels[3]);
+ delete _labels[0];
+ delete _labels[1];
+ delete _labels[2];
+ delete _labels[3];
+ _labels[0] = 0;
+ _labels[1] = 0;
+ _labels[2] = 0;
+ _labels[3] = 0;
+ }
+
virtual void enter() {
_vm->changeBackground("test");
_vm->_input->setMouseState(MOUSE_ENABLED_HIDE);
- uint id[4];
- id[0] = _vm->_gfx->createLabel(_vm->_menuFont, introMsg3[0], 1);
- id[1] = _vm->_gfx->createLabel(_vm->_menuFont, introMsg3[1], 1);
- id[2] = _vm->_gfx->createLabel(_vm->_menuFont, introMsg3[2], 1);
- id[3] = _vm->_gfx->createLabel(_vm->_menuFont, introMsg3[3], 1);
- _vm->_gfx->showLabel(id[0], CENTER_LABEL_HORIZONTAL, 50);
- _vm->_gfx->showLabel(id[1], CENTER_LABEL_HORIZONTAL, 70);
- _vm->_gfx->showLabel(id[2], CENTER_LABEL_HORIZONTAL, 100);
- _vm->_gfx->showLabel(id[3], CENTER_LABEL_HORIZONTAL, 120);
+ _labels[0] = _vm->_gfx->createLabel(_vm->_menuFont, introMsg3[0], 1);
+ _labels[1] = _vm->_gfx->createLabel(_vm->_menuFont, introMsg3[1], 1);
+ _labels[2] = _vm->_gfx->createLabel(_vm->_menuFont, introMsg3[2], 1);
+ _labels[3] = _vm->_gfx->createLabel(_vm->_menuFont, introMsg3[3], 1);
+ _vm->_gfx->showLabel(_labels[0], CENTER_LABEL_HORIZONTAL, 50);
+ _vm->_gfx->showLabel(_labels[1], CENTER_LABEL_HORIZONTAL, 70);
+ _vm->_gfx->showLabel(_labels[2], CENTER_LABEL_HORIZONTAL, 100);
+ _vm->_gfx->showLabel(_labels[3], CENTER_LABEL_HORIZONTAL, 120);
}
};
@@ -402,7 +453,7 @@ class SelectCharacterInputState_NS : public MenuInputState {
Graphics::Surface _block;
Graphics::Surface _emptySlots;
- uint _labels[2];
+ GfxObj *_labels[2];
uint _len;
uint32 _startTime;
@@ -427,11 +478,24 @@ public:
SelectCharacterInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("selectcharacter", helper), _vm(vm) {
_keys = (_vm->getPlatform() == Common::kPlatformAmiga && (_vm->getFeatures() & GF_LANG_MULT)) ? _amigaKeys : _pcKeys;
_block.create(BLOCK_WIDTH, BLOCK_HEIGHT, 1);
+ _labels[0] = 0;
+ _labels[1] = 0;
}
~SelectCharacterInputState_NS() {
_block.free();
_emptySlots.free();
+
+ destroyLabels();
+ }
+
+ void destroyLabels() {
+ _vm->_gfx->unregisterLabel(_labels[0]);
+ _vm->_gfx->unregisterLabel(_labels[1]);
+ delete _labels[0];
+ delete _labels[1];
+ _labels[0] = 0;
+ _labels[1] = 0;
}
void cleanup() {
@@ -490,7 +554,7 @@ public:
}
void success() {
- _vm->_gfx->freeLabels();
+ destroyLabels();
_vm->_gfx->setBlackPalette();
_emptySlots.free();
@@ -628,17 +692,34 @@ class ShowCreditsInputState_NS : public MenuInputState {
};
static const Credit _credits[6];
+ GfxObj *_labels[2];
public:
ShowCreditsInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("showcredits", helper), _vm(vm) {
+ _labels[0] = 0;
+ _labels[1] = 0;
+ }
+
+ ~ShowCreditsInputState_NS() {
+ destroyLabels();
+ }
+
+ void destroyLabels() {
+ _vm->_gfx->unregisterLabel(_labels[0]);
+ _vm->_gfx->unregisterLabel(_labels[1]);
+ delete _labels[0];
+ delete _labels[1];
+ _labels[0] = 0;
+ _labels[1] = 0;
}
void drawCurrentLabel() {
- uint id[2];
- id[0] = _vm->_gfx->createLabel(_vm->_menuFont, _credits[_current]._role, 1);
- id[1] = _vm->_gfx->createLabel(_vm->_menuFont, _credits[_current]._name, 1);
- _vm->_gfx->showLabel(id[0], CENTER_LABEL_HORIZONTAL, 80);
- _vm->_gfx->showLabel(id[1], CENTER_LABEL_HORIZONTAL, 100);
+ destroyLabels();
+
+ _labels[0] = _vm->_gfx->createLabel(_vm->_menuFont, _credits[_current]._role, 1);
+ _labels[1] = _vm->_gfx->createLabel(_vm->_menuFont, _credits[_current]._name, 1);
+ _vm->_gfx->showLabel(_labels[0], CENTER_LABEL_HORIZONTAL, 80);
+ _vm->_gfx->showLabel(_labels[1], CENTER_LABEL_HORIZONTAL, 100);
}
@@ -655,7 +736,7 @@ public:
if ((event == kMouseLeftUp) || (curTime - _startTime > 5500)) {
_current++;
_startTime = curTime;
- _vm->_gfx->freeLabels();
+ destroyLabels();
if (_current == 6) {
return _helper->getState("endintro");
@@ -685,10 +766,22 @@ const ShowCreditsInputState_NS::Credit ShowCreditsInputState_NS::_credits[6] = {
class EndIntroInputState_NS : public MenuInputState {
Parallaction_ns *_vm;
bool _isDemo;
+ GfxObj *_label;
public:
EndIntroInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("endintro", helper), _vm(vm) {
_isDemo = (_vm->getFeatures() & GF_DEMO) != 0;
+ _label = 0;
+ }
+
+ ~EndIntroInputState_NS() {
+ destroyLabels();
+ }
+
+ void destroyLabels() {
+ _vm->_gfx->unregisterLabel(_label);
+ delete _label;
+ _label = 0;
}
virtual MenuInputState* run() {
@@ -703,7 +796,7 @@ public:
return 0;
}
- _vm->_gfx->freeLabels();
+ destroyLabels();
_engineFlags &= ~kEngineBlockInput;
return _helper->getState("selectcharacter");
}
@@ -713,8 +806,8 @@ public:
if (!_isDemo) {
_vm->_soundManI->stopMusic();
- int label = _vm->_gfx->createLabel(_vm->_menuFont, "CLICK MOUSE BUTTON TO START", 1);
- _vm->_gfx->showLabel(label, CENTER_LABEL_HORIZONTAL, 80);
+ _label = _vm->_gfx->createLabel(_vm->_menuFont, "CLICK MOUSE BUTTON TO START", 1);
+ _vm->_gfx->showLabel(_label, CENTER_LABEL_HORIZONTAL, 80);
}
}
};
@@ -735,9 +828,31 @@ class EndPartInputState_NS : public MenuInputState {
static const char *endMsg6[4];
static const char *endMsg7[4];
+ GfxObj *_labels[4];
public:
EndPartInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("endpart", helper), _vm(vm) {
+ _labels[0] = 0;
+ _labels[1] = 0;
+ _labels[2] = 0;
+ _labels[3] = 0;
+ }
+
+ void destroyLabels() {
+ _vm->_gfx->unregisterLabel(_labels[0]);
+ _vm->_gfx->unregisterLabel(_labels[1]);
+ _vm->_gfx->unregisterLabel(_labels[2]);
+ _vm->_gfx->unregisterLabel(_labels[3]);
+
+ delete _labels[0];
+ delete _labels[1];
+ delete _labels[2];
+ delete _labels[3];
+
+ _labels[0] = 0;
+ _labels[1] = 0;
+ _labels[2] = 0;
+ _labels[3] = 0;
}
virtual MenuInputState* run() {
@@ -746,7 +861,7 @@ public:
return this;
}
- _vm->_gfx->freeLabels();
+ destroyLabels();
if (_allPartsComplete) {
_vm->scheduleLocationSwitch("estgrotta.drki");
@@ -763,23 +878,22 @@ public:
_vm->_input->setMouseState(MOUSE_DISABLED);
uint16 language = _vm->getInternLanguage();
- uint id[4];
if (_allPartsComplete) {
- id[0] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg4[language], 1);
- id[1] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg5[language], 1);
- id[2] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg6[language], 1);
- id[3] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg7[language], 1);
+ _labels[0] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg4[language], 1);
+ _labels[1] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg5[language], 1);
+ _labels[2] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg6[language], 1);
+ _labels[3] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg7[language], 1);
} else {
- id[0] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg0[language], 1);
- id[1] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg1[language], 1);
- id[2] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg2[language], 1);
- id[3] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg3[language], 1);
+ _labels[0] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg0[language], 1);
+ _labels[1] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg1[language], 1);
+ _labels[2] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg2[language], 1);
+ _labels[3] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg3[language], 1);
}
- _vm->_gfx->showLabel(id[0], CENTER_LABEL_HORIZONTAL, 70);
- _vm->_gfx->showLabel(id[1], CENTER_LABEL_HORIZONTAL, 100);
- _vm->_gfx->showLabel(id[2], CENTER_LABEL_HORIZONTAL, 130);
- _vm->_gfx->showLabel(id[3], CENTER_LABEL_HORIZONTAL, 160);
+ _vm->_gfx->showLabel(_labels[0], CENTER_LABEL_HORIZONTAL, 70);
+ _vm->_gfx->showLabel(_labels[1], CENTER_LABEL_HORIZONTAL, 100);
+ _vm->_gfx->showLabel(_labels[2], CENTER_LABEL_HORIZONTAL, 130);
+ _vm->_gfx->showLabel(_labels[3], CENTER_LABEL_HORIZONTAL, 160);
}
};
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index fe5b4a7302..acc6dad759 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -204,6 +204,8 @@ Zone::Zone() {
}
Zone::~Zone() {
+ _vm->_gfx->unregisterLabel(_label);
+ delete _label;
}
void Zone::translate(int16 x, int16 y) {
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index 6e4d4439bb..f84c930241 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -272,7 +272,7 @@ public:
uint32 _type;
uint32 _flags;
- uint _label;
+ GfxObj *_label;
TypeData u;
CommandList _commands;
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index befca63930..bc2ab77eba 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -547,7 +547,7 @@ public:
uint _subtitleLipSync;
#endif
int _subtitleY;
- int _subtitle[2];
+ GfxObj *_subtitle[2];
ZonePtr _activeZone2;
uint32 _zoneFlags[NUM_LOCATIONS][NUM_ZONES];
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index acfb3b583e..9fd46cc9af 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -87,8 +87,8 @@ Common::Error Parallaction_br::init() {
_part = -1;
- _subtitle[0] = -1;
- _subtitle[1] = -1;
+ _subtitle[0] = 0;
+ _subtitle[1] = 0;
memset(_zoneFlags, 0, sizeof(_zoneFlags));
@@ -226,7 +226,7 @@ void Parallaction_br::freeCharacter() {
void Parallaction_br::freeLocation(bool removeAll) {
// free open location stuff
clearSubtitles();
- _subtitle[0] = _subtitle[1] = -1;
+ _subtitle[0] = _subtitle[1] = 0;
_localFlagNames->clear();
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index 7c08e426a2..d2cbe86b57 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -340,6 +340,7 @@ void Parallaction_ns::changeLocation() {
_soundManI->playLocationMusic(location);
_input->stopHovering();
+ // this is still needed to remove the floatingLabel
_gfx->freeLabels();
_zoneTrap.reset();
@@ -355,12 +356,13 @@ void Parallaction_ns::changeLocation() {
if (locname.hasSlide()) {
showSlide(locname.slide());
- uint id = _gfx->createLabel(_menuFont, _location._slideText[0].c_str(), 1);
- _gfx->showLabel(id, CENTER_LABEL_HORIZONTAL, 14);
+ GfxObj *label = _gfx->createLabel(_menuFont, _location._slideText[0].c_str(), 1);
+ _gfx->showLabel(label, CENTER_LABEL_HORIZONTAL, 14);
_gfx->updateScreen();
_input->waitForButtonEvent(kMouseLeftUp);
- _gfx->freeLabels();
+ _gfx->unregisterLabel(label);
+ delete label;
}
if (locname.hasCharacter()) {