[Scummvm-cvs-logs] SF.net SVN: scummvm:[39685] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Mar 25 13:07:10 CET 2009


Revision: 39685
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39685&view=rev
Author:   thebluegr
Date:     2009-03-25 12:07:10 +0000 (Wed, 25 Mar 2009)

Log Message:
-----------
Changed some flags to enums

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/gfx/sci_widgets.cpp
    scummvm/trunk/engines/sci/gfx/sci_widgets.h

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-03-25 10:49:52 UTC (rev 39684)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-03-25 12:07:10 UTC (rev 39685)
@@ -458,7 +458,7 @@
 
 	newport = sciw_new_window(s, port->zone, port->font_nr, port->color, newbgcolor,
 	                          s->titlebar_port->font_nr, s->ega_colors[15], s->ega_colors[8],
-	                          port->title_text, port->port_flags & ~WINDOW_FLAG_TRANSPARENT);
+	                          port->title_text, port->port_flags & ~kWindowTransparent);
 
 	if (s->dyn_views) {
 		int found = 0;
@@ -1302,7 +1302,7 @@
 	// explains what this does.
 	if (type == K_CONTROL_BUTTON && text && (s->_gameName == "sq4") &&
 			s->version < SCI_VERSION(1, 001, 000) && !strcmp(text, " Delete ")) {
-		PUT_SEL32V(obj, state, (state | CONTROL_STATE_GRAY) & ~CONTROL_STATE_ENABLED);
+		PUT_SEL32V(obj, state, (state | kControlStateDisabled) & ~kControlStateEnabled);
 	}
 }
 
@@ -1510,7 +1510,7 @@
 
 		case K_CONTROL_TEXT: {
 			int state = GET_SEL32V(obj, state);
-			PUT_SEL32V(obj, state, state | CONTROL_STATE_DITHER_FRAMED);
+			PUT_SEL32V(obj, state, state | kControlStateDitherFramed);
 			_k_draw_control(s, obj, 0);
 			PUT_SEL32V(obj, state, state);
 		}
@@ -1552,7 +1552,7 @@
 	case K_CONTROL_BUTTON:
 		SCIkdebug(SCIkGRAPHICS, "drawing button "PREG" to %d,%d\n", PRINT_REG(obj), x, y);
 		ADD_TO_CURRENT_BG_WIDGETS(sciw_new_button_control(s->port, obj, area, text, font_nr,
-		                          (int8)(state & CONTROL_STATE_FRAMED), (int8)inverse, (int8)(state & CONTROL_STATE_GRAY)));
+		                          (int8)(state & kControlStateFramed), (int8)inverse, (int8)(state & kControlStateDisabled)));
 		break;
 
 	case K_CONTROL_TEXT:
@@ -1561,7 +1561,7 @@
 		SCIkdebug(SCIkGRAPHICS, "drawing text "PREG" to %d,%d, mode=%d\n", PRINT_REG(obj), x, y, mode);
 
 		ADD_TO_CURRENT_BG_WIDGETS(sciw_new_text_control(s->port, obj, area, text, font_nr, mode,
-									(int8)(!!(state & CONTROL_STATE_DITHER_FRAMED)), (int8)inverse));
+									(int8)(!!(state & kControlStateDitherFramed)), (int8)inverse));
 		break;
 
 	case K_CONTROL_EDIT:
@@ -1585,7 +1585,7 @@
 		SCIkdebug(SCIkGRAPHICS, "drawing icon control "PREG" to %d,%d\n", PRINT_REG(obj), x, y - 1);
 
 		ADD_TO_CURRENT_BG_WIDGETS(sciw_new_icon_control(s->port, obj, area, view, loop, cel,
-		                          (int8)(state & CONTROL_STATE_FRAMED), (int8)inverse));
+		                          (int8)(state & kControlStateFramed), (int8)inverse));
 		break;
 
 	case K_CONTROL_CONTROL:

Modified: scummvm/trunk/engines/sci/gfx/sci_widgets.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/sci_widgets.cpp	2009-03-25 10:49:52 UTC (rev 39684)
+++ scummvm/trunk/engines/sci/gfx/sci_widgets.cpp	2009-03-25 12:07:10 UTC (rev 39685)
@@ -142,11 +142,11 @@
 	gfxop_set_color(state, &black, 0, 0, 0, 0, 0, 0);
 	gfxw_port_t *win;
 	gfxw_list_t *decorations;
