aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2009-06-05 23:08:35 +0000
committerFilippos Karapetis2009-06-05 23:08:35 +0000
commitda36901b0751b9d4faaae30dce230b67d75e04e6 (patch)
treec5a2635467c89590b07aeefe9a84ec3346244222 /engines/sci
parent5f005bf93099def8c9fb1bb2eb61df600b0f0ed5 (diff)
downloadscummvm-rg350-da36901b0751b9d4faaae30dce230b67d75e04e6.tar.gz
scummvm-rg350-da36901b0751b9d4faaae30dce230b67d75e04e6.tar.bz2
scummvm-rg350-da36901b0751b9d4faaae30dce230b67d75e04e6.zip
Cleanup
svn-id: r41202
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kgraphics.cpp4
-rw-r--r--engines/sci/gfx/gfx_driver.cpp13
-rw-r--r--engines/sci/sfx/core.cpp6
3 files changed, 10 insertions, 13 deletions
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 */
+ }
}