aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agi/agi.h4
-rw-r--r--engines/agi/graphics.cpp12
-rw-r--r--engines/agi/graphics.h2
-rw-r--r--engines/agi/menu.cpp6
-rw-r--r--engines/agi/text.cpp10
5 files changed, 23 insertions, 11 deletions
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 41db06baa1..4633d9df85 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -736,7 +736,7 @@ public:
int selection_box(const char *, const char **);
void close_window(void);
void draw_window(int, int, int, int);
- void print_text(const char *, int, int, int, int, int, int);
+ void print_text(const char *, int, int, int, int, int, int, bool checkerboard = false);
void print_text_console(const char *, int, int, int, int, int);
int print(const char *, int, int, int);
char *word_wrap_string(char *, int *);
@@ -749,7 +749,7 @@ public:
private:
void print_status(const char *message, ...);
- void print_text2(int l, const char *msg, int foff, int xoff, int yoff, int len, int fg, int bg);
+ void print_text2(int l, const char *msg, int foff, int xoff, int yoff, int len, int fg, int bg, bool checkerboard = false);
void blit_textbox(const char *p, int y, int x, int len);
void erase_textbox();
char *safe_strcat(char *s, const char *t);
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index b55806bba4..ceadda1236 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -185,7 +185,7 @@ void GfxMgr::shakeEnd() {
free(shake_h);
}
-void GfxMgr::putTextCharacter(int l, int x, int y, unsigned int c, int fg, int bg) {
+void GfxMgr::putTextCharacter(int l, int x, int y, unsigned int c, int fg, int bg, bool checkerboard) {
int x1, y1, xx, yy, cc;
uint8 *p;
@@ -200,6 +200,16 @@ void GfxMgr::putTextCharacter(int l, int x, int y, unsigned int c, int fg, int b
p++;
}
+
+ // Simple checkerboard effect to simulate "greyed out" text.
+ // This is what Sierra's interpreter does for things like menu items
+ // that aren't selectable (such as separators). -- dsymonds
+ if (checkerboard) {
+ for (yy = y; yy < y + CHAR_LINES; yy++)
+ for (xx = x + (~yy & 1); xx < x + CHAR_COLS; xx += 2)
+ agi_screen[xx + yy * GFX_WIDTH] = 15;
+ }
+
/* FIXME: we don't want this when we're writing on the
* console!
*/
diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h
index eef9a42bd7..2d1663d398 100644
--- a/engines/agi/graphics.h
+++ b/engines/agi/graphics.h
@@ -55,7 +55,7 @@ public:
void gfxPutBlock(int x1, int y1, int x2, int y2);
- void putTextCharacter(int, int, int, unsigned int, int, int);
+ void putTextCharacter(int, int, int, unsigned int, int, int, bool checkerboard = false);
void shakeScreen(int);
void shakeStart();
void shakeEnd();
diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp
index 160609a15b..ed2fc96dfa 100644
--- a/engines/agi/menu.cpp
+++ b/engines/agi/menu.cpp
@@ -106,7 +106,7 @@ void Menu::draw_menu_option(int h_menu) {
for (iter = m->down.begin(); iter != m->down.end(); ++iter) {
agi_menu_option* d = *iter;
_vm->print_text(d->text, 0, m->wincol + 1, d->index + 2, m->width + 2,
- d->enabled ? MENU_FG : MENU_DISABLED, MENU_BG);
+ MENU_FG, MENU_BG, !d->enabled);
}
}
@@ -114,8 +114,10 @@ void Menu::draw_menu_option_hilite(int h_menu, int v_menu) {
agi_menu *m = get_menu(h_menu);
agi_menu_option *d = get_menu_option(h_menu, v_menu);
+ // Disabled menu items are "greyed out" with a checkerboard effect,
+ // rather than having a different colour. -- dsymonds
_vm->print_text(d->text, 0, m->wincol + 1, v_menu + 2, m->width + 2,
- MENU_BG, d->enabled ? MENU_FG : MENU_DISABLED);
+ MENU_BG, MENU_FG, !d->enabled);
}
void Menu::new_menu_selected(int i) {
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index b35217b7ae..b0ef2a630b 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -31,7 +31,7 @@
namespace Agi {
void AgiEngine::print_text2(int l, const char *msg, int foff, int xoff, int yoff,
- int len, int fg, int bg) {
+ int len, int fg, int bg, bool checkerboard) {
int x1, y1;
int maxx, minx, ofoff;
int update;
@@ -47,7 +47,7 @@ void AgiEngine::print_text2(int l, const char *msg, int foff, int xoff, int yoff
/* FR: strings with len == 1 were not printed
*/
if (len == 1) {
- _gfx->putTextCharacter(l, xoff + foff, yoff, *msg, fg, bg);
+ _gfx->putTextCharacter(l, xoff + foff, yoff, *msg, fg, bg, checkerboard);
maxx = 1;
minx = 0;
ofoff = foff;
@@ -73,7 +73,7 @@ void AgiEngine::print_text2(int l, const char *msg, int foff, int xoff, int yoff
if (xpos >= GFX_WIDTH)
continue;
- _gfx->putTextCharacter(l, xpos, ypos, *m, fg, bg);
+ _gfx->putTextCharacter(l, xpos, ypos, *m, fg, bg, checkerboard);
if (x1 > maxx)
maxx = x1;
@@ -189,13 +189,13 @@ void AgiEngine::erase_textbox() {
/**
* Print text in the AGI engine screen.
*/
-void AgiEngine::print_text(const char *msg, int f, int x, int y, int len, int fg, int bg) {
+void AgiEngine::print_text(const char *msg, int f, int x, int y, int len, int fg, int bg, bool checkerboard) {
f *= CHAR_COLS;
x *= CHAR_COLS;
y *= CHAR_LINES;
debugC(4, kDebugLevelText, "%s, %d, %d, %d, %d, %d, %d", msg, f, x, y, len, fg, bg);
- print_text2(0, agi_sprintf(msg), f, x, y, len, fg, bg);
+ print_text2(0, agi_sprintf(msg), f, x, y, len, fg, bg, checkerboard);
}
/**