normalitzat Audio
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#include <iostream> // for basic_ostream, char_traits, operator<<
|
||||
#include <numeric> // for accumulate
|
||||
|
||||
#include "core/audio/jail_audio.hpp" // for JA_PlaySound, JA_DeleteSound, JA_LoadSound
|
||||
#include "core/audio/audio.hpp" // for Audio
|
||||
#include "core/input/global_inputs.hpp" // for GlobalInputs::handle
|
||||
#include "core/input/input.h" // for inputs_e, Input, REPEAT_TRUE, REPEAT_FALSE
|
||||
#include "core/locale/lang.h" // for Lang
|
||||
@@ -1307,7 +1307,7 @@ void Game::updateHiScore() {
|
||||
// Si se supera la máxima puntuación emite sonido
|
||||
if (hiScoreAchieved == false) {
|
||||
hiScoreAchieved = true;
|
||||
JA_PlaySound(hiScoreSound);
|
||||
Audio::get()->playSound(hiScoreSound);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1459,9 +1459,9 @@ void Game::updateStage() {
|
||||
}
|
||||
}
|
||||
updateHiScore();
|
||||
JA_StopMusic();
|
||||
Audio::get()->stopMusic();
|
||||
}
|
||||
JA_PlaySound(stageChangeSound);
|
||||
Audio::get()->playSound(stageChangeSound);
|
||||
stageBitmapCounter = 0;
|
||||
enemySpeed = defaultEnemySpeed;
|
||||
setBalloonSpeed(enemySpeed);
|
||||
@@ -1499,7 +1499,7 @@ void Game::updateDeath() {
|
||||
if (!demo.enabled) {
|
||||
const Uint8 index = rand() % 4;
|
||||
JA_Sound_t *sound[4] = {bubble1Sound, bubble2Sound, bubble3Sound, bubble4Sound};
|
||||
JA_PlaySound(sound[index], 0);
|
||||
Audio::get()->playSound(sound[index]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1746,7 +1746,7 @@ void Game::destroyAllBalloons() {
|
||||
|
||||
enemyDeployCounter = 255;
|
||||
if (!demo.enabled) {
|
||||
JA_PlaySound(powerBallSound);
|
||||
Audio::get()->playSound(powerBallSound);
|
||||
}
|
||||
effect.flash = true;
|
||||
effect.shake = true;
|
||||
@@ -1811,26 +1811,26 @@ void Game::checkPlayerItemCollision(Player *player) {
|
||||
player->addScore(1000);
|
||||
updateHiScore();
|
||||
createItemScoreSprite(item->getPosX() + (item->getWidth() / 2) - (n1000Sprite->getWidth() / 2), player->getPosY(), n1000Sprite);
|
||||
JA_PlaySound(itemPickUpSound);
|
||||
Audio::get()->playSound(itemPickUpSound);
|
||||
break;
|
||||
|
||||
case ITEM_POINTS_2_GAVINA:
|
||||
player->addScore(2500);
|
||||
updateHiScore();
|
||||
createItemScoreSprite(item->getPosX() + (item->getWidth() / 2) - (n2500Sprite->getWidth() / 2), player->getPosY(), n2500Sprite);
|
||||
JA_PlaySound(itemPickUpSound);
|
||||
Audio::get()->playSound(itemPickUpSound);
|
||||
break;
|
||||
|
||||
case ITEM_POINTS_3_PACMAR:
|
||||
player->addScore(5000);
|
||||
updateHiScore();
|
||||
createItemScoreSprite(item->getPosX() + (item->getWidth() / 2) - (n5000Sprite->getWidth() / 2), player->getPosY(), n5000Sprite);
|
||||
JA_PlaySound(itemPickUpSound);
|
||||
Audio::get()->playSound(itemPickUpSound);
|
||||
break;
|
||||
|
||||
case ITEM_CLOCK:
|
||||
enableTimeStopItem();
|
||||
JA_PlaySound(itemPickUpSound);
|
||||
Audio::get()->playSound(itemPickUpSound);
|
||||
break;
|
||||
|
||||
case ITEM_COFFEE:
|
||||
@@ -1840,12 +1840,12 @@ void Game::checkPlayerItemCollision(Player *player) {
|
||||
createItemScoreSprite(item->getPosX() + (item->getWidth() / 2) - (n5000Sprite->getWidth() / 2), player->getPosY(), n5000Sprite);
|
||||
}
|
||||
player->giveExtraHit();
|
||||
JA_PlaySound(itemPickUpSound);
|
||||
Audio::get()->playSound(itemPickUpSound);
|
||||
break;
|
||||
|
||||
case ITEM_COFFEE_MACHINE:
|
||||
player->setPowerUp(true);
|
||||
JA_PlaySound(itemPickUpSound);
|
||||
Audio::get()->playSound(itemPickUpSound);
|
||||
coffeeMachineEnabled = false;
|
||||
break;
|
||||
|
||||
@@ -1876,7 +1876,7 @@ void Game::checkBulletBalloonCollision() {
|
||||
|
||||
// Si no es el modo demo, genera un sonido
|
||||
if (!demo.enabled) {
|
||||
JA_PlaySound(balloonSound);
|
||||
Audio::get()->playSound(balloonSound);
|
||||
}
|
||||
|
||||
// Deshabilita la bala
|
||||
@@ -1887,7 +1887,7 @@ void Game::checkBulletBalloonCollision() {
|
||||
if ((droppeditem != NO_KIND) && !(demo.enabled) && !(demo.recording)) {
|
||||
if (droppeditem != ITEM_COFFEE_MACHINE) {
|
||||
createItem(droppeditem, balloon->getPosX(), balloon->getPosY());
|
||||
JA_PlaySound(itemDropSound);
|
||||
Audio::get()->playSound(itemDropSound);
|
||||
} else {
|
||||
createItem(droppeditem, players[index]->getPosX(), 0);
|
||||
coffeeMachineEnabled = true;
|
||||
@@ -1945,7 +1945,7 @@ void Game::updateItems() {
|
||||
if (item->isEnabled()) {
|
||||
item->update();
|
||||
if (item->isOnFloor()) {
|
||||
JA_PlaySound(coffeeMachineSound);
|
||||
Audio::get()->playSound(coffeeMachineSound);
|
||||
effect.shake = true;
|
||||
}
|
||||
}
|
||||
@@ -2132,12 +2132,12 @@ void Game::killPlayer(Player *player) {
|
||||
player->removeExtraHit();
|
||||
throwCoffee(player->getPosX() + (player->getWidth() / 2), player->getPosY() + (player->getHeight() / 2));
|
||||
if (!demo.enabled) {
|
||||
JA_PlaySound(coffeeOutSound);
|
||||
Audio::get()->playSound(coffeeOutSound);
|
||||
}
|
||||
} else if (deathSequence.phase == DeathPhase::None) {
|
||||
if (!demo.enabled) {
|
||||
JA_PauseMusic();
|
||||
JA_PlaySound(playerCollisionSound);
|
||||
Audio::get()->pauseMusic();
|
||||
Audio::get()->playSound(playerCollisionSound);
|
||||
}
|
||||
stopAllBalloons(10);
|
||||
shakeScreen();
|
||||
@@ -2167,11 +2167,11 @@ void Game::updateDeathSequence() {
|
||||
// Espera 500ms antes de completar la muerte
|
||||
if (SDL_GetTicks() - deathSequence.phaseStartTicks >= 500) {
|
||||
if (!demo.enabled) {
|
||||
JA_PlaySound(coffeeOutSound);
|
||||
Audio::get()->playSound(coffeeOutSound);
|
||||
if (allPlayersAreDead()) {
|
||||
JA_StopMusic();
|
||||
Audio::get()->stopMusic();
|
||||
} else {
|
||||
JA_ResumeMusic();
|
||||
Audio::get()->resumeMusic();
|
||||
}
|
||||
}
|
||||
deathSequence.player->setAlive(false);
|
||||
@@ -2234,7 +2234,7 @@ void Game::updateEnemyDeployCounter() {
|
||||
// Actualiza el juego
|
||||
void Game::update() {
|
||||
// Actualiza el audio
|
||||
JA_Update();
|
||||
Audio::update();
|
||||
|
||||
// Actualiza los efectos basados en tiempo real (no en el throttle del juego)
|
||||
updateDeathShake();
|
||||
@@ -2541,7 +2541,7 @@ void Game::checkGameInput() {
|
||||
player->setFireCooldown(10);
|
||||
|
||||
// Reproduce el sonido de disparo
|
||||
JA_PlaySound(bulletSound);
|
||||
Audio::get()->playSound(bulletSound);
|
||||
|
||||
demo.keys.fire = 1;
|
||||
}
|
||||
@@ -2555,7 +2555,7 @@ void Game::checkGameInput() {
|
||||
player->setFireCooldown(10);
|
||||
|
||||
// Reproduce el sonido de disparo
|
||||
JA_PlaySound(bulletSound);
|
||||
Audio::get()->playSound(bulletSound);
|
||||
|
||||
demo.keys.fireLeft = 1;
|
||||
}
|
||||
@@ -2569,7 +2569,7 @@ void Game::checkGameInput() {
|
||||
player->setFireCooldown(10);
|
||||
|
||||
// Reproduce el sonido de disparo
|
||||
JA_PlaySound(bulletSound);
|
||||
Audio::get()->playSound(bulletSound);
|
||||
|
||||
demo.keys.fireRight = 1;
|
||||
}
|
||||
@@ -2610,11 +2610,11 @@ void Game::renderMessages() {
|
||||
|
||||
if (timeStoppedCounter > 100) {
|
||||
if (timeStoppedCounter % 30 == 0) {
|
||||
JA_PlaySound(clockSound, false);
|
||||
Audio::get()->playSound(clockSound);
|
||||
}
|
||||
} else {
|
||||
if (timeStoppedCounter % 15 == 0) {
|
||||
JA_PlaySound(clockSound, false);
|
||||
Audio::get()->playSound(clockSound);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2652,8 +2652,8 @@ void Game::enableTimeStopItem() {
|
||||
stopAllBalloons(TIME_STOPPED_COUNTER);
|
||||
setTimeStopped(true);
|
||||
incTimeStoppedCounter(TIME_STOPPED_COUNTER);
|
||||
if (JA_GetMusicState() == JA_MUSIC_PLAYING) {
|
||||
JA_PauseMusic();
|
||||
if (Audio::getRealMusicState() == Audio::MusicState::PLAYING) {
|
||||
Audio::get()->pauseMusic();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2662,8 +2662,8 @@ void Game::disableTimeStopItem() {
|
||||
timeStopped = false;
|
||||
setTimeStoppedCounter(0);
|
||||
startAllBalloons();
|
||||
if (JA_GetMusicState() == JA_MUSIC_PAUSED) {
|
||||
JA_ResumeMusic();
|
||||
if (Audio::getRealMusicState() == Audio::MusicState::PAUSED) {
|
||||
Audio::get()->resumeMusic();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2729,11 +2729,11 @@ void Game::iterate() {
|
||||
gameOverInitialized = false;
|
||||
|
||||
// Si la música no está sonando
|
||||
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED)) {
|
||||
if ((Audio::getRealMusicState() == Audio::MusicState::STOPPED) || (Audio::getRealMusicState() == Audio::MusicState::STOPPED)) {
|
||||
// Reproduce la música (nunca en modo demo: deja sonar la del título)
|
||||
if (!gameCompleted && !demo.enabled) {
|
||||
if (players[0]->isAlive()) {
|
||||
JA_PlayMusic(gameMusic);
|
||||
Audio::get()->playMusic(gameMusic);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2781,7 +2781,7 @@ void Game::handleEvent(const SDL_Event *event) {
|
||||
if (gameCompleted) {
|
||||
gameOverPostFade = 1;
|
||||
fade->activateFade();
|
||||
JA_PlaySound(itemPickUpSound);
|
||||
Audio::get()->playSound(itemPickUpSound);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2810,15 +2810,15 @@ void Game::updatePausedGame() {
|
||||
const bool b = pauseCounter == 60;
|
||||
const bool c = pauseCounter == 30;
|
||||
if (a || b || c) {
|
||||
JA_PlaySound(clockSound);
|
||||
Audio::get()->playSound(clockSound);
|
||||
}
|
||||
pauseCounter--;
|
||||
} else { // Ha finalizado el contador
|
||||
section->name = SECTION_PROG_GAME;
|
||||
section->subsection = numPlayers == 1 ? SUBSECTION_GAME_PLAY_1P : SUBSECTION_GAME_PLAY_2P;
|
||||
|
||||
if (JA_GetMusicState() == JA_MUSIC_PAUSED) {
|
||||
JA_ResumeMusic();
|
||||
if (Audio::getRealMusicState() == Audio::MusicState::PAUSED) {
|
||||
Audio::get()->resumeMusic();
|
||||
}
|
||||
}
|
||||
} else { // Actualiza la lógica del menu de pausa
|
||||
@@ -2847,7 +2847,7 @@ void Game::updatePausedGame() {
|
||||
if (fade->hasEnded()) {
|
||||
section->name = SECTION_PROG_TITLE;
|
||||
section->subsection = SUBSECTION_TITLE_1;
|
||||
JA_StopMusic();
|
||||
Audio::get()->stopMusic();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2897,8 +2897,8 @@ void Game::renderPausedGame() {
|
||||
// Inicializa el estado de pausa del juego
|
||||
void Game::enterPausedGame() {
|
||||
// Pone en pausa la música
|
||||
if (JA_GetMusicState() == JA_MUSIC_PLAYING) {
|
||||
JA_PauseMusic();
|
||||
if (Audio::getRealMusicState() == Audio::MusicState::PLAYING) {
|
||||
Audio::get()->pauseMusic();
|
||||
}
|
||||
|
||||
// Reinicia el menu
|
||||
|
||||
Reference in New Issue
Block a user