diff options
author | Robert Göffringmann | 2003-12-20 17:55:09 +0000 |
---|---|---|
committer | Robert Göffringmann | 2003-12-20 17:55:09 +0000 |
commit | be120d1289c199675e8ec9e4a1eb1466d86b62a6 (patch) | |
tree | e4e41cada081a3dcbe572116e1f07869d5137561 | |
parent | 33ca6ecfa5d97db0e63092268eca4e94c0851fa3 (diff) | |
download | scummvm-rg350-be120d1289c199675e8ec9e4a1eb1466d86b62a6.tar.gz scummvm-rg350-be120d1289c199675e8ec9e4a1eb1466d86b62a6.tar.bz2 scummvm-rg350-be120d1289c199675e8ec9e4a1eb1466d86b62a6.zip |
fix recently introduced mouse bugs.
svn-id: r11787
-rw-r--r-- | sword1/menu.cpp | 5 | ||||
-rw-r--r-- | sword1/mouse.cpp | 17 | ||||
-rw-r--r-- | sword1/mouse.h | 4 |
3 files changed, 9 insertions, 17 deletions
diff --git a/sword1/menu.cpp b/sword1/menu.cpp index ba44bc4577..01f4e26438 100644 --- a/sword1/menu.cpp +++ b/sword1/menu.cpp @@ -182,7 +182,6 @@ void SwordMenu::fnEndMenu(void) { _screen->clearMenu(MENU_TOP); _screen->clearMenu(MENU_BOT); _objectBarShown = false; - _mouse->setMenuStatus(0); } } @@ -190,7 +189,7 @@ void SwordMenu::fnChooser(BsObject *compact) { SwordLogic::_scriptVars[OBJECT_HELD] = 0; buildSubjects(); compact->o_logic = LOGIC_choose; - _mouse->setMenuStatus(1); // so the mouse cursor will be shown. + _mouse->controlPanel(true); // so the mouse cursor will be shown. _subjectBarShown = true; } @@ -203,7 +202,7 @@ void SwordMenu::fnEndChooser(void) { delete _subjects[cnt]; _subjects[cnt] = NULL; } - _mouse->setMenuStatus(0); + _mouse->controlPanel(false); _subjectBarShown = false; } diff --git a/sword1/mouse.cpp b/sword1/mouse.cpp index 920c3f74cc..083899ad1f 100644 --- a/sword1/mouse.cpp +++ b/sword1/mouse.cpp @@ -57,10 +57,11 @@ SwordMouse::SwordMouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan) { void SwordMouse::initialize(void) { _numObjs = 0; - _menuStatus = _mouseStatus = 0; // mouse off and unlocked + _mouseStatus = 0; // mouse off and unlocked _getOff = 0; _specialPtrId = 0; _inTopMenu = false; + _mouseOverride = false; for (uint8 cnt = 0; cnt < 17; cnt++) _pointers[cnt] = (MousePtr*)_resMan->mouseResOpen(MSE_POINTER + cnt); @@ -68,17 +69,15 @@ void SwordMouse::initialize(void) { void SwordMouse::controlPanel(bool on) { // true on entering cpanel, false when leaving static uint32 savedPtrId = 0, savedSpecialId = 0; - static uint8 savedMouseStatus; if (on) { savedPtrId = _currentPtrId; savedSpecialId = _specialPtrId; - savedMouseStatus = _mouseStatus; - _mouseStatus = 1; + _mouseOverride = true; setPointer(MSE_POINTER, 0); } else { _currentPtrId = savedPtrId; - _mouseStatus = savedMouseStatus; _specialPtrId = savedSpecialId; + _mouseOverride = false; if (_specialPtrId) setPointer(_specialPtrId, 0); else @@ -91,10 +90,6 @@ void SwordMouse::useLogicAndMenu(SwordLogic *pLogic, SwordMenu *pMenu) { _menu = pMenu; } -void SwordMouse::setMenuStatus(uint8 status) { - _menuStatus = status; -} - void SwordMouse::addToList(int id, BsObject *compact) { _objList[_numObjs].id = id; _objList[_numObjs].compact = compact; @@ -209,7 +204,7 @@ void SwordMouse::setPointer(uint32 resId, uint32 rate) { } _frame = 0; - if ((resId == 0) || (!(_mouseStatus & 1))) { + if ((resId == 0) || (!(_mouseStatus & 1) && (!_mouseOverride))) { _system->set_mouse_cursor(NULL, 0, 0, 0, 0); _system->show_mouse(false); } else { @@ -227,7 +222,7 @@ void SwordMouse::setPointer(uint32 resId, uint32 rate) { void SwordMouse::animate(void) { MousePtr *currentPtr; - if ((_mouseStatus == 1) || _menuStatus) { + if ((_mouseStatus == 1) || _mouseOverride) { if (_specialPtrId) currentPtr = _specialPtr; else diff --git a/sword1/mouse.h b/sword1/mouse.h index e056aa18e4..76a16dbadd 100644 --- a/sword1/mouse.h +++ b/sword1/mouse.h @@ -83,7 +83,6 @@ public: void fnNormalMouse(void); void fnLockMouse(void); void fnUnlockMouse(void); - void setMenuStatus(uint8 status); void controlPanel(bool on); private: MousePtr *_pointers[17]; @@ -100,10 +99,9 @@ private: uint16 _numObjs; uint16 _lastState, _state; uint32 _getOff; - uint8 _menuStatus; uint32 _specialPtrId; // for special mouse cursors which aren't in the _pointers[] array. MousePtr *_specialPtr; - bool _inTopMenu; + bool _inTopMenu, _mouseOverride; }; #endif //BSMOUSE_H |