aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorFilippos Karapetis2018-07-09 00:40:03 +0300
committerFilippos Karapetis2018-07-09 00:41:04 +0300
commitf5247457740142385e2d5de229dbe7d1bb57f02b (patch)
tree370c66400e0b1c947f697eb7dcc036b04c599f16 /engines/dreamweb
parentfc5261b0c4216885b3f4bb8db2df3fba3fcd8433 (diff)
downloadscummvm-rg350-f5247457740142385e2d5de229dbe7d1bb57f02b.tar.gz
scummvm-rg350-f5247457740142385e2d5de229dbe7d1bb57f02b.tar.bz2
scummvm-rg350-f5247457740142385e2d5de229dbe7d1bb57f02b.zip
DREAMWEB: Simplify the character kerning checks
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreamweb.cpp1
-rw-r--r--engines/dreamweb/dreamweb.h5
-rw-r--r--engines/dreamweb/keypad.cpp16
-rw-r--r--engines/dreamweb/print.cpp10
4 files changed, 11 insertions, 21 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index a10403c0e1..665e5b44de 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -91,7 +91,6 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
// misc variables
_speechCount = 0;
_charShift = 0;
- _kerning = 0;
_brightPalette = false;
_roomLoaded = 0;
_didZoom = 0;
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 0231f142d8..d34af40a05 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -316,7 +316,6 @@ public:
// misc variables
uint8 _speechCount;
uint16 _charShift;
- uint8 _kerning;
bool _brightPalette;
bool _copyProtection;
uint8 _roomLoaded;
@@ -647,10 +646,10 @@ public:
// from print.cpp
uint8 getNextWord(const GraphicsFile &charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount);
- void printChar(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
+ void printChar(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height, bool kerning = false);
void printChar(const GraphicsFile &charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
void printBoth(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar);
- uint8 printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered);
+ uint8 printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered, bool kerning = false);
uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
uint8 getNumber(const GraphicsFile &charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset);
uint8 kernChars(uint8 firstChar, uint8 secondChar, uint8 width);
diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp
index 50e452eb82..476e9b5fb7 100644
--- a/engines/dreamweb/keypad.cpp
+++ b/engines/dreamweb/keypad.cpp
@@ -440,18 +440,16 @@ void DreamWebEngine::showLeftPage() {
showFrame(_folderGraphics2, 0, y, 5, 0);
_lineSpacing = 8;
_charShift = 91;
- _kerning = 1;
uint8 pageIndex = _folderPage - 2;
const uint8 *string = getTextInFile1(pageIndex * 2);
y = 48;
for (uint i = 0; i < 2; ++i) {
uint8 lastChar;
do {
- lastChar = printDirect(&string, 2, &y, 140, false);
+ lastChar = printDirect(&string, 2, &y, 140, false, true);
y += _lineSpacing;
} while (lastChar != '\0');
}
- _kerning = 0;
_charShift = 0;
_lineSpacing = 10;
uint8 *bufferToSwap = workspace() + (48*kScreenwidth)+2;
@@ -473,18 +471,16 @@ void DreamWebEngine::showRightPage() {
showFrame(_folderGraphics2, 143, y, 2, 0);
_lineSpacing = 8;
- _kerning = 1;
uint8 pageIndex = _folderPage - 1;
const uint8 *string = getTextInFile1(pageIndex * 2);
y = 48;
for (uint i = 0; i < 2; ++i) {
uint8 lastChar;
do {
- lastChar = printDirect(&string, 152, &y, 140, false);
+ lastChar = printDirect(&string, 152, &y, 140, false, true);
y += _lineSpacing;
} while (lastChar != '\0');
}
- _kerning = 0;
_lineSpacing = 10;
}
@@ -848,17 +844,15 @@ void DreamWebEngine::diaryKeyN() {
void DreamWebEngine::showDiaryPage() {
showFrame(_diaryGraphics, kDiaryx, kDiaryy, 0, 0);
- _kerning = 1;
useTempCharset(&_diaryCharset);
_charShift = 91+91;
const uint8 *string = getTextInFile1(_diaryPage);
uint16 y = kDiaryy + 16;
- printDirect(&string, kDiaryx + 48, &y, 240, 240 & 1);
+ printDirect(&string, kDiaryx + 48, &y, 240, 240 & 1, true);
y = kDiaryy + 16;
- printDirect(&string, kDiaryx + 129, &y, 240, 240 & 1);
+ printDirect(&string, kDiaryx + 129, &y, 240, 240 & 1, true);
y = kDiaryy + 23;
- printDirect(&string, kDiaryx + 48, &y, 240, 240 & 1);
- _kerning = 0;
+ printDirect(&string, kDiaryx + 48, &y, 240, 240 & 1, true);
_charShift = 0;
useCharset1();
}
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp
index c119f284cc..b98d5dda67 100644
--- a/engines/dreamweb/print.cpp
+++ b/engines/dreamweb/print.cpp
@@ -60,7 +60,7 @@ uint8 DreamWebEngine::getNextWord(const GraphicsFile &charSet, const uint8 *stri
}
}
-void DreamWebEngine::printChar(const GraphicsFile &charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
+void DreamWebEngine::printChar(const GraphicsFile &charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height, bool kerning) {
// WORKAROUND: Some texts contain leftover tab characters, which will cause
// OOB memory access when showing a character, as all the printable ones are
// from 32 onwards. We compensate for that here by ignoring all the invalid
@@ -77,7 +77,7 @@ void DreamWebEngine::printChar(const GraphicsFile &charSet, uint16* x, uint16 y,
y -= 3;
uint16 tmp = c - 32 + _charShift;
showFrame(charSet, *x, y, tmp & 0x1ff, (tmp >> 8) & 0xfe, width, height);
- if (_kerning == 0)
+ if (!kerning)
*width = kernChars(c, nextChar, *width);
(*x) += *width;
}
@@ -130,7 +130,7 @@ uint8 DreamWebEngine::printDirect(const uint8* string, uint16 x, uint16 y, uint8
return printDirect(&string, x, &y, maxWidth, centered);
}
-uint8 DreamWebEngine::printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) {
+uint8 DreamWebEngine::printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered, bool kerning) {
_lastXPos = x;
const GraphicsFile &charSet = *_currentCharset;
while (true) {
@@ -211,7 +211,6 @@ uint16 DreamWebEngine::waitFrames() {
}
const char *DreamWebEngine::monPrint(const char *string) {
- _kerning = 1;
uint16 x = _monAdX;
const char *iterator = string;
bool done = false;
@@ -233,7 +232,7 @@ const char *DreamWebEngine::monPrint(const char *string) {
break;
}
c = modifyChar(c);
- printChar(_monitorCharset, &x, _monAdY, c, 0, NULL, NULL);
+ printChar(_monitorCharset, &x, _monAdY, c, 0, NULL, NULL, true);
_cursLocX = x;
_cursLocY = _monAdY;
_mainTimer = 1;
@@ -248,7 +247,6 @@ const char *DreamWebEngine::monPrint(const char *string) {
_cursLocX = _monAdX;
}
- _kerning = 0;
return iterator;
}