diff options
author | Strangerke | 2011-09-17 10:08:24 +0200 |
---|---|---|
committer | Strangerke | 2011-09-17 10:08:52 +0200 |
commit | f5eca796580f5e16a2389d980b8330b2ab6b0980 (patch) | |
tree | e229e9b1f87f0d5a804d3f6c95f31095ae9d240a /engines/cge | |
parent | fba3fc360221670bc9a2209f7b994273141721a5 (diff) | |
download | scummvm-rg350-f5eca796580f5e16a2389d980b8330b2ab6b0980.tar.gz scummvm-rg350-f5eca796580f5e16a2389d980b8330b2ab6b0980.tar.bz2 scummvm-rg350-f5eca796580f5e16a2389d980b8330b2ab6b0980.zip |
CGE: Move 4 global to CGEEngine
Diffstat (limited to 'engines/cge')
-rw-r--r-- | engines/cge/cge.h | 7 | ||||
-rw-r--r-- | engines/cge/cge_main.cpp | 12 | ||||
-rw-r--r-- | engines/cge/cge_main.h | 4 | ||||
-rw-r--r-- | engines/cge/events.cpp | 38 | ||||
-rw-r--r-- | engines/cge/snail.cpp | 4 | ||||
-rw-r--r-- | engines/cge/walk.cpp | 2 |
6 files changed, 33 insertions, 34 deletions
diff --git a/engines/cge/cge.h b/engines/cge/cge.h index ace5d66a22..6628535393 100644 --- a/engines/cge/cge.h +++ b/engines/cge/cge.h @@ -42,6 +42,9 @@ class Console; class Sprite; class Cluster; class Vga; +class System; +class Keyboard; +class Mouse; #define kSavegameVersion 2 #define kSavegameStrSize 11 @@ -157,6 +160,10 @@ public: Bar _barriers[kSceneMax + 1]; Font *_font; Vga *_vga; + System *_sys; + Sprite *_pocLight; + Keyboard *_keyboard; + Mouse *_mouse; Common::RandomSource _randomSource; MusicPlayer _midiPlayer; diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 2311aa527b..f8fa83621b 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -52,11 +52,7 @@ namespace CGE { uint16 _stklen = (kStackSize * 2); -System *_sys; -Sprite *_pocLight; EventManager *_eventManager; -Keyboard *_keyboard; -Mouse *_mouse; Sprite *_pocket[kPocketNX]; Sprite *_sprite; Sprite *_miniScene; @@ -784,7 +780,7 @@ void System::touch(uint16 mask, int x, int y) { } switch (x) { case 'X': - if (_keyboard->_key[kKeyAlt]) + if (_vm->_keyboard->_key[kKeyAlt]) _vm->quit(); break; case '0': @@ -792,7 +788,7 @@ void System::touch(uint16 mask, int x, int y) { case '2': case '3': case '4': - if (_keyboard->_key[kKeyAlt]) { + if (_vm->_keyboard->_key[kKeyAlt]) { _snail->addCom(kSnLevel, -1, x - '0', NULL); break; } @@ -945,7 +941,7 @@ void CGEEngine::optionTouch(int opt, uint16 mask) { #pragma argsused void Sprite::touch(uint16 mask, int x, int y) { - _sys->funTouch(); + _vm->_sys->funTouch(); if ((mask & kEventAttn) != 0) return; @@ -970,7 +966,7 @@ void Sprite::touch(uint16 mask, int x, int y) { } if ((mask & kMouseRightUp) && _snail->idle()) { - Sprite *ps = (_pocLight->_seqPtr) ? _pocket[_vm->_pocPtr] : NULL; + Sprite *ps = (_vm->_pocLight->_seqPtr) ? _pocket[_vm->_pocPtr] : NULL; if (ps) { if (_flags._kept || _hero->distance(this) < kDistMax) { if (works(ps)) { diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h index ba9d9a6cc9..32fe80107e 100644 --- a/engines/cge/cge_main.h +++ b/engines/cge/cge_main.h @@ -109,10 +109,6 @@ private: CGEEngine *_vm; }; -extern System *_sys; -extern Sprite *_pocLight; -extern Keyboard *_keyboard; -extern Mouse *_mouse; extern EventManager *_eventManager; extern Sprite *_pocket[]; extern Sprite *_sprite; diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp index 2f0a5ab170..259451de65 100644 --- a/engines/cge/events.cpp +++ b/engines/cge/events.cpp @@ -289,7 +289,7 @@ void EventManager::poll() { case Common::EVENT_KEYDOWN: case Common::EVENT_KEYUP: // Handle keyboard events - _keyboard->newKeyboard(_event); + _vm->_keyboard->newKeyboard(_event); handleEvents(); break; case Common::EVENT_MOUSEMOVE: @@ -298,7 +298,7 @@ void EventManager::poll() { case Common::EVENT_RBUTTONDOWN: case Common::EVENT_RBUTTONUP: // Handle mouse events - _mouse->newMouse(_event); + _vm->_mouse->newMouse(_event); handleEvents(); break; default: @@ -311,12 +311,12 @@ void EventManager::handleEvents() { while (_eventQueueTail != _eventQueueHead) { CGEEvent e = _eventQueue[_eventQueueTail]; if (e._mask) { - if (_mouse->_hold && e._spritePtr != _mouse->_hold) - _mouse->_hold->touch(e._mask | kEventAttn, e._x - _mouse->_hold->_x, e._y - _mouse->_hold->_y); + if (_vm->_mouse->_hold && e._spritePtr != _vm->_mouse->_hold) + _vm->_mouse->_hold->touch(e._mask | kEventAttn, e._x - _vm->_mouse->_hold->_x, e._y - _vm->_mouse->_hold->_y); // update mouse cursor position if (e._mask & kMouseRoll) - _mouse->gotoxy(e._x, e._y); + _vm->_mouse->gotoxy(e._x, e._y); // activate current touched SPRITE if (e._spritePtr) { @@ -324,25 +324,25 @@ void EventManager::handleEvents() { e._spritePtr->touch(e._mask, e._x, e._y); else e._spritePtr->touch(e._mask, e._x - e._spritePtr->_x, e._y - e._spritePtr->_y); - } else if (_sys) - _sys->touch(e._mask, e._x, e._y); + } else if (_vm->_sys) + _vm->_sys->touch(e._mask, e._x, e._y); if (e._mask & kMouseLeftDown) { - _mouse->_hold = e._spritePtr; - if (_mouse->_hold) { - _mouse->_hold->_flags._hold = true; + _vm->_mouse->_hold = e._spritePtr; + if (_vm->_mouse->_hold) { + _vm->_mouse->_hold->_flags._hold = true; - if (_mouse->_hold->_flags._drag) { - _mouse->_hx = e._x - _mouse->_hold->_x; - _mouse->_hy = e._y - _mouse->_hold->_y; + if (_vm->_mouse->_hold->_flags._drag) { + _vm->_mouse->_hx = e._x - _vm->_mouse->_hold->_x; + _vm->_mouse->_hy = e._y - _vm->_mouse->_hold->_y; } } } if (e._mask & kMouseLeftUp) { - if (_mouse->_hold) { - _mouse->_hold->_flags._hold = false; - _mouse->_hold = NULL; + if (_vm->_mouse->_hold) { + _vm->_mouse->_hold->_flags._hold = false; + _vm->_mouse->_hold = NULL; } } ///Touched = e.Ptr; @@ -353,9 +353,9 @@ void EventManager::handleEvents() { } _eventQueueTail = (_eventQueueTail + 1) % kEventMax; } - if (_mouse->_hold) { - if (_mouse->_hold->_flags._drag) - _mouse->_hold->gotoxy(_mouse->_x - _mouse->_hx, _mouse->_y - _mouse->_hy); + if (_vm->_mouse->_hold) { + if (_vm->_mouse->_hold->_flags._drag) + _vm->_mouse->_hold->gotoxy(_vm->_mouse->_x - _vm->_mouse->_hx, _vm->_mouse->_y - _vm->_mouse->_hy); } } diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index b542006014..8a7100077f 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -995,13 +995,13 @@ void Snail::runCom() { if (spr == _hero && spr->seqTest(-1)) spr->step(kSeqHTalk); _text->say(_text->getText(snc->_val), spr); - _sys->_funDel = kHeroFun0; + _vm->_sys->_funDel = kHeroFun0; } break; case kSnInf: if (_talkEnable) { _vm->inf(_text->getText(snc->_val)); - _sys->_funDel = kHeroFun0; + _vm->_sys->_funDel = kHeroFun0; } break; case kSnTime: diff --git a/engines/cge/walk.cpp b/engines/cge/walk.cpp index e8247090be..a3b819ae2b 100644 --- a/engines/cge/walk.cpp +++ b/engines/cge/walk.cpp @@ -58,7 +58,7 @@ void Walk::tick() { _here = _vm->XZ(_x + _w / 2, _y + _h); if (_dir != kDirNone) { - _sys->funTouch(); + _vm->_sys->funTouch(); for (Sprite *spr = _vm->_vga->_showQ->first(); spr; spr = spr->_next) { if (distance(spr) < 2) { if (!spr->_flags._near) { |