mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
- Moved 3 more commands to console.cpp: "draw_pic", "draw_rect" and "fill_screen"
- Removed some FreeSCI-specific variables for checking of the on-screen console - Removed the Control-1 key combo - the console command "visual_state" can be used for the same reason svn-id: r41040
This commit is contained in:
parent
15d5b8436e
commit
4ab05f0b38
@ -69,6 +69,9 @@ Console::Console(SciEngine *vm) : GUI::Debugger() {
|
||||
DCmd_Register("restart_game", WRAP_METHOD(Console, cmdRestartGame));
|
||||
DCmd_Register("class_table", WRAP_METHOD(Console, cmdClassTable));
|
||||
DCmd_Register("parser_words", WRAP_METHOD(Console, cmdParserWords));
|
||||
DCmd_Register("draw_pic", WRAP_METHOD(Console, cmdDrawPic));
|
||||
DCmd_Register("draw_rect", WRAP_METHOD(Console, cmdDrawRect));
|
||||
DCmd_Register("fill_screen", WRAP_METHOD(Console, cmdFillScreen));
|
||||
DCmd_Register("current_port", WRAP_METHOD(Console, cmdCurrentPort));
|
||||
DCmd_Register("print_port", WRAP_METHOD(Console, cmdPrintPort));
|
||||
DCmd_Register("parse_grammar", WRAP_METHOD(Console, cmdParseGrammar));
|
||||
@ -507,7 +510,7 @@ bool Console::cmdRestoreGame(int argc, const char **argv) {
|
||||
shrink_execution_stack(g_EngineState, g_EngineState->execution_stack_base + 1);
|
||||
return 0;
|
||||
} else {
|
||||
sciprintf("Restoring gamestate '%s' failed.\n", argv[1]);
|
||||
DebugPrintf("Restoring gamestate '%s' failed.\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -564,6 +567,66 @@ bool Console::cmdParserWords(int argc, const char **argv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Console::cmdDrawPic(int argc, const char **argv) {
|
||||
if (argc < 2) {
|
||||
DebugPrintf("Draws a pic resource\n");
|
||||
DebugPrintf("Usage: %s <nr> [<pal>] [<fl>]\n", argv[0]);
|
||||
DebugPrintf("where <nr> is the number of the pic resource to draw\n");
|
||||
DebugPrintf("<pal> is the optional default palette for the pic (default: 0)\n");
|
||||
DebugPrintf("<fl> are any pic draw flags (default: 1)\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
int flags = 1, default_palette = 0;
|
||||
|
||||
if (argc > 2)
|
||||
default_palette = atoi(argv[2]);
|
||||
|
||||
if (argc == 4)
|
||||
flags = atoi(argv[3]);
|
||||
|
||||
gfxop_new_pic(g_EngineState->gfx_state, atoi(argv[1]), flags, default_palette);
|
||||
gfxop_clear_box(g_EngineState->gfx_state, gfx_rect(0, 0, 320, 200));
|
||||
gfxop_update(g_EngineState->gfx_state);
|
||||
gfxop_sleep(g_EngineState->gfx_state, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Console::cmdDrawRect(int argc, const char **argv) {
|
||||
if (argc != 6) {
|
||||
DebugPrintf("Draws a rectangle to the screen with one of the EGA colors\n");
|
||||
DebugPrintf("Usage: %s <x> <y> <width> <height> <color>\n", argv[0]);
|
||||
DebugPrintf("where <color> is the EGA color to use (0-15)\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
int col = CLIP<int>(atoi(argv[5]), 0, 15);
|
||||
|
||||
gfxop_set_clip_zone(g_EngineState->gfx_state, gfx_rect_fullscreen);
|
||||
gfxop_fill_box(g_EngineState->gfx_state, gfx_rect(atoi(argv[1]), atoi(argv[2]),
|
||||
atoi(argv[3]), atoi(argv[4])), g_EngineState->ega_colors[col]);
|
||||
gfxop_update(g_EngineState->gfx_state);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Console::cmdFillScreen(int argc, const char **argv) {
|
||||
if (argc != 2) {
|
||||
DebugPrintf("Fills the screen with one of the EGA colors\n");
|
||||
DebugPrintf("Usage: %s <color>\n", argv[0]);
|
||||
DebugPrintf("where <color> is the EGA color to use (0-15)\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
int col = CLIP<int>(atoi(argv[1]), 0, 15);
|
||||
|
||||
gfxop_set_clip_zone(g_EngineState->gfx_state, gfx_rect_fullscreen);
|
||||
gfxop_fill_box(g_EngineState->gfx_state, gfx_rect_fullscreen, g_EngineState->ega_colors[col]);
|
||||
gfxop_update(g_EngineState->gfx_state);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Console::cmdCurrentPort(int argc, const char **argv) {
|
||||
if (!g_EngineState->port)
|
||||
DebugPrintf("There is no port active currently.\n");
|
||||
@ -873,7 +936,7 @@ void Console::printList(List *l) {
|
||||
|
||||
node = &(nt->_table[pos.offset]);
|
||||
|
||||
sciprintf("\t%04x:%04x : %04x:%04x -> %04x:%04x\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value));
|
||||
DebugPrintf("\t%04x:%04x : %04x:%04x -> %04x:%04x\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value));
|
||||
|
||||
if (my_prev != node->pred)
|
||||
DebugPrintf(" WARNING: current node gives %04x:%04x as predecessor!\n",
|
||||
|
@ -62,6 +62,9 @@ private:
|
||||
bool cmdRestartGame(int argc, const char **argv);
|
||||
bool cmdClassTable(int argc, const char **argv);
|
||||
bool cmdParserWords(int argc, const char **argv);
|
||||
bool cmdDrawPic(int argc, const char **argv);
|
||||
bool cmdDrawRect(int argc, const char **argv);
|
||||
bool cmdFillScreen(int argc, const char **argv);
|
||||
bool cmdCurrentPort(int argc, const char **argv);
|
||||
bool cmdPrintPort(int argc, const char **argv);
|
||||
bool cmdParseGrammar(int argc, const char **argv);
|
||||
|
@ -520,8 +520,6 @@ int game_init(EngineState *s) {
|
||||
s->game_start_time = g_system->getMillis();
|
||||
s->last_wait_time = s->game_start_time;
|
||||
|
||||
s->onscreen_console = 0; // No onscreen console unless explicitly requested
|
||||
|
||||
srand(g_system->getMillis()); // Initialize random number generator
|
||||
|
||||
// script_dissect(0, s->_selectorNames);
|
||||
|
@ -94,14 +94,10 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||
sciprintf("Debug mode activated\n");
|
||||
script_debug_flag = 1; // Enter debug mode
|
||||
_debug_seeking = _debug_step_running = 0;
|
||||
s->onscreen_console = 0;
|
||||
} else if ((e.buckybits & SCI_EVM_CTRL) && (e.data == '`')) {
|
||||
sciprintf("Debug mode activated\n");
|
||||
script_debug_flag = 1; // Enter debug mode
|
||||
_debug_seeking = _debug_step_running = 0;
|
||||
s->onscreen_console = 1;
|
||||
} else if ((e.buckybits & SCI_EVM_CTRL) && (e.data == '1')) {
|
||||
if (s->visual)
|
||||
s->visual->print(0);
|
||||
} else {
|
||||
PUT_SEL32V(obj, type, SCI_EVT_KEYBOARD); // Keyboard event
|
||||
s->r_acc = make_reg(0, 1);
|
||||
|
@ -1260,15 +1260,9 @@ static int c_visible_map(EngineState *s, const Common::Array<cmd_param_t> &cmdPa
|
||||
|
||||
// TODO
|
||||
#if 0
|
||||
if (s->onscreen_console)
|
||||
con_restore_screen(s, s->osc_backup);
|
||||
|
||||
if (cmdParams[0].val <= 3)
|
||||
s->pic_visible_map = cmdParams[0].val;
|
||||
c_redraw_screen(s);
|
||||
|
||||
if (s->onscreen_console)
|
||||
s->osc_backup = con_backup_screen(s);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -1293,29 +1287,6 @@ static int c_gfx_priority(EngineState *s, const Common::Array<cmd_param_t> &cmdP
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int c_gfx_drawpic(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
|
||||
int flags = 1, default_palette = 0;
|
||||
|
||||
if (!_debugstate_valid) {
|
||||
sciprintf("Not in debug state\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cmdParams.size() > 1) {
|
||||
default_palette = cmdParams[1].val;
|
||||
|
||||
if (cmdParams.size() > 2)
|
||||
flags = cmdParams[2].val;
|
||||
}
|
||||
|
||||
gfxop_new_pic(s->gfx_state, cmdParams[0].val, flags, default_palette);
|
||||
gfxop_clear_box(s->gfx_state, gfx_rect(0, 0, 320, 200));
|
||||
gfxop_update(s->gfx_state);
|
||||
gfxop_sleep(s->gfx_state, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef GFXW_DEBUG_WIDGETS
|
||||
extern GfxWidget *debug_widgets[];
|
||||
extern int debug_widget_pos;
|
||||
@ -1364,42 +1335,6 @@ static int c_gfx_draw_cel(EngineState *s, const Common::Array<cmd_param_t> &cmdP
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int c_gfx_fill_screen(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
|
||||
int col = cmdParams[0].val;
|
||||
|
||||
if (!s) {
|
||||
sciprintf("Not in debug state!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (col < 0 || col > 15)
|
||||
col = 0;
|
||||
|
||||
gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen);
|
||||
gfxop_fill_box(s->gfx_state, gfx_rect_fullscreen, s->ega_colors[col]);
|
||||
gfxop_update(s->gfx_state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int c_gfx_draw_rect(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
|
||||
int col = cmdParams[4].val;
|
||||
|
||||
if (!s) {
|
||||
sciprintf("Not in debug state!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (col < 0 || col > 15)
|
||||
col = 0;
|
||||
|
||||
gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen);
|
||||
gfxop_fill_box(s->gfx_state, gfx_rect(cmdParams[0].val, cmdParams[1].val, cmdParams[2].val, cmdParams[3].val), s->ega_colors[col]);
|
||||
gfxop_update(s->gfx_state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int c_gfx_propagate_rect(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
|
||||
int map = cmdParams[4].val;
|
||||
rect_t rect;
|
||||
@ -2287,12 +2222,6 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t *
|
||||
con_hook_command(c_gfx_print_widget, "gfx_print_widget", "i*", "If called with no parameters, it\n shows which widgets are active.\n"
|
||||
" With parameters, it lists the\n widget corresponding to the\n numerical index specified (for\n each parameter).");
|
||||
#endif
|
||||
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_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>");
|
||||
con_hook_command(c_gfx_propagate_rect,
|
||||
"gfx_propagate_rect",
|
||||
"iiiii",
|
||||
|
@ -46,9 +46,7 @@ EngineState::EngineState() : _dirseeker(this) {
|
||||
|
||||
pic_not_valid = 0;
|
||||
pic_is_new = 0;
|
||||
onscreen_console = 0;
|
||||
osc_backup = 0;
|
||||
|
||||
|
||||
pic_priority_table = 0;
|
||||
|
||||
status_bar_foreground = 0;
|
||||
|
@ -137,8 +137,6 @@ public:
|
||||
|
||||
byte pic_not_valid; /**< Is 0 if the background picture is "valid" */
|
||||
byte pic_is_new; /**< New pic was loaded or port was opened */
|
||||
byte onscreen_console; /**< Use the onscreen console for debugging */
|
||||
byte *osc_backup; /**< Backup of the pre-onscreen console screen data */
|
||||
|
||||
int *pic_priority_table; /**< 16 entries with priorities or NULL if not present */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user