From 59654b17191b99c23486f6a41076b9ed05a1c38f Mon Sep 17 00:00:00 2001 From: Robert Göffringmann Date: Sat, 20 Dec 2003 09:12:54 +0000 Subject: added SwordControl (the control panel). Not yet finished. svn-id: r11775 --- sword1/mouse.cpp | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'sword1/mouse.cpp') diff --git a/sword1/mouse.cpp b/sword1/mouse.cpp index 585fba3bc2..920c3f74cc 100644 --- a/sword1/mouse.cpp +++ b/sword1/mouse.cpp @@ -35,14 +35,6 @@ SwordMouse::SwordMouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan) { _resMan = pResMan; _objMan = pObjMan; _system = system; - _numObjs = 0; - _menuStatus = _mouseStatus = 0; // mouse off and unlocked - _getOff = 0; - _specialPtrId = 0; - _inTopMenu = false; - - for (uint8 cnt = 0; cnt < 17; cnt++) - _pointers[cnt] = (MousePtr*)_resMan->mouseResOpen(MSE_POINTER + cnt); /*_resMan->resOpen(MSE_POINTER); // normal mouse (1 frame anim) _resMan->resOpen(MSE_OPERATE); _resMan->resOpen(MSE_PICKUP); @@ -63,6 +55,37 @@ SwordMouse::SwordMouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan) { // luggage & chess stuff is opened dynamically } +void SwordMouse::initialize(void) { + _numObjs = 0; + _menuStatus = _mouseStatus = 0; // mouse off and unlocked + _getOff = 0; + _specialPtrId = 0; + _inTopMenu = false; + + for (uint8 cnt = 0; cnt < 17; cnt++) + _pointers[cnt] = (MousePtr*)_resMan->mouseResOpen(MSE_POINTER + cnt); +} + +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; + setPointer(MSE_POINTER, 0); + } else { + _currentPtrId = savedPtrId; + _mouseStatus = savedMouseStatus; + _specialPtrId = savedSpecialId; + if (_specialPtrId) + setPointer(_specialPtrId, 0); + else + setPointer(_currentPtrId + MSE_POINTER, 0); + } +} + void SwordMouse::useLogicAndMenu(SwordLogic *pLogic, SwordMenu *pMenu) { _logic = pLogic; _menu = pMenu; @@ -186,7 +209,7 @@ void SwordMouse::setPointer(uint32 resId, uint32 rate) { } _frame = 0; - if (resId == 0) { + if ((resId == 0) || (!(_mouseStatus & 1))) { _system->set_mouse_cursor(NULL, 0, 0, 0, 0); _system->show_mouse(false); } else { -- cgit v1.2.3