fix mouse bugs (fixes chess puzzle)

svn-id: r11834
This commit is contained in:
Robert Göffringmann 2003-12-21 18:50:05 +00:00
parent 2be2cb6d3e
commit e342d624d0
2 changed files with 11 additions and 12 deletions

View file

@ -39,7 +39,7 @@ SwordMouse::SwordMouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan) {
void SwordMouse::initialize(void) { void SwordMouse::initialize(void) {
_numObjs = 0; _numObjs = 0;
_mouseStatus = 0; // mouse off and unlocked SwordLogic::_scriptVars[MOUSE_STATUS] = 0; // mouse off and unlocked
_getOff = 0; _getOff = 0;
_specialPtrId = 0; _specialPtrId = 0;
_inTopMenu = false; _inTopMenu = false;
@ -99,7 +99,7 @@ void SwordMouse::engine(uint16 x, uint16 y, uint16 eventFlags) {
_mouseX = x; _mouseX = x;
_mouseY = y; _mouseY = y;
if (!(_mouseStatus & 1)) { // no human? if (!(SwordLogic::_scriptVars[MOUSE_STATUS] & 1)) { // no human?
// if the mouse is turned off, I want the menu automatically removed, // if the mouse is turned off, I want the menu automatically removed,
// except while in conversation, while examining a menu object or while combining two menu objects! // except while in conversation, while examining a menu object or while combining two menu objects!
/*if ((!subject_status)&&(!menu_looking)&&(!second_icon)) /*if ((!subject_status)&&(!menu_looking)&&(!second_icon))
@ -188,7 +188,7 @@ void SwordMouse::setPointer(uint32 resId, uint32 rate) {
} }
_frame = 0; _frame = 0;
if ((resId == 0) || (!(_mouseStatus & 1) && (!_mouseOverride))) { if ((resId == 0) || (!(SwordLogic::_scriptVars[MOUSE_STATUS] & 1) && (!_mouseOverride))) {
_system->set_mouse_cursor(NULL, 0, 0, 0, 0); _system->set_mouse_cursor(NULL, 0, 0, 0, 0);
_system->show_mouse(false); _system->show_mouse(false);
} else { } else {
@ -206,7 +206,7 @@ void SwordMouse::setPointer(uint32 resId, uint32 rate) {
void SwordMouse::animate(void) { void SwordMouse::animate(void) {
MousePtr *currentPtr; MousePtr *currentPtr;
if ((_mouseStatus == 1) || _mouseOverride) { if ((SwordLogic::_scriptVars[MOUSE_STATUS] == 1) || _mouseOverride) {
if (_specialPtrId) if (_specialPtrId)
currentPtr = _specialPtr; currentPtr = _specialPtr;
else else
@ -219,18 +219,17 @@ void SwordMouse::animate(void) {
} }
void SwordMouse::fnNoHuman(void) { void SwordMouse::fnNoHuman(void) {
if (_mouseStatus & 2) // locked, can't do anything if (SwordLogic::_scriptVars[MOUSE_STATUS] & 2) // locked, can't do anything
return ; return ;
_mouseStatus = 0; // off & unlocked SwordLogic::_scriptVars[MOUSE_STATUS] = 0; // off & unlocked
setLuggage(0, 0); setLuggage(0, 0);
setPointer(0, 0); setPointer(0, 0);
} }
void SwordMouse::fnAddHuman(void) { void SwordMouse::fnAddHuman(void) {
if (_mouseStatus & 2) // locked, can't do anything if (SwordLogic::_scriptVars[MOUSE_STATUS] & 2) // locked, can't do anything
return ; return ;
_mouseStatus = 1; SwordLogic::_scriptVars[MOUSE_STATUS] = 1;
// SwordLogic::_scriptVars[SPECIAL_ITEM] = -1;
SwordLogic::_scriptVars[SPECIAL_ITEM] = 0; // _scriptVars is unsigned... SwordLogic::_scriptVars[SPECIAL_ITEM] = 0; // _scriptVars is unsigned...
_getOff = SCR_std_off; _getOff = SCR_std_off;
setPointer(MSE_POINTER, 0); setPointer(MSE_POINTER, 0);
@ -247,11 +246,11 @@ void SwordMouse::fnNormalMouse(void) {
} }
void SwordMouse::fnLockMouse(void) { void SwordMouse::fnLockMouse(void) {
_mouseStatus |= 2; SwordLogic::_scriptVars[MOUSE_STATUS] |= 2;
} }
void SwordMouse::fnUnlockMouse(void) { void SwordMouse::fnUnlockMouse(void) {
_mouseStatus &= 1; SwordLogic::_scriptVars[MOUSE_STATUS] &= 1;
} }
void SwordMouse::giveCoords(uint16 *x, uint16 *y) { void SwordMouse::giveCoords(uint16 *x, uint16 *y) {

View file

@ -95,7 +95,7 @@ private:
uint16 _mouseX, _mouseY; uint16 _mouseX, _mouseY;
uint32 _currentPtrId, _frame; uint32 _currentPtrId, _frame;
uint8 _mouseStatus, _mouseCount; uint8 _mouseCount;
uint16 _numObjs; uint16 _numObjs;
uint16 _lastState, _state; uint16 _lastState, _state;
uint32 _getOff; uint32 _getOff;