mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 17:29:11 +00:00
Extended text rendering code to allow "checkerboarding", and switch menu code
to using this checkerboard effect for disabled menu items (this is how Sierra's interpreter works). svn-id: r25024
This commit is contained in:
parent
a16a3f258d
commit
61d741514e
@ -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);
|
||||
|
@ -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!
|
||||
*/
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user