aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorBastien Bouclet2017-07-22 16:28:53 +0200
committerBastien Bouclet2017-07-22 20:38:56 +0200
commit2597e69f29a4b603cbfc7d53d034a2a9d3405de4 (patch)
treeebd1802d6586fd68298db86a4fa2b9043566f6a6 /engines/mohawk
parent7ac1bd9a57782f0488327f4b0de36d79f44aaeeb (diff)
downloadscummvm-rg350-2597e69f29a4b603cbfc7d53d034a2a9d3405de4.tar.gz
scummvm-rg350-2597e69f29a4b603cbfc7d53d034a2a9d3405de4.tar.bz2
scummvm-rg350-2597e69f29a4b603cbfc7d53d034a2a9d3405de4.zip
MOHAWK: Myst: Fix Selenitic sound receiver buttons not flashing
The new screen update strategy does not allow scripts to draw twice at the same location for blinking.
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/myst_stacks/selenitic.cpp23
-rw-r--r--engines/mohawk/myst_stacks/selenitic.h1
2 files changed, 20 insertions, 4 deletions
diff --git a/engines/mohawk/myst_stacks/selenitic.cpp b/engines/mohawk/myst_stacks/selenitic.cpp
index 087143abfc..e9439047ff 100644
--- a/engines/mohawk/myst_stacks/selenitic.cpp
+++ b/engines/mohawk/myst_stacks/selenitic.cpp
@@ -44,6 +44,7 @@ Selenitic::Selenitic(MohawkEngine_Myst *vm) :
_soundReceiverDirection = 0;
_soundReceiverStartTime = 0;
+ _soundReceiverNearBlinkCounter = 0;
}
Selenitic::~Selenitic() {
@@ -990,13 +991,26 @@ uint16 Selenitic::soundReceiverCurrentSound(uint16 source, uint16 position) {
if (position == solution) {
soundId = soundIdGood;
} else if (position > solution && position <= solution + 50) {
- _soundReceiverLeftButton->drawConditionalDataToScreen(2);
- _soundReceiverLeftButton->drawConditionalDataToScreen(0);
+ _soundReceiverNearBlinkCounter++;
+ if (_soundReceiverNearBlinkCounter % 2) {
+ _soundReceiverLeftButton->drawConditionalDataToScreen(2);
+ } else {
+ _soundReceiverLeftButton->drawConditionalDataToScreen(0);
+ }
soundId = soundIdNear;
} else if (position < solution && position >= solution - 50) {
- _soundReceiverRightButton->drawConditionalDataToScreen(2);
- _soundReceiverRightButton->drawConditionalDataToScreen(0);
+ _soundReceiverNearBlinkCounter++;
+ if (_soundReceiverNearBlinkCounter % 2) {
+ _soundReceiverRightButton->drawConditionalDataToScreen(2);
+ } else {
+ _soundReceiverRightButton->drawConditionalDataToScreen(0);
+ }
soundId = soundIdNear;
+ } else if (_soundReceiverNearBlinkCounter > 0) {
+ // Make sure the buttons don't stay highlighted when leaving the 'near' area
+ _soundReceiverRightButton->drawConditionalDataToScreen(0);
+ _soundReceiverLeftButton->drawConditionalDataToScreen(0);
+ _soundReceiverNearBlinkCounter = 0;
}
}
@@ -1053,6 +1067,7 @@ void Selenitic::o_soundReceiver_init(uint16 var, const ArgumentsArray &args) {
soundReceiverSetSubimageRect();
_soundReceiverSigmaPressed = false;
+ _soundReceiverNearBlinkCounter = 0;
}
void Selenitic::o_soundLock_init(uint16 var, const ArgumentsArray &args) {
diff --git a/engines/mohawk/myst_stacks/selenitic.h b/engines/mohawk/myst_stacks/selenitic.h
index e0b4564bb9..341886d20b 100644
--- a/engines/mohawk/myst_stacks/selenitic.h
+++ b/engines/mohawk/myst_stacks/selenitic.h
@@ -86,6 +86,7 @@ private:
uint16 _soundReceiverDirection; // 120
uint16 _soundReceiverSpeed; // 122
uint32 _soundReceiverStartTime; //124
+ uint _soundReceiverNearBlinkCounter;
MystAreaImageSwitch *_soundReceiverViewer; // 128
MystAreaImageSwitch *_soundReceiverRightButton; // 132
MystAreaImageSwitch *_soundReceiverLeftButton; // 136