diff --git a/source/defines.h b/source/defines.h index d8eb091..8c07ec6 100644 --- a/source/defines.h +++ b/source/defines.h @@ -10,7 +10,7 @@ constexpr const char *TEXT_COPYRIGHT = "@2022 JailDesigner"; constexpr const char *VERSION = "1.10"; // Velocidad del juego -constexpr Uint32 GAME_SPEED = 1000 / 60; +constexpr Uint32 GAME_SPEED = 15; // Tamaño de bloque constexpr int BLOCK = 8; diff --git a/source/ending2.cpp b/source/ending2.cpp index 18f99b5..392ed57 100644 --- a/source/ending2.cpp +++ b/source/ending2.cpp @@ -21,25 +21,14 @@ // Constructor Ending2::Ending2() - : screen_(Screen::get()), - renderer_(Screen::get()->getRenderer()), - resource_(Resource::get()), - asset_(Asset::get()), - input_(Input::get()), - text_(resource_->getText("smb2")), - music_(resource_->getMusic("ending2.ogg")) + : counter_enabled_(false), + pre_counter_(0), + post_counter_(0), + post_counter_enabled_(false), + ticks_(0) { - // Inicializa variables - counter_enabled_ = false; - pre_counter_ = 0; - post_counter_ = 0; - post_counter_enabled_ = false; options.section.section = Section::ENDING2; options.section.subsection = Subsection::NONE; - ticks_ = 0; - dist_sprite_text_ = 8; - dist_sprite_sprite_ = 0; - sprite_desp_speed_ = -0.2f; // Inicializa el vector de colores const std::vector color_list = {"white", "yellow", "cyan", "green", "magenta", "red", "blue", "black"}; @@ -49,7 +38,7 @@ Ending2::Ending2() } // Cambia el color del borde - screen_->setBorderColor(stringToColor(options.video.palette, "black")); + Screen::get()->setBorderColor(stringToColor(options.video.palette, "black")); // Inicializa la lista de sprites iniSpriteList(); @@ -100,7 +89,8 @@ void Ending2::update() // Actualiza el volumen de la musica updateMusicVolume(); - screen_->update(); + // Actualiza el objeto + Screen::get()->update(); } } @@ -108,10 +98,10 @@ void Ending2::update() void Ending2::render() { // Prepara para empezar a dibujar en la textura de juego - screen_->start(); + Screen::get()->start(); // Limpia la pantalla - screen_->clean(stringToColor(options.video.palette, "black")); + Screen::get()->clean(stringToColor(options.video.palette, "black")); // Dibuja los sprites renderSprites(); @@ -123,28 +113,28 @@ void Ending2::render() renderTexts(); // Dibuja una trama arriba y abajo - SDL_SetRenderDrawColor(renderer_, 0, 0, 0, 0xFF); + SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0, 0, 0, 0xFF); for (int i = 0; i < 256; i += 2) { - SDL_RenderDrawPoint(renderer_, i + 0, 0); - SDL_RenderDrawPoint(renderer_, i + 1, 1); - SDL_RenderDrawPoint(renderer_, i + 0, 2); - SDL_RenderDrawPoint(renderer_, i + 1, 3); + SDL_RenderDrawPoint(Screen::get()->getRenderer(), i + 0, 0); + SDL_RenderDrawPoint(Screen::get()->getRenderer(), i + 1, 1); + SDL_RenderDrawPoint(Screen::get()->getRenderer(), i + 0, 2); + SDL_RenderDrawPoint(Screen::get()->getRenderer(), i + 1, 3); - SDL_RenderDrawPoint(renderer_, i, 4); - SDL_RenderDrawPoint(renderer_, i, 6); + SDL_RenderDrawPoint(Screen::get()->getRenderer(), i, 4); + SDL_RenderDrawPoint(Screen::get()->getRenderer(), i, 6); - SDL_RenderDrawPoint(renderer_, i + 0, 191); - SDL_RenderDrawPoint(renderer_, i + 1, 190); - SDL_RenderDrawPoint(renderer_, i + 0, 189); - SDL_RenderDrawPoint(renderer_, i + 1, 188); + SDL_RenderDrawPoint(Screen::get()->getRenderer(), i + 0, 191); + SDL_RenderDrawPoint(Screen::get()->getRenderer(), i + 1, 190); + SDL_RenderDrawPoint(Screen::get()->getRenderer(), i + 0, 189); + SDL_RenderDrawPoint(Screen::get()->getRenderer(), i + 1, 188); - SDL_RenderDrawPoint(renderer_, i, 187); - SDL_RenderDrawPoint(renderer_, i, 185); + SDL_RenderDrawPoint(Screen::get()->getRenderer(), i, 187); + SDL_RenderDrawPoint(Screen::get()->getRenderer(), i, 185); } // Vuelca el contenido del renderizador en pantalla - screen_->render(); + Screen::get()->render(); } // Comprueba el manejador de eventos @@ -166,7 +156,7 @@ void Ending2::checkInput() // Bucle principal void Ending2::run() { - JA_PlayMusic(music_); + JA_PlayMusic(Resource::get()->getMusic("ending2.ogg")); while (options.section.section == Section::ENDING2) { @@ -292,7 +282,7 @@ void Ending2::loadSprites() // Carga los sprites for (const auto &sl : sprite_list_) { - sprites_.emplace_back(std::make_shared(resource_->getTexture(sl + ".png"), resource_->getAnimations(sl + ".ani"))); + sprites_.emplace_back(std::make_shared(Resource::get()->getTexture(sl + ".png"), Resource::get()->getAnimations(sl + ".ani"))); sprite_max_width_ = std::max(sprites_.back()->getWidth(), sprite_max_width_); sprite_max_height_ = std::max(sprites_.back()->getHeight(), sprite_max_height_); } @@ -389,14 +379,14 @@ void Ending2::placeSprites() for (int i = 0; i < (int)sprites_.size(); ++i) { const int X = i % 2 == 0 ? FIRST_COL_ : SECOND_COL_; - const int Y = (i / 1) * (sprite_max_height_ + dist_sprite_text_ + text_->getCharacterSize() + dist_sprite_sprite_) + GAMECANVAS_HEIGHT + 40; + const int Y = (i / 1) * (sprite_max_height_ + DIST_SPRITE_TEXT_ + Resource::get()->getText("smb2")->getCharacterSize() + DIST_SPRITE_SPRITE_) + GAMECANVAS_HEIGHT + 40; const int W = sprites_.at(i)->getWidth(); const int H = sprites_.at(i)->getHeight(); const int DX = -(W / 2); const int DY = sprite_max_height_ - H; sprites_.at(i)->setPosition({X + DX, Y + DY, W, H}); - sprites_.at(i)->setVelY(sprite_desp_speed_); + sprites_.at(i)->setVelY(SPRITE_DESP_SPEED_); } // Recoloca el último sprite, que es el del jugador @@ -412,32 +402,41 @@ void Ending2::placeSprites() void Ending2::createSpriteTexts() { // Crea los sprites de texto a partir de la lista - for (int i = 0; i < (int)sprite_list_.size(); ++i) + for (int i = 0; i < static_cast(sprite_list_.size()); ++i) { - // Calcula constantes - std::string txt = sprite_list_[i]; - std::replace(txt.begin(), txt.end(), '_', ' '); - txt = txt == "player" ? "JAILDOCTOR" : txt; // Reemplaza el texto - const int w = text_->lenght(txt, 1); - const int h = text_->getCharacterSize(); - const int x = i % 2 == 0 ? FIRST_COL_ : SECOND_COL_; - const int dx = -(w / 2); - const int y = sprites_.at(i)->getPosY() + sprites_.at(i)->getHeight() + dist_sprite_text_; + auto text = Resource::get()->getText("smb2"); - // Cambia la posición del último sprite - const int X = (i == (int)sprite_list_.size() - 1) ? GAMECANVAS_CENTER_X - (w / 2) : x + dx; + // Procesa y ajusta el texto del sprite actual + std::string txt = sprite_list_[i]; + std::replace(txt.begin(), txt.end(), '_', ' '); // Reemplaza '_' por ' ' + if (txt == "player") + { + txt = "JAILDOCTOR"; // Reemplaza "player" por "JAILDOCTOR" + } + + // Calcula las dimensiones del texto + const int W = text->lenght(txt, 1); + const int H = text->getCharacterSize(); + + // Determina la columna y la posición X del texto + const int X = (i == static_cast(sprite_list_.size()) - 1) + ? (GAMECANVAS_CENTER_X - (W / 2)) + : ((i % 2 == 0 ? FIRST_COL_ : SECOND_COL_) - (W / 2)); + + // Calcula la posición Y del texto en base a la posición y altura del sprite + const int Y = sprites_.at(i)->getPosY() + sprites_.at(i)->getHeight() + DIST_SPRITE_TEXT_; // Crea la textura - auto texture = std::make_shared(renderer_); - texture->createBlank(w, h); - texture->setAsRenderTarget(renderer_); + auto texture = std::make_shared(Screen::get()->getRenderer()); + texture->createBlank(W, H); + texture->setAsRenderTarget(Screen::get()->getRenderer()); texture->setBlendMode(SDL_BLENDMODE_BLEND); - text_->write(0, 0, txt); + text->write(0, 0, txt); // Crea el sprite - SDL_Rect pos = {X, y, w, h}; + SDL_Rect pos = {X, Y, W, H}; sprite_texts_.emplace_back(std::make_shared(texture, pos)); - sprite_texts_.back()->setVelY(sprite_desp_speed_); + sprite_texts_.back()->setVelY(SPRITE_DESP_SPEED_); } } @@ -448,32 +447,34 @@ void Ending2::createTexts() std::vector list; list.push_back("STARRING"); + auto text = Resource::get()->getText("smb2"); + // Crea los sprites de texto a partir de la lista for (int i = 0; i < (int)list.size(); ++i) { // Calcula constantes - const int w = text_->lenght(list[i], 1); - const int h = text_->getCharacterSize(); + const int w = text->lenght(list[i], 1); + const int h = text->getCharacterSize(); const int x = GAMECANVAS_CENTER_X; const int dx = -(w / 2); - const int y = GAMECANVAS_HEIGHT + (text_->getCharacterSize() * (i * 2)); + const int y = GAMECANVAS_HEIGHT + (text->getCharacterSize() * (i * 2)); // Crea la textura - auto texture = std::make_shared(renderer_); + auto texture = std::make_shared(Screen::get()->getRenderer()); texture->createBlank(w, h); - texture->setAsRenderTarget(renderer_); + texture->setAsRenderTarget(Screen::get()->getRenderer()); texture->setBlendMode(SDL_BLENDMODE_BLEND); - text_->write(0, 0, list[i]); + text->write(0, 0, list[i]); // Crea el sprite SDL_Rect pos = {x + dx, y, w, h}; texts_.emplace_back(std::make_shared(texture, pos)); - texts_.back()->setVelY(sprite_desp_speed_); + texts_.back()->setVelY(SPRITE_DESP_SPEED_); } // Crea los últimos textos // El primer texto va a continuación del ultimo spriteText - const int start = sprite_texts_.back()->getPosY() + text_->getCharacterSize() * 15; + const int start = sprite_texts_.back()->getPosY() + text->getCharacterSize() * 15; list.clear(); list.push_back("THANK YOU"); list.push_back("FOR PLAYING!"); @@ -482,23 +483,23 @@ void Ending2::createTexts() for (int i = 0; i < (int)list.size(); ++i) { // Calcula constantes - const int w = text_->lenght(list[i], 1); - const int h = text_->getCharacterSize(); + const int w = text->lenght(list[i], 1); + const int h = text->getCharacterSize(); const int x = GAMECANVAS_CENTER_X; const int dx = -(w / 2); - const int y = start + (text_->getCharacterSize() * (i * 2)); + const int y = start + (text->getCharacterSize() * (i * 2)); // Crea la textura - auto texture = std::make_shared(renderer_); + auto texture = std::make_shared(Screen::get()->getRenderer()); texture->createBlank(w, h); - texture->setAsRenderTarget(renderer_); + texture->setAsRenderTarget(Screen::get()->getRenderer()); texture->setBlendMode(SDL_BLENDMODE_BLEND); - text_->write(0, 0, list[i]); + text->write(0, 0, list[i]); // Crea el sprite SDL_Rect pos = {x + dx, y, w, h}; texts_.emplace_back(std::make_shared(texture, pos)); - texts_.back()->setVelY(sprite_desp_speed_); + texts_.back()->setVelY(SPRITE_DESP_SPEED_); } } @@ -506,12 +507,12 @@ void Ending2::createTexts() void Ending2::updateFinalFade() { // La variable step va de 0 a 40 en el tramo de postCounter que va de 500 a 540. Al dividirlo por 40, va de 0.0f a 1.0f - const float step = std::min(std::max(post_counter_, 500) - 500, 40) / 40.0f; - const int index = (colors_.size() - 1) * step; + const float STEP = std::min(std::max(post_counter_, 500) - 500, 40) / 40.0f; + const int INDEX = (colors_.size() - 1) * STEP; - for (const auto &t : texts_) + for (const auto &text : texts_) { - t->getTexture()->setColor(colors_[index].r, colors_[index].g, colors_[index].b); + text->getTexture()->setColor(colors_.at(INDEX).r, colors_.at(INDEX).g, colors_.at(INDEX).b); } } diff --git a/source/ending2.h b/source/ending2.h index a2959cf..cd9f438 100644 --- a/source/ending2.h +++ b/source/ending2.h @@ -20,16 +20,15 @@ class Ending2 { private: // Constantes - static constexpr int FIRST_COL_ = GAMECANVAS_FIRST_QUARTER_X + (GAMECANVAS_WIDTH / 16); // Primera columna por donde desfilan los sprites - static constexpr int SECOND_COL_ = GAMECANVAS_THIRD_QUARTER_X - (GAMECANVAS_WIDTH / 16); // Segunda columna por donde desfilan los sprites + static constexpr int FIRST_COL_ = + GAMECANVAS_FIRST_QUARTER_X + (GAMECANVAS_WIDTH / 16); // Primera columna por donde desfilan los sprites + static constexpr int SECOND_COL_ = + GAMECANVAS_THIRD_QUARTER_X - (GAMECANVAS_WIDTH / 16); // Segunda columna por donde desfilan los sprites + static constexpr int DIST_SPRITE_TEXT_ = 8; // Distancia entre el sprite y el texto que lo acompaña + static constexpr int DIST_SPRITE_SPRITE_ = 0; // Distancia entre dos sprites de la misma columna + static constexpr float SPRITE_DESP_SPEED_ = -0.2f; // Velocidad de desplazamiento de los sprites // Objetos y punteros - Screen *screen_; // Objeto encargado de dibujar en pantalla - SDL_Renderer *renderer_; // El renderizador de la ventana - Resource *resource_; // Objeto con los recursos - Asset *asset_; // Objeto con los ficheros de recursos - Input *input_; // Objeto pata gestionar la entrada - std::shared_ptr text_; // Objeto para escribir texto en pantalla std::vector> sprites_; // Vector con todos los sprites a dibujar std::vector> sprite_texts_; // Vector con los sprites de texto de los sprites std::vector> texts_; // Vector con los sprites de texto @@ -40,14 +39,10 @@ private: int post_counter_; // Contador posterior bool post_counter_enabled_; // Indica si está habilitado el contador Uint32 ticks_; // Contador de ticks para ajustar la velocidad del programa - JA_Music_t *music_; // Musica que suena durante el final std::vector sprite_list_; // Lista con todos los sprites a dibujar std::vector colors_; // Vector con los colores para el fade int sprite_max_width_; // El valor de ancho del sprite mas ancho int sprite_max_height_; // El valor de alto del sprite mas alto - int dist_sprite_text_; // Distancia entre el sprite y el texto que lo acompaña - int dist_sprite_sprite_; // Distancia entre dos sprites de la misma columna - float sprite_desp_speed_; // Velocidad de desplazamiento de los sprites // Actualiza el objeto void update(); diff --git a/source/enemy.cpp b/source/enemy.cpp index 27a0c8b..9ae5af4 100644 --- a/source/enemy.cpp +++ b/source/enemy.cpp @@ -7,7 +7,7 @@ #include "texture.h" // for Texture // Constructor -Enemy::Enemy(const EnemyData enemy) +Enemy::Enemy(const EnemyData &enemy) : sprite_(std::make_shared(Resource::get()->getTexture(enemy.texture_path), Resource::get()->getAnimations(enemy.animation_path))), color_string_(enemy.color), x1_(enemy.x1), diff --git a/source/enemy.h b/source/enemy.h index 156a210..631f9dd 100644 --- a/source/enemy.h +++ b/source/enemy.h @@ -49,7 +49,7 @@ private: public: // Constructor - explicit Enemy(const EnemyData enemy); + explicit Enemy(const EnemyData &enemy); // Destructor ~Enemy() = default; diff --git a/source/game.cpp b/source/game.cpp index a3729ad..12baf16 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -32,13 +32,16 @@ Game::Game() scoreboard_(std::make_shared(board_)), room_tracker_(std::make_shared()), stats_(std::make_shared(Asset::get()->get("stats.csv"), Asset::get()->get("stats_buffer.csv"))), - // test_surface_(std::make_shared(Screen::get()->getSurface(), "test.gif")), +#ifdef DEBUG + current_room_("03.room"), spawn_point_(PlayerSpawn(25 * BLOCK, 13 * BLOCK, 0, 0, 0, PlayerState::STANDING, SDL_FLIP_HORIZONTAL)) +#else + current_room_("03.room"), + spawn_point_(PlayerSpawn(25 * BLOCK, 13 * BLOCK, 0, 0, 0, PlayerState::STANDING, SDL_FLIP_HORIZONTAL)) +#endif { #ifdef DEBUG - current_room_ = "03.room"; - spawn_point_ = PlayerSpawn(25 * BLOC, 13 * BLOCK, 0, 0, 0, PlayerState::STANDING, SDL_FLIP_HORIZONTAL); - debug_->setEnabled(false); + Debug::get()->setEnabled(false); #endif // Crea objetos e inicializa variables @@ -127,7 +130,7 @@ void Game::update() checkInput(); #ifdef DEBUG - debug_->clear(); + Debug::get()->clear(); #endif // Actualiza los objetos @@ -182,15 +185,15 @@ void Game::render() // Pasa la información de debug void Game::updateDebugInfo() { - debug_->add("X = " + std::to_string(static_cast(player_->x_)) + ", Y = " + std::to_string(static_cast(player_->y_))); - debug_->add("VX = " + std::to_string(player_->vx_).substr(0, 4) + ", VY = " + std::to_string(player_->vy_).substr(0, 4)); - debug_->add("STATE = " + std::to_string(static_cast(player_->state_))); + Debug::get()->add("X = " + std::to_string(static_cast(player_->x_)) + ", Y = " + std::to_string(static_cast(player_->y_))); + Debug::get()->add("VX = " + std::to_string(player_->vx_).substr(0, 4) + ", VY = " + std::to_string(player_->vy_).substr(0, 4)); + Debug::get()->add("STATE = " + std::to_string(static_cast(player_->state_))); } // Pone la información de debug en pantalla void Game::renderDebugInfo() { - if (!debug_->getEnabled()) + if (!Debug::get()->getEnabled()) { return; } @@ -212,8 +215,8 @@ void Game::renderDebugInfo() } // Pinta el texto - debug_->setPos({1, 18 * 8}); - debug_->render(); + Debug::get()->setPos({1, 18 * 8}); + Debug::get()->render(); } // Comprueba los eventos @@ -639,7 +642,7 @@ void Game::checkEndGameCheevos() } // Inicializa al jugador -void Game::initPlayer(PlayerSpawn spawn_point, std::shared_ptr room) +void Game::initPlayer(const PlayerSpawn &spawn_point, std::shared_ptr room) { std::string player_texture = options.cheats.alternate_skin == Cheat::CheatState::ENABLED ? "player2.png" : "player.png"; std::string player_animations = options.cheats.alternate_skin == Cheat::CheatState::ENABLED ? "player2.ani" : "player.ani"; diff --git a/source/game.h b/source/game.h index 1fa9250..990ab38 100644 --- a/source/game.h +++ b/source/game.h @@ -8,7 +8,6 @@ #include "player.h" // Para playerSpawn_t #include "scoreboard.h" // Para board_t #include "room.h" -// #include "surface.h" class Asset; class Cheevos; class Debug; @@ -36,17 +35,16 @@ private: std::shared_ptr player_; // Objeto con el jugador std::shared_ptr stats_; // Objeto encargado de gestionar las estadísticas SDL_Texture *room_name_texture_; // Textura para escribir el nombre de la habitación - // std::shared_ptr test_surface_; // Variables - Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa - std::string current_room_ = "03.room"; // Fichero de la habitación actual - PlayerSpawn spawn_point_; // Lugar de la habitación donde aparece el jugador - bool paused_ = false; // Indica si el juego se encuentra en pausa - bool black_screen_ = false; // Indica si la pantalla está en negro. Se utiliza para la muerte del jugador - int black_screen_counter_ = 0; // Contador para temporizar la pantalla en negro - int total_items_; // Cantidad total de items que hay en el mapeado del juego - SDL_Rect room_name_rect_; // Rectangulo donde pintar la textura con el nombre de la habitación + Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa + std::string current_room_; // Fichero de la habitación actual + PlayerSpawn spawn_point_; // Lugar de la habitación donde aparece el jugador + bool paused_ = false; // Indica si el juego se encuentra en pausa + bool black_screen_ = false; // Indica si la pantalla está en negro. Se utiliza para la muerte del jugador + int black_screen_counter_ = 0; // Contador para temporizar la pantalla en negro + int total_items_; // Cantidad total de items que hay en el mapeado del juego + SDL_Rect room_name_rect_; // Rectangulo donde pintar la textura con el nombre de la habitación // Actualiza el juego, las variables, comprueba la entrada, etc. void update(); @@ -132,7 +130,7 @@ private: void checkEndGameCheevos(); // Inicializa al jugador - void initPlayer(PlayerSpawn spawn_point, std::shared_ptr room); + void initPlayer(const PlayerSpawn &spawn_point, std::shared_ptr room); // Crea la textura para poner el nombre de la habitación void createRoomNameTexture(); diff --git a/source/options.h b/source/options.h index b9e190f..b53126d 100644 --- a/source/options.h +++ b/source/options.h @@ -212,10 +212,10 @@ struct OptionsStats worst_nightmare("") {} // Constructor - OptionsStats(int r, int i, const std::string wn) - : rooms(r), - items(i), - worst_nightmare(wn) {} + OptionsStats(int rooms, int items, const std::string &worst_nightmare) + : rooms(rooms), + items(items), + worst_nightmare(worst_nightmare) {} }; // Estructura con opciones de la ventana diff --git a/source/room.cpp b/source/room.cpp index c724510..a56c242 100644 --- a/source/room.cpp +++ b/source/room.cpp @@ -1415,11 +1415,11 @@ bool Room::checkAutoSurfaces(SDL_Point *p) } // Comprueba las colisiones -int Room::checkLeftSlopes(v_line_t *line) +int Room::checkLeftSlopes(const v_line_t *line) { - for (auto s : left_slopes_) + for (auto slope : left_slopes_) { - const SDL_Point p = checkCollision(s, *line); + const SDL_Point p = checkCollision(slope, *line); if (p.x != -1) { return p.y; @@ -1432,9 +1432,9 @@ int Room::checkLeftSlopes(v_line_t *line) // Comprueba las colisiones bool Room::checkLeftSlopes(SDL_Point *p) { - for (auto s : left_slopes_) + for (auto slope : left_slopes_) { - if (checkCollision(*p, s)) + if (checkCollision(*p, slope)) { return true; } @@ -1444,11 +1444,11 @@ bool Room::checkLeftSlopes(SDL_Point *p) } // Comprueba las colisiones -int Room::checkRightSlopes(v_line_t *line) +int Room::checkRightSlopes(const v_line_t *line) { - for (auto s : right_slopes_) + for (auto slope : right_slopes_) { - const SDL_Point p = checkCollision(s, *line); + const SDL_Point p = checkCollision(slope, *line); if (p.x != -1) { return p.y; @@ -1461,9 +1461,9 @@ int Room::checkRightSlopes(v_line_t *line) // Comprueba las colisiones bool Room::checkRightSlopes(SDL_Point *p) { - for (auto s : right_slopes_) + for (auto slope : right_slopes_) { - if (checkCollision(*p, s)) + if (checkCollision(*p, slope)) { return true; } diff --git a/source/room.h b/source/room.h index c54f730..3e2a046 100644 --- a/source/room.h +++ b/source/room.h @@ -229,13 +229,13 @@ public: bool checkAutoSurfaces(SDL_Point *p); // Comprueba las colisiones - int checkLeftSlopes(v_line_t *line); + int checkLeftSlopes(const v_line_t *line); // Comprueba las colisiones bool checkLeftSlopes(SDL_Point *p); // Comprueba las colisiones - int checkRightSlopes(v_line_t *line); + int checkRightSlopes(const v_line_t *line); // Comprueba las colisiones bool checkRightSlopes(SDL_Point *p); diff --git a/source/scoreboard.cpp b/source/scoreboard.cpp index a31c4a3..3c6f946 100644 --- a/source/scoreboard.cpp +++ b/source/scoreboard.cpp @@ -101,27 +101,6 @@ Scoreboard::ClockData Scoreboard::getTime() return time; } -// Recarga la textura -void Scoreboard::reLoadTexture() -{ - player_sprite_->getTexture()->reLoad(); - // playerTexture->reLoad(); - item_texture_->reLoad(); - text_->reLoadTexture(); -} - -// Recarga la paleta -void Scoreboard::reLoadPalette() -{ - // Reinicia el vector de colores - const std::vector vColors = {"blue", "magenta", "green", "cyan", "yellow", "white", "bright_blue", "bright_magenta", "bright_green", "bright_cyan", "bright_yellow", "bright_white"}; - color_.clear(); - for (auto v : vColors) - { - color_.push_back(stringToColor(options.video.palette, v)); - } -} - // Pone el marcador en modo pausa void Scoreboard::setPaused(bool value) { diff --git a/source/scoreboard.h b/source/scoreboard.h index 9279394..68972e3 100644 --- a/source/scoreboard.h +++ b/source/scoreboard.h @@ -93,12 +93,6 @@ public: // Actualiza las variables del objeto void update(); - // Recarga la textura - void reLoadTexture(); - - // Recarga la paleta - void reLoadPalette(); - // Pone el marcador en modo pausa void setPaused(bool value);