aboutsummaryrefslogtreecommitdiff
path: root/engines/cine/gfx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/cine/gfx.cpp')
-rw-r--r--engines/cine/gfx.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index b143df9e70..c58db1579e 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -42,6 +42,49 @@ uint8 page1Raw[320 * 200];
uint8 page2Raw[320 * 200];
uint8 page3Raw[320 * 200];
+static const uint8 mouseCursorNormal[] = {
+ 0x00, 0x00, 0x40, 0x00, 0x60, 0x00, 0x70, 0x00,
+ 0x78, 0x00, 0x7C, 0x00, 0x7E, 0x00, 0x7F, 0x00,
+ 0x7F, 0x80, 0x7C, 0x00, 0x6C, 0x00, 0x46, 0x00,
+ 0x06, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xC0, 0x00, 0xE0, 0x00, 0xF0, 0x00, 0xF8, 0x00,
+ 0xFC, 0x00, 0xFE, 0x00, 0xFF, 0x00, 0xFF, 0x80,
+ 0xFF, 0xC0, 0xFF, 0xC0, 0xFE, 0x00, 0xFF, 0x00,
+ 0xCF, 0x00, 0x07, 0x80, 0x07, 0x80, 0x03, 0x80
+};
+
+static const uint8 mouseCursorDisk[] = {
+ 0x7F, 0xFC, 0x9F, 0x12, 0x9F, 0x12, 0x9F, 0x12,
+ 0x9F, 0x12, 0x9F, 0xE2, 0x80, 0x02, 0x9F, 0xF2,
+ 0xA0, 0x0A, 0xA0, 0x0A, 0xA0, 0x0A, 0xA0, 0x0A,
+ 0xA0, 0x0A, 0xA0, 0x0A, 0x7F, 0xFC, 0x00, 0x00,
+ 0x7F, 0xFC, 0xFF, 0xFE, 0xFF, 0xFE, 0xFF, 0xFE,
+ 0xFF, 0xFE, 0xFF, 0xFE, 0xFF, 0xFE, 0xFF, 0xFE,
+ 0xFF, 0xFE, 0xFF, 0xFE, 0xFF, 0xFE, 0xFF, 0xFE,
+ 0xFF, 0xFE, 0xFF, 0xFE, 0x7F, 0xFC, 0x00, 0x00
+};
+
+static const uint8 mouseCursorCross[] = {
+ 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7C, 0x7C,
+ 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80,
+ 0x03, 0x80, 0x03, 0x80, 0xFF, 0xFE, 0xFE, 0xFE,
+ 0xFF, 0xFE, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80,
+ 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x00, 0x00
+};
+
+static const struct MouseCursor {
+ int hotspotX;
+ int hotspotY;
+ const uint8 *bitmap;
+} mouseCursors[] = {
+ { 1, 1, mouseCursorNormal },
+ { 0, 0, mouseCursorDisk },
+ { 7, 7, mouseCursorCross }
+};
+
void init_video() {
screenBuffer = (byte *)malloc(320 * 200 * 3);
assert(screenBuffer);
@@ -52,6 +95,33 @@ void init_video() {
page3 = (unsigned char *)malloc(0x8000);
}
+void setMouseCursor(int cursor) {
+ static int currentMouseCursor = -1;
+ if (cursor >= 0 && cursor < 3) {
+ if (currentMouseCursor != cursor) {
+ uint8 mouseCursor[16 * 16];
+ const MouseCursor *mc = &mouseCursors[cursor];
+ const uint8 *src = mc->bitmap;
+ for (int i = 0; i < 32; ++i) {
+ int offs = i * 8;
+ for (uint8 mask = 0x80; mask != 0; mask >>= 1) {
+ if (src[0] & mask) {
+ mouseCursor[offs] = 2;
+ } else if (src[32] & mask) {
+ mouseCursor[offs] = 0;
+ } else {
+ mouseCursor[offs] = 0xFF;
+ }
+ ++offs;
+ }
+ ++src;
+ }
+ g_system->setMouseCursor(mouseCursor, 16, 16, mc->hotspotX, mc->hotspotY);
+ currentMouseCursor = cursor;
+ }
+ }
+}
+
uint16 transformColor(uint16 baseColor, int8 r, int8 g, int8 b) {
int8 oriR = (baseColor & 0x7);
int8 oriG = (baseColor & 0x70) >> 4;