aboutsummaryrefslogtreecommitdiff
path: root/sword2/driver/_mouse.cpp
diff options
context:
space:
mode:
authorOliver Kiehl2003-08-19 21:42:21 +0000
committerOliver Kiehl2003-08-19 21:42:21 +0000
commit050241ff87213d18f393cffb734ce102f09b37fe (patch)
tree7a3cef51ce8aafb3d350035eb374a79fb0dfc7f1 /sword2/driver/_mouse.cpp
parentf5cdcfa3db1056c5bf79c94e8528bc07dedfea18 (diff)
downloadscummvm-rg350-050241ff87213d18f393cffb734ce102f09b37fe.tar.gz
scummvm-rg350-050241ff87213d18f393cffb734ce102f09b37fe.tar.bz2
scummvm-rg350-050241ff87213d18f393cffb734ce102f09b37fe.zip
preliminary cursor code. dirty, hacky and no animation yet. but at least something...
svn-id: r9785
Diffstat (limited to 'sword2/driver/_mouse.cpp')
-rw-r--r--sword2/driver/_mouse.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/sword2/driver/_mouse.cpp b/sword2/driver/_mouse.cpp
index 9df9104e99..b8d4b95e84 100644
--- a/sword2/driver/_mouse.cpp
+++ b/sword2/driver/_mouse.cpp
@@ -137,6 +137,7 @@
#include "d_draw.h"
#include "render.h"
#include "menu.h"
+#include "../sword2.h"
@@ -534,9 +535,37 @@ int32 AnimateMouse(void)
int32 SetMouseAnim(uint8 *ma, int32 size, int32 mouseFlash)
-
{
- warning("stub SetMouseAnim( %d, %d )", size, mouseFlash);
+ if (ma) {
+ if (mouseAnim)
+ free(mouseAnim);
+
+ if (mouseFlash == RDMOUSE_FLASH)
+ mouseFrame = 0;
+ else
+ mouseFrame = MOUSEFLASHFRAME;
+
+ mouseAnim = (_mouseAnim *)malloc(size);
+ memcpy((uint8 *)mouseAnim, ma, size);
+
+ mouseOffsets = (int32 *)((uint8 *)mouseAnim + sizeof(_mouseAnim));
+ AnimateMouse();
+
+ uint8 *decompSprite = (uint8 *)malloc(mouseAnim->mousew * mouseAnim->mouseh);
+ DecompressMouse(decompSprite, mouseSprite, mouseAnim->mousew * mouseAnim->mouseh);
+
+ int i;
+ for (i = 0; i < mouseAnim->mousew * mouseAnim->mouseh; i++)
+ if (decompSprite[i] == 0)
+ decompSprite[i] = 0xff;
+
+ g_sword2->_system->set_mouse_cursor(decompSprite,
+ mouseAnim->mousew, mouseAnim->mouseh,
+ mouseAnim->xHotSpot, mouseAnim->yHotSpot - MENUDEEP);
+ g_sword2->_system->show_mouse(true);
+ } else
+ g_sword2->_system->show_mouse(false);
+
/*
int32 i;