[Scummvm-cvs-logs] scummvm master -> 1ea96002b88c5d65a5f6b1e093c83d48a3c6cbbb
bluegr
md5 at scummvm.org
Sun May 29 20:14:29 CEST 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
1ea96002b8 SCI: Added a more generalized fix for bug #3306417
Commit: 1ea96002b88c5d65a5f6b1e093c83d48a3c6cbbb
https://github.com/scummvm/scummvm/commit/1ea96002b88c5d65a5f6b1e093c83d48a3c6cbbb
Author: md5 (md5 at scummvm.org)
Date: 2011-05-29T11:12:37-07:00
Commit Message:
SCI: Added a more generalized fix for bug #3306417
Changed paths:
engines/sci/engine/kgraphics.cpp
engines/sci/engine/kstring.cpp
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 75f8c25..6c96266 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -360,10 +360,29 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
} else
#endif
g_sci->_gfxText16->kernelTextSize(g_sci->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
-
+
+ // One of the game texts in LB2 German contains loads of spaces in
+ // its end. We trim the text here, otherwise the graphics code will
+ // attempt to draw a very large window (larger than the screen) to
+ // show the text, and crash.
+ // Fixes bug #3306417.
+ if (textWidth >= g_sci->_gfxScreen->getDisplayWidth() ||
+ textHeight >= g_sci->_gfxScreen->getDisplayHeight()) {
+ // TODO: Is this needed for SCI32 as well?
+ if (g_sci->_gfxText16) {
+ warning("kTextSize: string would be too big to fit on screen. Trimming it");
+ text.trim();
+ // Copy over the trimmed string...
+ s->_segMan->strcpy(argv[1], text.c_str());
+ // ...and recalculate bounding box dimensions
+ g_sci->_gfxText16->kernelTextSize(g_sci->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
+ }
+ }
+
debugC(kDebugLevelStrings, "GetTextSize '%s' -> %dx%d", text.c_str(), textWidth, textHeight);
dest[2] = make_reg(0, textHeight);
dest[3] = make_reg(0, textWidth);
+
return s->r_acc;
}
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index add5b7b..c3c10bd 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -67,21 +67,6 @@ reg_t kStrCpy(EngineState *s, int argc, reg_t *argv) {
else
s->_segMan->memcpy(argv[0], argv[1], -length);
} else {
- if (g_sci->getGameId() == GID_LAURABOW2 && g_sci->getLanguage() == Common::DE_DEU &&
- s->currentRoomNumber() == 360) {
- // One of the game texts in LB2 German contains loads of spaces in
- // its end. We trim the text here, otherwise the graphics code will
- // attempt to draw a very large window (larger than the screen) to
- // show the text, and crash.
- // Fixes bug #3306417.
- SegmentRef src = s->_segMan->dereference(argv[1]);
- if (src.maxSize == 7992) { // the problematic resource. Trim it.
- Common::String text = s->_segMan->getString(argv[1]);
- text.trim();
- s->_segMan->strcpy(argv[1], text.c_str());
- }
- }
-
s->_segMan->strcpy(argv[0], argv[1]);
}
More information about the Scummvm-git-logs
mailing list