[Scummvm-cvs-logs] scummvm master -> b94b4e631b319b48c15febff6be55b5db128bcfc
Strangerke
Strangerke at scummvm.org
Mon Dec 5 21:04:13 CET 2011
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f3884d1a98 CGE: Better handling of the wide 'space' character
b94b4e631b CGE: Remove useless function
Commit: f3884d1a98c19134514a1fca6af48a59f3b57e91
https://github.com/scummvm/scummvm/commit/f3884d1a98c19134514a1fca6af48a59f3b57e91
Author: Strangerke (strangerke at scummvm.org)
Date: 2011-12-05T11:59:51-08:00
Commit Message:
CGE: Better handling of the wide 'space' character
Changed paths:
engines/cge/cge.h
engines/cge/snail.cpp
engines/cge/talk.cpp
engines/cge/talk.h
engines/cge/text.cpp
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index d494af0..d324b29 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -225,7 +225,7 @@ public:
void runGame();
bool showTitle(const char *name);
void movie(const char *ext);
- void inf(const char *text);
+ void inf(const char *text, bool wideSpace = false);
void selectSound();
void dummy() {}
void NONE();
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index f50f669..c26f68f 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -194,7 +194,7 @@ void CommandHandler::runCommand() {
break;
case kCmdInf:
if (_talkEnable) {
- _vm->inf(_vm->_text->getText(tailCmd->_val));
+ _vm->inf(_vm->_text->getText(tailCmd->_val), true);
_vm->_sys->_funDel = kHeroFun0;
}
break;
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index d9be56e..5a39228 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++);
@@ -211,10 +221,16 @@ void Talk::putLine(int line, const char *text) {
uint8 *q = v + size;
while (*text) {
- uint16 cw = _vm->_font->_widthArr[(unsigned char)*text], i;
+ uint16 cw = _vm->_font->_widthArr[(unsigned char)*text];
uint8 *fp = _vm->_font->_map + _vm->_font->_pos[(unsigned char)*text];
- for (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];
uint16 n;
for (n = 0; n < kFontHigh; n++) {
@@ -271,15 +287,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];
- // This hack compensates the font modification done to fix the display
- // of the 'F1' text. Specifically, it reduces the width of the space
- // character when it has been enlarged.
- // This hack fixes bug #3450423.
- int8 hackStart = 0;
- if ((*text == 0x20) && (cw > 4))
- hackStart = 2;
+ // 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 (uint16 i = hackStart; i < cw; i++) {
+ for (int i = fontStart; i < cw; i++) {
uint16 b = fp[i];
for (uint16 n = 0; n < kFontHigh; n++) {
if (b & 1)
diff --git a/engines/cge/talk.h b/engines/cge/talk.h
index 55c529b..b292cf7 100644
--- a/engines/cge/talk.h
+++ b/engines/cge/talk.h
@@ -52,8 +52,9 @@ protected:
TextBoxStyle _mode;
BitmapPtr *_ts;
Bitmap *box(uint16 w, uint16 h);
+ bool _wideSpace;
public:
- Talk(CGEEngine *vm, const char *text, TextBoxStyle mode);
+ Talk(CGEEngine *vm, const char *text, TextBoxStyle mode, bool wideSpace = false);
Talk(CGEEngine *vm);
virtual void update(const char *text);
diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp
index d426787..331dc8a 100644
--- a/engines/cge/text.cpp
+++ b/engines/cge/text.cpp
@@ -182,7 +182,7 @@ void Text::say(const char *text, Sprite *spr) {
_vm->_vga->_showQ->insert(speaker, _vm->_vga->_showQ->last());
}
-void CGEEngine::inf(const char *text) {
+void CGEEngine::inf(const char *text, bool wideSpace) {
debugC(1, kCGEDebugEngine, "CGEEngine::inf(%s)", text);
if (!text)
return;
@@ -191,7 +191,7 @@ void CGEEngine::inf(const char *text) {
return;
killText();
- _talk = new Talk(this, text, kTBRect);
+ _talk = new Talk(this, text, kTBRect, wideSpace);
if (!_talk)
return;
Commit: b94b4e631b319b48c15febff6be55b5db128bcfc
https://github.com/scummvm/scummvm/commit/b94b4e631b319b48c15febff6be55b5db128bcfc
Author: Strangerke (strangerke at scummvm.org)
Date: 2011-12-05T12:03:21-08:00
Commit Message:
CGE: Remove useless function
Changed paths:
engines/cge/talk.cpp
engines/cge/talk.h
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index 5a39228..f5d570b 100644
--- a/engines/cge/talk.cpp
+++ b/engines/cge/talk.cpp
@@ -192,61 +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];
- uint8 *fp = _vm->_font->_map + _vm->_font->_pos[(unsigned char)*text];
-
- // 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];
- 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];
diff --git a/engines/cge/talk.h b/engines/cge/talk.h
index b292cf7..66e3d85 100644
--- a/engines/cge/talk.h
+++ b/engines/cge/talk.h
@@ -58,7 +58,6 @@ public:
Talk(CGEEngine *vm);
virtual void update(const char *text);
- void putLine(int line, const char *text);
private:
CGEEngine *_vm;
};
More information about the Scummvm-git-logs
mailing list