diff options
-rw-r--r-- | engines/kyra/graphics/screen.cpp | 21 | ||||
-rw-r--r-- | engines/kyra/graphics/screen.h | 3 | ||||
-rw-r--r-- | engines/kyra/graphics/screen_eob.cpp | 1 |
3 files changed, 12 insertions, 13 deletions
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp index c7d16ff1e6..d1ed281061 100644 --- a/engines/kyra/graphics/screen.cpp +++ b/engines/kyra/graphics/screen.cpp @@ -93,6 +93,8 @@ Screen::~Screen() { delete[] _16bitPalette; delete[] _16bitConversionPalette; + _sjisFontShared.reset(); + for (uint i = 0; i < _palettes.size(); ++i) delete _palettes[i]; @@ -168,24 +170,19 @@ bool Screen::init() { } if (_useSJIS) { - Common::SharedPtr<Graphics::FontSJIS> font(Graphics::FontSJIS::createFont(_vm->gameFlags().platform)); - if (!font.get()) + _sjisFontShared = Common::SharedPtr<Graphics::FontSJIS>(Graphics::FontSJIS::createFont(_vm->gameFlags().platform)); + if (!_sjisFontShared.get()) error("Could not load any SJIS font, neither the original nor ScummVM's 'SJIS.FNT'"); - if (_use16ColorMode) { - _fonts[FID_SJIS_TEXTMODE_FNT] = new SJISFont(font, _sjisInvisibleColor, true, false, 0); - if (_vm->game() == GI_EOB1) { - int temp; - _fonts[FID_SJIS_FNT] = new SJISFontEoB1PC98(font, 12, _vm->staticres()->loadRawDataBe16(kEoB1Ascii2SjisTable1, temp), _vm->staticres()->loadRawDataBe16(kEoB1Ascii2SjisTable2, temp)); - } - } else { - _fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, false, _vm->game() != GI_LOL && _vm->game() != GI_EOB2, _vm->game() == GI_LOL ? 1 : 0); - } + if (_use16ColorMode) + _fonts[FID_SJIS_TEXTMODE_FNT] = new SJISFont(_sjisFontShared, _sjisInvisibleColor, true, false, 0); + else + _fonts[FID_SJIS_FNT] = new SJISFont(_sjisFontShared, _sjisInvisibleColor, false, _vm->game() != GI_LOL && _vm->game() != GI_EOB2, _vm->game() == GI_LOL ? 1 : 0); if (_vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns) { assert(_fonts[FID_SJIS_FNT]); _fonts[FID_SJIS_FNT]->setStyle(Font::kFSFat); - _fonts[FID_SJIS_LARGE_FNT] = new SJISFontLarge(font); + _fonts[FID_SJIS_LARGE_FNT] = new SJISFontLarge(_sjisFontShared); } } } diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h index 083409a6e6..b16c3951f0 100644 --- a/engines/kyra/graphics/screen.h +++ b/engines/kyra/graphics/screen.h @@ -605,7 +605,8 @@ protected: Common::RenderMode _renderMode; int _bytesPerPixel; int _screenPageSize; - + + Common::SharedPtr<Graphics::FontSJIS> _sjisFontShared; uint8 _sjisInvisibleColor; bool _sjisMixedFontMode; diff --git a/engines/kyra/graphics/screen_eob.cpp b/engines/kyra/graphics/screen_eob.cpp index 6a639eede7..3ba1ca35d7 100644 --- a/engines/kyra/graphics/screen_eob.cpp +++ b/engines/kyra/graphics/screen_eob.cpp @@ -95,6 +95,7 @@ bool Screen_EoB::init() { loadFont(FID_SJIS_SMALL_FNT, "FONT.DMP"); } else if (_vm->game() == GI_EOB1 && _vm->gameFlags().platform == Common::kPlatformPC98) { loadFont(FID_SJIS_SMALL_FNT, "FONT12.FNT"); + _fonts[FID_SJIS_FNT] = new SJISFontEoB1PC98(_sjisFontShared, 12, _vm->staticres()->loadRawDataBe16(kEoB1Ascii2SjisTable1, temp), _vm->staticres()->loadRawDataBe16(kEoB1Ascii2SjisTable2, temp)); } if (_vm->gameFlags().useHiRes && _renderMode == Common::kRenderEGA) { |