aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2002-12-25 21:57:01 +0000
committerMax Horn2002-12-25 21:57:01 +0000
commita782a22c4dce266aa53bba74e68483f4e48412d0 (patch)
treef0653e7d978c975bebada39fb4ecdc3a712a3bf5 /scumm
parent2d46b1e4d78482f5305c81bfdd9a354da1a9f49c (diff)
downloadscummvm-rg350-a782a22c4dce266aa53bba74e68483f4e48412d0.tar.gz
scummvm-rg350-a782a22c4dce266aa53bba74e68483f4e48412d0.tar.bz2
scummvm-rg350-a782a22c4dce266aa53bba74e68483f4e48412d0.zip
seperated classic & old256 rendered (now subclasses of CharsetRenderer)
svn-id: r6152
Diffstat (limited to 'scumm')
-rw-r--r--scumm/charset.cpp37
-rw-r--r--scumm/charset.h37
-rw-r--r--scumm/scummvm.cpp5
-rw-r--r--scumm/string.cpp7
4 files changed, 57 insertions, 29 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index 4701d2d234..8efd33ad47 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -39,23 +39,28 @@ byte *CharsetRenderer::getFontPtr(byte id)
}
// do spacing for variable width old-style font
-int CharsetRenderer::getSpacing(byte chr, byte *charset)
+int CharsetRendererClassic::getSpacing(byte chr, byte *charset)
{
int spacing = 0;
-
- if (_vm->_features & GF_OLD256) {
- spacing = *(charset - 11 + chr);
- } else {
- int offs = READ_LE_UINT32(charset + chr * 4 + 4);
- if (offs) {
- spacing = charset[offs];
- if (charset[offs + 2] >= 0x80) {
- spacing += charset[offs + 2] - 0x100;
- } else {
- spacing += charset[offs + 2];
- }
+
+ int offs = READ_LE_UINT32(charset + chr * 4 + 4);
+ if (offs) {
+ spacing = charset[offs];
+ if (charset[offs + 2] >= 0x80) {
+ spacing += charset[offs + 2] - 0x100;
+ } else {
+ spacing += charset[offs + 2];
}
}
+
+ return spacing;
+}
+
+int CharsetRendererOld256::getSpacing(byte chr, byte *charset)
+{
+ int spacing = 0;
+
+ spacing = *(charset - 11 + chr);
// FIXME - this fixes the inventory icons in Zak256/Indy3
// see bug #613109.
@@ -173,7 +178,7 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth)
}
-void CharsetRenderer::printCharOld(int chr)
+void CharsetRendererOld256::printChar(int chr)
{ // Indy3 / Zak256
VirtScreen *vs;
byte *char_ptr, *dest_ptr;
@@ -223,7 +228,7 @@ void CharsetRenderer::printCharOld(int chr)
}
-void CharsetRenderer::printChar(int chr)
+void CharsetRendererClassic::printChar(int chr)
{
int width, height;
int offsX, offsY;
@@ -339,7 +344,7 @@ void CharsetRenderer::printChar(int chr)
_top -= offsY;
}
-void CharsetRenderer::drawBits(VirtScreen *vs, byte *dst, byte *mask, int drawTop, int width, int height)
+void CharsetRendererClassic::drawBits(VirtScreen *vs, byte *dst, byte *mask, int drawTop, int width, int height)
{
byte maskmask;
int y, x;
diff --git a/scumm/charset.h b/scumm/charset.h
index 5c5e931737..98388fd471 100644
--- a/scumm/charset.h
+++ b/scumm/charset.h
@@ -54,18 +54,15 @@ protected:
byte _curId;
byte *_fontPtr;
- byte _bpp;
- byte *_charPtr;
-
- void drawBits(VirtScreen *vs, byte *dst, byte *mask, int drawTop, int width, int height);
byte *getFontPtr(byte id);
+ virtual int getSpacing(byte chr, byte *charset) = 0;
+
public:
CharsetRenderer(Scumm *vm) : _vm(vm) {}
- void printChar(int chr);
- void printCharOld(int chr);
- int getSpacing(byte chr, byte *charset);
+ virtual void printChar(int chr) = 0;
+
int getStringWidth(int a, byte *str);
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
@@ -76,4 +73,30 @@ public:
};
+class CharsetRendererClassic : public CharsetRenderer {
+protected:
+ byte _bpp;
+ byte *_charPtr;
+
+ int getSpacing(byte chr, byte *charset);
+ void drawBits(VirtScreen *vs, byte *dst, byte *mask, int drawTop, int width, int height);
+
+public:
+ CharsetRendererClassic(Scumm *vm) : CharsetRenderer(vm) {}
+
+ void printChar(int chr);
+};
+
+
+class CharsetRendererOld256 : public CharsetRenderer {
+protected:
+ int getSpacing(byte chr, byte *charset);
+
+public:
+ CharsetRendererOld256(Scumm *vm) : CharsetRenderer(vm) {}
+
+ void printChar(int chr);
+};
+
+
#endif
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 96f6ae426d..f2daa8af4d 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -1552,7 +1552,10 @@ void Scumm::mainRun()
void Scumm::launch()
{
- _charset = new CharsetRenderer(this);
+ if (_features & GF_OLD256)
+ _charset = new CharsetRendererOld256(this);
+ else
+ _charset = new CharsetRendererClassic(this);
gdi._vm = this;
diff --git a/scumm/string.cpp b/scumm/string.cpp
index 73dca4ba06..ece823c75d 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -243,7 +243,7 @@ void Scumm::CHARSET_1()
_charset->_left = _charset->_nextLeft;
_charset->_top = _charset->_nextTop;
if (_features & GF_OLD256) {
- _charset->printCharOld(c);
+ _charset->printChar(c);
} else if (_features & GF_AFTER_V6) {
if (!_noSubtitles || (_haveMsg != 0xFE && _haveMsg != 0xFF))
_charset->printChar(c);
@@ -526,10 +526,7 @@ void Scumm::drawString(int a)
if (_string[a].no_talk_anim == 0)
_charset->_blitAlso = true;
}
- if (_features & GF_OLD256)
- _charset->printCharOld(chr);
- else
- _charset->printChar(chr);
+ _charset->printChar(chr);
_charset->_blitAlso = false;
}
}