void KyraEngine_LoK::mainLoop() { // Initialize debugger since how it should be fully usable _debugger->initialize(); _eventList.clear(); while (!shouldQuit()) { int32 frameTime = (int32)_system->getMillis(); if (_currentCharacter->sceneId == 210) { updateKyragemFading(); if (seq_playEnd() && _deathHandler != 8) break; } if (_deathHandler != -1) { snd_playWanderScoreViaMap(0, 1); snd_playSoundEffect(49); _screen->hideMouse(); _screen->setMouseCursor(1, 1, _shapes[0]); removeHandItem(); _screen->showMouse(); _gui->buttonMenuCallback(0); _deathHandler = -1; } if ((_brandonStatusBit & 2) && _brandonStatusBit0x02Flag) _animator->animRefreshNPC(0); if ((_brandonStatusBit & 0x20) && _brandonStatusBit0x20Flag) { _animator->animRefreshNPC(0); _brandonStatusBit0x20Flag = 0; } // FIXME: Why is this here? _screen->showMouse(); int inputFlag = checkInput(_buttonList, _currentCharacter->sceneId != 210); removeInputTop(); updateMousePointer(); _timer->update(); _sound->process(); updateTextFade(); if (inputFlag == 198 || inputFlag == 199) processInput(_mouseX, _mouseY); if (skipFlag()) resetSkipFlag(); delay((frameTime + _gameSpeed) - _system->getMillis(), true, true); } }
int KyraEngine_v2::o2_waitForConfirmationClick(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_waitForConfirmationClick(%p) (%d)", (const void *)script, stackPos(0)); resetSkipFlag(); uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength; while (_system->getMillis() < maxWaitTime) { int inputFlag = checkInput(0); removeInputTop(); if (inputFlag == 198 || inputFlag == 199) { _sceneScriptState.regs[1] = _mouseX; _sceneScriptState.regs[2] = _mouseY; return 0; } update(); _system->delayMillis(10); } _sceneScriptState.regs[1] = _mouseX; _sceneScriptState.regs[2] = _mouseY; return 1; }
int KyraEngine_HoF::trySceneChange(int *moveTable, int unk1, int updateChar) { bool running = true; bool unkFlag = false; int8 updateType = -1; int changedScene = 0; const int *moveTableStart = moveTable; _unk4 = 0; while (running && !shouldQuit()) { if (*moveTable >= 0 && *moveTable <= 7) { _mainCharacter.facing = getOppositeFacingDirection(*moveTable); unkFlag = true; } else { if (*moveTable == 8) { running = false; } else { ++moveTable; unkFlag = false; } } if (checkSceneChange()) { running = false; changedScene = 1; } if (unk1) { if (skipFlag()) { resetSkipFlag(false); running = false; _unk4 = 1; } } if (!unkFlag || !running) continue; int ret = 0; if (moveTable == moveTableStart || moveTable[1] == 8) ret = updateCharPos(0); else ret = updateCharPos(moveTable); if (ret) ++moveTable; ++updateType; if (!updateType) { update(); } else if (updateType == 1) { refreshAnimObjectsIfNeed(); updateType = -1; } delay(10); } if (updateChar) _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing]; updateCharacterAnim(0); refreshAnimObjectsIfNeed(); return changedScene; }