STARK: Add right-click dialog speech skipping

You can skip speech lines talked by game characters showed in dialogPanel with a mouse right-click
This commit is contained in:
Snejp 2018-04-07 22:03:31 +02:00 committed by Bastien Bouclet
parent fc49ef1af6
commit ce355587ba
2 changed files with 25 additions and 10 deletions

View File

@ -65,7 +65,19 @@ DialogPanel::DialogPanel(Gfx::Driver *gfx, Cursor *cursor) :
DialogPanel::~DialogPanel() {
clearOptions();
clearSubtitleVisual();
}
void DialogPanel::abortCurrentSpeech() {
if (_currentSpeech) {
_currentSpeech->stop();
_currentSpeech = nullptr;
}
}
void DialogPanel::clearSubtitleVisual() {
delete _subtitleVisual;
_subtitleVisual = nullptr;
}
void DialogPanel::clearOptions() {
@ -111,8 +123,7 @@ void DialogPanel::onRender() {
if (!_currentSpeech || !_currentSpeech->isPlaying()) {
_currentSpeech = nullptr;
delete _subtitleVisual;
_subtitleVisual = nullptr;
clearSubtitleVisual();
}
// Update the dialog engine
@ -145,7 +156,7 @@ void DialogPanel::onRender() {
}
void DialogPanel::updateSubtitleVisual() {
delete _subtitleVisual;
clearSubtitleVisual();
uint32 color = _otherColor;
if (_currentSpeech->characterIsApril())
@ -210,15 +221,16 @@ void DialogPanel::onClick(const Common::Point &pos) {
}
}
void DialogPanel::reset() {
if (_currentSpeech) {
_currentSpeech->stop();
_currentSpeech = nullptr;
void DialogPanel::onRightClick(const Common::Point &pos) {
if (_currentSpeech && _currentSpeech->isPlaying()) {
abortCurrentSpeech();
clearSubtitleVisual();
}
}
delete _subtitleVisual;
_subtitleVisual = nullptr;
void DialogPanel::reset() {
abortCurrentSpeech();
clearSubtitleVisual();
clearOptions();
StarkDialogPlayer->reset();

View File

@ -55,10 +55,12 @@ public:
protected:
void onMouseMove(const Common::Point &pos) override;
void onClick(const Common::Point &pos) override;
void onRightClick(const Common::Point &pos) override;
void onRender() override;
private:
void updateSubtitleVisual();
void clearSubtitleVisual();
void updateDialogOptions();
void clearOptions();
int getHoveredOption(const Common::Point &pos);
@ -79,6 +81,7 @@ private:
Common::Rect _scrollDownArrowRect;
Resources::Speech *_currentSpeech;
void abortCurrentSpeech();
uint32 _firstVisibleOption;
Common::Array<ClickText*> _options;