aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/kgraphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine/kgraphics.cpp')
-rw-r--r--engines/sci/engine/kgraphics.cpp69
1 files changed, 34 insertions, 35 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 205204b0ba..55ecad6529 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -92,7 +92,7 @@ namespace Sci {
if (val == GFX_ERROR) \
warning("GFX subsystem returned error on \"" #x "\""); \
else {\
- error("GFX subsystem fatal error condition on \"" #x "\""); \
+ SCIkwarn(SCIkERROR, "GFX subsystem fatal error condition on \"" #x "\"!\n"); \
vm_handle_fatal_error(s, __LINE__, __FILE__); \
} \
}\
@@ -101,7 +101,7 @@ namespace Sci {
#define ASSERT(x) { \
int val = !!(x); \
if (!val) { \
- error("Fatal error condition on \"" #x "\""); \
+ SCIkwarn(SCIkERROR, "Fatal error condition on \"" #x "\"!\n"); \
BREAKPOINT(); \
vm_handle_fatal_error(s, __LINE__, __FILE__); \
} \
@@ -220,7 +220,7 @@ void graph_restore_box(EngineState *s, reg_t handle) {
while (port_nr > 2 && !(s->port->flags & GFXW_FLAG_IMMUNE_TO_SNAPSHOTS) && (gfxw_widget_matches_snapshot(*ptr, GFXW(s->port)))) {
// This shouldn't ever happen, actually, since windows (ports w/ ID > 2) should all be immune
gfxw_port_t *newport = gfxw_find_port(s->visual, port_nr);
- error("Port %d is not immune against snapshots", s->port->ID);
+ SCIkwarn(SCIkERROR, "Port %d is not immune against snapshots!\n", s->port->ID);
port_nr--;
if (newport)
s->port = newport;
@@ -234,7 +234,7 @@ void graph_restore_box(EngineState *s, reg_t handle) {
} while (parent && (gfxw_widget_matches_snapshot(*ptr, GFXW(parent))));
if (!parent) {
- error("Attempted widget mass destruction by a snapshot");
+ SCIkwarn(SCIkERROR, "Attempted widget mass destruction by a snapshot\n");
BREAKPOINT();
}
@@ -243,7 +243,7 @@ void graph_restore_box(EngineState *s, reg_t handle) {
if (!ptr) {
- error("Attempt to restore invalid snaphot with handle "PREG, PRINT_REG(handle));
+ SCIkwarn(SCIkERROR, "Attempt to restore invalid snaphot with handle %04x!\n", handle);
return;
}
@@ -273,7 +273,7 @@ gfx_pixmap_color_t *get_pic_color(EngineState *s, int color) {
else if (color < KERNEL_COLORS_NR)
return &(KERNEL_COLOR_PALETTE[color]);
else {
- error("Color index %d out of bounds for pic %d (%d max)", color, s->gfx_state->pic_nr, KERNEL_COLORS_NR);
+ SCIkwarn(SCIkERROR, "Color index %d out of bounds for pic %d (%d max)", color, s->gfx_state->pic_nr, KERNEL_COLORS_NR);
BREAKPOINT();
return NULL;
}
@@ -334,7 +334,7 @@ reg_t kSetCursor_SCI11(EngineState *s, int funct_nr, int argc, reg_t *argv) {
break;
}
default :
- error("kSetCursor: Unhandled case: %d arguments given", argc);
+ SCIkwarn(SCIkERROR, "kSetCursor: Unhandled case: %d arguments given!\n", argc);
break;
}
return s->r_acc;
@@ -437,7 +437,7 @@ reg_t kPicNotValid(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
void _k_redraw_box(EngineState *s, int x1, int y1, int x2, int y2) {
- sciprintf("_k_redraw_box(): Unimplemented");
+ sciprintf("_k_redraw_box(): Unimplemented!\n");
#if 0
int i;
view_object_t *list = s->dyn_views;
@@ -712,7 +712,7 @@ void _k_dirloop(reg_t obj, word angle, EngineState *s, int funct_nr, int argc, r
maxloops = gfxop_lookup_view_get_loops(s->gfx_state, view);
if (maxloops == GFX_ERROR) {
- error("Invalid view.%03d", view);
+ SCIkwarn(SCIkERROR, "Invalid view.%03d\n", view);
return;
} else if ((loop > 1) && (maxloops < 4))
return;
@@ -903,7 +903,7 @@ reg_t kCelHigh(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
if (gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset)) {
- error("Invalid loop (%d) or cel (%d) in view.%d (0x%x), or view invalid", loop, cel, view, view);
+ SCIkwarn(SCIkERROR, "Invalid loop (%d) or cel (%d) in view.%d (0x%x), or view invalid\n", loop, cel, view, view);
return NULL_REG;
} else
return make_reg(0, height);
@@ -921,7 +921,7 @@ reg_t kCelWide(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
if (gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset)) {
- error("Invalid loop (%d) or cel (%d) in view.%d (0x%x), or view invalid", loop, cel, view, view);
+ SCIkwarn(SCIkERROR, "Invalid loop (%d) or cel (%d) in view.%d (0x%x), or view invalid\n", loop, cel, view, view);
return NULL_REG;
} else
return make_reg(0, width);
@@ -933,7 +933,7 @@ reg_t kNumLoops(EngineState *s, int funct_nr, int argc, reg_t *argv) {
int loops_nr = gfxop_lookup_view_get_loops(s->gfx_state, view);
if (loops_nr < 0) {
- error("view.%d (0x%x) not found", view, view);
+ SCIkwarn(SCIkERROR, "view.%d (0x%x) not found\n", view, view);
return NULL_REG;
}
@@ -952,7 +952,7 @@ reg_t kNumCels(EngineState *s, int funct_nr, int argc, reg_t *argv) {
if (gfxop_check_cel(s->gfx_state, view, &loop, &cel)) {
// OK, this is a hack and there's a
// real function to calculate cel numbers...
- error("view.%d (0x%x) not found", view, view);
+ SCIkwarn(SCIkERROR, "view.%d (0x%x) not found\n", view, view);
return NULL_REG;
}
@@ -1056,11 +1056,10 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
if (sci01_priority_table_flags & 0x2) {
if (s->pic_priority_table) {
int i;
- printf("---------------------------\nPriority table:\n");
+ fprintf(stderr, "---------------------------\nPriority table:\n");
for (i = 0; i < 16; i++)
- printf("\t%d:\t%d\n", i, s->pic_priority_table[i]);
- printf("---------------------------\n");
- error("Error");
+ fprintf(stderr, "\t%d:\t%d\n", i, s->pic_priority_table[i]);
+ fprintf(stderr, "---------------------------\n");
}
}
if (sci01_priority_table_flags & 0x1)
@@ -1118,7 +1117,7 @@ abs_rect_t set_base(EngineState *s, reg_t object) {
if (loop != oldloop) {
loop = 0;
PUT_SEL32V(object, loop, 0);
- SCIkdebug(SCIkGRAPHICS, "Resetting loop for "PREG"", PRINT_REG(object));
+ SCIkdebug(SCIkGRAPHICS, "Resetting loop for "PREG"!\n", PRINT_REG(object));
}
if (cel != oldcel) {
@@ -1722,19 +1721,19 @@ static void _k_view_list_do_postdraw(EngineState *s, gfxw_list_t *list) {
temp = GET_SEL32V(obj, nsBottom);
PUT_SEL32V(obj, lsBottom, temp);
#ifdef DEBUG_LSRECT
- error("lsRected "PREG"", PRINT_REG(obj));
+ fprintf(stderr, "lsRected "PREG"\n", PRINT_REG(obj));
#endif
}
#ifdef DEBUG_LSRECT
else
- error("Not lsRecting "PREG" because %d", PRINT_REG(obj), lookup_selector(s, obj, s->selector_map.nsBottom, NULL, NULL));
+ fprintf(stderr, "Not lsRecting "PREG" because %d\n", PRINT_REG(obj), lookup_selector(s, obj, s->selector_map.nsBottom, NULL, NULL));
#endif
if (widget->signal & _K_VIEW_SIG_FLAG_HIDDEN)
widget->signal |= _K_VIEW_SIG_FLAG_REMOVE;
}
#ifdef DEBUG_LSRECT
- error("obj "PREG" has pflags %x", PRINT_REG(obj), (widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)));
+ fprintf(stderr, "obj "PREG" has pflags %x\n", PRINT_REG(obj), (widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)));
#endif
if (widget->signalp) {
@@ -1786,7 +1785,7 @@ int _k_view_list_dispose_loop(EngineState *s, list_t *list, gfxw_dyn_view_t *wid
reg_t under_bits = NULL_REG;
if (!is_object(s, obj)) {
- error("Non-object "PREG" present in view list during delete time", PRINT_REG(obj));
+ SCIkwarn(SCIkERROR, "Non-object "PREG" present in view list during delete time\n", PRINT_REG(obj));
obj = NULL_REG;
} else
if (widget->under_bitsp) { // Is there a bg picture left to clean?
@@ -1823,7 +1822,7 @@ int _k_view_list_dispose_loop(EngineState *s, list_t *list, gfxw_dyn_view_t *wid
if (!(signal & _K_VIEW_SIG_FLAG_HIDDEN)) {
SCIkdebug(SCIkGRAPHICS, "Adding view at "PREG" to background\n", PRINT_REG(obj));
if (!(gfxw_remove_id(widget->parent, widget->ID, widget->subID) == GFXW(widget))) {
- error("Attempt to remove view with ID %x:%x from list failed", widget->ID, widget->subID);
+ SCIkwarn(SCIkERROR, "Attempt to remove view with ID %x:%x from list failed!\n", widget->ID, widget->subID);
BREAKPOINT();
}
@@ -1941,7 +1940,7 @@ static void _k_make_view_list(EngineState *s, gfxw_list_t **widget_list, list_t
gfxw_dyn_view_t *widget;
if (!*widget_list) {
- error("make_view_list with widget_list == ()");
+ SCIkwarn(SCIkERROR, "make_view_list with widget_list == ()\n");
BREAKPOINT();
};
@@ -1950,7 +1949,7 @@ static void _k_make_view_list(EngineState *s, gfxw_list_t **widget_list, list_t
// Yes, this _does_ happen!
if (!list) { // list sanity check
- error("Attempt to make list from non-list");
+ SCIkwarn(SCIkERROR, "Attempt to make list from non-list!\n");
BREAKPOINT();
}
@@ -2069,7 +2068,7 @@ static void _k_prepare_view_list(EngineState *s, gfxw_list_t *list, int options)
// Never happens
/* if (view->signal & 0) {
view->signal &= ~_K_VIEW_SIG_FLAG_FREESCI_STOPUPD;
- error("Unsetting magic StopUpd for view "PREG"", PRINT_REG(obj));
+ fprintf(stderr, "Unsetting magic StopUpd for view "PREG"\n", PRINT_REG(obj));
} */
view = (gfxw_dyn_view_t *) view->next;
@@ -2268,7 +2267,7 @@ reg_t kAddToPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
priority, -1 /* No priority */ , ALIGN_CENTER, ALIGN_BOTTOM, 0));
if (!widget) {
- error("Attempt to single-add invalid picview (%d/%d/%d)", view, loop, cel);
+ SCIkwarn(SCIkERROR, "Attempt to single-add invalid picview (%d/%d/%d)\n", view, loop, cel);
} else {
widget->ID = -1;
if (control >= 0) {
@@ -2332,7 +2331,7 @@ reg_t kSetPort(EngineState *s, int funct_nr, int argc, reg_t *argv) {
new_port = gfxw_find_port(s->visual, port_nr);
if (!new_port) {
- error("Invalid port %04x requested", port_nr);
+ SCIkwarn(SCIkERROR, "Invalid port %04x requested\n", port_nr);
return NULL_REG;
}
@@ -2360,7 +2359,7 @@ reg_t kSetPort(EngineState *s, int funct_nr, int argc, reg_t *argv) {
break;
}
default :
- error("SetPort was called with %d parameters", argc);
+ SCIkwarn(SCIkERROR, "SetPort was called with %d parameters\n", argc);
break;
}
@@ -2389,13 +2388,13 @@ reg_t kDrawCel(EngineState *s, int funct_nr, int argc, reg_t *argv) {
/*
if (!view) {
- error("Attempt to draw non-existing view.%03d", view);
+ SCIkwarn(SCIkERROR, "Attempt to draw non-existing view.%03d\n", view);
return;
}
*/
if (gfxop_check_cel(s->gfx_state, view, &loop, &cel)) {
- error("Attempt to draw non-existing view.%03d", view);
+ SCIkwarn(SCIkERROR, "Attempt to draw non-existing view.%03d\n", view);
return s->r_acc;
}
@@ -2423,7 +2422,7 @@ reg_t kDisposeWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) {
gfxw_widget_kill_chrono(s->visual, goner_nr);
goner = gfxw_find_port(s->visual, goner_nr);
if ((goner_nr < 3) || (goner == NULL)) {
- error("Removal of invalid window %04x requested", goner_nr);
+ SCIkwarn(SCIkERROR, "Removal of invalid window %04x requested\n", goner_nr);
return s->r_acc;
}
@@ -2572,7 +2571,7 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t *
gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen);
if (!newscreen) {
- error("Failed to allocate 'newscreen'");
+ SCIkwarn(SCIkERROR, "Failed to allocate 'newscreen'!\n");
return;
}
@@ -3124,7 +3123,7 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
if (!text) {
- error("Display with invalid reference "PREG"", PRINT_REG(textp));
+ SCIkdebug(SCIkERROR, "Display with invalid reference "PREG"!\n", PRINT_REG(textp));
return NULL_REG;
}
@@ -3250,7 +3249,7 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) {
text_handle = gfxw_new_text(s->gfx_state, area, font_nr, text, halign, ALIGN_TOP, color0, *color1, bg_color, 0);
if (!text_handle) {
- error("Display: Failed to create text widget");
+ SCIkwarn(SCIkERROR, "Display: Failed to create text widget!\n");
return NULL_REG;
}