FIX: Si saltes el logo talla el so a meitat sonar

FIX: Corregida la lògica del efecte de flash
This commit is contained in:
2024-11-27 18:39:23 +01:00
parent eed45bdbc6
commit faba87c06d
6 changed files with 24 additions and 14 deletions

View File

@@ -172,7 +172,7 @@ void Credits::checkInput()
{
// Si todavía estan los creditos en marcha, se pasan solos a toda pastilla
want_to_pass_ = true;
ticks_speed_ = 3;
ticks_speed_ = 1;
}
}

View File

@@ -53,7 +53,7 @@ Director::Director(int argc, const char *argv[])
section::name = section::Name::GAME;
section::options = section::Options::GAME_PLAY_1P;
#elif DEBUG
section::name = section::Name::CREDITS;
section::name = section::Name::LOGO;
#else // NORMAL GAME
section::name = section::Name::LOGO;
section::attract_mode = section::AttractMode::TITLE_TO_DEMO;
@@ -105,7 +105,7 @@ void Director::init()
Resource::init();
Input::init(Asset::get()->get("gamecontrollerdb.txt"));
bindInputs();
Notifier::init(std::string(), Resource::get()->getText("8bithud"), Asset::get()->get("notify.wav"));
Notifier::init(std::string(), Resource::get()->getText("8bithud"));
OnScreenHelp::init();
globalInputs::init();
}

View File

@@ -253,7 +253,7 @@ void Game::updateStage()
++Stage::number;
JA_PlaySound(Resource::get()->getSound("stage_change.wav"));
balloon_manager_->resetBalloonSpeed();
screen_->flash(flash_color, 100);
screen_->flash(flash_color, 3);
screen_->shake();
// Escribe el texto por pantalla
@@ -1169,7 +1169,7 @@ void Game::checkEvents()
}
case SDLK_7: // Flash
{
screen_->flash(flash_color, 100);
screen_->flash(flash_color, 3);
break;
}
case SDLK_8:

View File

@@ -59,6 +59,7 @@ Logo::~Logo()
{
jail_texture_->setColor(255, 255, 255);
since_texture_->setColor(255, 255, 255);
JA_PauseChannel(-1);
}
// Recarga todas las texturas

View File

@@ -88,10 +88,10 @@ void Screen::blit()
fps_counter_++;
// Actualiza y dibuja el efecto de flash en la pantalla
doFlash();
renderFlash();
// Atenua la pantalla
doAttenuate();
renderAttenuate();
// Muestra la ayuda por pantalla
OnScreenHelp::get()->render();
@@ -254,6 +254,7 @@ void Screen::setBlendMode(SDL_BlendMode blendMode)
void Screen::update()
{
updateShakeEffect();
updateFlash();
Notifier::get()->update();
updateFPS();
OnScreenHelp::get()->update();
@@ -312,21 +313,26 @@ void Screen::flash(Color color, int lenght)
}
// Actualiza y dibuja el efecto de flash en la pantalla
void Screen::doFlash()
void Screen::renderFlash()
{
if (flash_effect_.enabled)
{
// Dibuja el color del flash en la textura
SDL_SetRenderDrawColor(renderer_, flash_effect_.color.r, flash_effect_.color.g, flash_effect_.color.b, 0xFF);
SDL_RenderClear(renderer_);
}
}
// Actualiza la lógica del efecto
// Actualiza el efecto de flash
void Screen::updateFlash()
{
if (flash_effect_.enabled)
{
flash_effect_.counter > 0 ? flash_effect_.counter-- : flash_effect_.enabled = false;
}
}
// Atenua la pantalla
void Screen::doAttenuate()
void Screen::renderAttenuate()
{
if (attenuate_effect_)
{

View File

@@ -82,11 +82,14 @@ private:
// Actualiza la logica para agitar la pantalla
void updateShakeEffect();
// Actualiza y dibuja el efecto de flash en la pantalla
void doFlash();
// Dibuja el efecto de flash en la pantalla
void renderFlash();
// Actualiza el efecto de flash
void updateFlash();
// Atenua la pantalla
void doAttenuate();
void renderAttenuate();
// Calcula los frames por segundo
void updateFPS();