aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--saga/gfx.cpp51
-rw-r--r--saga/gfx.h2
2 files changed, 33 insertions, 20 deletions
diff --git a/saga/gfx.cpp b/saga/gfx.cpp
index f3f22913af..dd5335312e 100644
--- a/saga/gfx.cpp
+++ b/saga/gfx.cpp
@@ -904,27 +904,8 @@ int GFX_SetPalette(R_SURFACE *surface, PALENTRY *pal) {
// When the palette changes, make sure the cursor colours are still
// correct. We may have to reconsider this code later, but for now
// there is only one cursor image.
-
if (GfxModule.white_index != best_windex) {
- int white = (best_windex == 255) ? 254 : best_windex;
-
- // Set up the mouse cursor
- static byte cursor_img[R_CURSOR_W * R_CURSOR_H] = {
- 255, 255, 255, 0, 255, 255, 255,
- 255, 255, 255, 0, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255,
- 0, 0, 255, 255, 255, 0, 0,
- 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 0, 255, 255, 255,
- 255, 255, 255, 0, 255, 255, 255,
- };
-
- for (i = 0; i < R_CURSOR_W * R_CURSOR_H; i++) {
- if (cursor_img[i] != 255)
- cursor_img[i] = white;
- }
-
- _system->setMouseCursor(cursor_img, R_CURSOR_W, R_CURSOR_H, 4, 4);
+ GFX_SetCursor(best_windex);
}
// Set whitest and blackest color indices
@@ -1066,9 +1047,39 @@ int GFX_BlackToPal(R_SURFACE *surface, PALENTRY *src_pal, double percent) {
}
}
+ // When the palette changes, make sure the cursor colours are still
+ // correct. We may have to reconsider this code later, but for now
+ // there is only one cursor image.
+ if (GfxModule.white_index != best_windex) {
+ GFX_SetCursor(best_windex);
+ }
+
_system->setPalette(cur_pal, 0, R_PAL_ENTRIES);
return R_SUCCESS;
}
+void GFX_SetCursor(int best_white) {
+ int white = (best_white == 255) ? 254 : best_white;
+ int i;
+
+ // Set up the mouse cursor
+ static byte cursor_img[R_CURSOR_W * R_CURSOR_H] = {
+ 255, 255, 255, 0, 255, 255, 255,
+ 255, 255, 255, 0, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255,
+ 0, 0, 255, 255, 255, 0, 0,
+ 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 0, 255, 255, 255,
+ 255, 255, 255, 0, 255, 255, 255,
+ };
+
+ for (i = 0; i < R_CURSOR_W * R_CURSOR_H; i++) {
+ if (cursor_img[i] != 255)
+ cursor_img[i] = white;
+ }
+
+ _system->setMouseCursor(cursor_img, R_CURSOR_W, R_CURSOR_H, 4, 4);
+}
+
} // End of namespace Saga
diff --git a/saga/gfx.h b/saga/gfx.h
index dd088d89f0..a24385874a 100644
--- a/saga/gfx.h
+++ b/saga/gfx.h
@@ -47,6 +47,8 @@ struct R_GFX_MODULE {
int black_index;
};
+void GFX_SetCursor(int best_white);
+
} // End of namespace Saga
#endif