Moved mouse cursor loading/handling to Input class.
svn-id: r34206
This commit is contained in:
parent
4e7205af36
commit
0a387bca12
11 changed files with 176 additions and 169 deletions
|
@ -29,10 +29,12 @@
|
||||||
#define PATH_LEN 200
|
#define PATH_LEN 200
|
||||||
|
|
||||||
#include "common/fs.h"
|
#include "common/fs.h"
|
||||||
|
|
||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
|
|
||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
|
|
||||||
|
#include "parallaction/graphics.h"
|
||||||
|
|
||||||
namespace Parallaction {
|
namespace Parallaction {
|
||||||
|
|
||||||
class Table;
|
class Table;
|
||||||
|
|
|
@ -230,7 +230,7 @@ public:
|
||||||
_vm->_gfx->setItemFrame(id, 0);
|
_vm->_gfx->setItemFrame(id, 0);
|
||||||
}
|
}
|
||||||
_selection = -1;
|
_selection = -1;
|
||||||
_vm->setArrowCursor();
|
_vm->_input->setArrowCursor();
|
||||||
_vm->_input->setMouseState(MOUSE_ENABLED_SHOW);
|
_vm->_input->setMouseState(MOUSE_ENABLED_SHOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ public:
|
||||||
uint id = _vm->_gfx->createLabel(_vm->_introFont, "SELECT LANGUAGE", 1);
|
uint id = _vm->_gfx->createLabel(_vm->_introFont, "SELECT LANGUAGE", 1);
|
||||||
_vm->_gfx->showLabel(id, 60, 30);
|
_vm->_gfx->showLabel(id, 60, 30);
|
||||||
|
|
||||||
_vm->setArrowCursor();
|
_vm->_input->setArrowCursor();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ public:
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
_vm->setArrowCursor();
|
_vm->_input->setArrowCursor();
|
||||||
_vm->_input->setMouseState(MOUSE_ENABLED_SHOW);
|
_vm->_input->setMouseState(MOUSE_ENABLED_SHOW);
|
||||||
_state = CHOICE;
|
_state = CHOICE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,58 @@
|
||||||
|
|
||||||
namespace Parallaction {
|
namespace Parallaction {
|
||||||
|
|
||||||
|
#define MOUSEARROW_WIDTH_NS 16
|
||||||
|
#define MOUSEARROW_HEIGHT_NS 16
|
||||||
|
|
||||||
|
#define MOUSECOMBO_WIDTH_NS 32 // sizes for cursor + selected inventory item
|
||||||
|
#define MOUSECOMBO_HEIGHT_NS 32
|
||||||
|
|
||||||
|
struct MouseComboProperties {
|
||||||
|
int _xOffset;
|
||||||
|
int _yOffset;
|
||||||
|
int _width;
|
||||||
|
int _height;
|
||||||
|
};
|
||||||
|
/*
|
||||||
|
// TODO: improve NS's handling of normal cursor before merging cursor code.
|
||||||
|
MouseComboProperties _mouseComboProps_NS = {
|
||||||
|
7, // combo x offset (the icon from the inventory will be rendered from here)
|
||||||
|
7, // combo y offset (ditto)
|
||||||
|
32, // combo (arrow + icon) width
|
||||||
|
32 // combo (arrow + icon) height
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
MouseComboProperties _mouseComboProps_BR = {
|
||||||
|
8, // combo x offset (the icon from the inventory will be rendered from here)
|
||||||
|
8, // combo y offset (ditto)
|
||||||
|
68, // combo (arrow + icon) width
|
||||||
|
68 // combo (arrow + icon) height
|
||||||
|
};
|
||||||
|
|
||||||
|
Input::Input(Parallaction *vm) : _vm(vm) {
|
||||||
|
_gameType = _vm->getGameType();
|
||||||
|
_transCurrentHoverItem = 0;
|
||||||
|
_hasDelayedAction = false; // actived when the character needs to move before taking an action
|
||||||
|
_mouseState = MOUSE_DISABLED;
|
||||||
|
_activeItem._index = 0;
|
||||||
|
_activeItem._id = 0;
|
||||||
|
_mouseButtons = 0;
|
||||||
|
_delayedActionZone = nullZonePtr;
|
||||||
|
|
||||||
|
initCursors();
|
||||||
|
}
|
||||||
|
|
||||||
|
Input::~Input() {
|
||||||
|
if (_gameType == GType_Nippon) {
|
||||||
|
delete _mouseArrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete _comboArrow;
|
||||||
|
delete _dinoCursor;
|
||||||
|
delete _dougCursor;
|
||||||
|
delete _donnaCursor;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: the engine has 3 event loops. The following routine hosts the main one,
|
// FIXME: the engine has 3 event loops. The following routine hosts the main one,
|
||||||
// and it's called from 8 different places in the code. There exist 2 more specialised
|
// and it's called from 8 different places in the code. There exist 2 more specialised
|
||||||
// loops which could possibly be merged into this one with some effort in changing
|
// loops which could possibly be merged into this one with some effort in changing
|
||||||
|
@ -131,8 +183,6 @@ int Input::updateGameInput() {
|
||||||
|
|
||||||
int event = kEvNone;
|
int event = kEvNone;
|
||||||
|
|
||||||
readInput();
|
|
||||||
|
|
||||||
if (!isMouseEnabled() ||
|
if (!isMouseEnabled() ||
|
||||||
(_engineFlags & kEngineWalking) ||
|
(_engineFlags & kEngineWalking) ||
|
||||||
(_engineFlags & kEngineChangeLocation)) {
|
(_engineFlags & kEngineChangeLocation)) {
|
||||||
|
@ -162,20 +212,14 @@ int Input::updateGameInput() {
|
||||||
int Input::updateInput() {
|
int Input::updateInput() {
|
||||||
|
|
||||||
int event = kEvNone;
|
int event = kEvNone;
|
||||||
|
readInput();
|
||||||
|
|
||||||
switch (_inputMode) {
|
switch (_inputMode) {
|
||||||
case kInputModeComment:
|
|
||||||
case kInputModeDialogue:
|
|
||||||
case kInputModeMenu:
|
|
||||||
readInput();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kInputModeGame:
|
case kInputModeGame:
|
||||||
event = updateGameInput();
|
event = updateGameInput();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kInputModeInventory:
|
case kInputModeInventory:
|
||||||
readInput();
|
|
||||||
updateInventoryInput();
|
updateInventoryInput();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -214,7 +258,7 @@ void Input::takeAction(ZonePtr z) {
|
||||||
|
|
||||||
void Input::walkTo(const Common::Point &dest) {
|
void Input::walkTo(const Common::Point &dest) {
|
||||||
stopHovering();
|
stopHovering();
|
||||||
_vm->setArrowCursor();
|
setArrowCursor();
|
||||||
_vm->_char.scheduleWalk(dest.x, dest.y);
|
_vm->_char.scheduleWalk(dest.x, dest.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +314,7 @@ bool Input::translateGameInput() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_vm->beep();
|
_vm->beep();
|
||||||
_vm->setArrowCursor();
|
setArrowCursor();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +330,7 @@ void Input::enterInventoryMode() {
|
||||||
_activeItem._index = (_activeItem._id >> 16) & 0xFFFF;
|
_activeItem._index = (_activeItem._id >> 16) & 0xFFFF;
|
||||||
_engineFlags |= kEngineDragging;
|
_engineFlags |= kEngineDragging;
|
||||||
} else {
|
} else {
|
||||||
_vm->setArrowCursor();
|
setArrowCursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,12 +365,12 @@ void Input::exitInventoryMode() {
|
||||||
|
|
||||||
_vm->closeInventory();
|
_vm->closeInventory();
|
||||||
if (pos == -1) {
|
if (pos == -1) {
|
||||||
_vm->setArrowCursor();
|
setArrowCursor();
|
||||||
} else {
|
} else {
|
||||||
const InventoryItem *item = _vm->getInventoryItem(pos);
|
const InventoryItem *item = _vm->getInventoryItem(pos);
|
||||||
if (item->_index != 0) {
|
if (item->_index != 0) {
|
||||||
_activeItem._id = item->_id;
|
_activeItem._id = item->_id;
|
||||||
_vm->setInventoryCursor(item->_index);
|
setInventoryCursor(item->_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_vm->resumeJobs();
|
_vm->resumeJobs();
|
||||||
|
@ -374,4 +418,94 @@ bool Input::isMouseEnabled() {
|
||||||
return (_mouseState == MOUSE_ENABLED_SHOW) || (_mouseState == MOUSE_ENABLED_HIDE);
|
return (_mouseState == MOUSE_ENABLED_SHOW) || (_mouseState == MOUSE_ENABLED_HIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Input::initCursors() {
|
||||||
|
|
||||||
|
switch (_gameType) {
|
||||||
|
case GType_Nippon:
|
||||||
|
_comboArrow = _vm->_disk->loadPointer("pointer");
|
||||||
|
_mouseArrow = new Cnv(1, MOUSEARROW_WIDTH_NS, MOUSEARROW_HEIGHT_NS, _resMouseArrow_NS);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GType_BRA:
|
||||||
|
if (_vm->getPlatform() == Common::kPlatformPC) {
|
||||||
|
_dinoCursor = _vm->_disk->loadPointer("pointer1");
|
||||||
|
_dougCursor = _vm->_disk->loadPointer("pointer2");
|
||||||
|
_donnaCursor = _vm->_disk->loadPointer("pointer3");
|
||||||
|
|
||||||
|
Graphics::Surface *surf = new Graphics::Surface;
|
||||||
|
surf->create(_mouseComboProps_BR._width, _mouseComboProps_BR._height, 1);
|
||||||
|
_comboArrow = new SurfaceToFrames(surf);
|
||||||
|
|
||||||
|
// TODO: choose the pointer depending on the active character
|
||||||
|
// For now, we pick Donna's
|
||||||
|
_mouseArrow = _donnaCursor;
|
||||||
|
} else {
|
||||||
|
// TODO: Where are the Amiga cursors?
|
||||||
|
_mouseArrow = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
warning("Input::initCursors: unknown gametype");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Input::setArrowCursor() {
|
||||||
|
|
||||||
|
switch (_gameType) {
|
||||||
|
case GType_Nippon:
|
||||||
|
debugC(1, kDebugInput, "setting mouse cursor to arrow");
|
||||||
|
// this stuff is needed to avoid artifacts with labels and selected items when switching cursors
|
||||||
|
stopHovering();
|
||||||
|
_activeItem._id = 0;
|
||||||
|
_vm->_system->setMouseCursor(_mouseArrow->getData(0), MOUSEARROW_WIDTH_NS, MOUSEARROW_HEIGHT_NS, 0, 0, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GType_BRA: {
|
||||||
|
if (_vm->getPlatform() == Common::kPlatformAmiga)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Common::Rect r;
|
||||||
|
_mouseArrow->getRect(0, r);
|
||||||
|
_vm->_system->setMouseCursor(_mouseArrow->getData(0), r.width(), r.height(), 0, 0, 0);
|
||||||
|
_vm->_system->showMouse(true);
|
||||||
|
_activeItem._id = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
warning("Input::setArrowCursor: unknown gametype");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Input::setInventoryCursor(ItemName name) {
|
||||||
|
assert(name > 0);
|
||||||
|
|
||||||
|
switch (_gameType) {
|
||||||
|
case GType_Nippon: {
|
||||||
|
byte *v8 = _comboArrow->getData(0);
|
||||||
|
// FIXME: destination offseting is not clear
|
||||||
|
_vm->_inventoryRenderer->drawItem(name, v8 + 7 * MOUSECOMBO_WIDTH_NS + 7, MOUSECOMBO_WIDTH_NS);
|
||||||
|
_vm->_system->setMouseCursor(v8, MOUSECOMBO_WIDTH_NS, MOUSECOMBO_HEIGHT_NS, 0, 0, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case GType_BRA: {
|
||||||
|
byte *src = _mouseArrow->getData(0);
|
||||||
|
byte *dst = _comboArrow->getData(0);
|
||||||
|
memcpy(dst, src, _comboArrow->getSize(0));
|
||||||
|
// FIXME: destination offseting is not clear
|
||||||
|
_vm->_inventoryRenderer->drawItem(name, dst + _mouseComboProps_BR._yOffset * _mouseComboProps_BR._width + _mouseComboProps_BR._xOffset, _mouseComboProps_BR._width);
|
||||||
|
_vm->_system->setMouseCursor(dst, _mouseComboProps_BR._width, _mouseComboProps_BR._height, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
warning("Input::setInventoryCursor: unknown gametype");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Parallaction
|
} // namespace Parallaction
|
||||||
|
|
|
@ -74,6 +74,17 @@ class Input {
|
||||||
void enterInventoryMode();
|
void enterInventoryMode();
|
||||||
void exitInventoryMode();
|
void exitInventoryMode();
|
||||||
|
|
||||||
|
int _gameType;
|
||||||
|
|
||||||
|
static byte _resMouseArrow_NS[256];
|
||||||
|
Frames *_mouseArrow;
|
||||||
|
Frames *_comboArrow;
|
||||||
|
Frames *_dinoCursor;
|
||||||
|
Frames *_dougCursor;
|
||||||
|
Frames *_donnaCursor;
|
||||||
|
|
||||||
|
void initCursors();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
kInputModeGame = 0,
|
kInputModeGame = 0,
|
||||||
|
@ -84,18 +95,8 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Input(Parallaction *vm) : _vm(vm) {
|
Input(Parallaction *vm);
|
||||||
_transCurrentHoverItem = 0;
|
virtual ~Input();
|
||||||
_hasDelayedAction = false; // actived when the character needs to move before taking an action
|
|
||||||
_mouseState = MOUSE_DISABLED;
|
|
||||||
_activeItem._index = 0;
|
|
||||||
_activeItem._id = 0;
|
|
||||||
_mouseButtons = 0;
|
|
||||||
_delayedActionZone = nullZonePtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~Input() { }
|
|
||||||
|
|
||||||
|
|
||||||
void getCursorPos(Common::Point& p) {
|
void getCursorPos(Common::Point& p) {
|
||||||
p = _mousePos;
|
p = _mousePos;
|
||||||
|
@ -118,6 +119,9 @@ public:
|
||||||
void setMouseState(MouseTriState state);
|
void setMouseState(MouseTriState state);
|
||||||
MouseTriState getMouseState();
|
MouseTriState getMouseState();
|
||||||
bool isMouseEnabled();
|
bool isMouseEnabled();
|
||||||
|
|
||||||
|
void setArrowCursor();
|
||||||
|
void setInventoryCursor(ItemName name);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Parallaction
|
} // namespace Parallaction
|
||||||
|
|
|
@ -100,8 +100,6 @@ Parallaction::~Parallaction() {
|
||||||
|
|
||||||
cleanupGui();
|
cleanupGui();
|
||||||
|
|
||||||
delete _comboArrow;
|
|
||||||
|
|
||||||
delete _localFlagNames;
|
delete _localFlagNames;
|
||||||
delete _gfx;
|
delete _gfx;
|
||||||
delete _soundMan;
|
delete _soundMan;
|
||||||
|
@ -134,6 +132,7 @@ int Parallaction::init() {
|
||||||
|
|
||||||
initInventory(); // needs to be pushed into subclass
|
initInventory(); // needs to be pushed into subclass
|
||||||
|
|
||||||
|
// this needs _disk to be already setup
|
||||||
_input = new Input(this);
|
_input = new Input(this);
|
||||||
|
|
||||||
_gfx = new Gfx(this);
|
_gfx = new Gfx(this);
|
||||||
|
@ -301,13 +300,13 @@ void Parallaction::processInput(int event) {
|
||||||
case kEvSaveGame:
|
case kEvSaveGame:
|
||||||
_input->stopHovering();
|
_input->stopHovering();
|
||||||
saveGame();
|
saveGame();
|
||||||
setArrowCursor();
|
_input->setArrowCursor();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEvLoadGame:
|
case kEvLoadGame:
|
||||||
_input->stopHovering();
|
_input->stopHovering();
|
||||||
loadGame();
|
loadGame();
|
||||||
setArrowCursor();
|
_input->setArrowCursor();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,10 +90,6 @@ enum {
|
||||||
kEvLoadGame = 4000
|
kEvLoadGame = 4000
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
|
||||||
kCursorArrow = -1
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ParallactionGameType {
|
enum ParallactionGameType {
|
||||||
GType_Nippon = 1,
|
GType_Nippon = 1,
|
||||||
GType_BRA
|
GType_BRA
|
||||||
|
@ -104,7 +100,6 @@ struct PARALLACTIONGameDescription;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern uint16 _mouseButtons;
|
|
||||||
extern char _password[8];
|
extern char _password[8];
|
||||||
extern uint16 _score;
|
extern uint16 _score;
|
||||||
extern uint16 _language;
|
extern uint16 _language;
|
||||||
|
@ -302,7 +297,6 @@ public:
|
||||||
Common::RandomSource _rnd;
|
Common::RandomSource _rnd;
|
||||||
|
|
||||||
Debugger *_debugger;
|
Debugger *_debugger;
|
||||||
Frames *_comboArrow;
|
|
||||||
|
|
||||||
|
|
||||||
protected: // data
|
protected: // data
|
||||||
|
@ -337,9 +331,6 @@ public:
|
||||||
|
|
||||||
virtual void callFunction(uint index, void* parm) { }
|
virtual void callFunction(uint index, void* parm) { }
|
||||||
|
|
||||||
virtual void setArrowCursor() = 0;
|
|
||||||
virtual void setInventoryCursor(ItemName name) = 0;
|
|
||||||
|
|
||||||
virtual void parseLocation(const char* name) = 0;
|
virtual void parseLocation(const char* name) = 0;
|
||||||
|
|
||||||
void updateDoor(ZonePtr z, bool close);
|
void updateDoor(ZonePtr z, bool close);
|
||||||
|
@ -455,7 +446,6 @@ public:
|
||||||
|
|
||||||
void switchBackground(const char* background, const char* mask);
|
void switchBackground(const char* background, const char* mask);
|
||||||
void showSlide(const char *name, int x = 0, int y = 0);
|
void showSlide(const char *name, int x = 0, int y = 0);
|
||||||
void setArrowCursor();
|
|
||||||
|
|
||||||
// TODO: this should be private!!!!!!!
|
// TODO: this should be private!!!!!!!
|
||||||
bool _inTestResult;
|
bool _inTestResult;
|
||||||
|
@ -479,19 +469,12 @@ private:
|
||||||
void changeCharacter(const char *name);
|
void changeCharacter(const char *name);
|
||||||
void runPendingZones();
|
void runPendingZones();
|
||||||
|
|
||||||
void setInventoryCursor(ItemName name);
|
|
||||||
|
|
||||||
|
|
||||||
void doLoadGame(uint16 slot);
|
void doLoadGame(uint16 slot);
|
||||||
void doSaveGame(uint16 slot, const char* name);
|
void doSaveGame(uint16 slot, const char* name);
|
||||||
int buildSaveFileList(Common::StringList& l);
|
int buildSaveFileList(Common::StringList& l);
|
||||||
int selectSaveFile(uint16 arg_0, const char* caption, const char* button);
|
int selectSaveFile(uint16 arg_0, const char* caption, const char* button);
|
||||||
|
|
||||||
void initResources();
|
void initResources();
|
||||||
void initCursors();
|
|
||||||
|
|
||||||
static byte _resMouseArrow[256];
|
|
||||||
byte *_mouseArrow;
|
|
||||||
|
|
||||||
static const Callable _dosCallables[25];
|
static const Callable _dosCallables[25];
|
||||||
static const Callable _amigaCallables[25];
|
static const Callable _amigaCallables[25];
|
||||||
|
@ -599,7 +582,6 @@ public:
|
||||||
|
|
||||||
uint32 _zoneFlags[NUM_LOCATIONS][NUM_ZONES];
|
uint32 _zoneFlags[NUM_LOCATIONS][NUM_ZONES];
|
||||||
void startPart(uint part);
|
void startPart(uint part);
|
||||||
void setArrowCursor();
|
|
||||||
private:
|
private:
|
||||||
LocationParser_br *_locationParser;
|
LocationParser_br *_locationParser;
|
||||||
ProgramParser_br *_programParser;
|
ProgramParser_br *_programParser;
|
||||||
|
@ -607,9 +589,6 @@ private:
|
||||||
void initResources();
|
void initResources();
|
||||||
void initFonts();
|
void initFonts();
|
||||||
void freeFonts();
|
void freeFonts();
|
||||||
|
|
||||||
void setInventoryCursor(ItemName name);
|
|
||||||
|
|
||||||
void changeLocation(char *location);
|
void changeLocation(char *location);
|
||||||
void runPendingZones();
|
void runPendingZones();
|
||||||
|
|
||||||
|
@ -617,13 +596,6 @@ private:
|
||||||
void freePart();
|
void freePart();
|
||||||
void freeLocation();
|
void freeLocation();
|
||||||
|
|
||||||
void initCursors();
|
|
||||||
|
|
||||||
Frames *_dinoCursor;
|
|
||||||
Frames *_dougCursor;
|
|
||||||
Frames *_donnaCursor;
|
|
||||||
Frames *_mouseArrow;
|
|
||||||
|
|
||||||
|
|
||||||
static const char *_partNames[];
|
static const char *_partNames[];
|
||||||
|
|
||||||
|
|
|
@ -32,27 +32,6 @@
|
||||||
|
|
||||||
namespace Parallaction {
|
namespace Parallaction {
|
||||||
|
|
||||||
struct MouseComboProperties {
|
|
||||||
int _xOffset;
|
|
||||||
int _yOffset;
|
|
||||||
int _width;
|
|
||||||
int _height;
|
|
||||||
};
|
|
||||||
/*
|
|
||||||
// TODO: improve NS's handling of normal cursor before merging cursor code.
|
|
||||||
MouseComboProperties _mouseComboProps_NS = {
|
|
||||||
7, // combo x offset (the icon from the inventory will be rendered from here)
|
|
||||||
7, // combo y offset (ditto)
|
|
||||||
32, // combo (arrow + icon) width
|
|
||||||
32 // combo (arrow + icon) height
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
MouseComboProperties _mouseComboProps_BR = {
|
|
||||||
8, // combo x offset (the icon from the inventory will be rendered from here)
|
|
||||||
8, // combo y offset (ditto)
|
|
||||||
68, // combo (arrow + icon) width
|
|
||||||
68 // combo (arrow + icon) height
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *Parallaction_br::_partNames[] = {
|
const char *Parallaction_br::_partNames[] = {
|
||||||
"PART0",
|
"PART0",
|
||||||
|
@ -96,7 +75,6 @@ int Parallaction_br::init() {
|
||||||
|
|
||||||
initResources();
|
initResources();
|
||||||
initFonts();
|
initFonts();
|
||||||
initCursors();
|
|
||||||
_locationParser = new LocationParser_br(this);
|
_locationParser = new LocationParser_br(this);
|
||||||
_locationParser->init();
|
_locationParser->init();
|
||||||
_programParser = new ProgramParser_br(this);
|
_programParser = new ProgramParser_br(this);
|
||||||
|
@ -119,10 +97,6 @@ int Parallaction_br::init() {
|
||||||
|
|
||||||
Parallaction_br::~Parallaction_br() {
|
Parallaction_br::~Parallaction_br() {
|
||||||
freeFonts();
|
freeFonts();
|
||||||
|
|
||||||
delete _dinoCursor;
|
|
||||||
delete _dougCursor;
|
|
||||||
delete _donnaCursor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parallaction_br::callFunction(uint index, void* parm) {
|
void Parallaction_br::callFunction(uint index, void* parm) {
|
||||||
|
@ -170,26 +144,6 @@ void Parallaction_br::freeFonts() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parallaction_br::initCursors() {
|
|
||||||
|
|
||||||
if (getPlatform() == Common::kPlatformPC) {
|
|
||||||
_dinoCursor = _disk->loadPointer("pointer1");
|
|
||||||
_dougCursor = _disk->loadPointer("pointer2");
|
|
||||||
_donnaCursor = _disk->loadPointer("pointer3");
|
|
||||||
|
|
||||||
Graphics::Surface *surf = new Graphics::Surface;
|
|
||||||
surf->create(_mouseComboProps_BR._width, _mouseComboProps_BR._height, 1);
|
|
||||||
_comboArrow = new SurfaceToFrames(surf);
|
|
||||||
|
|
||||||
// TODO: choose the pointer depending on the active character
|
|
||||||
// For now, we pick Donna's
|
|
||||||
_mouseArrow = _donnaCursor;
|
|
||||||
} else {
|
|
||||||
// TODO: Where are the Amiga cursors?
|
|
||||||
_mouseArrow = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Parallaction_br::initPart() {
|
void Parallaction_br::initPart() {
|
||||||
|
|
||||||
|
@ -365,30 +319,5 @@ void Parallaction_br::changeCharacter(const char *name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Parallaction_br::setArrowCursor() {
|
|
||||||
// FIXME: Where are the Amiga cursors?
|
|
||||||
if (getPlatform() == Common::kPlatformAmiga)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Common::Rect r;
|
|
||||||
_mouseArrow->getRect(0, r);
|
|
||||||
|
|
||||||
_system->setMouseCursor(_mouseArrow->getData(0), r.width(), r.height(), 0, 0, 0);
|
|
||||||
_system->showMouse(true);
|
|
||||||
|
|
||||||
_input->_activeItem._id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Parallaction_br::setInventoryCursor(ItemName name) {
|
|
||||||
assert(name > 0);
|
|
||||||
|
|
||||||
byte *src = _mouseArrow->getData(0);
|
|
||||||
byte *dst = _comboArrow->getData(0);
|
|
||||||
memcpy(dst, src, _comboArrow->getSize(0));
|
|
||||||
|
|
||||||
// FIXME: destination offseting is not clear
|
|
||||||
_inventoryRenderer->drawItem(name, dst + _mouseComboProps_BR._yOffset * _mouseComboProps_BR._width + _mouseComboProps_BR._xOffset, _mouseComboProps_BR._width);
|
|
||||||
_system->setMouseCursor(dst, _mouseComboProps_BR._width, _mouseComboProps_BR._height, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Parallaction
|
} // namespace Parallaction
|
||||||
|
|
|
@ -35,12 +35,6 @@
|
||||||
namespace Parallaction {
|
namespace Parallaction {
|
||||||
|
|
||||||
|
|
||||||
#define MOUSEARROW_WIDTH 16
|
|
||||||
#define MOUSEARROW_HEIGHT 16
|
|
||||||
|
|
||||||
#define MOUSECOMBO_WIDTH 32 // sizes for cursor + selected inventory item
|
|
||||||
#define MOUSECOMBO_HEIGHT 32
|
|
||||||
|
|
||||||
LocationName::LocationName() {
|
LocationName::LocationName() {
|
||||||
_buf = 0;
|
_buf = 0;
|
||||||
_hasSlide = false;
|
_hasSlide = false;
|
||||||
|
@ -135,7 +129,6 @@ int Parallaction_ns::init() {
|
||||||
|
|
||||||
initResources();
|
initResources();
|
||||||
initFonts();
|
initFonts();
|
||||||
initCursors();
|
|
||||||
_locationParser = new LocationParser_ns(this);
|
_locationParser = new LocationParser_ns(this);
|
||||||
_locationParser->init();
|
_locationParser->init();
|
||||||
_programParser = new ProgramParser_ns(this);
|
_programParser = new ProgramParser_ns(this);
|
||||||
|
@ -181,32 +174,6 @@ void Parallaction_ns::freeFonts() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parallaction_ns::initCursors() {
|
|
||||||
_comboArrow = _disk->loadPointer("pointer");
|
|
||||||
_mouseArrow = _resMouseArrow;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Parallaction_ns::setArrowCursor() {
|
|
||||||
|
|
||||||
debugC(1, kDebugInput, "setting mouse cursor to arrow");
|
|
||||||
|
|
||||||
// this stuff is needed to avoid artifacts with labels and selected items when switching cursors
|
|
||||||
_input->stopHovering();
|
|
||||||
_input->_activeItem._id = 0;
|
|
||||||
|
|
||||||
_system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Parallaction_ns::setInventoryCursor(ItemName name) {
|
|
||||||
assert(name > 0);
|
|
||||||
|
|
||||||
byte *v8 = _comboArrow->getData(0);
|
|
||||||
|
|
||||||
// FIXME: destination offseting is not clear
|
|
||||||
_inventoryRenderer->drawItem(name, v8 + 7 * MOUSECOMBO_WIDTH + 7, MOUSECOMBO_WIDTH);
|
|
||||||
_system->setMouseCursor(v8, MOUSECOMBO_WIDTH, MOUSECOMBO_HEIGHT, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Parallaction_ns::callFunction(uint index, void* parm) {
|
void Parallaction_ns::callFunction(uint index, void* parm) {
|
||||||
assert(index < 25); // magic value 25 is maximum # of callables for Nippon Safes
|
assert(index < 25); // magic value 25 is maximum # of callables for Nippon Safes
|
||||||
|
@ -287,7 +254,7 @@ void Parallaction_ns::changeLocation(char *location) {
|
||||||
|
|
||||||
_zoneTrap = nullZonePtr;
|
_zoneTrap = nullZonePtr;
|
||||||
|
|
||||||
setArrowCursor();
|
_input->setArrowCursor();
|
||||||
|
|
||||||
_gfx->showGfxObj(_char._ani->gfxobj, false);
|
_gfx->showGfxObj(_char._ani->gfxobj, false);
|
||||||
_location._animations.remove(_char._ani);
|
_location._animations.remove(_char._ani);
|
||||||
|
|
|
@ -392,7 +392,7 @@ bool Parallaction_ns::loadGame() {
|
||||||
GUI::TimedMessageDialog dialog("Loading game...", 1500);
|
GUI::TimedMessageDialog dialog("Loading game...", 1500);
|
||||||
dialog.runModal();
|
dialog.runModal();
|
||||||
|
|
||||||
setArrowCursor();
|
_input->setArrowCursor();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
namespace Parallaction {
|
namespace Parallaction {
|
||||||
|
|
||||||
byte Parallaction_ns::_resMouseArrow[256] = {
|
byte Input::_resMouseArrow_NS[256] = {
|
||||||
0x12, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x00, 0x00,
|
0x12, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x00, 0x00,
|
||||||
0x11, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x13, 0x00, 0x00, 0x00,
|
0x11, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x13, 0x00, 0x00, 0x00,
|
||||||
0x11, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x13, 0x00, 0x00, 0x00, 0x00,
|
0x11, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x13, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue