diff options
author | Travis Howell | 2009-07-07 07:09:56 +0000 |
---|---|---|
committer | Travis Howell | 2009-07-07 07:09:56 +0000 |
commit | dd4b02c34aaa8f3c7a9bb0ae3ce6dd8fe8f7cb41 (patch) | |
tree | 630e9935c335ee15bd704e76b0c8887f4efca242 /engines/sci/gfx | |
parent | c233459359ba43aeb6421469b32086036901a394 (diff) | |
parent | 0a8cd4a27d1b9ad7974697d6524b3455290f8990 (diff) | |
download | scummvm-rg350-dd4b02c34aaa8f3c7a9bb0ae3ce6dd8fe8f7cb41.tar.gz scummvm-rg350-dd4b02c34aaa8f3c7a9bb0ae3ce6dd8fe8f7cb41.tar.bz2 scummvm-rg350-dd4b02c34aaa8f3c7a9bb0ae3ce6dd8fe8f7cb41.zip |
Merged revisions 42163-42164,42167-42181,42196-42200 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
........
r42163 | Kirben | 2009-07-06 16:21:59 +1000 (Mon, 06 Jul 2009) | 1 line
Use graphics surfaces for screen buffers, and always use correct pitch when writing to the frameBuffer.
........
r42164 | Kirben | 2009-07-06 16:24:04 +1000 (Mon, 06 Jul 2009) | 1 line
Ooops, remove debug code.
........
r42167 | thebluegr | 2009-07-06 20:39:22 +1000 (Mon, 06 Jul 2009) | 1 line
Replaced sciprintf() calls with printf, DebugPrintf, warning and error calls
........
r42168 | thebluegr | 2009-07-06 21:10:35 +1000 (Mon, 06 Jul 2009) | 1 line
Fixed compilation
........
r42169 | thebluegr | 2009-07-06 21:15:42 +1000 (Mon, 06 Jul 2009) | 1 line
Added seChanged the warning displayed when a selector can't be mapped to a debugC - it's perfectly normal not to find certain selectors in certain SCI versions. Also, fixed the SCI version enums
........
r42170 | thebluegr | 2009-07-06 21:19:19 +1000 (Mon, 06 Jul 2009) | 1 line
Assigned several unimplemented/unused kernel functions as stubs, so that we know when they're used and how they're called
........
r42171 | drmccoy | 2009-07-06 21:19:37 +1000 (Mon, 06 Jul 2009) | 1 line
Splitting up the big evaluate() function
........
r42172 | thebluegr | 2009-07-06 21:33:28 +1000 (Mon, 06 Jul 2009) | 1 line
When a song isn't found, send a "stop handle" event so that the engine won't wait forever (e.g. in SQ4CD, perhaps others)
........
r42173 | dreammaster | 2009-07-06 22:33:05 +1000 (Mon, 06 Jul 2009) | 1 line
Removed all the current special cases coding for user (mouse press) waiting, and reimplemented it exactly the way the original did
........
r42174 | thebluegr | 2009-07-06 22:44:55 +1000 (Mon, 06 Jul 2009) | 1 line
Proper handling of sound effects marked as music resources
........
r42175 | joostp | 2009-07-06 23:09:50 +1000 (Mon, 06 Jul 2009) | 2 lines
add workaround for PSP compiler ICE
........
r42176 | drmccoy | 2009-07-06 23:52:47 +1000 (Mon, 06 Jul 2009) | 1 line
Loop over the string instead of copying and then editing it (hopefully, the PSP GCC won't ICE again here :P)
........
r42177 | jvprat | 2009-07-07 01:23:50 +1000 (Tue, 07 Jul 2009) | 2 lines
Groovie: Improve ROQ timing and audio sync (noticeable at least in the Clandestiny trailer)
........
r42178 | thebluegr | 2009-07-07 01:30:07 +1000 (Tue, 07 Jul 2009) | 1 line
KQ6CD should be working correctly again
........
r42179 | thebluegr | 2009-07-07 01:50:44 +1000 (Tue, 07 Jul 2009) | 1 line
Swapped the music and audio resource check for SCI1.1 games. Digital sound effects are now preferred over the synthesized ones
........
r42180 | lordhoto | 2009-07-07 02:17:03 +1000 (Tue, 07 Jul 2009) | 1 line
Fix RTL from Kyra3 main menu. (It now doesn't quit ScummVM anymore)
........
r42181 | thebluegr | 2009-07-07 02:22:14 +1000 (Tue, 07 Jul 2009) | 1 line
Renamed SCI_VERSION_01 -> SCI_VERSION_01_EGA
........
r42196 | dreammaster | 2009-07-07 11:14:55 +1000 (Tue, 07 Jul 2009) | 1 line
Bugfix so the game speed will correctly change after showing the credits when the game is restarted
........
r42197 | dreammaster | 2009-07-07 12:49:33 +1000 (Tue, 07 Jul 2009) | 1 line
Bugfix so that user delays work correctly
........
r42198 | dreammaster | 2009-07-07 12:51:42 +1000 (Tue, 07 Jul 2009) | 1 line
Added workaround to briefly pause when displaying the first message of the shooting cut-scene, so it can be read properly
........
r42199 | dreammaster | 2009-07-07 16:23:09 +1000 (Tue, 07 Jul 2009) | 1 line
Fix to the return values of the Op_GetMouseButton library function now allows the game's "Fisticuffs path" to work properly
........
r42200 | thebluegr | 2009-07-07 16:29:07 +1000 (Tue, 07 Jul 2009) | 1 line
Removed unused define
........
svn-id: r42203
Diffstat (limited to 'engines/sci/gfx')
-rw-r--r-- | engines/sci/gfx/font.cpp | 2 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_driver.cpp | 4 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_gui.cpp | 19 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_pixmap_scale.cpp | 10 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_resmgr.cpp | 10 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_state_internal.h | 2 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_support.cpp | 8 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_system.h | 3 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_tools.cpp | 2 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_widgets.cpp | 124 | ||||
-rw-r--r-- | engines/sci/gfx/menubar.cpp | 4 | ||||
-rw-r--r-- | engines/sci/gfx/operations.cpp | 127 | ||||
-rw-r--r-- | engines/sci/gfx/res_cursor.cpp | 2 | ||||
-rw-r--r-- | engines/sci/gfx/res_font.cpp | 16 | ||||
-rw-r--r-- | engines/sci/gfx/res_pal.cpp | 6 | ||||
-rw-r--r-- | engines/sci/gfx/res_pic.cpp | 16 | ||||
-rw-r--r-- | engines/sci/gfx/res_view.cpp | 10 |
17 files changed, 148 insertions, 217 deletions
diff --git a/engines/sci/gfx/font.cpp b/engines/sci/gfx/font.cpp index 0f1a19f1c0..9265cba040 100644 --- a/engines/sci/gfx/font.cpp +++ b/engines/sci/gfx/font.cpp @@ -186,7 +186,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!\n", text[i]); + error("Invalid character 0x%02x encountered", text[i]); return NULL; } diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp index 9457727b33..b71152822c 100644 --- a/engines/sci/gfx/gfx_driver.cpp +++ b/engines/sci/gfx/gfx_driver.cpp @@ -114,7 +114,7 @@ int GfxDriver::drawLine(Common::Point start, Common::Point end, gfx_color_t colo modeDrawProc = drawProc<4, uint32, 0>; break; default: - GFXERROR("Invalid mode->bytespp=%d\n", _mode->bytespp); + error("Invalid mode->bytespp=%d", _mode->bytespp); } if (color.mask & GFX_MASK_VISUAL) { @@ -237,7 +237,7 @@ int GfxDriver::update(rect_t src, Common::Point dest, gfx_buffer_t buffer) { break; } default: - GFXERROR("Invalid buffer %d in update!\n", buffer); + error("Invalid buffer %d in update", buffer); return GFX_ERROR; } diff --git a/engines/sci/gfx/gfx_gui.cpp b/engines/sci/gfx/gfx_gui.cpp index fb05c0fe29..218bf1523e 100644 --- a/engines/sci/gfx/gfx_gui.cpp +++ b/engines/sci/gfx/gfx_gui.cpp @@ -81,14 +81,14 @@ void sciw_set_status_bar(EngineState *s, GfxPort *status_bar, const Common::Stri gfx_color_t black = s->ega_colors[0]; if (!status_bar->_visual) { - GFXERROR("Attempt to change title bar without visual!\n"); + error("Attempt to change title bar without visual"); return; } state = status_bar->_visual->_gfxState; if (!state) { - GFXERROR("Attempt to change title bar with stateless visual!\n"); + error("Attempt to change title bar with stateless visual"); return; } @@ -121,7 +121,8 @@ void sciw_set_status_bar(EngineState *s, GfxPort *status_bar, const Common::Stri static void sciw_make_window_fit(rect_t *rect, GfxPort *parent) { // This window is meant to cover the whole screen, so we allow it to go through. - if (rect->width == 319 && rect->height == 189) return; + if (rect->width == 319 && rect->height == 189) + return; if (rect->x + rect->width > parent->_bounds.x + parent->_bounds.width) rect->x -= (rect->x + rect->width) - (parent->_bounds.x + parent->_bounds.width) + 2; @@ -220,7 +221,7 @@ GfxPort *sciw_new_window(EngineState *s, 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"); + error("Could not get black/semitrans color entry"); return NULL; } @@ -236,7 +237,7 @@ GfxPort *sciw_new_window(EngineState *s, // Draw frame if (gfxop_set_color(state, &black, 0, 0, 0, 0, bgcolor.priority, -1)) { - GFXERROR("Could not get black color entry!\n"); + error("Could not get black color entry"); return NULL; } @@ -418,7 +419,7 @@ GfxList *sciw_new_icon_control(GfxPort *port, reg_t ID, rect_t zone, int view, i gfxw_set_id(list, ID.segment, ID.offset); if (!port->_visual) { - GFXERROR("Attempting to create icon control for virtual port!\n"); + error("Attempting to create icon control for virtual port"); return NULL; } @@ -429,7 +430,7 @@ GfxList *sciw_new_icon_control(GfxPort *port, reg_t ID, rect_t zone, int view, i ALIGN_LEFT, ALIGN_TOP, GFXW_VIEW_FLAG_DONT_MODIFY_OFFSET); if (!icon) { - GFXERROR("Attempt to create icon control with cel %d/%d/%d (invalid)\n", view, loop, cel); + error("Attempt to create icon control with cel %d/%d/%d (invalid)", view, loop, cel); return NULL; } @@ -461,7 +462,7 @@ GfxList *sciw_new_list_control(GfxPort *port, reg_t ID, rect_t zone, int font_nr columns = (zone.height - 20); if (font_height <= 0) { - GFXERROR("Attempt to create list control with invalid font %d\n", font_nr); + error("Attempt to create list control with invalid font %d", font_nr); delete list; return NULL; } @@ -565,7 +566,7 @@ GfxPort *sciw_new_menu(EngineState *s, GfxPort *status_bar, Menubar *menubar, in return NULL; if (selection >= (int)menubar->_menus.size()) { - GFXERROR("Attempt to make menu #%d of %d\n", selection, menubar->_menus.size()); + error("Attempt to make menu #%d of %d", selection, menubar->_menus.size()); return NULL; } diff --git a/engines/sci/gfx/gfx_pixmap_scale.cpp b/engines/sci/gfx/gfx_pixmap_scale.cpp index 37843743b9..41e6102cbd 100644 --- a/engines/sci/gfx/gfx_pixmap_scale.cpp +++ b/engines/sci/gfx/gfx_pixmap_scale.cpp @@ -514,8 +514,7 @@ static void _gfx_xlate_pixmap_unfiltered(gfx_mode_t *mode, gfx_pixmap_t *pxm, in break; default: - GFXERROR("Invalid mode->bytespp=%d\n", mode->bytespp); - + error("Invalid mode->bytespp=%d", mode->bytespp); } if (pxm->flags & GFX_PIXMAP_FLAG_SCALED_INDEX) { @@ -559,8 +558,7 @@ static void _gfx_xlate_pixmap_linear(gfx_mode_t *mode, gfx_pixmap_t *pxm, int sc break; default: - GFXERROR("Invalid mode->bytespp=%d\n", mode->bytespp); - + error("Invalid mode->bytespp=%d", mode->bytespp); } } @@ -596,7 +594,7 @@ static void _gfx_xlate_pixmap_trilinear(gfx_mode_t *mode, gfx_pixmap_t *pxm, int break; default: - GFXERROR("Invalid mode->bytespp=%d\n", mode->bytespp); + error("Invalid mode->bytespp=%d", mode->bytespp); } } @@ -635,7 +633,7 @@ void gfx_xlate_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode, gfx_xlate_filter_t fi break; default: - GFXERROR("Attempt to filter pixmap %04x in invalid mode #%d\n", pxm->ID, filter); + error("Attempt to filter pixmap %04x in invalid mode #%d", pxm->ID, filter); if (!was_allocated) { if (!mode->alpha_mask && pxm->colors_nr() < GFX_PIC_COLORS) diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index 282931d004..4abcc1fb78 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -165,7 +165,7 @@ int GfxResManager::getOptionsHash(gfx_resource_type_t type) { case GFX_RESOURCE_TYPES_NR: default: - GFXERROR("Invalid resource type: %d\n", type); + error("Invalid resource type: %d", type); return -1; } } @@ -350,7 +350,7 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale #endif if (!pic) { - GFXERROR("Failed to allocate scaled pic!\n"); + error("Failed to allocate scaled pic"); return NULL; } @@ -359,7 +359,7 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale if (need_unscaled) { unscaled_pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _version >= SCI_VERSION_01_VGA); if (!unscaled_pic) { - GFXERROR("Failed to allocate unscaled pic!\n"); + error("Failed to allocate unscaled pic"); return NULL; } gfxr_clear_pic0(pic, SCI_TITLEBAR_SIZE); @@ -531,9 +531,9 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) { int resid = GFXR_RES_ID(GFX_RESOURCE_TYPE_VIEW, nr); - if (_version < SCI_VERSION_01) + if (_version < SCI_VERSION_01_EGA) view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, -1); - else if (_version == SCI_VERSION_01 || !_isVGA) + else if (_version == SCI_VERSION_01_EGA || !_isVGA) view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, palette); else if (_version >= SCI_VERSION_01_VGA && _version <= SCI_VERSION_1) view = gfxr_draw_view1(resid, viewRes->data, viewRes->size, _staticPalette, false); diff --git a/engines/sci/gfx/gfx_state_internal.h b/engines/sci/gfx/gfx_state_internal.h index 3f00b5213c..3beb0ea067 100644 --- a/engines/sci/gfx/gfx_state_internal.h +++ b/engines/sci/gfx/gfx_state_internal.h @@ -132,7 +132,7 @@ public: } /** - * Prints a string representation of the widget with sciprintf. + * Prints a string representation of the widget with printf. * * Will recursively print all of the widget's contents if the widget * contains further sub-widgets diff --git a/engines/sci/gfx/gfx_support.cpp b/engines/sci/gfx/gfx_support.cpp index 3a32752b9a..314e955367 100644 --- a/engines/sci/gfx/gfx_support.cpp +++ b/engines/sci/gfx/gfx_support.cpp @@ -94,7 +94,7 @@ static void gfx_draw_line_buffer(byte *buffer, int linewidth, int pixelwidth, return; default: - GFXERROR("pixelwidth=%d not supported!\n", pixelwidth); + error("pixelwidth=%d not supported", pixelwidth); return; } @@ -292,7 +292,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!\n"); + error("Invalid alpha mode: both pxm->alpha_map and alpha_mask are white"); return GFX_ERROR; } @@ -335,7 +335,7 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel, alpha_mask, alpha_min, 0, 0, 0, 0); else { - GFXERROR("Invalid mode->bytespp: %d\n", mode->bytespp); + error("Invalid mode->bytespp: %d", mode->bytespp); return GFX_ERROR; } } else { // priority @@ -344,7 +344,7 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel, alpha_mask, alpha_min, priority_pos, priority_line_width, priority_skip, priority); else { - GFXERROR("Invalid mode->bytespp: %d\n", mode->bytespp); + error("Invalid mode->bytespp: %d", mode->bytespp); return GFX_ERROR; } } diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index 4d9a39934d..fe93922e21 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -36,9 +36,6 @@ namespace Sci { #define GFX_DEBUG -/* General output macros */ -#define GFXERROR sciprintf("GFX Error: %s, L%d:", __FILE__, __LINE__); error - /***********************/ /*** Data structures ***/ /***********************/ diff --git a/engines/sci/gfx/gfx_tools.cpp b/engines/sci/gfx/gfx_tools.cpp index b835084b0c..9e81ec1a8a 100644 --- a/engines/sci/gfx/gfx_tools.cpp +++ b/engines/sci/gfx/gfx_tools.cpp @@ -246,7 +246,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!\n"); + error("Attempt to scale index data without index data!\n"); return pixmap; } diff --git a/engines/sci/gfx/gfx_widgets.cpp b/engines/sci/gfx/gfx_widgets.cpp index 2207309f48..12cec0ada6 100644 --- a/engines/sci/gfx/gfx_widgets.cpp +++ b/engines/sci/gfx/gfx_widgets.cpp @@ -81,7 +81,7 @@ static void _gfxw_debug_remove_widget(GfxWidget *widget) { static void indent(int indentation) { for (int i = 0; i < indentation; i++) - sciprintf(" "); + printf(" "); } void GfxWidget::printIntern(int indentation) const { @@ -92,35 +92,35 @@ void GfxWidget::printIntern(int indentation) const { if (_magic == GFXW_MAGIC_VALID) { if (_visual) - sciprintf("v "); + printf("v "); else - sciprintf("NoVis "); + printf("NoVis "); } else if (_magic == GFXW_MAGIC_INVALID) - sciprintf("INVALID "); + printf("INVALID "); - sciprintf("S%08x", _serial); + printf("S%08x", _serial); if (_ID != GFXW_NO_ID) { - sciprintf("#%x", _ID); + printf("#%x", _ID); if (_subID != GFXW_NO_ID) - sciprintf(":%x ", _subID); + printf(":%x ", _subID); else - sciprintf(" "); + printf(" "); } - sciprintf("[(%d,%d)(%dx%d)]", _bounds.x, _bounds.y, _bounds.width, _bounds.height); + printf("[(%d,%d)(%dx%d)]", _bounds.x, _bounds.y, _bounds.width, _bounds.height); for (i = 0; i < strlen(flags_list); i++) if (_flags & (1 << i)) - sciprintf("%c", flags_list[i]); + printf("%c", flags_list[i]); - sciprintf(" "); + printf(" "); } void GfxWidget::print(int indentation) const { printIntern(indentation); - sciprintf("<untyped #%d>", _type); + printf("<untyped #%d>", _type); } GfxWidget::GfxWidget(gfxw_widget_type_t type_) { @@ -149,13 +149,13 @@ GfxWidget::GfxWidget(gfxw_widget_type_t type_) { static int verify_widget(GfxWidget *widget) { if (!widget) { - GFXERROR("Attempt to use NULL widget\n"); + warning("Attempt to use NULL widget"); return 1; } else if (widget->_magic != GFXW_MAGIC_VALID) { if (widget->_magic == GFXW_MAGIC_INVALID) { - GFXERROR("Attempt to use invalidated widget\n"); + warning("Attempt to use invalidated widget"); } else { - GFXERROR("Attempt to use non-widget\n"); + warning("Attempt to use non-widget"); } return 1; } @@ -163,13 +163,13 @@ static int verify_widget(GfxWidget *widget) { } #define VERIFY_WIDGET(w) \ - if (verify_widget((GfxWidget *)(w))) { GFXERROR("Error occured while validating widget\n"); } + if (verify_widget((GfxWidget *)(w))) { error("Error occured while validating widget"); } #define GFX_ASSERT(_x) \ { \ int retval = (_x); \ if (retval == GFX_ERROR) { \ - GFXERROR("Error occured while drawing widget!\n"); \ + warning("Error occured while drawing widget"); \ return 1; \ } else if (retval == GFX_FATAL) { \ error("Fatal error occured while drawing widget!\nGraphics state invalid; aborting program..."); \ @@ -183,23 +183,23 @@ static int verify_widget(GfxWidget *widget) { // Assertion for drawing #define DRAW_ASSERT(widget, exp_type) \ if (!(widget)) { \ - sciprintf("L%d: NULL widget", __LINE__); \ + printf("L%d: NULL widget", __LINE__); \ return 1; \ } \ if ((widget)->_type != (exp_type)) { \ - sciprintf("L%d: Error in widget: Expected type " # exp_type "(%d) but got %d\n", __LINE__, exp_type, (widget)->_type); \ - sciprintf("Erroneous widget: "); \ + printf("L%d: Error in widget: Expected type " # exp_type "(%d) but got %d\n", __LINE__, exp_type, (widget)->_type); \ + printf("Erroneous widget: "); \ widget->print(4); \ - sciprintf("\n"); \ + printf("\n"); \ return 1; \ } \ if (!(widget->_flags & GFXW_FLAG_VISIBLE)) \ return 0; \ if (!(widget->_type == GFXW_VISUAL || widget->_visual)) { \ - sciprintf("L%d: Error while drawing widget: Widget has no visual\n", __LINE__); \ - sciprintf("Erroneous widget: "); \ + printf("L%d: Error while drawing widget: Widget has no visual\n", __LINE__); \ + printf("Erroneous widget: "); \ widget->print(1); \ - sciprintf("\n"); \ + printf("\n"); \ return 1; \ } @@ -253,8 +253,7 @@ void gfxw_remove_widget_from_container(GfxContainer *container, GfxWidget *widge GfxWidget **seekerp; if (!container) { - GFXERROR("Attempt to remove widget from NULL container!\n"); - error("gfxw_remove_widget_from_container() failed. Breakpoint in %s, line %d", __FILE__, __LINE__); + error("Attempt to remove widget from NULL container!\n"); } seekerp = &(container->_contents); @@ -271,10 +270,10 @@ void gfxw_remove_widget_from_container(GfxContainer *container, GfxWidget *widge seekerp = &((*seekerp)->_next); if (!*seekerp) { - GFXERROR("Internal error: Attempt to remove widget from container it was not contained in!\n"); - sciprintf("Widget:"); + printf("Internal error: Attempt to remove widget from container it was not contained in!\n"); + printf("Widget:"); widget->print(1); - sciprintf("Container:"); + printf("Container:"); widget->print(1); error("gfxw_remove_widget_from_container() failed. Breakpoint in %s, line %d", __FILE__, __LINE__); return; @@ -341,7 +340,7 @@ int GfxBox::draw(const Common::Point &pos) { void GfxBox::print(int indentation) const { printIntern(indentation); - sciprintf("BOX"); + printf("BOX"); } static int _gfxwop_box_superarea_of(GfxWidget *widget, GfxWidget *other) { @@ -472,7 +471,7 @@ int GfxRect::draw(const Common::Point &pos) { void GfxRect::print(int indentation) const { printIntern(indentation); - sciprintf("RECT"); + printf("RECT"); } void _gfxw_set_ops_RECT(GfxWidget *prim) { @@ -518,7 +517,7 @@ int GfxLine::draw(const Common::Point &pos) { void GfxLine::print(int indentation) const { printIntern(indentation); -// sciprintf("LINE"); +// printf("LINE"); } void _gfxw_set_ops_LINE(GfxWidget *prim) { @@ -598,13 +597,13 @@ void GfxView::print(int indentation) const { printIntern(indentation); if (_type == GFXW_STATIC_VIEW) - sciprintf("STATICVIEW"); + printf("STATICVIEW"); else if (_type == GFXW_VIEW) - sciprintf("VIEW"); + printf("VIEW"); else error("GfxView::print: Invalid type %d", _type); - sciprintf("(%d/%d/%d)@(%d,%d)[p:%d,c:%d]", _view, _loop, _cel, _pos.x, _pos.y, + printf("(%d/%d/%d)@(%d,%d)[p:%d,c:%d]", _view, _loop, _cel, _pos.x, _pos.y, (_color.mask & GFX_MASK_PRIORITY) ? _color.priority : -1, (_color.mask & GFX_MASK_CONTROL) ? _color.control : -1); } @@ -675,13 +674,13 @@ int GfxDynView::draw(const Common::Point &pos) { printIntern(indentation); if (_type == GFXW_DYN_VIEW) - sciprintf("DYNVIEW"); + printf("DYNVIEW"); else if (_type == GFXW_PIC_VIEW) - sciprintf("PICVIEW"); + printf("PICVIEW"); else error("GfxDynView::print: Invalid type %d", _type); - sciprintf(" SORT=%d z=%d seq=%d (%d/%d/%d)@(%d,%d)[p:%d,c:%d]; sig[%04x@%04X:%04X[%d]]", force_precedence, _z, + printf(" SORT=%d z=%d seq=%d (%d/%d/%d)@(%d,%d)[p:%d,c:%d]; sig[%04x@%04X:%04X[%d]]", force_precedence, _z, sequence, _view, _loop, _cel, _pos.x, _pos.y, (_color.mask & GFX_MASK_PRIORITY) ? _color.priority : -1, (_color.mask & GFX_MASK_CONTROL) ? _color.control : -1, signal, signalp.obj.segment, signalp.obj.offset, signalp.varindex); @@ -815,8 +814,7 @@ GfxText::~GfxText() { if (_textHandle) { GfxState *state = _visual ? _visual->_gfxState : NULL; if (!state) { - GFXERROR("Attempt to free text without supplying mode to free it from!\n"); - error("GfxText destructor failed. Breakpoint in %s, line %d", __FILE__, __LINE__); + error("Attempt to free text without supplying mode to free it from!\n"); } else { gfxop_free_text(state, _textHandle); _textHandle = NULL; @@ -838,7 +836,7 @@ int GfxText::draw(const Common::Point &pos) { void GfxText::print(int indentation) const { printIntern(indentation); - sciprintf("TEXT:'%s'", _text.c_str()); + printf("TEXT:'%s'", _text.c_str()); } static int _gfxwop_text_equals(GfxWidget *widget, GfxWidget *other) { @@ -964,11 +962,11 @@ static int _w_gfxwop_container_print_contents(const char *name, GfxWidget *widge indent(indentation); - sciprintf("--%s:\n", name); + printf("--%s:\n", name); while (seeker) { seeker->print(indentation + 1); - sciprintf("\n"); + printf("\n"); seeker = seeker->_next; } @@ -976,14 +974,14 @@ static int _w_gfxwop_container_print_contents(const char *name, GfxWidget *widge } void GfxContainer::print(int indentation) const { - sciprintf(" viszone=((%d,%d),(%dx%d))\n", zone.x, zone.y, zone.width, zone.height); + printf(" viszone=((%d,%d),(%dx%d))\n", zone.x, zone.y, zone.width, zone.height); indent(indentation); - sciprintf("--dirty:\n"); + printf("--dirty:\n"); for (DirtyRectList::const_iterator dirty = _dirtyRects.begin(); dirty != _dirtyRects.end(); ++dirty) { indent(indentation + 1); - sciprintf("dirty(%d,%d, (%dx%d))\n", dirty->x, dirty->y, dirty->width, dirty->height); + printf("dirty(%d,%d, (%dx%d))\n", dirty->x, dirty->y, dirty->width, dirty->height); } _w_gfxwop_container_print_contents("contents", _contents, indentation); @@ -1155,11 +1153,11 @@ static void _gfxw_dirtify_container(GfxContainer *container, GfxWidget *widget) static int _parentize_widget(GfxContainer *container, GfxWidget *widget) { if (widget->_parent) { - GFXERROR("_gfxwop_container_add(): Attempt to give second parent node to widget!\nWidget:"); + printf("_parentize_widget(): Attempt to give second parent node to widget!\nWidget:"); widget->print(3); - sciprintf("\nContainer:"); + printf("\nContainer:"); container->print(3); - + error("Error in _parentize_widget()"); return 1; } @@ -1253,9 +1251,9 @@ void GfxList::print(int indentation) const { printIntern(indentation); if (_type == GFXW_LIST) - sciprintf("LIST"); + printf("LIST"); else if (_type == GFXW_SORTED_LIST) - sciprintf("SORTED_LIST"); + printf("SORTED_LIST"); else error("GfxList::print: Invalid type %d", _type); @@ -1272,7 +1270,7 @@ static int _gfxwop_list_equals(GfxWidget *widget, GfxWidget *other) { if (!GFXW_IS_LIST(widget)) { warning("[GFX] _gfxwop_list_equals(): Method called on non-list"); widget->print(0); - sciprintf("\n"); + printf("\n"); return 0; } @@ -1316,11 +1314,11 @@ int _gfxwop_ordered_add(GfxContainer *container, GfxWidget *widget, int compare_ GfxWidget **seekerp = &(container->_contents); if (widget->_next) { - GFXERROR("_gfxwop_sorted_list_add(): Attempt to add widget to two lists!\nWidget:"); + printf("_gfxwop_ordered_add(): Attempt to add widget to two lists!\nWidget:"); widget->print(3); - sciprintf("\nList:"); + printf("\nList:"); container->print(3); - error("Breakpoint in %s, line %d", __FILE__, __LINE__); + error("Error in _gfxwop_ordered_add()"); } if (_gfxw_container_id_equals(container, widget)) @@ -1388,7 +1386,7 @@ int GfxVisual::draw(const Common::Point &pos) { int err = gfxop_clear_box(_gfxState, *dirty); if (err) { - GFXERROR("Error while clearing dirty rect (%d,%d,(%dx%d))\n", dirty->x, + error("Error while clearing dirty rect (%d,%d,(%dx%d))", dirty->x, dirty->y, dirty->width, dirty->height); if (err == GFX_FATAL) return err; @@ -1405,15 +1403,15 @@ int GfxVisual::draw(const Common::Point &pos) { void GfxVisual::print(int indentation) const { printIntern(indentation); - sciprintf("VISUAL; ports={"); + printf("VISUAL; ports={"); for (uint i = 0; i < _portRefs.size(); i++) { if (_portRefs[i]) { if (i != 0) - sciprintf(","); - sciprintf("%d", i); + printf(","); + printf("%d", i); } } - sciprintf("}\n"); + printf("}\n"); GfxContainer::print(indentation); } @@ -1519,10 +1517,10 @@ GfxPort::~GfxPort() { void GfxPort::print(int indentation) const { printIntern(indentation); - sciprintf("PORT"); - sciprintf(" font=%d drawpos=(%d,%d)", _font, draw_pos.x, draw_pos.y); + printf("PORT"); + printf(" font=%d drawpos=(%d,%d)", _font, draw_pos.x, draw_pos.y); if (gray_text) - sciprintf(" (gray)"); + printf(" (gray)"); GfxContainer::print(indentation); _w_gfxwop_container_print_contents("decorations", _decorations, indentation); diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp index 9d3ed6a4a5..a5a43a7f00 100644 --- a/engines/sci/gfx/menubar.cpp +++ b/engines/sci/gfx/menubar.cpp @@ -334,7 +334,7 @@ int Menubar::setAttribute(EngineState *s, int menu_nr, int item_nr, int attribut break; default: - sciprintf("Attempt to set invalid attribute of menu %d, item %d: 0x%04x\n", menu_nr, item_nr, attribute); + error("Attempt to set invalid attribute of menu %d, item %d: 0x%04x", menu_nr, item_nr, attribute); return 1; } @@ -367,7 +367,7 @@ reg_t Menubar::getAttribute(int menu_nr, int item_nr, int attribute) const { return make_reg(0, item._tag); default: - sciprintf("Attempt to read invalid attribute from menu %d, item %d: 0x%04x\n", menu_nr, item_nr, attribute); + warning("Attempt to read invalid attribute from menu %d, item %d: 0x%04x", menu_nr, item_nr, attribute); return make_reg(0, -1); } } diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 1f7c4ed479..80adb9eddb 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -61,13 +61,6 @@ gfx_pixmap_color_t default_colors[DEFAULT_COLORS_NR] = {{GFX_COLOR_SYSTEM, 0x00, #define POINTER_VISIBLE_BUT_CLIPPED 2 -// Performs basic checks that apply to most functions -#define BASIC_CHECKS(error_retval) \ -if (!state) { \ - GFXERROR("Null state!\n"); \ - return error_retval; \ -} - // How to determine whether colors have to be allocated #define PALETTE_MODE state->driver->getMode()->palette @@ -157,7 +150,7 @@ static int _gfxop_grab_pixmap(GfxState *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", color, pxm->ID, pxm->loop, pxm->cel); \ + error("Attempt to draw control color %d on pixmap %d/%d/%d without index data", color, pxm->ID, pxm->loop, pxm->cel); \ return; \ } \ \ @@ -257,7 +250,7 @@ static int _gfxop_draw_pixmap(GfxDriver *driver, gfx_pixmap_t *pxm, int priority err = driver->drawPixmap(pxm, priority, src, clipped_dest, static_buf ? GFX_BUFFER_STATIC : GFX_BUFFER_BACK); if (err) { - GFXERROR("driver->draw_pixmap() returned err!\n"); + error("driver->draw_pixmap() returned error code"); return err; } @@ -301,7 +294,7 @@ static int _gfxop_update_box(GfxState *state, rect_t box) { _gfxop_scale_rect(&box, state->driver->getMode()); if ((retval = _gfxop_buffer_propagate_box(state, box, GFX_BUFFER_FRONT))) { - GFXERROR("Error occured while propagating box (%d,%d,%d,%d) to front buffer\n", box.x, box.y, box.width, box.height); + error("Error occured while propagating box (%d,%d,%d,%d) to front buffer", box.x, box.y, box.width, box.height); return retval; } return GFX_OK; @@ -354,7 +347,7 @@ void gfxdr_add_dirty(DirtyRectList &list, rect_t box, int strategy) { break; default: - GFXERROR("Attempt to use invalid dirty frame mode %d!\nPlease refer to gfx_options.h.", strategy); + error("Attempt to use invalid dirty frame mode %d!\nPlease refer to gfx_options.h", strategy); } } @@ -417,8 +410,6 @@ int gfxop_init(int version, bool isVGA, GfxState *state, //int color_depth = bpp ? bpp : 1; //int initialized = 0; - BASIC_CHECKS(GFX_FATAL); - state->options = options; state->visible_map = GFX_MASK_VISUAL; state->fullscreen_override = NULL; // No magical override @@ -445,8 +436,6 @@ int gfxop_init(int version, bool isVGA, GfxState *state, } int gfxop_exit(GfxState *state) { - BASIC_CHECKS(GFX_ERROR); - state->gfxResMan->freeResManager(); if (state->control_map) { @@ -521,7 +510,6 @@ int gfxop_scan_bitmask(GfxState *state, rect_t area, gfx_map_mask_t map) { int gfxop_set_clip_zone(GfxState *state, rect_t zone) { int xfact, yfact; - BASIC_CHECKS(GFX_ERROR); DDIRTY(stderr, "-- Setting clip zone %d %d %d %d\n", GFX_PRINT_RECT(zone)); @@ -558,8 +546,6 @@ int gfxop_set_color(GfxState *state, gfx_color_t *color, int r, int g, int b, in int mask = ((r >= 0 && g >= 0 && b >= 0) ? GFX_MASK_VISUAL : 0) | ((priority >= 0) ? GFX_MASK_PRIORITY : 0) | ((control >= 0) ? GFX_MASK_CONTROL : 0); - BASIC_CHECKS(GFX_FATAL); - if (PALETTE_MODE && a >= GFXOP_ALPHA_THRESHOLD) mask &= ~GFX_MASK_VISUAL; @@ -594,13 +580,11 @@ int gfxop_set_color(GfxState *state, gfx_color_t *colorOut, gfx_color_t &colorIn } int gfxop_set_system_color(GfxState *state, unsigned int index, gfx_color_t *color) { - BASIC_CHECKS(GFX_FATAL); - if (!PALETTE_MODE) return GFX_OK; if (index >= state->driver->getMode()->palette->size()) { - GFXERROR("Attempt to set invalid color index %02x as system color\n", color->visual.parent_index); + error("Attempt to set invalid color index %02x as system color", color->visual.parent_index); return GFX_ERROR; } @@ -753,7 +737,7 @@ static int simulate_stippled_line_draw(GfxDriver *driver, int skipone, Common::P Common::Point nextpos = Common::Point(start.x + xl, start.y + yl); if ((retval = driver->drawLine(start, nextpos, color, line_mode, GFX_LINE_STYLE_NORMAL))) { - GFXERROR("Failed to draw partial stippled line (%d,%d) -- (%d,%d)\n", start.x, start.y, nextpos.x, nextpos.y); + error("Failed to draw partial stippled line (%d,%d) -- (%d,%d)", start.x, start.y, nextpos.x, nextpos.y); return retval; } *posvar += delta; @@ -775,7 +759,7 @@ static int simulate_stippled_line_draw(GfxDriver *driver, int skipone, Common::P nextpos = Common::Point(start.x + xl, start.y + yl); if ((retval = driver->drawLine(start, nextpos, color, line_mode, GFX_LINE_STYLE_NORMAL))) { - GFXERROR("Failed to draw partial stippled line (%d,%d) -- (%d,%d)\n", start.x, start.y, nextpos.x, nextpos.y); + error("Failed to draw partial stippled line (%d,%d) -- (%d,%d)", start.x, start.y, nextpos.x, nextpos.y); return retval; } } @@ -788,7 +772,6 @@ static int _gfxop_draw_line_clipped(GfxState *state, Common::Point start, Common int retval; int skipone = (start.x ^ end.y) & 1; // Used for simulated line stippling - BASIC_CHECKS(GFX_FATAL); _gfxop_full_pointer_refresh(state); // First, make sure that the line is normalized @@ -814,7 +797,7 @@ static int _gfxop_draw_line_clipped(GfxState *state, Common::Point start, Common } if ((retval = state->driver->drawLine(start, end, color, line_mode, line_style))) { - GFXERROR("Failed to draw line (%d,%d) -- (%d,%d)\n", start.x, start.y, end.x, end.y); + error("Failed to draw line (%d,%d) -- (%d,%d)", start.x, start.y, end.x, end.y); return retval; } @@ -825,7 +808,6 @@ int gfxop_draw_line(GfxState *state, Common::Point start, Common::Point end, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) { int xfact, yfact; - BASIC_CHECKS(GFX_FATAL); _gfxop_add_dirty_x(state, gfx_rect(start.x, start.y, end.x - start.x, end.y - start.y)); xfact = state->driver->getMode()->xfact; @@ -856,7 +838,6 @@ int gfxop_draw_rectangle(GfxState *state, rect_t rect, gfx_color_t color, gfx_li Common::Point upper_left_u, upper_right_u, lower_left_u, lower_right_u; Common::Point upper_left, upper_right, lower_left, lower_right; - BASIC_CHECKS(GFX_FATAL); _gfxop_full_pointer_refresh(state); xfact = state->driver->getMode()->xfact; @@ -890,7 +871,7 @@ int gfxop_draw_rectangle(GfxState *state, rect_t rect, gfx_color_t color, gfx_li #undef PARTIAL_LINE if (retval) { - GFXERROR("Failed to draw rectangle (%d,%d)+(%d,%d)\n", rect.x, rect.y, rect.width, rect.height); + error("Failed to draw rectangle (%d,%d)+(%d,%d)", rect.x, rect.y, rect.width, rect.height); return retval; } @@ -907,7 +888,6 @@ int gfxop_draw_box(GfxState *state, rect_t box, gfx_color_t color1, gfx_color_t gfx_rectangle_fill_t driver_shade_type; rect_t new_box; - BASIC_CHECKS(GFX_FATAL); _gfxop_full_pointer_refresh(state); shade_type = GFX_BOX_SHADE_FLAT; @@ -960,7 +940,7 @@ int gfxop_draw_box(GfxState *state, rect_t box, gfx_color_t color1, gfx_color_t break; default: - GFXERROR("Invalid shade type: %d\n", shade_type); + error("Invalid shade type: %d", shade_type); return GFX_ERROR; } @@ -1021,7 +1001,7 @@ static int _gfxop_buffer_propagate_box(GfxState *state, rect_t box, gfx_buffer_t return GFX_OK; if ((err = state->driver->update(box, Common::Point(box.x, box.y), buffer))) { - GFXERROR("Error occured while updating region (%d,%d,%d,%d) in buffer %d\n", box.x, box.y, box.width, box.height, buffer); + error("Error occured while updating region (%d,%d,%d,%d) in buffer %d", box.x, box.y, box.width, box.height, buffer); return err; } @@ -1031,7 +1011,6 @@ static int _gfxop_buffer_propagate_box(GfxState *state, rect_t box, gfx_buffer_t extern int sci0_palette; int gfxop_clear_box(GfxState *state, rect_t box) { - BASIC_CHECKS(GFX_FATAL); _gfxop_full_pointer_refresh(state); _gfxop_add_dirty(state, box); DDIRTY(stderr, "[] clearing box %d %d %d %d\n", GFX_PRINT_RECT(box)); @@ -1078,11 +1057,7 @@ int gfxop_set_visible_map(GfxState *state, gfx_map_mask_t visible_map) { } int gfxop_update(GfxState *state) { - int retval; - - BASIC_CHECKS(GFX_FATAL); - - retval = _gfxop_clear_dirty_rec(state, state->_dirtyRects); + int retval = _gfxop_clear_dirty_rec(state, state->_dirtyRects); if (state->fullscreen_override) { // We've been asked to re-draw the active full-screen image, essentially. @@ -1093,7 +1068,7 @@ int gfxop_update(GfxState *state) { } if (retval) { - GFXERROR("Clearing the dirty rectangles failed!\n"); + error("Clearing the dirty rectangles failed"); } if (state->tag_mode) { @@ -1108,8 +1083,6 @@ int gfxop_update(GfxState *state) { } int gfxop_update_box(GfxState *state, rect_t box) { - BASIC_CHECKS(GFX_FATAL); - if (state->disable_dirty) _gfxop_update_box(state, box); else @@ -1119,15 +1092,12 @@ int gfxop_update_box(GfxState *state, rect_t box) { } int gfxop_enable_dirty_frames(GfxState *state) { - BASIC_CHECKS(GFX_ERROR); state->disable_dirty = 0; return GFX_OK; } int gfxop_disable_dirty_frames(GfxState *state) { - BASIC_CHECKS(GFX_ERROR); - state->disable_dirty = 1; return GFX_OK; @@ -1136,8 +1106,6 @@ int gfxop_disable_dirty_frames(GfxState *state) { // Pointer and IO ops int gfxop_sleep(GfxState *state, uint32 msecs) { - BASIC_CHECKS(GFX_FATAL); - uint32 time; const uint32 wakeup_time = g_system->getMillis() + msecs; @@ -1160,8 +1128,6 @@ int gfxop_sleep(GfxState *state, uint32 msecs) { } static int _gfxop_set_pointer(GfxState *state, gfx_pixmap_t *pxm, Common::Point *hotspot) { - BASIC_CHECKS(GFX_FATAL); - // FIXME: We may have to store this pxm somewhere, as the global palette // may change when a new PIC is loaded. The cursor has to be regenerated // from this pxm at that point. (An alternative might be to ensure the @@ -1176,8 +1142,6 @@ static int _gfxop_set_pointer(GfxState *state, gfx_pixmap_t *pxm, Common::Point } int gfxop_set_pointer_cursor(GfxState *state, int nr) { - BASIC_CHECKS(GFX_FATAL); - if (nr == GFXOP_NO_POINTER) return _gfxop_set_pointer(state, NULL, NULL); @@ -1193,8 +1157,6 @@ int gfxop_set_pointer_cursor(GfxState *state, int nr) { } int gfxop_set_pointer_view(GfxState *state, int nr, int loop, int cel, Common::Point *hotspot) { - BASIC_CHECKS(GFX_FATAL); - int real_loop = loop; int real_cel = cel; // FIXME: For now, don't palettize pointers @@ -1223,8 +1185,6 @@ int gfxop_set_pointer_view(GfxState *state, int nr, int loop, int cel, Common::P } int gfxop_set_pointer_position(GfxState *state, Common::Point pos) { - BASIC_CHECKS(GFX_ERROR); - state->pointer_pos = pos; if (pos.x > 320 || pos.y > 200) { @@ -1551,10 +1511,9 @@ static sci_event_t scummvm_get_event(GfxDriver *drv) { } sci_event_t gfxop_get_event(GfxState *state, unsigned int mask) { - sci_event_t error_event = { SCI_EVT_ERROR, 0, 0, 0 }; + //sci_event_t error_event = { SCI_EVT_ERROR, 0, 0, 0 }; sci_event_t event = { 0, 0, 0, 0 }; - BASIC_CHECKS(error_event); _gfxop_full_pointer_refresh(state); // Update the screen here, since it's called very often @@ -1617,8 +1576,6 @@ int gfxop_lookup_view_get_loops(GfxState *state, int nr) { int loop = 0, cel = 0; gfxr_view_t *view = NULL; - BASIC_CHECKS(GFX_ERROR); - view = state->gfxResMan->getView(nr, &loop, &cel, 0); if (!view) { @@ -1633,8 +1590,6 @@ int gfxop_lookup_view_get_cels(GfxState *state, int nr, int loop) { int real_loop = loop, cel = 0; gfxr_view_t *view = NULL; - BASIC_CHECKS(GFX_ERROR); - view = state->gfxResMan->getView(nr, &real_loop, &cel, 0); if (!view) { @@ -1648,8 +1603,6 @@ int gfxop_lookup_view_get_cels(GfxState *state, int nr, int loop) { } int gfxop_check_cel(GfxState *state, int nr, int *loop, int *cel) { - BASIC_CHECKS(GFX_ERROR); - gfxr_view_t *testView = state->gfxResMan->getView(nr, loop, cel, 0); if (!testView) { @@ -1663,7 +1616,6 @@ int gfxop_check_cel(GfxState *state, int nr, int *loop, int *cel) { int gfxop_overflow_cel(GfxState *state, int nr, int *loop, int *cel) { int loop_v = *loop; int cel_v = *cel; - BASIC_CHECKS(GFX_ERROR); gfxr_view_t *testView = state->gfxResMan->getView(nr, &loop_v, &cel_v, 0); @@ -1685,7 +1637,6 @@ int gfxop_overflow_cel(GfxState *state, int nr, int *loop, int *cel) { int gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel, int *width, int *height, Common::Point *offset) { gfxr_view_t *view = NULL; gfx_pixmap_t *pxm = NULL; - BASIC_CHECKS(GFX_ERROR); view = state->gfxResMan->getView(nr, &loop, &cel, 0); @@ -1709,7 +1660,6 @@ static int _gfxop_draw_cel_buffer(GfxState *state, int nr, int loop, int cel, Co gfxr_view_t *view = NULL; gfx_pixmap_t *pxm = NULL; int old_x, old_y; - BASIC_CHECKS(GFX_FATAL); view = state->gfxResMan->getView(nr, &loop, &cel, palette); @@ -1781,8 +1731,6 @@ int *gfxop_get_pic_metainfo(GfxState *state) { } int gfxop_new_pic(GfxState *state, int nr, int flags, int default_palette) { - BASIC_CHECKS(GFX_FATAL); - state->gfxResMan->tagResources(); state->tag_mode = 1; state->palette_nr = default_palette; @@ -1795,15 +1743,16 @@ int gfxop_new_pic(GfxState *state, int nr, int flags, int default_palette) { } if (!state->pic || !state->pic_unscaled) { - GFXERROR("Could not retrieve background pic %d!\n", nr); + warning("Could not retrieve background pic %d", nr); if (state->pic) { - GFXERROR(" -- Inconsistency: scaled pic _was_ retrieved!\n"); + warning(" -- Inconsistency: scaled pic _was_ retrieved!"); } if (state->pic_unscaled) { - GFXERROR(" -- Inconsistency: unscaled pic _was_ retrieved!\n"); + warning(" -- Inconsistency: unscaled pic _was_ retrieved!"); } + error("Error occured in gfxop_new_pic()"); state->pic = state->pic_unscaled = NULL; return GFX_ERROR; } @@ -1814,17 +1763,15 @@ int gfxop_new_pic(GfxState *state, int nr, int flags, int default_palette) { } int gfxop_add_to_pic(GfxState *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"); + error("Attempt to add to pic with no pic active"); return GFX_ERROR; } state->pic = state->gfxResMan->addToPic(state->pic_nr, nr, flags, state->palette_nr, default_palette); if (!state->pic) { - GFXERROR("Could not add pic #%d to pic #%d!\n", state->pic_nr, nr); + error("Could not add pic #%d to pic #%d", state->pic_nr, nr); return GFX_ERROR; } @@ -1839,7 +1786,6 @@ int gfxop_add_to_pic(GfxState *state, int nr, int flags, int default_palette) { // replacing GfxState* state parameter with gfx_resstate_t* gfxResourceState and adjust callers accordingly int gfxop_get_font_height(GfxState *state, int font_nr) { gfx_bitmap_font_t *font; - BASIC_CHECKS(GFX_FATAL); font = state->gfxResMan->getFont(font_nr); @@ -1855,12 +1801,10 @@ int gfxop_get_text_params(GfxState *state, int font_nr, const char *text, int ma bool textsplits; gfx_bitmap_font_t *font; - BASIC_CHECKS(GFX_FATAL); - font = state->gfxResMan->getFont(font_nr); if (!font) { - GFXERROR("Attempt to calculate text size with invalid font #%d\n", font_nr); + error("Attempt to calculate text size with invalid font #%d", font_nr); *width = *height = 0; return GFX_ERROR; } @@ -1873,7 +1817,7 @@ int gfxop_get_text_params(GfxState *state, int font_nr, const char *text, int ma #endif if (!textsplits) { - GFXERROR("Could not calculate text size!"); + error("Could not calculate text size"); *width = *height = 0; return GFX_ERROR; } @@ -1889,21 +1833,20 @@ TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &t TextHandle *handle; gfx_bitmap_font_t *font; int err = 0; - BASIC_CHECKS(NULL); // mapping text colors to palette err |= gfxop_set_color(state, &color1, color1); err |= gfxop_set_color(state, &color2, color2); err |= gfxop_set_color(state, &bg_color, bg_color); if (err) { - GFXERROR("Unable to set up colors"); + error("Unable to set up colors"); return NULL; } font = state->gfxResMan->getFont(font_nr); if (!font) { - GFXERROR("Attempt to draw text with invalid font #%d\n", font_nr); + error("Attempt to draw text with invalid font #%d", font_nr); return NULL; } @@ -1925,7 +1868,7 @@ TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &t #endif if (!result) { - GFXERROR("Could not calculate text parameters in font #%d\n", font_nr); + error("Could not calculate text parameters in font #%d", font_nr); delete handle; return NULL; } @@ -1946,7 +1889,7 @@ TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &t (bg_color.mask & GFX_MASK_VISUAL) ? &bg_color.visual : NULL); if (!handle->text_pixmaps[i]) { - GFXERROR("Failed to draw text pixmap for line %d/%d\n", i, handle->lines.size()); + error("Failed to draw text pixmap for line %d/%d", i, handle->lines.size()); delete handle; return NULL; } @@ -1961,8 +1904,6 @@ TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &t } int gfxop_free_text(GfxState *state, TextHandle *handle) { - BASIC_CHECKS(GFX_ERROR); - delete handle; return GFX_OK; @@ -1987,11 +1928,10 @@ TextHandle::~TextHandle() { int gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) { int line_height; rect_t pos; - BASIC_CHECKS(GFX_FATAL); _gfxop_full_pointer_refresh(state); if (!handle) { - GFXERROR("Attempt to draw text with NULL handle!\n"); + error("Attempt to draw text with NULL handle"); return GFX_ERROR; } @@ -2020,7 +1960,7 @@ int gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) { break; default: - GFXERROR("Invalid vertical alignment %d!\n", handle->valign); + error("Invalid vertical alignment %d", handle->valign); return GFX_FATAL; // Internal error... } @@ -2036,7 +1976,7 @@ int gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) { #endif } if (!pxm) { - GFXERROR("Could not find text pixmap %d/%d\n", i, handle->lines.size()); + error("Could not find text pixmap %d/%d", i, handle->lines.size()); return GFX_ERROR; } @@ -2056,7 +1996,7 @@ int gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) { break; default: - GFXERROR("Invalid vertical alignment %d!\n", handle->valign); + error("Invalid vertical alignment %d", handle->valign); return GFX_FATAL; // Internal error... } @@ -2076,7 +2016,6 @@ int gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) { gfx_pixmap_t *gfxop_grab_pixmap(GfxState *state, rect_t area) { gfx_pixmap_t *pixmap = NULL; rect_t resultzone; // Ignored for this application - BASIC_CHECKS(NULL); _gfxop_full_pointer_refresh(state); _gfxop_scale_rect(&area, state->driver->getMode()); @@ -2088,10 +2027,9 @@ gfx_pixmap_t *gfxop_grab_pixmap(GfxState *state, rect_t area) { int gfxop_draw_pixmap(GfxState *state, gfx_pixmap_t *pxm, rect_t zone, Common::Point pos) { rect_t target; - BASIC_CHECKS(GFX_ERROR); if (!pxm) { - GFXERROR("Attempt to draw NULL pixmap!\n"); + error("Attempt to draw NULL pixmap"); return GFX_ERROR; } @@ -2102,7 +2040,7 @@ int gfxop_draw_pixmap(GfxState *state, gfx_pixmap_t *pxm, rect_t zone, Common::P _gfxop_add_dirty(state, target); if (!pxm) { - GFXERROR("Attempt to draw_pixmap with pxm=NULL\n"); + error("Attempt to draw_pixmap with pxm=NULL"); return GFX_ERROR; } @@ -2114,7 +2052,6 @@ int gfxop_draw_pixmap(GfxState *state, gfx_pixmap_t *pxm, rect_t zone, Common::P } int gfxop_free_pixmap(GfxState *state, gfx_pixmap_t *pxm) { - BASIC_CHECKS(GFX_ERROR); gfx_free_pixmap(pxm); return GFX_OK; } diff --git a/engines/sci/gfx/res_cursor.cpp b/engines/sci/gfx/res_cursor.cpp index f78134536c..9b3e64b8d5 100644 --- a/engines/sci/gfx/res_cursor.cpp +++ b/engines/sci/gfx/res_cursor.cpp @@ -53,7 +53,7 @@ gfx_pixmap_t *gfxr_draw_cursor(int id, byte *resource, int size, bool isSci01) { colors[3] = 2; if (size != CURSOR_RESOURCE_SIZE) { - GFXERROR("Expected resource size of %d, but found %d\n", CURSOR_RESOURCE_SIZE, size); + error("Expected resource size of %d, but found %d", CURSOR_RESOURCE_SIZE, size); return NULL; } diff --git a/engines/sci/gfx/res_font.cpp b/engines/sci/gfx/res_font.cpp index 7330df7441..cddbade845 100644 --- a/engines/sci/gfx/res_font.cpp +++ b/engines/sci/gfx/res_font.cpp @@ -44,12 +44,12 @@ static int calc_char(byte *dest, int total_width, int total_height, byte *src, i src += 2; if ((width >> 3) > total_width || height > total_height) { - GFXERROR("Weird character: width=%d/%d, height=%d/%d\n", width, total_width, height, total_height); + error("Weird character: width=%d/%d, height=%d/%d", width, total_width, height, total_height); return GFX_ERROR; } if (byte_width * height + 2 > size) { - GFXERROR("Character extends to %d of %d allowed bytes\n", byte_width * height + 2, size); + error("Character extends to %d of %d allowed bytes", byte_width * height + 2, size); return GFX_ERROR; } @@ -71,7 +71,7 @@ gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size) { ++font_counter; if (size < 6) { - GFXERROR("Font %04x size is %d- this is a joke, right?\n", id, size); + error("Font %04x size is %d", id, size); gfxr_free_font(font); return NULL; } @@ -81,15 +81,15 @@ gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size) { if (chars_nr < 0 || chars_nr > 256 || max_height < 0) { if (chars_nr < 0 || chars_nr > 256) - GFXERROR("Font %04x: Invalid number of characters: %d\n", id, chars_nr); + error("Font %04x: Invalid number of characters: %d", id, chars_nr); if (max_height < 0) - GFXERROR("Font %04x: Invalid font height: %d\n", id, max_height); + error("Font %04x: Invalid font height: %d", id, max_height); gfxr_free_font(font); return NULL; } if (size < 6 + chars_nr * 2) { - GFXERROR("Font %04x: Insufficient space for %d characters in font\n", id, chars_nr); + error("Font %04x: Insufficient space for %d characters in font", id, chars_nr); gfxr_free_font(font); return NULL; } @@ -101,7 +101,7 @@ gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size) { int offset = READ_LE_UINT16(resource + (i << 1) + 6); if (offset >= size) { - GFXERROR("Font %04x: Error: Character 0x%02x is at offset 0x%04x (beyond 0x%04x)\n", id, i, offset, size); + error("Font %04x: Error: Character 0x%02x is at offset 0x%04x (beyond 0x%04x)", id, i, offset, size); gfxr_free_font(font); return NULL; } @@ -130,7 +130,7 @@ gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size) { int offset = READ_LE_UINT16(resource + (i << 1) + 6); if (calc_char(font->data + (font->char_size * i), font->row_size, max_height, resource + offset, size - offset)) { - GFXERROR("Problem occured in font %04x, char %d/%d\n", id, i, chars_nr); + error("Problem occured in font %04x, char %d/%d", id, i, chars_nr); gfxr_free_font(font); return NULL; } diff --git a/engines/sci/gfx/res_pal.cpp b/engines/sci/gfx/res_pal.cpp index 0acc27a9b1..97e7297d43 100644 --- a/engines/sci/gfx/res_pal.cpp +++ b/engines/sci/gfx/res_pal.cpp @@ -76,7 +76,7 @@ Palette *gfxr_read_pal1(int id, byte *resource, int size) { unsigned int colors[MAX_COLORS] = {0}; if (size < PALETTE_START + 4) { - GFXERROR("Palette resource too small in %04x\n", id); + error("Palette resource too small in %04x", id); return NULL; } @@ -88,7 +88,7 @@ Palette *gfxr_read_pal1(int id, byte *resource, int size) { } if (counter < MAX_COLORS) { - GFXERROR("Palette %04x ends prematurely\n", id); + error("SCI1 palette %04x ends prematurely", id); return NULL; } @@ -117,7 +117,7 @@ Palette *gfxr_read_pal1_amiga(Common::File &file) { b2 = file.readByte(); if (b1 == EOF || b2 == EOF) { - GFXERROR("Palette file ends prematurely\n"); + error("Amiga palette file ends prematurely"); return NULL; } diff --git a/engines/sci/gfx/res_pic.cpp b/engines/sci/gfx/res_pic.cpp index 2c91cb579f..6c35ad314e 100644 --- a/engines/sci/gfx/res_pic.cpp +++ b/engines/sci/gfx/res_pic.cpp @@ -400,7 +400,7 @@ enum { #ifdef GFXR_DEBUG_PIC0 -#define p0printf sciprintf +#define p0printf printf #else void do_nothing(...) { } #define p0printf do_nothing @@ -1197,7 +1197,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, pal += default_palette; if (pal >= GFXR_PIC0_NUM_PALETTES) { - GFXERROR("Attempt to access invalid palette %d\n", pal); + error("Attempt to access invalid palette %d", pal); return; } @@ -1442,7 +1442,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, index %= GFXR_PIC0_PALETTE_SIZE; if (pal >= GFXR_PIC0_NUM_PALETTES) { - GFXERROR("Attempt to write to invalid palette %d\n", pal); + error("Attempt to write to invalid palette %d", pal); return; } palette[pal][index] = *(resource + pos++); @@ -1453,7 +1453,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, p0printf("Set palette @%d\n", pos); pal = *(resource + pos++); if (pal >= GFXR_PIC0_NUM_PALETTES) { - GFXERROR("Attempt to write to invalid palette %d\n", pal); + error("Attempt to write to invalid palette %d", pal); return; } @@ -1527,7 +1527,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->palette && view->palette->isShared() && !sci1) { - sciprintf("gfx_draw_pic0(): can't set a non-static palette for an embedded view!\n"); + warning("gfx_draw_pic0(): can't set a non-static palette for an embedded view"); } // For SCI0, use special color mapping to copy the low @@ -1602,7 +1602,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, if (!pic->priorityTable) { pic->priorityTable = (int*)malloc(16 * sizeof(int)); } else { - GFXERROR("pic->priorityTable is not NULL (%p); possible memory corruption", (void *)pic->priorityTable); + error("pic->priorityTable is not NULL (%p); possible memory corruption", (void *)pic->priorityTable); } pri_table = pic->priorityTable; @@ -1614,7 +1614,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, } default: - sciprintf("%s L%d: Warning: Unknown opx %02x\n", __FILE__, __LINE__, opx); + warning("gfxr_draw_pic01(): Unknown opx %02x", opx); return; } goto end_op_loop; @@ -1714,7 +1714,7 @@ void gfxr_dither_pic0(gfxr_pic_t *pic, int dmode, int pattern) { break; default: - GFXERROR("Invalid dither mode %d!\n", dmode); + error("Invalid dither mode %d", dmode); return; } diff --git a/engines/sci/gfx/res_view.cpp b/engines/sci/gfx/res_view.cpp index b30c57f38d..41cb55fa75 100644 --- a/engines/sci/gfx/res_view.cpp +++ b/engines/sci/gfx/res_view.cpp @@ -76,7 +76,7 @@ gfx_pixmap_t *gfxr_draw_cel0(int id, int loop, int cel, byte *resource, int size if (xl <= 0 || yl <= 0) { gfx_free_pixmap(retval); - GFXERROR("View %02x:(%d/%d) has invalid xl=%d or yl=%d\n", id, loop, cel, xl, yl); + error("View %02x:(%d/%d) has invalid xl=%d or yl=%d", id, loop, cel, xl, yl); return NULL; } @@ -123,7 +123,7 @@ gfx_pixmap_t *gfxr_draw_cel0(int id, int loop, int cel, byte *resource, int size color = retval->color_key; if (writepos + count > pixmap_size) { - GFXERROR("View %02x:(%d/%d) writes RLE data over its designated end at rel. offset 0x%04x\n", id, loop, cel, pos); + error("View %02x:(%d/%d) writes RLE data over its designated end at rel. offset 0x%04x", id, loop, cel, pos); return NULL; } @@ -143,7 +143,7 @@ gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette) { int palette_ofs = READ_LE_UINT16(resource + 6); if (size < V0_FIRST_LOOP_OFFSET + 8) { - GFXERROR("Attempt to draw empty view %04x\n", id); + error("Attempt to draw empty view %04x", id); return NULL; } @@ -166,7 +166,7 @@ gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette) { } if (view->loops_nr * 2 + V0_FIRST_LOOP_OFFSET > size) { - GFXERROR("View %04x: Not enough space in resource to accomodate for the claimed %d loops\n", id, view->loops_nr); + error("View %04x: Not enough space in resource to accomodate for the claimed %d loops", id, view->loops_nr); free(view); return NULL; } @@ -346,7 +346,7 @@ gfx_pixmap_t *gfxr_draw_cel1(int id, int loop, int cel, int mirrored, byte *reso if (xl <= 0 || yl <= 0) { gfx_free_pixmap(retval); - GFXERROR("View %02x:(%d/%d) has invalid xl=%d or yl=%d\n", id, loop, cel, xl, yl); + error("View %02x:(%d/%d) has invalid xl=%d or yl=%d", id, loop, cel, xl, yl); return NULL; } |