int sys_audiopause(void) { cprintf("sys_audiopause\n"); pauseSound(); return 0; }
void slideShowEngine::pause() { m_currentState=Paused; pauseSound(); //storeTimerAnimation=m_timerAnimation.elapsed(); //storeTotalTime=m_totalTime.elapsed(); //m_groupAnimation->pause(); }
void SoundManager::pause(bool p) { if (backgroundNoise.length() > 0) { if (p) { pauseSound(backgroundNoise); } else { playSound(backgroundNoise); } } }
void initState(int state) { if (state == STARTSCREEN) { loadPalette(startScreenPal); DMANow(3, startScreenTiles, &CHARBLOCKBASE[0], startScreenTilesLen); DMANow(3, startScreenMap, &SCREENBLOCKBASE[27], startScreenMapLen); DMANow(3, startScreenTiles, &CHARBLOCKBASE[1], startScreenTilesLen); DMANow(3, startScreenMap, &SCREENBLOCKBASE[25], startScreenMapLen); selector = 0; selectRow = 100; selectCol = 56; } else if (state == PAUSESCREEN) { loadPalette(startScreenPal); DMANow(3, pauseScreenTiles, &CHARBLOCKBASE[0], pauseScreenTilesLen); DMANow(3, pauseScreenMap, &SCREENBLOCKBASE[27], pauseScreenMapLen); DMANow(3, pauseScreenTiles, &CHARBLOCKBASE[1], pauseScreenTilesLen); DMANow(3, pauseScreenMap, &SCREENBLOCKBASE[25], pauseScreenMapLen); } else if (state == INSTRUCTIONSCREEN) { DMANow(3, instructionScreenTiles, &CHARBLOCKBASE[0], instructionScreenTilesLen); DMANow(3, instructionScreenMap, &SCREENBLOCKBASE[27], instructionScreenMapLen); DMANow(3, instructionScreenTiles, &CHARBLOCKBASE[1], instructionScreenTilesLen); DMANow(3, instructionScreenMap, &SCREENBLOCKBASE[25], instructionScreenMapLen); } else if (state == WINSCREEN) { loadPalette(startScreenPal); DMANow(3, winScreenTiles, &CHARBLOCKBASE[0], winScreenTilesLen); DMANow(3, winScreenMap, &SCREENBLOCKBASE[27], winScreenMapLen); DMANow(3, winScreenTiles, &CHARBLOCKBASE[1], winScreenTilesLen); DMANow(3, winScreenMap, &SCREENBLOCKBASE[25], winScreenMapLen); } else if (state == LOSESCREEN) { loadPalette(startScreenPal); DMANow(3, loseScreenTiles, &CHARBLOCKBASE[0], loseScreenTilesLen); DMANow(3, loseScreenMap, &SCREENBLOCKBASE[27], loseScreenMapLen); DMANow(3, loseScreenTiles, &CHARBLOCKBASE[1], loseScreenTilesLen); DMANow(3, loseScreenMap, &SCREENBLOCKBASE[25], loseScreenMapLen); } hideSprites(); clearShadowOAM(); if (state == PAUSESCREEN) { pauseSound(); } else { stopSound(); } REG_BG0HOFS = 0; REG_BG0VOFS = 0; REG_BG1HOFS = 0; }
void SoundCTRL::setView(Ui_meta *view) { this->view = view; connect(view, SIGNAL(playSound()), this, SLOT(playOrPauseCTRL())); connect(view, SIGNAL(pauseSound()), this, SLOT(playOrPauseCTRL())); connect(this, SIGNAL(soundPlayed()), this->view, SLOT(playOrPause())); connect(this, SIGNAL(soundPlayed()), this->view, SLOT(resetMarkLabels())); connect(this, SIGNAL(soundPlayed()), this->view, SLOT(resetClockAndSlider())); connect(this, SIGNAL(changeAllMarks()), this->view, SLOT(changeMarksLabels())); connect(view, SIGNAL(nextMark(uint32_t, Format*)), this, SLOT(forward(uint32_t, Format*))); connect(view, SIGNAL(prevMark(uint32_t, Format*)), this, SLOT(rewind(uint32_t, Format*))); connect(view, SIGNAL(forwardTime(Format *)), this, SLOT(fastForward(Format *))); connect(view, SIGNAL(rewindTime(Format *)), this, SLOT(fastRewind(Format *))); connect(this, SIGNAL(clock(int)), this->view, SLOT(updateClock(int))); connect(view, SIGNAL(update_m_position(uint32_t, Format*)), this, SLOT(set_m_position(uint32_t, Format*))); }
void game() { // Reset running motion in case user stops pressing arrow key player.isRunning = 0; // Running/moving speed if (player.frameCount % 4 == 0) { changeFrame(); } // Button Handling if (BUTTON_PRESSED(BUTTON_A)) { // Only jump if player is not already jumping if (canJump && checkCollision()) { canJump = 0; player.isJumping = 1; jumpFrameCounter = 30; playSoundB(jumpSound, JUMPSOUNDLEN, JUMPSOUNDFREQ, 0); jump(); } } if (BUTTON_PRESSED(BUTTON_B)) { vBlankCount = 100; prevSeason = season; playSoundB(warpSound, WARPSOUNDLEN, WARPSOUNDFREQ, 0); state = SEASONCHANGE; } if (BUTTON_PRESSED(BUTTON_START)) { REG_DISPCTL ^= BG0_ENABLE; pauseSound(); state = PAUSE; } // Change to neutral season - CHEAT MODE if (BUTTON_HELD(BUTTON_R) && BUTTON_HELD(BUTTON_L) && BUTTON_HELD(BUTTON_SELECT)) { vBlankCount = 100; prevSeason = -1; playSoundB(warpSound, WARPSOUNDLEN, WARPSOUNDFREQ, 0); state = SEASONCHANGE; } if (BUTTON_HELD(BUTTON_RIGHT)) { player.isRunning = 1; player.facing = 0; player.deltaCol = 1; if (hOff < 272 && player.col >= 120 - player.height / 2) { hOff += player.deltaCol; } else if (player.col < 240 - player.width) { player.col += player.deltaCol; } } if (BUTTON_HELD(BUTTON_LEFT)) { player.isRunning = 1; player.facing = 1; player.deltaCol = -1; if (hOff > 0 && player.col < 120 - player.width / 2) { hOff += player.deltaCol; } else if (player.col > 0) { player.col += player.deltaCol; } } // End of button handling // Jump handling if (player.isJumping) { jump(); } /* if (!canJump && hOff < 272) { player.col += player.deltaCol; } */ // Gravity and Collision if (!checkCollision() || player.isJumping) { player.isRunning = 0; // Stop running animation /*if (vOff <= 96 && player.row >= 80 - player.height / 2) { */ vOff += player.deltaRow; //} if (player.row < 160) { player.row += player.deltaRow; } else { state = LOSE; } } else { canJump = 1; player.deltaCol = 0; } // Gem collision detection - player wins current level if (checkWinCollision()) { playSoundB(winLevelSound, WINLEVELSOUNDLEN, WINLEVELSOUNDFREQ, 0); state = WINLEVEL; } // Standing still animation if (!player.isRunning) { player.currentFrame = 0; } // Running animation if (player.isRunning) { player.frameCount++; } // Seasonal BG1 Animations switch (season) { case FALL: bg1VOff--; break; case WINTER: bg1HOff--; bg1VOff--; break; } }
void Widget::onClickButton(int buttonId) { // ----------------------------------------------------------------- Main ----------------------------------------------------------------- if(screensaverEnd()) { // Set oldScene if(scene != sceneMap["mainQExit"] && scene != sceneMap["options"] && scene != sceneMap["shop"]) oldScene = scene; if(scene == sceneMap["main"]) // ----------------------------- Main ----------------------------- { if(buttonId == mainButtonPlay.id) // Button Play { scene = sceneMap["gameOptions"]; // Set Duration (Sword Speed) playerAnimation.setDuration(swords[usedSwordId].speed()); // Set text gameOptionsText = "Game Options"; // Sounds playSound(gameSoundStartBattle); pauseSound(mainSoundtrack); startGameOptionsAnimations(); } else if(buttonId == mainButtonExit.id) // Button Exit { scene = sceneMap["mainQExit"]; // Start Animations startQExitAnimations(); } else if(buttonId == mainButtonShop.id) // Button shop { scene = sceneMap["shop"]; // Set selectSwordId selectSwordId = usedSwordId; // Start Animations startShopAnimations(); shopButtonUse.visible = true; } else if(buttonId == mainButtonOptions.id) // Button options { scene = sceneMap["options"]; // Start Animations startOptionsAnimations(); } } else if(scene == sceneMap["options"]) // ----------------------------- Options ----------------------------- { if(buttonId == optionsButtonBack.id) // Button Options Back { if(oldScene == sceneMap["main"]) { // Start Animations startMainAnimations(false); } else if(oldScene == sceneMap["gamePause"]) { // Start Animations startPauseAnimations(); } scene = oldScene; } else if(buttonId == optionsButtonSite.id) // Button Options Back { QDesktopServices::openUrl(QUrl("http://coolone.ru/category/projects/")); } else if(buttonId == optionsButtonCheckUpdates.id) // Button Options Back { QDesktopServices::openUrl(QUrl("http://coolone.ru/category/projects/games/sword-battle/")); } } else if(scene == sceneMap["shop"]) // ----------------------------- Shop ----------------------------- { if(buttonId == shopButtonUpgrade.id) // Button Update { // Buy Upgrade / Price int price = swords[selectSwordId].price(); if(coins >= price) { // Buy / Upgrade if(swords[selectSwordId].levelSword>0) playSound(shopSoundUpgrade); else playSound(shopSoundBuy); coins -= price; swords[selectSwordId].levelSword++; usedSwordId = selectSwordId; } shopButtonUse.visible = true; } else if(buttonId == shopButtonBack.id) // Button Back { scene = sceneMap["main"]; // Start Animations bool iconsAniamtions = false; if(usedSwordId != selectSwordId) iconsAniamtions = true; startMainAnimations(iconsAniamtions); } else if(buttonId == shopButtonUse.id) // Button Use { if(swords[selectSwordId].levelSword>0) { usedSwordId = selectSwordId; playSound(shopSoundUse); } } else if(buttonId == shopButtonLeft.id) // Button Left { if(selectSwordId<=0) { selectSwordId = numberSwords-1; } else { selectSwordId--; } if(swords[selectSwordId].levelSword > 0) { shopButtonUse.visible = true; } else { shopButtonUse.visible = false; } } else if(buttonId == shopButtonRight.id) // Button Right { if(selectSwordId+1>numberSwords-1) { selectSwordId = 0; } else { selectSwordId++; } if(swords[selectSwordId].levelSword > 0) { shopButtonUse.visible = true; } else { shopButtonUse.visible = false; } } } else if(scene == sceneMap["mainQExit"]) // ----------------------------- QExit ----------------------------- { if(buttonId == qExitButtonNo.id) // Button QNo { if(oldScene == sceneMap["main"]) { // Start Animations startMainAnimations(false); } else if(oldScene == sceneMap["gamePause"]) { // Start Animations startPauseAnimations(); } scene = oldScene; } else if(buttonId == qExitButtonYes.id) // Button QYes { QApplication::exit(); } } // ----------------------------------------------------------------- Game ----------------------------------------------------------------- else if(scene == sceneMap["gameOptions"]) // ----------------------------- Game Options ----------------------------- { if(buttonId == gameOptionsButtonPlay.id) // Button Options Play { // Set player sword coords playerAnimation.x = moveX; playerAnimation.y = moveY; // Set sword and sounds Id int id; if(gameOptionsButtonHard.text == "Easy") { id = 0; } else if(gameOptionsButtonHard.text == "Normal") { id = 1; } else { id = 2; } gameSoundShotsId = id; usedEnemySwordId = id; // Set combo playerCombo = 0; enemyCombo = 0; // Enemy go attack enemyAttack = true; playerLeft = true; // Set full health dEnemyHealth = 100+gameOptionsButtonHard.progressValue*9; enemyHealthDAnimation.animation->stop(); enemyHealth = dEnemyHealth; enemyHealthDAnimation.value = enemyHealth; playerHealth = dPlayerHealth; playerHealthDAnimation.value = playerHealth; scene = sceneMap["game"]; // Start Animations startGameAnimations(); } else if(buttonId == gameOptionsButtonMain.id) // Button Play { scene = sceneMap["gamePause"]; onClickButton(pauseButtonMain.id); } } else if(scene == sceneMap["game"]) // ----------------------------- Game ----------------------------- { if(buttonId == gameButtonPause.id) // Button Pause { scene = sceneMap["gamePause"]; enemyAnimation.pause(); // Start Animations startPauseAnimations(); } } else if(scene == sceneMap["gamePause"]) // ----------------------------- Pause ----------------------------- { if(buttonId == pauseButtonExit.id) // Button Pause Exit { scene = sceneMap["mainQExit"]; // Start Animations startQExitAnimations(); } else if(buttonId == pauseButtonOptions.id) // Button Pause options { scene = sceneMap["options"]; // Start Animations startOptionsAnimations(); } else if(buttonId == pauseButtonMain.id) // Button Pause Main { scene = sceneMap["main"]; // Set Default game values enemyAttackSpeed = dEnemyAttackSpeed; playerScore = 0; // Play Soundtrack playSound(mainSoundtrack); // Stop Health Bars Aniamtions enemyHealthDAnimation.animation->stop(); playerHealthDAnimation.animation->stop(); // Set null opasity mask main logo sword mainSwordOpasityAnimation.setValue(minOpasitySword); mainSwordOpasityAnimation.start(); // Start Animations startMainAnimations(); } else if(buttonId == pauseButtonBack.id) // Button Pause Back { scene = sceneMap["game"]; // Start Animations enemyAnimation.start(false,false); startGameAnimations(); } } } }