From 739047f887e9fef53c89ecf76de8809e7ae6809f Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sun, 22 Jan 2017 19:01:02 -0600 Subject: SCI32: Always reinit GfxText32 statics on game startup Fixes bad scaling of text when switching between games with different script resolutions. --- engines/sci/graphics/frameout.cpp | 1 + engines/sci/graphics/text32.cpp | 11 +++++------ engines/sci/graphics/text32.h | 5 +++++ 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'engines/sci/graphics') diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 464b28a2ba..5f96a8e1c9 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -117,6 +117,7 @@ void GfxFrameout::run() { CelObj::init(); Plane::init(); ScreenItem::init(); + GfxText32::init(); // NOTE: This happens in SCI::InitPlane in the actual engine, // and is a background fill plane to ensure hidden planes diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp index c6360010d3..a017a2fcc5 100644 --- a/engines/sci/graphics/text32.cpp +++ b/engines/sci/graphics/text32.cpp @@ -50,14 +50,13 @@ GfxText32::GfxText32(SegManager *segMan, GfxCache *fonts) : _bitmap(NULL_REG) { _fontId = kSci32SystemFont; _font = _cache->getFont(kSci32SystemFont); - - if (_xResolution == 0) { - // initialize the statics - _xResolution = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth; - _yResolution = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight; - } } +void GfxText32::init() { + _xResolution = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth; + _yResolution = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight; +} + reg_t GfxText32::createFontBitmap(int16 width, int16 height, const Common::Rect &rect, const Common::String &text, const uint8 foreColor, const uint8 backColor, const uint8 skipColor, const GuiResourceId fontId, const TextAlign alignment, const int16 borderColor, const bool dimmed, const bool doScaling, const bool gc) { _borderColor = borderColor; diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h index 722af34339..bfd5ebc606 100644 --- a/engines/sci/graphics/text32.h +++ b/engines/sci/graphics/text32.h @@ -152,6 +152,11 @@ private: public: GfxText32(SegManager *segMan, GfxCache *fonts); + /** + * Initialises static GfxText32 members. + */ + static void init(); + /** * The memory handle of the currently active bitmap. */ -- cgit v1.2.3