aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJoseph-Eugene Winzer2017-08-23 03:25:48 +0200
committerThierry Crozat2018-01-23 01:47:01 +0000
commitb64248981b917f7772413b0dd1af46ff6fc78d89 (patch)
tree3c0865723c0f732113fdc74a42776ce04d0a6cb5 /engines
parent2c0518e0babfea3c2b656f58af98aa373d3bf684 (diff)
downloadscummvm-rg350-b64248981b917f7772413b0dd1af46ff6fc78d89.tar.gz
scummvm-rg350-b64248981b917f7772413b0dd1af46ff6fc78d89.tar.bz2
scummvm-rg350-b64248981b917f7772413b0dd1af46ff6fc78d89.zip
SUPERNOVA: Fixes too large edit() field
Before edit() cleared the input on screen by overdrawing it from x to the right side of the screen. This works fine for terminals but for example setting the watches alarm time it does not. The text font is 5x8 so overdrawing the max input length + 1 * 5 is sufficient to clear the screen from our input and the cursor. Also if the value ends up being too big it is clamped to the right side of the screen.
Diffstat (limited to 'engines')
-rw-r--r--engines/supernova/msn_def.h2
-rw-r--r--engines/supernova/state.cpp4
2 files changed, 5 insertions, 1 deletions
diff --git a/engines/supernova/msn_def.h b/engines/supernova/msn_def.h
index a8c76a49df..884b467350 100644
--- a/engines/supernova/msn_def.h
+++ b/engines/supernova/msn_def.h
@@ -27,6 +27,8 @@ namespace Supernova {
const int kScreenWidth = 320;
const int kScreenHeight = 200;
+const int kFontWidth = 5;
+const int kFontHeight = 8;
const int kTextSpeed[] = {19, 14, 10, 7, 4};
const int kMsecPerTick = 55;
diff --git a/engines/supernova/state.cpp b/engines/supernova/state.cpp
index 98230c2fb8..28ba850b60 100644
--- a/engines/supernova/state.cpp
+++ b/engines/supernova/state.cpp
@@ -980,12 +980,14 @@ void GameManager::animationOn() {
void GameManager::edit(Common::String &input, int x, int y, uint length) {
bool isEditing = true;
uint cursorIndex = input.size();
+ int overdrawWidth = ((length + 1) * kFontWidth > kScreenWidth - x) ?
+ kScreenWidth - x : (length + 1) * kFontWidth;
while (isEditing) {
_vm->_textCursorX = x;
_vm->_textCursorY = y;
_vm->_textColor = COL_EDIT;
- _vm->renderBox(x, y - 1, 320 - x, 10, HGR_EDIT);
+ _vm->renderBox(x, y - 1, overdrawWidth, 9, HGR_EDIT);
for (uint i = 0; i < input.size(); ++i) {
// Draw char highlight depending on cursor position
if (i == cursorIndex) {