aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2009-05-29 17:19:39 +0000
committerFilippos Karapetis2009-05-29 17:19:39 +0000
commitb1997801dad7f5ec30b6cb3c4a2e7574ed0cf590 (patch)
tree0b45674ae814c0053b85630098d455c596fe3763 /engines/sci
parent797c35876b32988841f84318f1ef0f998f4926c9 (diff)
downloadscummvm-rg350-b1997801dad7f5ec30b6cb3c4a2e7574ed0cf590.tar.gz
scummvm-rg350-b1997801dad7f5ec30b6cb3c4a2e7574ed0cf590.tar.bz2
scummvm-rg350-b1997801dad7f5ec30b6cb3c4a2e7574ed0cf590.zip
- Moved some debug code into console.cpp, adding 3 console commands: resource_types, sci0_palette and exit
- Removed the "man" command - Removed the commands which set the SCI01 priority table flags and the crossblit alpha threshold (they're too specific, and not really useful anymore) - Removed some leftover debug code from gfxop_clear_box() svn-id: r41010
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/console.cpp96
-rw-r--r--engines/sci/console.h4
-rw-r--r--engines/sci/engine/kernel.h2
-rw-r--r--engines/sci/engine/kgraphics.cpp14
-rw-r--r--engines/sci/engine/sciconsole.cpp59
-rw-r--r--engines/sci/gfx/gfx_support.cpp9
-rw-r--r--engines/sci/gfx/gfx_tools.h7
-rw-r--r--engines/sci/gfx/operations.cpp3
-rw-r--r--engines/sci/sci.cpp41
9 files changed, 76 insertions, 159 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index e649e55869..d4b909a4a0 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -85,11 +85,13 @@ Console::Console(SciEngine *vm) : GUI::Debugger() {
DCmd_Register("kernelnames", WRAP_METHOD(Console, cmdKernelNames));
DCmd_Register("suffixes", WRAP_METHOD(Console, cmdSuffixes));
DCmd_Register("kernelwords", WRAP_METHOD(Console, cmdKernelWords));
- DCmd_Register("man", WRAP_METHOD(Console, cmdMan));
DCmd_Register("hexdump", WRAP_METHOD(Console, cmdHexDump));
DCmd_Register("dissect_script", WRAP_METHOD(Console, cmdDissectScript));
DCmd_Register("room", WRAP_METHOD(Console, cmdRoomNumber));
DCmd_Register("size", WRAP_METHOD(Console, cmdResourceSize));
+ DCmd_Register("restypes", WRAP_METHOD(Console, cmdResourceTypes));
+ DCmd_Register("sci0_palette", WRAP_METHOD(Console, cmdSci0Palette));
+ DCmd_Register("exit", WRAP_METHOD(Console, cmdExit));
}
Console::~Console() {
@@ -231,53 +233,14 @@ bool Console::cmdKernelWords(int argc, const char **argv) {
return true;
}
-bool Console::cmdMan(int argc, const char **argv) {
-#if 0
- int section = 0;
- unsigned int i;
- char *name = cmd_params[0].str;
- char *c = strchr(name, '.');
- cmd_mm_entry_t *entry = 0;
-
- if (c) {
- *c = 0;
- section = atoi(c + 1);
- }
-
- if (section < 0 || section >= CMD_MM_ENTRIES) {
- DebugPrintf("Invalid section %d\n", section);
- return true;
- }
-
- DebugPrintf("section:%d\n", section);
- if (section)
- entry = cmd_mm_find(name, section - 1);
- else
- for (i = 0; i < CMD_MM_ENTRIES && !section; i++) {
- if ((entry = cmd_mm_find(name, i)))
- section = i + 1;
- }
-
- if (!entry) {
- DebugPrintf("No manual entry\n");
- return true;
- }
-
- DebugPrintf("-- %s: %s.%d\n", cmd_mm[section - 1].name, name, section);
- cmd_mm[section - 1].print(entry, 1);
-
-#endif
- return true;
-}
-
bool Console::cmdHexDump(int argc, const char **argv) {
if (argc != 3) {
DebugPrintf("Usage: %s <resource type> <resource number>\n", argv[0]);
- DebugPrintf("The 20 valid resource types are:\n");
+ DebugPrintf("The %d valid resource types are:\n", kResourceTypeInvalid);
// There are 20 resource types supported by SCI1.1
- for (int i = 0; i < 20; i++) {
+ for (int i = 0; i < kResourceTypeInvalid; i++) {
DebugPrintf("%s", getResourceTypeName((ResourceType) i));
- DebugPrintf((i < 19) ? ", " : "\n");
+ DebugPrintf((i < kResourceTypeInvalid - 1) ? ", " : "\n");
}
return true;
@@ -360,4 +323,51 @@ bool Console::cmdResourceSize(int argc, const char **argv) {
return true;
}
+bool Console::cmdResourceTypes(int argc, const char **argv) {
+ DebugPrintf("The %d valid resource types are:\n", kResourceTypeInvalid);
+ for (int i = 0; i < kResourceTypeInvalid; i++) {
+ DebugPrintf("%s", getResourceTypeName((ResourceType) i));
+ DebugPrintf((i < kResourceTypeInvalid - 1) ? ", " : "\n");
+ }
+
+ return true;
+}
+
+extern int sci0_palette;
+
+bool Console::cmdSci0Palette(int argc, const char **argv) {
+ if (argc != 2) {
+ DebugPrintf("Set the SCI0 palette to use - 0: EGA, 1: AGI/Amiga, 2: Grayscale\n");
+ return true;
+ }
+
+ sci0_palette = atoi(argv[1]);
+ // TODO: the current room has to be changed to reset the palette of the views
+ game_init_graphics(g_EngineState);
+
+ return false;
+}
+
+bool Console::cmdExit(int argc, const char **argv) {
+ if (argc != 2) {
+ DebugPrintf("exit game - exit gracefully\n");
+ DebugPrintf("exit now - exit ungracefully\n");
+ return true;
+ }
+
+ if (!scumm_stricmp(argv[1], "game")) {
+ // Quit gracefully
+ script_abort_flag = 1; // Terminate VM
+ _debugstate_valid = 0;
+ _debug_seeking = 0;
+ _debug_step_running = 0;
+
+ } else if (!scumm_stricmp(argv[1], "now")) {
+ // Quit ungracefully
+ exit(0);
+ }
+
+ return false;
+}
+
} // End of namespace Sci
diff --git a/engines/sci/console.h b/engines/sci/console.h
index 2b706df536..68ff89f6f8 100644
--- a/engines/sci/console.h
+++ b/engines/sci/console.h
@@ -50,11 +50,13 @@ private:
bool cmdKernelNames(int argc, const char **argv);
bool cmdSuffixes(int argc, const char **argv);
bool cmdKernelWords(int argc, const char **argv);
- bool cmdMan(int argc, const char **argv);
bool cmdHexDump(int argc, const char **argv);
bool cmdDissectScript(int argc, const char **argv);
bool cmdRoomNumber(int argc, const char **argv);
bool cmdResourceSize(int argc, const char **argv);
+ bool cmdResourceTypes(int argc, const char **argv);
+ bool cmdSci0Palette(int argc, const char **argv);
+ bool cmdExit(int argc, const char **argv);
private:
SciEngine *_vm;
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 8269157ff9..c0be017dd0 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -170,8 +170,6 @@ int kernel_oops(EngineState *s, const char *file, int line, const char *reason);
/******************** Priority macros/functions ********************/
-extern int sci01_priority_table_flags; /* 1: delete, 2: print */
-
int _find_priority_band(EngineState *s, int band);
/* Finds the position of the priority band specified
** Parameters: (EngineState *) s: State to search in
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index c0d967083a..b0fe1d50cb 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -987,8 +987,6 @@ reg_t kOnControl(EngineState *s, int funct_nr, int argc, reg_t *argv) {
void _k_view_list_free_backgrounds(EngineState *s, ViewObject *list, int list_nr);
-int sci01_priority_table_flags = 0;
-
#define K_DRAWPIC_FLAG_MIRRORED (1 << 14)
reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
@@ -1050,18 +1048,6 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
s->pic_priority_table = gfxop_get_pic_metainfo(s->gfx_state);
- if (sci01_priority_table_flags & 0x2) {
- if (s->pic_priority_table) {
- int i;
- fprintf(stderr, "---------------------------\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");
- }
- }
- if (sci01_priority_table_flags & 0x1)
- s->pic_priority_table = NULL;
-
if (argc > 1)
s->pic_animate = SKPV(1) & 0xff; // The animation used during kAnimate() later on
diff --git a/engines/sci/engine/sciconsole.cpp b/engines/sci/engine/sciconsole.cpp
index 9177a4b11f..6d4059492f 100644
--- a/engines/sci/engine/sciconsole.cpp
+++ b/engines/sci/engine/sciconsole.cpp
@@ -37,7 +37,6 @@ namespace Sci {
// console commands
static int c_list(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // lists various types of things
-static int c_man(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // 'manual page'
static int c_set(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // sets an int variable
static int c_print(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // prints a variable
//static int c_objinfo(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // shows some info about one class
@@ -162,7 +161,6 @@ void con_init() {
// Hook up some commands
con_hook_command(&c_list, "list", "s*", "Lists various things (try 'list')");
- con_hook_command(&c_man, "man", "s", "Gives a short description of something");
con_hook_command(&c_print, "print", "s", "Prints an int variable");
con_hook_command(&c_set, "set", "si", "Sets an int variable");
con_hook_command(&c_hexgrep, "hexgrep", "shh*", "Searches some resources for a\n"
@@ -191,6 +189,20 @@ void con_init() {
" a list of addresses and indices is provided.\n"
" ?obj.idx may be used to disambiguate 'obj'\n"
" by the index 'idx'.\n");
+
+ // These were in sci.cpp
+ /*
+ con_hook_int(&(gfx_options.buffer_pics_nr), "buffer_pics_nr",
+ "Number of pics to buffer in LRU storage\n");
+ con_hook_int(&(gfx_options.pic0_dither_mode), "pic0_dither_mode",
+ "Mode to use for pic0 dithering\n");
+ con_hook_int(&(gfx_options.pic0_dither_pattern), "pic0_dither_pattern",
+ "Pattern to use for pic0 dithering\n");
+ con_hook_int(&(gfx_options.pic0_unscaled), "pic0_unscaled",
+ "Whether pic0 should be drawn unscaled\n");
+ con_hook_int(&(gfx_options.dirty_frames), "dirty_frames",
+ "Dirty frames management\n");
+ */
}
}
@@ -731,7 +743,6 @@ static int c_list(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
"vars - lists all variables\n"
"docs - lists all misc. documentation\n"
"\n"
- "restypes - lists all resource types\n"
"[resource] - lists all [resource]s");
} else if (cmdParams.size() == 1) {
const char *mm_subsects[3] = {"cmds", "vars", "docs"};
@@ -749,11 +760,6 @@ static int c_list(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
if (!s) {
sciprintf("You need a state to do that!\n");
return 1;
- }
-
- else if (strcmp("restypes", cmdParams[0].str) == 0) {
- for (i = 0; i < kResourceTypeInvalid; i++)
- sciprintf("%s\n", getResourceTypeName((ResourceType)i));
} else {
ResourceType res = parseResourceType(cmdParams[0].str);
if (res == kResourceTypeInvalid)
@@ -770,43 +776,6 @@ static int c_list(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
return 0;
}
-static int c_man(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
- int section = 0;
- uint i;
- Common::String name = cmdParams[0].str;
- const char *c = strchr(name.c_str(), '.');
- cmd_mm_entry_t *entry = 0;
-
- if (c) {
- section = atoi(c + 1);
- name = Common::String(name.begin(), c);
- }
-
- if (section < 0 || section >= CMD_MM_ENTRIES) {
- sciprintf("Invalid section %d\n", section);
- return 1;
- }
-
- sciprintf("section:%d\n", section);
- if (section)
- entry = cmd_mm_find(name.c_str(), section - 1);
- else
- for (i = 0; i < CMD_MM_ENTRIES && !section; i++) {
- if ((entry = cmd_mm_find(name.c_str(), i)))
- section = i + 1;
- }
-
- if (!entry) {
- sciprintf("No manual entry\n");
- return 1;
- }
-
- sciprintf("-- %s: %s.%d\n", cmd_mm[section - 1].name, name.c_str(), section);
- cmd_mm[section - 1].print(entry, 1);
-
- return 0;
-}
-
static int c_set(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
cmd_var_t *var = (cmd_var_t *)cmd_mm_find(cmdParams[0].str, CMD_MM_VAR);
diff --git a/engines/sci/gfx/gfx_support.cpp b/engines/sci/gfx/gfx_support.cpp
index fd62cf8e73..3a32752b9a 100644
--- a/engines/sci/gfx/gfx_support.cpp
+++ b/engines/sci/gfx/gfx_support.cpp
@@ -32,9 +32,6 @@
namespace Sci {
-int gfx_crossblit_alpha_threshold = 128;
-
-
#define LINEMACRO(startx, starty, deltalinear, deltanonlinear, linearvar, nonlinearvar, \
linearend, nonlinearstart, linearmod, nonlinearmod) \
incrNE = ((deltalinear) > 0) ? (deltalinear) : -(deltalinear); \
@@ -314,6 +311,12 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect
#endif
}
+ /**
+ * Crossblitting functions use this value as threshold for distinguishing
+ * between transparent and opaque wrt alpha values.
+ */
+ int gfx_crossblit_alpha_threshold = 0x90; // was 128
+
if (alpha_mask & 0xff)
alpha_min = ((alpha_mask * gfx_crossblit_alpha_threshold) >> 8) & alpha_mask;
else
diff --git a/engines/sci/gfx/gfx_tools.h b/engines/sci/gfx/gfx_tools.h
index 50ecb70783..8582dfa565 100644
--- a/engines/sci/gfx/gfx_tools.h
+++ b/engines/sci/gfx/gfx_tools.h
@@ -42,13 +42,6 @@ enum gfx_xlate_filter_t {
GFX_XLATE_FILTER_TRILINEAR
};
-
-/**
- * Crossblitting functions use this value as threshold for distinguishing
- * between transparent and opaque wrt alpha values.
- */
-extern int gfx_crossblit_alpha_threshold;
-
gfx_mode_t *gfx_new_mode(int xfact, int yfact, const Graphics::PixelFormat &format, Palette *palette, int flags);
/* Allocates a new gfx_mode_t structure with the specified parameters
** Parameters: (int x int) xfact x yfact: Horizontal and vertical scaling factors
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index ad1265316a..46f0bb4332 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -1049,9 +1049,6 @@ int gfxop_clear_box(GfxState *state, rect_t box) {
_gfxop_full_pointer_refresh(state);
_gfxop_add_dirty(state, box);
DDIRTY(stderr, "[] clearing box %d %d %d %d\n", GFX_PRINT_RECT(box));
- if (box.x == 29 && box.y == 77 && (sci0_palette == 1)) {
- BREAKPOINT();
- }
_gfxop_clip(&box, gfx_rect(0, 0, 320, 200));
#ifdef PRECISE_PRIORITY_MAP
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 76febe5d5f..58fc65270e 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -55,44 +55,6 @@ const char *versionNames[9] = {
"SCI32"
};
-
-int c_quit(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
- script_abort_flag = 1; // Terminate VM
- _debugstate_valid = 0;
- _debug_seeking = 0;
- _debug_step_running = 0;
- return 0;
-}
-
-int c_die(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
- exit(0); //
- return 0;
-}
-
-static void init_console() {
- con_hook_command(&c_quit, "quit", "", "console: Quits gracefully");
- con_hook_command(&c_die, "die", "", "console: Quits ungracefully");
-
- /*
- con_hook_int(&(gfx_options.buffer_pics_nr), "buffer_pics_nr",
- "Number of pics to buffer in LRU storage\n");
- con_hook_int(&(gfx_options.pic0_dither_mode), "pic0_dither_mode",
- "Mode to use for pic0 dithering\n");
- con_hook_int(&(gfx_options.pic0_dither_pattern), "pic0_dither_pattern",
- "Pattern to use for pic0 dithering\n");
- con_hook_int(&(gfx_options.pic0_unscaled), "pic0_unscaled",
- "Whether pic0 should be drawn unscaled\n");
- con_hook_int(&(gfx_options.dirty_frames), "dirty_frames",
- "Dirty frames management\n");
- */
- con_hook_int(&gfx_crossblit_alpha_threshold, "alpha_threshold",
- "Alpha threshold for crossblitting\n");
- con_hook_int(&sci0_palette, "sci0_palette",
- "SCI0 palette- 0: EGA, 1:AGI/Amiga, 2:Grayscale\n");
- con_hook_int(&sci01_priority_table_flags, "sci01_priority_table_flags",
- "SCI01 priority table debugging flags: 1:Disable, 2:Print on change\n");
-}
-
SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc)
: Engine(syst), _gameDescription(desc) {
// Put your engine in a sane state, but do nothing big yet;
@@ -161,8 +123,6 @@ Common::Error SciEngine::run() {
// FIXME/TODO: Move some of the stuff below to init()
- init_console(); /* So we can get any output */
-
script_debug_flag = 0;
sci_version_t version;
@@ -238,7 +198,6 @@ Common::Error SciEngine::run() {
// since we cannot let the game control where saves are stored)
script_set_gamestate_save_dir(gamestate, "/");
- gfx_crossblit_alpha_threshold = 0x90;
GfxState gfx_state;
gfx_state.driver = &gfx_driver_scummvm;