-//	int xextra = !(flags & WINDOW_FLAG_NOFRAME) ? 1 : 0;
-//	int yextra = !(flags & WINDOW_FLAG_NOFRAME) ? 2 : 0;
+//	int xextra = !(flags & kWindowNoFrame) ? 1 : 0;
+//	int yextra = !(flags & kWindowNoFrame) ? 2 : 0;
 
 	if (area.width == 319 && area.height == 189) {
-		flags |= WINDOW_FLAG_NOFRAME;
+		flags |= kWindowNoFrame;
 		// The below line makes the points bar in QfG2 work, but breaks
 		// the one in QfG1. Hm.
 		if ((byte)bgcolor.priority == 255) /* Yep, QfG2 */
@@ -163,10 +163,10 @@
 	}
 	*/
 
-	if (flags & WINDOW_FLAG_TITLE)
+	if (flags & kWindowTitle)
 		area. y += 10;
 
-	if (!(flags & (WINDOW_FLAG_TITLE | WINDOW_FLAG_NOFRAME)))
+	if (!(flags & (kWindowTitle | kWindowNoFrame)))
 		area.height -= 1; // Normal windows are drawn one pixel too small.
 
 	sciw_make_window_fit(&area, s->wm_port);
@@ -178,13 +178,13 @@
 
 	win->flags |= GFXW_FLAG_IMMUNE_TO_SNAPSHOTS;
 
-	if (flags & WINDOW_FLAG_DONTDRAW)
-		flags = WINDOW_FLAG_TRANSPARENT | WINDOW_FLAG_NOFRAME;
+	if (flags & kWindowDontDraw)
+		flags = kWindowTransparent | kWindowNoFrame;
 
-	if (flags == (WINDOW_FLAG_TRANSPARENT | WINDOW_FLAG_NOFRAME))
+	if (flags == (kWindowTransparent | kWindowNoFrame))
 		return win; // Fully transparent window
 
-	if (flags & WINDOW_FLAG_TITLE)
+	if (flags & kWindowTitle)
 		frame = gfx_rect(area.x - 1, area.y - 10, area.width + 2, area.height + 11);
 	else
 		frame = gfx_rect(area.x - 1, area.y - 1, area.width + 2, area.height + 2);
@@ -194,15 +194,15 @@
 
 	decorations = gfxw_new_list(gfx_rect(frame.x, frame.y, frame.width + 1 + shadow_offset, frame.height + 1 + shadow_offset), 0);
 
