aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kernel.cpp18
-rw-r--r--engines/sci/engine/kevent.cpp2
-rw-r--r--engines/sci/engine/kfile.cpp10
-rw-r--r--engines/sci/engine/kgraphics.cpp46
-rw-r--r--engines/sci/engine/klists.cpp2
-rw-r--r--engines/sci/engine/kmath.cpp8
-rw-r--r--engines/sci/engine/kmovement.cpp14
-rw-r--r--engines/sci/engine/kpathing.cpp6
-rw-r--r--engines/sci/engine/kscripts.cpp10
-rw-r--r--engines/sci/engine/ksound.cpp6
-rw-r--r--engines/sci/engine/kstring.cpp12
-rw-r--r--engines/sci/engine/scriptdebug.cpp1
-rw-r--r--engines/sci/engine/vm.cpp5
-rw-r--r--engines/sci/gfx/resource/sci_pic_0.cpp4
-rw-r--r--engines/sci/include/kdebug.h5
-rw-r--r--engines/sci/include/kernel.h7
-rw-r--r--engines/sci/include/resource.h2
-rw-r--r--engines/sci/sci.cpp19
-rw-r--r--engines/sci/sci.h22
19 files changed, 111 insertions, 88 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 3821cd5479..26f112fa6a 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -449,7 +449,7 @@ reg_t kMemoryInfo(state_t *s, int funct_nr, int argc, reg_t *argv) {
return make_reg(0, 0x7fff); // Must not be 0xffff, or some memory calculations will overflow
default:
- SCIkwarn(SCIkWARNING, "Unknown MemoryInfo operation: %04x\n", argv[0].offset);
+ warning("Unknown MemoryInfo operation: %04x", argv[0].offset);
}
return NULL_REG;
@@ -457,7 +457,7 @@ reg_t kMemoryInfo(state_t *s, int funct_nr, int argc, reg_t *argv) {
reg_t k_Unknown(state_t *s, int funct_nr, int argc, reg_t *argv) {
if (funct_nr >= SCI_MAPPED_UNKNOWN_KFUNCTIONS_NR) {
- SCIkwarn(SCIkSTUB, "Unhandled Unknown function %04x\n", funct_nr);
+ warning("Unhandled Unknown function %04x", funct_nr);
return NULL_REG;
} else {
switch (kfunct_mappers[funct_nr].type) {
@@ -465,7 +465,7 @@ reg_t k_Unknown(state_t *s, int funct_nr, int argc, reg_t *argv) {
return kfunct_mappers[funct_nr].sig_pair.fun(s, funct_nr, argc, argv);
case KF_NONE:
default:
- SCIkwarn(SCIkSTUB, "Unhandled Unknown function %04x\n", funct_nr);
+ warning("Unhandled Unknown function %04x", funct_nr);
return NULL_REG;
}
}
@@ -557,7 +557,7 @@ reg_t kGetTime(state_t *s, int funct_nr, int argc, reg_t *argv) {
break;
}
default: {
- SCIkdebug(SCIkWARNING, "Attempt to use unknown GetTime mode %d\n", mode);
+ warning("Attempt to use unknown GetTime mode %d\n", mode);
break;
}
}
@@ -598,12 +598,12 @@ reg_t kMemory(state_t *s, int funct_nr, int argc, reg_t *argv) {
if (dest && src)
memcpy(dest, src, size);
else {
- SCIkdebug(SCIkWARNING, "Warning: Could not execute kMemory:memcpy of %d bytes:\n", size);
+ warning("Warning: Could not execute kMemory:memcpy of %d bytes:", size);
if (!dest) {
- SCIkdebug(SCIkWARNING, " dest ptr ("PREG") invalid/memory region too small\n", PRINT_REG(argv[1]));
+ warning(" dest ptr ("PREG") invalid/memory region too small", PRINT_REG(argv[1]));
}
if (!src) {
- SCIkdebug(SCIkWARNING, " src ptr ("PREG") invalid/memory region too small\n", PRINT_REG(argv[2]));
+ warning(" src ptr ("PREG") invalid/memory region too small", PRINT_REG(argv[2]));
}
}
break;
@@ -649,7 +649,7 @@ reg_t kMemory(state_t *s, int funct_nr, int argc, reg_t *argv) {
reg_t kstub(state_t *s, int funct_nr, int argc, reg_t *argv) {
int i;
- SCIkwarn(SCIkWARNING, "Unimplemented syscall: %s[%x](", s->kernel_names[funct_nr], funct_nr);
+ warning("Unimplemented syscall: %s[%x](", s->kernel_names[funct_nr], funct_nr);
for (i = 0; i < argc; i++) {
sciprintf(PREG, PRINT_REG(argv[i]));
@@ -663,7 +663,7 @@ reg_t kstub(state_t *s, int funct_nr, int argc, reg_t *argv) {
reg_t kNOP(state_t *s, int funct_nr, int argc, reg_t *argv) {
const char *problem = (const char*)(s->kfunct_table[funct_nr].orig_name ? "unmapped" : "NOP");
- SCIkwarn(SCIkWARNING, "Warning: Kernel function 0x%02x invoked: %s", funct_nr, problem);
+ warning("Warning: Kernel function 0x%02x invoked: %s", funct_nr, problem);
if (s->kfunct_table[funct_nr].orig_name && strcmp(s->kfunct_table[funct_nr].orig_name, SCRIPT_UNKNOWN_FUNCTION_STRING)) {
sciprintf(" (but its name is known to be %s)", s->kfunct_table[funct_nr].orig_name);
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index d1a8214f13..e0f26f8fa8 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -219,6 +219,6 @@ reg_t kLocalToGlobal(state_t *s, int funct_nr, int argc, reg_t *argv) {
}
reg_t kJoystick(state_t *s, int funct_nr, int argc, reg_t *argv) {
- SCIkdebug(SCIkSTUB, "Unimplemented syscall 'Joystick()'\n", funct_nr);
+ warning("Unimplemented syscall 'Joystick()");
return NULL_REG;
}
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index b66e8fd272..7580782472 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -511,7 +511,7 @@ reg_t kCheckFreeSpace(state_t *s, int funct_nr, int argc, reg_t *argv) {
while (IS_VALID_FD(fd = open(testpath, O_RDONLY))) {
close(fd);
if (testpath[pathlen - 2] == 'z') { // Failed.
- SCIkwarn(SCIkWARNING, "Failed to find non-existing file for free space test\n");
+ warning("Failed to find non-existing file for free space test");
free(testpath);
return NULL_REG;
}
@@ -530,8 +530,8 @@ reg_t kCheckFreeSpace(state_t *s, int funct_nr, int argc, reg_t *argv) {
fd = creat(testpath, 0600);
if (!IS_VALID_FD(fd)) {
- SCIkwarn(SCIkWARNING, "Could not test for disk space: %s\n", strerror(errno));
- SCIkwarn(SCIkWARNING, "Test path was '%s'\n", testpath);
+ warning("Could not test for disk space: %s", strerror(errno));
+ warning("Test path was '%s'", testpath);
free(testpath);
return NULL_REG;
}
@@ -674,7 +674,7 @@ reg_t kCheckSaveGame(state_t *s, int funct_nr, int argc, reg_t *argv) {
strcpy(game_id_file_name, game_id);
strcat(game_id_file_name, FREESCI_ID_SUFFIX);
- SCIkwarn(SCIkWARNING, "Savegame index list not initialized!\n");
+ warning("Savegame index list not initialized");
update_savegame_indices(game_id_file_name);
}
@@ -832,7 +832,7 @@ reg_t kRestoreGame(state_t *s, int funct_nr, int argc, reg_t *argv) {
strcpy(game_id_file_name, game_id);
strcat(game_id_file_name, FREESCI_ID_SUFFIX);
- SCIkwarn(SCIkWARNING, "Savegame index list not initialized!\n");
+ warning("Savegame index list not initialized");
update_savegame_indices(game_id_file_name);
}
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index d7842b260d..c4fb62c7d3 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -88,7 +88,7 @@
int val = !!(x); \
if (val) { \
if (val == GFX_ERROR) \
- SCIkwarn(SCIkWARNING, "GFX subsystem returned error on \"" #x "\"!\n"); \
+ warning("GFX subsystem returned error on \"" #x "\""); \
else {\
SCIkwarn(SCIkERROR, "GFX subsystem fatal error condition on \"" #x "\"!\n"); \
vm_handle_fatal_error(s, __LINE__, __FILE__); \
@@ -164,13 +164,13 @@ int _find_priority_band(state_t *s, int nr) {
if (nr == 15)
return 0xffff;
else {
- SCIkwarn(SCIkWARNING, "Attempt to get priority band %d\n", nr);
+ warning("Attempt to get priority band %d", nr);
}
return 0;
}
if (s->version < SCI_VERSION_FTU_PRIORITY_14_ZONES && (nr < 0 || nr > 15)) {
- SCIkwarn(SCIkWARNING, "Attempt to get priority band %d\n", nr);
+ warning("Attempt to get priority band %d", nr);
return 0;
}
@@ -204,14 +204,14 @@ void graph_restore_box(state_t *s, reg_t handle) {
int port_nr = s->port->ID;
if (!handle.segment) {
- SCIkwarn(SCIkWARNING, "Attempt to restore box with zero handle\n");
+ warning("Attempt to restore box with zero handle");
return;
}
ptr = (gfxw_snapshot_t **) kmem(s, handle);
if (!ptr) {
- SCIkwarn(SCIkWARNING, "Attempt to restore invalid handle %04x\n", handle);
+ warning("Attempt to restore invalid handle %04x", handle);
return;
}
@@ -418,7 +418,7 @@ reg_t kShow(state_t *s, int funct_nr, int argc, reg_t *argv) {
break;
default:
- SCIkwarn(SCIkWARNING, "Show(%x) selects unknown map\n", s->pic_visible_map);
+ warning("Show(%x) selects unknown map", s->pic_visible_map);
}
@@ -599,7 +599,7 @@ reg_t kGraph(state_t *s, int funct_nr, int argc, reg_t *argv) {
default:
- SCIkdebug(SCIkSTUB, "Unhandled Graph() operation %04x\n", SKPV(0));
+ warning("Unhandled Graph() operation %04x", SKPV(0));
}
@@ -846,7 +846,7 @@ reg_t kCanBeHere(state_t *s, int funct_nr, int argc, reg_t * argv) {
SCIkdebug(SCIkBRESEN, " comparing against "PREG"\n", PRINT_REG(other_obj));
if (!is_object(s, other_obj)) {
- SCIkdebug(SCIkWARNING, "CanBeHere() cliplist contains non-object %04x\n", other_obj);
+ warning("CanBeHere() cliplist contains non-object %04x", other_obj);
} else if (!REG_EQ(other_obj, obj)) { // Clipping against yourself is not recommended
if (collides_with(s, abs_zone, other_obj, 0, GASEOUS_VIEW_MASK_PASSIVE, funct_nr, argc, argv)) {
@@ -897,7 +897,7 @@ reg_t kCelHigh(state_t *s, int funct_nr, int argc, reg_t *argv) {
Common::Point offset;
if (argc != 3) {
- SCIkwarn(SCIkWARNING, "CelHigh called with %d parameters!\n", argc);
+ warning("CelHigh called with %d parameters", argc);
}
if (gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset)) {
@@ -915,7 +915,7 @@ reg_t kCelWide(state_t *s, int funct_nr, int argc, reg_t *argv) {
Common::Point offset;
if (argc != 3) {
- SCIkwarn(SCIkWARNING, "CelHigh called with %d parameters!\n", argc);
+ warning("CelHigh called with %d parameters", argc);
}
if (gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset)) {
@@ -1296,7 +1296,7 @@ reg_t kPalette(state_t *s, int funct_nr, int argc, reg_t *argv) {
case 6 :
break;
default :
- SCIkdebug(SCIkWARNING, "Unimplemented subfunction: %d\n", UKPV(0));
+ warning("Unimplemented subfunction: %d", UKPV(0));
}
return s->r_acc;
@@ -1380,7 +1380,7 @@ reg_t kEditControl(state_t *s, int funct_nr, int argc, reg_t *argv) {
int textlen;
if (!text) {
- SCIkdebug(SCIkWARNING, "Could not draw control: "PREG" does not reference text!\n", PRINT_REG(text_pos));
+ warning("Could not draw control: "PREG" does not reference text", PRINT_REG(text_pos));
return s->r_acc;
}
@@ -1527,7 +1527,7 @@ reg_t kEditControl(state_t *s, int funct_nr, int argc, reg_t *argv) {
break;
default:
- SCIkwarn(SCIkWARNING, "Attempt to edit control type %d\n", ct_type);
+ warning("Attempt to edit control type %d", ct_type);
}
}
@@ -1643,7 +1643,7 @@ static void _k_draw_control(state_t *s, reg_t obj, int inverse) {
break;
default:
- SCIkwarn(SCIkWARNING, "Unknown control type: %d at "PREG", at (%d, %d) size %d x %d\n",
+ warning("Unknown control type: %d at "PREG", at (%d, %d) size %d x %d",
type, PRINT_REG(obj), x, y, xl, yl);
}
@@ -1673,7 +1673,7 @@ static inline void draw_obj_to_control_map(state_t *s, gfxw_dyn_view_t *view) {
reg_t obj = make_reg(view->ID, view->subID);
if (!is_object(s, obj))
- SCIkwarn(SCIkWARNING, "View %d does not contain valid object reference "PREG"\n", view->ID, PRINT_REG(obj));
+ warning("View %d does not contain valid object reference "PREG"", view->ID, PRINT_REG(obj));
if (!(view->signalp && (((reg_t *)view->signalp)->offset & _K_VIEW_SIG_FLAG_IGNORE_ACTOR))) {
abs_rect_t abs_zone = get_nsrect(s, make_reg(view->ID, view->subID), 1);
@@ -1793,7 +1793,7 @@ int _k_view_list_dispose_loop(state_t *s, list_t *list, gfxw_dyn_view_t *widget,
if (!kfree(s, mem_handle)) {
*((reg_t*)(widget->under_bitsp)) = make_reg(0, widget->under_bits = 0);
} else {
- SCIkwarn(SCIkWARNING, "Treating viewobj "PREG" as no longer present\n", PRINT_REG(obj));
+ warning("Treating viewobj "PREG" as no longer present", PRINT_REG(obj));
obj = NULL_REG;
}
}
@@ -1801,9 +1801,9 @@ int _k_view_list_dispose_loop(state_t *s, list_t *list, gfxw_dyn_view_t *widget,
if (is_object(s, obj)) {
if (invoke_selector(INV_SEL(obj, delete_, 1), 0))
- SCIkwarn(SCIkWARNING, "Object at "PREG" requested deletion, but does not have a delete funcselector\n", PRINT_REG(obj));
+ warning("Object at "PREG" requested deletion, but does not have a delete funcselector", PRINT_REG(obj));
if (_k_animate_ran) {
- SCIkwarn(SCIkWARNING, "Object at "PREG" invoked kAnimate() during deletion!\n", PRINT_REG(obj));
+ warning("Object at "PREG" invoked kAnimate() during deletion", PRINT_REG(obj));
return dropped;
}
@@ -1923,7 +1923,7 @@ static gfxw_dyn_view_t *_k_make_dynview_obj(state_t *s, reg_t obj, int options,
return widget;
} else {
- SCIkwarn(SCIkWARNING, "Could not generate dynview widget for %d/%d/%d\n", view_nr, loop, cel);
+ warning("Could not generate dynview widget for %d/%d/%d", view_nr, loop, cel);
return NULL;
}
}
@@ -2278,7 +2278,7 @@ reg_t kAddToPic(state_t *s, int funct_nr, int argc, reg_t *argv) {
list_t *list;
if (!list_ref.segment) {
- SCIkdebug(SCIkWARNING, "Attempt to AddToPic single non-list: "PREG"\n", PRINT_REG(list_ref));
+ warning("Attempt to AddToPic single non-list: "PREG"", PRINT_REG(list_ref));
return s->r_acc;
}
@@ -2923,7 +2923,7 @@ static void animate_do_animation(state_t *s, int funct_nr, int argc, reg_t *argv
default:
if (s->pic_animate != K_ANIMATE_OPEN_SIMPLE)
- SCIkwarn(SCIkWARNING, "Unknown opening animation 0x%02x\n", s->pic_animate);
+ warning("Unknown opening animation 0x%02x", s->pic_animate);
GRAPH_UPDATE_BOX(s, 0, 10, 320, 190);
}
@@ -3155,7 +3155,7 @@ reg_t kDisplay(state_t *s, int funct_nr, int argc, reg_t *argv) {
if (temp == -1)
color0 = transparent;
else
- SCIkwarn(SCIkWARNING, "Display: Attempt to set invalid fg color %d\n", temp);
+ warning("Display: Attempt to set invalid fg color %d", temp);
break;
case K_DISPLAY_SET_BGCOLOR:
@@ -3172,7 +3172,7 @@ reg_t kDisplay(state_t *s, int funct_nr, int argc, reg_t *argv) {
if (temp == -1)
bg_color = transparent;
else
- SCIkwarn(SCIkWARNING, "Display: Attempt to set invalid fg color %d\n", temp);
+ warning("Display: Attempt to set invalid fg color %d", temp);
break;
case K_DISPLAY_SET_GRAYTEXT:
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 748590fc07..5380c30bd5 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -346,7 +346,7 @@ reg_t kAddAfter(state_t *s, int funct_nr, int argc, reg_t *argv) {
}
if (argc != 3) {
- SCIkdebug(SCIkWARNING, "Aborting.\n");
+ warning("kAddAfter: Haven't got 3 arguments, aborting");
return NULL_REG;
}
diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp
index d038f85c68..fb8a191337 100644
--- a/engines/sci/engine/kmath.cpp
+++ b/engines/sci/engine/kmath.cpp
@@ -124,7 +124,7 @@ reg_t kCosDiv(state_t *s, int funct_nr, int argc, reg_t *argv) {
double cosval = cos(angle * PI / 180.0);
if ((cosval < 0.0001) && (cosval > 0.0001)) {
- SCIkwarn(SCIkWARNING, "Attepted division by zero\n");
+ warning("Attepted division by zero");
return make_reg(0, (gint16)0x8000);
} else
return make_reg(0, (gint16)(value / cosval));
@@ -136,7 +136,7 @@ reg_t kSinDiv(state_t *s, int funct_nr, int argc, reg_t *argv) {
double sinval = sin(angle * PI / 180.0);
if ((sinval < 0.0001) && (sinval > 0.0001)) {
- SCIkwarn(SCIkWARNING, "Attepted division by zero\n");
+ warning("Attepted division by zero");
return make_reg(0, (gint16)0x8000);
} else
return make_reg(0, (gint16)(value / sinval));
@@ -148,7 +148,7 @@ reg_t kTimesTan(state_t *s, int funct_nr, int argc, reg_t *argv) {
param -= 90;
if ((param % 90) == 0) {
- SCIkwarn(SCIkWARNING, "Attempted tan(pi/2)");
+ warning("Attempted tan(pi/2)");
return make_reg(0, (gint16)0x8000);
} else
return make_reg(0, (gint16) - (tan(param * PI / 180.0) * scale));
@@ -159,7 +159,7 @@ reg_t kTimesCot(state_t *s, int funct_nr, int argc, reg_t *argv) {
int scale = SKPV_OR_ALT(1, 1);
if ((param % 90) == 0) {
- SCIkwarn(SCIkWARNING, "Attempted tan(pi/2)");
+ warning("Attempted tan(pi/2)");
return make_reg(0, (gint16)0x8000);
} else
return make_reg(0, (gint16)(tan(param * PI / 180.0) * scale));
diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp
index 86586d27d4..45e080016e 100644
--- a/engines/sci/engine/kmovement.cpp
+++ b/engines/sci/engine/kmovement.cpp
@@ -257,13 +257,13 @@ static void bresenham_autodetect(state_t *s) {
byte *buf;
if (obj == NULL) {
- SCIkwarn(SCIkWARNING, "bresenham_autodetect failed!");
+ warning("bresenham_autodetect failed");
handle_movecnt = INCREMENT_MOVECNT; // Most games do this, so best guess
return;
}
if (lookup_selector(s, motion_class, s->selector_map.doit, NULL, &fptr) != SELECTOR_METHOD) {
- SCIkwarn(SCIkWARNING, "bresenham_autodetect failed!");
+ warning("bresenham_autodetect failed");
handle_movecnt = INCREMENT_MOVECNT; // Most games do this, so best guess
return;
}
@@ -272,7 +272,7 @@ static void bresenham_autodetect(state_t *s) {
handle_movecnt = (SCI_VERSION_MAJOR(s->version) == 0 || checksum_bytes(buf, 8) == 0x216) ? INCREMENT_MOVECNT : IGNORE_MOVECNT;
sciprintf("b-moveCnt action based on checksum: %s\n", handle_movecnt == IGNORE_MOVECNT ? "ignore" : "increment");
} else {
- SCIkwarn(SCIkWARNING, "bresenham_autodetect failed!");
+ warning("bresenham_autodetect failed");
handle_movecnt = INCREMENT_MOVECNT; // Most games do this, so best guess
}
}
@@ -396,14 +396,14 @@ reg_t kDoAvoider(state_t *s, int funct_nr, int argc, reg_t *argv) {
s->r_acc = make_reg(0, -1);
if (!is_heap_object(s, avoider)) {
- SCIkwarn(SCIkWARNING, "DoAvoider() where avoider "PREG" is not an object\n", PRINT_REG(avoider));
+ warning("DoAvoider() where avoider "PREG" is not an object", PRINT_REG(avoider));
return NULL_REG;
}
client = GET_SEL32(avoider, client);
if (!is_heap_object(s, client)) {
- SCIkwarn(SCIkWARNING, "DoAvoider() where client "PREG" is not an object\n", PRINT_REG(client));
+ warning("DoAvoider() where client "PREG" is not an object", PRINT_REG(client));
return NULL_REG;
}
@@ -412,7 +412,7 @@ reg_t kDoAvoider(state_t *s, int funct_nr, int argc, reg_t *argv) {
if (!is_heap_object(s, mover)) {
if (mover.segment) {
- SCIkwarn(SCIkWARNING, "DoAvoider() where mover "PREG" is not an object\n", PRINT_REG(mover));
+ warning("DoAvoider() where mover "PREG" is not an object", PRINT_REG(mover));
}
return s->r_acc;
}
@@ -484,7 +484,7 @@ reg_t kDoAvoider(state_t *s, int funct_nr, int argc, reg_t *argv) {
angle -= 360;
}
- SCIkwarn(SCIkWARNING, "DoAvoider failed for avoider "PREG"\n", PRINT_REG(avoider));
+ warning("DoAvoider failed for avoider "PREG"", PRINT_REG(avoider));
} else {
int heading = GET_SEL32V(client, heading);
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 6a9cf8f80c..9d400d8aaa 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -252,7 +252,7 @@ static void draw_input(state_t *s, reg_t poly_list, Common::Point start, Common:
list = LOOKUP_LIST(poly_list);
if (!list) {
- SCIkwarn(SCIkWARNING, "Could not obtain polygon list\n");
+ warning("Could not obtain polygon list");
return;
}
@@ -298,7 +298,7 @@ static void print_input(state_t *s, reg_t poly_list, Common::Point start, Common
list = LOOKUP_LIST(poly_list);
if (!list) {
- SCIkwarn(SCIkWARNING, "Could not obtain polygon list\n");
+ warning("Could not obtain polygon list");
return;
}
@@ -1522,7 +1522,7 @@ reg_t kAvoidPath(state_t *s, int funct_nr, int argc, reg_t *argv) {
}
default:
- SCIkwarn(SCIkWARNING, "Unknown AvoidPath subfunction %d\n",
+ warning("Unknown AvoidPath subfunction %d",
argc);
return NULL_REG;
break;
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 6d8b3eb933..40e1d0159e 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -40,14 +40,14 @@ void write_selector(state_t *s, reg_t object, selector_t selector_id, reg_t valu
reg_t *address;
if ((selector_id < 0) || (selector_id > s->selector_names_nr)) {
- SCIkwarn(SCIkWARNING, "Attempt to write to invalid selector %d of"
- " object at "PREG" (%s L%d).\n", selector_id, PRINT_REG(object), fname, line);
+ warning("Attempt to write to invalid selector %d of"
+ " object at "PREG" (%s L%d).", selector_id, PRINT_REG(object), fname, line);
return;
}
if (lookup_selector(s, object, selector_id, &address, NULL) != SELECTOR_VARIABLE)
- SCIkwarn(SCIkWARNING, "Selector '%s' of object at %04x could not be"
- " written to (%s L%d)\n", s->selector_names[selector_id], object, fname, line);
+ warning("Selector '%s' of object at %04x could not be"
+ " written to (%s L%d)", s->selector_names[selector_id], object, fname, line);
else
*address = value;
}
@@ -209,7 +209,7 @@ reg_t kDisposeClone(state_t *s, int funct_nr, int argc, reg_t *argv) {
underBits = GET_SEL32V(victim_addr, underBits);
if (underBits) {
- SCIkwarn(SCIkWARNING, "Clone "PREG" was cleared with underBits set\n", PRINT_REG(victim_addr));
+ warning("Clone "PREG" was cleared with underBits set", PRINT_REG(victim_addr));
}
#if 0
if (s->dyn_views) { // Free any widget associated with the clone
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index efaa3f43cb..fc5bc49224 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -98,7 +98,7 @@ script_set_priority(state_t *s, reg_t obj, int priority) {
if (song->data[0] == 0xf0)
priority = song->data[1];
else
- SCIkdebug(SCIkWARNING, "Attempt to unset song priority when there is no built-in value!\n");
+ warning("Attempt to unset song priority when there is no built-in value");
flags &= ~SCI1_SOUND_FLAG_SCRIPTED_PRI;
} else flags |= SCI1_SOUND_FLAG_SCRIPTED_PRI;
@@ -131,7 +131,7 @@ process_sound_events(state_t *s) { /* Get all sound events, apply their changes
while ((result = sfx_poll(&s->sound, &handle, &cue))) {
reg_t obj = DEFROBNICATE_HANDLE(handle);
if (!is_object(s, obj)) {
- SCIkdebug(SCIkWARNING, "Non-object "PREG" received sound signal (%d/%d)\n", PRINT_REG(obj), result, cue);
+ warning("Non-object "PREG" received sound signal (%d/%d)", PRINT_REG(obj), result, cue);
return;
}
@@ -351,7 +351,7 @@ kDoSound_SCI0(state_t *s, int funct_nr, int argc, reg_t *argv) {
break;
default:
- SCIkwarn(SCIkWARNING, "Unhandled DoSound command: %x\n", command);
+ warning("Unhandled DoSound command: %x", command);
}
// process_sound_events(s); /* Take care of incoming events */
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 3141171849..4f15276f21 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -124,7 +124,7 @@ kSaid(state_t *s, int funct_nr, int argc, reg_t *argv) {
said_block = (byte *) kernel_dereference_bulk_pointer(s, heap_said_block, 0);
if (!said_block) {
- SCIkdebug(SCIkWARNING, "Said on non-string, pointer "PREG"\n", PRINT_REG(heap_said_block));
+ warning("Said on non-string, pointer "PREG"", PRINT_REG(heap_said_block));
return NULL_REG;
}
@@ -235,7 +235,7 @@ kSetSynonyms(state_t *s, int funct_nr, int argc, reg_t *argv) {
synpos++;
}
- } else SCIkwarn(SCIkWARNING, "Synonyms of script.%03d were requested, but script is not available\n");
+ } else warning("Synonyms of script.%03d were requested, but script is not available");
}
@@ -379,12 +379,12 @@ kStrCpy(state_t *s, int funct_nr, int argc, reg_t *argv) {
char *src = (char *) kernel_dereference_bulk_pointer(s, argv[1], 0);
if (!dest) {
- SCIkdebug(SCIkWARNING, "Attempt to strcpy TO invalid pointer "PREG"!\n",
+ warning("Attempt to strcpy TO invalid pointer "PREG"",
PRINT_REG(argv[0]));
return NULL_REG;
}
if (!src) {
- SCIkdebug(SCIkWARNING, "Attempt to strcpy FROM invalid pointer "PREG"!\n",
+ warning("Attempt to strcpy FROM invalid pointer "PREG"",
PRINT_REG(argv[1]));
return NULL_REG;
}
@@ -399,7 +399,7 @@ kStrCpy(state_t *s, int funct_nr, int argc, reg_t *argv) {
reg_t *srcp = (reg_t *) src;
int i;
- SCIkdebug(SCIkWARNING, "Performing reg_t to raw conversion for AvoidPath\n");
+ warning("Performing reg_t to raw conversion for AvoidPath");
for (i = 0; i < -length / 2; i++) {
dest[2 * i] = srcp->offset & 0xff;
dest[2 * i + 1] = srcp->offset >> 8;
@@ -421,7 +421,7 @@ kStrAt(state_t *s, int funct_nr, int argc, reg_t *argv) {
reg_t *dest2;
if (!dest) {
- SCIkdebug(SCIkWARNING, "Attempt to StrAt at invalid pointer "PREG"!\n",
+ warning("Attempt to StrAt at invalid pointer "PREG"",
PRINT_REG(argv[0]));
return NULL_REG;
}
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 6ead77cad9..6fa17d5227 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -2525,7 +2525,6 @@ c_handle_config_update(const generic_config_flag_t *flags, int flags_nr,
}
const generic_config_flag_t SCIk_Debug_Names[SCIk_DEBUG_MODES] = {
- {"Stubs", 'u', (1 << SCIkSTUB_NR)},
{"Lists and nodes", 'l', (1 << 1)},
{"Graphics", 'g', (1 << 2)},
{"Character handling", 'c', (1 << 3)},
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 622fad8920..9aee6eb123 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -23,6 +23,7 @@
*
*/
+#include "common/debug.h"
#include "sci/include/sciresource.h"
#include "sci/include/engine.h"
@@ -739,7 +740,7 @@ run_vm(state_t *s, int restoring) {
scr = script_locate_by_segment(s, xs->addr.pc.segment);
if (!scr) {
/* No script? Implicit return via fake instruction buffer */
- SCIkdebug(SCIkWARNING, "Running on non-existant script in segment %x!\n", xs->addr.pc.segment);
+ warning("Running on non-existant script in segment %x!\n", xs->addr.pc.segment);
code_buf = _fake_return_buffer;
#ifndef DISABLE_VALIDATIONS
code_buf_size = 2;
@@ -760,7 +761,7 @@ run_vm(state_t *s, int restoring) {
local_script = script_locate_by_segment(s, xs->local_segment);
if (!local_script) {
- SCIkdebug(SCIkWARNING, "Could not find local script from segment %x!\n", xs->local_segment);
+ warning("Could not find local script from segment %x", xs->local_segment);
local_script = NULL;
variables_base[VAR_LOCAL] = variables[VAR_LOCAL] = NULL;
#ifndef DISABLE_VALIDATIONS
diff --git a/engines/sci/gfx/resource/sci_pic_0.cpp b/engines/sci/gfx/resource/sci_pic_0.cpp
index a14f705727..ccb8790578 100644
--- a/engines/sci/gfx/resource/sci_pic_0.cpp
+++ b/engines/sci/gfx/resource/sci_pic_0.cpp
@@ -132,7 +132,7 @@ gfxr_init_static_palette() {
gfx_sci0_pic_colors[i].b = INTERCOL(gfx_sci0_image_colors[sci0_palette][i & 0xf].b,
gfx_sci0_image_colors[sci0_palette][i >> 4].b);
}
- //WARNING("Uncomment me after fixing sci0_palette changes to reset me");
+ //warning("Uncomment me after fixing sci0_palette changes to reset me");
/* _gfxr_pic0_colors_initialized = 1; */
}
}
@@ -1873,7 +1873,7 @@ gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size,
case PIC_OP_TERMINATE:
p0printf("Terminator\n");
- /* WARNING( "ARTIFACT REMOVAL CODE is commented out!") */
+ /* warning( "ARTIFACT REMOVAL CODE is commented out!") */
/* _gfxr_vismap_remove_artifacts(); */
return;
diff --git a/engines/sci/include/kdebug.h b/engines/sci/include/kdebug.h
index fba5a1ee25..dbe890f8ff 100644
--- a/engines/sci/include/kdebug.h
+++ b/engines/sci/include/kdebug.h
@@ -29,11 +29,10 @@
#define _SCI_KDEBUG_H_
struct _state;
-#define SCIk_DEBUG_MODES 18
+#define SCIk_DEBUG_MODES 17
#define SCIkERROR_NR -2
#define SCIkWARNING_NR -1
-#define SCIkSTUB_NR 0
#define SCIkFUNCCHK_NR 5
#define SCIkSOUNDCHK_NR 7
#define SCIkGFXDRIVER_NR 8
@@ -42,8 +41,6 @@ struct _state;
#define SCIkAVOIDPATH_NR 17
#define SCIkERROR s, __FILE__, __LINE__, SCIkERROR_NR
-#define SCIkWARNING s, __FILE__, __LINE__, SCIkWARNING_NR
-#define SCIkSTUB s, __FILE__, __LINE__, SCIkSTUB_NR
#define SCIkNODES s, __FILE__, __LINE__, 1
#define SCIkGRAPHICS s, __FILE__, __LINE__, 2
#define SCIkSTRINGS s, __FILE__, __LINE__, 3
diff --git a/engines/sci/include/kernel.h b/engines/sci/include/kernel.h
index 16e4c187d8..e9467e246e 100644
--- a/engines/sci/include/kernel.h
+++ b/engines/sci/include/kernel.h
@@ -27,6 +27,7 @@
#define _SCI_KERNEL_H_
#include "common/scummsys.h"
+#include "common/debug.h"
#include "sci/include/kdebug.h"
#include "sci/include/uinput.h"
@@ -113,12 +114,6 @@ kernel_lookup_text(struct _state *s, reg_t address, int index);
/******************** Debug functionality ********************/
#define KERNEL_OOPS(reason) kernel_oops(s, __FILE__, __LINE__, reason)
-/* Non-fatal assertion */
-#define SCIkASSERT(a) if (!(a)) { \
- SCIkwarn(SCIkERROR, "Assertion " #a " failed in " __FILE__ " line %d\n", __LINE__); \
- return; \
-}
-
#ifdef SCI_KERNEL_DEBUG
#define CHECK_THIS_KERNEL_FUNCTION if (s->debug_mode & (1 << SCIkFUNCCHK_NR)) {\
diff --git a/engines/sci/include/resource.h b/engines/sci/include/resource.h
index ed9e420933..278810490d 100644
--- a/engines/sci/include/resource.h
+++ b/engines/sci/include/resource.h
@@ -298,6 +298,4 @@ sci_sched_yield(void);
# define BREAKPOINT() { fprintf(stderr, "Missed breakpoint in %s, line %d\n", __FILE__, __LINE__); *((int *) NULL) = 42; }
#endif /* !BREAKPOINT() */
-#define WARNING(foo) {char i; i = 500;}
-
#endif
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 50bf26d51c..d2450f69b7 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -139,7 +139,24 @@ SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc)
//printf("%s\n", _gameDataPath.c_str());
// Set up the engine specific debug levels
- //Common::addSpecialDebugLevel(SCI_DEBUG_RESOURCES, "resources", "Debug the resources loading");
+ Common::addDebugChannel(kDebugLevelError, "Error", "Script error debugging");
+ Common::addDebugChannel(kDebugLevelNodes, "Lists", "Lists and nodes debugging");
+ Common::addDebugChannel(kDebugLevelGraphics, "Graphics", "Graphics debugging");
+ Common::addDebugChannel(kDebugLevelStrings, "Strings", "Strings debugging");
+ Common::addDebugChannel(kDebugLevelMem, "Memory", "Memory debugging");
+ Common::addDebugChannel(kDebugLevelFuncCheck, "Func", "Function parameter debugging");
+ Common::addDebugChannel(kDebugLevelBresen, "Bresenham", "Bresenham algorithms debugging");
+ Common::addDebugChannel(kDebugLevelSound, "Sound", "Sound debugging");
+ Common::addDebugChannel(kDebugLevelGfxDriver, "Gfxdriver", "Gfx driver debugging");
+ Common::addDebugChannel(kDebugLevelBaseSetter, "Base", "Base Setter debugging");
+ Common::addDebugChannel(kDebugLevelParser, "Parser", "Parser debugging");
+ Common::addDebugChannel(kDebugLevelMenu, "Menu", "Menu handling debugging");
+ Common::addDebugChannel(kDebugLevelSaid, "Said", "Said specs debugging");
+ Common::addDebugChannel(kDebugLevelFile, "File", "File I/O debugging");
+ Common::addDebugChannel(kDebugLevelTime, "Time", "Time debugging");
+ Common::addDebugChannel(kDebugLevelRoom, "Room", "Room number debugging");
+ Common::addDebugChannel(kDebugLevelEmu, "Emu", "Alternate emulation debugging");
+ Common::addDebugChannel(kDebugLevelAvoidPath, "Pathfinding", "Pathfinding debugging");
printf("SciEngine::SciEngine\n");
}
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index b5951ca398..ea846ee42d 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -32,9 +32,25 @@
namespace Sci {
// our engine debug levels
-enum {
- SCI_DEBUG_RESOURCES = 1 << 0,
- SCI_DEBUG_todo = 1 << 1
+enum kDebugLevels {
+ kDebugLevelError = 1 << 0,
+ kDebugLevelNodes = 1 << 1,
+ kDebugLevelGraphics = 1 << 2,
+ kDebugLevelStrings = 1 << 3,
+ kDebugLevelMem = 1 << 4,
+ kDebugLevelFuncCheck = 1 << 5,
+ kDebugLevelBresen = 1 << 6,
+ kDebugLevelSound = 1 << 7,
+ kDebugLevelGfxDriver = 1 << 8,
+ kDebugLevelBaseSetter = 1 << 9,
+ kDebugLevelParser = 1 << 10,
+ kDebugLevelMenu = 1 << 11,
+ kDebugLevelSaid = 1 << 12,
+ kDebugLevelFile = 1 << 13,
+ kDebugLevelTime = 1 << 14,
+ kDebugLevelRoom = 1 << 15,
+ kDebugLevelEmu = 1 << 16,
+ kDebugLevelAvoidPath = 1 << 17
};
struct GameFlags {