diff options
author | Filippos Karapetis | 2010-06-09 07:59:42 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-06-09 07:59:42 +0000 |
commit | 5cb311ee2c352372e8eb494933e2bc36ffd5c4f5 (patch) | |
tree | 541c69484c5cba4add34c2aec638f8897e18d560 /engines/sci | |
parent | 10aeb33a4253b5df05f19a9bfabc3cc374db096c (diff) | |
download | scummvm-rg350-5cb311ee2c352372e8eb494933e2bc36ffd5c4f5.tar.gz scummvm-rg350-5cb311ee2c352372e8eb494933e2bc36ffd5c4f5.tar.bz2 scummvm-rg350-5cb311ee2c352372e8eb494933e2bc36ffd5c4f5.zip |
Renamed the SciEvent class to EventManager, to separate it from the sciEvent structure, and removed it from the engine state
svn-id: r49534
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kevent.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/state.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 4 | ||||
-rw-r--r-- | engines/sci/event.cpp | 14 | ||||
-rw-r--r-- | engines/sci/event.h | 6 | ||||
-rw-r--r-- | engines/sci/graphics/cursor.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/cursor.h | 4 | ||||
-rw-r--r-- | engines/sci/graphics/gui32.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/gui32.h | 2 | ||||
-rw-r--r-- | engines/sci/graphics/menu.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/menu.h | 4 | ||||
-rw-r--r-- | engines/sci/graphics/portrait.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/portrait.h | 4 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 6 | ||||
-rw-r--r-- | engines/sci/sci.h | 3 |
15 files changed, 31 insertions, 32 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index 4b4d605c68..d6cb4ebd8e 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -67,7 +67,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { oldx = mousePos.x; oldy = mousePos.y; - curEvent = s->_event->get(mask); + curEvent = g_sci->getEventManager()->get(mask); if (g_sci->getVocabulary()) g_sci->getVocabulary()->parser_event = NULL_REG; // Invalidate parser event diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 2410b2666d..e94be73077 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -119,14 +119,12 @@ void EngineState::reset(bool isRestoring) { } void EngineState::wait(int16 ticks) { - uint32 time; - - time = g_system->getMillis(); + uint32 time = g_system->getMillis(); r_acc = make_reg(0, ((long)time - (long)last_wait_time) * 60 / 1000); last_wait_time = time; ticks *= g_debug_sleeptime_factor; - _event->sleep(ticks * 1000 / 60); + g_sci->getEventManager()->sleep(ticks * 1000 / 60); } uint16 EngineState::currentRoomNumber() const { diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 3fcefd80c4..ae81e9393d 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -48,7 +48,7 @@ namespace Common { namespace Sci { -class SciEvent; +class EventManager; class MessageState; class SoundCommandParser; @@ -112,8 +112,6 @@ public: /* Non-VM information */ - SciEvent *_event; // Event handling - #ifdef USE_OLD_MUSIC_FUNCTIONS SfxState _sound; /**< sound subsystem */ int sfx_init_flags; /**< flags the sfx subsystem was initialised with */ diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp index c3be22b143..cdddb26ca4 100644 --- a/engines/sci/event.cpp +++ b/engines/sci/event.cpp @@ -36,12 +36,12 @@ namespace Sci { #define SCANCODE_ROWS_NR 3 -SciEvent::SciEvent(ResourceManager *resMan) { +EventManager::EventManager(ResourceManager *resMan) { // Check, if font of current game includes extended chars _fontIsExtended = resMan->detectFontExtended(); } -SciEvent::~SciEvent() { +EventManager::~EventManager() { } struct scancode_row { @@ -53,7 +53,7 @@ struct scancode_row { {0x2c, "ZXCVBNM,./"} }; -int SciEvent::altify (int ch) { +int EventManager::altify (int ch) { // Calculates a PC keyboard scancode from a character */ int row; int c = toupper((char)ch); @@ -74,7 +74,7 @@ int SciEvent::altify (int ch) { return ch; } -int SciEvent::numlockify (int c) { +int EventManager::numlockify (int c) { switch (c) { case SCI_KEY_DELETE: return '.'; @@ -114,7 +114,7 @@ static const byte codepagemap_88591toDOS[0x80] = { '?', 0xa4, 0x95, 0xa2, 0x93, '?', 0x94, '?', '?', 0x97, 0xa3, 0x96, 0x81, '?', '?', 0x98 // 0xFx }; -sciEvent SciEvent::getFromScummVM() { +sciEvent EventManager::getFromScummVM() { static int _modifierStates = 0; // FIXME: Avoid non-const global vars sciEvent input = { SCI_EVENT_NONE, 0, 0, 0 }; @@ -315,7 +315,7 @@ sciEvent SciEvent::getFromScummVM() { return input; } -sciEvent SciEvent::get(unsigned int mask) { +sciEvent EventManager::get(unsigned int mask) { //sci_event_t error_event = { SCI_EVT_ERROR, 0, 0, 0 }; sciEvent event = { 0, 0, 0, 0 }; @@ -380,7 +380,7 @@ sciEvent SciEvent::get(unsigned int mask) { return event; } -void SciEvent::sleep(uint32 msecs) { +void EventManager::sleep(uint32 msecs) { uint32 time; const uint32 wakeup_time = g_system->getMillis() + msecs; diff --git a/engines/sci/event.h b/engines/sci/event.h index 9301b1ca09..7882e56c02 100644 --- a/engines/sci/event.h +++ b/engines/sci/event.h @@ -111,10 +111,10 @@ struct sciEvent { #define SCI_KEYMOD_NO_FOOLOCK (~(SCI_KEYMOD_SCRLOCK | SCI_KEYMOD_NUMLOCK | SCI_KEYMOD_CAPSLOCK | SCI_KEYMOD_INSERT)) #define SCI_KEYMOD_ALL 0xFF -class SciEvent { +class EventManager { public: - SciEvent(ResourceManager *resMgr); - ~SciEvent(); + EventManager(ResourceManager *resMgr); + ~EventManager(); sciEvent get(unsigned int mask); diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp index 2f8393f9ac..8cc99c787c 100644 --- a/engines/sci/graphics/cursor.cpp +++ b/engines/sci/graphics/cursor.cpp @@ -54,7 +54,7 @@ GfxCursor::~GfxCursor() { purgeCache(); } -void GfxCursor::init(GfxCoordAdjuster *coordAdjuster, SciEvent *event) { +void GfxCursor::init(GfxCoordAdjuster *coordAdjuster, EventManager *event) { _coordAdjuster = coordAdjuster; _event = event; } diff --git a/engines/sci/graphics/cursor.h b/engines/sci/graphics/cursor.h index 6d92b3cf5f..7acd14acd9 100644 --- a/engines/sci/graphics/cursor.h +++ b/engines/sci/graphics/cursor.h @@ -45,7 +45,7 @@ public: GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *screen); ~GfxCursor(); - void init(GfxCoordAdjuster *coordAdjuster, SciEvent *event); + void init(GfxCoordAdjuster *coordAdjuster, EventManager *event); void kernelShow(); void kernelHide(); @@ -74,7 +74,7 @@ private: GfxScreen *_screen; GfxPalette *_palette; GfxCoordAdjuster *_coordAdjuster; - SciEvent *_event; + EventManager *_event; int _upscaledHires; diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp index 4b72050d0b..10b2b1c4fd 100644 --- a/engines/sci/graphics/gui32.cpp +++ b/engines/sci/graphics/gui32.cpp @@ -45,7 +45,7 @@ namespace Sci { -SciGui32::SciGui32(SegManager *segMan, SciEvent *event, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor) +SciGui32::SciGui32(SegManager *segMan, EventManager *event, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor) : _screen(screen), _palette(palette), _cache(cache), _cursor(cursor) { _coordAdjuster = new GfxCoordAdjuster32(segMan); diff --git a/engines/sci/graphics/gui32.h b/engines/sci/graphics/gui32.h index 99eb03b321..2c73272566 100644 --- a/engines/sci/graphics/gui32.h +++ b/engines/sci/graphics/gui32.h @@ -41,7 +41,7 @@ class GfxPaint32; class SciGui32 { public: - SciGui32(SegManager *segMan, SciEvent *event, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor); + SciGui32(SegManager *segMan, EventManager *event, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor); ~SciGui32(); void init(); diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp index 880e1aba12..ac4f1c0653 100644 --- a/engines/sci/graphics/menu.cpp +++ b/engines/sci/graphics/menu.cpp @@ -43,7 +43,7 @@ namespace Sci { -GfxMenu::GfxMenu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, GfxCursor *cursor) +GfxMenu::GfxMenu(EventManager *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, GfxCursor *cursor) : _event(event), _segMan(segMan), _gui(gui), _ports(ports), _paint16(paint16), _text16(text16), _screen(screen), _cursor(cursor) { _menuSaveHandle = NULL_REG; diff --git a/engines/sci/graphics/menu.h b/engines/sci/graphics/menu.h index 8f23b46ff8..ec344961de 100644 --- a/engines/sci/graphics/menu.h +++ b/engines/sci/graphics/menu.h @@ -83,7 +83,7 @@ typedef Common::List<GuiMenuItemEntry *> GuiMenuItemList; */ class GfxMenu { public: - GfxMenu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, GfxCursor *cursor); + GfxMenu(EventManager *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, GfxCursor *cursor); ~GfxMenu(); void reset(); @@ -111,7 +111,7 @@ private: uint16 mouseFindMenuItemSelection(Common::Point mousePosition, uint16 menuId); GuiMenuItemEntry *interactiveGetItem(uint16 menuId, uint16 itemId, bool menuChanged); - SciEvent *_event; + EventManager *_event; SegManager *_segMan; SciGui *_gui; GfxPorts *_ports; diff --git a/engines/sci/graphics/portrait.cpp b/engines/sci/graphics/portrait.cpp index 1208f8ed65..1b4e4bde77 100644 --- a/engines/sci/graphics/portrait.cpp +++ b/engines/sci/graphics/portrait.cpp @@ -38,7 +38,7 @@ namespace Sci { -Portrait::Portrait(ResourceManager *resMan, SciEvent *event, SciGui *gui, GfxScreen *screen, GfxPalette *palette, AudioPlayer *audio, Common::String resourceName) +Portrait::Portrait(ResourceManager *resMan, EventManager *event, SciGui *gui, GfxScreen *screen, GfxPalette *palette, AudioPlayer *audio, Common::String resourceName) : _resMan(resMan), _event(event), _gui(gui), _screen(screen), _palette(palette), _audio(audio), _resourceName(resourceName) { init(); } diff --git a/engines/sci/graphics/portrait.h b/engines/sci/graphics/portrait.h index 4b22e209a3..2f23ced913 100644 --- a/engines/sci/graphics/portrait.h +++ b/engines/sci/graphics/portrait.h @@ -42,7 +42,7 @@ struct PortraitBitmap { */ class Portrait { public: - Portrait(ResourceManager *resMan, SciEvent *event, SciGui *gui, GfxScreen *screen, GfxPalette *palette, AudioPlayer *audio, Common::String resourceName); + Portrait(ResourceManager *resMan, EventManager *event, SciGui *gui, GfxScreen *screen, GfxPalette *palette, AudioPlayer *audio, Common::String resourceName); ~Portrait(); void setupAudio(uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq); @@ -56,7 +56,7 @@ private: void bitsShow(); ResourceManager *_resMan; - SciEvent *_event; + EventManager *_event; SciGui *_gui; GfxPalette *_palette; GfxScreen *_screen; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 888e72783c..b30665a59e 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -190,7 +190,7 @@ Common::Error SciEngine::run() { _gamestate = new EngineState(segMan); - _gamestate->_event = new SciEvent(_resMan); + _eventMan = new EventManager(_resMan); if (script_init_engine(_gamestate)) return Common::kUnknownError; @@ -203,7 +203,7 @@ Common::Error SciEngine::run() { _gfxPaint16 = 0; _gfxPorts = 0; _gui = 0; - _gui32 = new SciGui32(_gamestate->_segMan, _gamestate->_event, screen, palette, cache, cursor); + _gui32 = new SciGui32(_gamestate->_segMan, _eventMan, screen, palette, cache, cursor); } else { #endif _gfxPorts = new GfxPorts(segMan, screen); @@ -280,7 +280,7 @@ Common::Error SciEngine::run() { delete _gfxPalette; delete cursor; delete _gfxScreen; - delete _gamestate->_event; + delete _eventMan; delete segMan; delete _gamestate; diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 685f05e685..0902a41139 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -51,6 +51,7 @@ class Kernel; class GameFeatures; class Console; class AudioPlayer; +class EventManager; class GfxAnimate; class GfxCache; @@ -164,6 +165,7 @@ public: inline Kernel *getKernel() const { return _kernel; } inline EngineState *getEngineState() const { return _gamestate; } inline Vocabulary *getVocabulary() const { return _vocabulary; } + inline EventManager *getEventManager() const { return _eventMan; } Common::String getSavegameName(int nr) const; Common::String getSavegamePattern() const; @@ -222,6 +224,7 @@ private: EngineState *_gamestate; Kernel *_kernel; Vocabulary *_vocabulary; + EventManager *_eventMan; Console *_console; OSystem *_system; }; |