-	if (!(flags & WINDOW_FLAG_TRANSPARENT)) {
+	if (!(flags & kWindowTransparent)) {
 		// Draw window background
-		win->port_bg = (gfxw_widget_t *)gfxw_new_box(state, gfx_rect(1, (flags & WINDOW_FLAG_TITLE) ? 10 : 1,
+		win->port_bg = (gfxw_widget_t *)gfxw_new_box(state, gfx_rect(1, (flags & kWindowTitle) ? 10 : 1,
 		                        area.width, area.height), bgcolor, bgcolor, GFX_BOX_SHADE_FLAT);
 		decorations->add((gfxw_container_t *) decorations, win->port_bg);
 		win->flags |= GFXW_FLAG_OPAQUE;
 	}
 
-	if (flags & WINDOW_FLAG_TITLE) {
+	if (flags & kWindowTitle) {
 		// Add window title
 		rect_t title_rect = gfx_rect(1, 1, area.width, 8);
 
@@ -214,10 +214,10 @@
 						title_bgcolor, GFXR_FONT_FLAG_NO_NEWLINES));
 	}
 
-	if (!(flags & WINDOW_FLAG_NOFRAME)) {
+	if (!(flags & kWindowNoFrame)) {
 		// Draw backdrop shadow
 
-		if (!(flags & WINDOW_FLAG_NO_DROP_SHADOW)) {
+		if (!(flags & kWindowNoDropShadow)) {
 			if (gfxop_set_color(state, &black, 0, 0, 0, 0x80, bgcolor.priority, -1)) {
 				GFXERROR("Could not get black/semitrans color entry!\n");
 				return NULL;
@@ -239,12 +239,12 @@
 			return NULL;
 		}
 
-		if (!(flags & WINDOW_FLAG_NO_DROP_SHADOW)) {
+		if (!(flags & kWindowNoDropShadow)) {
 
 			decorations->add((gfxw_container_t *)decorations, (gfxw_widget_t *)
 			                 gfxw_new_rect(gfx_rect(0, 0, frame.width - 1, frame.height - 1), black, GFX_LINE_MODE_FINE, GFX_LINE_STYLE_NORMAL));
 
-			if (flags & WINDOW_FLAG_TITLE)
+			if (flags & kWindowTitle)
 				decorations->add((gfxw_container_t *)decorations, (gfxw_widget_t *)gfxw_new_line(Common::Point(1, 9),
 									Common::Point(frame.width - 2, 9), black, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
 		} else {
@@ -577,7 +577,7 @@
 	area.height = menu->_items.size() * 10;
 
 	retval = sciw_new_window(s, area, status_bar->font_nr, status_bar->color, status_bar->bgcolor,
-	                         0, status_bar->color, status_bar->bgcolor, NULL, WINDOW_FLAG_NO_DROP_SHADOW | WINDOW_FLAG_TRANSPARENT);
+	                         0, status_bar->color, status_bar->bgcolor, NULL, kWindowNoDropShadow | kWindowTransparent);
 
 	retval->set_visual(GFXW(retval), s->visual);
 

Modified: scummvm/trunk/engines/sci/gfx/sci_widgets.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/sci_widgets.h	2009-03-25 10:49:52 UTC (rev 39684)
+++ scummvm/trunk/engines/sci/gfx/sci_widgets.h	2009-03-25 12:07:10 UTC (rev 39685)
@@ -34,34 +34,23 @@
 
 class Menu;
 
-/* The following flags are applicable to windows in SCI0: */
-#define WINDOW_FLAG_TRANSPARENT 0x01
+// The following flags are applicable to windows in SCI0
+enum windowFlags {
+	kWindowTransparent  = 0x01,          // 0001
+	kWindowNoFrame      = 0x02,          // 0010 - a window without a frame
+	// Add title bar to window (10 pixels high, framed, text is centered and written in white on dark gray)
+	kWindowTitle        = 0x04,          // 0100
+	kWindowDontDraw     = 0x80,          // 1000 0000 - don't draw anything
+	kWindowNoDropShadow = 0x1000000,     // 0001 0000 0000 0000 0000 0000 0000
+};
 
+enum controlStateFlags {
+	kControlStateEnabled      = 0x0001,  // 0001 - enabled buttons (used by the interpreter)
+	kControlStateDisabled     = 0x0004,  // 0010 - grayed out buttons (used by the interpreter)
+	kControlStateFramed       = 0x0008,  // 1000 - widgets surrounded by a frame (used by the interpreter)
+	kControlStateDitherFramed = 0x1000   // 0001 0000 0000 0000 - widgets surrounded by a dithered frame (used in kgraphics)
+};
 
-#define WINDOW_FLAG_NOFRAME 0x02
-/* No frame is drawn around the window onto wm_view */
-
-#define WINDOW_FLAG_TITLE 0x04
-/* Add titlebar to window (10 pixels high, framed, text is centered and written
-** in white on dark gray
-*/
-
-#define WINDOW_FLAG_DONTDRAW 0x80
-/* Don't draw anything */
-
-#define WINDOW_FLAG_NO_DROP_SHADOW 0x1000000
-
-
-/* Used in kgraphics to flag text surrounded by a dithered frame */
-#define CONTROL_STATE_DITHER_FRAMED 0x1000
-
-/* Used by the interpreter to flag buttons that are grayed out */
-#define CONTROL_STATE_GRAY 0x0004
-/* Used by the interpreter to flag some widgets to determine whether they should be surrounded by a frame */
-#define CONTROL_STATE_FRAMED 0x0008
-/* Used by the interpreter to flag buttons that are enabled */
-#define CONTROL_STATE_ENABLED 0x0001
-
 void sciw_set_status_bar(EngineState *s, gfxw_port_t *status_bar, const Common::String &text, int fgcolor, int bgcolor);
 /* Sets the contents of a port used as status bar
 ** Parmeters: (EngineState *) s: The affected game state


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