Permalink
Browse files

WINTERMUTE: Add FoxTail text spacing hack

FoxTail fork of WME seems to have hard-coded modifications for getting inter-line and inter-character spaces smaller.
This implementation seems to be pixel-perfect to FoxTail.
  • Loading branch information...
lolbot-iichan committed Aug 26, 2018
1 parent db07aad commit 547a756710af5e0745ae6d6571e5be7b4a1d7fb2
@@ -28,6 +28,7 @@

#include "engines/wintermute/base/font/base_font_bitmap.h"
#include "engines/wintermute/utils/string_util.h"
#include "engines/wintermute/base/base_engine.h"
#include "engines/wintermute/base/base_parser.h"
#include "engines/wintermute/base/base_frame.h"
#include "engines/wintermute/base/gfx/base_surface.h"
@@ -56,6 +57,9 @@ BaseFontBitmap::BaseFontBitmap(BaseGame *inGame) : BaseFont(inGame) {
_fontextFix = false;
_freezable = false;
_wholeCell = false;
#ifdef ENABLE_FOXTAIL
_minimizeSpacing = BaseEngine::instance().getGameId() == "foxtail";
#endif
}


@@ -211,6 +215,11 @@ int BaseFontBitmap::textHeightDraw(const byte *text, int x, int y, int width, TT
startX += getCharWidth(str[i]);
}
y += _tileHeight;
#ifdef ENABLE_FOXTAIL
if (_minimizeSpacing) {
y -= 3;
}
#endif
last_end = end;
if (longLine) {
end--;
@@ -509,6 +518,11 @@ bool BaseFontBitmap::persist(BasePersistenceManager *persistMgr) {
persistMgr->getBytes(_widths, sizeof(_widths));
}

#ifdef ENABLE_FOXTAIL
if (!persistMgr->getIsSaving()) {
_minimizeSpacing = BaseEngine::instance().getGameId() == "foxtail";
}
#endif

persistMgr->transferBool(TMEMBER(_fontextFix));
persistMgr->transferBool(TMEMBER(_wholeCell));
@@ -523,6 +537,11 @@ int BaseFontBitmap::getCharWidth(byte index) {
if (_fontextFix) {
index--;
}
#ifdef ENABLE_FOXTAIL
if (_minimizeSpacing) {
return _widths[index] - 1;
}
#endif
return _widths[index];
}

@@ -58,6 +58,9 @@ class BaseFontBitmap : public BaseFont {
byte _widths[NUM_CHARACTERS];
BaseSubFrame *_subframe;
bool _wholeCell;
#ifdef ENABLE_FOXTAIL
bool _minimizeSpacing;
#endif

int getCharWidth(byte index);
void drawChar(byte c, int x, int y);

0 comments on commit 547a756

Please sign in to comment.