diff options
author | Arnaud Boutonné | 2010-11-07 00:02:48 +0000 |
---|---|---|
committer | Arnaud Boutonné | 2010-11-07 00:02:48 +0000 |
commit | a4cd83061eae135f17eefe15ee023817ec734250 (patch) | |
tree | 1d9b743baabf171c48e7b0fec46c1064c60f20bd /engines/hugo/display_v1d.cpp | |
parent | f5d2695800473fa44500dc3fdaa92f9fcff844b9 (diff) | |
download | scummvm-rg350-a4cd83061eae135f17eefe15ee023817ec734250.tar.gz scummvm-rg350-a4cd83061eae135f17eefe15ee023817ec734250.tar.bz2 scummvm-rg350-a4cd83061eae135f17eefe15ee023817ec734250.zip |
HUGO: Move fonts to display.cpp
Some cleanup
svn-id: r54103
Diffstat (limited to 'engines/hugo/display_v1d.cpp')
-rw-r--r-- | engines/hugo/display_v1d.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/engines/hugo/display_v1d.cpp b/engines/hugo/display_v1d.cpp index df5ea636c6..28c8e4407a 100644 --- a/engines/hugo/display_v1d.cpp +++ b/engines/hugo/display_v1d.cpp @@ -54,19 +54,19 @@ Screen_v1d::~Screen_v1d() { void Screen_v1d::loadFont(int16 fontId) { debugC(2, kDebugDisplay, "loadFont(%d)", fontId); - static bool fontLoadedFl[NUM_FONTS] = {false, false, false}; + assert(fontId < NUM_FONTS); _fnt = fontId - FIRST_FONT; // Set current font number - if (fontLoadedFl[_fnt]) // If already loaded, return + if (fontLoadedFl[_fnt]) // If already loaded, return return; fontLoadedFl[_fnt] = true; - memcpy(_fontdata[_fnt], _vm->_arrayFont[_fnt], _vm->_arrayFontSize[_fnt]); + memcpy(_fontdata[_fnt], _arrayFont[_fnt], _arrayFontSize[_fnt]); _font[_fnt][0] = _fontdata[_fnt]; // Store height,width of fonts - int16 offset = 2; // Start at fontdata[2] ([0],[1] used for height,width) + int16 offset = 2; // Start at fontdata[2] ([0],[1] used for height,width) // Setup the font array (127 characters) for (int i = 1; i < 128; i++) { @@ -81,5 +81,20 @@ void Screen_v1d::loadFont(int16 fontId) { offset += 2 + size; } } + +/** +* Load fonts from Hugo.dat +* These fonts are a workaround to avoid handling TTF fonts used by DOS versions +* TODO: Properly handle the vector based font files (win31) +*/ +void Screen_v1d::loadFontArr(Common::File &in) { + for (int i = 0; i < NUM_FONTS; i++) { + _arrayFontSize[i] = in.readUint16BE(); + _arrayFont[i] = (byte *)malloc(sizeof(byte) * _arrayFontSize[i]); + for (int j = 0; j < _arrayFontSize[i]; j++) { + _arrayFont[i][j] = in.readByte(); + } + } +} } // End of namespace Hugo |