Common::Error QueenEngine::run() { initGraphics(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT, false); _resource = new Resource(); _bam = new BamScene(this); _bankMan = new BankManager(_resource); _command = new Command(this); _debugger = new Debugger(this); _display = new Display(this, _system); _graphics = new Graphics(this); _grid = new Grid(this); _input = new Input(_resource->getLanguage(), _system, this); if (_resource->isDemo()) { _logic = new LogicDemo(this); } else if (_resource->isInterview()) { _logic = new LogicInterview(this); } else { _logic = new LogicGame(this); } _sound = Sound::makeSoundInstance(_mixer, this, _resource->getCompression()); _walk = new Walk(this); //_talkspeedScale = (MAX_TEXT_SPEED - MIN_TEXT_SPEED) / 255.0; registerDefaultSettings(); // Setup mixer syncSoundSettings(); _logic->start(); if (ConfMan.hasKey("save_slot") && canLoadOrSave()) { loadGameState(ConfMan.getInt("save_slot")); } _lastSaveTime = _lastUpdateTime = _system->getMillis(); while (!shouldQuit()) { if (_logic->newRoom() > 0) { _logic->update(); _logic->oldRoom(_logic->currentRoom()); _logic->currentRoom(_logic->newRoom()); _logic->changeRoom(); _display->fullscreen(false); if (_logic->currentRoom() == _logic->newRoom()) { _logic->newRoom(0); } } else if (_logic->joeWalk() == JWM_EXECUTE) { _logic->joeWalk(JWM_NORMAL); _command->executeCurrentAction(); } else { _logic->joeWalk(JWM_NORMAL); update(true); } } return Common::kNoError; }
void QueenEngine::update(bool checkPlayerInput) { _debugger->onFrame(); _graphics->update(_logic->currentRoom()); _logic->update(); int frameDelay = (_lastUpdateTime + Input::DELAY_NORMAL - _system->getMillis()); if (frameDelay <= 0) { frameDelay = 1; } _input->delay(frameDelay); _lastUpdateTime = _system->getMillis(); if (!_resource->isInterview()) { _display->palCustomScroll(_logic->currentRoom()); } BobSlot *joe = _graphics->bob(0); _display->update(joe->active, joe->x, joe->y); _input->checkKeys(); if (_input->debugger()) { _input->debuggerReset(); _debugger->attach(); } if (canLoadOrSave()) { if (_input->quickSave()) { _input->quickSaveReset(); saveGameState(SLOT_QUICKSAVE, "Quicksave"); } if (_input->quickLoad()) { _input->quickLoadReset(); loadGameState(SLOT_QUICKSAVE); } if (shouldPerformAutoSave(_lastSaveTime)) { saveGameState(SLOT_AUTOSAVE, "Autosave"); _lastSaveTime = _system->getMillis(); } } if (!_input->cutawayRunning()) { if (checkPlayerInput) { _command->updatePlayer(); } if (_input->idleTime() >= Input::DELAY_SCREEN_BLANKER) { _display->blankScreen(); } } _sound->updateMusic(); }
bool QueenEngine::canSaveGameStateCurrently() { return canLoadOrSave(); }