[Scummvm-cvs-logs] SF.net SVN: scummvm:[44904] scummvm/trunk
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sun Oct 11 13:28:43 CEST 2009
Revision: 44904
http://scummvm.svn.sourceforge.net/scummvm/?rev=44904&view=rev
Author: lordhoto
Date: 2009-10-11 11:28:43 +0000 (Sun, 11 Oct 2009)
Log Message:
-----------
Revert changes to graphics/sjis.h in r44709.
Modified Paths:
--------------
scummvm/trunk/engines/kyra/screen.cpp
scummvm/trunk/engines/kyra/screen.h
scummvm/trunk/graphics/sjis.h
Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp 2009-10-11 09:47:12 UTC (rev 44903)
+++ scummvm/trunk/engines/kyra/screen.cpp 2009-10-11 11:28:43 UTC (rev 44904)
@@ -102,7 +102,7 @@
if (!font)
error("Could not load any SJIS font, neither the original nor ScummVM's 'SJIS.FNT'");
- _fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, _use16ColorMode);
+ _fonts[FID_SJIS_FNT] = new SJISFont(this, font, _sjisInvisibleColor, _use16ColorMode, !_use16ColorMode);
}
}
@@ -1135,7 +1135,6 @@
int Screen::getCharWidth(uint16 c) const {
if (isSJISChar(c))
- // _charWidth does not apply to sjis (rom) fonts
return _fonts[FID_SJIS_FNT]->getCharWidth(c);
else
return _fonts[_currentFont]->getCharWidth(c) + _charWidth;
@@ -1169,10 +1168,6 @@
cmap[1] = color1;
setTextColor(cmap, 0, 1);
- /*FontId oldFont = FID_NUM;
- if (requiresSJISFont(str))
- oldFont = setFont(FID_SJIS_FNT);*/
-
const uint8 charHeightFnt = getFontHeight();
if (x < 0)
@@ -1207,9 +1202,6 @@
x += charWidth;
}
}
-
- /*if (oldFont != FID_NUM)
- setFont(oldFont);*/
}
bool Screen::isSJISChar(uint16 c) const {
@@ -1224,18 +1216,6 @@
return false;
}
-bool Screen::requiresSJISFont(const char *s) const {
- if (!_useSJIS)
- return false;
-
- while (*s) {
- if (isSJISChar(fetchChar(s)))
- return true;
- }
-
- return false;
-}
-
uint16 Screen::fetchChar(const char *&s) const {
if (_currentFont != FID_SJIS_FNT)
return (uint8)*s++;
@@ -3341,11 +3321,15 @@
memset(_chars, 0, sizeof(_chars));
}
-SJISFont::SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color)
- : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color) {
+SJISFont::SJISFont(Screen *s, Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize)
+ : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color), _screen(s) {
assert(_font);
- _font->enableOutline(!is16Color);
- _font->toggleCharSize(is16Color);
+
+ _font->enableOutline(outlineSize);
+
+ _sjisWidth = _font->getMaxFontWidth() >> 1;
+ _fontHeight = _font->getFontHeight() >> 1;
+ _asciiWidth = _font->getCharWidth('a');
}
void SJISFont::unload() {
@@ -3354,15 +3338,18 @@
}
int SJISFont::getHeight() const {
- return _font->getFontHeight() >> 1;
+ return _fontHeight;
}
int SJISFont::getWidth() const {
- return _font->getMaxFontWidth() >> 1;
+ return _sjisWidth;
}
int SJISFont::getCharWidth(uint16 c) const {
- return _font->getCharWidth(c) >> 1;
+ if (_screen->isSJISChar(c))
+ return _sjisWidth;
+ else
+ return _asciiWidth;
}
void SJISFont::setColorMap(const uint8 *src) {
Modified: scummvm/trunk/engines/kyra/screen.h
===================================================================
--- scummvm/trunk/engines/kyra/screen.h 2009-10-11 09:47:12 UTC (rev 44903)
+++ scummvm/trunk/engines/kyra/screen.h 2009-10-11 11:28:43 UTC (rev 44904)
@@ -44,6 +44,7 @@
typedef Common::Functor0<void> UpdateFunctor;
class KyraEngine_v1;
+class Screen;
struct ScreenDim {
uint16 sx;
@@ -176,7 +177,7 @@
*/
class SJISFont : public Font {
public:
- SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color);
+ SJISFont(Screen *s, Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize);
~SJISFont() { unload(); }
bool usesOverlay() const { return true; }
@@ -195,6 +196,10 @@
Graphics::FontSJIS *_font;
const uint8 _invisColor;
const bool _is16Color;
+
+ const Screen *_screen;
+ int _sjisWidth, _asciiWidth;
+ int _fontHeight;
};
/**
@@ -421,6 +426,8 @@
const ScreenDim *_curDim;
+ bool isSJISChar(uint16 ch) const;
+
// shape handling
uint8 *encodeShape(int x, int y, int w, int h, int flags);
@@ -492,8 +499,6 @@
void copyOverlayRegion(int x, int y, int x2, int y2, int w, int h, int srcPage, int dstPage);
// font/text specific
- bool isSJISChar(uint16 ch) const;
- bool requiresSJISFont(const char *s) const;
uint16 fetchChar(const char *&s) const;
void drawChar(uint16 c, int x, int y);
Modified: scummvm/trunk/graphics/sjis.h
===================================================================
--- scummvm/trunk/graphics/sjis.h 2009-10-11 09:47:12 UTC (rev 44903)
+++ scummvm/trunk/graphics/sjis.h 2009-10-11 11:28:43 UTC (rev 44904)
@@ -72,20 +72,13 @@
/**
* Enable outline drawing.
+ *
+ * After changing outline state, getFontHeight and getMaxFontWidth / getCharWidth might return
+ * different values!
*/
virtual void enableOutline(bool enable) {}
/**
- * Toggle values returned by getFontHeight and getMaxFontWidth / getCharWidth.
- * These methods have to return different values when emulating PC-98 text mode.
- * We cannot simply match this with enableOutline(), since there are situations
- * where outlines get disabled in graphic mode, too. In these admittedly rare
- * cases (Kyra 1: Brynn's note, Kyra 2: spell book) the values returned by
- * getFontHeight and getMaxFontWidth / getCharWidth have to remain the same.
- */
- virtual void toggleCharSize(bool textMode) {}
-
- /**
* Returns the height of the font.
*/
virtual uint getFontHeight() const = 0;
@@ -129,13 +122,12 @@
*/
class FontSJIS16x16 : public FontSJIS {
public:
- FontSJIS16x16() : _outlineEnabled(false), _pc98TextModeCharSize(false) {}
+ FontSJIS16x16() : _outlineEnabled(false) {}
void enableOutline(bool enable) { _outlineEnabled = enable; }
- void toggleCharSize(bool textMode) { _pc98TextModeCharSize = textMode; }
- uint getFontHeight() const { return _pc98TextModeCharSize ? 16 : 18; }
- uint getMaxFontWidth() const { return _pc98TextModeCharSize ? 16 : 18; }
+ uint getFontHeight() const { return _outlineEnabled ? 18 : 16; }
+ uint getMaxFontWidth() const { return _outlineEnabled ? 18 : 16; }
virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2) const;
@@ -148,7 +140,6 @@
protected:
bool _outlineEnabled;
- bool _pc98TextModeCharSize;
virtual const uint16 *getCharData(uint16 c) const = 0;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list