aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/game.cpp8
-rw-r--r--engines/sci/engine/gc.cpp2
-rw-r--r--engines/sci/engine/heap.cpp2
-rw-r--r--engines/sci/engine/kernel.cpp22
-rw-r--r--engines/sci/engine/kfile.cpp20
-rw-r--r--engines/sci/engine/kgraphics.cpp68
-rw-r--r--engines/sci/engine/klists.cpp30
-rw-r--r--engines/sci/engine/kmovement.cpp8
-rw-r--r--engines/sci/engine/kscripts.cpp12
-rw-r--r--engines/sci/engine/ksound.cpp4
-rw-r--r--engines/sci/engine/kstring.cpp10
-rw-r--r--engines/sci/engine/said.cpp18
-rw-r--r--engines/sci/engine/scriptconsole.cpp14
-rw-r--r--engines/sci/engine/scriptdebug.cpp48
-rw-r--r--engines/sci/engine/seg_manager.cpp28
-rw-r--r--engines/sci/engine/sys_strings.cpp7
-rw-r--r--engines/sci/engine/vm.cpp14
17 files changed, 158 insertions, 157 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index bbb02fe87c..28f0454710 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -53,7 +53,7 @@ static int _init_vocabulary(state_t *s) { // initialize vocabulary and related r
s->opcodes = vocabulary_get_opcodes(s->resmgr);
if (!(s->selector_names = vocabulary_get_snames(s->resmgr, NULL, s->version))) {
- sciprintf("_init_vocabulary(): Could not retrieve selector names (vocab.997)!\n");
+ sciprintf("_init_vocabulary(): Could not retrieve selector names (vocab.997)");
return 1;
}
@@ -150,7 +150,7 @@ int _reset_graphics_input(state_t *s) {
_sci1_alloc_system_colors(s);
scir_unlock_resource(s->resmgr, resource, sci_palette, 999);
} else {
- sciprintf("Couldn't find the default palette!\n");
+ sciprintf("Couldn't find the default palette");
}
}
}
@@ -328,7 +328,7 @@ int create_class_table_sci11(state_t *s) {
classnr = getUInt16((byte*)seeker_ptr + 10);
if (classnr >= s->classtable_size) {
if (classnr >= SCRIPT_MAX_CLASSTABLE_SIZE) {
- fprintf(stderr, "Invalid class number 0x%x in script.%d(0x%x), offset %04x\n",
+ error("Invalid class number 0x%x in script.%d(0x%x), offset %04x\n",
classnr, scriptnr, scriptnr, seeker_offset);
return 1;
}
@@ -402,7 +402,7 @@ static int create_class_table_sci0(state_t *s) {
if (classnr >= s->classtable_size) {
if (classnr >= SCRIPT_MAX_CLASSTABLE_SIZE) {
- fprintf(stderr, "Invalid class number 0x%x in script.%d(0x%x), offset %04x\n",
+ error("Invalid class number 0x%x in script.%d(0x%x), offset %04x\n",
classnr, scriptnr, scriptnr, seeker);
return 1;
}
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp
index 86ab8f3cd5..bf523e5f7b 100644
--- a/engines/sci/engine/gc.cpp
+++ b/engines/sci/engine/gc.cpp
@@ -77,7 +77,7 @@ static reg_t worklist_pop(worklist_t **wlp) {
reg_t retval;
if (!wl || !wl->used) {
- fprintf(stderr, "Attempt to pop from empty worklist");
+ error("Attempt to pop from empty worklist");
exit(1);
}
diff --git a/engines/sci/engine/heap.cpp b/engines/sci/engine/heap.cpp
index 35f7b7066e..b356172c16 100644
--- a/engines/sci/engine/heap.cpp
+++ b/engines/sci/engine/heap.cpp
@@ -116,7 +116,7 @@ heap_ptr heap_allocate(heap_t *h, int size) {
unsigned int current = previous;
if (!size) {
- fprintf(stderr, "Warning: heap_alloc'd zero bytes!\n");
+ error("Warning: heap_alloc'd zero bytes");
size += 2;
}
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 26f112fa6a..b84753a638 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -353,7 +353,7 @@ static const char *argtype_description[] = { "Undetermined (WTF?)", "List", "Nod
int kernel_oops(state_t *s, const char *file, int line, const char *reason) {
sciprintf("Kernel Oops in file %s, line %d: %s\n", file, line, reason);
- fprintf(stderr, "Kernel Oops in file %s, line %d: %s\n", file, line, reason);
+ error("Kernel Oops in file %s, line %d: %s\n", file, line, reason);
script_debug_flag = script_error_flag = 1;
return 0;
}
@@ -386,7 +386,7 @@ byte *kmem(state_t *s, reg_t handle) {
hunk_table_t *ht = &(mobj->data.hunks);
if (!mobj || !ENTRY_IS_VALID(ht, handle.offset)) {
- SCIkwarn(SCIkERROR, "Error: kmem() with invalid handle\n");
+ error("Error: kmem() with invalid handle\n");
return NULL;
}
@@ -504,7 +504,7 @@ reg_t kGetTime(state_t *s, int funct_nr, int argc, reg_t *argv) {
#ifdef WIN32
if (TIMERR_NOERROR != timeBeginPeriod(1)) {
- fprintf(stderr, "timeBeginPeriod(1) failed in kGetTime!\n");
+ error("timeBeginPeriod(1) failed in kGetTime");
}
#endif // WIN32
@@ -513,7 +513,7 @@ reg_t kGetTime(state_t *s, int funct_nr, int argc, reg_t *argv) {
#ifdef WIN32
if (TIMERR_NOERROR != timeEndPeriod(1)) {
- fprintf(stderr, "timeEndPeriod(1) failed in kGetTime!\n");
+ error("timeEndPeriod(1) failed in kGetTime");
}
#endif // WIN32
@@ -577,7 +577,7 @@ reg_t kMemory(state_t *s, int funct_nr, int argc, reg_t *argv) {
switch (UKPV(0)) {
case K_MEMORY_ALLOCATE_CRITICAL :
if (!sm_alloc_dynmem(&s->seg_manager, UKPV(1), "kMemory() critical", &s->r_acc)) {
- SCIkwarn(SCIkERROR, "Critical heap allocation failed\n");
+ error("Critical heap allocation failed\n");
script_error_flag = script_debug_flag = 1;
}
return s->r_acc;
@@ -587,7 +587,7 @@ reg_t kMemory(state_t *s, int funct_nr, int argc, reg_t *argv) {
break;
case K_MEMORY_FREE :
if (sm_free_dynmem(&s->seg_manager, argv[1])) {
- SCIkwarn(SCIkERROR, "Attempt to kMemory::free() non-dynmem pointer "PREG"!\n", PRINT_REG(argv[1]));
+ error("Attempt to kMemory::free() non-dynmem pointer "PREG"", PRINT_REG(argv[1]));
}
break;
case K_MEMORY_MEMCPY : {
@@ -612,7 +612,7 @@ reg_t kMemory(state_t *s, int funct_nr, int argc, reg_t *argv) {
byte *ref = kernel_dereference_bulk_pointer(s, argv[1], 2);
if (!ref) {
- SCIkdebug(SCIkERROR, "Attempt to poke invalid memory at "PREG"!\n", PRINT_REG(argv[1]));
+ error("Attempt to poke invalid memory at "PREG"", PRINT_REG(argv[1]));
return s->r_acc;
}
if (s->seg_manager.heap[argv[1].segment]->type == MEM_OBJ_LOCALS)
@@ -625,7 +625,7 @@ reg_t kMemory(state_t *s, int funct_nr, int argc, reg_t *argv) {
byte *ref = kernel_dereference_bulk_pointer(s, argv[1], 2);
if (!ref) {
- SCIkdebug(SCIkERROR, "Attempt to poke invalid memory at "PREG"!\n", PRINT_REG(argv[1]));
+ error("Attempt to poke invalid memory at "PREG"", PRINT_REG(argv[1]));
return s->r_acc;
}
@@ -633,7 +633,7 @@ reg_t kMemory(state_t *s, int funct_nr, int argc, reg_t *argv) {
*((reg_t *) ref) = argv[2];
else {
if (argv[2].segment) {
- SCIkdebug(SCIkERROR, "Attempt to poke memory reference "PREG" to "PREG"!\n", PRINT_REG(argv[2]), PRINT_REG(argv[1]));
+ error("Attempt to poke memory reference "PREG" to "PREG"", PRINT_REG(argv[2]), PRINT_REG(argv[1]));
return s->r_acc;
putInt16(ref, argv[2].offset); // ???
}
@@ -951,12 +951,12 @@ static inline void *_kernel_dereference_pointer(struct _state *s, reg_t pointer,
void *retval = sm_dereference(&s->seg_manager, pointer, &maxsize);
if (pointer.offset & (align - 1)) {
- SCIkdebug(SCIkERROR, "Unaligned pointer read: "PREG" expected with %d alignment!\n", PRINT_REG(pointer), align);
+ error("Unaligned pointer read: "PREG" expected with %d alignment", PRINT_REG(pointer), align);
return NULL;
}
if (entries > maxsize) {
- SCIkdebug(SCIkERROR, "Trying to dereference pointer "PREG" beyond end of segment!\n", PRINT_REG(pointer));
+ error("Trying to dereference pointer "PREG" beyond end of segment", PRINT_REG(pointer));
return NULL;
}
return retval;
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 7580782472..2b22f6d87a 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -144,7 +144,7 @@ void file_open(state_t *s, char *filename, int mode) {
SCIkdebug(SCIkFILE, "Failed. Attempting to copy from resource dir...\n");
file = f_open_mirrored(s, filename);
if (file)
- SCIkdebug(SCIkFILE, "Success!\n");
+ SCIkdebug(SCIkFILE, "Success");
else
SCIkdebug(SCIkFILE, "Not found.\n");
}
@@ -181,12 +181,12 @@ reg_t kFOpen(state_t *s, int funct_nr, int argc, reg_t *argv) {
static FILE *getFileFromHandle(state_t *s, int handle) {
if (handle == 0) {
- SCIkwarn(SCIkERROR, "Attempt to use file handle 0\n");
+ error("Attempt to use file handle 0\n");
return 0;
}
if ((handle >= s->file_handles_nr) || (s->file_handles[handle] == NULL)) {
- SCIkwarn(SCIkERROR, "Attempt to use invalid/unused file handle %d\n", handle);
+ error("Attempt to use invalid/unused file handle %d\n", handle);
return 0;
}
@@ -421,7 +421,7 @@ reg_t kDeviceInfo_Win32(state_t *s, int funct_nr, int argc, reg_t *argv) {
}
break;
default: {
- SCIkwarn(SCIkERROR, "Unknown DeviceInfo() sub-command: %d\n", mode);
+ error("Unknown DeviceInfo() sub-command: %d\n", mode);
}
}
return s->r_acc;
@@ -483,7 +483,7 @@ reg_t kDeviceInfo_Unix(state_t *s, int funct_nr, int argc, reg_t *argv) {
}
break;
default: {
- SCIkwarn(SCIkERROR, "Unknown DeviceInfo() sub-command: %d\n", mode);
+ error("Unknown DeviceInfo() sub-command: %d\n", mode);
}
}
@@ -780,13 +780,13 @@ reg_t kSaveGame(state_t *s, int funct_nr, int argc, reg_t *argv) {
} else ++i;
}
if (savedir_id >= MAX_SAVEGAME_NR) {
- sciprintf("Internal error: Free savegame ID is %d, shouldn't happen!\n", savedir_id);
+ sciprintf("Internal error: Free savegame ID is %d, shouldn't happen", savedir_id);
return NULL_REG;
}
// This loop terminates when savedir_id is not in [x | ex. n. _savegame_indices[n].id = x]
} else {
- sciprintf("Savegame ID %d is not allowed!\n", savedir_nr);
+ sciprintf("Savegame ID %d is not allowed", savedir_nr);
return NULL_REG;
}
@@ -853,7 +853,7 @@ reg_t kRestoreGame(state_t *s, int funct_nr, int argc, reg_t *argv) {
}
} else {
s->r_acc = make_reg(0, 1);
- sciprintf("Savegame #%d not found!\n", savedir_nr);
+ sciprintf("Savegame #%d not found", savedir_nr);
}
_chdir_restoredir(workdir);
@@ -904,7 +904,7 @@ void next_file(state_t *s) {
void first_file(state_t *s, const char *dir, char *mask, reg_t buffer) {
if (!buffer.segment) {
- sciprintf("Warning: first_file(state,\"%s\",\"%s\", 0) invoked!\n", dir, mask);
+ sciprintf("Warning: first_file(state,\"%s\",\"%s\", 0) invoked", dir, mask);
s->r_acc = NULL_REG;
return;
}
@@ -1014,7 +1014,7 @@ reg_t kFileIO(state_t *s, int funct_nr, int argc, reg_t *argv) {
break;
}
default :
- SCIkwarn(SCIkERROR, "Unknown FileIO() sub-command: %d\n", func_nr);
+ error("Unknown FileIO() sub-command: %d\n", func_nr);
}
return s->r_acc;
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index c4fb62c7d3..8f41ac2d91 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -90,7 +90,7 @@
if (val == GFX_ERROR) \
warning("GFX subsystem returned error on \"" #x "\""); \
else {\
- SCIkwarn(SCIkERROR, "GFX subsystem fatal error condition on \"" #x "\"!\n"); \
+ error("GFX subsystem fatal error condition on \"" #x "\""); \
vm_handle_fatal_error(s, __LINE__, __FILE__); \
} \
}\
@@ -99,7 +99,7 @@
#define ASSERT(x) { \
int val = !!(x); \
if (!val) { \
- SCIkwarn(SCIkERROR, "Fatal error condition on \"" #x "\"!\n"); \
+ error("Fatal error condition on \"" #x "\""); \
BREAKPOINT(); \
vm_handle_fatal_error(s, __LINE__, __FILE__); \
} \
@@ -218,7 +218,7 @@ void graph_restore_box(state_t *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);
- SCIkwarn(SCIkERROR, "Port %d is not immune against snapshots!\n", s->port->ID);
+ error("Port %d is not immune against snapshots", s->port->ID);
port_nr--;
if (newport)
s->port = newport;
@@ -232,7 +232,7 @@ void graph_restore_box(state_t *s, reg_t handle) {
} while (parent && (gfxw_widget_matches_snapshot(*ptr, GFXW(parent))));
if (!parent) {
- SCIkwarn(SCIkERROR, "Attempted widget mass destruction by a snapshot\n");
+ error("Attempted widget mass destruction by a snapshot\n");
BREAKPOINT();
}
@@ -241,7 +241,7 @@ void graph_restore_box(state_t *s, reg_t handle) {
if (!ptr) {
- SCIkwarn(SCIkERROR, "Attempt to restore invalid snaphot with handle %04x!\n", handle);
+ error("Attempt to restore invalid snaphot with handle %04x", handle);
return;
}
@@ -271,7 +271,7 @@ gfx_pixmap_color_t *get_pic_color(state_t *s, int color) {
else if (color < KERNEL_COLORS_NR)
return &(KERNEL_COLOR_PALETTE[color]);
else {
- SCIkwarn(SCIkERROR, "Color index %d out of bounds for pic %d (%d max)", color, s->gfx_state->pic_nr, KERNEL_COLORS_NR);
+ error("Color index %d out of bounds for pic %d (%d max)", color, s->gfx_state->pic_nr, KERNEL_COLORS_NR);
BREAKPOINT();
return NULL;
}
@@ -332,7 +332,7 @@ reg_t kSetCursor_SCI11(state_t *s, int funct_nr, int argc, reg_t *argv) {
break;
}
default :
- SCIkwarn(SCIkERROR, "kSetCursor: Unhandled case: %d arguments given!\n", argc);
+ error("kSetCursor: Unhandled case: %d arguments given", argc);
break;
}
return s->r_acc;
@@ -435,7 +435,7 @@ reg_t kPicNotValid(state_t *s, int funct_nr, int argc, reg_t *argv) {
}
void _k_redraw_box(state_t *s, int x1, int y1, int x2, int y2) {
- sciprintf("_k_redraw_box(): Unimplemented!\n");
+ sciprintf("_k_redraw_box(): Unimplemented");
#if 0
int i;
view_object_t *list = s->dyn_views;
@@ -710,7 +710,7 @@ void _k_dirloop(reg_t obj, word angle, state_t *s, int funct_nr, int argc, reg_t
maxloops = gfxop_lookup_view_get_loops(s->gfx_state, view);
if (maxloops == GFX_ERROR) {
- SCIkwarn(SCIkERROR, "Invalid view.%03d\n", view);
+ error("Invalid view.%03d\n", view);
return;
} else if ((loop > 1) && (maxloops < 4))
return;
@@ -901,7 +901,7 @@ reg_t kCelHigh(state_t *s, int funct_nr, int argc, reg_t *argv) {
}
if (gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset)) {
- SCIkwarn(SCIkERROR, "Invalid loop (%d) or cel (%d) in view.%d (0x%x), or view invalid\n", loop, cel, view, view);
+ error("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);
@@ -919,7 +919,7 @@ reg_t kCelWide(state_t *s, int funct_nr, int argc, reg_t *argv) {
}
if (gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset)) {
- SCIkwarn(SCIkERROR, "Invalid loop (%d) or cel (%d) in view.%d (0x%x), or view invalid\n", loop, cel, view, view);
+ error("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);
@@ -931,7 +931,7 @@ reg_t kNumLoops(state_t *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) {
- SCIkwarn(SCIkERROR, "view.%d (0x%x) not found\n", view, view);
+ error("view.%d (0x%x) not found\n", view, view);
return NULL_REG;
}
@@ -950,7 +950,7 @@ reg_t kNumCels(state_t *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...
- SCIkwarn(SCIkERROR, "view.%d (0x%x) not found\n", view, view);
+ error("view.%d (0x%x) not found\n", view, view);
return NULL_REG;
}
@@ -1054,10 +1054,10 @@ reg_t kDrawPic(state_t *s, int funct_nr, int argc, reg_t *argv) {
if (sci01_priority_table_flags & 0x2) {
if (s->pic_priority_table) {
int i;
- fprintf(stderr, "---------------------------\nPriority table:\n");
+ error("---------------------------\nPriority table:\n");
for (i = 0; i < 16; i++)
- fprintf(stderr, "\t%d:\t%d\n", i, s->pic_priority_table[i]);
- fprintf(stderr, "---------------------------\n");
+ error("\t%d:\t%d\n", i, s->pic_priority_table[i]);
+ error("---------------------------\n");
}
}
if (sci01_priority_table_flags & 0x1)
@@ -1115,7 +1115,7 @@ abs_rect_t set_base(state_t *s, reg_t object) {
if (loop != oldloop) {
loop = 0;
PUT_SEL32V(object, loop, 0);
- SCIkdebug(SCIkGRAPHICS, "Resetting loop for "PREG"!\n", PRINT_REG(object));
+ SCIkdebug(SCIkGRAPHICS, "Resetting loop for "PREG"", PRINT_REG(object));
}
if (cel != oldcel) {
@@ -1719,19 +1719,19 @@ static void _k_view_list_do_postdraw(state_t *s, gfxw_list_t *list) {
temp = GET_SEL32V(obj, nsBottom);
PUT_SEL32V(obj, lsBottom, temp);
#ifdef DEBUG_LSRECT
- fprintf(stderr, "lsRected "PREG"\n", PRINT_REG(obj));
+ error("lsRected "PREG"\n", PRINT_REG(obj));
#endif
}
#ifdef DEBUG_LSRECT
else
- fprintf(stderr, "Not lsRecting "PREG" because %d\n", PRINT_REG(obj), lookup_selector(s, obj, s->selector_map.nsBottom, NULL, NULL));
+ error("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
- fprintf(stderr, "obj "PREG" has pflags %x\n", PRINT_REG(obj), (widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)));
+ error("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) {
@@ -1783,7 +1783,7 @@ int _k_view_list_dispose_loop(state_t *s, list_t *list, gfxw_dyn_view_t *widget,
reg_t under_bits = NULL_REG;
if (!is_object(s, obj)) {
- SCIkwarn(SCIkERROR, "Non-object "PREG" present in view list during delete time\n", PRINT_REG(obj));
+ error("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?
@@ -1820,7 +1820,7 @@ int _k_view_list_dispose_loop(state_t *s, list_t *list, gfxw_dyn_view_t *widget,
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))) {
- SCIkwarn(SCIkERROR, "Attempt to remove view with ID %x:%x from list failed!\n", widget->ID, widget->subID);
+ error("Attempt to remove view with ID %x:%x from list failed", widget->ID, widget->subID);
BREAKPOINT();
}
@@ -1938,7 +1938,7 @@ static void _k_make_view_list(state_t *s, gfxw_list_t **widget_list, list_t *lis
gfxw_dyn_view_t *widget;
if (!*widget_list) {
- SCIkwarn(SCIkERROR, "make_view_list with widget_list == ()\n");
+ error("make_view_list with widget_list == ()\n");
BREAKPOINT();
};
@@ -1947,7 +1947,7 @@ static void _k_make_view_list(state_t *s, gfxw_list_t **widget_list, list_t *lis
// Yes, this _does_ happen!
if (!list) { // list sanity check
- SCIkwarn(SCIkERROR, "Attempt to make list from non-list!\n");
+ error("Attempt to make list from non-list");
BREAKPOINT();
}
@@ -2066,7 +2066,7 @@ static void _k_prepare_view_list(state_t *s, gfxw_list_t *list, int options) {
// Never happens
/* if (view->signal & 0) {
view->signal &= ~_K_VIEW_SIG_FLAG_FREESCI_STOPUPD;
- fprintf(stderr, "Unsetting magic StopUpd for view "PREG"\n", PRINT_REG(obj));
+ error("Unsetting magic StopUpd for view "PREG"\n", PRINT_REG(obj));
} */
view = (gfxw_dyn_view_t *) view->next;
@@ -2265,7 +2265,7 @@ reg_t kAddToPic(state_t *s, int funct_nr, int argc, reg_t *argv) {
priority, -1 /* No priority */ , ALIGN_CENTER, ALIGN_BOTTOM, 0));
if (!widget) {
- SCIkwarn(SCIkERROR, "Attempt to single-add invalid picview (%d/%d/%d)\n", view, loop, cel);
+ error("Attempt to single-add invalid picview (%d/%d/%d)\n", view, loop, cel);
} else {
widget->ID = -1;
if (control >= 0) {
@@ -2329,7 +2329,7 @@ reg_t kSetPort(state_t *s, int funct_nr, int argc, reg_t *argv) {
new_port = gfxw_find_port(s->visual, port_nr);
if (!new_port) {
- SCIkwarn(SCIkERROR, "Invalid port %04x requested\n", port_nr);
+ error("Invalid port %04x requested\n", port_nr);
return NULL_REG;
}
@@ -2357,7 +2357,7 @@ reg_t kSetPort(state_t *s, int funct_nr, int argc, reg_t *argv) {
break;
}
default :
- SCIkwarn(SCIkERROR, "SetPort was called with %d parameters\n", argc);
+ error("SetPort was called with %d parameters\n", argc);
break;
}
@@ -2386,13 +2386,13 @@ reg_t kDrawCel(state_t *s, int funct_nr, int argc, reg_t *argv) {
/*
if (!view) {
- SCIkwarn(SCIkERROR, "Attempt to draw non-existing view.%03d\n", view);
+ error("Attempt to draw non-existing view.%03d\n", view);
return;
}
*/
if (gfxop_check_cel(s->gfx_state, view, &loop, &cel)) {
- SCIkwarn(SCIkERROR, "Attempt to draw non-existing view.%03d\n", view);
+ error("Attempt to draw non-existing view.%03d\n", view);
return s->r_acc;
}
@@ -2420,7 +2420,7 @@ reg_t kDisposeWindow(state_t *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)) {
- SCIkwarn(SCIkERROR, "Removal of invalid window %04x requested\n", goner_nr);
+ error("Removal of invalid window %04x requested\n", goner_nr);
return s->r_acc;
}
@@ -2569,7 +2569,7 @@ static void animate_do_animation(state_t *s, int funct_nr, int argc, reg_t *argv
gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen);
if (!newscreen) {
- SCIkwarn(SCIkERROR, "Failed to allocate 'newscreen'!\n");
+ error("Failed to allocate 'newscreen'");
return;
}
@@ -3121,7 +3121,7 @@ reg_t kDisplay(state_t *s, int funct_nr, int argc, reg_t *argv) {
}
if (!text) {
- SCIkdebug(SCIkERROR, "Display with invalid reference "PREG"!\n", PRINT_REG(textp));
+ error("Display with invalid reference "PREG"", PRINT_REG(textp));
return NULL_REG;
}
@@ -3247,7 +3247,7 @@ reg_t kDisplay(state_t *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) {
- SCIkwarn(SCIkERROR, "Display: Failed to create text widget!\n");
+ error("Display: Failed to create text widget");
return NULL_REG;
}
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 5380c30bd5..e08610a9af 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -172,12 +172,12 @@ reg_t kDisposeList(state_t *s, int funct_nr, int argc, reg_t *argv) {
list_t *l = LOOKUP_LIST(argv[0]);
if (!l) {
- SCIkwarn(SCIkERROR, "Attempt to dispose non-list at "PREG"!\n", PRINT_REG(argv[0]));
+ error("Attempt to dispose non-list at "PREG"", PRINT_REG(argv[0]));
return NULL_REG;
}
if (!sane_listp(s, argv[0]))
- SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
+ error("List at "PREG" is not sane anymore", PRINT_REG(argv[0]));
/* if (!IS_NULL_REG(l->first)) {
reg_t n_addr = l->first;
@@ -222,7 +222,7 @@ reg_t kFirstNode(state_t *s, int funct_nr, int argc, reg_t *argv) {
list_t *l = LOOKUP_NULL_LIST(argv[0]);
if (l && !sane_listp(s, argv[0]))
- SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
+ error("List at "PREG" is not sane anymore", PRINT_REG(argv[0]));
if (l)
return l->first;
@@ -234,7 +234,7 @@ reg_t kLastNode(state_t *s, int funct_nr, int argc, reg_t *argv) {
list_t *l = LOOKUP_LIST(argv[0]);
if (l && !sane_listp(s, argv[0]))
- SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
+ error("List at "PREG" is not sane anymore", PRINT_REG(argv[0]));
if (l)
return l->last;
@@ -246,7 +246,7 @@ reg_t kEmptyList(state_t *s, int funct_nr, int argc, reg_t *argv) {
list_t *l = LOOKUP_LIST(argv[0]);
if (!l || !sane_listp(s, argv[0]))
- SCIkwarn(SCIkERROR, "List at "PREG" is invalid or not sane anymore!\n", PRINT_REG(argv[0]));
+ error("List at "PREG" is invalid or not sane anymore", PRINT_REG(argv[0]));
return make_reg(0, ((l) ? IS_NULL_REG(l->first) : 0));
}
@@ -258,9 +258,9 @@ inline void _k_add_to_front(state_t *s, reg_t listbase, reg_t nodebase) {
SCIkdebug(SCIkNODES, "Adding node "PREG" to end of list "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase));
if (!new_n)
- SCIkwarn(SCIkERROR, "Attempt to add non-node ("PREG") to list at "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase));
+ error("Attempt to add non-node ("PREG") to list at "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase));
if (!l || !sane_listp(s, listbase))
- SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(listbase));
+ error("List at "PREG" is not sane anymore", PRINT_REG(listbase));
new_n->succ = l->first;
new_n->pred = NULL_REG;
@@ -281,9 +281,9 @@ inline void _k_add_to_end(state_t *s, reg_t listbase, reg_t nodebase) {
SCIkdebug(SCIkNODES, "Adding node "PREG" to end of list "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase));
if (!new_n)
- SCIkwarn(SCIkERROR, "Attempt to add non-node ("PREG") to list at "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase));
+ error("Attempt to add non-node ("PREG") to list at "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase));
if (!l || !sane_listp(s, listbase))
- SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(listbase));
+ error("List at "PREG" is not sane anymore", PRINT_REG(listbase));
new_n->succ = NULL_REG;
new_n->pred = l->last;
@@ -300,7 +300,7 @@ inline void _k_add_to_end(state_t *s, reg_t listbase, reg_t nodebase) {
reg_t kNextNode(state_t *s, int funct_nr, int argc, reg_t *argv) {
node_t *n = LOOKUP_NODE(argv[0]);
if (!sane_nodep(s, argv[0])) {
- SCIkwarn(SCIkERROR, "List node at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
+ error("List node at "PREG" is not sane anymore", PRINT_REG(argv[0]));
script_error_flag = script_debug_flag = 0;
return NULL_REG;
}
@@ -311,7 +311,7 @@ reg_t kNextNode(state_t *s, int funct_nr, int argc, reg_t *argv) {
reg_t kPrevNode(state_t *s, int funct_nr, int argc, reg_t *argv) {
node_t *n = LOOKUP_NODE(argv[0]);
if (!sane_nodep(s, argv[0]))
- SCIkwarn(SCIkERROR, "List node at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
+ error("List node at "PREG" is not sane anymore", PRINT_REG(argv[0]));
return n->pred;
}
@@ -319,7 +319,7 @@ reg_t kPrevNode(state_t *s, int funct_nr, int argc, reg_t *argv) {
reg_t kNodeValue(state_t *s, int funct_nr, int argc, reg_t *argv) {
node_t *n = LOOKUP_NODE(argv[0]);
if (!sane_nodep(s, argv[0])) {
- SCIkwarn(SCIkERROR, "List node at "PREG" is not sane!\n", PRINT_REG(argv[0]));
+ error("List node at "PREG" is not sane", PRINT_REG(argv[0]));
script_debug_flag = script_error_flag = 0;
return NULL_REG;
}
@@ -338,10 +338,10 @@ reg_t kAddAfter(state_t *s, int funct_nr, int argc, reg_t *argv) {
node_t *newnode = LOOKUP_NODE(argv[2]);
if (!l || !sane_listp(s, argv[0]))
- SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
+ error("List at "PREG" is not sane anymore", PRINT_REG(argv[0]));
if (!newnode) {
- SCIkwarn(SCIkERROR, "New 'node' "PREG" is not a node!\n", argv[1], argv[2]);
+ error("New 'node' "PREG" is not a node", argv[1], argv[2]);
return NULL_REG;
}
@@ -384,7 +384,7 @@ reg_t kFindKey(state_t *s, int funct_nr, int argc, reg_t *argv) {
SCIkdebug(SCIkNODES, "Looking for key "PREG" in list "PREG"\n", PRINT_REG(key), PRINT_REG(list_pos));
if (!sane_listp(s, list_pos))
- SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(list_pos));
+ error("List at "PREG" is not sane anymore", PRINT_REG(list_pos));
node_pos = LOOKUP_LIST(list_pos)->first;
diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp
index 45e080016e..a5e9a4ec53 100644
--- a/engines/sci/engine/kmovement.cpp
+++ b/engines/sci/engine/kmovement.cpp
@@ -423,7 +423,7 @@ reg_t kDoAvoider(state_t *s, int funct_nr, int argc, reg_t *argv) {
SCIkdebug(SCIkBRESEN, "Doing avoider %04x (dest=%d,%d)\n", avoider, destx, desty);
if (invoke_selector(INV_SEL(mover, doit, 1) , 0)) {
- SCIkwarn(SCIkERROR, "Mover "PREG" of avoider "PREG" doesn't have a doit() funcselector\n", PRINT_REG(mover), PRINT_REG(avoider));
+ error("Mover "PREG" of avoider "PREG" doesn't have a doit() funcselector\n", PRINT_REG(mover), PRINT_REG(avoider));
return NULL_REG;
}
@@ -432,7 +432,7 @@ reg_t kDoAvoider(state_t *s, int funct_nr, int argc, reg_t *argv) {
return s->r_acc; // Return gracefully.
if (invoke_selector(INV_SEL(client, isBlocked, 1) , 0)) {
- SCIkwarn(SCIkERROR, "Client "PREG" of avoider "PREG" doesn't"
+ error("Client "PREG" of avoider "PREG" doesn't"
" have an isBlocked() funcselector\n", PRINT_REG(client), PRINT_REG(avoider));
return NULL_REG;
}
@@ -463,7 +463,7 @@ reg_t kDoAvoider(state_t *s, int funct_nr, int argc, reg_t *argv) {
SCIkdebug(SCIkBRESEN, "Pos (%d,%d): Trying angle %d; delta=(%d,%d)\n", oldx, oldy, angle, move_x, move_y);
if (invoke_selector(INV_SEL(client, canBeHere, 1) , 0)) {
- SCIkwarn(SCIkERROR, "Client "PREG" of avoider "PREG" doesn't"
+ error("Client "PREG" of avoider "PREG" doesn't"
" have a canBeHere() funcselector\n", PRINT_REG(client), PRINT_REG(avoider));
return NULL_REG;
}
@@ -497,7 +497,7 @@ reg_t kDoAvoider(state_t *s, int funct_nr, int argc, reg_t *argv) {
if (looper.segment) {
if (invoke_selector(INV_SEL(looper, doit, 1), 2, angle, client)) {
- SCIkwarn(SCIkERROR, "Looper "PREG" of avoider "PREG" doesn't"
+ error("Looper "PREG" of avoider "PREG" doesn't"
" have a doit() funcselector\n", PRINT_REG(looper), PRINT_REG(avoider));
} else
return s->r_acc;
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 40e1d0159e..0819965cfe 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -69,7 +69,7 @@ int invoke_selector(state_t *s, reg_t object, int selector_id, int noinvalid, in
slc_type = lookup_selector(s, object, selector_id, NULL, &address);
if (slc_type == SELECTOR_NONE) {
- SCIkwarn(SCIkERROR, "Selector '%s' of object at "PREG" could not be invoked (%s L%d)\n",
+ error("Selector '%s' of object at "PREG" could not be invoked (%s L%d)\n",
s->selector_names[selector_id], PRINT_REG(object), fname, line);
if (noinvalid == 0)
KERNEL_OOPS("Not recoverable: VM was halted\n");
@@ -158,7 +158,7 @@ reg_t kClone(state_t *s, int funct_nr, int argc, reg_t *argv) {
int varblock_size;
if (!parent_obj) {
- SCIkwarn(SCIkERROR, "Attempt to clone non-object/class at "PREG" failed", PRINT_REG(parent_addr));
+ error("Attempt to clone non-object/class at "PREG" failed", PRINT_REG(parent_addr));
return NULL_REG;
}
@@ -167,7 +167,7 @@ reg_t kClone(state_t *s, int funct_nr, int argc, reg_t *argv) {
clone_obj = sm_alloc_clone(&s->seg_manager, &clone_addr);
if (!clone_obj) {
- SCIkwarn(SCIkERROR, "Cloning "PREG" failed-- internal error!\n", PRINT_REG(parent_addr));
+ error("Cloning "PREG" failed-- internal error", PRINT_REG(parent_addr));
return NULL_REG;
}
@@ -196,7 +196,7 @@ reg_t kDisposeClone(state_t *s, int funct_nr, int argc, reg_t *argv) {
word underBits;
if (!victim_obj) {
- SCIkwarn(SCIkERROR, "Attempt to dispose non-class/object at "PREG"\n",
+ error("Attempt to dispose non-class/object at "PREG"\n",
PRINT_REG(victim_addr));
return s->r_acc;
}
@@ -244,12 +244,12 @@ reg_t kScriptID(state_t *s, int funct_nr, int argc, reg_t *argv) {
scr = &(s->seg_manager.heap[scriptid]->data.script);
if (!scr->exports_nr) {
- SCIkdebug(SCIkERROR, "Script 0x%x does not have a dispatch table\n", script);
+ error("Script 0x%x does not have a dispatch table\n", script);
return NULL_REG;
}
if (index > scr->exports_nr) {
- SCIkwarn(SCIkERROR, "Dispatch index too big: %d > %d\n", index, scr->exports_nr);
+ error("Dispatch index too big: %d > %d\n", index, scr->exports_nr);
return NULL_REG;
}
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index fc5bc49224..21b476c5c1 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -938,14 +938,14 @@ kDoSound_SCI1(state_t *s, int funct_nr, int argc, reg_t *argv) {
case SI_ABSOLUTE_CUE:
signal = cue;
- fprintf(stderr, "[CUE] "PREG" Absolute Cue: %d\n",
+ error("[CUE] "PREG" Absolute Cue: %d\n",
PRINT_REG(obj), signal);
PUT_SEL32V(obj, signal, signal);
break;
case SI_RELATIVE_CUE:
- fprintf(stderr, "[CUE] "PREG" Relative Cue: %d\n",
+ error("[CUE] "PREG" Relative Cue: %d\n",
PRINT_REG(obj), cue);
PUT_SEL32V(obj, dataInc, cue);
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 4f15276f21..7f2d82858b 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -31,7 +31,7 @@
#define CHECK_OVERFLOW1(pt, size, rv) \
if (((pt) - (str_base)) + (size) > maxsize) { \
- SCIkwarn(SCIkERROR, "String expansion exceeded heap boundaries\n"); \
+ error("String expansion exceeded heap boundaries\n"); \
return rv;\
}
@@ -50,7 +50,7 @@ kernel_lookup_text(state_t *s, reg_t address, int index)
textres = scir_find_resource(s->resmgr, sci_text, address.offset, 0);
if (!textres) {
- SCIkwarn(SCIkERROR, "text.%03d not found\n", address);
+ error("text.%03d not found\n", address);
return NULL; /* Will probably segfault */
}
@@ -63,7 +63,7 @@ kernel_lookup_text(state_t *s, reg_t address, int index)
if (textlen)
return seeker;
else {
- SCIkwarn(SCIkERROR, "Index %d out of bounds in text.%03d\n", _index, address);
+ error("Index %d out of bounds in text.%03d\n", _index, address);
return 0;
}
@@ -224,7 +224,7 @@ kSetSynonyms(state_t *s, int funct_nr, int argc, reg_t *argv) {
synonyms_nr, script);
if (synonyms_nr > 16384) {
- SCIkwarn(SCIkERROR, "Segtable corruption: script.%03d has %d synonyms!\n",
+ error("Segtable corruption: script.%03d has %d synonyms",
script, synonyms_nr);
/* We used to reset the corrupted value here. I really don't think it's appropriate.
* Lars */
@@ -708,7 +708,7 @@ kGetFarText(state_t *s, int funct_nr, int argc, reg_t *argv) {
if (!textres) {
- SCIkwarn(SCIkERROR, "text.%d does not exist\n", UKPV(0));
+ error("text.%d does not exist\n", UKPV(0));
return NULL_REG;
}
diff --git a/engines/sci/engine/said.cpp b/engines/sci/engine/said.cpp
index 1ae8b2b1f2..fa1979ff82 100644
--- a/engines/sci/engine/said.cpp
+++ b/engines/sci/engine/said.cpp
@@ -832,10 +832,10 @@ yytype_int16 *bottom;
yytype_int16 *top;
#endif
{
- YYFPRINTF(stderr, "Stack now");
+ YYerror("Stack now");
for (; bottom <= top; ++bottom)
- YYFPRINTF(stderr, " %d", *bottom);
- YYFPRINTF(stderr, "\n");
+ YYerror(" %d", *bottom);
+ YYerror("\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
@@ -863,15 +863,15 @@ int yyrule;
int yynrhs = yyr2[yyrule];
int yyi;
unsigned long int yylno = yyrline[yyrule];
- YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n",
+ YYerror("Reducing stack by rule %d (line %lu):\n",
yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++) {
- fprintf(stderr, " $%d = ", yyi + 1);
+ error(" $%d = ", yyi + 1);
yy_symbol_print(stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
);
- fprintf(stderr, "\n");
+ error("\n");
}
}
@@ -1890,7 +1890,7 @@ static tree_t said_aug_branch(int n1, int n2, tree_t t1, tree_t t2) {
said_branch_node(SAID_NEXT_NODE, said_leaf_node(SAID_NEXT_NODE, n2), t1)), t2);
#ifdef SAID_DEBUG
- fprintf(stderr, "AUG(0x%x, 0x%x, [%04x], [%04x]) = [%04x]\n", n1, n2, t1, t2, retval);
+ error("AUG(0x%x, 0x%x, [%04x], [%04x]) = [%04x]\n", n1, n2, t1, t2, retval);
#endif
return retval;
@@ -1898,7 +1898,7 @@ static tree_t said_aug_branch(int n1, int n2, tree_t t1, tree_t t2) {
static tree_t said_attach_branch(tree_t base, tree_t attacheant) {
#ifdef SAID_DEBUG
- fprintf(stderr, "ATT2([%04x], [%04x]) = [%04x]\n", base, attacheant, base);
+ error("ATT2([%04x], [%04x]) = [%04x]\n", base, attacheant, base);
#endif
if (!attacheant)
@@ -1916,7 +1916,7 @@ static tree_t said_attach_branch(tree_t base, tree_t attacheant) {
static said_spec_t said_top_branch(tree_t first) {
#ifdef SAID_DEBUG
- fprintf(stderr, "TOP([%04x])\n", first);
+ error("TOP([%04x])\n", first);
#endif
said_branch_node(0, 1, 2);
said_leaf_node(1, 0x141); // Magic number #1
diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp
index 5687d30559..8357b212b9 100644
--- a/engines/sci/engine/scriptconsole.cpp
+++ b/engines/sci/engine/scriptconsole.cpp
@@ -579,7 +579,7 @@ con_parse(state_t *s, const char *command) {
break;
default:
- fprintf(stderr, "Internal error: Heap corruption or prior assertion failed:\n"
+ error("Internal error: Heap corruption or prior assertion failed:\n"
"Unknown parameter type '%c' for funtion\n", paramtype);
}
@@ -587,7 +587,7 @@ con_parse(state_t *s, const char *command) {
if (do_execute) {
command_todo->command(s);
- } else fprintf(stderr, "Skipping command...\n");
+ } else error("Skipping command...\n");
}
}
}
@@ -907,7 +907,7 @@ c_list(state_t * s) {
+ i * cmd_mm[mm_found].size_per_entry), 0);
else {
if (!s) {
- sciprintf("You need a state to do that!\n");
+ sciprintf("You need a state to do that");
return 1;
}
@@ -1047,14 +1047,14 @@ c_hexgrep(state_t * s) {
char *dot = strchr(cmd_params[0].str, '.');
if (NULL == s) {
- fprintf(stderr, "console.c: c_hexgrep(): NULL passed for s\r\n");
+ error("console.c: c_hexgrep(): NULL passed for s\r\n");
return(-1);
}
seekstr = (unsigned char*)sci_malloc(seeklen = (cmd_paramlength - 1));
if (NULL == seekstr) {
- fprintf(stderr, "console.c: c_hexgrep(): malloc failed for seekstr\r\n");
+ error("console.c: c_hexgrep(): malloc failed for seekstr\r\n");
return(-1);
}
@@ -1126,7 +1126,7 @@ c_selectornames(state_t * s) {
snames = vocabulary_get_snames(s->resmgr, &namectr, s ? s->version : 0);
if (!snames) {
- sciprintf("No selector name table found!\n");
+ sciprintf("No selector name table found");
return 1;
}
@@ -1151,7 +1151,7 @@ c_kernelnames(state_t * s) {
}
if (!knames) {
- sciprintf("No kernel name table found!\n");
+ sciprintf("No kernel name table found");
return 1;
}
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 6fa17d5227..b5c9c9b377 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -38,10 +38,10 @@
Sleep(0); \
} else { \
if (timeBeginPeriod(1) != TIMERR_NOERROR) \
- fprintf(stderr, "timeBeginPeriod(1) failed\n"); \
+ error("timeBeginPeriod(1) failed\n"); \
Sleep(x); \
if (timeEndPeriod(1) != TIMERR_NOERROR) \
- fprintf(stderr, "timeEndPeriod(1) failed\n"); \
+ error("timeEndPeriod(1) failed\n"); \
} \
} while (0);
#endif
@@ -158,24 +158,24 @@ midi_hexdump(byte *data, int size, int notational_offset) { /* Specialised for S
int blanks = 0;
offset += offset_mod;
- fprintf(stderr, " [%04x] %d\t",
+ error(" [%04x] %d\t",
old_offset + notational_offset, time);
cmd = data[offset];
if (!(cmd & 0x80)) {
cmd = prev;
if (prev < 0x80) {
- fprintf(stderr, "Track broken at %x after"
+ error("Track broken at %x after"
" offset mod of %d\n",
offset + notational_offset, offset_mod);
sci_hexdump(data, size, notational_offset);
return;
}
- fprintf(stderr, "(rs %02x) ", cmd);
+ error("(rs %02x) ", cmd);
blanks += 8;
} else {
++offset;
- fprintf(stderr, "%02x ", cmd);
+ error("%02x ", cmd);
blanks += 3;
}
prev = cmd;
@@ -188,37 +188,37 @@ midi_hexdump(byte *data, int size, int notational_offset) { /* Specialised for S
for (i = 0; i < pleft; i++) {
if (i == 0)
firstarg = data[offset];
- fprintf(stderr, "%02x ", data[offset++]);
+ error("%02x ", data[offset++]);
blanks += 3;
}
while (blanks < 16) {
blanks += 4;
- fprintf(stderr, " ");
+ error(" ");
}
while (blanks < 20) {
++blanks;
- fprintf(stderr, " ");
+ error(" ");
}
if (cmd == SCI_MIDI_EOT)
- fprintf(stderr, ";; EOT");
+ error(";; EOT");
else if (cmd == SCI_MIDI_SET_SIGNAL) {
if (firstarg == SCI_MIDI_SET_SIGNAL_LOOP)
- fprintf(stderr, ";; LOOP point");
+ error(";; LOOP point");
else
- fprintf(stderr, ";; CUE (%d)", firstarg);
+ error(";; CUE (%d)", firstarg);
} else if (SCI_MIDI_CONTROLLER(cmd)) {
if (firstarg == SCI_MIDI_CUMULATIVE_CUE)
- fprintf(stderr, ";; CUE (cumulative)");
+ error(";; CUE (cumulative)");
else if (firstarg == SCI_MIDI_RESET_ON_SUSPEND)
- fprintf(stderr, ";; RESET-ON-SUSPEND flag");
+ error(";; RESET-ON-SUSPEND flag");
}
- fprintf(stderr, "\n");
+ error("\n");
if (old_offset >= offset) {
- fprintf(stderr, "-- Not moving forward anymore,"
+ error("-- Not moving forward anymore,"
" aborting (%x/%x)\n", offset, old_offset);
return;
}
@@ -406,7 +406,7 @@ print_list(state_t *s, list_t *l) {
mem_obj_t *mobj = GET_SEGMENT(s->seg_manager, pos.segment, MEM_OBJ_NODES);
if (!mobj || !ENTRY_IS_VALID(&(mobj->data.nodes), pos.offset)) {
- sciprintf(" WARNING: "PREG": Doesn't contain list node!\n",
+ sciprintf(" WARNING: "PREG": Doesn't contain list node",
PRINT_REG(pos));
return;
}
@@ -417,7 +417,7 @@ print_list(state_t *s, list_t *l) {
PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value));
if (!REG_EQ(my_prev, node->pred))
- sciprintf(" WARNING: current node gives "PREG" as predecessor!\n",
+ sciprintf(" WARNING: current node gives "PREG" as predecessor",
PRINT_REG(node->pred));
my_prev = pos;
@@ -425,7 +425,7 @@ print_list(state_t *s, list_t *l) {
}
if (!REG_EQ(my_prev, l->last))
- sciprintf(" WARNING: Last node was expected to be "PREG", was "PREG"!\n",
+ sciprintf(" WARNING: Last node was expected to be "PREG", was "PREG"",
PRINT_REG(l->last), PRINT_REG(my_prev));
sciprintf("\t>\n");
}
@@ -2006,7 +2006,7 @@ c_gfx_draw_cel(state_t *s) {
int cel = cmd_params[2].val;
int palette = cmd_params[3].val;
if (!s) {
- sciprintf("Not in debug state!\n");
+ sciprintf("Not in debug state");
return 1;
}
@@ -2023,7 +2023,7 @@ c_gfx_fill_screen(state_t *s) {
int col = cmd_params[0].val;
if (!s) {
- sciprintf("Not in debug state!\n");
+ sciprintf("Not in debug state");
return 1;
}
@@ -2042,7 +2042,7 @@ c_gfx_draw_rect(state_t *s) {
int col = cmd_params[4].val;
if (!s) {
- sciprintf("Not in debug state!\n");
+ sciprintf("Not in debug state");
return 1;
}
@@ -2062,7 +2062,7 @@ c_gfx_propagate_rect(state_t *s) {
rect_t rect;
if (!s) {
- sciprintf("Not in debug state!\n");
+ sciprintf("Not in debug state");
return 1;
}
@@ -2107,7 +2107,7 @@ c_gfx_draw_viewobj(state_t *s) {
int brLeft, brRight, brBottom, brTop;
if (!s) {
- sciprintf("Not in debug state!\n");
+ sciprintf("Not in debug state");
return 1;
}
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 1524f7c737..612ad90f14 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -215,7 +215,7 @@ static void sm_set_script_size(mem_obj_t *mem, struct _state *s, int script_nr)
sciprintf("Script and heap sizes combined exceed 64K.\n"
"This means a fundamental design bug was made in FreeSCI\n"
"regarding SCI1.1 games.\nPlease report this so it can be"
- "fixed in the next major version!\n");
+ "fixed in the next major version");
return;
}
}
@@ -323,7 +323,7 @@ _sm_deallocate(seg_manager_t* self, int seg, int recursive) {
free(mobj->data.reserved);
break;
default:
- fprintf(stderr, "Deallocating segment type %d not supported!\n",
+ error("Deallocating segment type %d not supported",
mobj->type);
BREAKPOINT();
}
@@ -1442,7 +1442,7 @@ sm_dereference(seg_manager_t *self, reg_t pointer, int *size) {
if (!pointer.segment
|| (pointer.segment >= self->heap_size)
|| !self->heap[pointer.segment]) {
- sciprintf("Error: Attempt to dereference invalid pointer "PREG"!\n",
+ sciprintf("Error: Attempt to dereference invalid pointer "PREG"",
PRINT_REG(pointer));
return NULL; /* Invalid */
}
@@ -1486,20 +1486,20 @@ sm_dereference(seg_manager_t *self, reg_t pointer, int *size) {
&& mobj->data.sys_strings.strings[pointer.offset].name)
return (byte *)(mobj->data.sys_strings.strings[pointer.offset].value);
else {
- sciprintf("Error: Attempt to dereference invalid pointer "PREG"!\n",
+ sciprintf("Error: Attempt to dereference invalid pointer "PREG"",
PRINT_REG(pointer));
return NULL;
}
case MEM_OBJ_RESERVED:
- sciprintf("Error: Trying to dereference pointer "PREG" to reserved segment `%s'!\n",
+ sciprintf("Error: Trying to dereference pointer "PREG" to reserved segment `%s'",
mobj->data.reserved);
return NULL;
break;
default:
sciprintf("Error: Trying to dereference pointer "PREG" to inappropriate"
- " segment!\n",
+ " segment",
PRINT_REG(pointer));
return NULL;
}
@@ -1640,10 +1640,10 @@ list_all_outgoing_references_script(seg_interface_t *self, state_t *s, reg_t add
for (i = 0; i < obj->variables_nr; i++)
(*note)(param, obj->variables[i]);
} else {
- fprintf(stderr, "Request for outgoing script-object reference at "PREG" yielded invalid index %d\n", PRINT_REG(addr), idx);
+ error("Request for outgoing script-object reference at "PREG" yielded invalid index %d\n", PRINT_REG(addr), idx);
}
} else {
- /* fprintf(stderr, "Unexpected request for outgoing script-object references at "PREG"\n", PRINT_REG(addr));*/
+ /* error("Unexpected request for outgoing script-object references at "PREG"\n", PRINT_REG(addr));*/
/* Happens e.g. when we're looking into strings */
}
}
@@ -1687,7 +1687,7 @@ list_all_outgoing_references_clones(seg_interface_t *self, state_t *s, reg_t add
assert(addr.segment == self->seg_id);
if (!(ENTRY_IS_VALID(clone_table, addr.offset))) {
- fprintf(stderr, "Unexpected request for outgoing references from clone at "PREG"\n", PRINT_REG(addr));
+ error("Unexpected request for outgoing references from clone at "PREG"\n", PRINT_REG(addr));
// BREAKPOINT();
return;
}
@@ -1786,10 +1786,10 @@ static seg_interface_t seg_interface_locals = {
static void
list_all_outgoing_references_stack(seg_interface_t *self, state_t *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) {
int i;
- fprintf(stderr, "Emitting %d stack entries\n", self->mobj->data.stack.nr);
+ error("Emitting %d stack entries\n", self->mobj->data.stack.nr);
for (i = 0; i < self->mobj->data.stack.nr; i++)
(*note)(param, self->mobj->data.stack.entries[i]);
- fprintf(stderr, "DONE");
+ error("DONE");
}
/*-------------------- stack --------------------*/
@@ -1831,7 +1831,7 @@ list_all_outgoing_references_list(seg_interface_t *self, state_t *s, reg_t addr,
list_t *list = &(table->table[addr.offset].entry);
if (!ENTRY_IS_VALID(table, addr.offset)) {
- fprintf(stderr, "Invalid list referenced for outgoing references: "PREG"\n", PRINT_REG(addr));
+ error("Invalid list referenced for outgoing references: "PREG"\n", PRINT_REG(addr));
return;
}
@@ -1871,7 +1871,7 @@ list_all_outgoing_references_nodes(seg_interface_t *self, state_t *s, reg_t addr
node_t *node = &(table->table[addr.offset].entry);
if (!ENTRY_IS_VALID(table, addr.offset)) {
- fprintf(stderr, "Invalid node referenced for outgoing references: "PREG"\n", PRINT_REG(addr));
+ error("Invalid node referenced for outgoing references: "PREG"\n", PRINT_REG(addr));
return;
}
@@ -1979,7 +1979,7 @@ get_seg_interface(seg_manager_t *self, seg_id_t segid) {
memcpy(retval, seg_interfaces[mobj->type - 1], sizeof(seg_interface_t));
if (mobj->type != retval->type_id) {
- fprintf(stderr, "Improper segment interface for %d", mobj->type);
+ error("Improper segment interface for %d", mobj->type);
exit(1);
}
diff --git a/engines/sci/engine/sys_strings.cpp b/engines/sci/engine/sys_strings.cpp
index e3091236fe..613e995805 100644
--- a/engines/sci/engine/sys_strings.cpp
+++ b/engines/sci/engine/sys_strings.cpp
@@ -23,6 +23,7 @@
*
*/
+#include "common/util.h"
#include "sci/include/sys_strings.h"
#include "sci/include/sci_memory.h"
@@ -31,7 +32,7 @@ sys_string_acquire(sys_strings_t *strings, int index, const char *name, int max_
sys_string_t *str = strings->strings + index;
if (index < 0 || index >= SYS_STRINGS_MAX) {
- fprintf(stderr, "[SYSSTR] Error: Attempt to acquire string #%d\n",
+ error("[SYSSTR] Error: Attempt to acquire string #%d\n",
index);
BREAKPOINT();
}
@@ -39,7 +40,7 @@ sys_string_acquire(sys_strings_t *strings, int index, const char *name, int max_
if (str->name
&& (strcmp(name, str->name)
|| (str->max_size != max_len))) {
- fprintf(stderr, "[SYSSTR] Error: Attempt to re-acquire existing string #%d;"
+ error("[SYSSTR] Error: Attempt to re-acquire existing string #%d;"
"was '%s', tried to claim as '%s'\n",
index, str->name, name);
BREAKPOINT();
@@ -56,7 +57,7 @@ sys_string_set(sys_strings_t *strings, int index, const char *value) {
sys_string_t *str = strings->strings + index;
if (index < 0 || index >= SYS_STRINGS_MAX || !str->name) {
- fprintf(stderr, "[SYSSTR] Error: Attempt to write to invalid/unused string #%d\n",
+ error("[SYSSTR] Error: Attempt to write to invalid/unused string #%d\n",
index);
BREAKPOINT();
return 1;
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 9aee6eb123..360fdd37f4 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -74,14 +74,14 @@ static inline reg_t *
validate_property(object_t *obj, int index) {
if (!obj) {
if (sci_debug_flags & 4)
- sciprintf("[VM] Sending to disposed object!\n");
+ sciprintf("[VM] Sending to disposed object");
_dummy_register = NULL_REG;
return &_dummy_register;
}
if (index < 0 || index >= obj->variables_nr) {
if (sci_debug_flags & 4)
- sciprintf("[VM] Invalid property #%d (out of [0..%d]) requested!\n", index,
+ sciprintf("[VM] Invalid property #%d (out of [0..%d]) requested", index,
obj->variables_nr);
_dummy_register = NULL_REG;
@@ -595,12 +595,12 @@ add_exec_stack_entry(state_t *s, reg_t pc, stack_ptr_t sp, reg_t objp, int argc,
void
vm_handle_fatal_error(state_t *s, int line, const char *file) {
- fprintf(stderr, "Fatal VM error in %s, L%d; aborting...\n", file, line);
+ error("Fatal VM error in %s, L%d; aborting...\n", file, line);
#ifdef HAVE_SETJMP_H
if (jump_initialized)
longjmp(vm_error_address, 0);
#endif
- fprintf(stderr, "Could not recover, exitting...\n");
+ error("Could not recover, exitting...\n");
exit(1);
}
@@ -740,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 */
- warning("Running on non-existant script in segment %x!\n", xs->addr.pc.segment);
+ warning("Running on non-existant script in segment %x", xs->addr.pc.segment);
code_buf = _fake_return_buffer;
#ifndef DISABLE_VALIDATIONS
code_buf_size = 2;
@@ -887,7 +887,7 @@ run_vm(state_t *s, int restoring) {
/* Pointer arithmetics! */
if (s->r_acc.segment) {
if (r_temp.segment) {
- sciprintf("Error: Attempt to add two pointers, stack="PREG" and acc="PREG"!\n",
+ sciprintf("Error: Attempt to add two pointers, stack="PREG" and acc="PREG"",
PRINT_REG(r_temp), PRINT_REG(s->r_acc));
script_debug_flag = script_error_flag = 1;
offset = 0;
@@ -914,7 +914,7 @@ run_vm(state_t *s, int restoring) {
/* Pointer arithmetics! */
if (s->r_acc.segment) {
if (r_temp.segment) {
- sciprintf("Error: Attempt to subtract two pointers, stack="PREG" and acc="PREG"!\n",
+ sciprintf("Error: Attempt to subtract two pointers, stack="PREG" and acc="PREG"",
PRINT_REG(r_temp), PRINT_REG(s->r_acc));
script_debug_flag = script_error_flag = 1;
offset = 0;