PETKA: added engine field to VideoSystem

This commit is contained in:
Andrei Prykhodko 2020-06-05 21:01:15 +03:00
parent b4b46779d4
commit bfeb6cda0b
3 changed files with 9 additions and 6 deletions

View File

@ -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);

View File

@ -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<QVisibleObject *> &objs = g_vm->getQSystem()->_currInterface->_objs;
Common::Array<QVisibleObject *> &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) {

View File

@ -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;