aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2007-08-11 20:44:22 +0000
committerNicola Mettifogo2007-08-11 20:44:22 +0000
commit9167422ce3b479671419784c6b26bb2c8ee799f5 (patch)
treea66fc092f18ceec17098a764e20a9e61dcf25e96 /engines
parentceaeba852e89065c1a33e0eb92a05ae55560a451 (diff)
downloadscummvm-rg350-9167422ce3b479671419784c6b26bb2c8ee799f5.tar.gz
scummvm-rg350-9167422ce3b479671419784c6b26bb2c8ee799f5.tar.bz2
scummvm-rg350-9167422ce3b479671419784c6b26bb2c8ee799f5.zip
Moved cursor handling from Gfx to engine subclasses.
svn-id: r28534
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/graphics.cpp40
-rw-r--r--engines/parallaction/graphics.h10
-rw-r--r--engines/parallaction/parallaction.cpp2
-rw-r--r--engines/parallaction/parallaction.h12
-rw-r--r--engines/parallaction/parallaction_br.cpp6
-rw-r--r--engines/parallaction/parallaction_ns.cpp55
-rw-r--r--engines/parallaction/staticres.cpp2
7 files changed, 75 insertions, 52 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index cdc2641666..2e7d79c37c 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -454,43 +454,8 @@ void jobEraseLabel(void *parm, Job *j) {
return;
}
-void Gfx::initMouse(uint16 arg_0) {
- _mouseComposedArrow = _vm->_disk->loadPointer();
- byte temp[MOUSEARROW_WIDTH*MOUSEARROW_HEIGHT];
- memcpy(temp, _mouseArrow, MOUSEARROW_WIDTH*MOUSEARROW_HEIGHT);
-
- uint16 k = 0;
- for (uint16 i = 0; i < 4; i++) {
- for (uint16 j = 0; j < 64; j++) _mouseArrow[k++] = temp[i + j * 4];
- }
-
- return;
-}
-
-
-void Gfx::setMousePointer(int16 index) {
-
- if (index == kCursorArrow) { // standard mouse pointer
-
- g_system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
- g_system->showMouse(true);
-
- } else {
- // inventory item pointer
- byte *v8 = (byte*)_mouseComposedArrow->pixels;
-
- // FIXME: destination offseting is not clear
- byte* s = _vm->_char._objs->getFramePtr(getInventoryItemIndex(index));
- byte* d = v8 + 7 + MOUSECOMBO_WIDTH * 7;
- copyRect(INVENTORYITEM_WIDTH, INVENTORYITEM_HEIGHT, d, MOUSECOMBO_WIDTH, s, INVENTORYITEM_PITCH);
-
- g_system->setMouseCursor(v8, MOUSECOMBO_WIDTH, MOUSECOMBO_HEIGHT, 0, 0, 0);
- }
-
- return;
-}
@@ -824,8 +789,6 @@ Gfx::Gfx(Parallaction* vm) :
memset(_palettefx, 0, sizeof(_palettefx));
- initMouse( 0 );
-
_halfbrite = false;
_font = NULL;
@@ -840,9 +803,6 @@ Gfx::~Gfx() {
_buffers[kBitBack]->free();
delete _buffers[kBitBack];
- _mouseComposedArrow->free();
- delete _mouseComposedArrow;
-
return;
}
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index 2134a17e4e..a830b9b2c9 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -37,12 +37,6 @@
namespace Parallaction {
-#define MOUSEARROW_WIDTH 16
-#define MOUSEARROW_HEIGHT 16
-
-#define MOUSECOMBO_WIDTH 32 // sizes for cursor + selected inventory item
-#define MOUSECOMBO_HEIGHT 32
-
#include "common/pack-start.h" // START STRUCT PACKING
struct PaletteFxRange {
@@ -230,7 +224,6 @@ public:
// misc
int16 queryMask(int16 v);
- void setMousePointer(int16 index);
void setFont(Font* font);
void swapBuffers();
void updateScreen();
@@ -252,8 +245,6 @@ protected:
Parallaction* _vm;
Graphics::Surface *_buffers[NUM_BUFFERS];
MaskBuffer *_depthMask;
- static byte _mouseArrow[256];
- Graphics::Surface *_mouseComposedArrow;
Font *_font;
bool _halfbrite;
@@ -261,7 +252,6 @@ protected:
void copyRect(uint width, uint height, byte *dst, uint dstPitch, byte *src, uint srcPitch);
void flatBlit(const Common::Rect& r, byte *data, Gfx::Buffers buffer, byte transparentColor);
void blit(const Common::Rect& r, uint16 z, byte *data, Gfx::Buffers buffer);
- void initMouse(uint16 arg_0);
void screenClip(Common::Rect& r, Common::Point& p);
};
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 813394da01..e576218fdd 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -675,7 +675,7 @@ void Parallaction::changeCursor(int32 index) {
_activeItem._id = _inventory[index]._id;
}
- _gfx->setMousePointer(index);
+ setMousePointer(index);
return;
}
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 3f5afe6f4c..22568d9b6e 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -490,6 +490,8 @@ protected: // members
public:
virtual void callFunction(uint index, void* parm) { }
virtual void renderLabel(Graphics::Surface *cnv, char *text) { }
+ virtual void setMousePointer(int16 index) = 0;
+
public:
const char **_zoneFlagNamesRes;
@@ -513,6 +515,8 @@ public:
virtual void callFunction(uint index, void* parm);
void renderLabel(Graphics::Surface *cnv, char *text);
+ void setMousePointer(int16 index);
+
private:
void initFonts();
@@ -520,6 +524,10 @@ private:
private:
void initResources();
+ void initCursors();
+
+ static byte _mouseArrow[256];
+ Graphics::Surface *_mouseComposedArrow;
static const Callable _dosCallables[25];
static const Callable _amigaCallables[25];
@@ -583,6 +591,10 @@ private:
void initFonts();
void freeFonts();
+ void setMousePointer(int16 index);
+ void initCursors();
+
+
int showMenu();
void renderMenuItem(Graphics::Surface &surf, const char *text);
void invertMenuItem(Graphics::Surface &surf);
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 8060803dac..3ac36a75fa 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -223,4 +223,10 @@ void Parallaction_br::freeFonts() {
return;
}
+void Parallaction_br::setMousePointer(int16 index) {
+
+
+
+}
+
} // namespace Parallaction
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index 0b088442e4..ab9a6894f1 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -24,6 +24,8 @@
*/
#include "common/stdafx.h"
+#include "common/system.h"
+
#include "common/config-manager.h"
#include "parallaction/parallaction.h"
@@ -31,6 +33,12 @@
namespace Parallaction {
+#define MOUSEARROW_WIDTH 16
+#define MOUSEARROW_HEIGHT 16
+
+#define MOUSECOMBO_WIDTH 32 // sizes for cursor + selected inventory item
+#define MOUSECOMBO_HEIGHT 32
+
int Parallaction_ns::init() {
// Detect game
@@ -63,6 +71,7 @@ int Parallaction_ns::init() {
initResources();
initFonts();
+ initCursors();
Parallaction::init();
@@ -71,6 +80,9 @@ int Parallaction_ns::init() {
Parallaction_ns::~Parallaction_ns() {
freeFonts();
+
+ _mouseComposedArrow->free();
+ delete _mouseComposedArrow;
}
@@ -102,6 +114,49 @@ void Parallaction_ns::renderLabel(Graphics::Surface *cnv, char *text) {
}
+void Parallaction_ns::initCursors() {
+
+ _mouseComposedArrow = _disk->loadPointer();
+
+ byte temp[MOUSEARROW_WIDTH*MOUSEARROW_HEIGHT];
+ memcpy(temp, _mouseArrow, MOUSEARROW_WIDTH*MOUSEARROW_HEIGHT);
+
+ uint16 k = 0;
+ for (uint16 i = 0; i < 4; i++) {
+ for (uint16 j = 0; j < 64; j++) _mouseArrow[k++] = temp[i + j * 4];
+ }
+
+ return;
+}
+
+void Parallaction_ns::setMousePointer(int16 index) {
+
+ if (index == kCursorArrow) { // standard mouse pointer
+
+ _system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
+ _system->showMouse(true);
+
+ } else {
+ // inventory item pointer
+ byte *v8 = (byte*)_mouseComposedArrow->pixels;
+
+ // FIXME: destination offseting is not clear
+ byte* s = _char._objs->getFramePtr(getInventoryItemIndex(index));
+ byte* d = v8 + 7 + MOUSECOMBO_WIDTH * 7;
+
+ for (uint i = 0; i < INVENTORYITEM_HEIGHT; i++) {
+ memcpy(d, s, INVENTORYITEM_WIDTH);
+
+ s += INVENTORYITEM_PITCH;
+ d += MOUSECOMBO_WIDTH;
+ }
+
+ _system->setMouseCursor(v8, MOUSECOMBO_WIDTH, MOUSECOMBO_HEIGHT, 0, 0, 0);
+ }
+
+ return;
+}
+
void Parallaction_ns::callFunction(uint index, void* parm) {
assert(index < 25); // magic value 25 is maximum # of callables for Nippon Safes
diff --git a/engines/parallaction/staticres.cpp b/engines/parallaction/staticres.cpp
index 046176a933..74fe456167 100644
--- a/engines/parallaction/staticres.cpp
+++ b/engines/parallaction/staticres.cpp
@@ -30,7 +30,7 @@
namespace Parallaction {
-byte Gfx::_mouseArrow[256] = {
+byte Parallaction_ns::_mouseArrow[256] = {
0x12, 0x11, 0x11, 0x11, 0x13, 0x12, 0x12, 0x12, 0x13, 0x12, 0x12, 0x11, 0x13, 0x12, 0x12, 0x00,
0x13, 0x12, 0x12, 0x11, 0x13, 0x12, 0x12, 0x12, 0x13, 0x12, 0x12, 0x12, 0x13, 0x12, 0x12, 0x12,
0x13, 0x12, 0x12, 0x12, 0x13, 0x12, 0x12, 0x12, 0x13, 0x12, 0x12, 0x13, 0x13, 0x13, 0x12, 0x00,