diff options
| author | Filippos Karapetis | 2009-05-29 08:25:42 +0000 |
|---|---|---|
| committer | Filippos Karapetis | 2009-05-29 08:25:42 +0000 |
| commit | e9444e2b93802d1717901232e2bc4ba1bab37060 (patch) | |
| tree | 1f79ea906ebc54556e47414361a9a155efd7bfe1 /engines/sci/engine | |
| parent | 637a432b1ffd6bc64f85c61b44b6a7ddb5803467 (diff) | |
| download | scummvm-rg350-e9444e2b93802d1717901232e2bc4ba1bab37060.tar.gz scummvm-rg350-e9444e2b93802d1717901232e2bc4ba1bab37060.tar.bz2 scummvm-rg350-e9444e2b93802d1717901232e2bc4ba1bab37060.zip | |
- Rewrote kSetCursor to be a bit simpler to understand, and got rid of GF_SCI1_NEWSETCURSOR
- Removed the 3 mouse pointer view, loop and cell variables (and their 3 "save" versions) from the game state, as they're all actually not used anywhere
- Cleanup
svn-id: r40976
Diffstat (limited to 'engines/sci/engine')
| -rw-r--r-- | engines/sci/engine/game.cpp | 6 | ||||
| -rw-r--r-- | engines/sci/engine/kgraphics.cpp | 83 | ||||
| -rw-r--r-- | engines/sci/engine/state.cpp | 7 | ||||
| -rw-r--r-- | engines/sci/engine/state.h | 7 |
4 files changed, 43 insertions, 60 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index 3ae209c662..363549eacd 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -109,14 +109,8 @@ int _reset_graphics_input(EngineState *s) { gfxop_fill_box(s->gfx_state, gfx_rect(0, 0, 320, 200), s->ega_colors[0]); // Fill screen black gfxop_update(s->gfx_state); - s->mouse_pointer_view = s->mouse_pointer_loop = s->mouse_pointer_cel = -1; // No mouse pointer resource - s->save_mouse_pointer_view = s->save_mouse_pointer_loop = s->save_mouse_pointer_cel = -1; // No mouse pointer resource gfxop_set_pointer_position(s->gfx_state, Common::Point(160, 150)); - s->mouse_pointer_view = s->mouse_pointer_loop = s->mouse_pointer_cel = -1; // No mouse pointer resource - s->save_mouse_pointer_view = s->save_mouse_pointer_loop = s->save_mouse_pointer_cel = -1; // No mouse pointer resource - - s->pic_is_new = 0; s->pic_visible_map = GFX_MASK_NONE; // Other values only make sense for debugging s->dyn_views = NULL; // no DynViews diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index c4b017643e..a587f4eb87 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -302,53 +302,56 @@ static gfx_color_t graph_map_color(EngineState *s, int color, int priority, int reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (argc) { - case 1 : - if (UKPV(0) == 0) { - s->save_mouse_pointer_view = s->mouse_pointer_view; - s->save_mouse_pointer_loop = s->mouse_pointer_loop; - s->save_mouse_pointer_cel = s->mouse_pointer_cel; - s->mouse_pointer_view = s->mouse_pointer_loop = s->mouse_pointer_cel = -1; - gfxop_set_pointer_cursor(s->gfx_state, GFXOP_NO_POINTER); + case 1 : // set cursor according to the first parameter + GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, SKPV(0))); + break; + case 2 : + if (s->version < SCI_VERSION_1_1) { + // Pre-SCI1.1: set cursor according to the first parameter, and toggle its + // visibility based on the second parameter + // Some late SCI1 games actually use the SCI1.1 version of this call (EcoQuest 1 + // and KQ5 CD, but I haven't seen this case happen), but we can determine the + // semantics from the second parameter passed. + // Rationale: with the older behavior, the second parameter can either be 0 + // (hide cursor) or 1/-1 (show cursor). This could be problematic if the engine + // tries to place the cursor at (x, 0) or (x, 1), but no SCI1 game does that, as + // this would open the menu on top. LSL5 is an exception, as the game can open + // the menu when the player presses a button during the intro, but the cursor is + // not placed on (x, 0) or (x, 1) + int param2 = SKPV(1); + if (param2 == 0 || param2 == 1 || param2 == -1) { + GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, + param2 == 0 ? GFXOP_NO_POINTER : SKPV(0))); + } else { // newer (SCI1.1) semantics: set pointer position + GFX_ASSERT(gfxop_set_pointer_position(s->gfx_state, + Common::Point(UKPV(0), UKPV(1)))); + } } else { - s->mouse_pointer_view = s->save_mouse_pointer_view; - s->mouse_pointer_loop = s->save_mouse_pointer_loop; - s->mouse_pointer_cel = s->save_mouse_pointer_cel; + // SCI1.1 and newer: set pointer position + GFX_ASSERT(gfxop_set_pointer_position(s->gfx_state, + Common::Point(UKPV(0), UKPV(1)))); } - case 2 : + break; case 4 : - if (s->version >= SCI_VERSION_1_1 || (s->flags & GF_SCI1_NEWSETCURSOR)) { - GFX_ASSERT(gfxop_set_pointer_position(s->gfx_state, Common::Point(UKPV(0), UKPV(1)))); - } else { - if (SKPV_OR_ALT(1, 1)) { - s->mouse_pointer_view = SKPV(0); - } else - s->mouse_pointer_view = GFXOP_NO_POINTER; - - s->mouse_pointer_loop = s->mouse_pointer_cel = 0; // Not used with cursor-format pointers - - GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, s->mouse_pointer_view)); + GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, + UKPV(0) == 0 ? GFXOP_NO_POINTER : SKPV(0))); - if (argc > 2) { - Common::Point newpos = Common::Point(SKPV(2) + s->port->_bounds.x, SKPV(3) + s->port->_bounds.y); - GFX_ASSERT(gfxop_set_pointer_position(s->gfx_state, newpos)); - } + // Set pointer position, if requested + if (argc > 2) { + Common::Point newpos = Common::Point(SKPV(2) + s->port->_bounds.x, SKPV(3) + s->port->_bounds.y); + GFX_ASSERT(gfxop_set_pointer_position(s->gfx_state, newpos)); } break; - case 3 : { - GFX_ASSERT(gfxop_set_pointer_view(s->gfx_state, UKPV(0), UKPV(1), UKPV(2), NULL)); - s->mouse_pointer_view = UKPV(0); - s->mouse_pointer_loop = UKPV(1); - s->mouse_pointer_cel = UKPV(2); - break; - } - case 9 : { - Common::Point hotspot = Common::Point(SKPV(3), SKPV(4)); - -// sciprintf("Setting hotspot at %d/%d\n", hotspot.x, hotspot.y); - - gfxop_set_pointer_view(s->gfx_state, UKPV(0), UKPV(1), UKPV(2), &hotspot); + case 3 : + case 5 : + case 9 : + if (argc > 3) { + Common::Point hotspot = Common::Point(SKPV(3), SKPV(4)); + GFX_ASSERT(gfxop_set_pointer_view(s->gfx_state, UKPV(0), UKPV(1), UKPV(2), &hotspot)); + } else { + GFX_ASSERT(gfxop_set_pointer_view(s->gfx_state, UKPV(0), UKPV(1), UKPV(2), NULL)); + } break; - } default : error("kSetCursor: Unhandled case: %d arguments given", argc); break; diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 70f5550722..ee0156aacf 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -56,13 +56,6 @@ EngineState::EngineState() : _dirseeker(this) { game_time = 0; - mouse_pointer_view = 0; - mouse_pointer_loop = 0; - mouse_pointer_cel = 0; - save_mouse_pointer_view = 0; - save_mouse_pointer_loop = 0; - save_mouse_pointer_cel = 0; - port = 0; memset(ega_colors, 0, sizeof(ega_colors)); diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 2db88c3288..c56a0e8e7b 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -151,13 +151,6 @@ public: long game_time; /**< Counted at 60 ticks per second, reset during start time */ - int mouse_pointer_view; /**< Mouse pointer resource, or -1 if disabled */ - int mouse_pointer_loop; /**< Mouse pointer resource, or -1 if disabled */ - int mouse_pointer_cel; /**< Mouse pointer resource, or -1 if disabled */ - int save_mouse_pointer_view; /**< Temporary storage for mouse pointer resource, when the pointer is hidden */ - int save_mouse_pointer_loop; /**< Temporary storage for mouse pointer resource, when the pointer is hidden */ - int save_mouse_pointer_cel; /**< Temporary storage for mouse pointer resource, when the pointer is hidden */ - GfxPort *port; /**< The currently active port */ gfx_color_t ega_colors[16]; /**< The 16 EGA colors- for SCI0(1) */ |
