Fix bug 2969257 (labels) and hopefully plug all the leaks.
svn-id: r48811
This commit is contained in:
parent
7c26675ec1
commit
498d8000ca
10 changed files with 234 additions and 102 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,10 +136,21 @@ 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) {
|
||||
_vm->setInternLanguage(_language);
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -204,6 +204,8 @@ Zone::Zone() {
|
|||
}
|
||||
|
||||
Zone::~Zone() {
|
||||
_vm->_gfx->unregisterLabel(_label);
|
||||
delete _label;
|
||||
}
|
||||
|
||||
void Zone::translate(int16 x, int16 y) {
|
||||
|
|
|
@ -272,7 +272,7 @@ public:
|
|||
|
||||
uint32 _type;
|
||||
uint32 _flags;
|
||||
uint _label;
|
||||
GfxObj *_label;
|
||||
|
||||
TypeData u;
|
||||
CommandList _commands;
|
||||
|
|
|
@ -547,7 +547,7 @@ public:
|
|||
uint _subtitleLipSync;
|
||||
#endif
|
||||
int _subtitleY;
|
||||
int _subtitle[2];
|
||||
GfxObj *_subtitle[2];
|
||||
ZonePtr _activeZone2;
|
||||
uint32 _zoneFlags[NUM_LOCATIONS][NUM_ZONES];
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue