aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2006-04-30 08:48:31 +0000
committerTravis Howell2006-04-30 08:48:31 +0000
commit29a125dcdaf43ec3107f8503911054424bc46635 (patch)
tree3de0a8bd37bd4a799e5b90be9f4f2279ef9cab19 /engines
parent59b89e7a79dbfec8ce049fd166996169ae16a30c (diff)
downloadscummvm-rg350-29a125dcdaf43ec3107f8503911054424bc46635.tar.gz
scummvm-rg350-29a125dcdaf43ec3107f8503911054424bc46635.tar.bz2
scummvm-rg350-29a125dcdaf43ec3107f8503911054424bc46635.zip
Use system code for mouse cursors in FF
svn-id: r22241
Diffstat (limited to 'engines')
-rw-r--r--engines/simon/cursor.cpp110
-rw-r--r--engines/simon/simon.cpp2
-rw-r--r--engines/simon/simon.h5
3 files changed, 18 insertions, 99 deletions
diff --git a/engines/simon/cursor.cpp b/engines/simon/cursor.cpp
index 48e6fd8e3b..bcb6a5dfb3 100644
--- a/engines/simon/cursor.cpp
+++ b/engines/simon/cursor.cpp
@@ -393,15 +393,14 @@ const byte _mouseOffs[] = {
0,0,10,7,10,6,10,5,10,4,10,3,10,4,10,5,10,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
-// TODO: Convert to our mouse code in system
void SimonEngine::drawMousePointer_FF() {
byte *dst;
uint curCursor;
- int image, offs;
- int pitch;
+ int image, offs, pitch;
+ int hotSpotX, hotSpotY;
- dst = getBackBuf();
- pitch = _screenWidth;
+ dst = (byte *)calloc(80 * 80, 1);
+ pitch = 80;
if (_animatePointer != 0) {
if (getBitFlag(99)) {
@@ -415,31 +414,6 @@ void SimonEngine::drawMousePointer_FF() {
_mouseAnim = 1;
}
- _mouseCountY = 40;
- _mouseCountX = 40;
-
- if (_mouseY < 19)
- _mouseCountY -= 19 - _mouseY;
- else
- dst += (((_mouseY - 19) * (pitch / 16)) & 0xffff) * 16;
-
- if (_mouseX < 38)
- _mouseCountX -= 38 - _mouseX;
- else
- dst += _mouseX - 38;
-
- if (_mouseCountY == 40) {
- _mouseCountY = 499 - _mouseY;
- if (_mouseCountY > 40)
- _mouseCountY = 40;
- }
-
- if (_mouseCountX == 40) {
- _mouseCountX = 659 - _mouseX;
- if (_mouseCountX > 40)
- _mouseCountX = 40;
- }
-
curCursor = _mouseCursor;
if (_animatePointer == 0 && getBitFlag(99)) {
_mouseAnim = 1;
@@ -450,18 +424,21 @@ void SimonEngine::drawMousePointer_FF() {
image = curCursor * 16 + 1;
offs = curCursor * 32;
- drawMousePart(dst, pitch, image, offs);
+ drawMousePart(dst, pitch, image, offs, hotSpotX, hotSpotY);
image = curCursor * 16 + 1 + _mouseAnim;
offs = curCursor * 32 + _mouseAnim * 2;
- drawMousePart(dst, pitch, image, offs);
+ drawMousePart(dst, pitch, image, offs, hotSpotX, hotSpotY);
+
+ _system->setMouseCursor(dst, 80, 80, hotSpotX, hotSpotY, 0);
+ free(dst);
}
-void SimonEngine::drawMousePart(byte *dst, int pitch, int image, int offs) {
+void SimonEngine::drawMousePart(byte *dst, int pitch, int image, int offs, int &hotSpotX, int &hotSpotY) {
VgaPointersEntry *vpe = &_vgaBufferPointers[7];
byte *src;
- int x, y, width, height;
- int tmp, srcw;
+ int x, y, w, h;
+ int width, height;
x = _mouseOffs[offs];
y = _mouseOffs[offs + 1];
@@ -469,76 +446,23 @@ void SimonEngine::drawMousePart(byte *dst, int pitch, int image, int offs) {
dst += y * pitch + x;
src = vpe->vgaFile2 + image * 8;
- srcw = width = READ_LE_UINT16(src + 6);
+ width = READ_LE_UINT16(src + 6);
height = READ_LE_UINT16(src + 4);
src = vpe->vgaFile2 + readUint32Wrapper(src);
- if (_mouseCountX != 40) {
- if (_mouseX >= 600) {
- tmp = _mouseOffs[offs] + width - _mouseCountX;
- if (tmp >= 0) {
- width -= tmp;
- if (width <= 0)
- return;
- }
- } else {
- if (_mouseOffs[offs] + _mouseCountX >= 40) {
- dst -= 40 - _mouseCountX;
- } else {
- dst -= _mouseOffs[offs];
- tmp = -(_mouseOffs[offs] + _mouseCountX - 40);
- width -= tmp;
- if (width <= 0)
- return;
- src += tmp;
- }
- }
- }
-
- if (_mouseCountY != 40) {
- if (_mouseY >= 200) {
- tmp = _mouseOffs[offs + 1] + height - _mouseCountY;
- if (tmp >= 0) {
- height -= tmp;
- if (height <= 0)
- return;
- }
- } else {
- tmp = _mouseOffs[offs + 1] + _mouseCountY;
- if (tmp >= 40) {
- tmp = 40 - _mouseCountY;
- while (tmp--)
- dst -= pitch;
- } else {
- tmp = _mouseOffs[offs + 1];
- while (tmp--)
- dst -= pitch;
- tmp = -(_mouseOffs[offs + 1] + _mouseCountY - 40);
- height -= tmp;
- if (height <= 0)
- return;
- while (tmp--)
- src += srcw;
- }
- }
- }
-
- drawMouse(dst, pitch, src, srcw, width, height);
-}
-
-void SimonEngine::drawMouse(byte *dst, int pitch, byte *src, int srcw, int width, int height) {
- int h, w;
-
for (h = 0; h < height; h++) {
for (w = 0; w < width; w++) {
if (src[w] != 0)
dst[w] = src[w];
}
- src += srcw;
+ src += width;
dst += pitch;
}
+
+ hotSpotX = (x + width) / 2;
+ hotSpotY = (y + height) / 2;
}
} // End of namespace Simon
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp
index 4f8e93445f..b634e8fa15 100644
--- a/engines/simon/simon.cpp
+++ b/engines/simon/simon.cpp
@@ -163,8 +163,6 @@ SimonEngine::SimonEngine(OSystem *syst)
_mouseAnimMax = 0;
_oldMouseCursor = 0;
_oldMouseAnimMax = 0;
- _mouseCountX = 0;
- _mouseCountY = 0;
_mouseToggle = false;
_vgaVar9 = 0;
diff --git a/engines/simon/simon.h b/engines/simon/simon.h
index e46c108435..bed42b1d5b 100644
--- a/engines/simon/simon.h
+++ b/engines/simon/simon.h
@@ -325,7 +325,6 @@ protected:
byte _mouseCursor, _mouseAnim, _mouseAnimMax;
byte _oldMouseCursor, _oldMouseAnimMax;
uint _mouseHideCount;
- int _mouseCountX, _mouseCountY;
bool _mouseToggle;
byte _leftButtonDown;
@@ -675,9 +674,7 @@ protected:
void pollMouseXY();
void drawMousePointer();
void drawMousePointer_FF();
- void drawMouse(byte *dst, int pitch, byte *src, int srcw, int width, int height);
- void drawMousePart(byte *dst, int pitch, int image, int offs);
-
+ void drawMousePart(byte *dst, int pitch, int image, int offs, int &width, int &height);
void defineArrowBoxes(WindowBlock *window);
void removeArrows(WindowBlock *window, uint num);