aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/gfx')
-rw-r--r--engines/sci/gfx/font.cpp8
-rw-r--r--engines/sci/gfx/gfx_driver.cpp4
-rw-r--r--engines/sci/gfx/gfx_res_options.cpp24
-rw-r--r--engines/sci/gfx/gfx_resource.cpp4
-rw-r--r--engines/sci/gfx/gfx_support.cpp4
-rw-r--r--engines/sci/gfx/gfx_tools.cpp16
-rw-r--r--engines/sci/gfx/operations.cpp54
-rw-r--r--engines/sci/gfx/resmgr.cpp6
-rw-r--r--engines/sci/gfx/resource/sci_pic_0.cpp29
-rw-r--r--engines/sci/gfx/resource/sci_view_1.cpp2
-rw-r--r--engines/sci/gfx/sbtree.cpp87
-rw-r--r--engines/sci/gfx/sci_widgets.cpp10
-rw-r--r--engines/sci/gfx/widgets.cpp30
13 files changed, 141 insertions, 137 deletions
diff --git a/engines/sci/gfx/font.cpp b/engines/sci/gfx/font.cpp
index abea8540a5..c0326c749d 100644
--- a/engines/sci/gfx/font.cpp
+++ b/engines/sci/gfx/font.cpp
@@ -120,7 +120,7 @@ gfx_bitmap_font_t *gfxr_scale_font_unfiltered(gfx_bitmap_font_t *orig_font, gfx_
}
gfx_bitmap_font_t *gfxr_scale_font(gfx_bitmap_font_t *orig_font, gfx_mode_t *mode, gfxr_font_scale_filter_t filter) {
- GFXWARN("This function hasn't been tested yet");
+ GFXWARN("This function hasn't been tested yet!\n");
switch (filter) {
@@ -128,7 +128,7 @@ gfx_bitmap_font_t *gfxr_scale_font(gfx_bitmap_font_t *orig_font, gfx_mode_t *mod
return gfxr_scale_font_unfiltered(orig_font, mode);
default:
- GFXERROR("Invalid font filter mode %d", filter);
+ GFXERROR("Invalid font filter mode %d!\n", filter);
return NULL;
}
}
@@ -297,7 +297,7 @@ gfx_pixmap_t *gfxr_draw_font(gfx_bitmap_font_t *font, const char *stext, int cha
int ch = (int) text[i];
if (ch >= font->chars_nr) {
- GFXERROR("Invalid character 0x%02x encountered", text[i]);
+ GFXERROR("Invalid character 0x%02x encountered!\n", text[i]);
return NULL;
}
@@ -308,7 +308,7 @@ gfx_pixmap_t *gfxr_draw_font(gfx_bitmap_font_t *font, const char *stext, int cha
pxm->colors_nr = !!fg0 + !!fg1 + !!bg;
if (pxm->colors_nr == 0) {
- GFXWARN("Pixmap would have zero colors, resetting");
+ GFXWARN("Pixmap would have zero colors, resetting!\n");
pxm->colors_nr = 3;
hack = 1;
fg0 = fg1 = bg = &dummy;
diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp
index ad726e1b14..34c61f26d2 100644
--- a/engines/sci/gfx/gfx_driver.cpp
+++ b/engines/sci/gfx/gfx_driver.cpp
@@ -234,7 +234,7 @@ static int scummvm_grab_pixmap(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t
break;
case GFX_MASK_PRIORITY:
- printf("FIXME: priority map grab not implemented yet");
+ printf("FIXME: priority map grab not implemented yet!\n");
break;
default:
@@ -282,7 +282,7 @@ static int scummvm_update(struct _gfx_driver *drv, rect_t src, Common::Point des
S->update_screen = true;
break;
default:
- GFXERROR("Invalid buffer %d in update", buffer);
+ GFXERROR("Invalid buffer %d in update!\n", buffer);
return GFX_ERROR;
}
diff --git a/engines/sci/gfx/gfx_res_options.cpp b/engines/sci/gfx/gfx_res_options.cpp
index 5a57c03fa3..76f488f45e 100644
--- a/engines/sci/gfx/gfx_res_options.cpp
+++ b/engines/sci/gfx/gfx_res_options.cpp
@@ -46,7 +46,8 @@ static inline int matches_patternlist(gfx_res_pattern_t *patterns, int nr, int v
#ifdef DEBUG
static void print_pattern(gfx_res_pattern_t *pat) {
- error("[%d..%d]", pat->min, pat->max);
+ fprintf(stderr, "[%d..%d]",
+ pat->min, pat->max);
}
#endif
@@ -54,24 +55,24 @@ static inline int resource_matches_patternlists(gfx_res_conf_t *conf, int type,
int loc;
#ifdef DEBUG
int i;
-
- error("[DEBUG:gfx-res] Trying to match against %d/%d/%d choices\n", conf->patterns_nr, conf->loops_nr, conf->cels_nr);
+ fprintf(stderr, "[DEBUG:gfx-res] Trying to match against %d/%d/%d choices\n",
+ conf->patterns_nr, conf->loops_nr, conf->cels_nr);
for (i = 0; i < conf->patterns_nr; i++) {
- error("[DEBUG:gfx-res] Pat #%d: ", i);
+ fprintf(stderr, "[DEBUG:gfx-res] Pat #%d: ", i);
print_pattern(conf->patterns + i);
- error("\n");
+ fprintf(stderr, "\n");
}
loc = conf->patterns_nr;
for (i = 0; i < conf->loops_nr; i++) {
- error("[DEBUG:gfx-res] Loop #%d: ", i);
+ fprintf(stderr, "[DEBUG:gfx-res] Loop #%d: ", i);
print_pattern(conf->patterns + i + loc);
- error("\n");
+ fprintf(stderr, "\n");
}
loc += conf->loops_nr;
for (i = 0; i < conf->cels_nr; i++) {
- error("[DEBUG:gfx-res] Cel #%d: ", i);
+ fprintf(stderr, "[DEBUG:gfx-res] Cel #%d: ", i);
print_pattern(conf->patterns + i + loc);
- error("\n");
+ fprintf(stderr, "\n");
}
#endif
if (conf->patterns_nr && !matches_patternlist(conf->patterns, conf->patterns_nr, nr))
@@ -104,7 +105,7 @@ static inline gfx_res_conf_t *find_match(gfx_res_conf_t *conflist, int type, int
while (conflist) {
if (resource_matches_patternlists(conflist, type, nr, loop, cel)) {
#ifdef DEBUG
- error("[DEBUG:gfx-res] Found match");
+ fprintf(stderr, "[DEBUG:gfx-res] Found match!\n");
#endif
return conflist;
}
@@ -175,7 +176,8 @@ int gfx_get_res_config(gfx_options_t *options, gfx_pixmap_t *pxm) {
gfx_res_conf_t *conf;
#ifdef DEBUG
- error("[DEBUG:gfx-res] Trying to conf %d/%d/%d/%d (ID=%d)\n", restype, nr, loop, cel, pxm->ID);
+ fprintf(stderr, "[DEBUG:gfx-res] Trying to conf %d/%d/%d/%d (ID=%d)\n",
+ restype, nr, loop, cel, pxm->ID);
#endif
if (pxm->ID < 0 || restype < 0 || restype >= GFX_RESOURCE_TYPES_NR)
diff --git a/engines/sci/gfx/gfx_resource.cpp b/engines/sci/gfx/gfx_resource.cpp
index 779a87a3e1..74c8f905f2 100644
--- a/engines/sci/gfx/gfx_resource.cpp
+++ b/engines/sci/gfx/gfx_resource.cpp
@@ -195,7 +195,7 @@ gfx_pixmap_t *gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
break;
default:
- error("gfxr_endianness_adjust(): Cannot adjust endianness for %d bytespp", bytespp);
+ fprintf(stderr, "gfxr_endianness_adjust(): Cannot adjust endianness for %d bytespp!\n", bytespp);
return NULL;
}
@@ -357,7 +357,7 @@ void gfx_xlate_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode, gfx_xlate_filter_t fi
for (i = 0; i < pxm->colors_nr; i++) {
if (gfx_alloc_color(mode->palette, pxm->colors + i) < 0) {
- GFXWARN("Failed to allocate color %d/%d in pixmap (color %02x/%02x/%02x)",
+ GFXWARN("Failed to allocate color %d/%d in pixmap (color %02x/%02x/%02x)!\n",
i, pxm->colors_nr, pxm->colors[i].r, pxm->colors[i].g, pxm->colors[i].b);
pxm->colors[i].global_index = 0;
}
diff --git a/engines/sci/gfx/gfx_support.cpp b/engines/sci/gfx/gfx_support.cpp
index 276d51e176..e1b8004907 100644
--- a/engines/sci/gfx/gfx_support.cpp
+++ b/engines/sci/gfx/gfx_support.cpp
@@ -78,7 +78,7 @@ inline void gfx_draw_line_buffer(byte *buffer, int linewidth, int pixelwidth, Co
return;
default:
- GFXERROR("pixelwidth=%d not supported", pixelwidth);
+ GFXERROR("pixelwidth=%d not supported!\n", pixelwidth);
return;
}
@@ -350,7 +350,7 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect
alpha_mask = mode->alpha_mask;
if (!alpha_mask && pxm->alpha_map) {
- GFXERROR("Invalid alpha mode: both pxm->alpha_map and alpha_mask are white");
+ GFXERROR("Invalid alpha mode: both pxm->alpha_map and alpha_mask are white!\n");
return GFX_ERROR;
}
diff --git a/engines/sci/gfx/gfx_tools.cpp b/engines/sci/gfx/gfx_tools.cpp
index 75a742b743..23d8bd3820 100644
--- a/engines/sci/gfx/gfx_tools.cpp
+++ b/engines/sci/gfx/gfx_tools.cpp
@@ -183,7 +183,7 @@ gfx_pixmap_t *gfx_pixmap_alloc_index_data(gfx_pixmap_t *pixmap) {
int size;
if (pixmap->index_data) {
- GFXWARN("Attempt to allocate pixmap index data twice");
+ GFXWARN("Attempt to allocate pixmap index data twice!\n");
return pixmap;
}
@@ -200,7 +200,7 @@ gfx_pixmap_t *gfx_pixmap_alloc_index_data(gfx_pixmap_t *pixmap) {
gfx_pixmap_t *gfx_pixmap_free_index_data(gfx_pixmap_t *pixmap) {
if (!pixmap->index_data) {
- GFXWARN("Attempt to free pixmap index data twice");
+ GFXWARN("Attempt to free pixmap index data twice!\n");
return pixmap;
}
@@ -213,7 +213,7 @@ gfx_pixmap_t *gfx_pixmap_alloc_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
int size;
if (pixmap->data) {
- GFXWARN("Attempt to allocate pixmap data twice");
+ GFXWARN("Attempt to allocate pixmap data twice!\n");
return pixmap;
}
@@ -235,7 +235,7 @@ gfx_pixmap_t *gfx_pixmap_alloc_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
gfx_pixmap_t *gfx_pixmap_free_data(gfx_pixmap_t *pixmap) {
if (!pixmap->data) {
- GFXWARN("Attempt to free pixmap data twice");
+ GFXWARN("Attempt to free pixmap data twice!\n");
return pixmap;
}
@@ -256,14 +256,14 @@ int gfx_alloc_color(gfx_palette_t *pal, gfx_pixmap_color_t *color) {
return GFX_OK;
if (pal->max_colors_nr <= 0) {
- GFXERROR("Palette has zero or less color entries");
+ GFXERROR("Palette has zero or less color entries!\n");
return GFX_ERROR;
}
if (color->global_index != GFX_COLOR_INDEX_UNMAPPED) {
#if 0
- GFXDEBUG("Attempt to allocate color twice: index 0x%d (%02x/%02x/%02x)",
+ GFXDEBUG("Attempt to allocate color twice: index 0x%d (%02x/%02x/%02x)!\n",
color->global_index, color->r, color->g, color->b);
#endif
return GFX_OK;
@@ -317,7 +317,7 @@ int gfx_free_color(gfx_palette_t *pal, gfx_pixmap_color_t *color) {
return GFX_OK;
if (color->global_index == GFX_COLOR_INDEX_UNMAPPED) {
- GFXWARN("Attempt to free unmapped color %02x/%02x/%02x", color->r, color->g, color->b);
+ GFXWARN("Attempt to free unmapped color %02x/%02x/%02x!\n", color->r, color->g, color->b);
BREAKPOINT();
return GFX_ERROR;
}
@@ -361,7 +361,7 @@ gfx_pixmap_t *gfx_pixmap_scale_index_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode
old_data = pixmap->index_data;
if (!old_data) {
- GFXERROR("Attempt to scale index data without index data");
+ GFXERROR("Attempt to scale index data without index data!\n");
return pixmap;
}
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index a3c3d96779..dbeeb38122 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -38,7 +38,7 @@ namespace Sci {
// Enable to debug stuff relevant for dirty rectsin widget management
#ifdef GFXW_DEBUG_DIRTY
-# define DDIRTY error("%s:%5d| ", __FILE__, __LINE__); fprintf
+# define DDIRTY fprintf(stderr, "%s:%5d| ", __FILE__, __LINE__); fprintf
#else
# define DDIRTY if (0) fprintf
#endif
@@ -61,19 +61,19 @@ gfx_pixmap_color_t default_colors[DEFAULT_COLORS_NR] = {{GFX_COLOR_SYSTEM, 0x00,
// Performs basic checks that apply to most functions
#define BASIC_CHECKS(error_retval) \
if (!state) { \
- GFXERROR("Null state"); \
+ GFXERROR("Null state!\n"); \
return error_retval; \
} \
if (!state->driver) { \
- GFXERROR("GFX driver invalid"); \
+ GFXERROR("GFX driver invalid!\n"); \
return error_retval; \
}
// How to determine whether colors have to be allocated
#define PALETTE_MODE state->driver->mode->palette
-#define DRAW_POINTER { int __x = _gfxop_draw_pointer(state); if (__x) { GFXERROR("Drawing the mouse pointer failed"); return __x;} }
-#define REMOVE_POINTER { int __x = _gfxop_remove_pointer(state); if (__x) { GFXERROR("Removing the mouse pointer failed"); return __x;} }
+#define DRAW_POINTER { int __x = _gfxop_draw_pointer(state); if (__x) { GFXERROR("Drawing the mouse pointer failed!\n"); return __x;} }
+#define REMOVE_POINTER { int __x = _gfxop_remove_pointer(state); if (__x) { GFXERROR("Removing the mouse pointer failed!\n"); return __x;} }
//#define GFXOP_DEBUG_DIRTY
@@ -235,7 +235,7 @@ static int _gfxop_install_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm) {
if ((error = driver->set_palette(driver, pxm->colors[i].global_index, pxm->colors[i].r,
pxm->colors[i].g, pxm->colors[i].b))) {
- GFXWARN("driver->set_palette(%d, %02x/%02x/%02x) failed",
+ GFXWARN("driver->set_palette(%d, %02x/%02x/%02x) failed!\n",
pxm->colors[i].global_index, pxm->colors[i].r, pxm->colors[i].g, pxm->colors[i].b);
if (error == GFX_FATAL)
@@ -283,7 +283,7 @@ static int _gfxop_draw_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm, int prior
error = driver->draw_pixmap(driver, pxm, priority, src, clipped_dest, static_buf ? GFX_BUFFER_STATIC : GFX_BUFFER_BACK);
if (error) {
- GFXERROR("driver->draw_pixmap() returned error");
+ GFXERROR("driver->draw_pixmap() returned error!\n");
return error;
}
@@ -432,7 +432,8 @@ gfx_dirty_rect_t *gfxdr_add_dirty(gfx_dirty_rect_t *base, rect_t box, int strate
box.yl = - box.yl;
}
#ifdef GFXOP_DEBUG_DIRTY
- error("Adding new dirty (%d %d %d %d)\n", GFX_PRINT_RECT(box));
+ fprintf(stderr, "Adding new dirty (%d %d %d %d)\n",
+ GFX_PRINT_RECT(box));
#endif
if (_gfxop_clip(&box, gfx_rect(0, 0, 320, 200)))
return base;
@@ -500,7 +501,8 @@ static int _gfxop_clear_dirty_rec(gfx_state_t *state, struct _dirty_rect *rect)
return GFX_OK;
#ifdef GFXOP_DEBUG_DIRTY
- error("\tClearing dirty (%d %d %d %d)\n", GFX_PRINT_RECT(rect->rect));
+ fprintf(stderr, "\tClearing dirty (%d %d %d %d)\n",
+ GFX_PRINT_RECT(rect->rect));
#endif
if (!state->fullscreen_override)
retval = _gfxop_update_box(state, rect->rect);
@@ -526,7 +528,7 @@ static int _gfxop_init_common(gfx_state_t *state, gfx_options_t *options, void *
state->options = options;
if (!((state->resstate = gfxr_new_resource_manager(state->version, state->options, state->driver, misc_payload)))) {
- GFXERROR("Failed to initialize resource manager");
+ GFXERROR("Failed to initialize resource manager!\n");
return GFX_FATAL;
}
@@ -1169,7 +1171,7 @@ int gfxop_draw_box(gfx_state_t *state, rect_t box, gfx_color_t color1, gfx_color
return drv->draw_filled_rect(drv, new_box, color1, color1, GFX_SHADE_FLAT);
else {
if (PALETTE_MODE) {
- GFXWARN("Attempting to draw shaded box in palette mode");
+ GFXWARN("Attempting to draw shaded box in palette mode!\n");
return GFX_ERROR;
}
@@ -1261,7 +1263,7 @@ int gfxop_set_visible_map(gfx_state_t *state, gfx_map_mask_t visible_map) {
break;
default:
- error("Invalid display map %d selected", visible_map);
+ fprintf(stderr, "Invalid display map %d selected!\n", visible_map);
return GFX_ERROR;
}
@@ -1289,7 +1291,7 @@ int gfxop_update(gfx_state_t *state) {
}
if (retval) {
- GFXERROR("Clearing the dirty rectangles failed");
+ GFXERROR("Clearing the dirty rectangles failed!\n");
}
if (state->tag_mode) {
@@ -1335,7 +1337,7 @@ int gfxop_disable_dirty_frames(gfx_state_t *state) {
#define MILLION 1000000
// Sure, this may seem silly, but it's too easy to miss a zero...)
-#define GFXOP_FULL_POINTER_REFRESH if (_gfxop_full_pointer_refresh(state)) { GFXERROR("Failed to do full pointer refresh"); return GFX_ERROR; }
+#define GFXOP_FULL_POINTER_REFRESH if (_gfxop_full_pointer_refresh(state)) { GFXERROR("Failed to do full pointer refresh!\n"); return GFX_ERROR; }
static int _gfxop_full_pointer_refresh(gfx_state_t *state) {
rect_t pointer_bounds;
@@ -1630,7 +1632,7 @@ sci_event_t gfxop_get_event(gfx_state_t *state, unsigned int mask) {
BASIC_CHECKS(error_event);
if (_gfxop_remove_pointer(state)) {
- GFXERROR("Failed to remove pointer before processing event");
+ GFXERROR("Failed to remove pointer before processing event!\n");
}
while (*seekerp && !((*seekerp)->event.type & mask))
@@ -1663,7 +1665,7 @@ sci_event_t gfxop_get_event(gfx_state_t *state, unsigned int mask) {
}
if (_gfxop_full_pointer_refresh(state)) {
- GFXERROR("Failed to update the mouse pointer");
+ GFXERROR("Failed to update the mouse pointer!\n");
return error_event;
}
@@ -1857,13 +1859,13 @@ int gfxop_new_pic(gfx_state_t *state, int nr, int flags, int default_palette) {
state->pic_unscaled = gfxr_get_pic(state->resstate, nr, GFX_MASK_VISUAL, flags, default_palette, 0);
if (!state->pic || !state->pic_unscaled) {
- GFXERROR("Could not retrieve background pic %d", nr);
+ GFXERROR("Could not retrieve background pic %d!\n", nr);
if (state->pic) {
- GFXERROR(" -- Inconsistency: scaled pic _was_ retrieved");
+ GFXERROR(" -- Inconsistency: scaled pic _was_ retrieved!\n");
}
if (state->pic_unscaled) {
- GFXERROR(" -- Inconsistency: unscaled pic _was_ retrieved");
+ GFXERROR(" -- Inconsistency: unscaled pic _was_ retrieved!\n");
}
state->pic = state->pic_unscaled = NULL;
@@ -1879,12 +1881,12 @@ int gfxop_add_to_pic(gfx_state_t *state, int nr, int flags, int default_palette)
BASIC_CHECKS(GFX_FATAL);
if (!state->pic) {
- GFXERROR("Attempt to add to pic with no pic active");
+ GFXERROR("Attempt to add to pic with no pic active!\n");
return GFX_ERROR;
}
if (!(state->pic = gfxr_add_to_pic(state->resstate, state->pic_nr, nr, GFX_MASK_VISUAL, flags, state->palette_nr, default_palette, 1))) {
- GFXERROR("Could not add pic #%d to pic #%d", state->pic_nr, nr);
+ GFXERROR("Could not add pic #%d to pic #%d!\n", state->pic_nr, nr);
return GFX_ERROR;
}
state->pic_unscaled = gfxr_add_to_pic(state->resstate, state->pic_nr, nr, GFX_MASK_VISUAL, flags,
@@ -2052,7 +2054,7 @@ int gfxop_draw_text(gfx_state_t *state, gfx_text_handle_t *handle, rect_t zone)
REMOVE_POINTER;
if (!handle) {
- GFXERROR("Attempt to draw text with NULL handle");
+ GFXERROR("Attempt to draw text with NULL handle!\n");
return GFX_ERROR;
}
@@ -2081,7 +2083,7 @@ int gfxop_draw_text(gfx_state_t *state, gfx_text_handle_t *handle, rect_t zone)
break;
default:
- GFXERROR("Invalid vertical alignment %d", handle->valign);
+ GFXERROR("Invalid vertical alignment %d!\n", handle->valign);
return GFX_FATAL; // Internal error...
}
@@ -2114,7 +2116,7 @@ int gfxop_draw_text(gfx_state_t *state, gfx_text_handle_t *handle, rect_t zone)
break;
default:
- GFXERROR("Invalid vertical alignment %d", handle->valign);
+ GFXERROR("Invalid vertical alignment %d!\n", handle->valign);
return GFX_FATAL; // Internal error...
}
@@ -2137,7 +2139,7 @@ gfx_pixmap_t *gfxop_grab_pixmap(gfx_state_t *state, rect_t area) {
rect_t resultzone; // Ignored for this application
BASIC_CHECKS(NULL);
if (_gfxop_remove_pointer(state)) {
- GFXERROR("Could not remove pointer");
+ GFXERROR("Could not remove pointer!\n");
return NULL;
}
@@ -2155,7 +2157,7 @@ int gfxop_draw_pixmap(gfx_state_t *state, gfx_pixmap_t *pxm, rect_t zone, Common
BASIC_CHECKS(GFX_ERROR);
if (!pxm) {
- GFXERROR("Attempt to draw NULL pixmap");
+ GFXERROR("Attempt to draw NULL pixmap!\n");
return GFX_ERROR;
}
diff --git a/engines/sci/gfx/resmgr.cpp b/engines/sci/gfx/resmgr.cpp
index 1d31a57d32..654a859896 100644
--- a/engines/sci/gfx/resmgr.cpp
+++ b/engines/sci/gfx/resmgr.cpp
@@ -68,7 +68,7 @@ gfx_resstate_t *gfxr_new_resource_manager(int version, gfx_options_t *options, g
else {
tree = sbtree_new(entries_nr, resources);
if (!tree) {
- GFXWARN("Failed to allocate tree for %d entries of resource type %d", entries_nr, i);
+ GFXWARN("Failed to allocate tree for %d entries of resource type %d!\n", entries_nr, i);
}
state->resource_trees[i] = tree;
free(resources);
@@ -274,7 +274,7 @@ gfxr_pic_t *gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags, int
pic = gfxr_interpreter_init_pic(state->version, state->driver->mode, GFXR_RES_ID(restype, nr), state->misc_payload);
if (!pic) {
- GFXERROR("Failed to allocate scaled pic");
+ GFXERROR("Failed to allocate scaled pic!\n");
return NULL;
}
@@ -284,7 +284,7 @@ gfxr_pic_t *gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags, int
unscaled_pic = gfxr_interpreter_init_pic(state->version, &mode_1x1_color_index, GFXR_RES_ID(restype, nr),
state->misc_payload);
if (!unscaled_pic) {
- GFXERROR("Failed to allocate unscaled pic");
+ GFXERROR("Failed to allocate unscaled pic!\n");
return NULL;
}
gfxr_interpreter_clear_pic(state->version, unscaled_pic, state->misc_payload);
diff --git a/engines/sci/gfx/resource/sci_pic_0.cpp b/engines/sci/gfx/resource/sci_pic_0.cpp
index 246794a6d7..43eea3bcc3 100644
--- a/engines/sci/gfx/resource/sci_pic_0.cpp
+++ b/engines/sci/gfx/resource/sci_pic_0.cpp
@@ -362,11 +362,11 @@ static void _gfxr_auxbuf_spread(gfxr_pic_t *pic, int *min_x, int *min_y, int *ma
#ifdef FILL_RECURSIVE_DEBUG
if (!fillmagc) {
- error("------------------------------------------------\n");
- error("LineID: ");
+ fprintf(stderr, "------------------------------------------------\n");
+ fprintf(stderr, "LineID: ");
for (i = 0; i < 5; i++)
- error(" %d ", i);
- error("\n");
+ fprintf(stderr, " %d ", i);
+ fprintf(stderr, "\n");
}
#endif
@@ -466,10 +466,10 @@ static void _gfxr_auxbuf_spread(gfxr_pic_t *pic, int *min_x, int *min_y, int *ma
#ifdef FILL_RECURSIVE_DEBUG
if (!fillmagc && intervals_nr) {
- error("AI L#%03d:", y);
+ fprintf(stderr, "AI L#%03d:", y);
for (int j = 0; j < intervals_nr; j++)
- error("%c[%03d,%03d]", intervals[ivi][j].tag ? ' ' : '-', intervals[ivi][j].xl, intervals[ivi][j].xr);
- error("\n");
+ fprintf(stderr, "%c[%03d,%03d]", intervals[ivi][j].tag ? ' ' : '-', intervals[ivi][j].xl, intervals[ivi][j].xr);
+ fprintf(stderr, "\n");
}
#endif
@@ -614,7 +614,7 @@ static void _gfxr_fill_ellipse(gfxr_pic_t *pic, byte *buffer, int linewidth, int
break;
default:
- error("%s L%d: Invalid ellipse fill mode", __FILE__, __LINE__);
+ fprintf(stderr, "%s L%d: Invalid ellipse fill mode!\n", __FILE__, __LINE__);
return;
}
@@ -916,7 +916,8 @@ static inline void _gfxr_draw_subline(gfxr_pic_t *pic, int x, int y, int ex, int
end.y = ey;
if (ex >= pic->visual_map->index_xl || ey >= pic->visual_map->index_yl || x < 0 || y < 0) {
- error("While drawing pic0: INVALID LINE %d,%d,%d,%d\n", start.x, start.y, end.x, end.y);
+ fprintf(stderr, "While drawing pic0: INVALID LINE %d,%d,%d,%d\n",
+ start.x, start.y, end.x, end.y);
return;
}
@@ -1233,7 +1234,7 @@ void gfxr_remove_artifacts_pic0(gfxr_pic_t *dest, gfxr_pic_t *src) {
assert(src->mode->yfact == 1);
if (bound_x == 1 && bound_y == 1) {
- GFXWARN("attempt to remove artifacts from unscaled pic");
+ GFXWARN("attempt to remove artifacts from unscaled pic!\n");
return;
}
@@ -1406,12 +1407,12 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size,
GET_ABS_COORDS(oldx, oldy);
while (*(resource + pos) < PIC_OP_FIRST) {
#if 0
- error("Medium-line: [%04x] from %d,%d, data %02x %02x (dx=%d)", pos, oldx, oldy,
+ fprintf(stderr, "Medium-line: [%04x] from %d,%d, data %02x %02x (dx=%d)", pos, oldx, oldy,
0xff & resource[pos], 0xff & resource[pos+1], *((signed char *) resource + pos + 1));
#endif
GET_MEDREL_COORDS(oldx, oldy);
#if 0
- error(" to %d,%d\n", x, y);
+ fprintf(stderr, " to %d,%d\n", x, y);
#endif
_gfxr_draw_line(pic, oldx, oldy, x, y, color, priority, control, drawenable, line_mode,
PIC_OP_MEDIUM_LINES, sci_titlebar_size);
@@ -1675,7 +1676,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size,
// *if it's not for some reason, we should die
if (!(view->flags & GFX_PIXMAP_FLAG_EXTERNAL_PALETTE) && !sci1) {
- sciprintf("gfx_draw_pic0(): can't set a non-static palette for an embedded view");
+ sciprintf("gfx_draw_pic0(): can't set a non-static palette for an embedded view!\n");
}
// For SCI0, use special color mapping to copy the low
@@ -1858,7 +1859,7 @@ void gfxr_dither_pic0(gfxr_pic_t *pic, int dmode, int pattern) {
break;
default:
- GFXERROR("Invalid dither mode %d", dmode);
+ GFXERROR("Invalid dither mode %d!\n", dmode);
return;
}
diff --git a/engines/sci/gfx/resource/sci_view_1.cpp b/engines/sci/gfx/resource/sci_view_1.cpp
index a268cba1dd..1a395e93f1 100644
--- a/engines/sci/gfx/resource/sci_view_1.cpp
+++ b/engines/sci/gfx/resource/sci_view_1.cpp
@@ -341,7 +341,7 @@ gfxr_view_t *gfxr_draw_view1(int id, byte *resource, int size, gfx_pixmap_color_
return NULL;
}
- //error("View flags are 0x%02x\n", resource[3]);
+ /* fprintf(stderr, "View flags are 0x%02x\n", resource[3]);*/
/*
for (i = 0; i < V1_MAGICS_NR; i++)
diff --git a/engines/sci/gfx/sbtree.cpp b/engines/sci/gfx/sbtree.cpp
index 1893b0c711..fd7e7f0197 100644
--- a/engines/sci/gfx/sbtree.cpp
+++ b/engines/sci/gfx/sbtree.cpp
@@ -25,7 +25,7 @@
// Static binary lookup tree lookup
-#include "common/util.h"
+
#include "sci/include/sci_memory.h"
#include "sci/include/sbtree.h"
#include <stdlib.h>
@@ -82,14 +82,14 @@ sbtree_t *sbtree_new(int size, int *keys) {
table[i].key = NOT_A_KEY;
if (!table) {
- error("SBTree: Out of memory: Could not allocate %d cells\n", table_size);
+ fprintf(stderr, "SBTree: Out of memory: Could not allocate %d cells\n", table_size);
return NULL;
}
tree = (sbtree_t *)sci_malloc(sizeof(sbtree_t));
if (!tree) {
- error("SBTree: Could not allocate tree structure\n");
+ fprintf(stderr, "SBTree: Could not allocate tree structure\n");
free(table);
return NULL;
}
@@ -101,7 +101,7 @@ sbtree_t *sbtree_new(int size, int *keys) {
tree->levels = levels;
tree->entries_nr = size;
if ((tree->min_entry = keys[0]) < 0) {
- error("SBTree: Error: Using negative keys\n");
+ fprintf(stderr, "SBTree: Error: Using negative keys\n");
free(table);
free(tree);
return NULL;
@@ -114,7 +114,7 @@ sbtree_t *sbtree_new(int size, int *keys) {
void sbtree_free(sbtree_t *tree) {
if (!tree) {
- error("SBTree: Attempt to free NULL sbtree\n");
+ fprintf(stderr, "SBTree: Attempt to free NULL sbtree\n");
return;
}
@@ -174,24 +174,24 @@ static void sbtree_print(sbtree_t *tree) {
int l, i;
sbcell_t *cells = (sbcell_t *)tree->data;
- error("\tTree:\n");
+ fprintf(stderr, "\tTree:\n");
for (l = 0; l <= tree->levels; l++) {
- error("\t ");
+ fprintf(stderr, "\t ");
for (i = 0; i < (1 << l); i++) {
if (cells->key == NOT_A_KEY)
- error("-- ");
+ fprintf(stderr, "-- ");
else {
if (cells->value)
- error("%d+ ", cells->key);
+ fprintf(stderr, "%d+ ", cells->key);
else
- error("%d ", cells->key);
+ fprintf(stderr, "%d ", cells->key);
}
cells = cells + 1;
}
- error("\n");
+ fprintf(stderr, "\n");
}
- error("\n");
+ fprintf(stderr, "\n");
}
#endif
@@ -206,7 +206,7 @@ void *foreach_double_func(sbtree_t *tree, const int key, const void *value, void
int *real_value = (int *) value;
if (!real_value)
- error("foreach_double_func(): key %d mapped to non-value", key);
+ fprintf(stderr, "foreach_double_func(): key %d mapped to non-value!\n", key);
else
*real_value *= 2;
@@ -248,7 +248,7 @@ void insert_values(sbtree_t *tree, int nr, int *data) {
for (i = 0; i < nr; i++)
if (sbtree_set(tree, data[i], (void *)(data + i))) {
- error("While inserting: %d incorrectly deemed invalid\n", data[i]);
+ fprintf(stderr, "While inserting: %d incorrectly deemed invalid\n", data[i]);
any_error = 1;
}
}
@@ -275,18 +275,18 @@ void test_value(sbtree_t *tree, int times, int max, int numbers, int *data, int
found = 1;
if (found && !value) {
- error("!%d ", key);
+ fprintf(stderr, "!%d ", key);
++failed;
} else if (!found && found) {
- error("?[%d]=%d ", key, *value);
+ fprintf(stderr, "?[%d]=%d ", key, *value);
++failed;
}
}
if (failed)
- error("(%d/%d errors)\n", any_error = failed, times);
+ fprintf(stderr, "(%d/%d errors)\n", any_error = failed, times);
else
- error("OK\n");
+ fprintf(stderr, "OK\n");
}
void test_boundary(sbtree_t *tree, int max, int random) {
@@ -297,23 +297,23 @@ void test_boundary(sbtree_t *tree, int max, int random) {
int failure = (value_too_low || value_too_high || (!random && (!value_low || !value_high)));
if (!failure)
- error("OK\n");
+ fprintf(stderr, "OK\n");
else {
any_error = 1;
- error("Errors: ");
+ fprintf(stderr, "Errors: ");
if (value_too_low)
- error("too-low=%d ", *value_too_low);
+ fprintf(stderr, "too-low=%d ", *value_too_low);
if (value_too_high)
- error("too-high=%d ", *value_too_high);
+ fprintf(stderr, "too-high=%d ", *value_too_high);
if (!random) {
if (!value_low)
- error("!low ");
+ fprintf(stderr, "!low ");
if (!value_high)
- error("!high ");
+ fprintf(stderr, "!high ");
}
- error("\n");
+ fprintf(stderr, "\n");
}
}
@@ -326,15 +326,15 @@ void test_empty(sbtree_t *tree, int count, int max) {
int *value;
if ((value = (int *) sbtree_get(tree, key))) {
- error("?[%d]=%d\n", key, *value);
+ fprintf(stderr, "?[%d]=%d\n", key, *value);
++errors;
}
}
if (errors)
- error(" (%d/%d errors)\n", any_error = errors, count);
+ fprintf(stderr, " (%d/%d errors)\n", any_error = errors, count);
else
- error("OK\n");
+ fprintf(stderr, "OK\n");
}
void run_test(sbtree_t *tree, int entries, int *data, int random, int max_value) {
@@ -343,23 +343,23 @@ void run_test(sbtree_t *tree, int entries, int *data, int random, int max_value)
any_error = 0;
- error("\tEmpty test: \t\t\t");
+ fprintf(stderr, "\tEmpty test: \t\t\t");
test_empty(tree, entries * 2, entries + 1);
insert_values(tree, entries, data);
- error("\tBoundary test: \t\t\t");
+ fprintf(stderr, "\tBoundary test: \t\t\t");
test_boundary(tree, max_value, random);
for (i = 0; i < 3; i++) {
- error(tests[i]);
+ fprintf(stderr, tests[i]);
test_value(tree, entries * 2, entries * 2, entries, data, i);
}
if (!random) {
i = data[0];
sbtree_foreach(tree, NULL, foreach_double_func);
- error("\tForeach test: \t\t\t");
+ fprintf(stderr, "\tForeach test: \t\t\t");
if (i * 2 != data[0]) {
- error("Error: No effect: %d * 2 != %d\n", i, data[0]);
+ fprintf(stderr, "Error: No effect: %d * 2 != %d\n", i, data[0]);
any_error = 1;
} else
test_value(tree, entries * 2, entries * 2, entries, data, MODE_LINEAR_DOUBLE);
@@ -378,47 +378,46 @@ int main(int argc, char **argv) {
int tests_nr = TESTS_NR;
int test_sizes[TESTS_NR] = {1, 2, 3, 7, 8, 9, 1000, 16383, 16384, 16385, 1000000};
int i;
-
- error("sbtree.c Copyright (C) 2000 Christoph Reichenbach <jameson@linuxgames.com>\n"
+ fprintf(stderr, "sbtree.c Copyright (C) 2000 Christoph Reichenbach <jameson@linuxgames.com>\n"
"This program is provided WITHOUT WARRANTY of any kind\n"
"Please refer to the file COPYING that should have come with this program\n");
- error("Static Binary Tree testing facility\n");
+ fprintf(stderr, "Static Binary Tree testing facility\n");
free(malloc(42)); // Make sure libefence's Copyright message is print here if we're using it
- error("\nsbtree.c: Running %d tests.\n", tests_nr);
+ fprintf(stderr, "\nsbtree.c: Running %d tests.\n", tests_nr);
for (i = 0; i < tests_nr; i++) {
int entries = test_sizes[i];
sbtree_t *tree;
int *data;
- error("Test #%d: %d entries\n", i + 1, entries);
+ fprintf(stderr, "Test #%d: %d entries\n", i + 1, entries);
- error("\t%da: Linear values\n", i + 1);
+ fprintf(stderr, "\t%da: Linear values\n", i + 1);
data = generate_linear_forward(entries);
tree = sbtree_new(entries, data);
run_test(tree, entries, data, 0, entries);
- error("\t%db: Reverse linear values\n", i + 1);
+ fprintf(stderr, "\t%db: Reverse linear values\n", i + 1);
data = generate_linear_backward(entries);
tree = sbtree_new(entries, data);
run_test(tree, entries, data, 0, entries);
- error("\t%dc: Dense random values\n", i + 1);
+ fprintf(stderr, "\t%dc: Dense random values\n", i + 1);
data = generate_random(entries, 1 + (entries >> 2));
tree = sbtree_new(entries, data);
run_test(tree, entries, data, 1, 1 + (entries >> 2));
- error("\t%dc: Sparse random values\n", i + 1);
+ fprintf(stderr, "\t%dc: Sparse random values\n", i + 1);
data = generate_random(entries, (entries << 2));
tree = sbtree_new(entries, data);
run_test(tree, entries, data, 1, entries << 2);
- error("Test #%d completed.\n\n", i + 1);
+ fprintf(stderr, "Test #%d completed.\n\n", i + 1);
}
- error("Test suite completed.\n");
+ fprintf(stderr, "Test suite completed.\n");
return 0;
}
diff --git a/engines/sci/gfx/sci_widgets.cpp b/engines/sci/gfx/sci_widgets.cpp
index 320647715b..2a059b8641 100644
--- a/engines/sci/gfx/sci_widgets.cpp
+++ b/engines/sci/gfx/sci_widgets.cpp
@@ -76,14 +76,14 @@ void sciw_set_status_bar(EngineState *s, gfxw_port_t *status_bar, char *text, in
gfx_color_t black = s->ega_colors[0];
if (!status_bar->visual) {
- GFXERROR("Attempt to change title bar without visual");
+ GFXERROR("Attempt to change title bar without visual!\n");
return;
}
state = status_bar->visual->gfx_state;
if (!state) {
- GFXERROR("Attempt to change title bar with stateless visual");
+ GFXERROR("Attempt to change title bar with stateless visual!\n");
return;
}
@@ -211,7 +211,7 @@ gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t
if (!(flags & WINDOW_FLAG_NO_DROP_SHADOW)) {
if (gfxop_set_color(state, &black, 0, 0, 0, 0x80, bgcolor.priority, -1)) {
- GFXERROR("Could not get black/semitrans color entry");
+ GFXERROR("Could not get black/semitrans color entry!\n");
return NULL;
}
@@ -227,7 +227,7 @@ gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t
// Draw frame
if (gfxop_set_color(state, &black, 0, 0, 0, 0, bgcolor.priority, -1)) {
- GFXERROR("Could not get black color entry");
+ GFXERROR("Could not get black color entry!\n");
return NULL;
}
@@ -416,7 +416,7 @@ gfxw_list_t *sciw_new_icon_control(gfxw_port_t *port, reg_t ID, rect_t zone, int
gfxw_set_id(GFXW(list), ID.segment, ID.offset);
if (!port->visual) {
- GFXERROR("Attempting to create icon control for virtual port");
+ GFXERROR("Attempting to create icon control for virtual port!\n");
return NULL;
}
diff --git a/engines/sci/gfx/widgets.cpp b/engines/sci/gfx/widgets.cpp
index 107c89956a..6162ba6530 100644
--- a/engines/sci/gfx/widgets.cpp
+++ b/engines/sci/gfx/widgets.cpp
@@ -31,7 +31,7 @@ namespace Sci {
#undef GFXW_DEBUG_DIRTY // Enable to debug dirty rectangle propagation (writes to stderr)
#ifdef GFXW_DEBUG_DIRTY
-# define DDIRTY error("%s:%5d| ", __FILE__, __LINE__); fprintf
+# define DDIRTY fprintf(stderr, "%s:%5d| ", __FILE__, __LINE__); fprintf
#else
# define DDIRTY if (0) fprintf
#endif
@@ -48,7 +48,7 @@ int debug_widget_pos = 0;
static void _gfxw_debug_add_widget(gfxw_widget_t *widget) {
if (debug_widget_pos == GFXW_DEBUG_WIDGETS) {
- GFXERROR("WIDGET DEBUG: Allocated the maximum number of %d widgets- Aborting", GFXW_DEBUG_WIDGETS);
+ GFXERROR("WIDGET DEBUG: Allocated the maximum number of %d widgets- Aborting!\n", GFXW_DEBUG_WIDGETS);
BREAKPOINT();
}
debug_widgets[debug_widget_pos++] = widget;
@@ -66,12 +66,12 @@ static void _gfxw_debug_remove_widget(gfxw_widget_t *widget) {
}
if (found > 1) {
- GFXERROR("While removing widget: Found it %d times", found);
+ GFXERROR("While removing widget: Found it %d times!\n", found);
BREAKPOINT();
}
if (found == 0) {
- GFXERROR("Attempted removal of unregistered widget");
+ GFXERROR("Attempted removal of unregistered widget!\n");
BREAKPOINT();
}
}
@@ -190,7 +190,7 @@ static void _gfxw_unallocate_widget(gfx_state_t *state, gfxw_widget_t *widget) {
if (text->text_handle) {
if (!state) {
- GFXERROR("Attempt to free text without supplying mode to free it from");
+ GFXERROR("Attempt to free text without supplying mode to free it from!\n");
BREAKPOINT();
} else {
gfxop_free_text(state, text->text_handle);
@@ -208,7 +208,7 @@ static void _gfxw_unallocate_widget(gfx_state_t *state, gfxw_widget_t *widget) {
{ \
int retval = (_x); \
if (retval == GFX_ERROR) { \
- GFXERROR("Error occured while drawing widget"); \
+ GFXERROR("Error occured while drawing widget!\n"); \
return 1; \
} else if (retval == GFX_FATAL) { \
GFXERROR("Fatal error occured while drawing widget!\nGraphics state invalid; aborting program..."); \
@@ -299,7 +299,7 @@ void gfxw_remove_widget_from_container(gfxw_container_t *container, gfxw_widget_
gfxw_widget_t **seekerp;
if (!container) {
- GFXERROR("Attempt to remove widget from NULL container");
+ GFXERROR("Attempt to remove widget from NULL container!\n");
BREAKPOINT();
}
@@ -317,7 +317,7 @@ void gfxw_remove_widget_from_container(gfxw_container_t *container, gfxw_widget_
seekerp = &((*seekerp)->next);
if (!*seekerp) {
- GFXERROR("Internal error: Attempt to remove widget from container it was not contained in");
+ GFXERROR("Internal error: Attempt to remove widget from container it was not contained in!\n");
sciprintf("Widget:");
widget->print(GFXW(widget), 1);
sciprintf("Container:");
@@ -614,7 +614,7 @@ gfxw_view_t *_gfxw_new_simple_view(gfx_state_t *state, Common::Point pos, int vi
Common::Point offset;
if (!state) {
- GFXERROR("Attempt to create view widget with NULL state");
+ GFXERROR("Attempt to create view widget with NULL state!\n");
return NULL;
}
@@ -849,7 +849,7 @@ gfxw_dyn_view_t *gfxw_new_dyn_view(gfx_state_t *state, Common::Point pos, int z,
Common::Point offset;
if (!state) {
- GFXERROR("Attempt to create view widget with NULL state");
+ GFXERROR("Attempt to create view widget with NULL state!\n");
return NULL;
}
@@ -1434,7 +1434,7 @@ static int _gfxwop_list_equals(gfxw_widget_t *widget, gfxw_widget_t *other) {
return 0;
if (!GFXW_IS_LIST(widget)) {
- GFXWARN("_gfxwop_list_equals(): Method called on non-list");
+ GFXWARN("_gfxwop_list_equals(): Method called on non-list!\n");
widget->print(widget, 0);
sciprintf("\n");
return 0;
@@ -1622,9 +1622,9 @@ static int _gfxwop_visual_print(gfxw_widget_t *widget, int indentation) {
static int _gfxwop_visual_set_visual(gfxw_widget_t *self, gfxw_visual_t *visual) {
if (self != GFXW(visual)) {
- GFXWARN("Attempt to set a visual's parent visual to something else");
+ GFXWARN("Attempt to set a visual's parent visual to something else!\n");
} else {
- GFXWARN("Attempt to set a visual's parent visual");
+ GFXWARN("Attempt to set a visual's parent visual!\n");
}
return 1;
@@ -1709,7 +1709,7 @@ static int _gfxwop_port_free(gfxw_widget_t *widget) {
int ID = port->ID;
if (ID < 0 || ID >= visual->port_refs_nr) {
- GFXWARN("Attempt to free port #%d; allowed: [0..%d]", ID, visual->port_refs_nr);
+ GFXWARN("Attempt to free port #%d; allowed: [0..%d]!\n", ID, visual->port_refs_nr);
return GFX_ERROR;
}
@@ -1783,7 +1783,7 @@ static int _gfxwop_port_add_dirty(gfxw_container_t *widget, rect_t dirty, int pr
if (self->port_bg->superarea_of(self->port_bg, &foo)) {
gfxw_container_t *parent = self->parent;
while (parent) {
- error("Dirtifying parent id %d\n", parent->ID);
+ fprintf(stderr, "Dirtifying parent id %d\n", parent->ID);
parent->flags |= GFXW_FLAG_DIRTY;
parent = parent->parent;
}