aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2009-05-30 14:30:39 +0000
committerFilippos Karapetis2009-05-30 14:30:39 +0000
commit69582f0179c9ab9dcdc0afb2acbe659d36a37790 (patch)
tree14a4d8507726a615e648c88cf519f8cbd137a5f8 /engines/sci/engine
parent9823f60146bedae98f2e649e7938614390fc4525 (diff)
downloadscummvm-rg350-69582f0179c9ab9dcdc0afb2acbe659d36a37790.tar.gz
scummvm-rg350-69582f0179c9ab9dcdc0afb2acbe659d36a37790.tar.bz2
scummvm-rg350-69582f0179c9ab9dcdc0afb2acbe659d36a37790.zip
Moved 3 more debug commands to console.cpp ("simkey", "segment_table" and "show_map") and removed the GFXWC macro. Some cleanup
svn-id: r41032
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/kernel.h2
-rw-r--r--engines/sci/engine/kevent.cpp2
-rw-r--r--engines/sci/engine/kgraphics.cpp46
-rw-r--r--engines/sci/engine/kmenu.cpp2
-rw-r--r--engines/sci/engine/scriptdebug.cpp120
7 files changed, 30 insertions, 152 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 45478feb58..c57fd5d68b 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -168,10 +168,10 @@ int _reset_graphics_input(EngineState *s) {
s->_pics.clear();
- s->visual->add(GFXWC(s->visual), s->wm_port);
- s->visual->add(GFXWC(s->visual), s->titlebar_port);
- s->visual->add(GFXWC(s->visual), s->picture_port);
- s->visual->add(GFXWC(s->visual), s->iconbar_port);
+ s->visual->add((GfxContainer *)s->visual, s->wm_port);
+ s->visual->add((GfxContainer *)s->visual, s->titlebar_port);
+ s->visual->add((GfxContainer *)s->visual, s->picture_port);
+ s->visual->add((GfxContainer *)s->visual, s->iconbar_port);
// Add ports to visual
s->port = s->picture_port; // Currently using the picture port
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp
index b5f49fbccf..24a7fbd1a9 100644
--- a/engines/sci/engine/gc.cpp
+++ b/engines/sci/engine/gc.cpp
@@ -183,8 +183,6 @@ void run_gc(EngineState *s) {
SegManager *sm = s->seg_manager;
#ifdef DEBUG_GC
- extern int c_segtable(EngineState *s);
- c_segtable(s);
sciprintf("[GC] Running...\n");
memset(&(deallocator.segcount), 0, sizeof(int) * (MEM_OBJ_MAX + 1));
#endif
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index c0be017dd0..d1fdf468c4 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -38,8 +38,6 @@ namespace Sci {
struct Node; // from vm.h
struct List; // from vm.h
-extern int _kdebug_cheap_event_hack;
-extern int _kdebug_cheap_soundcue_hack;
extern int stop_on_event;
extern int _debug_seeking;
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index bbdc8d3bc5..fda8e21b1f 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -28,10 +28,12 @@
#include "sci/engine/kernel.h"
#include "sci/gfx/gfx_widgets.h"
#include "sci/gfx/gfx_state_internal.h" // required for GfxPort, GfxVisual
+#include "sci/console.h" // for _kdebug_cheap_event_hack
namespace Sci {
int stop_on_event = 0;
+extern int _kdebug_cheap_event_hack;
#define SCI_VARIABLE_GAME_SPEED 3
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index c59b824b18..aaa55cab09 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -69,18 +69,18 @@ enum {
#define ADD_TO_CURRENT_PORT(widget) \
{if (s->port) \
- s->port->add(GFXWC(s->port), widget); \
+ s->port->add((GfxContainer *)s->port, widget); \
else \
- s->picture_port->add(GFXWC(s->visual), widget);}
+ s->picture_port->add((GfxContainer *)s->visual, widget);}
#define ADD_TO_CURRENT_PICTURE_PORT(widget) \
{if (s->port) \
- s->port->add(GFXWC(s->port), widget); \
+ s->port->add((GfxContainer *)s->port, widget); \
else \
- s->picture_port->add(GFXWC(s->picture_port), widget);}
+ s->picture_port->add((GfxContainer *)s->picture_port, widget);}
#define ADD_TO_WINDOW_PORT(widget) \
- s->wm_port->add(GFXWC(s->wm_port), widget);
+ s->wm_port->add((GfxContainer *)s->wm_port, widget);
#define FULL_REDRAW()\
if (s->visual) \
@@ -147,7 +147,7 @@ static void reparentize_primary_widget_lists(EngineState *s, GfxPort *newport) {
if (s->dyn_views) {
gfxw_remove_widget_from_container(s->dyn_views->_parent, s->dyn_views);
- newport->add(GFXWC(newport), s->dyn_views);
+ newport->add((GfxContainer *)newport, s->dyn_views);
}
}
@@ -476,7 +476,7 @@ void _k_graph_rebuild_port_with_color(EngineState *s, gfx_color_t newbgcolor) {
s->dyn_views = NULL;
}
- port->_parent->add(GFXWC(port->_parent), newport);
+ port->_parent->add((GfxContainer *)port->_parent, newport);
delete port;
}
@@ -562,7 +562,7 @@ reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv) {
// FIXME/TODO: this is not right, as some of the dialogs are drawn *behind* some widgets. But at least it works for now
//ADD_TO_CURRENT_PICTURE_PORT(gfxw_new_box(s->gfx_state, area, color, color, GFX_BOX_SHADE_FLAT)); // old code
- s->picture_port->add(GFXWC(s->picture_port), gfxw_new_box(s->gfx_state, area, color, color, GFX_BOX_SHADE_FLAT));
+ s->picture_port->add((GfxContainer *)s->picture_port, gfxw_new_box(s->gfx_state, area, color, color, GFX_BOX_SHADE_FLAT));
}
break;
@@ -587,7 +587,7 @@ reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv) {
area.x += s->port->zone.x;
area.y += s->port->zone.y;
- if (s->dyn_views && s->dyn_views->_parent == GFXWC(s->port))
+ if (s->dyn_views && s->dyn_views->_parent == (GfxContainer *)s->port)
s->dyn_views->draw(Common::Point(0, 0));
gfxop_update_box(s->gfx_state, area);
@@ -1039,9 +1039,9 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
s->iconbar_port = gfxw_new_port(s->visual, NULL, gfx_rect(0, 0, 320, 200), s->ega_colors[0], transparent);
s->iconbar_port->_flags |= GFXW_FLAG_NO_IMPLICIT_SWITCH;
- s->visual->add(GFXWC(s->visual), s->picture_port);
- s->visual->add(GFXWC(s->visual), s->wm_port);
- s->visual->add(GFXWC(s->visual), s->iconbar_port);
+ s->visual->add((GfxContainer *)s->visual, s->picture_port);
+ s->visual->add((GfxContainer *)s->visual, s->wm_port);
+ s->visual->add((GfxContainer *)s->visual, s->iconbar_port);
s->port = s->picture_port;
@@ -1843,7 +1843,7 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in
error("Attempt to remove view with ID %x:%x from list failed!\n", widget->_ID, widget->_subID);
}
- s->drop_views->add(GFXWC(s->drop_views), gfxw_picviewize_dynview(widget));
+ s->drop_views->add((GfxContainer *)s->drop_views, gfxw_picviewize_dynview(widget));
draw_obj_to_control_map(s, widget);
widget->draw_bounds.y += s->dyn_views->_bounds.y - widget->_parent->_bounds.y;
@@ -1992,7 +1992,7 @@ static void _k_make_view_list(EngineState *s, GfxList **widget_list, List *list,
tempWidget = _k_make_dynview_obj(s, obj, options, sequence_nr--, funct_nr, argc, argv);
if (tempWidget)
- GFX_ASSERT((*widget_list)->add(GFXWC(*widget_list), tempWidget));
+ GFX_ASSERT((*widget_list)->add((GfxContainer *)(*widget_list), tempWidget));
node = lookup_node(s, next_node); // Next node
}
@@ -2158,7 +2158,7 @@ static void _k_raise_topmost_in_view_list(EngineState *s, GfxList *list, GfxDynV
else
gfxw_show_widget(view);
- list->add(GFXWC(list), view);
+ list->add((GfxContainer *)list, view);
_k_raise_topmost_in_view_list(s, list, next);
}
@@ -2219,7 +2219,7 @@ void _k_draw_view_list(EngineState *s, GfxList *list, int flags) {
// Draws list_nr members of list to s->pic.
GfxDynView *widget = (GfxDynView *) list->_contents;
- if (GFXWC(s->port) != GFXWC(s->dyn_views->_parent))
+ if ((GfxContainer *)s->port != (GfxContainer *)s->dyn_views->_parent)
return; // Return if the pictures are meant for a different port
while (widget) {
@@ -2434,11 +2434,11 @@ reg_t kDisposeWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return s->r_acc;
}
- if (s->dyn_views && GFXWC(s->dyn_views->_parent) == GFXWC(goner)) {
+ if (s->dyn_views && (GfxContainer *)s->dyn_views->_parent == (GfxContainer *)goner) {
reparentize_primary_widget_lists(s, (GfxPort *) goner->_parent);
}
- if (s->drop_views && GFXWC(s->drop_views->_parent) == GFXWC(goner))
+ if (s->drop_views && (GfxContainer *)s->drop_views->_parent == (GfxContainer *)goner)
s->drop_views = NULL; // Kill it
pred = gfxw_remove_port(s->visual, goner);
@@ -2982,7 +2982,7 @@ reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) {
assert_primary_widget_lists(s);
if (!s->dyn_views->_contents // Only reparentize empty dynview list
- && ((GFXWC(s->port) != GFXWC(s->dyn_views->_parent)) // If dynviews are on other port...
+ && (((GfxContainer *)s->port != (GfxContainer *)s->dyn_views->_parent) // If dynviews are on other port...
|| (s->dyn_views->_next))) // ... or not on top of the view list
reparentize_primary_widget_lists(s, s->port);
@@ -2996,7 +2996,7 @@ reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) {
assert_primary_widget_lists(s);
if (!s->dyn_views->_contents // Only reparentize empty dynview list
- && ((GFXWC(s->port) != GFXWC(s->dyn_views->_parent)) // If dynviews are on other port...
+ && (((GfxContainer *)s->port != (GfxContainer *)s->dyn_views->_parent) // If dynviews are on other port...
|| (s->dyn_views->_next))) // ... or not on top of the view list
reparentize_primary_widget_lists(s, s->port);
// End of doit() recovery code
@@ -3020,12 +3020,12 @@ reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) {
_k_raise_topmost_in_view_list(s, s->dyn_views, (GfxDynView *)templist->_contents);
delete templist;
- s->dyn_views->free_tagged(GFXWC(s->dyn_views)); // Free obsolete dynviews
+ s->dyn_views->free_tagged((GfxContainer *)s->dyn_views); // Free obsolete dynviews
} // if (cast_list)
if (open_animation) {
gfxop_clear_box(s->gfx_state, gfx_rect(0, 10, 320, 190)); // Propagate pic
- s->visual->add_dirty_abs(GFXWC(s->visual), gfx_rect_fullscreen, 0);
+ s->visual->add_dirty_abs((GfxContainer *)s->visual, gfx_rect_fullscreen, 0);
// Mark screen as dirty so picviews will be drawn correctly
FULL_REDRAW();
@@ -3055,7 +3055,7 @@ reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
if ((reparentize | retval)
- && (GFXWC(s->port) == GFXWC(s->dyn_views->_parent)) // If dynviews are on the same port...
+ && ((GfxContainer *)s->port == (GfxContainer *)s->dyn_views->_parent) // If dynviews are on the same port...
&& (s->dyn_views->_next)) // ... and not on top of the view list...
reparentize_primary_widget_lists(s, s->port); // ...then reparentize.
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp
index 771af2a661..e1749e128e 100644
--- a/engines/sci/engine/kmenu.cpp
+++ b/engines/sci/engine/kmenu.cpp
@@ -288,7 +288,7 @@ reg_t kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) {
delete port;
port = sciw_new_menu(s, s->titlebar_port, s->_menubar, menu_nr);
- s->wm_port->add(GFXWC(s->wm_port), port);
+ s->wm_port->add((GfxContainer *)s->wm_port, port);
if (item_nr > -1)
old_item = -42; /* Enforce redraw in next step */
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index c40221fefe..f56aeffdfa 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -76,9 +76,6 @@ static int *p_var_max; // May be NULL even in valid state!
static const int MIDI_cmdlen[16] = {0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 2, 0};
-int _kdebug_cheap_event_hack = 0;
-int _kdebug_cheap_soundcue_hack = -1;
-
char inputbuf[256] = "";
union cmd_param_t {
@@ -300,69 +297,6 @@ int c_sfx_01_track(EngineState *s, const Common::Array<cmd_param_t> &cmdParams)
return 0;
}
-int c_segtable(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
- uint i;
-
- sciprintf(" ---- segment table ----\n");
- for (i = 0; i < s->seg_manager->_heap.size(); i++) {
- MemObject *mobj = s->seg_manager->_heap[i];
- if (mobj && mobj->getType()) {
- sciprintf(" [%04x] ", i);
-
- switch (mobj->getType()) {
- case MEM_OBJ_SCRIPT:
- sciprintf("S script.%03d l:%d ", (*(Script *)mobj).nr, (*(Script *)mobj).lockers);
- break;
-
- case MEM_OBJ_CLONES:
- sciprintf("C clones (%d allocd)", (*(CloneTable *)mobj).entries_used);
- break;
-
- case MEM_OBJ_LOCALS:
- sciprintf("V locals %03d", (*(LocalVariables *)mobj).script_id);
- break;
-
- case MEM_OBJ_STACK:
- sciprintf("D data stack (%d)", (*(DataStack *)mobj).nr);
- break;
-
- case MEM_OBJ_SYS_STRINGS:
- sciprintf("Y system string table");
- break;
-
- case MEM_OBJ_LISTS:
- sciprintf("L lists (%d)", (*(ListTable *)mobj).entries_used);
- break;
-
- case MEM_OBJ_NODES:
- sciprintf("N nodes (%d)", (*(NodeTable *)mobj).entries_used);
- break;
-
- case MEM_OBJ_HUNK:
- sciprintf("H hunk (%d)", (*(HunkTable *)mobj).entries_used);
- break;
-
- case MEM_OBJ_DYNMEM:
- sciprintf("M dynmem: %d bytes", (*(DynMem *)mobj)._size);
- break;
-
- case MEM_OBJ_STRING_FRAG:
- sciprintf("F string fragments");
- break;
-
- default:
- sciprintf("I Invalid (type = %x)", mobj->getType());
- break;
- }
-
- sciprintf(" seg_ID = %d \n", mobj->getSegMgrId());
- }
- }
- sciprintf("\n");
-
- return 0;
-}
-
static void print_obj_head(EngineState *s, reg_t pos) {
Object *obj = obj_get(s, pos);
@@ -1636,41 +1570,6 @@ static int c_gfx_print_widget(EngineState *s, const Common::Array<cmd_param_t> &
}
#endif
-static int c_gfx_show_map(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
- int map = cmdParams[0].val;
- if (!_debugstate_valid) {
- sciprintf("Not in debug state\n");
- return 1;
- }
-
- gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen);
-
- switch (map) {
- case 0:
- s->visual->add_dirty_abs(GFXWC(s->visual), gfx_rect(0, 0, 320, 200), 0);
- s->visual->draw(Common::Point(0, 0));
- break;
-
- case 1:
- gfx_xlate_pixmap(s->gfx_state->pic->priority_map, s->gfx_state->driver->mode, GFX_XLATE_FILTER_NONE);
- gfxop_draw_pixmap(s->gfx_state, s->gfx_state->pic->priority_map, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
- break;
-
- case 2:
- gfx_xlate_pixmap(s->gfx_state->control_map, s->gfx_state->driver->mode, GFX_XLATE_FILTER_NONE);
- gfxop_draw_pixmap(s->gfx_state, s->gfx_state->control_map, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
- break;
-
- default:
- sciprintf("Map %d is not available.\n", map);
- return 1;
- }
-
- gfxop_update(s->gfx_state);
-
- return 0;
-}
-
static int c_gfx_draw_cel(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
int view = cmdParams[0].val;
int loop = cmdParams[1].val;
@@ -2178,12 +2077,6 @@ int c_gfx_debuglog(EngineState *s, const Common::Array<cmd_param_t> &cmdParams)
return c_handle_config_update(gfx_debug_modes, GFX_DEBUG_MODES, "graphics subsystem", (int *)&(drv->debug_flags), cmdParams);
}
-int c_simkey(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
- _kdebug_cheap_event_hack = cmdParams[0].val;
-
- return 0;
-}
-
static int c_is_sample(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
Resource *song = s->resmgr->findResource(kResourceTypeSound, cmdParams[0].val, 0);
SongIterator *songit;
@@ -2215,12 +2108,6 @@ static int c_is_sample(EngineState *s, const Common::Array<cmd_param_t> &cmdPara
return 0;
}
-int c_simsoundcue(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
- _kdebug_cheap_soundcue_hack = cmdParams[0].val;
-
- return 0;
-}
-
#define GETRECT(ll, rr, tt, bb) \
ll = GET_SELECTOR(pos, ll); \
rr = GET_SELECTOR(pos, rr); \
@@ -2739,7 +2626,6 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t *
" gfx_debuglog.1, sfx_debuglog.1\n");
con_hook_command(c_visible_map, "set_vismap", "i", "Sets the visible map.\n Default is 0 (visual).\n"
" Other useful values are:\n 1: Priority\n 2: Control\n 3: Auxiliary\n");
- con_hook_command(c_simkey, "simkey", "i", "Simulates a keypress with the\n specified scancode.\n");
con_hook_command(c_statusbar, "statusbar", "ii", "Sets the colors of the status bar. Also controllable from the script.\n");
con_hook_command(c_bpx, "bpx", "s", "Sets a breakpoint on the execution of\n the specified method.\n\n EXAMPLE:\n"
" bpx ego::doit\n\n May also be used to set a breakpoint\n that applies whenever an object\n"
@@ -2802,8 +2688,6 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t *
con_hook_command(c_gfx_drawpic, "gfx_drawpic", "ii*", "Draws a pic resource\n\nUSAGE\n gfx_drawpic <nr> [<pal> [<fl>]]\n"
" where <nr> is the number of the pic resource\n to draw\n <pal> is the optional default\n palette for the pic (0 is"
"\n assumed if not specified)\n <fl> are any pic draw flags (default\n is 1)");
- con_hook_command(c_gfx_show_map, "gfx_show_map", "i", "Shows one of the screen maps\n Semantics of the int parameter:\n"
- " 0: visual map (back buffer)\n 1: priority map (back buf.)\n 2: control map (static buf.)");
con_hook_command(c_gfx_fill_screen, "gfx_fill_screen", "i", "Fills the screen with one\n of the EGA colors\n");
con_hook_command(c_gfx_draw_rect, "gfx_draw_rect", "iiiii", "Draws a rectangle to the screen\n with one of the EGA colors\n\nUSAGE\n\n"
" gfx_draw_rect <x> <y> <xl> <yl> <color>");
@@ -2826,10 +2710,6 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t *
con_hook_command(c_gfx_priority, "gfx_priority", "i*", "Prints information about priority\n bands\nUSAGE\n\n gfx_priority\n\n"
" will print the min and max values\n for the priority bands\n\n gfx_priority <val>\n\n Print start of the priority\n"
" band for the specified\n priority\n");
- con_hook_command(c_segtable, "segtable", "!",
- "Gives a short listing of all segments\n\n"
- "SEE ALSO\n\n"
- " seginfo.1");
con_hook_command(c_segkill, "segkill", "!i*",
"Deletes the specified segment\n\n"
"USAGE\n\n"