From da36901b0751b9d4faaae30dce230b67d75e04e6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 5 Jun 2009 23:08:35 +0000 Subject: Cleanup svn-id: r41202 --- engines/sci/engine/kgraphics.cpp | 4 ++-- engines/sci/gfx/gfx_driver.cpp | 13 +++++-------- engines/sci/sfx/core.cpp | 6 +++--- 3 files changed, 10 insertions(+), 13 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index fc23e4f6ef..1e0e675603 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -304,7 +304,7 @@ reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (argc) { case 1 : if (s->_version < SCI_VERSION_1_1) { - if (SKPV(0) == 0 || SKPV(0) == 1 || SKPV(0) == -1) { + if (SKPV(0) <= 1) { // Newer (SCI1.1) semantics: show/hide cursor g_system->showMouse(SKPV(0) != 0); } else { @@ -329,7 +329,7 @@ reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { // 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) - if (SKPV(1) == 0 || SKPV(1) == 1 || SKPV(1) == -1) { + if (SKPV(1) <= 1) { GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, SKPV(1) == 0 ? GFXOP_NO_POINTER : SKPV(0))); } else { // newer (SCI1.1) semantics: set pointer position diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp index c63bdf98f8..fcac77245e 100644 --- a/engines/sci/gfx/gfx_driver.cpp +++ b/engines/sci/gfx/gfx_driver.cpp @@ -36,7 +36,6 @@ namespace Sci { struct _scummvm_driver_state { gfx_pixmap_t *priority[2]; byte *visual[2]; - uint8 *pointer_data; int xsize, ysize; }; @@ -53,7 +52,6 @@ static int scummvm_init(gfx_driver_t *drv, int xfact, int yfact, int bytespp) { S->xsize = xfact * 320; S->ysize = yfact * 200; - S->pointer_data = NULL; //S->buckystate = 0; for (i = 0; i < 2; i++) { @@ -94,9 +92,6 @@ static void scummvm_exit(gfx_driver_t *drv) { S->visual[i] = NULL; } - delete[] S->pointer_data; - S->pointer_data = NULL; - delete S; } } @@ -284,8 +279,7 @@ static int scummvm_set_pointer(gfx_driver_t *drv, gfx_pixmap_t *pointer, Common: if ((pointer == NULL) || (hotspot == NULL)) { g_system->showMouse(false); } else { - delete[] S->pointer_data; - S->pointer_data = create_cursor(drv, pointer, 1); + uint8 *cursorData = 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 @@ -297,8 +291,11 @@ static int scummvm_set_pointer(gfx_driver_t *drv, gfx_pixmap_t *pointer, Common: if (!pointer->palette) color_key = 63; - g_system->setMouseCursor(S->pointer_data, pointer->width, pointer->height, hotspot->x, hotspot->y, color_key); + g_system->setMouseCursor(cursorData, pointer->width, pointer->height, hotspot->x, hotspot->y, color_key); g_system->showMouse(true); + + delete[] cursorData; + cursorData = 0; } return GFX_OK; diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp index f4e07d3b84..7e3395b7d3 100644 --- a/engines/sci/sfx/core.cpp +++ b/engines/sci/sfx/core.cpp @@ -807,14 +807,14 @@ void SfxState::sfx_add_song(SongIterator *it, int priority, song_handle_t handle setSongStatus( song, SOUND_STATUS_STOPPED); fprintf(stderr, "Overwriting old song (%08lx) ...\n", handle); - if (song->status == SOUND_STATUS_PLAYING - || song->status == SOUND_STATUS_SUSPENDED) { + if (song->status == SOUND_STATUS_PLAYING || song->status == SOUND_STATUS_SUSPENDED) { delete it; error("Unexpected (error): Song %ld still playing/suspended (%d)", handle, song->status); return; - } else + } else { song_lib_remove(_songlib, handle); /* No duplicates */ + } } -- cgit v1.2.3