mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 22:28:10 +00:00
Moved cursor handling from Gfx to engine subclasses.
svn-id: r28534
This commit is contained in:
parent
ceaeba852e
commit
9167422ce3
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
@ -675,7 +675,7 @@ void Parallaction::changeCursor(int32 index) {
|
||||
_activeItem._id = _inventory[index]._id;
|
||||
}
|
||||
|
||||
_gfx->setMousePointer(index);
|
||||
setMousePointer(index);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -221,6 +221,12 @@ void Parallaction_br::freeFonts() {
|
||||
delete _dialogueFont;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Parallaction_br::setMousePointer(int16 index) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace Parallaction
|
||||
|
@ -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
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user