From 1952a47787d868d4091d8a26f3aad6c000625a27 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Mar 2013 15:31:59 +0100 Subject: [PATCH] HOPKINS: Add clearAll() to EventsManager --- engines/hopkins/events.cpp | 7 ++++++- engines/hopkins/events.h | 2 +- engines/hopkins/globals.cpp | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 50b2850c73a..66692da4297 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -51,7 +51,7 @@ EventsManager::EventsManager(HopkinsEngine *vm) { _gameKey = KEY_NONE; _mouseCursorId = 0; _oldIconId = 0; - _objectBuf = NULL; + _objectBuf = g_PTRNUL; Common::fill(&_keyState[0], &_keyState[256], false); _priorCounterTime = 0; @@ -63,6 +63,11 @@ EventsManager::~EventsManager() { _vm->_globals->freeMemory(_mouseCursor); } +void EventsManager::clearAll() { + _objectBuf = _vm->_globals->freeMemory(_objectBuf); + _objectBuf = _vm->_globals->allocMemory(2500); +} + void EventsManager::initMouseData() { if (_vm->getPlatform() == Common::kPlatformLinux) _mouseLinuxFl = true; diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index da07817afa7..265cf53aaea 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -71,6 +71,7 @@ public: EventsManager(HopkinsEngine *vm); ~EventsManager(); + void clearAll(); void initMouseData(); void delay(int totalMilli); @@ -85,7 +86,6 @@ public: void mouseOn(); void mouseOff(); void setMouseOn(); - void refreshScreenAndEvents(); }; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 6d48599c96d..940e18afaf2 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -238,7 +238,6 @@ void Globals::clearAll() { initVBob(); _objectDataBuf = g_PTRNUL; _curObjectFileNum = 0; - _vm->_eventsManager->_objectBuf = g_PTRNUL; _vm->_dialogsManager->clearAll(); _answerBuffer = g_PTRNUL; SPRITE_ECRAN = g_PTRNUL; @@ -253,7 +252,7 @@ void Globals::clearAll() { _boxWidth = 240; - _vm->_eventsManager->_objectBuf = allocMemory(2500); + _vm->_eventsManager->clearAll(); _objectDataBuf = g_PTRNUL; }