Retocado el final del ending con fade de audio
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -19,6 +19,7 @@ Input::Input(std::string file)
|
||||
gameControllerBindings.resize(17, gcb);
|
||||
|
||||
verbose = true;
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
// Actualiza el estado del objeto
|
||||
|
||||
@@ -100,6 +100,9 @@ void Ending::update()
|
||||
|
||||
// Comprueba si se ha de cambiar de escena
|
||||
checkChangeScene();
|
||||
|
||||
// Actualiza el volumen de la musica
|
||||
updateMusicVolume();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -484,6 +487,7 @@ section_t Ending::run()
|
||||
}
|
||||
|
||||
JA_StopMusic();
|
||||
JA_SetVolume(128);
|
||||
|
||||
return section;
|
||||
}
|
||||
@@ -560,8 +564,12 @@ void Ending::checkChangeScene()
|
||||
coverCounter = 0;
|
||||
if (scene == 5)
|
||||
{
|
||||
// Termina el bucle
|
||||
section.name = SECTION_PROG_LOGO;
|
||||
|
||||
// Mantiene los valores anteriores
|
||||
scene = 4;
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
coverCounter = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -600,14 +608,20 @@ void Ending::renderCoverTexture()
|
||||
{
|
||||
if (coverCounter > 0)
|
||||
{ // Dibuja la textura que cubre el texto
|
||||
// const int offset = std::min(coverCounter, 200 / 2);
|
||||
// SDL_Rect srcRect = {0, 0, 256, 200 - (offset * 2)};
|
||||
// SDL_Rect dstRect = {0, offset * 2, 256, 200 - (offset * 2)};
|
||||
// SDL_RenderCopy(renderer, coverTexture, &srcRect, &dstRect);
|
||||
|
||||
const int offset = std::min(coverCounter, 100);
|
||||
SDL_Rect srcRect = {0, 200 - (coverCounter * 2), 256, offset * 2};
|
||||
SDL_Rect dstRect = {0, 0, 256, offset * 2};
|
||||
SDL_RenderCopy(renderer, coverTexture, &srcRect, &dstRect);
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza el volumen de la musica
|
||||
void Ending::updateMusicVolume()
|
||||
{
|
||||
if (scene == 4 && coverCounter > 0)
|
||||
{
|
||||
const float step = (100.0f - coverCounter) / 100.0f;
|
||||
const int volume = 128 * step;
|
||||
JA_SetVolume(volume);
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,9 @@ private:
|
||||
// Dibuja la cortinilla de cambio de escena
|
||||
void renderCoverTexture();
|
||||
|
||||
// Actualiza el volumen de la musica
|
||||
void updateMusicVolume();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Ending(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options);
|
||||
|
||||
@@ -212,6 +212,7 @@ void Game::update()
|
||||
checkPlayerAndItems();
|
||||
checkPlayerAndEnemies();
|
||||
checkIfPlayerIsAlive();
|
||||
checkGameOver();
|
||||
checkEndGame();
|
||||
scoreboard->update();
|
||||
input->update();
|
||||
@@ -372,7 +373,7 @@ void Game::checkIfPlayerIsAlive()
|
||||
}
|
||||
|
||||
// Comprueba si ha terminado la partida
|
||||
void Game::checkEndGame()
|
||||
void Game::checkGameOver()
|
||||
{
|
||||
if (board.lives < 0)
|
||||
{
|
||||
@@ -497,4 +498,20 @@ void Game::setScoreBoardColor()
|
||||
// Si el color es negro brillante lo cambia a blanco
|
||||
const color_t cBrightBlack = stringToColor(options->palette, "bright_black");
|
||||
board.color = colorAreEqual(c, cBrightBlack) ? stringToColor(options->palette, "white") : c;
|
||||
}
|
||||
|
||||
// Comprueba si ha finalizado el juego
|
||||
bool Game::checkEndGame()
|
||||
{
|
||||
const bool a = room->getName() == "THE JAIL";
|
||||
const bool b = board.items >= 2;
|
||||
const bool c = player->getRect().x < 152;
|
||||
|
||||
if (a && b && c)
|
||||
{
|
||||
section.name = SECTION_PROG_ENDING;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ private:
|
||||
void checkIfPlayerIsAlive();
|
||||
|
||||
// Comprueba si ha terminado la partida
|
||||
void checkEndGame();
|
||||
void checkGameOver();
|
||||
|
||||
// Mata al jugador
|
||||
void killPlayer();
|
||||
@@ -112,6 +112,9 @@ private:
|
||||
// Pone el color del marcador en función del color del borde de la habitación
|
||||
void setScoreBoardColor();
|
||||
|
||||
// Comprueba si ha finalizado el juego
|
||||
bool checkEndGame();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, Input *input, Debug *debug);
|
||||
|
||||
Reference in New Issue
Block a user