aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorColin Snover2017-02-07 15:27:15 -0600
committerColin Snover2017-04-22 19:25:20 -0500
commitede7976ede9121d52932b4b0780e6adc68f6e35d (patch)
tree09a5239e8bfc772544df05b8ea6d524c7195355f /engines/sci/engine
parentc6cf7215f0f620dc4a155ca79510a44db13370fc (diff)
downloadscummvm-rg350-ede7976ede9121d52932b4b0780e6adc68f6e35d.tar.gz
scummvm-rg350-ede7976ede9121d52932b4b0780e6adc68f6e35d.tar.bz2
scummvm-rg350-ede7976ede9121d52932b4b0780e6adc68f6e35d.zip
SCI32: Fix bad kPointSize implementation
Fixes text scaling gone mad in Phant2.
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kernel.h2
-rw-r--r--engines/sci/engine/kernel_tables.h8
-rw-r--r--engines/sci/engine/kgraphics32.cpp8
3 files changed, 7 insertions, 11 deletions
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 2b61a9e0d9..c648cd0323 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -651,7 +651,7 @@ reg_t kCelInfoGetPixel(EngineState *s, int argc, reg_t *argv);
reg_t kSetLanguage(EngineState *s, int argc, reg_t *argv);
reg_t kScrollWindow(EngineState *s, int argc, reg_t *argv);
-reg_t kSetFontHeight(EngineState *s, int argc, reg_t *argv);
+reg_t kPointSize(EngineState *s, int argc, reg_t *argv);
reg_t kSetFontRes(EngineState *s, int argc, reg_t *argv);
reg_t kFont(EngineState *s, int argc, reg_t *argv);
reg_t kAddLine(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 77f1aa134c..fd3f4bdb2d 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -369,7 +369,7 @@ static const SciKernelMapSubEntry kSave_subops[] = {
// version, subId, function-mapping, signature, workarounds
static const SciKernelMapSubEntry kFont_subops[] = {
- { SIG_SINCE_SCI21MID, 0, MAP_CALL(SetFontHeight), "i", NULL },
+ { SIG_SINCE_SCI21MID, 0, MAP_CALL(PointSize), "i", NULL },
{ SIG_SINCE_SCI21MID, 1, MAP_CALL(SetFontRes), "ii", NULL },
SCI_SUBOPENTRY_TERMINATOR
};
@@ -937,7 +937,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_DUMMY(InvertRect), SIG_THRU_SCI21EARLY, SIGFOR_ALL, "(.*)", NULL, NULL },
{ MAP_DUMMY(InputText), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_CALL(TextWidth), SIG_THRU_SCI21EARLY, SIGFOR_ALL, "ri", NULL, NULL },
- { MAP_DUMMY(PointSize), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_CALL(PointSize), SIG_THRU_SCI21EARLY, SIGFOR_ALL, "i", NULL, NULL },
// SCI2.1 Kernel Functions
{ "CheckCDisc", kCheckCD, SIG_SCI21EARLY, SIGFOR_ALL, "(i)", NULL, NULL },
@@ -1314,8 +1314,8 @@ static const char *const sci2_default_knames[] = {
/*0x86*/ "CheckIntegrity", // for debugging
/*0x87*/ "ObjectIntersect",
/*0x88*/ "MarkMemory", // for debugging
- /*0x89*/ "TextWidth", // for debugging(?), only in SCI2, not used in any SCI2 game
- /*0x8a*/ "PointSize", // for debugging(?), only in SCI2, not used in any SCI2 game
+ /*0x89*/ "TextWidth",
+ /*0x8a*/ "PointSize",
/*0x8b*/ "AddLine",
/*0x8c*/ "DeleteLine",
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index ae84e6b8a5..f332e17b29 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -608,13 +608,9 @@ reg_t kFont(EngineState *s, int argc, reg_t *argv) {
error("not supposed to call this");
}
-reg_t kSetFontHeight(EngineState *s, int argc, reg_t *argv) {
- // TODO: Setting font may have just been for side effect
- // of setting the fontHeight on the font manager, in
- // which case we could just get the font directly ourselves.
+reg_t kPointSize(EngineState *s, int argc, reg_t *argv) {
g_sci->_gfxText32->setFont(argv[0].toUint16());
- g_sci->_gfxText32->_yResolution = (g_sci->_gfxText32->_font->getHeight() * g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight + g_sci->_gfxText32->_yResolution - 1) / g_sci->_gfxText32->_yResolution;
- return make_reg(0, g_sci->_gfxText32->_yResolution);
+ return make_reg(0, g_sci->_gfxText32->getScaledFontHeight());
}
reg_t kSetFontRes(EngineState *s, int argc, reg_t *argv) {