diff options
-rw-r--r-- | engines/cine/cine.cpp | 4 | ||||
-rw-r--r-- | engines/cine/gfx.cpp | 70 | ||||
-rw-r--r-- | engines/cine/gfx.h | 2 | ||||
-rw-r--r-- | engines/cine/main_loop.cpp | 4 | ||||
-rw-r--r-- | engines/cine/msg.cpp | 2 | ||||
-rw-r--r-- | engines/cine/object.cpp | 2 | ||||
-rw-r--r-- | engines/cine/part.cpp | 4 | ||||
-rw-r--r-- | engines/cine/prc.cpp | 2 | ||||
-rw-r--r-- | engines/cine/rel.cpp | 2 | ||||
-rw-r--r-- | engines/cine/various.cpp | 7 | ||||
-rw-r--r-- | engines/cine/various.h | 1 |
11 files changed, 83 insertions, 17 deletions
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index 426ccc4a18..b874ca3501 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -182,8 +182,8 @@ int CineEngine::go() { if (gameType == Cine::GID_FW) snd_clearBasesonEntries(); - delete g_soundDriver; delete g_sfxPlayer; + delete g_soundDriver; return 0; } @@ -262,7 +262,7 @@ static void initialize() { loadPrc(BOOT_PRC_NAME); strcpy(currentPrcName, BOOT_PRC_NAME); - processPendingUpdates(0); + setMouseCursor(0); } } // End of namespace Cine 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; diff --git a/engines/cine/gfx.h b/engines/cine/gfx.h index 0f143382e1..7ee521d330 100644 --- a/engines/cine/gfx.h +++ b/engines/cine/gfx.h @@ -35,7 +35,7 @@ extern unsigned char *page2; extern unsigned char *page3; void init_video(); - +void setMouseCursor(int cursor); void convertGfx(uint8 *source, uint8 *dest, const uint16 width, const uint16 height); void convertGfx2(uint8 *source, uint8 *dest, const uint16 width, const uint16 height); void gfxCopyPage(uint8 *source, uint8 *dest); diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index f703f89da5..c0e700d266 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -161,9 +161,9 @@ void mainLoop(int bootScriptIdx) { purgeList0(); if (playerCommand == -1) { - processPendingUpdates(0); + setMouseCursor(0); } else { - processPendingUpdates(2); + setMouseCursor(2); } drawOverlays(); diff --git a/engines/cine/msg.cpp b/engines/cine/msg.cpp index b360dfd46e..d64111306a 100644 --- a/engines/cine/msg.cpp +++ b/engines/cine/msg.cpp @@ -54,7 +54,7 @@ void loadMsg(char *pMsgName) { ptr = readBundleFile(findFileInBundle(pMsgName)); - processPendingUpdates(1); + setMouseCursor(1); messageCount = READ_BE_UINT16(ptr); ptr += 2; diff --git a/engines/cine/object.cpp b/engines/cine/object.cpp index 468b044550..62c764354f 100644 --- a/engines/cine/object.cpp +++ b/engines/cine/object.cpp @@ -67,7 +67,7 @@ void loadObject(char *pObjectName) { ptr = readBundleFile(findFileInBundle(pObjectName)); - processPendingUpdates(1); + setMouseCursor(1); numEntry = READ_BE_UINT16(ptr); ptr += 2; diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp index 8b96a64cd2..5918339df6 100644 --- a/engines/cine/part.cpp +++ b/engines/cine/part.cpp @@ -53,7 +53,7 @@ void loadPart(const char *partName) { ASSERT(partFileHandle.isOpen()); - processPendingUpdates(-1); + setMouseCursor(-1); numElementInPart = partFileHandle.readUint16BE(); partFileHandle.readUint16BE(); // entry size @@ -183,7 +183,7 @@ int16 findFileInBundle(const char *fileName) { } void readFromPart(int16 idx, uint8 *dataPtr) { - processPendingUpdates(1); + setMouseCursor(1); partFileHandle.seek(partBuffer[idx].offset, SEEK_SET); partFileHandle.read(dataPtr, partBuffer[idx].packedSize); diff --git a/engines/cine/prc.cpp b/engines/cine/prc.cpp index 9c65d0a7a0..4751bcb561 100644 --- a/engines/cine/prc.cpp +++ b/engines/cine/prc.cpp @@ -81,7 +81,7 @@ void loadPrc(const char *pPrcName) { ASSERT_PTR(scriptPtr); } - processPendingUpdates(1); + setMouseCursor(1); numScripts = READ_BE_UINT16(scriptPtr); scriptPtr += 2; ASSERT(numScripts <= NUM_MAX_SCRIPT); diff --git a/engines/cine/rel.cpp b/engines/cine/rel.cpp index 93d4a9f48b..60d0a044d1 100644 --- a/engines/cine/rel.cpp +++ b/engines/cine/rel.cpp @@ -69,7 +69,7 @@ void loadRel(char *pRelName) { ptr = readBundleFile(findFileInBundle(pRelName)); - processPendingUpdates(1); + setMouseCursor(1); numEntry = READ_BE_UINT16(ptr); ptr += 2; diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index cfd9fb46bd..69e97b9091 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -55,9 +55,6 @@ void blitRawScreen(uint8 *frontBuffer) { gfxFlipRawPage(frontBuffer); } -void processPendingUpdates(int16 param) { -} - Common::File partFileHandle; void waitPlayerInput(void) { @@ -678,7 +675,7 @@ int16 makeLoad(char *saveName) { loadResourcesFromSave(); //reincrustAllBg(); - processPendingUpdates(0); + setMouseCursor(0); if (strlen(currentDatName)) { /* i = saveVar2; @@ -872,7 +869,7 @@ void makeSave(char *saveFileName) { fHandle.close(); - processPendingUpdates(0); + setMouseCursor(0); } void makeSystemMenu(void) { diff --git a/engines/cine/various.h b/engines/cine/various.h index eeba205116..c9d78897f3 100644 --- a/engines/cine/various.h +++ b/engines/cine/various.h @@ -82,7 +82,6 @@ extern uint16 var5; extern Common::File palFileHandle; extern Common::File partFileHandle; -void processPendingUpdates(int16 param); void freeAnimDataTable(void); void mainLoopSub1(void); void setTextWindow(uint16 param1, uint16 param2, uint16 param3, uint16 param4); |