From c75bdbc8e95946e1388fa45b086f8f37566ce886 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 27 May 2009 16:45:42 +0000 Subject: - SQ5 floppy starts now - Added a new console command, "room", which shows the current room svn-id: r40943 --- engines/sci/console.cpp | 7 +++++++ engines/sci/console.h | 1 + engines/sci/engine/ksound.cpp | 1 + engines/sci/gfx/gfx_driver.cpp | 10 ++++++++-- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 6a6ad672e7..7a86236531 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -88,6 +88,7 @@ Console::Console(SciEngine *vm) : GUI::Debugger() { 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)); } Console::~Console() { @@ -323,4 +324,10 @@ bool Console::cmdDissectScript(int argc, const char **argv) { return true; } +bool Console::cmdRoomNumber(int argc, const char **argv) { + DebugPrintf("Current room number is %d\n", g_EngineState->currentRoomNumber()); + + return true; +} + } // End of namespace Sci diff --git a/engines/sci/console.h b/engines/sci/console.h index 6e2e13d951..c54147d942 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -53,6 +53,7 @@ private: 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); private: SciEngine *_vm; diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 613412839b..54a65249e1 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -1076,6 +1076,7 @@ reg_t kDoSync(EngineState *s, int funct_nr, int argc, reg_t *argv) { PUT_SEL32V(argv[1], syncCue, -1); } } else if (argc == 7) { // SQ4CD or newer + // TODO warning("kDoSync: Start called with new semantics - 6 parameters: %d %d %d %d %d %d", UKPV(1), UKPV(2), UKPV(3), UKPV(4), UKPV(5), UKPV(6)); } else { // Hopefully, this should never happen warning("kDoSync: Start called with an unknown number of parameters (%d)", argc); diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp index e4f6a40120..8ee2b3977e 100644 --- a/engines/sci/gfx/gfx_driver.cpp +++ b/engines/sci/gfx/gfx_driver.cpp @@ -264,7 +264,8 @@ static uint8 *create_cursor(gfx_driver_t *drv, gfx_pixmap_t *pointer, int mode) for (int xc = 0; xc < pointer->index_width; xc++) { uint8 color = *src; // FIXME: The palette size check is a workaround for cursors using non-palette colour GFX_CURSOR_TRANSPARENT - if (color < pointer->palette->size()) + // Note that some cursors don't have a palette in SQ5 + if (pointer->palette && color < pointer->palette->size()) color = pointer->palette->getColor(color).parent_index; for (int scalectr = 0; scalectr < drv->mode->xfact; scalectr++) { *pos++ = color; @@ -287,9 +288,14 @@ static int scummvm_set_pointer(gfx_driver_t *drv, gfx_pixmap_t *pointer, Common: S->pointer_data = create_cursor(drv, pointer, 1); // FIXME: The palette size check is a workaround for cursors using non-palette colour GFX_CURSOR_TRANSPARENT + // Note that some cursors don't have a palette in SQ5 uint8 color_key = GFX_CURSOR_TRANSPARENT; - if ((pointer->color_key != GFX_PIXMAP_COLOR_KEY_NONE) && ((unsigned int)pointer->color_key < pointer->palette->size())) + if ((pointer->color_key != GFX_PIXMAP_COLOR_KEY_NONE) && (pointer->palette && (unsigned int)pointer->color_key < pointer->palette->size())) color_key = pointer->palette->getColor(pointer->color_key).parent_index; + // Some cursors in SQ5 don't have a palette. The cursor palette seems to use 64 colors, so setting the color key to 63 works + // TODO: Is this correct? + if (!pointer->palette) + color_key = 63; g_system->setMouseCursor(S->pointer_data, pointer->width, pointer->height, hotspot->x, hotspot->y, color_key); g_system->showMouse(true); -- cgit v1.2.3