aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/newgui.cpp9
-rw-r--r--scumm/dialogs.cpp2
2 files changed, 8 insertions, 3 deletions
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index ed9d20fb16..d4edecc5a7 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -432,6 +432,7 @@ int NewGui::getCharWidth(char c)
void NewGui::drawString(const String &str, int x, int y, int w, int16 color, int align)
{
+ const int leftX = x, rightX = x + w;
int width = getStringWidth(str);
if (align == kTextAlignCenter)
x = x + (w - width - 1)/2;
@@ -439,8 +440,12 @@ void NewGui::drawString(const String &str, int x, int y, int w, int16 color, int
x = x + w - width;
for (int i = 0; i < str.size(); ++i) {
- drawChar(str[i], x, y, color);
- x += getCharWidth(str[i]);
+ w = getCharWidth(str[i]);
+ if (x+w > rightX)
+ break;
+ if (x >= leftX)
+ drawChar(str[i], x, y, color);
+ x += w;
}
}
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index a15f469a4e..092c693b82 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -316,7 +316,7 @@ enum {
SaveLoadDialog::SaveLoadDialog(NewGui *gui, Scumm *scumm)
: ScummDialog(gui, scumm, 30, 20, 260, 124)
{
- addResText(10, 7, 240, 16, 1);
+ addResText(0, 7, 260, 16, 1);
// addResText(10, 7, 240, 16, 2);
// addResText(10, 7, 240, 16, 3);