aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kgraphics.cpp12
-rw-r--r--engines/sci/gfx/sci_widgets.cpp34
-rw-r--r--engines/sci/gfx/sci_widgets.h43
3 files changed, 39 insertions, 50 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 8823102472..b987f75755 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -458,7 +458,7 @@ void _k_graph_rebuild_port_with_color(EngineState *s, gfx_color_t newbgcolor) {
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 @@ static void _k_disable_delete_for_now(EngineState *s, reg_t obj) {
// 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 @@ reg_t kEditControl(EngineState *s, int funct_nr, int argc, reg_t *argv) {
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 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) {
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 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) {
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 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) {
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:
diff --git a/engines/sci/gfx/sci_widgets.cpp b/engines/sci/gfx/sci_widgets.cpp
index f816c2fea2..c0a311f0d3 100644
--- a/engines/sci/gfx/sci_widgets.cpp
+++ b/engines/sci/gfx/sci_widgets.cpp
@@ -142,11 +142,11 @@ gfxw_port_t *sciw_new_window(EngineState *s,
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 @@ gfxw_port_t *sciw_new_window(EngineState *s,
}
*/
- 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 @@ gfxw_port_t *sciw_new_window(EngineState *s,
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 @@ gfxw_port_t *sciw_new_window(EngineState *s,
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 @@ gfxw_port_t *sciw_new_window(EngineState *s,
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 @@ gfxw_port_t *sciw_new_window(EngineState *s,
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 @@ gfxw_port_t *sciw_new_menu(EngineState *s, gfxw_port_t *status_bar, Menubar *men
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);
diff --git a/engines/sci/gfx/sci_widgets.h b/engines/sci/gfx/sci_widgets.h
index b47e7120a1..5490e0fc4b 100644
--- a/engines/sci/gfx/sci_widgets.h
+++ b/engines/sci/gfx/sci_widgets.h
@@ -34,33 +34,22 @@ namespace Sci {
class Menu;
-/* The following flags are applicable to windows in SCI0: */
-#define WINDOW_FLAG_TRANSPARENT 0x01
-
-
-#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
+// 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)
+};
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