[Scummvm-git-logs] scummvm branch-2-5 -> fc116b114f24d397e756fbc6f5d0c40fdec7f168
eriktorbjorn
noreply at scummvm.org
Fri Dec 17 13:33:33 UTC 2021
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a046f9eb16 SHERLOCK: Fix glitches in Rose Tattoo save box
6ef69bf257 SHERLOCK: Process all pending keys at once in Rose Tattoo save dialog
fc116b114f SHERLOCK: Fix crash when using Delete key in Rose Tattoo save dialog
Commit: a046f9eb16cd1709cf9363331ce3e145fdabfc3c
https://github.com/scummvm/scummvm/commit/a046f9eb16cd1709cf9363331ce3e145fdabfc3c
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-12-17T14:31:36+01:00
Commit Message:
SHERLOCK: Fix glitches in Rose Tattoo save box
For instance, if you entered a letter like "g" and then erased it, there
would still be traces of it on screen. I've made the assumption that
subtracting 1 from the font height is wrong everywhere.
Changed paths:
engines/sherlock/tattoo/widget_files.cpp
diff --git a/engines/sherlock/tattoo/widget_files.cpp b/engines/sherlock/tattoo/widget_files.cpp
index b2518ff6f1..b2637f32d6 100644
--- a/engines/sherlock/tattoo/widget_files.cpp
+++ b/engines/sherlock/tattoo/widget_files.cpp
@@ -266,7 +266,7 @@ bool WidgetFiles::getFilename() {
if (isSlotEmpty(_selector)) {
index = 0;
- _surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.right - BUTTON_SIZE - 9, pt.y + _surface.fontHeight() - 1), TRANSPARENCY);
+ _surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.right - BUTTON_SIZE - 9, pt.y + _surface.fontHeight()), TRANSPARENCY);
filename = "";
} else {
index = filename.size();
@@ -324,7 +324,7 @@ bool WidgetFiles::getFilename() {
filename.setChar(' ', index);
}
- _surface.fillRect(Common::Rect(pt.x, pt.y, _surface.width() - BUTTON_SIZE - 9, pt.y + _surface.fontHeight() - 1), TRANSPARENCY);
+ _surface.fillRect(Common::Rect(pt.x, pt.y, _surface.width() - BUTTON_SIZE - 9, pt.y + _surface.fontHeight()), TRANSPARENCY);
_surface.writeString(filename.c_str() + index, pt, COMMAND_HIGHLIGHTED);
} else if ((keyState.keycode == Common::KEYCODE_LEFT && index > 0)
@@ -374,7 +374,7 @@ bool WidgetFiles::getFilename() {
} else if (keyState.keycode == Common::KEYCODE_DELETE) {
filename.deleteChar(index);
- _surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.right - BUTTON_SIZE - 9, pt.y + _surface.fontHeight() - 1), TRANSPARENCY);
+ _surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.right - BUTTON_SIZE - 9, pt.y + _surface.fontHeight()), TRANSPARENCY);
_surface.writeString(filename + index, pt, COMMAND_HIGHLIGHTED);
} else if (keyState.keycode == Common::KEYCODE_RETURN) {
@@ -394,7 +394,7 @@ bool WidgetFiles::getFilename() {
filename.setChar(keyState.ascii, index);
_surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.width() - BUTTON_SIZE - 9,
- pt.y + _surface.fontHeight() - 1), TRANSPARENCY);
+ pt.y + _surface.fontHeight()), TRANSPARENCY);
_surface.writeString(filename.c_str() + index, pt, COMMAND_HIGHLIGHTED);
pt.x += _surface.charWidth(keyState.ascii);
++index;
Commit: 6ef69bf257fb0a06c037ebb1133b5034df127ffc
https://github.com/scummvm/scummvm/commit/6ef69bf257fb0a06c037ebb1133b5034df127ffc
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-12-17T14:31:50+01:00
Commit Message:
SHERLOCK: Process all pending keys at once in Rose Tattoo save dialog
The event loop when entering save game description in Rose Tattoo runs
at the speed of the background animations, which is much slower than
ScummVM's keyboard repeat.
It was very easy to saturate the _pendingKeys queue, particularly when
erasing an old savegame description. Then you might have to wait for a
few seconds while it processed dozens of pending backspaces.
Now all pending keys are processed as quickly as possible.
Changed paths:
engines/sherlock/tattoo/widget_files.cpp
diff --git a/engines/sherlock/tattoo/widget_files.cpp b/engines/sherlock/tattoo/widget_files.cpp
index b2637f32d6..77f094ece4 100644
--- a/engines/sherlock/tattoo/widget_files.cpp
+++ b/engines/sherlock/tattoo/widget_files.cpp
@@ -313,91 +313,89 @@ bool WidgetFiles::getFilename() {
return false;
}
- Common::KeyState keyState = events.getKey();
- if (keyState.keycode == Common::KEYCODE_BACKSPACE && index > 0) {
- pt.x -= _surface.charWidth(filename[index - 1]);
- --index;
-
- if (insert) {
- filename.deleteChar(index);
- } else {
- filename.setChar(' ', index);
- }
-
- _surface.fillRect(Common::Rect(pt.x, pt.y, _surface.width() - BUTTON_SIZE - 9, pt.y + _surface.fontHeight()), TRANSPARENCY);
- _surface.writeString(filename.c_str() + index, pt, COMMAND_HIGHLIGHTED);
-
- } else if ((keyState.keycode == Common::KEYCODE_LEFT && index > 0)
- || (keyState.keycode == Common::KEYCODE_RIGHT && index < (int)filename.size() && pt.x < (_bounds.right - BUTTON_SIZE - 20))
- || (keyState.keycode == Common::KEYCODE_HOME && index > 0)
- || (keyState.keycode == Common::KEYCODE_END)) {
- _surface.fillRect(Common::Rect(pt.x, pt.y, pt.x + width, pt.y + _surface.fontHeight()), TRANSPARENCY);
- if (currentChar)
- _surface.writeString(charString, pt, COMMAND_HIGHLIGHTED);
-
- switch (keyState.keycode) {
- case Common::KEYCODE_LEFT:
+ while (events.kbHit()) {
+ Common::KeyState keyState = events.getKey();
+ if (keyState.keycode == Common::KEYCODE_BACKSPACE && index > 0) {
pt.x -= _surface.charWidth(filename[index - 1]);
--index;
- break;
-
- case Common::KEYCODE_RIGHT:
- pt.x += _surface.charWidth(filename[index]);
- ++index;
- break;
-
- case Common::KEYCODE_HOME:
- pt.x = _surface.stringWidth("00.") + _surface.widestChar() + 5;
- index = 0;
- break;
- case Common::KEYCODE_END:
- pt.x = _surface.stringWidth("00.") + _surface.stringWidth(filename) + _surface.widestChar() + 5;
- index = filename.size();
+ if (insert) {
+ filename.deleteChar(index);
+ } else {
+ filename.setChar(' ', index);
+ }
- while (filename[index - 1] == ' ' && index > 0) {
+ _surface.fillRect(Common::Rect(pt.x, pt.y, _surface.width() - BUTTON_SIZE - 9, pt.y + _surface.fontHeight()), TRANSPARENCY);
+ _surface.writeString(filename.c_str() + index, pt, COMMAND_HIGHLIGHTED);
+ } else if ((keyState.keycode == Common::KEYCODE_LEFT && index > 0)
+ || (keyState.keycode == Common::KEYCODE_RIGHT && index < (int)filename.size() && pt.x < (_bounds.right - BUTTON_SIZE - 20))
+ || (keyState.keycode == Common::KEYCODE_HOME && index > 0)
+ || (keyState.keycode == Common::KEYCODE_END)) {
+ _surface.fillRect(Common::Rect(pt.x, pt.y, pt.x + width, pt.y + _surface.fontHeight()), TRANSPARENCY);
+ if (currentChar)
+ _surface.writeString(charString, pt, COMMAND_HIGHLIGHTED);
+
+ switch (keyState.keycode) {
+ case Common::KEYCODE_LEFT:
pt.x -= _surface.charWidth(filename[index - 1]);
--index;
+ break;
+
+ case Common::KEYCODE_RIGHT:
+ pt.x += _surface.charWidth(filename[index]);
+ ++index;
+ break;
+
+ case Common::KEYCODE_HOME:
+ pt.x = _surface.stringWidth("00.") + _surface.widestChar() + 5;
+ index = 0;
+ break;
+
+ case Common::KEYCODE_END:
+ pt.x = _surface.stringWidth("00.") + _surface.stringWidth(filename) + _surface.widestChar() + 5;
+ index = filename.size();
+
+ while (filename[index - 1] == ' ' && index > 0) {
+ pt.x -= _surface.charWidth(filename[index - 1]);
+ --index;
+ }
+ break;
+
+ default:
+ break;
}
- break;
-
- default:
- break;
- }
- } else if (keyState.keycode == Common::KEYCODE_INSERT) {
- insert = !insert;
- if (insert)
- cursorColor = 192;
- else
- cursorColor = 200;
-
- } else if (keyState.keycode == Common::KEYCODE_DELETE) {
- filename.deleteChar(index);
-
- _surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.right - BUTTON_SIZE - 9, pt.y + _surface.fontHeight()), TRANSPARENCY);
- _surface.writeString(filename + index, pt, COMMAND_HIGHLIGHTED);
-
- } else if (keyState.keycode == Common::KEYCODE_RETURN) {
- done = 1;
-
- } else if (keyState.keycode == Common::KEYCODE_ESCAPE) {
- _selector = -1;
- render(RENDER_NAMES_AND_SCROLLBAR);
- done = -1;
- }
-
- if ((keyState.ascii >= ' ') && (keyState.ascii <= 'z') && (index < 50)) {
- if (pt.x + _surface.charWidth(keyState.ascii) < _surface.w - BUTTON_SIZE - 20) {
+ } else if (keyState.keycode == Common::KEYCODE_INSERT) {
+ insert = !insert;
if (insert)
- filename.insertChar(keyState.ascii, index);
+ cursorColor = 192;
else
- filename.setChar(keyState.ascii, index);
+ cursorColor = 200;
+ } else if (keyState.keycode == Common::KEYCODE_DELETE) {
+ filename.deleteChar(index);
- _surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.width() - BUTTON_SIZE - 9,
- pt.y + _surface.fontHeight()), TRANSPARENCY);
- _surface.writeString(filename.c_str() + index, pt, COMMAND_HIGHLIGHTED);
- pt.x += _surface.charWidth(keyState.ascii);
- ++index;
+ _surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.right - BUTTON_SIZE - 9, pt.y + _surface.fontHeight()), TRANSPARENCY);
+ _surface.writeString(filename + index, pt, COMMAND_HIGHLIGHTED);
+ } else if (keyState.keycode == Common::KEYCODE_RETURN) {
+ done = 1;
+ } else if (keyState.keycode == Common::KEYCODE_ESCAPE) {
+ _selector = -1;
+ render(RENDER_NAMES_AND_SCROLLBAR);
+ done = -1;
+ }
+
+ if ((keyState.ascii >= ' ') && (keyState.ascii <= 'z') && (index < 50)) {
+ if (pt.x + _surface.charWidth(keyState.ascii) < _surface.w - BUTTON_SIZE - 20) {
+ if (insert)
+ filename.insertChar(keyState.ascii, index);
+ else
+ filename.setChar(keyState.ascii, index);
+
+ _surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.width() - BUTTON_SIZE - 9,
+ pt.y + _surface.fontHeight()), TRANSPARENCY);
+ _surface.writeString(filename.c_str() + index, pt, COMMAND_HIGHLIGHTED);
+ pt.x += _surface.charWidth(keyState.ascii);
+ ++index;
+ }
}
}
} while (!done && !_vm->shouldQuit());
Commit: fc116b114f24d397e756fbc6f5d0c40fdec7f168
https://github.com/scummvm/scummvm/commit/fc116b114f24d397e756fbc6f5d0c40fdec7f168
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-12-17T14:32:00+01:00
Commit Message:
SHERLOCK: Fix crash when using Delete key in Rose Tattoo save dialog
Changed paths:
engines/sherlock/tattoo/widget_files.cpp
diff --git a/engines/sherlock/tattoo/widget_files.cpp b/engines/sherlock/tattoo/widget_files.cpp
index 77f094ece4..4499ff80ac 100644
--- a/engines/sherlock/tattoo/widget_files.cpp
+++ b/engines/sherlock/tattoo/widget_files.cpp
@@ -370,11 +370,11 @@ bool WidgetFiles::getFilename() {
cursorColor = 192;
else
cursorColor = 200;
- } else if (keyState.keycode == Common::KEYCODE_DELETE) {
+ } else if (keyState.keycode == Common::KEYCODE_DELETE && index < (int)filename.size()) {
filename.deleteChar(index);
_surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.right - BUTTON_SIZE - 9, pt.y + _surface.fontHeight()), TRANSPARENCY);
- _surface.writeString(filename + index, pt, COMMAND_HIGHLIGHTED);
+ _surface.writeString(Common::String(filename.c_str() + index), pt, COMMAND_HIGHLIGHTED);
} else if (keyState.keycode == Common::KEYCODE_RETURN) {
done = 1;
} else if (keyState.keycode == Common::KEYCODE_ESCAPE) {
More information about the Scummvm-git-logs
mailing list