diff options
Diffstat (limited to 'engines/sci/gfx')
-rw-r--r-- | engines/sci/gfx/font.cpp | 8 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_driver.cpp | 4 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_res_options.cpp | 20 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_resource.cpp | 4 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_support.cpp | 4 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_tools.cpp | 22 | ||||
-rw-r--r-- | engines/sci/gfx/operations.cpp | 54 | ||||
-rw-r--r-- | engines/sci/gfx/resmgr.cpp | 6 | ||||
-rw-r--r-- | engines/sci/gfx/resource/sci_pic_0.cpp | 32 | ||||
-rw-r--r-- | engines/sci/gfx/resource/sci_view_1.cpp | 2 | ||||
-rw-r--r-- | engines/sci/gfx/sbtree.cpp | 86 | ||||
-rw-r--r-- | engines/sci/gfx/sci_widgets.cpp | 10 | ||||
-rw-r--r-- | engines/sci/gfx/widgets.cpp | 36 |
13 files changed, 144 insertions, 144 deletions
diff --git a/engines/sci/gfx/font.cpp b/engines/sci/gfx/font.cpp index c7b2a242c5..0b25ba2edf 100644 --- a/engines/sci/gfx/font.cpp +++ b/engines/sci/gfx/font.cpp @@ -127,7 +127,7 @@ gfxr_scale_font_unfiltered(gfx_bitmap_font_t *orig_font, gfx_mode_t *mode) { 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!\n"); + GFXWARN("This function hasn't been tested yet"); switch (filter) { @@ -135,7 +135,7 @@ gfxr_scale_font(gfx_bitmap_font_t *orig_font, gfx_mode_t *mode, gfxr_font_scale_ return gfxr_scale_font_unfiltered(orig_font, mode); default: - GFXERROR("Invalid font filter mode %d!\n", filter); + GFXERROR("Invalid font filter mode %d", filter); return NULL; } } @@ -318,7 +318,7 @@ gfxr_draw_font(gfx_bitmap_font_t *font, const char *stext, int characters, int ch = (int) text[i]; if (ch >= font->chars_nr) { - GFXERROR("Invalid character 0x%02x encountered!\n", text[i]); + GFXERROR("Invalid character 0x%02x encountered", text[i]); return NULL; } @@ -329,7 +329,7 @@ gfxr_draw_font(gfx_bitmap_font_t *font, const char *stext, int characters, pxm->colors_nr = !!fg0 + !!fg1 + !!bg; if (pxm->colors_nr == 0) { - GFXWARN("Pixmap would have zero colors, resetting!\n"); + GFXWARN("Pixmap would have zero colors, resetting"); 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 85194a0858..841ab04b8b 100644 --- a/engines/sci/gfx/gfx_driver.cpp +++ b/engines/sci/gfx/gfx_driver.cpp @@ -252,7 +252,7 @@ scummvm_grab_pixmap(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t *pxm, break; case GFX_MASK_PRIORITY: - printf("FIXME: priority map grab not implemented yet!\n"); + printf("FIXME: priority map grab not implemented yet"); break; default: @@ -306,7 +306,7 @@ scummvm_update(struct _gfx_driver *drv, rect_t src, Common::Point dest, gfx_buff S->update_screen = true; break; default: - GFXERROR("Invalid buffer %d in update!\n", buffer); + GFXERROR("Invalid buffer %d in update", buffer); return GFX_ERROR; } diff --git a/engines/sci/gfx/gfx_res_options.cpp b/engines/sci/gfx/gfx_res_options.cpp index 230d69e0a7..d61bfb57e9 100644 --- a/engines/sci/gfx/gfx_res_options.cpp +++ b/engines/sci/gfx/gfx_res_options.cpp @@ -45,7 +45,7 @@ matches_patternlist(gfx_res_pattern_t *patterns, int nr, int val) { #ifdef DEBUG static void print_pattern(gfx_res_pattern_t *pat) { - fprintf(stderr, "[%d..%d]", + error("[%d..%d]", pat->min, pat->max); } #endif @@ -56,24 +56,24 @@ resource_matches_patternlists(gfx_res_conf_t *conf, int loc; #ifdef DEBUG int i; - fprintf(stderr, "[DEBUG:gfx-res] Trying to match against %d/%d/%d choices\n", + error("[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++) { - fprintf(stderr, "[DEBUG:gfx-res] Pat #%d: ", i); + error("[DEBUG:gfx-res] Pat #%d: ", i); print_pattern(conf->patterns + i); - fprintf(stderr, "\n"); + error("\n"); } loc = conf->patterns_nr; for (i = 0; i < conf->loops_nr; i++) { - fprintf(stderr, "[DEBUG:gfx-res] Loop #%d: ", i); + error("[DEBUG:gfx-res] Loop #%d: ", i); print_pattern(conf->patterns + i + loc); - fprintf(stderr, "\n"); + error("\n"); } loc += conf->loops_nr; for (i = 0; i < conf->cels_nr; i++) { - fprintf(stderr, "[DEBUG:gfx-res] Cel #%d: ", i); + error("[DEBUG:gfx-res] Cel #%d: ", i); print_pattern(conf->patterns + i + loc); - fprintf(stderr, "\n"); + error("\n"); } #endif if (conf->patterns_nr && @@ -114,7 +114,7 @@ find_match(gfx_res_conf_t *conflist, if (resource_matches_patternlists(conflist, type, nr, loop, cel)) { #ifdef DEBUG - fprintf(stderr, "[DEBUG:gfx-res] Found match!\n"); + error("[DEBUG:gfx-res] Found match"); #endif return conflist; } @@ -187,7 +187,7 @@ gfx_get_res_config(gfx_options_t *options, gfx_pixmap_t *pxm) { gfx_res_conf_t *conf; #ifdef DEBUG - fprintf(stderr, "[DEBUG:gfx-res] Trying to conf %d/%d/%d/%d (ID=%d)\n", + error("[DEBUG:gfx-res] Trying to conf %d/%d/%d/%d (ID=%d)\n", restype, nr, loop, cel, pxm->ID); #endif diff --git a/engines/sci/gfx/gfx_resource.cpp b/engines/sci/gfx/gfx_resource.cpp index c454d23d93..43e49dcad7 100644 --- a/engines/sci/gfx/gfx_resource.cpp +++ b/engines/sci/gfx/gfx_resource.cpp @@ -203,7 +203,7 @@ gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode) { break; default: - fprintf(stderr, "gfxr_endianness_adjust(): Cannot adjust endianness for %d bytespp!\n", bytespp); + error("gfxr_endianness_adjust(): Cannot adjust endianness for %d bytespp", bytespp); return NULL; } @@ -369,7 +369,7 @@ gfx_xlate_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode, gfx_xlate_filter_t filter) 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)!\n", + GFXWARN("Failed to allocate color %d/%d in pixmap (color %02x/%02x/%02x)", 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 18734b1006..81abaae6d1 100644 --- a/engines/sci/gfx/gfx_support.cpp +++ b/engines/sci/gfx/gfx_support.cpp @@ -77,7 +77,7 @@ gfx_draw_line_buffer(byte *buffer, int linewidth, int pixelwidth, Common::Point return; default: - GFXERROR("pixelwidth=%d not supported!\n", pixelwidth); + GFXERROR("pixelwidth=%d not supported", pixelwidth); return; } @@ -363,7 +363,7 @@ gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, alpha_mask = mode->alpha_mask; if (!alpha_mask && pxm->alpha_map) { - GFXERROR("Invalid alpha mode: both pxm->alpha_map and alpha_mask are white!\n"); + GFXERROR("Invalid alpha mode: both pxm->alpha_map and alpha_mask are white"); return GFX_ERROR; } diff --git a/engines/sci/gfx/gfx_tools.cpp b/engines/sci/gfx/gfx_tools.cpp index 1aded808d7..5cf195f80a 100644 --- a/engines/sci/gfx/gfx_tools.cpp +++ b/engines/sci/gfx/gfx_tools.cpp @@ -213,7 +213,7 @@ gfx_pixmap_alloc_index_data(gfx_pixmap_t *pixmap) { int size; if (pixmap->index_data) { - GFXWARN("Attempt to allocate pixmap index data twice!\n"); + GFXWARN("Attempt to allocate pixmap index data twice"); return pixmap; } @@ -232,7 +232,7 @@ 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!\n"); + GFXWARN("Attempt to free pixmap index data twice"); return pixmap; } @@ -247,7 +247,7 @@ gfx_pixmap_alloc_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) { int size; if (pixmap->data) { - GFXWARN("Attempt to allocate pixmap data twice!\n"); + GFXWARN("Attempt to allocate pixmap data twice"); return pixmap; } @@ -271,7 +271,7 @@ 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!\n"); + GFXWARN("Attempt to free pixmap data twice"); return pixmap; } @@ -293,14 +293,14 @@ 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!\n"); + GFXERROR("Palette has zero or less color entries"); 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)!\n", + GFXDEBUG("Attempt to allocate color twice: index 0x%d (%02x/%02x/%02x)", color->global_index, color->r, color->g, color->b); #endif return GFX_OK; @@ -343,7 +343,7 @@ gfx_alloc_color(gfx_palette_t *pal, gfx_pixmap_color_t *color) { color->global_index = bestcolor; -// GFXWARN("Out of palette colors- doing approximated mapping!\n"); +// GFXWARN("Out of palette colors- doing approximated mapping"); return GFX_OK; } @@ -356,19 +356,19 @@ 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!\n", color->r, color->g, color->b); + GFXWARN("Attempt to free unmapped color %02x/%02x/%02x", color->r, color->g, color->b); BREAKPOINT(); return GFX_ERROR; } if (color->global_index >= pal->max_colors_nr) { - GFXERROR("Attempt to free invalid color index %d (%02x/%02x/%02x)!\n", + GFXERROR("Attempt to free invalid color index %d (%02x/%02x/%02x)", color->global_index, color->r, color->g, color->b); return GFX_ERROR; } if (!palette_color->lockers) { - GFXERROR("Attempt to free unused color index %d (%02x/%02x/%02x)!\n", + GFXERROR("Attempt to free unused color index %d (%02x/%02x/%02x)", color->global_index, color->r, color->g, color->b); return GFX_ERROR; } @@ -403,7 +403,7 @@ 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!\n"); + GFXERROR("Attempt to scale index data without index data"); return pixmap; } diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index d1f19032e4..7045583b56 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -36,7 +36,7 @@ ** in widget management */ #ifdef GFXW_DEBUG_DIRTY -# define DDIRTY fprintf(stderr, "%s:%5d| ", __FILE__, __LINE__); fprintf +# define DDIRTY error("%s:%5d| ", __FILE__, __LINE__); fprintf #else # define DDIRTY if (0) fprintf #endif @@ -59,19 +59,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!\n"); \ + GFXERROR("Null state"); \ return error_retval; \ } \ if (!state->driver) { \ - GFXERROR("GFX driver invalid!\n"); \ + GFXERROR("GFX driver invalid"); \ 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!\n"); return __x;} } -#define REMOVE_POINTER { int __x = _gfxop_remove_pointer(state); if (__x) { GFXERROR("Removing the mouse pointer failed!\n"); return __x;} } +#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 GFXOP_DEBUG_DIRTY */ @@ -199,7 +199,7 @@ _gfxop_grab_pixmap(gfx_state_t *state, gfx_pixmap_t **pxmp, int x, int y, int x,y; \ \ if (!pxm->index_data) { \ - GFXERROR("Attempt to draw control color %d on pixmap %d/%d/%d without index data!\n", \ + GFXERROR("Attempt to draw control color %d on pixmap %d/%d/%d without index data", \ color, pxm->ID, pxm->loop, pxm->cel); \ return; \ } \ @@ -250,7 +250,7 @@ _gfxop_install_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm) { pxm->colors[i].g, pxm->colors[i].b))) { - GFXWARN("driver->set_palette(%d, %02x/%02x/%02x) failed!\n", + GFXWARN("driver->set_palette(%d, %02x/%02x/%02x) failed", pxm->colors[i].global_index, pxm->colors[i].r, pxm->colors[i].g, @@ -308,7 +308,7 @@ _gfxop_draw_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm, int priority, int co static_buf ? GFX_BUFFER_STATIC : GFX_BUFFER_BACK); if (error) { - GFXERROR("driver->draw_pixmap() returned error!\n"); + GFXERROR("driver->draw_pixmap() returned error"); return error; } return GFX_OK; @@ -479,7 +479,7 @@ gfxdr_add_dirty(gfx_dirty_rect_t *base, rect_t box, int strategy) { box.yl = - box.yl; } #ifdef GFXOP_DEBUG_DIRTY - fprintf(stderr, "Adding new dirty (%d %d %d %d)\n", + error("Adding new dirty (%d %d %d %d)\n", GFX_PRINT_RECT(box)); #endif if (_gfxop_clip(&box, gfx_rect(0, 0, 320, 200))) @@ -552,7 +552,7 @@ _gfxop_clear_dirty_rec(gfx_state_t *state, struct _dirty_rect *rect) { return GFX_OK; #ifdef GFXOP_DEBUG_DIRTY - fprintf(stderr, "\tClearing dirty (%d %d %d %d)\n", + error("\tClearing dirty (%d %d %d %d)\n", GFX_PRINT_RECT(rect->rect)); #endif if (!state->fullscreen_override) @@ -585,7 +585,7 @@ _gfxop_init_common(gfx_state_t *state, gfx_options_t *options, void *misc_payloa state->options, state->driver, misc_payload)))) { - GFXERROR("Failed to initialize resource manager!\n"); + GFXERROR("Failed to initialize resource manager"); return GFX_FATAL; } @@ -1276,7 +1276,7 @@ gfxop_draw_box(gfx_state_t *state, rect_t box, gfx_color_t color1, gfx_color_t c 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!\n"); + GFXWARN("Attempting to draw shaded box in palette mode"); return GFX_ERROR; } @@ -1376,7 +1376,7 @@ gfxop_set_visible_map(gfx_state_t *state, gfx_map_mask_t visible_map) { break; default: - fprintf(stderr, "Invalid display map %d selected!\n", visible_map); + error("Invalid display map %d selected", visible_map); return GFX_ERROR; } @@ -1404,7 +1404,7 @@ gfxop_update(gfx_state_t *state) { } if (retval) { - GFXERROR("Clearing the dirty rectangles failed!\n"); + GFXERROR("Clearing the dirty rectangles failed"); } if (state->tag_mode) { @@ -1457,7 +1457,7 @@ gfxop_disable_dirty_frames(gfx_state_t *state) { /* 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!\n"); return GFX_ERROR; } +#define GFXOP_FULL_POINTER_REFRESH if (_gfxop_full_pointer_refresh(state)) { GFXERROR("Failed to do full pointer refresh"); return GFX_ERROR; } static int _gfxop_full_pointer_refresh(gfx_state_t *state) { @@ -1774,7 +1774,7 @@ 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!\n"); + GFXERROR("Failed to remove pointer before processing event"); } while (*seekerp && !((*seekerp)->event.type & mask)) @@ -1807,7 +1807,7 @@ gfxop_get_event(gfx_state_t *state, unsigned int mask) { } if (_gfxop_full_pointer_refresh(state)) { - GFXERROR("Failed to update the mouse pointer!\n"); + GFXERROR("Failed to update the mouse pointer"); return error_event; } @@ -2043,13 +2043,13 @@ 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!\n", nr); + GFXERROR("Could not retrieve background pic %d", nr); if (state->pic) { - GFXERROR(" -- Inconsistency: scaled pic _was_ retrieved!\n"); + GFXERROR(" -- Inconsistency: scaled pic _was_ retrieved"); } if (state->pic_unscaled) { - GFXERROR(" -- Inconsistency: unscaled pic _was_ retrieved!\n"); + GFXERROR(" -- Inconsistency: unscaled pic _was_ retrieved"); } state->pic = state->pic_unscaled = NULL; @@ -2067,13 +2067,13 @@ 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!\n"); + GFXERROR("Attempt to add to pic with no pic active"); 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!\n", state->pic_nr, nr); + GFXERROR("Could not add pic #%d to pic #%d", state->pic_nr, nr); return GFX_ERROR; } state->pic_unscaled = gfxr_add_to_pic(state->resstate, state->pic_nr, nr, @@ -2264,7 +2264,7 @@ 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!\n"); + GFXERROR("Attempt to draw text with NULL handle"); return GFX_ERROR; } @@ -2293,7 +2293,7 @@ gfxop_draw_text(gfx_state_t *state, gfx_text_handle_t *handle, rect_t zone) { break; default: - GFXERROR("Invalid vertical alignment %d!\n", handle->valign); + GFXERROR("Invalid vertical alignment %d", handle->valign); return GFX_FATAL; /* Internal error... */ } @@ -2326,7 +2326,7 @@ gfxop_draw_text(gfx_state_t *state, gfx_text_handle_t *handle, rect_t zone) { break; default: - GFXERROR("Invalid vertical alignment %d!\n", handle->valign); + GFXERROR("Invalid vertical alignment %d", handle->valign); return GFX_FATAL; /* Internal error... */ } @@ -2352,7 +2352,7 @@ 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!\n"); + GFXERROR("Could not remove pointer"); return NULL; } @@ -2371,7 +2371,7 @@ gfxop_draw_pixmap(gfx_state_t *state, gfx_pixmap_t *pxm, rect_t zone, Common::Po BASIC_CHECKS(GFX_ERROR); if (!pxm) { - GFXERROR("Attempt to draw NULL pixmap!\n"); + GFXERROR("Attempt to draw NULL pixmap"); return GFX_ERROR; } diff --git a/engines/sci/gfx/resmgr.cpp b/engines/sci/gfx/resmgr.cpp index 1a4450baeb..b1bda530bf 100644 --- a/engines/sci/gfx/resmgr.cpp +++ b/engines/sci/gfx/resmgr.cpp @@ -70,7 +70,7 @@ gfxr_new_resource_manager(int version, gfx_options_t *options, else { tree = sbtree_new(entries_nr, resources); if (!tree) { - GFXWARN("Failed to allocate tree for %d entries of resource type %d!\n", entries_nr, i); + GFXWARN("Failed to allocate tree for %d entries of resource type %d", entries_nr, i); } state->resource_trees[i] = tree; free(resources); @@ -302,7 +302,7 @@ gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags, int default_pal state->misc_payload); if (!pic) { - GFXERROR("Failed to allocate scaled pic!\n"); + GFXERROR("Failed to allocate scaled pic"); return NULL; } @@ -314,7 +314,7 @@ gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags, int default_pal GFXR_RES_ID(restype, nr), state->misc_payload); if (!unscaled_pic) { - GFXERROR("Failed to allocate unscaled pic!\n"); + GFXERROR("Failed to allocate unscaled pic"); return NULL; } gfxr_interpreter_clear_pic(state->version, unscaled_pic, diff --git a/engines/sci/gfx/resource/sci_pic_0.cpp b/engines/sci/gfx/resource/sci_pic_0.cpp index ccb8790578..41ac4a1110 100644 --- a/engines/sci/gfx/resource/sci_pic_0.cpp +++ b/engines/sci/gfx/resource/sci_pic_0.cpp @@ -375,11 +375,11 @@ _gfxr_auxbuf_spread(gfxr_pic_t *pic, int *min_x, int *min_y, int *max_x, int *ma #ifdef FILL_RECURSIVE_DEBUG if (!fillmagc) { - fprintf(stderr, "------------------------------------------------\n"); - fprintf(stderr, "LineID: "); + error("------------------------------------------------\n"); + error("LineID: "); for (i = 0; i < 5; i++) - fprintf(stderr, " %d ", i); - fprintf(stderr, "\n"); + error(" %d ", i); + error("\n"); } #endif @@ -481,10 +481,10 @@ _gfxr_auxbuf_spread(gfxr_pic_t *pic, int *min_x, int *min_y, int *max_x, int *ma #ifdef FILL_RECURSIVE_DEBUG if (!fillmagc && intervals_nr) { - fprintf(stderr, "AI L#%03d:", y); + error("AI L#%03d:", y); for (int j = 0; j < intervals_nr; j++) - fprintf(stderr, "%c[%03d,%03d]", intervals[ivi][j].tag ? ' ' : '-', intervals[ivi][j].xl, intervals[ivi][j].xr); - fprintf(stderr, "\n"); + error("%c[%03d,%03d]", intervals[ivi][j].tag ? ' ' : '-', intervals[ivi][j].xl, intervals[ivi][j].xr); + error("\n"); } #endif @@ -631,7 +631,7 @@ _gfxr_fill_ellipse(gfxr_pic_t *pic, byte *buffer, int linewidth, int x, int y, break; default: - fprintf(stderr, "%s L%d: Invalid ellipse fill mode!\n", __FILE__, __LINE__); + error("%s L%d: Invalid ellipse fill mode", __FILE__, __LINE__); return; } @@ -968,7 +968,7 @@ _gfxr_draw_subline(gfxr_pic_t *pic, int x, int y, int ex, int ey, int color, int end.y = ey; if (ex >= pic->visual_map->index_xl || ey >= pic->visual_map->index_yl || x < 0 || y < 0) { - fprintf(stderr, "While drawing pic0: INVALID LINE %d,%d,%d,%d\n", + error("While drawing pic0: INVALID LINE %d,%d,%d,%d\n", start.x, start.y, end.x, end.y); return; } @@ -1307,7 +1307,7 @@ gfxr_remove_artifacts_pic0(gfxr_pic_t *dest, gfxr_pic_t *src) { if (bound_x == 1 && bound_y == 1) { /* D'Oh! */ - GFXWARN("attempt to remove artifacts from unscaled pic!\n"); + GFXWARN("attempt to remove artifacts from unscaled pic"); return; } @@ -1494,12 +1494,12 @@ 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 - fprintf(stderr, "Medium-line: [%04x] from %d,%d, data %02x %02x (dx=%d)", pos, oldx, oldy, + error("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 - fprintf(stderr, " to %d,%d\n", x, y); + error(" 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); @@ -1780,7 +1780,7 @@ 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!\n"); + sciprintf("gfx_draw_pic0(): can't set a non-static palette for an embedded view"); } /* For SCI0, use special color mapping to copy the low @@ -1832,7 +1832,7 @@ gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, if (!pic->internal) { pic->internal = sci_malloc(16 * sizeof(int)); } else { - GFXERROR("pic->internal is not NULL (%08x); this only occurs with overlaid pics, otherwise it's a bug!\n", pic->internal); + GFXERROR("pic->internal is not NULL (%08x); this only occurs with overlaid pics, otherwise it's a bug", pic->internal); } pri_table = (int*)pic->internal; @@ -1854,7 +1854,7 @@ gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, if (!pic->internal) { pic->internal = sci_malloc(16 * sizeof(int)); } else { - GFXERROR("pic->internal is not NULL (%08x); possible memory corruption!\n", pic->internal); + GFXERROR("pic->internal is not NULL (%08x); possible memory corruption", pic->internal); } pri_table = (int*)pic->internal; @@ -1980,7 +1980,7 @@ gfxr_dither_pic0(gfxr_pic_t *pic, int dmode, int pattern) { break; default: - GFXERROR("Invalid dither mode %d!\n", dmode); + GFXERROR("Invalid dither mode %d", dmode); return; } diff --git a/engines/sci/gfx/resource/sci_view_1.cpp b/engines/sci/gfx/resource/sci_view_1.cpp index 7f989b646a..aef02b694b 100644 --- a/engines/sci/gfx/resource/sci_view_1.cpp +++ b/engines/sci/gfx/resource/sci_view_1.cpp @@ -347,7 +347,7 @@ gfxr_draw_view1(int id, byte *resource, int size, gfx_pixmap_color_t *static_pal return NULL; } - /* fprintf(stderr, "View flags are 0x%02x\n", resource[3]);*/ + /* error("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 d5ef5ea510..5158feefad 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> @@ -84,14 +84,14 @@ sbtree_new(int size, int *keys) { table[i].key = NOT_A_KEY; if (!table) { - fprintf(stderr, "SBTree: Out of memory: Could not allocate %d cells\n", table_size); + error("SBTree: Out of memory: Could not allocate %d cells\n", table_size); return NULL; } tree = (sbtree_t*)sci_malloc(sizeof(sbtree_t)); if (!tree) { - fprintf(stderr, "SBTree: Could not allocate tree structure\n"); + error("SBTree: Could not allocate tree structure\n"); free(table); return NULL; } @@ -103,7 +103,7 @@ sbtree_new(int size, int *keys) { tree->levels = levels; tree->entries_nr = size; if ((tree->min_entry = keys[0]) < 0) { - fprintf(stderr, "SBTree: Error: Using negative keys\n"); + error("SBTree: Error: Using negative keys\n"); free(table); free(tree); return NULL; @@ -118,7 +118,7 @@ sbtree_new(int size, int *keys) { void sbtree_free(sbtree_t *tree) { if (!tree) { - fprintf(stderr, "SBTree: Attempt to free NULL sbtree\n"); + error("SBTree: Attempt to free NULL sbtree\n"); return; } @@ -188,24 +188,24 @@ sbtree_print(sbtree_t *tree) { int l, i; sbcell_t *cells = (sbcell_t *) tree->data; - fprintf(stderr, "\tTree:\n"); + error("\tTree:\n"); for (l = 0; l <= tree->levels; l++) { - fprintf(stderr, "\t "); + error("\t "); for (i = 0; i < (1 << l); i++) { if (cells->key == NOT_A_KEY) - fprintf(stderr, "-- "); + error("-- "); else { if (cells->value) - fprintf(stderr, "%d+ ", cells->key); + error("%d+ ", cells->key); else - fprintf(stderr, "%d ", cells->key); + error("%d ", cells->key); } cells = cells + 1; } - fprintf(stderr, "\n"); + error("\n"); } - fprintf(stderr, "\n"); + error("\n"); } #endif @@ -223,7 +223,7 @@ foreach_double_func(sbtree_t *tree, const int key, const void *value, void *args int *real_value = (int *) value; if (!real_value) - fprintf(stderr, "foreach_double_func(): key %d mapped to non-value!\n", key); + error("foreach_double_func(): key %d mapped to non-value", key); else *real_value *= 2; return real_value; @@ -267,7 +267,7 @@ insert_values(sbtree_t *tree, int nr, int *data) { for (i = 0; i < nr; i++) if (sbtree_set(tree, data[i], (void *)(data + i))) { - fprintf(stderr, "While inserting: %d incorrectly deemed invalid\n", data[i]); + error("While inserting: %d incorrectly deemed invalid\n", data[i]); any_error = 1; } } @@ -296,18 +296,18 @@ test_value(sbtree_t *tree, int times, int max, int numbers, int *data, int mode) found = 1; if (found && !value) { - fprintf(stderr, "!%d ", key); + error("!%d ", key); ++failed; } else if (!found && found) { - fprintf(stderr, "?[%d]=%d ", key, *value); + error("?[%d]=%d ", key, *value); ++failed; } } if (failed) - fprintf(stderr, "(%d/%d errors)\n", any_error = failed, times); + error("(%d/%d errors)\n", any_error = failed, times); else - fprintf(stderr, "OK\n"); + error("OK\n"); } @@ -320,23 +320,23 @@ test_boundary(sbtree_t *tree, int max, int random) { int failure = (value_too_low || value_too_high || (!random && (!value_low || !value_high))); if (!failure) - fprintf(stderr, "OK\n"); + error("OK\n"); else { any_error = 1; - fprintf(stderr, "Errors: "); + error("Errors: "); if (value_too_low) - fprintf(stderr, "too-low=%d ", *value_too_low); + error("too-low=%d ", *value_too_low); if (value_too_high) - fprintf(stderr, "too-high=%d ", *value_too_high); + error("too-high=%d ", *value_too_high); if (!random) { if (!value_low) - fprintf(stderr, "!low "); + error("!low "); if (!value_high) - fprintf(stderr, "!high "); + error("!high "); } - fprintf(stderr, "\n"); + error("\n"); } } @@ -351,15 +351,15 @@ test_empty(sbtree_t *tree, int count, int max) { int *value; if ((value = (int *) sbtree_get(tree, key))) { - fprintf(stderr, "?[%d]=%d\n", key, *value); + error("?[%d]=%d\n", key, *value); ++errors; } } if (errors) - fprintf(stderr, " (%d/%d errors)\n", any_error = errors, count); + error(" (%d/%d errors)\n", any_error = errors, count); else - fprintf(stderr, "OK\n"); + error("OK\n"); } void @@ -369,23 +369,23 @@ run_test(sbtree_t *tree, int entries, int *data, int random, int max_value) { any_error = 0; - fprintf(stderr, "\tEmpty test: \t\t\t"); + error("\tEmpty test: \t\t\t"); test_empty(tree, entries * 2, entries + 1); insert_values(tree, entries, data); - fprintf(stderr, "\tBoundary test: \t\t\t"); + error("\tBoundary test: \t\t\t"); test_boundary(tree, max_value, random); for (i = 0; i < 3; i++) { - fprintf(stderr, tests[i]); + error(tests[i]); test_value(tree, entries * 2, entries * 2, entries, data, i); } if (!random) { i = data[0]; sbtree_foreach(tree, NULL, foreach_double_func); - fprintf(stderr, "\tForeach test: \t\t\t"); + error("\tForeach test: \t\t\t"); if (i * 2 != data[0]) { - fprintf(stderr, "Error: No effect: %d * 2 != %d\n", i, data[0]); + error("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); @@ -406,46 +406,46 @@ 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; - fprintf(stderr, "sbtree.c Copyright (C) 2000 Christoph Reichenbach <jameson@linuxgames.com>\n" + error("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"); - fprintf(stderr, "Static Binary Tree testing facility\n"); + error("Static Binary Tree testing facility\n"); free(malloc(42)); /* Make sure libefence's Copyright message is print here if we're using it */ - fprintf(stderr, "\nsbtree.c: Running %d tests.\n", tests_nr); + error("\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; - fprintf(stderr, "Test #%d: %d entries\n", i + 1, entries); + error("Test #%d: %d entries\n", i + 1, entries); - fprintf(stderr, "\t%da: Linear values\n", i + 1); + error("\t%da: Linear values\n", i + 1); data = generate_linear_forward(entries); tree = sbtree_new(entries, data); run_test(tree, entries, data, 0, entries); - fprintf(stderr, "\t%db: Reverse linear values\n", i + 1); + error("\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); - fprintf(stderr, "\t%dc: Dense random values\n", i + 1); + error("\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)); - fprintf(stderr, "\t%dc: Sparse random values\n", i + 1); + error("\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); - fprintf(stderr, "Test #%d completed.\n\n", i + 1); + error("Test #%d completed.\n\n", i + 1); } - fprintf(stderr, "Test suite completed.\n"); + error("Test suite completed.\n"); return 0; } diff --git a/engines/sci/gfx/sci_widgets.cpp b/engines/sci/gfx/sci_widgets.cpp index 97e2a0acd0..e39c9a37c8 100644 --- a/engines/sci/gfx/sci_widgets.cpp +++ b/engines/sci/gfx/sci_widgets.cpp @@ -80,14 +80,14 @@ sciw_set_status_bar(state_t *s, gfxw_port_t *status_bar, char *text, int fgcolor gfx_color_t black = s->ega_colors[0]; if (!status_bar->visual) { - GFXERROR("Attempt to change title bar without visual!\n"); + GFXERROR("Attempt to change title bar without visual"); return; } state = status_bar->visual->gfx_state; if (!state) { - GFXERROR("Attempt to change title bar with stateless visual!\n"); + GFXERROR("Attempt to change title bar with stateless visual"); return; } @@ -224,7 +224,7 @@ sciw_new_window(state_t *s, rect_t area, int font, gfx_color_t color, gfx_color_ 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!\n"); + GFXERROR("Could not get black/semitrans color entry"); return NULL; } @@ -242,7 +242,7 @@ sciw_new_window(state_t *s, rect_t area, int font, gfx_color_t color, gfx_color_ /* Draw frame */ if (gfxop_set_color(state, &black, 0, 0, 0, 0, bgcolor.priority, -1)) { - GFXERROR("Could not get black color entry!\n"); + GFXERROR("Could not get black color entry"); return NULL; } @@ -461,7 +461,7 @@ sciw_new_icon_control(gfxw_port_t *port, reg_t ID, rect_t zone, int view, int lo gfxw_set_id(GFXW(list), ID.segment, ID.offset); if (!port->visual) { - GFXERROR("Attempting to create icon control for virtual port!\n"); + GFXERROR("Attempting to create icon control for virtual port"); return NULL; } diff --git a/engines/sci/gfx/widgets.cpp b/engines/sci/gfx/widgets.cpp index fc0a177a50..777d567a32 100644 --- a/engines/sci/gfx/widgets.cpp +++ b/engines/sci/gfx/widgets.cpp @@ -29,7 +29,7 @@ #undef GFXW_DEBUG_DIRTY /* Enable to debug dirty rectangle propagation (writes to stderr) */ #ifdef GFXW_DEBUG_DIRTY -# define DDIRTY fprintf(stderr, "%s:%5d| ", __FILE__, __LINE__); fprintf +# define DDIRTY error("%s:%5d| ", __FILE__, __LINE__); fprintf #else # define DDIRTY if (0) fprintf #endif @@ -47,7 +47,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!\n", GFXW_DEBUG_WIDGETS); + GFXERROR("WIDGET DEBUG: Allocated the maximum number of %d widgets- Aborting", GFXW_DEBUG_WIDGETS); BREAKPOINT(); } debug_widgets[debug_widget_pos++] = widget; @@ -67,12 +67,12 @@ _gfxw_debug_remove_widget(gfxw_widget_t *widget) { } if (found > 1) { - GFXERROR("While removing widget: Found it %d times!\n", found); + GFXERROR("While removing widget: Found it %d times", found); BREAKPOINT(); } if (found == 0) { - GFXERROR("Attempted removal of unregistered widget!\n"); + GFXERROR("Attempted removal of unregistered widget"); BREAKPOINT(); } } @@ -199,7 +199,7 @@ _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!\n"); + GFXERROR("Attempt to free text without supplying mode to free it from"); BREAKPOINT(); } else { gfxop_free_text(state, text->text_handle); @@ -217,7 +217,7 @@ _gfxw_unallocate_widget(gfx_state_t *state, gfxw_widget_t *widget) { { \ int retval = (_x); \ if (retval == GFX_ERROR) { \ - GFXERROR("Error occured while drawing widget!\n"); \ + GFXERROR("Error occured while drawing widget"); \ return 1; \ } else if (retval == GFX_FATAL) { \ GFXERROR("Fatal error occured while drawing widget!\nGraphics state invalid; aborting program..."); \ @@ -235,11 +235,11 @@ _gfxw_unallocate_widget(gfx_state_t *state, gfxw_widget_t *widget) { /* Assertion for drawing */ #define DRAW_ASSERT(widget, exp_type) \ if (!(widget)) { \ - sciprintf("L%d: NULL widget!\n", __LINE__); \ + sciprintf("L%d: NULL widget", __LINE__); \ return 1; \ } \ if (!(widget)->print) { \ - sciprintf("L%d: Widget of type %d does not have print function!\n", __LINE__, \ + sciprintf("L%d: Widget of type %d does not have print function", __LINE__, \ (widget)->type); \ } \ if ((widget)->type != (exp_type)) { \ @@ -324,7 +324,7 @@ gfxw_remove_widget_from_container(gfxw_container_t *container, gfxw_widget_t *wi gfxw_widget_t **seekerp; if (!container) { - GFXERROR("Attempt to remove widget from NULL container!\n"); + GFXERROR("Attempt to remove widget from NULL container"); BREAKPOINT(); } @@ -342,7 +342,7 @@ gfxw_remove_widget_from_container(gfxw_container_t *container, gfxw_widget_t *wi seekerp = &((*seekerp)->next); if (!*seekerp) { - GFXERROR("Internal error: Attempt to remove widget from container it was not contained in!\n"); + GFXERROR("Internal error: Attempt to remove widget from container it was not contained in"); sciprintf("Widget:"); widget->print(GFXW(widget), 1); sciprintf("Container:"); @@ -705,7 +705,7 @@ _gfxw_new_simple_view(gfx_state_t *state, Common::Point pos, int view, int loop, Common::Point offset; if (!state) { - GFXERROR("Attempt to create view widget with NULL state!\n"); + GFXERROR("Attempt to create view widget with NULL state"); return NULL; } @@ -988,7 +988,7 @@ gfxw_new_dyn_view(gfx_state_t *state, Common::Point pos, int z, int view, int lo Common::Point offset; if (!state) { - GFXERROR("Attempt to create view widget with NULL state!\n"); + GFXERROR("Attempt to create view widget with NULL state"); return NULL; } @@ -1657,7 +1657,7 @@ _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!\n"); + GFXWARN("_gfxwop_list_equals(): Method called on non-list"); widget->print(widget, 0); sciprintf("\n"); return 0; @@ -1866,9 +1866,9 @@ _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!\n"); + GFXWARN("Attempt to set a visual's parent visual to something else"); } else { - GFXWARN("Attempt to set a visual's parent visual!\n"); + GFXWARN("Attempt to set a visual's parent visual"); } return 1; } @@ -1967,12 +1967,12 @@ _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]!\n", ID, visual->port_refs_nr); + GFXWARN("Attempt to free port #%d; allowed: [0..%d]", ID, visual->port_refs_nr); return GFX_ERROR; } if (visual->port_refs[ID] != port) { - GFXWARN("While freeing port %d: Port is at %p, but port list indicates %p!\n", + GFXWARN("While freeing port %d: Port is at %p, but port list indicates %p", ID, port, visual->port_refs[ID]); } else visual->port_refs[ID] = NULL; @@ -2045,7 +2045,7 @@ _gfxwop_port_add_dirty(gfxw_container_t *widget, rect_t dirty, int propagate) { if (self->port_bg->superarea_of(self->port_bg, &foo)) { gfxw_container_t *parent = self->parent; while (parent) { - fprintf(stderr, "Dirtifying parent id %d\n", parent->ID); + error("Dirtifying parent id %d\n", parent->ID); parent->flags |= GFXW_FLAG_DIRTY; parent = parent->parent; } |