void Scene1105::update() { Scene::update(); if (_countdown != 0 && (--_countdown == 0)) createObjects(); if (_isClosePanelDone && !isSoundPlaying(1)) leaveScene(_leaveResult); if (_doMoveTeddy && !isSoundPlaying(2)) { sendMessage(_asTeddyBear, 0x2002, 0); _doMoveTeddy = false; } }
void SsScene2504Button::update() { updatePosition(); if (_isSoundPlaying && !isSoundPlaying(0) && !isSoundPlaying(1)) { playSound(3); setVisible(false); _isSoundPlaying = false; } if (_countdown != 0 && (--_countdown) == 0) { if (getSubVar(VA_LOCKS_DISABLED, 0x01180951)) playSound(0); else playSound(1); _isSoundPlaying = true; } }
void SsScene3009FireCannonButton::update() { updatePosition(); if (_isClicked && !isSoundPlaying(0)) { sendMessage(_parentScene, 0x2000, 0); setVisible(false); } }
bool MinigameBbAnt::updateStatus3(int mouseX, int mouseY, uint mouseButtons) { if (!isSoundPlaying(9) && _fromMainGame) { _vm->_system->delayMillis(1000); _gameDone = true; } return true; }
void Scene1202::update() { Scene::update(); if (_isPuzzleSolved) { if (!isSoundPlaying(3)) leaveScene(0); } else if (_counter == 0 && isSolved()) { _clickedIndex = 0; SetMessageHandler(&Scene1202::hmSolved); setGlobalVar(V_TNT_DUMMY_BUILT, 1); _palette->copyToBasePalette(_paletteData); _palette->startFadeToPalette(24); playSound(3); _isPuzzleSolved = true; } else if (_clickedIndex >= 0 && _counter == 0) { // Swap TNT positions int destIndex = kScene1202Table[_clickedIndex]; sendMessage(_asTntItems[_clickedIndex], 0x2001, getSubVar(VA_TNT_POSITIONS, destIndex)); sendMessage(_asTntItems[destIndex], 0x2001, getSubVar(VA_TNT_POSITIONS, _clickedIndex)); int temp = getSubVar(VA_TNT_POSITIONS, destIndex); setSubVar(VA_TNT_POSITIONS, destIndex, getSubVar(VA_TNT_POSITIONS, _clickedIndex)); setSubVar(VA_TNT_POSITIONS, _clickedIndex, temp); _counter = 2; _clickedIndex = -1; playSound(_soundToggle ? 1 : 2); _soundToggle = !_soundToggle; } }
void SpeechManager::update() { vector<map<unsigned int, int>::iterator> removeIndices; for(map<unsigned int, int>::iterator iter = SpeechManager::speeches.begin(); iter != SpeechManager::speeches.end(); iter++) { if(!isSoundPlaying(iter->second)) { removeIndices.push_back(iter); } } for(int i = 0; i < removeIndices.size(); i++) { SpeechManager::speeches.erase(removeIndices[i]); } }
void Scene1609::update() { if (!_isSolved && _countdown1 != 0 && (--_countdown1 == 0)) { if (_changeCurrentSymbol) { _currentSymbolIndex++; if (_currentSymbolIndex >= 12) _currentSymbolIndex = 0; _asSymbols[_symbolPosition]->change(_currentSymbolIndex + 12, _currentSymbolIndex == (int)getSubVar(VA_CODE_SYMBOLS, _noisySymbolIndex)); _changeCurrentSymbol = false; _countdown1 = 36; } else { _asSymbols[_symbolPosition]->hide(); _changeCurrentSymbol = true; _countdown1 = 12; } } if (_isSolved && !isSoundPlaying(0)) leaveScene(1); Scene::update(); }
void Scene1501::update() { Scene::update(); if (_countdown1 != 0) { _countdown1--; if (_countdown1 == 0) { _vm->_screen->clear(); leaveScene(0); } } else if ((_countdown2 != 0 && (--_countdown2 == 0)) || (_countdown2 == 0 && !isSoundPlaying(0))) { _countdown1 = 12; _palette->startFadeToBlack(11); } if (_countdown3 != 0) _countdown3--; if (_countdown3 == 0 && _skip && _countdown1 == 0) { _countdown1 = 12; _palette->startFadeToBlack(11); } }
bool Minigame::isAnySoundPlaying(const uint *indices, uint count) { for (uint i = 0; i < count; ++i) if (isSoundPlaying(indices[i])) return true; return false; }
void MinigameBbAnt::updateObjs(uint mouseButtons) { for (int i = 12; i < kMaxObjectsCount; ++i) { Obj *obj = &_objects[i]; if (obj->kind) { if ((mouseButtons & kLeftButtonClicked) && isMagGlassAtBug(i)) obj->damageCtr += 100; if (obj->status == 1) { int candyObjIndex; if (isBugAtCandy(i, candyObjIndex)) { obj->status = 3; obj->otherObjIndex = candyObjIndex; _objects[candyObjIndex].otherObjIndex = i; _objects[candyObjIndex].status = 10; _objects[candyObjIndex].priority = 620; _objects[candyObjIndex].status = 11; _objects[candyObjIndex].anim = getObjInit(candyObjIndex - 3)->anim3; updateBugObjAnim(i); if (_vm->getRandom(3) == 1 && !isAnySoundPlaying(kSoundTbl4, 10)) playSound(kSoundTbl1[_vm->getRandom(4)]); } } if (testObj5(i)) { updateObjAnim2(i); } if (obj->damageCtr) { --obj->damageCtr; if (!isSoundPlaying(13)) playSound(13); } switch (obj->kind) { case 1: updateBugObj1(i); break; case 2: updateObjKind2(i); break; case 3: updateObjKind3(i); break; case 4: updateObjKind4(i); break; case 5: updateObjKind5(i); break; case 7: updateSmokeObj(i); break; case 9: updateStompObj(i); break; } } } }