diff options
author | Strangerke | 2013-02-15 08:33:42 +0100 |
---|---|---|
committer | Strangerke | 2013-02-15 08:33:42 +0100 |
commit | 93dc7c8e63f138a3d3bac4474cd3065b053ed22a (patch) | |
tree | d309a2aacbce02dbd9f30373c2fc01166b044c19 | |
parent | 0a1cc63abb4e4a43bc8b865fb50c753e7a6669af (diff) | |
download | scummvm-rg350-93dc7c8e63f138a3d3bac4474cd3065b053ed22a.tar.gz scummvm-rg350-93dc7c8e63f138a3d3bac4474cd3065b053ed22a.tar.bz2 scummvm-rg350-93dc7c8e63f138a3d3bac4474cd3065b053ed22a.zip |
HOPKINS: Move mouse data initialization to EventsManager, set mouse variable as private
-rw-r--r-- | engines/hopkins/dialogs.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/events.cpp | 33 | ||||
-rw-r--r-- | engines/hopkins/events.h | 6 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 31 |
4 files changed, 40 insertions, 34 deletions
diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index e13e820bb8..fe5f8cc2a5 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -43,12 +43,12 @@ DialogsManager::DialogsManager() { _inventWidth = _inventHeight = 0; _inventWin1 = g_PTRNUL; _inventBuf2 = g_PTRNUL; - _inventoryIcons = NULL; + _inventoryIcons = g_PTRNUL; } DialogsManager::~DialogsManager() { _vm->_globals.freeMemory(_inventWin1); - free(_inventoryIcons); + _vm->_globals.freeMemory(_inventoryIcons); } void DialogsManager::setParent(HopkinsEngine *vm) { diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index c55d0c5395..769696e2a0 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -64,6 +64,39 @@ void EventsManager::setParent(HopkinsEngine *vm) { _vm = vm; } +void EventsManager::initMouseData() { + if (_vm->getPlatform() == Common::kPlatformLinux) + _mouseLinuxFl = true; + else + _mouseLinuxFl = false; + + if (_mouseLinuxFl) { + _mouseSizeX = 52; + _mouseSizeY = 32; + } else { + _mouseSizeX = 34; + _mouseSizeY = 20; + } + + switch (_vm->_globals._language) { + case LANG_EN: + if (!_mouseLinuxFl) + _mouseCursor = _vm->_fileManager.loadFile("SOUAN.SPR"); + else + _mouseCursor = _vm->_fileManager.loadFile("LSOUAN.SPR"); + break; + case LANG_FR: + if (!_mouseLinuxFl) + _mouseCursor = _vm->_fileManager.loadFile("SOUFR.SPR"); + else + _mouseCursor = _vm->_fileManager.loadFile("LSOUFR.SPR"); + break; + case LANG_SP: + _mouseCursor = _vm->_fileManager.loadFile("SOUES.SPR"); + break; + } +} + // Mouse On void EventsManager::setMouseOn() { _mouseFl = true; diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 03f8593091..d4759dfe1b 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -42,6 +42,8 @@ private: uint32 _priorCounterTime; uint32 _priorFrameTime; bool _keyState[256]; + bool _mouseLinuxFl; + int _mouseSizeX, _mouseSizeY; HopkinsEngine *_vm; @@ -56,7 +58,6 @@ public: uint32 _gameCounter; bool _escKeyFl; bool _mouseFl; - bool _mouseLinuxFl; bool _breakoutFl; Common::Point _startPos; Common::Point _mousePos; @@ -65,13 +66,14 @@ public: int _curMouseButton; int _mouseButton; int _mouseCursorId; - int _mouseSizeX, _mouseSizeY; byte *_objectBuf; byte *_mouseCursor; EventsManager(); ~EventsManager(); void setParent(HopkinsEngine *vm); + void initMouseData(); + void delay(int totalMilli); void changeMouseCursor(int id); void refreshEvents(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2b7c026111..a8695dbe70 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1557,36 +1557,7 @@ void HopkinsEngine::initializeSystem() { SearchMan.addSubDirectoryMatching(gameDataDir, "VOICE"); SearchMan.addSubDirectoryMatching(gameDataDir, "TSVGA"); - if (getPlatform() == Common::kPlatformLinux) - _eventsManager._mouseLinuxFl = true; - else - _eventsManager._mouseLinuxFl = false; - - if (_eventsManager._mouseLinuxFl) { - _eventsManager._mouseSizeX = 52; - _eventsManager._mouseSizeY = 32; - } else { - _eventsManager._mouseSizeX = 34; - _eventsManager._mouseSizeY = 20; - } - - switch (_globals._language) { - case LANG_EN: - if (!_eventsManager._mouseLinuxFl) - _eventsManager._mouseCursor = _fileManager.loadFile("SOUAN.SPR"); - else - _eventsManager._mouseCursor = _fileManager.loadFile("LSOUAN.SPR"); - break; - case LANG_FR: - if (!_eventsManager._mouseLinuxFl) - _eventsManager._mouseCursor = _fileManager.loadFile("SOUFR.SPR"); - else - _eventsManager._mouseCursor = _fileManager.loadFile("LSOUFR.SPR"); - break; - case LANG_SP: - _eventsManager._mouseCursor = _fileManager.loadFile("SOUES.SPR"); - break; - } + _eventsManager.initMouseData(); _globals.clearAll(); |