[Scummvm-cvs-logs] SF.net SVN: scummvm: [25024] scummvm/trunk/engines/agi

dsx at users.sourceforge.net dsx at users.sourceforge.net
Sat Jan 6 06:11:41 CET 2007


Revision: 25024
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25024&view=rev
Author:   dsx
Date:     2007-01-05 21:11:41 -0800 (Fri, 05 Jan 2007)

Log Message:
-----------
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).

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.h
    scummvm/trunk/engines/agi/graphics.cpp
    scummvm/trunk/engines/agi/graphics.h
    scummvm/trunk/engines/agi/menu.cpp
    scummvm/trunk/engines/agi/text.cpp

Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h	2007-01-06 04:19:28 UTC (rev 25023)
+++ scummvm/trunk/engines/agi/agi.h	2007-01-06 05:11:41 UTC (rev 25024)
@@ -736,7 +736,7 @@
 	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 @@
 
 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);

Modified: scummvm/trunk/engines/agi/graphics.cpp
===================================================================
--- scummvm/trunk/engines/agi/graphics.cpp	2007-01-06 04:19:28 UTC (rev 25023)
+++ scummvm/trunk/engines/agi/graphics.cpp	2007-01-06 05:11:41 UTC (rev 25024)
@@ -185,7 +185,7 @@
 	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 @@
 
 		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!
 	 */

Modified: scummvm/trunk/engines/agi/graphics.h
===================================================================
--- scummvm/trunk/engines/agi/graphics.h	2007-01-06 04:19:28 UTC (rev 25023)
+++ scummvm/trunk/engines/agi/graphics.h	2007-01-06 05:11:41 UTC (rev 25024)
@@ -55,7 +55,7 @@
 
 	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();

Modified: scummvm/trunk/engines/agi/menu.cpp
===================================================================
--- scummvm/trunk/engines/agi/menu.cpp	2007-01-06 04:19:28 UTC (rev 25023)
+++ scummvm/trunk/engines/agi/menu.cpp	2007-01-06 05:11:41 UTC (rev 25024)
@@ -106,7 +106,7 @@
 	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 @@
 	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) {

Modified: scummvm/trunk/engines/agi/text.cpp
===================================================================
--- scummvm/trunk/engines/agi/text.cpp	2007-01-06 04:19:28 UTC (rev 25023)
+++ scummvm/trunk/engines/agi/text.cpp	2007-01-06 05:11:41 UTC (rev 25024)
@@ -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 @@
 	/* 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 @@
 					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 @@
 /**
  * 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);
 }
 
 /**


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list