fix: arreglos de codi
This commit is contained in:
@@ -1845,7 +1845,7 @@ void Game::updateGameStateEnteringPlayer()
|
|||||||
updatePlayers();
|
updatePlayers();
|
||||||
updateScoreboard();
|
updateScoreboard();
|
||||||
updateBackground();
|
updateBackground();
|
||||||
for (auto player : players_)
|
for (const auto &player : players_)
|
||||||
{
|
{
|
||||||
if (player->isPlaying())
|
if (player->isPlaying())
|
||||||
{
|
{
|
||||||
@@ -2026,7 +2026,7 @@ void Game::checkDebugEvents(const SDL_Event &event)
|
|||||||
}
|
}
|
||||||
case SDLK_8:
|
case SDLK_8:
|
||||||
{
|
{
|
||||||
for (auto player : players_)
|
for (const auto &player : players_)
|
||||||
{
|
{
|
||||||
if (player->isPlaying())
|
if (player->isPlaying())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ void Intro::initSprites()
|
|||||||
sprites_.at(0)->addPath(-SPRITE_WIDTH - 10, X_DEST, PathType::HORIZONTAL, Y_DEST, 100, easeInOutExpo, 0);
|
sprites_.at(0)->addPath(-SPRITE_WIDTH - 10, X_DEST, PathType::HORIZONTAL, Y_DEST, 100, easeInOutExpo, 0);
|
||||||
sprites_.at(1)->addPath(param.game.width, X_DEST, PathType::HORIZONTAL, Y_DEST, 100, easeOutBounce, 0);
|
sprites_.at(1)->addPath(param.game.width, X_DEST, PathType::HORIZONTAL, Y_DEST, 100, easeOutBounce, 0);
|
||||||
sprites_.at(2)->addPath(-SPRITE_HEIGHT, Y_DEST, PathType::VERTICAL, X_DEST, 40, easeOutQuint, 0);
|
sprites_.at(2)->addPath(-SPRITE_HEIGHT, Y_DEST, PathType::VERTICAL, X_DEST, 40, easeOutQuint, 0);
|
||||||
sprites_.at(3)->addPath(param.game.height, Y_DEST, PathType::VERTICAL, X_DEST, 800, easeOutQuint, 0);
|
sprites_.at(3)->addPath(param.game.height, Y_DEST, PathType::VERTICAL, X_DEST, 600, easeOutQuint, 0);
|
||||||
sprites_.at(4)->addPath(-SPRITE_HEIGHT, Y_DEST, PathType::VERTICAL, X_DEST, 70, easeOutElastic, 0);
|
sprites_.at(4)->addPath(-SPRITE_HEIGHT, Y_DEST, PathType::VERTICAL, X_DEST, 70, easeOutElastic, 0);
|
||||||
sprites_.at(5)->addPath(param.game.width, X_DEST, PathType::HORIZONTAL, Y_DEST, 400, easeOutQuad, 300);
|
sprites_.at(5)->addPath(param.game.width, X_DEST, PathType::HORIZONTAL, Y_DEST, 400, easeOutQuad, 300);
|
||||||
sprites_.at(5)->addPath(X_DEST, -SPRITE_WIDTH, PathType::HORIZONTAL, Y_DEST, 80, easeInElastic, 0);
|
sprites_.at(5)->addPath(X_DEST, -SPRITE_WIDTH, PathType::HORIZONTAL, Y_DEST, 80, easeInElastic, 0);
|
||||||
@@ -377,7 +377,7 @@ void Intro::initSprites()
|
|||||||
shadow_sprites_.at(0)->addPath(param.game.height + 10, S_Y_DEST, PathType::VERTICAL, S_X_DEST, 100, easeInOutExpo, 0);
|
shadow_sprites_.at(0)->addPath(param.game.height + 10, S_Y_DEST, PathType::VERTICAL, S_X_DEST, 100, easeInOutExpo, 0);
|
||||||
shadow_sprites_.at(1)->addPath(-SHADOW_SPRITE_HEIGHT, S_Y_DEST, PathType::VERTICAL, S_X_DEST, 100, easeOutBounce, 0);
|
shadow_sprites_.at(1)->addPath(-SHADOW_SPRITE_HEIGHT, S_Y_DEST, PathType::VERTICAL, S_X_DEST, 100, easeOutBounce, 0);
|
||||||
shadow_sprites_.at(2)->addPath(-SHADOW_SPRITE_WIDTH, S_X_DEST, PathType::HORIZONTAL, S_Y_DEST, 40, easeOutQuint, 0);
|
shadow_sprites_.at(2)->addPath(-SHADOW_SPRITE_WIDTH, S_X_DEST, PathType::HORIZONTAL, S_Y_DEST, 40, easeOutQuint, 0);
|
||||||
shadow_sprites_.at(3)->addPath(param.game.width, S_X_DEST, PathType::HORIZONTAL, S_Y_DEST, 800, easeOutQuint, 0);
|
shadow_sprites_.at(3)->addPath(param.game.width, S_X_DEST, PathType::HORIZONTAL, S_Y_DEST, 600, easeOutQuint, 0);
|
||||||
shadow_sprites_.at(4)->addPath(param.game.height, S_Y_DEST, PathType::VERTICAL, S_X_DEST, 70, easeOutElastic, 0);
|
shadow_sprites_.at(4)->addPath(param.game.height, S_Y_DEST, PathType::VERTICAL, S_X_DEST, 70, easeOutElastic, 0);
|
||||||
shadow_sprites_.at(5)->addPath(-SHADOW_SPRITE_HEIGHT, S_Y_DEST, PathType::VERTICAL, S_X_DEST, 400, easeOutQuad, 300);
|
shadow_sprites_.at(5)->addPath(-SHADOW_SPRITE_HEIGHT, S_Y_DEST, PathType::VERTICAL, S_X_DEST, 400, easeOutQuad, 300);
|
||||||
shadow_sprites_.at(5)->addPath(S_X_DEST, param.game.width, PathType::HORIZONTAL, S_Y_DEST, 80, easeInElastic, 0);
|
shadow_sprites_.at(5)->addPath(S_X_DEST, param.game.width, PathType::HORIZONTAL, S_Y_DEST, 80, easeInElastic, 0);
|
||||||
@@ -493,11 +493,15 @@ void Intro::updatePostState()
|
|||||||
tiled_bg_->stopGracefully();
|
tiled_bg_->stopGracefully();
|
||||||
|
|
||||||
// Modifica el color del fondo hasta llegar a blanco
|
// Modifica el color del fondo hasta llegar a blanco
|
||||||
if (bg_color_ < 255)
|
if (bg_color_ <= 253) // Garantiza que no se exceda de 255 al incrementar de 2 en 2
|
||||||
{
|
{
|
||||||
++bg_color_;
|
bg_color_ += 2;
|
||||||
tiled_bg_->setColor(Color(bg_color_, bg_color_, bg_color_));
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bg_color_ = 255; // Asegura que bg_color_ no exceda el límite máximo
|
||||||
|
}
|
||||||
|
tiled_bg_->setColor(Color(bg_color_, bg_color_, bg_color_));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cambia de estado si el fondo se ha detenido y recuperado el color
|
// Cambia de estado si el fondo se ha detenido y recuperado el color
|
||||||
@@ -509,7 +513,7 @@ void Intro::updatePostState()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IntroPostState::END:
|
case IntroPostState::END:
|
||||||
// Finaliza la intro después de 3 segundos
|
// Finaliza la intro después de 2 segundos
|
||||||
if (ELAPSED_TIME >= 2000)
|
if (ELAPSED_TIME >= 2000)
|
||||||
{
|
{
|
||||||
JA_StopMusic();
|
JA_StopMusic();
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ private:
|
|||||||
IntroState state_ = IntroState::SCENES; // Estado
|
IntroState state_ = IntroState::SCENES; // Estado
|
||||||
IntroPostState post_state_ = IntroPostState::STOP_BG; // Estado
|
IntroPostState post_state_ = IntroPostState::STOP_BG; // Estado
|
||||||
Uint32 state_start_time_;
|
Uint32 state_start_time_;
|
||||||
Uint8 bg_color_ = 96;
|
Uint8 bg_color_ = 112;
|
||||||
|
|
||||||
// Actualiza las variables del objeto
|
// Actualiza las variables del objeto
|
||||||
void update();
|
void update();
|
||||||
|
|||||||
@@ -348,15 +348,15 @@ std::vector<Uint32> Texture::loadPaletteFromFile(const std::string &file_path)
|
|||||||
throw std::runtime_error("Error al leer el fichero: " + getFileName(file_path));
|
throw std::runtime_error("Error al leer el fichero: " + getFileName(file_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto pal = LoadPalette(buffer.data());
|
const auto *PAL = LoadPalette(buffer.data());
|
||||||
if (!pal)
|
if (!PAL)
|
||||||
{
|
{
|
||||||
return palette;
|
return palette;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 256; ++i)
|
for (int i = 0; i < 256; ++i)
|
||||||
{
|
{
|
||||||
palette.push_back((pal[i] << 8) + 255);
|
palette.push_back((PAL[i] << 8) + 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
return palette;
|
return palette;
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ TiledBG::TiledBG(SDL_Rect pos, TiledBGMode mode)
|
|||||||
break;
|
break;
|
||||||
case TiledBGMode::CIRCLE:
|
case TiledBGMode::CIRCLE:
|
||||||
window_ = {128, 128, pos_.w, pos_.h};
|
window_ = {128, 128, pos_.w, pos_.h};
|
||||||
speed_ = 0.8f;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
window_ = {0, 0, pos_.w, pos_.h};
|
window_ = {0, 0, pos_.w, pos_.h};
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ private:
|
|||||||
// Variables
|
// Variables
|
||||||
SDL_Rect pos_; // Posición y tamaño del mosaico
|
SDL_Rect pos_; // Posición y tamaño del mosaico
|
||||||
SDL_Rect window_; // Ventana visible para la textura de fondo del titulo
|
SDL_Rect window_; // Ventana visible para la textura de fondo del titulo
|
||||||
int counter_ = 0; // Contador
|
|
||||||
TiledBGMode mode_; // Tipo de movimiento del mosaico
|
TiledBGMode mode_; // Tipo de movimiento del mosaico
|
||||||
double sin_[360]; // Vector con los valores del seno precalculados
|
double sin_[360]; // Vector con los valores del seno precalculados
|
||||||
float desp_ = 0.0f; // Desplazamiento aplicado
|
float desp_ = 0.0f; // Desplazamiento aplicado
|
||||||
|
|||||||
Reference in New Issue
Block a user