diff --git a/engines/petka/petka.cpp b/engines/petka/petka.cpp index 44e4fd84e88..258d3f66e48 100644 --- a/engines/petka/petka.cpp +++ b/engines/petka/petka.cpp @@ -91,7 +91,7 @@ Common::Error PetkaEngine::run() { _console.reset(new Console(this)); _fileMgr.reset(new FileMgr()); _soundMgr.reset(new SoundMgr(*this)); - _vsys.reset(new VideoSystem()); + _vsys.reset(new VideoSystem(*this)); loadPart(2); diff --git a/engines/petka/video.cpp b/engines/petka/video.cpp index 093e2b72b08..202b6db1fdf 100644 --- a/engines/petka/video.cpp +++ b/engines/petka/video.cpp @@ -36,15 +36,15 @@ namespace Petka { const uint kShakeTime = 30; const int kShakeOffset = 3; -VideoSystem::VideoSystem() : - _shake(false), _shift(false), _shakeTime(0), _time(0) { +VideoSystem::VideoSystem(PetkaEngine &vm) : + _vm(vm), _shake(false), _shift(false), _shakeTime(0), _time(0) { makeAllDirty(); _time = g_system->getMillis(); _allowAddingRects = true; } void VideoSystem::update() { - Interface *interface = g_vm->getQSystem()->_currInterface; + Interface *interface = _vm.getQSystem()->_currInterface; uint32 time = g_system->getMillis(); if (interface) { for (uint i = interface->_startIndex; i < interface->_objs.size(); ++i) { @@ -128,7 +128,7 @@ void VideoSystem::setShake(bool shake) { } void VideoSystem::sort() { - Common::Array &objs = g_vm->getQSystem()->_currInterface->_objs; + Common::Array &objs = _vm.getQSystem()->_currInterface->_objs; for (uint i = 0; i < objs.size() - 1; ++i) { uint minIndex = i; for (uint j = i + 1; j < objs.size(); ++j) { diff --git a/engines/petka/video.h b/engines/petka/video.h index f6370d10897..5e3b2afc8a5 100644 --- a/engines/petka/video.h +++ b/engines/petka/video.h @@ -29,9 +29,11 @@ namespace Petka { class FlicDecoder; +class PetkaEngine; + class VideoSystem : public Graphics::Screen { public: - VideoSystem(); + VideoSystem(PetkaEngine &vm); void updateTime(); void update() override; @@ -51,6 +53,7 @@ private: void sort(); private: + PetkaEngine &_vm; uint32 _shakeTime; uint32 _time; bool _shake;