[Scummvm-cvs-logs] SF.net SVN: scummvm: [21321] scummvm/trunk/engines/cine
cyx at users.sourceforge.net
cyx at users.sourceforge.net
Wed Mar 15 14:36:02 CET 2006
Revision: 21321
Author: cyx
Date: 2006-03-15 14:34:46 -0800 (Wed, 15 Mar 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21321&view=rev
Log Message:
-----------
added mouse cursors
Modified Paths:
--------------
scummvm/trunk/engines/cine/cine.cpp
scummvm/trunk/engines/cine/gfx.cpp
scummvm/trunk/engines/cine/gfx.h
scummvm/trunk/engines/cine/main_loop.cpp
scummvm/trunk/engines/cine/msg.cpp
scummvm/trunk/engines/cine/object.cpp
scummvm/trunk/engines/cine/part.cpp
scummvm/trunk/engines/cine/prc.cpp
scummvm/trunk/engines/cine/rel.cpp
scummvm/trunk/engines/cine/various.cpp
scummvm/trunk/engines/cine/various.h
Modified: scummvm/trunk/engines/cine/cine.cpp
===================================================================
--- scummvm/trunk/engines/cine/cine.cpp 2006-03-15 21:59:07 UTC (rev 21320)
+++ scummvm/trunk/engines/cine/cine.cpp 2006-03-15 22:34:46 UTC (rev 21321)
@@ -182,8 +182,8 @@
if (gameType == Cine::GID_FW)
snd_clearBasesonEntries();
+ delete g_sfxPlayer;
delete g_soundDriver;
- delete g_sfxPlayer;
return 0;
}
@@ -262,7 +262,7 @@
loadPrc(BOOT_PRC_NAME);
strcpy(currentPrcName, BOOT_PRC_NAME);
- processPendingUpdates(0);
+ setMouseCursor(0);
}
} // End of namespace Cine
Modified: scummvm/trunk/engines/cine/gfx.cpp
===================================================================
--- scummvm/trunk/engines/cine/gfx.cpp 2006-03-15 21:59:07 UTC (rev 21320)
+++ scummvm/trunk/engines/cine/gfx.cpp 2006-03-15 22:34:46 UTC (rev 21321)
@@ -42,6 +42,49 @@
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 @@
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;
Modified: scummvm/trunk/engines/cine/gfx.h
===================================================================
--- scummvm/trunk/engines/cine/gfx.h 2006-03-15 21:59:07 UTC (rev 21320)
+++ scummvm/trunk/engines/cine/gfx.h 2006-03-15 22:34:46 UTC (rev 21321)
@@ -35,7 +35,7 @@
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);
Modified: scummvm/trunk/engines/cine/main_loop.cpp
===================================================================
--- scummvm/trunk/engines/cine/main_loop.cpp 2006-03-15 21:59:07 UTC (rev 21320)
+++ scummvm/trunk/engines/cine/main_loop.cpp 2006-03-15 22:34:46 UTC (rev 21321)
@@ -161,9 +161,9 @@
purgeList0();
if (playerCommand == -1) {
- processPendingUpdates(0);
+ setMouseCursor(0);
} else {
- processPendingUpdates(2);
+ setMouseCursor(2);
}
drawOverlays();
Modified: scummvm/trunk/engines/cine/msg.cpp
===================================================================
--- scummvm/trunk/engines/cine/msg.cpp 2006-03-15 21:59:07 UTC (rev 21320)
+++ scummvm/trunk/engines/cine/msg.cpp 2006-03-15 22:34:46 UTC (rev 21321)
@@ -54,7 +54,7 @@
ptr = readBundleFile(findFileInBundle(pMsgName));
- processPendingUpdates(1);
+ setMouseCursor(1);
messageCount = READ_BE_UINT16(ptr); ptr += 2;
Modified: scummvm/trunk/engines/cine/object.cpp
===================================================================
--- scummvm/trunk/engines/cine/object.cpp 2006-03-15 21:59:07 UTC (rev 21320)
+++ scummvm/trunk/engines/cine/object.cpp 2006-03-15 22:34:46 UTC (rev 21321)
@@ -67,7 +67,7 @@
ptr = readBundleFile(findFileInBundle(pObjectName));
- processPendingUpdates(1);
+ setMouseCursor(1);
numEntry = READ_BE_UINT16(ptr); ptr += 2;
Modified: scummvm/trunk/engines/cine/part.cpp
===================================================================
--- scummvm/trunk/engines/cine/part.cpp 2006-03-15 21:59:07 UTC (rev 21320)
+++ scummvm/trunk/engines/cine/part.cpp 2006-03-15 22:34:46 UTC (rev 21321)
@@ -53,7 +53,7 @@
ASSERT(partFileHandle.isOpen());
- processPendingUpdates(-1);
+ setMouseCursor(-1);
numElementInPart = partFileHandle.readUint16BE();
partFileHandle.readUint16BE(); // entry size
@@ -183,7 +183,7 @@
}
void readFromPart(int16 idx, uint8 *dataPtr) {
- processPendingUpdates(1);
+ setMouseCursor(1);
partFileHandle.seek(partBuffer[idx].offset, SEEK_SET);
partFileHandle.read(dataPtr, partBuffer[idx].packedSize);
Modified: scummvm/trunk/engines/cine/prc.cpp
===================================================================
--- scummvm/trunk/engines/cine/prc.cpp 2006-03-15 21:59:07 UTC (rev 21320)
+++ scummvm/trunk/engines/cine/prc.cpp 2006-03-15 22:34:46 UTC (rev 21321)
@@ -81,7 +81,7 @@
ASSERT_PTR(scriptPtr);
}
- processPendingUpdates(1);
+ setMouseCursor(1);
numScripts = READ_BE_UINT16(scriptPtr); scriptPtr += 2;
ASSERT(numScripts <= NUM_MAX_SCRIPT);
Modified: scummvm/trunk/engines/cine/rel.cpp
===================================================================
--- scummvm/trunk/engines/cine/rel.cpp 2006-03-15 21:59:07 UTC (rev 21320)
+++ scummvm/trunk/engines/cine/rel.cpp 2006-03-15 22:34:46 UTC (rev 21321)
@@ -69,7 +69,7 @@
ptr = readBundleFile(findFileInBundle(pRelName));
- processPendingUpdates(1);
+ setMouseCursor(1);
numEntry = READ_BE_UINT16(ptr); ptr += 2;
Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp 2006-03-15 21:59:07 UTC (rev 21320)
+++ scummvm/trunk/engines/cine/various.cpp 2006-03-15 22:34:46 UTC (rev 21321)
@@ -55,9 +55,6 @@
gfxFlipRawPage(frontBuffer);
}
-void processPendingUpdates(int16 param) {
-}
-
Common::File partFileHandle;
void waitPlayerInput(void) {
@@ -678,7 +675,7 @@
loadResourcesFromSave();
//reincrustAllBg();
- processPendingUpdates(0);
+ setMouseCursor(0);
if (strlen(currentDatName)) {
/* i = saveVar2;
@@ -872,7 +869,7 @@
fHandle.close();
- processPendingUpdates(0);
+ setMouseCursor(0);
}
void makeSystemMenu(void) {
Modified: scummvm/trunk/engines/cine/various.h
===================================================================
--- scummvm/trunk/engines/cine/various.h 2006-03-15 21:59:07 UTC (rev 21320)
+++ scummvm/trunk/engines/cine/various.h 2006-03-15 22:34:46 UTC (rev 21321)
@@ -82,7 +82,6 @@
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list