aboutsummaryrefslogtreecommitdiff
path: root/engines/cge/talk.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2013-04-18 23:35:23 +0200
committerWillem Jan Palenstijn2013-05-08 20:40:58 +0200
commit9c2341678ef4984bf92b3878295250faf980b066 (patch)
tree2fb4805e05e16b9924e80c9947e6bad723b28c4b /engines/cge/talk.cpp
parent8172d679df5148a4a32f46074b20cb6caf91844f (diff)
parenta5f4ff36ffc386d48f2da49387a9655ce9295a4d (diff)
downloadscummvm-rg350-9c2341678ef4984bf92b3878295250faf980b066.tar.gz
scummvm-rg350-9c2341678ef4984bf92b3878295250faf980b066.tar.bz2
scummvm-rg350-9c2341678ef4984bf92b3878295250faf980b066.zip
Merge branch 'master'
Diffstat (limited to 'engines/cge/talk.cpp')
-rw-r--r--engines/cge/talk.cpp75
1 files changed, 21 insertions, 54 deletions
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index 467b39be40..f5d570b389 100644
--- a/engines/cge/talk.cpp
+++ b/engines/cge/talk.cpp
@@ -73,8 +73,8 @@ uint16 Font::width(const char *text) {
return w;
}
-Talk::Talk(CGEEngine *vm, const char *text, TextBoxStyle mode)
- : Sprite(vm, NULL), _mode(mode), _vm(vm) {
+Talk::Talk(CGEEngine *vm, const char *text, TextBoxStyle mode, bool wideSpace)
+ : Sprite(vm, NULL), _mode(mode), _wideSpace(wideSpace), _vm(vm) {
_ts = NULL;
_flags._syst = true;
update(text);
@@ -85,6 +85,7 @@ Talk::Talk(CGEEngine *vm)
: Sprite(vm, NULL), _mode(kTBPure), _vm(vm) {
_ts = NULL;
_flags._syst = true;
+ _wideSpace = false;
}
void Talk::update(const char *text) {
@@ -103,7 +104,9 @@ void Talk::update(const char *text) {
if (k > mw)
mw = k;
k = 2 * hmarg;
- } else
+ } else if ((*p == 0x20) && (_vm->_font->_widthArr[(unsigned char)*p] > 4) && (!_wideSpace))
+ k += _vm->_font->_widthArr[(unsigned char)*p] - 2;
+ else
k += _vm->_font->_widthArr[(unsigned char)*p];
}
if (k > mw)
@@ -122,7 +125,14 @@ void Talk::update(const char *text) {
} else {
int cw = _vm->_font->_widthArr[(unsigned char)*text];
uint8 *f = _vm->_font->_map + _vm->_font->_pos[(unsigned char)*text];
- for (int i = 0; i < cw; i++) {
+
+ // Handle properly space size, after it was enlarged to display properly
+ // 'F1' text.
+ int8 fontStart = 0;
+ if ((*text == 0x20) && (cw > 4) && (!_wideSpace))
+ fontStart = 2;
+
+ for (int i = fontStart; i < cw; i++) {
uint8 *pp = m;
uint16 n;
uint16 b = *(f++);
@@ -182,55 +192,6 @@ Bitmap *Talk::box(uint16 w, uint16 h) {
return new Bitmap(_vm, w, h, b);
}
-void Talk::putLine(int line, const char *text) {
- // Note: (_ts[0]._w % 4) must be 0
- uint16 w = _ts[0]->_w;
- uint16 h = _ts[0]->_h;
- uint8 *v = _ts[0]->_v;
- uint16 dsiz = w >> 2; // data size (1 plane line size)
- uint16 lsiz = 2 + dsiz + 2; // uint16 for line header, uint16 for gap
- uint16 psiz = h * lsiz; // - last gap, but + plane trailer
- uint16 size = 4 * psiz; // whole map size
- uint16 rsiz = kFontHigh * lsiz; // length of whole text row map
-
- // set desired line pointer
- v += (kTextVMargin + (kFontHigh + kTextLineSpace) * line) * lsiz;
- uint8 *p = v; // assume blanked line above text
-
- // clear whole rectangle
- assert((rsiz % lsiz) == 0);
- for (int planeCtr = 0; planeCtr < 4; planeCtr++, p += psiz) {
- for (byte *pDest = p; pDest < (p + (rsiz - lsiz)); pDest += lsiz)
- Common::copy(p - lsiz, p, pDest);
- }
-
- // paint text line
- if (!text)
- return;
- p = v + 2 + (kTextHMargin / 4) + (kTextHMargin % 4) * psiz;
- uint8 *q = v + size;
-
- while (*text) {
- uint16 cw = _vm->_font->_widthArr[(unsigned char)*text], i;
- uint8 *fp = _vm->_font->_map + _vm->_font->_pos[(unsigned char)*text];
-
- for (i = 0; i < cw; i++) {
- uint16 b = fp[i];
- uint16 n;
- for (n = 0; n < kFontHigh; n++) {
- if (b & 1)
- *p = kTextColFG;
- b >>= 1;
- p += lsiz;
- }
- p = p - rsiz + psiz;
- if (p >= q)
- p = p - size + 1;
- }
- text++;
- }
-}
-
InfoLine::InfoLine(CGEEngine *vm, uint16 w) : Talk(vm), _oldText(NULL), _vm(vm) {
if (!_ts) {
_ts = new BitmapPtr[2];
@@ -271,7 +232,13 @@ void InfoLine::update(const char *text) {
uint16 cw = _vm->_font->_widthArr[(unsigned char)*text];
uint8 *fp = _vm->_font->_map + _vm->_font->_pos[(unsigned char)*text];
- for (uint16 i = 0; i < cw; i++) {
+ // Handle properly space size, after it was enlarged to display properly
+ // 'F1' text.
+ int8 fontStart = 0;
+ if ((*text == 0x20) && (cw > 4) && (!_wideSpace))
+ fontStart = 2;
+
+ for (int i = fontStart; i < cw; i++) {
uint16 b = fp[i];
for (uint16 n = 0; n < kFontHigh; n++) {
if (b & 1)