diff options
author | Nicola Mettifogo | 2007-09-02 18:34:11 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-09-02 18:34:11 +0000 |
commit | 21e4f4f1760e204de6e8d0a413f8e8f8987dd083 (patch) | |
tree | 1902fcb1756b1226e05dc12a4bfabead8ba9215d /engines/parallaction/parallaction.cpp | |
parent | f1f324cee424cb97da1a14789db2806002ba3f6e (diff) | |
download | scummvm-rg350-21e4f4f1760e204de6e8d0a413f8e8f8987dd083.tar.gz scummvm-rg350-21e4f4f1760e204de6e8d0a413f8e8f8987dd083.tar.bz2 scummvm-rg350-21e4f4f1760e204de6e8d0a413f8e8f8987dd083.zip |
Simplified global label management and added subtitles for BRA.
svn-id: r28828
Diffstat (limited to 'engines/parallaction/parallaction.cpp')
-rw-r--r-- | engines/parallaction/parallaction.cpp | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index cab1658b29..7e5221d6ae 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -353,6 +353,31 @@ void Parallaction::runGame() { return; } +void Parallaction::showLabel(Label &label) { + label.resetPosition(); + _jDrawLabel = addJob(kJobDisplayLabel, (void*)&label, kPriority0); + _jEraseLabel = addJob(kJobEraseLabel, (void*)&label, kPriority20); +} + +void Parallaction::hideLabel(uint priority) { + + if (!_jDrawLabel) + return; + + removeJob(_jDrawLabel); + _jDrawLabel = 0; + + if (priority == kPriority99) { + // remove job immediately + removeJob(_jEraseLabel); + _jEraseLabel = 0; + } else { + // schedule job for deletion + addJob(kJobWaitRemoveJob, _jEraseLabel, priority); + } + +} + void Parallaction::processInput(InputData *data) { Zone *z; @@ -360,19 +385,12 @@ void Parallaction::processInput(InputData *data) { switch (data->_event) { case kEvEnterZone: debugC(2, kDebugInput, "processInput: kEvEnterZone"); - _gfx->_labelPosition[1].x = -1000; - _gfx->_labelPosition[1].y = -1000; - _gfx->_labelPosition[0].x = -1000; - _gfx->_labelPosition[0].y = -1000; - _jDrawLabel = addJob(kJobDisplayLabel, (void*)data->_label, kPriority0); - _jEraseLabel = addJob(kJobEraseLabel, (void*)data->_label, kPriority20); + showLabel(*data->_label); break; case kEvExitZone: debugC(2, kDebugInput, "processInput: kEvExitZone"); - removeJob(_jDrawLabel); - addJob(kJobWaitRemoveJob, _jEraseLabel, kPriority15); - _jDrawLabel = NULL; + hideLabel(kPriority15); break; case kEvAction: @@ -390,13 +408,10 @@ void Parallaction::processInput(InputData *data) { case kEvOpenInventory: _procCurrentHoverItem = -1; _hoverZone = NULL; - if (_jDrawLabel != 0) { - removeJob(_jDrawLabel); - _jDrawLabel = NULL; - addJob(kJobWaitRemoveJob, _jEraseLabel, kPriority2); + hideLabel(kPriority2); + if (hitZone(kZoneYou, _mousePos.x, _mousePos.y) == 0) { + changeCursor(kCursorArrow); } - if (hitZone(kZoneYou, _mousePos.x, _mousePos.y) == 0) - changeCursor(kCursorArrow); removeJob(_jRunScripts); _jDrawInventory = addJob(kJobShowInventory, 0, kPriority2); openInventory(); @@ -619,11 +634,7 @@ void Parallaction::changeCursor(int32 index) { debugC(1, kDebugInput, "changeCursor(%i), label: %p", index, (const void*)_jDrawLabel); - if (_jDrawLabel != NULL) { - removeJob(_jDrawLabel); - addJob(kJobWaitRemoveJob, _jEraseLabel, kPriority15 ); - _jDrawLabel = NULL; - } + hideLabel(kPriority15); _activeItem._id = 0; |