[Scummvm-cvs-logs] CVS: scummvm/saga font.cpp,1.25,1.26 font.h,1.10,1.11 interface.cpp,1.58,1.59 interface.h,1.26,1.27
Eugene Sandulenko
sev at users.sourceforge.net
Mon Jan 10 16:53:08 CET 2005
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8676
Modified Files:
font.cpp font.h interface.cpp interface.h
Log Message:
o All fonts were mapped. Introduced new FONT_DONTMAP flag
o Implemented and tested converse drawing. Still some features like
arrows and hardcoded values are present, and it is not used in scripts
Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- font.cpp 9 Jan 2005 23:41:21 -0000 1.25
+++ font.cpp 11 Jan 2005 00:51:58 -0000 1.26
@@ -379,20 +379,20 @@
font = _fonts[font_id];
if (flags & FONT_OUTLINE) {
- outFont(font->outline, ds, draw_str, draw_str_ct, text_x - 1, text_y - 1, effect_color);
- outFont(font->normal, ds, draw_str, draw_str_ct, text_x, text_y, color);
+ outFont(font->outline, ds, draw_str, draw_str_ct, text_x - 1, text_y - 1, effect_color, flags);
+ outFont(font->normal, ds, draw_str, draw_str_ct, text_x, text_y, color, flags);
} else if (flags & FONT_SHADOW) {
- outFont(font->normal, ds, draw_str, draw_str_ct, text_x - 1, text_y + 1, effect_color);
- outFont(font->normal, ds, draw_str, draw_str_ct, text_x, text_y, color);
+ outFont(font->normal, ds, draw_str, draw_str_ct, text_x - 1, text_y + 1, effect_color, flags);
+ outFont(font->normal, ds, draw_str, draw_str_ct, text_x, text_y, color, flags);
} else { // FONT_NORMAL
- outFont(font->normal, ds, draw_str, draw_str_ct, text_x, text_y, color);
+ outFont(font->normal, ds, draw_str, draw_str_ct, text_x, text_y, color, flags);
}
return SUCCESS;
}
int Font::outFont(FONT_STYLE * draw_font, SURFACE * ds, const char *draw_str, size_t draw_str_ct,
- int text_x, int text_y, int color) {
+ int text_x, int text_y, int color, int flags) {
const byte *draw_str_p;
byte *c_data_ptr;
int c_code;
@@ -424,7 +424,8 @@
c_code = *draw_str_p & 0xFFU;
// Translate character
- c_code = _charMap[c_code];
+ if (!(flags & FONT_DONTMAP))
+ c_code = _charMap[c_code];
assert(c_code < FONT_CHARCOUNT);
// Check if character is defined
Index: font.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- font.h 1 Jan 2005 16:18:36 -0000 1.10
+++ font.h 11 Jan 2005 00:51:58 -0000 1.11
@@ -55,11 +55,12 @@
};
enum FONT_EFFECT_FLAGS {
- FONT_NORMAL = 0x00,
- FONT_OUTLINE = 0x01,
- FONT_SHADOW = 0x02,
- FONT_BOLD = 0x04,
- FONT_CENTERED = 0x08
+ FONT_NORMAL = 0,
+ FONT_OUTLINE = 1 << 0,
+ FONT_SHADOW = 1 << 1,
+ FONT_BOLD = 1 << 2,
+ FONT_CENTERED = 1 << 3,
+ FONT_DONTMAP = 1 << 4
};
struct FONT_HEADER {
@@ -110,7 +111,7 @@
int loadFont(uint32 font_rn, int font_id);
FONT_STYLE *createOutline(FONT_STYLE * src_font);
int outFont(FONT_STYLE *font, SURFACE * ds, const char *draw_str, size_t draw_str_ct,
- int text_x, int text_y, int color);
+ int text_x, int text_y, int color, int flags);
int getByteLen(int num_bits);
static const int _charMap[256];
Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- interface.cpp 10 Jan 2005 22:51:01 -0000 1.58
+++ interface.cpp 11 Jan 2005 00:51:58 -0000 1.59
@@ -808,6 +808,11 @@
_converseStartPos = 0;
_converseEndPos = 0;
_conversePos = -1;
+
+ for (int i = 0; i < CONVERSE_TEXT_LINES; i++) {
+ _converseLastColors[0][i] = 0;
+ _converseLastColors[1][i] = 0;
+ }
}
bool Interface::converseAddText(const char *text, int replyId, byte replyFlags, int replyBit) {
@@ -862,8 +867,8 @@
enum converseColors {
kColorBrightWhite = 0x2,
- kColorDarkGrey = 0xa,
- kColorGrey = 0xb,
+ kColorGrey = 0xa,
+ kColorDarkGrey = 0xb,
kColorGreen = 0xba,
kColorBlack = 0xf,
kColorBlue = 0x93
@@ -899,6 +904,72 @@
}
void Interface::converseDisplayTextLine(int textcolor, bool btnDown, bool rebuild) {
+ int x = 52; // FIXME: remove hardcoded value
+ int y = 6; // FIXME: remove hardcoded value
+ int pos = _converseStartPos;
+ byte textcolors[2][CONVERSE_TEXT_LINES];
+ SURFACE *ds;
+
+ ds = _vm->_gfx->getBackBuffer(); // FIXME: probably best to move this out
+
+ for (int i = 0; i < CONVERSE_TEXT_LINES; i++) {
+ int relpos = pos + i;
+
+ if (_conversePos >= 0
+ && _converseText[_conversePos].stringNum
+ == _converseText[relpos].stringNum) {
+ textcolors[0][i] = textcolor;
+ textcolors[1][i] = (!btnDown) ? kColorDarkGrey : kColorGrey;
+ } else {
+ textcolors[0][i] = kColorBlue;
+ textcolors[1][i] = kColorDarkGrey;
+ }
+ }
+ // if no colors have changed, exit
+ if (!rebuild && memcmp(textcolors, _converseLastColors, sizeof(textcolors)) == 0)
+ return;
+
+ memcpy(_converseLastColors, textcolors, sizeof(textcolors));
+
+ Rect rect(8, CONVERSE_TEXT_LINES * CONVERSE_TEXT_HEIGHT);
+ int scrx = _conversePanel.x + x;
+
+ rect.moveTo(_conversePanel.x + x, _conversePanel.y + y);
+
+ drawRect(ds, &rect, kColorDarkGrey);
+
+ rect.top = rect.left = 0;
+ rect.right = CONVERSE_MAX_TEXT_WIDTH;
+ rect.bottom = CONVERSE_TEXT_HEIGHT;
+
+ for (int i = 0; i < CONVERSE_TEXT_LINES; i++) {
+ byte foregnd = textcolors[0][i];
+ byte backgnd = textcolors[1][i];
+ int relpos = pos + i;
+
+ rect.moveTo(_conversePanel.x + x + 7 + 1,
+ _conversePanel.y + y + i * CONVERSE_TEXT_HEIGHT);
+
+ drawRect(ds, &rect, backgnd);
+
+ if (_converseTextCount > i) {
+ const char *str = _converseText[relpos].text;
+ char bullet[] = { 0xb7, 0 };
+ int scry = i * CONVERSE_TEXT_HEIGHT + _conversePanel.y + y;
+ byte tcolor, bcolor;
+
+ if (_converseText[relpos].textNum == 0) { // first entry
+ tcolor = kColorGreen;
+ bcolor = kColorBlack;
+ _vm->_font->draw(SMALL_FONT_ID, ds, bullet, strlen(bullet),
+ scrx + 2, scry, tcolor, bcolor, FONT_SHADOW | FONT_DONTMAP);
+ }
+ _vm->_font->draw(SMALL_FONT_ID, ds, str, strlen(str),
+ scrx + 9, scry, foregnd, kColorBlack, FONT_SHADOW);
+ }
+ }
+
+ // FIXME: TODO: arrows
}
void Interface::converseChangePos(int chg) {
Index: interface.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- interface.h 10 Jan 2005 22:51:01 -0000 1.26
+++ interface.h 11 Jan 2005 00:51:58 -0000 1.27
@@ -295,6 +295,8 @@
int _converseStartPos;
int _converseEndPos;
int _conversePos;
+
+ byte _converseLastColors[2][CONVERSE_TEXT_LINES];
};
} // End of namespace Saga
More information about the Scummvm-git-logs
mailing list