Ale, el modo demo torna a no tindre sonido 😎
This commit is contained in:
@@ -199,7 +199,7 @@ void Game::updateHiScore()
|
||||
if (hi_score_achieved_ == false)
|
||||
{
|
||||
hi_score_achieved_ = true;
|
||||
Audio::get()->playSound("hi_score_achieved.wav");
|
||||
playSound("hi_score_achieved.wav");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ void Game::updateStage()
|
||||
// Cambio de fase
|
||||
Stage::power = Stage::get(Stage::number).power_to_complete - Stage::power;
|
||||
++Stage::number;
|
||||
Audio::get()->playSound("stage_change.wav");
|
||||
playSound("stage_change.wav");
|
||||
balloon_manager_->resetBalloonSpeed();
|
||||
screen_->flash(FLASH_COLOR, 3);
|
||||
screen_->shake();
|
||||
@@ -374,6 +374,7 @@ void Game::updateGameStateCompleted()
|
||||
stopMusic();
|
||||
Stage::number = 9; // Deja el valor dentro de los limites
|
||||
balloon_manager_->destroyAllBalloons(); // Destruye a todos los globos
|
||||
playSound("power_ball_explosion.wav");
|
||||
destroyAllItems(); // Destruye todos los items
|
||||
Stage::power = 0; // Vuelve a dejar el poder a cero, por lo que hubiera podido subir al destruir todos los globos
|
||||
background_->setAlpha(0); // Elimina el tono rojo de las últimas pantallas
|
||||
@@ -479,7 +480,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
|
||||
player->addScore(1000);
|
||||
const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(0)->getWidth()) / 2;
|
||||
createItemText(x, game_text_textures_.at(0));
|
||||
Audio::get()->playSound("item_pickup.wav");
|
||||
playSound("item_pickup.wav");
|
||||
break;
|
||||
}
|
||||
case ItemType::GAVINA:
|
||||
@@ -487,7 +488,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
|
||||
player->addScore(2500);
|
||||
const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(1)->getWidth()) / 2;
|
||||
createItemText(x, game_text_textures_.at(1));
|
||||
Audio::get()->playSound("item_pickup.wav");
|
||||
playSound("item_pickup.wav");
|
||||
break;
|
||||
}
|
||||
case ItemType::PACMAR:
|
||||
@@ -495,7 +496,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
|
||||
player->addScore(5000);
|
||||
const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(2)->getWidth()) / 2;
|
||||
createItemText(x, game_text_textures_.at(2));
|
||||
Audio::get()->playSound("item_pickup.wav");
|
||||
playSound("item_pickup.wav");
|
||||
break;
|
||||
}
|
||||
case ItemType::DEBIAN:
|
||||
@@ -503,7 +504,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
|
||||
player->addScore(100000);
|
||||
const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(6)->getWidth()) / 2;
|
||||
createItemText(x, game_text_textures_.at(6));
|
||||
Audio::get()->playSound("debian_pickup.wav");
|
||||
playSound("debian_pickup.wav");
|
||||
break;
|
||||
}
|
||||
case ItemType::CLOCK:
|
||||
@@ -511,7 +512,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
|
||||
enableTimeStopItem();
|
||||
const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(5)->getWidth()) / 2;
|
||||
createItemText(x, game_text_textures_.at(5));
|
||||
Audio::get()->playSound("item_pickup.wav");
|
||||
playSound("item_pickup.wav");
|
||||
break;
|
||||
}
|
||||
case ItemType::COFFEE:
|
||||
@@ -528,7 +529,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
|
||||
const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(4)->getWidth()) / 2;
|
||||
createItemText(x, game_text_textures_.at(4));
|
||||
}
|
||||
Audio::get()->playSound("voice_coffee.wav");
|
||||
playSound("voice_coffee.wav");
|
||||
break;
|
||||
}
|
||||
case ItemType::COFFEE_MACHINE:
|
||||
@@ -537,7 +538,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
|
||||
coffee_machine_enabled_ = false;
|
||||
const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(3)->getWidth()) / 2;
|
||||
createItemText(x, game_text_textures_.at(3));
|
||||
Audio::get()->playSound("voice_power_up.wav");
|
||||
playSound("voice_power_up.wav");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -566,7 +567,7 @@ void Game::checkBulletCollision()
|
||||
if (tabe_->tryToGetBonus())
|
||||
{
|
||||
createItem(ItemType::DEBIAN, pos.x, pos.y);
|
||||
Audio::get()->playSound("debian_drop.wav");
|
||||
playSound("debian_drop.wav");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -574,7 +575,7 @@ void Game::checkBulletCollision()
|
||||
{
|
||||
createItem(ItemType::COFFEE, pos.x, pos.y);
|
||||
}
|
||||
Audio::get()->playSound("tabe_hit.wav");
|
||||
playSound("tabe_hit.wav");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -596,7 +597,7 @@ void Game::checkBulletCollision()
|
||||
if (dropped_item != ItemType::COFFEE_MACHINE)
|
||||
{
|
||||
createItem(dropped_item, balloon->getPosX(), balloon->getPosY());
|
||||
Audio::get()->playSound("item_drop.wav");
|
||||
playSound("item_drop.wav");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -618,7 +619,7 @@ void Game::checkBulletCollision()
|
||||
updateHiScore();
|
||||
|
||||
// Sonido de explosión
|
||||
Audio::get()->playSound("balloon.wav");
|
||||
playSound("balloon.wav");
|
||||
|
||||
// Deshabilita la bala
|
||||
bullet->disable();
|
||||
@@ -674,7 +675,7 @@ void Game::updateItems()
|
||||
item->update();
|
||||
if (item->isOnFloor())
|
||||
{
|
||||
Audio::get()->playSound("title.wav");
|
||||
playSound("title.wav");
|
||||
screen_->shake(1, 2, 4);
|
||||
}
|
||||
}
|
||||
@@ -901,16 +902,16 @@ void Game::killPlayer(std::shared_ptr<Player> &player)
|
||||
// Lo pierde
|
||||
player->removeExtraHit();
|
||||
throwCoffee(player->getPosX() + (player->getWidth() / 2), player->getPosY() + (player->getHeight() / 2));
|
||||
Audio::get()->playSound("coffee_out.wav");
|
||||
playSound("coffee_out.wav");
|
||||
screen_->shake();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Si no tiene cafes, muere
|
||||
balloon_manager_->stopAllBalloons();
|
||||
Audio::get()->playSound("player_collision.wav");
|
||||
playSound("player_collision.wav");
|
||||
screen_->shake();
|
||||
Audio::get()->playSound("voice_no.wav");
|
||||
playSound("voice_no.wav");
|
||||
player->setPlayingState(PlayerState::DYING);
|
||||
if (allPlayersAreNotPlaying())
|
||||
{
|
||||
@@ -930,7 +931,7 @@ void Game::updateTimeStopped()
|
||||
{
|
||||
if (time_stopped_counter_ % 30 == 0)
|
||||
{
|
||||
Audio::get()->playSound("clock.wav");
|
||||
playSound("clock.wav");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -938,12 +939,12 @@ void Game::updateTimeStopped()
|
||||
if (time_stopped_counter_ % 30 == 0)
|
||||
{
|
||||
balloon_manager_->normalColorsToAllBalloons();
|
||||
Audio::get()->playSound("clock.wav");
|
||||
playSound("clock.wav");
|
||||
}
|
||||
else if (time_stopped_counter_ % 30 == 15)
|
||||
{
|
||||
balloon_manager_->reverseColorsToAllBalloons();
|
||||
Audio::get()->playSound("clock.wav");
|
||||
playSound("clock.wav");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1438,7 +1439,7 @@ void Game::handleFireInput(const std::shared_ptr<Player> &player, BulletType bul
|
||||
player->setInput(bulletType == BulletType::UP ? InputAction::FIRE_CENTER : bulletType == BulletType::LEFT ? InputAction::FIRE_LEFT
|
||||
: InputAction::FIRE_RIGHT);
|
||||
createBullet(player->getPosX() + (player->getWidth() / 2) - 6, player->getPosY() + (player->getHeight() / 2), bulletType, player->isPowerUp(), player->getId());
|
||||
Audio::get()->playSound("bullet.wav");
|
||||
playSound("bullet.wav");
|
||||
|
||||
// Establece un tiempo de espera para el próximo disparo.
|
||||
const int cooldown = player->isPowerUp() ? 5 : Options::settings.autofire ? 10
|
||||
@@ -1535,7 +1536,7 @@ void Game::handlePlayerContinue(const std::shared_ptr<Player> &player)
|
||||
{
|
||||
player->setPlayingState(PlayerState::PLAYING);
|
||||
player->addCredit();
|
||||
Audio::get()->playSound("voice_thankyou.wav");
|
||||
playSound("voice_thankyou.wav");
|
||||
}
|
||||
|
||||
// Disminuye el contador de continuación si se presiona cualquier botón de disparo.
|
||||
@@ -1850,7 +1851,7 @@ void Game::updateGameStateEnteringPlayer()
|
||||
{
|
||||
setState(GameState::SHOWING_GET_READY_MESSAGE);
|
||||
createMessage({paths_.at(0), paths_.at(1)}, Resource::get()->getTexture("game_text_get_ready"));
|
||||
Audio::get()->playSound("voice_get_ready.wav");
|
||||
playSound("voice_get_ready.wav");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1972,6 +1973,15 @@ void Game::setState(GameState state)
|
||||
counter_ = 0;
|
||||
}
|
||||
|
||||
void Game::playSound(const std::string &name)
|
||||
{
|
||||
if (demo_.enabled)
|
||||
return;
|
||||
|
||||
static auto audio = Audio::get();
|
||||
audio->playSound(name);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// Comprueba los eventos en el modo DEBUG
|
||||
void Game::checkDebugEvents(const SDL_Event &event)
|
||||
@@ -1997,6 +2007,7 @@ void Game::checkDebugEvents(const SDL_Event &event)
|
||||
if (auto_pop_balloons_)
|
||||
{
|
||||
balloon_manager_->destroyAllBalloons();
|
||||
playSound("power_ball_explosion.wav");
|
||||
}
|
||||
balloon_manager_->setDeployBalloons(!auto_pop_balloons_);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user