aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
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
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')
-rw-r--r--engines/sci/console.cpp120
-rw-r--r--engines/sci/console.h3
-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
-rw-r--r--engines/sci/gfx/gfx_gui.cpp68
-rw-r--r--engines/sci/gfx/gfx_widgets.cpp8
-rw-r--r--engines/sci/gfx/gfx_widgets.h3
12 files changed, 191 insertions, 193 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 95c37074e0..d001cb0143 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -41,6 +41,8 @@ namespace Sci {
extern EngineState *g_EngineState;
+int _kdebug_cheap_event_hack = 0;
+
Console::Console(SciEngine *vm) : GUI::Debugger() {
_vm = vm;
@@ -71,6 +73,9 @@ Console::Console(SciEngine *vm) : GUI::Debugger() {
DCmd_Register("visual_state", WRAP_METHOD(Console, cmdVisualState));
DCmd_Register("dynamic_views", WRAP_METHOD(Console, cmdDynamicViews));
DCmd_Register("dropped_views", WRAP_METHOD(Console, cmdDroppedViews));
+ DCmd_Register("simkey", WRAP_METHOD(Console, cmdSimulateKey));
+ DCmd_Register("segment_table", WRAP_METHOD(Console, cmdPrintSegmentTable));
+ DCmd_Register("show_map", WRAP_METHOD(Console, cmdShowMap));
DCmd_Register("gc", WRAP_METHOD(Console, cmdInvokeGC));
DCmd_Register("gc_objects", WRAP_METHOD(Console, cmdGCObjects));
DCmd_Register("exit", WRAP_METHOD(Console, cmdExit));
@@ -607,6 +612,121 @@ bool Console::cmdDroppedViews(int argc, const char **argv) {
return true;
}
+bool Console::cmdSimulateKey(int argc, const char **argv) {
+ if (argc != 2) {
+ DebugPrintf("Simulate a keypress with the specified scancode\n");
+ DebugPrintf("Usage: %s <key scan code>\n", argv[0]);
+ return true;
+ }
+
+ _kdebug_cheap_event_hack = atoi(argv[1]);
+
+ return true;
+}
+
+bool Console::cmdPrintSegmentTable(int argc, const char **argv) {
+ DebugPrintf("Segment table:\n");
+
+ for (uint i = 0; i < g_EngineState->seg_manager->_heap.size(); i++) {
+ MemObject *mobj = g_EngineState->seg_manager->_heap[i];
+ if (mobj && mobj->getType()) {
+ DebugPrintf(" [%04x] ", i);
+
+ switch (mobj->getType()) {
+ case MEM_OBJ_SCRIPT:
+ DebugPrintf("S script.%03d l:%d ", (*(Script *)mobj).nr, (*(Script *)mobj).lockers);
+ break;
+
+ case MEM_OBJ_CLONES:
+ DebugPrintf("C clones (%d allocd)", (*(CloneTable *)mobj).entries_used);
+ break;
+
+ case MEM_OBJ_LOCALS:
+ DebugPrintf("V locals %03d", (*(LocalVariables *)mobj).script_id);
+ break;
+
+ case MEM_OBJ_STACK:
+ DebugPrintf("D data stack (%d)", (*(DataStack *)mobj).nr);
+ break;
+
+ case MEM_OBJ_SYS_STRINGS:
+ DebugPrintf("Y system string table");
+ break;
+
+ case MEM_OBJ_LISTS:
+ DebugPrintf("L lists (%d)", (*(ListTable *)mobj).entries_used);
+ break;
+
+ case MEM_OBJ_NODES:
+ DebugPrintf("N nodes (%d)", (*(NodeTable *)mobj).entries_used);
+ break;
+
+ case MEM_OBJ_HUNK:
+ DebugPrintf("H hunk (%d)", (*(HunkTable *)mobj).entries_used);
+ break;
+
+ case MEM_OBJ_DYNMEM:
+ DebugPrintf("M dynmem: %d bytes", (*(DynMem *)mobj)._size);
+ break;
+
+ case MEM_OBJ_STRING_FRAG:
+ DebugPrintf("F string fragments");
+ break;
+
+ default:
+ DebugPrintf("I Invalid (type = %x)", mobj->getType());
+ break;
+ }
+
+ DebugPrintf(" seg_ID = %d \n", mobj->getSegMgrId());
+ }
+ }
+ DebugPrintf("\n");
+
+ return true;
+}
+
+bool Console::cmdShowMap(int argc, const char **argv) {
+ if (argc != 2) {
+ DebugPrintf("Shows one of the screen maps\n");
+ DebugPrintf("Usage: %s <screen map>\n", argv[0]);
+ DebugPrintf("Screen maps:\n");
+ DebugPrintf("- 0: visual map (back buffer)\n");
+ DebugPrintf("- 1: priority map (back buffer)\n");
+ DebugPrintf("- 2: control map (static buffer)\n");
+ return true;
+ }
+
+ gfxop_set_clip_zone(g_EngineState->gfx_state, gfx_rect_fullscreen);
+
+ int map = atoi(argv[1]);
+
+ switch (map) {
+ case 0:
+ g_EngineState->visual->add_dirty_abs((GfxContainer *)g_EngineState->visual, gfx_rect(0, 0, 320, 200), 0);
+ g_EngineState->visual->draw(Common::Point(0, 0));
+ break;
+
+ case 1:
+ gfx_xlate_pixmap(g_EngineState->gfx_state->pic->priority_map, g_EngineState->gfx_state->driver->mode, GFX_XLATE_FILTER_NONE);
+ gfxop_draw_pixmap(g_EngineState->gfx_state, g_EngineState->gfx_state->pic->priority_map, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
+ break;
+
+ case 2:
+ gfx_xlate_pixmap(g_EngineState->gfx_state->control_map, g_EngineState->gfx_state->driver->mode, GFX_XLATE_FILTER_NONE);
+ gfxop_draw_pixmap(g_EngineState->gfx_state, g_EngineState->gfx_state->control_map, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
+ break;
+
+ default:
+ DebugPrintf("Map %d is not available.\n", map);
+ return true;
+ }
+
+ gfxop_update(g_EngineState->gfx_state);
+
+ return false;
+}
+
bool Console::cmdInvokeGC(int argc, const char **argv) {
DebugPrintf("Performing garbage collection...\n");
run_gc(g_EngineState);
diff --git a/engines/sci/console.h b/engines/sci/console.h
index 873497fa53..1e4fc9a1f8 100644
--- a/engines/sci/console.h
+++ b/engines/sci/console.h
@@ -67,6 +67,9 @@ private:
bool cmdVisualState(int argc, const char **argv);
bool cmdDynamicViews(int argc, const char **argv);
bool cmdDroppedViews(int argc, const char **argv);
+ bool cmdSimulateKey(int argc, const char **argv);
+ bool cmdPrintSegmentTable(int argc, const char **argv);
+ bool cmdShowMap(int argc, const char **argv);
bool cmdInvokeGC(int argc, const char **argv);
bool cmdGCObjects(int argc, const char **argv);
bool cmdExit(int argc, const char **argv);
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"
diff --git a/engines/sci/gfx/gfx_gui.cpp b/engines/sci/gfx/gfx_gui.cpp
index 392b5510f5..d4df4d9ff3 100644
--- a/engines/sci/gfx/gfx_gui.cpp
+++ b/engines/sci/gfx/gfx_gui.cpp
@@ -112,7 +112,7 @@ void sciw_set_status_bar(EngineState *s, GfxPort *status_bar, const Common::Stri
list->add((GfxContainer *)list, (GfxWidget *)bgbox);
}
- list->add(GFXWC(status_bar), list);
+ list->add((GfxContainer *)status_bar, list);
finish_titlebar_list(s, list, status_bar);
status_bar->draw(gfxw_point_zero);
@@ -255,7 +255,7 @@ GfxPort *sciw_new_window(EngineState *s,
}
win->_decorations = decorations;
- decorations->_parent = GFXWC(win);
+ decorations->_parent = (GfxContainer *)win;
return win;
}
@@ -281,14 +281,14 @@ GfxList *_sciw_add_text_to_list(GfxList *list, GfxPort *port, rect_t zone, char
bgcolor = &(port->_bgcolor);
}
- list->add(GFXWC(list), gfxw_new_text(port->_visual->_gfxState, zone, font, text, align, ALIGN_TOP,
+ list->add((GfxContainer *)list, gfxw_new_text(port->_visual->_gfxState, zone, font, text, align, ALIGN_TOP,
*color1, *color2, *bgcolor, flags));
zone.width--;
zone.height -= 2;
if (framed) {
- list->add(GFXWC(list), gfxw_new_rect(zone, *color2, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_STIPPLED));
+ list->add((GfxContainer *)list, gfxw_new_rect(zone, *color2, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_STIPPLED));
}
return list;
@@ -314,10 +314,10 @@ GfxList *sciw_new_button_control(GfxPort *port, reg_t ID, rect_t zone, char *tex
list = _sciw_add_text_to_list(list, port, gfx_rect(zone.x + 1, zone.y + 2, zone.width - 1, zone.height),
text, font, ALIGN_CENTER, 0, inverse, kFontIgnoreLF, grayed_out);
- list->add(GFXWC(list),
+ list->add((GfxContainer *)list,
gfxw_new_rect(zone, *frame_col, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
} else {
- list->add(GFXWC(list), gfxw_new_box(NULL, gfx_rect(zone.x, zone.y, zone.width + 1, zone.height + 1),
+ list->add((GfxContainer *)list, gfxw_new_box(NULL, gfx_rect(zone.x, zone.y, zone.width + 1, zone.height + 1),
port->_color, port->_color, GFX_BOX_SHADE_FLAT));
list = _sciw_add_text_to_list(list, port, gfx_rect(zone.x + 1, zone.y + 2, zone.width - 1, zone.height),
@@ -325,7 +325,7 @@ GfxList *sciw_new_button_control(GfxPort *port, reg_t ID, rect_t zone, char *tex
}
if (selected)
- list->add(GFXWC(list),
+ list->add((GfxContainer *)list,
gfxw_new_rect(gfx_rect(zone.x + 1, zone.y + 1, zone.width - 2, zone.height - 2),
*frame_col, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
@@ -365,7 +365,7 @@ GfxList *sciw_new_edit_control(GfxPort *port, reg_t ID, rect_t zone, char *text,
text_handle = gfxw_new_text(port->_visual->_gfxState, zone, font, text, ALIGN_LEFT, ALIGN_TOP,
port->_color, port->_color, port->_bgcolor, kFontNoNewlines);
- list->add(GFXWC(list), text_handle);
+ list->add((GfxContainer *)list, text_handle);
} else {
char *textdup = (char *)malloc(strlen(text) + 1);
@@ -378,7 +378,7 @@ GfxList *sciw_new_edit_control(GfxPort *port, reg_t ID, rect_t zone, char *text,
text_handle = gfxw_new_text(port->_visual->_gfxState, zone, font, textdup, ALIGN_LEFT, ALIGN_TOP,
port->_color, port->_color, port->_bgcolor, kFontNoNewlines);
- list->add(GFXWC(list), text_handle);
+ list->add((GfxContainer *)list, text_handle);
zone.x += text_handle->width;
}
@@ -387,26 +387,26 @@ GfxList *sciw_new_edit_control(GfxPort *port, reg_t ID, rect_t zone, char *text,
textdup[1] = 0;
text_handle = gfxw_new_text(port->_visual->_gfxState, zone, font, textdup, ALIGN_LEFT, ALIGN_TOP,
port->_bgcolor, port->_bgcolor, port->_color, kFontNoNewlines);
- list->add(GFXWC(list), text_handle);
+ list->add((GfxContainer *)list, text_handle);
zone.x += text_handle->width;
};
if (cursor + 1 < strlen(text)) {
text_handle = gfxw_new_text(port->_visual->_gfxState, zone, font, text + cursor + 1, ALIGN_LEFT, ALIGN_TOP,
port->_color, port->_color, port->_bgcolor, kFontNoNewlines);
- list->add(GFXWC(list), text_handle);
+ list->add((GfxContainer *)list, text_handle);
zone.x += text_handle->width;
};
if (cursor == strlen(text))
- list->add(GFXWC(list), gfxw_new_line(Common::Point(zone.x, zone.y), Common::Point(zone.x, zone.y + cursor_height - 1),
+ list->add((GfxContainer *)list, gfxw_new_line(Common::Point(zone.x, zone.y), Common::Point(zone.x, zone.y + cursor_height - 1),
port->_color, GFX_LINE_MODE_FAST, GFX_LINE_STYLE_NORMAL));
free(textdup);
}
zone.x = zone.y = 0;
- list->add(GFXWC(list), gfxw_new_rect(zone, port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
+ list->add((GfxContainer *)list, gfxw_new_rect(zone, port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
return list;
}
@@ -435,7 +435,7 @@ GfxList *sciw_new_icon_control(GfxPort *port, reg_t ID, rect_t zone, int view, i
list->_flags |= GFXW_FLAG_MULTI_ID;
- list->add(GFXWC(list), icon);
+ list->add((GfxContainer *)list, icon);
return list;
}
@@ -481,14 +481,14 @@ GfxList *sciw_new_list_control(GfxPort *port, reg_t ID, rect_t zone, int font_nr
for (i = list_top; columns-- && i < entries_nr; i++) {
if (i != selection)
- list->add(GFXWC(list),
+ list->add((GfxContainer *)list,
gfxw_new_text(port->_visual->_gfxState, gfx_rect(zone.x, zone.y, zone.width - 2, font_height),
font_nr, entries_list[i], ALIGN_LEFT, ALIGN_TOP,
port->_color, port->_color, port->_bgcolor, kFontNoNewlines));
else {
- list->add(GFXWC(list), gfxw_new_box(port->_visual->_gfxState, gfx_rect(zone.x, zone.y, zone.width - 1, font_height),
+ list->add((GfxContainer *)list, gfxw_new_box(port->_visual->_gfxState, gfx_rect(zone.x, zone.y, zone.width - 1, font_height),
port->_color, port->_color, GFX_BOX_SHADE_FLAT));
- list->add(GFXWC(list), gfxw_new_text(port->_visual->_gfxState, gfx_rect(zone.x, zone.y, zone.width - 2, font_height),
+ list->add((GfxContainer *)list, gfxw_new_text(port->_visual->_gfxState, gfx_rect(zone.x, zone.y, zone.width - 2, font_height),
font_nr, entries_list[i], ALIGN_LEFT, ALIGN_TOP,
port->_bgcolor, port->_bgcolor, port->_color, kFontNoNewlines));
}
@@ -502,24 +502,24 @@ GfxList *sciw_new_list_control(GfxPort *port, reg_t ID, rect_t zone, int font_nr
zone.y = 0;
// Add up arrow
- list->add(GFXWC(list), gfxw_new_text(port->_visual->_gfxState, gfx_rect(1, 0, zone.width - 2, 8),
+ list->add((GfxContainer *)list, gfxw_new_text(port->_visual->_gfxState, gfx_rect(1, 0, zone.width - 2, 8),
port->_font, arr_up, ALIGN_CENTER, ALIGN_CENTER,
port->_color, port->_color, port->_bgcolor, 0));
// Add down arrow
- list->add(GFXWC(list), gfxw_new_text(port->_visual->_gfxState, gfx_rect(1, zone.height - 9, zone.width - 2, 8),
+ list->add((GfxContainer *)list, gfxw_new_text(port->_visual->_gfxState, gfx_rect(1, zone.height - 9, zone.width - 2, 8),
port->_font, arr_down, ALIGN_CENTER, ALIGN_CENTER,
port->_color, port->_color, port->_bgcolor, 0));
if (list_top & 1) { // Hack to work around aggressive caching
- list->add(GFXWC(list), gfxw_new_rect(zone, port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
- list->add(GFXWC(list), gfxw_new_rect(gfx_rect(zone.x, zone.y + 10, zone.width, zone.height - 20),
+ list->add((GfxContainer *)list, gfxw_new_rect(zone, port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
+ list->add((GfxContainer *)list, gfxw_new_rect(gfx_rect(zone.x, zone.y + 10, zone.width, zone.height - 20),
port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
} else {
- list->add(GFXWC(list),
+ list->add((GfxContainer *)list,
gfxw_new_rect(gfx_rect(zone.x, zone.y, zone.width, zone.height - 10),
port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
- list->add(GFXWC(list),
+ list->add((GfxContainer *)list,
gfxw_new_rect(gfx_rect(zone.x, zone.y + 10, zone.width, zone.height - 10),
port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
}
@@ -539,19 +539,19 @@ void sciw_set_menubar(EngineState *s, GfxPort *status_bar, Menubar *menubar, int
int width = menu->_titleWidth + (MENU_BORDER_SIZE * 2);
if (i == selection) {
- list->add(GFXWC(list), gfxw_new_box(status_bar->_visual->_gfxState, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
+ list->add((GfxContainer *)list, gfxw_new_box(status_bar->_visual->_gfxState, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
status_bar->_color, status_bar->_color, GFX_BOX_SHADE_FLAT));
- list->add(GFXWC(list), gfxw_new_text(s->gfx_state, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
+ list->add((GfxContainer *)list, gfxw_new_text(s->gfx_state, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
status_bar->_font, menu->_title.c_str(), ALIGN_CENTER, ALIGN_CENTER,
status_bar->_bgcolor, status_bar->_bgcolor, status_bar->_color, kFontNoNewlines));
} else
- list->add(GFXWC(list), gfxw_new_text(s->gfx_state, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
+ list->add((GfxContainer *)list, gfxw_new_text(s->gfx_state, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
status_bar->_font, menu->_title.c_str(), ALIGN_CENTER, ALIGN_CENTER,
status_bar->_color, status_bar->_color, status_bar->_bgcolor, kFontNoNewlines));
offset += width;
}
- status_bar->add(GFXWC(status_bar), list);
+ status_bar->add((GfxContainer *)status_bar, list);
finish_titlebar_list(s, list, status_bar);
}
@@ -606,13 +606,13 @@ GfxWidget *_make_menu_entry(MenuItem *item, int offset, int width, GfxPort *port
xcolor = gray ? color : bgcolor;
- list->add(GFXWC(list), gfxw_new_box(port->_visual->_gfxState, area, bgcolor, bgcolor, GFX_BOX_SHADE_FLAT));
- list->add(GFXWC(list), gfxw_new_text(port->_visual->_gfxState, area, port->_font, item->_text.c_str(), ALIGN_LEFT, ALIGN_CENTER,
+ list->add((GfxContainer *)list, gfxw_new_box(port->_visual->_gfxState, area, bgcolor, bgcolor, GFX_BOX_SHADE_FLAT));
+ list->add((GfxContainer *)list, gfxw_new_text(port->_visual->_gfxState, area, port->_font, item->_text.c_str(), ALIGN_LEFT, ALIGN_CENTER,
color, xcolor, bgcolor, kFontNoNewlines));
if (!item->_keytext.empty()) {
area.width -= MENU_BOX_RIGHT_PADDING;
- list->add(GFXWC(list), gfxw_new_text(port->_visual->_gfxState, area, port->_font, item->_keytext.c_str(), ALIGN_RIGHT, ALIGN_CENTER,
+ list->add((GfxContainer *)list, gfxw_new_text(port->_visual->_gfxState, area, port->_font, item->_keytext.c_str(), ALIGN_RIGHT, ALIGN_CENTER,
color, xcolor, bgcolor, kFontNoNewlines));
}
@@ -627,8 +627,8 @@ GfxWidget *_make_menu_hbar(int offset, int width, GfxPort *port, gfx_color_t col
color = un_prioritize(color);
bgcolor = un_prioritize(bgcolor);
- list->add(GFXWC(list), gfxw_new_box(port->_visual->_gfxState, area, bgcolor, bgcolor, GFX_BOX_SHADE_FLAT));
- list->add(GFXWC(list), gfxw_new_line(Common::Point(0, 5), Common::Point(width, 5), color,
+ list->add((GfxContainer *)list, gfxw_new_box(port->_visual->_gfxState, area, bgcolor, bgcolor, GFX_BOX_SHADE_FLAT));
+ list->add((GfxContainer *)list, gfxw_new_line(Common::Point(0, 5), Common::Point(width, 5), color,
GFX_LINE_MODE_FAST, GFX_LINE_STYLE_STIPPLED));
return list;
@@ -644,10 +644,10 @@ GfxPort *sciw_toggle_item(GfxPort *menu_port, Menu *menu, int selection, bool se
MenuItem *item = &menu->_items[selection];
if (item->_type == MENU_TYPE_NORMAL)
- menu_port->add(GFXWC(menu_port), _make_menu_entry(item, selection * 10, menu_port->zone.width + 1,
+ menu_port->add((GfxContainer *)menu_port, _make_menu_entry(item, selection * 10, menu_port->zone.width + 1,
menu_port, fgColor, bgColor, selection + MAGIC_ID_OFFSET, item->_enabled));
else
- menu_port->add(GFXWC(menu_port), _make_menu_hbar(selection * 10, menu_port->zone.width + 1,
+ menu_port->add((GfxContainer *)menu_port, _make_menu_hbar(selection * 10, menu_port->zone.width + 1,
menu_port, fgColor, bgColor, selection + MAGIC_ID_OFFSET));
return menu_port;
diff --git a/engines/sci/gfx/gfx_widgets.cpp b/engines/sci/gfx/gfx_widgets.cpp
index 32f30b0518..e0edf36788 100644
--- a/engines/sci/gfx/gfx_widgets.cpp
+++ b/engines/sci/gfx/gfx_widgets.cpp
@@ -1229,7 +1229,7 @@ static int _gfxwop_container_add(GfxContainer *container, GfxWidget *widget) {
if (_parentize_widget(container, widget))
return 1;
- if (!(GFXW_IS_LIST(widget) && (!GFXWC(widget)->_contents))) { // Don't dirtify self on empty lists
+ if (!(GFXW_IS_LIST(widget) && (!((GfxContainer *)widget)->_contents))) { // Don't dirtify self on empty lists
DDIRTY(stderr, "container_add: dirtify DOWNWARDS (%d,%d,%d,%d, 1)\n", GFX_PRINT_RECT(widget->_bounds));
_gfxw_dirtify_container(container, widget);
}
@@ -1797,7 +1797,7 @@ void _gfxw_free_contents_appropriately(GfxContainer *container, gfxw_snapshot_t
delete widget;
} else {
if (GFXW_IS_CONTAINER(widget))
- _gfxw_free_contents_appropriately(GFXWC(widget), snapshot, priority);
+ _gfxw_free_contents_appropriately((GfxContainer *)widget, snapshot, priority);
}
widget = next;
@@ -1805,7 +1805,7 @@ void _gfxw_free_contents_appropriately(GfxContainer *container, gfxw_snapshot_t
}
gfxw_snapshot_t *gfxw_restore_snapshot(GfxVisual *visual, gfxw_snapshot_t *snapshot) {
- _gfxw_free_contents_appropriately(GFXWC(visual), snapshot, MAGIC_FREE_NUMBER);
+ _gfxw_free_contents_appropriately((GfxContainer *)visual, snapshot, MAGIC_FREE_NUMBER);
return snapshot;
}
@@ -1828,7 +1828,7 @@ void gfxw_annihilate(GfxWidget *widget) {
delete widget;
if (free_overdrawn)
- _gfxw_free_contents_appropriately(GFXWC(visual), &snapshot, widget_priority);
+ _gfxw_free_contents_appropriately((GfxContainer *)visual, &snapshot, widget_priority);
}
GfxDynView *gfxw_picviewize_dynview(GfxDynView *dynview) {
diff --git a/engines/sci/gfx/gfx_widgets.h b/engines/sci/gfx/gfx_widgets.h
index 32f86fddb5..57c2b43c87 100644
--- a/engines/sci/gfx/gfx_widgets.h
+++ b/engines/sci/gfx/gfx_widgets.h
@@ -82,9 +82,6 @@ struct GfxWidget;
/*********************************/
-#define GFXWC(foo) ((GfxContainer *) foo)
-/* Typecasts a container widget to gfxw_container_widget_t *. */
-
/* gfxw_point_zero is declared in gfx/widgets.cpp */
extern Common::Point gfxw_point_zero;