From df54930e140e56c8c03ed7b4e05adb56a1979c86 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Wed, 26 Nov 2025 09:55:25 +0100 Subject: [PATCH] eliminat MES codi del JDD --- data/room/03.yaml | 3 +- docker/Dockerfile.build | 46 ----------------- docker/docker-compose.runner.yml | 28 ----------- source/game/gameplay/room.cpp | 5 +- source/game/gameplay/room.hpp | 3 -- source/game/gameplay/room_loader.cpp | 3 -- source/game/scenes/game.cpp | 75 ---------------------------- source/game/scenes/game.hpp | 11 ---- 8 files changed, 3 insertions(+), 171 deletions(-) delete mode 100644 docker/Dockerfile.build delete mode 100644 docker/docker-compose.runner.yml diff --git a/data/room/03.yaml b/data/room/03.yaml index b7752bc..ff177e1 100644 --- a/data/room/03.yaml +++ b/data/room/03.yaml @@ -1,6 +1,5 @@ -# VOID MAIN +# 03 room: - name: "VOID MAIN" bgColor: blue border: mauve tileSetFile: standard.gif diff --git a/docker/Dockerfile.build b/docker/Dockerfile.build deleted file mode 100644 index 10d0857..0000000 --- a/docker/Dockerfile.build +++ /dev/null @@ -1,46 +0,0 @@ -# Imagen para compilar pollo en múltiples plataformas -# Incluye herramientas para: Linux x64, Windows x64 (cross), Raspberry Pi ARM64 (cross) -# SDL3 se compila en cada job del workflow - -FROM ubuntu:24.04 - -ENV DEBIAN_FRONTEND=noninteractive - -# Herramientas básicas de build -RUN apt-get update && apt-get install -y \ - build-essential \ - cmake \ - git \ - pkg-config \ - wget \ - tar \ - gzip \ - zip \ - # Node.js (requerido para GitHub/Gitea Actions) - nodejs \ - npm \ - # Cross-compilación Windows - mingw-w64 \ - # Cross-compilación Raspberry Pi ARM64 - gcc-aarch64-linux-gnu \ - g++-aarch64-linux-gnu \ - # Dependencias para compilar SDL3 (Linux nativo) - libgl1-mesa-dev \ - libglu1-mesa-dev \ - libx11-dev \ - libxext-dev \ - libxrandr-dev \ - libxcursor-dev \ - libxi-dev \ - libxinerama-dev \ - libxxf86vm-dev \ - libxss-dev \ - libasound2-dev \ - libpulse-dev \ - libudev-dev \ - libdbus-1-dev \ - libwayland-dev \ - libxkbcommon-dev \ - && rm -rf /var/lib/apt/lists/* - -WORKDIR /workspace diff --git a/docker/docker-compose.runner.yml b/docker/docker-compose.runner.yml deleted file mode 100644 index 44ea2b2..0000000 --- a/docker/docker-compose.runner.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Docker Compose para act_runner de Gitea Actions -# -# USO: -# 1. Obtener token de registro en Gitea > Settings > Actions > Runners -# 2. Actualizar GITEA_RUNNER_REGISTRATION_TOKEN abajo -# 3. Iniciar: docker compose -f docker-compose.runner.yml up -d runner -# 4. Ver logs: docker compose -f docker-compose.runner.yml logs -f runner - -services: - runner: - image: gitea/act_runner:latest - container_name: gitea-runner-pollo - restart: unless-stopped - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - ./runner-data:/data - environment: - - GITEA_INSTANCE_URL=http://gitea:3000 - - GITEA_RUNNER_REGISTRATION_TOKEN=${RUNNER_TOKEN} - - GITEA_RUNNER_NAME=pollo-runner - - GITEA_RUNNER_LABELS=ubuntu-latest:docker://ubuntu:24.04,linux:docker://ubuntu:24.04 - - CONFIG_FILE=/data/config.yaml - networks: - - web - -networks: - web: - external: true diff --git a/source/game/gameplay/room.cpp b/source/game/gameplay/room.cpp index bf8a2cb..3b61f02 100644 --- a/source/game/gameplay/room.cpp +++ b/source/game/gameplay/room.cpp @@ -22,7 +22,7 @@ Room::Room(const std::string& room_path, std::shared_ptr data) // Crea los managers de enemigos e items enemy_manager_ = std::make_unique(); - item_manager_ = std::make_unique(room->name, data_); + item_manager_ = std::make_unique(room->number, data_); initializeRoom(*room); @@ -42,7 +42,6 @@ Room::~Room() = default; void Room::initializeRoom(const Data& room) { // Asignar valores a las variables miembro number_ = room.number; - name_ = room.name; bg_color_ = room.bg_color; border_color_ = room.border_color; item_color1_ = room.item_color1.empty() ? "yellow" : room.item_color1; @@ -68,7 +67,7 @@ void Room::initializeRoom(const Data& room) { for (const auto& item : room.items) { const SDL_FPoint ITEM_POS = {item.x, item.y}; - if (!ItemTracker::get()->hasBeenPicked(room.name, ITEM_POS)) { + if (!ItemTracker::get()->hasBeenPicked(room.number, ITEM_POS)) { // Crear una copia local de los datos del item Item::Data item_copy = item; item_copy.color1 = stringToColor(item_color1_); diff --git a/source/game/gameplay/room.hpp b/source/game/gameplay/room.hpp index 60a174e..615c727 100644 --- a/source/game/gameplay/room.hpp +++ b/source/game/gameplay/room.hpp @@ -39,7 +39,6 @@ class Room { struct Data { std::string number; // Numero de la habitación - std::string name; // Nombre de la habitación std::string bg_color; // Color de fondo de la habitación std::string border_color; // Color del borde de la pantalla std::string item_color1; // Color 1 para los items de la habitación @@ -61,7 +60,6 @@ class Room { ~Room(); // Definido en .cpp para poder usar unique_ptr con forward declarations // --- Funciones --- - [[nodiscard]] auto getName() const -> const std::string& { return name_; } // Devuelve el nombre de la habitación [[nodiscard]] auto getBGColor() const -> Uint8 { return stringToColor(bg_color_); } // Devuelve el color de la habitación [[nodiscard]] auto getBorderColor() const -> Uint8 { return stringToColor(border_color_); } // Devuelve el color del borde void renderMap(); // Dibuja el mapa en pantalla @@ -106,7 +104,6 @@ class Room { // --- Variables --- std::string number_; // Numero de la habitación - std::string name_; // Nombre de la habitación std::string bg_color_; // Color de fondo de la habitación std::string border_color_; // Color del borde de la pantalla std::string item_color1_; // Color 1 para los items de la habitación diff --git a/source/game/gameplay/room_loader.cpp b/source/game/gameplay/room_loader.cpp index f070b81..f28121d 100644 --- a/source/game/gameplay/room_loader.cpp +++ b/source/game/gameplay/room_loader.cpp @@ -63,9 +63,6 @@ void RoomLoader::parseRoomConfig(const fkyaml::node& yaml, Room::Data& room, con room.number = file_name.substr(0, file_name.find_last_of('.')); // Basic properties - if (room_node.contains("name")) { - room.name = room_node["name"].get_value(); - } if (room_node.contains("bgColor")) { room.bg_color = room_node["bgColor"].get_value(); } diff --git a/source/game/scenes/game.cpp b/source/game/scenes/game.cpp index ac8adb2..61de0d3 100644 --- a/source/game/scenes/game.cpp +++ b/source/game/scenes/game.cpp @@ -52,7 +52,6 @@ Game::Game(Mode mode) initPlayer(spawn_data_, room_); total_items_ = getTotalItems(); - createRoomNameTexture(); game_backbuffer_surface_ = std::make_shared(Options::game.width, Options::game.height); changeRoom(current_room_); @@ -177,8 +176,6 @@ void Game::updatePlaying(float delta_time) { handlePlayerAndItemsCollisions(); handlePlayerAndEnemiesCollisions(); handleIfPlayerIsAlive(); - isGameCompleted(); - restAtJail(delta_time); break; case Mode::DEMO: @@ -303,7 +300,6 @@ void Game::renderPlaying() { if (mode_ == Mode::GAME) { player_->render(); } - renderRoomName(); #ifdef _DEBUG if (!Debug::get()->isEnabled()) { scoreboard_->render(); @@ -348,7 +344,6 @@ void Game::renderFadeToEnding() { room_->renderEnemies(); room_->renderItems(); player_->render(); // Player congelado pero visible - renderRoomName(); scoreboard_->render(); // 4. Restaurar renderer original @@ -534,12 +529,6 @@ void Game::handleDebugMouseDrag(float delta_time) { } #endif -// Escribe el nombre de la pantalla -void Game::renderRoomName() { - // Dibuja la textura con el nombre de la habitación - room_name_surface_->render(nullptr, &room_name_rect_); -} - // Cambia de habitación auto Game::changeRoom(const std::string& room_path) -> bool { // En las habitaciones los limites tienen la cadena del fichero o un 0 en caso de no limitar con nada @@ -552,9 +541,6 @@ auto Game::changeRoom(const std::string& room_path) -> bool { // Crea un objeto habitación nuevo a partir del fichero room_ = std::make_shared(room_path, scoreboard_data_); - // Pone el nombre de la habitación en la textura - fillRoomNameTexture(); - // Pone el color del marcador en función del color del borde de la habitación setScoreBoardColor(); @@ -646,22 +632,6 @@ void Game::setScoreBoardColor() { scoreboard_data_->color = IS_BLACK ? Color::index(Color::Cpc::WHITE) : BORDER_COLOR; } -// Comprueba si ha finalizado el juego -auto Game::isGameCompleted() -> bool { - const bool IS_ON_THE_ROOM = room_->getName() == "THE JAIL"; // Estar en la habitación que toca - const bool HAVE_THE_ITEMS = scoreboard_data_->items >= int(total_items_ * 0.9F); // Con mas del 90% de los items recogidos - const bool IS_ON_THE_DOOR = player_->getRect().x <= 128; // Y en la ubicación que toca (En la puerta) - - if (HAVE_THE_ITEMS && IS_ON_THE_ROOM && IS_ON_THE_DOOR) { - // Iniciar transición de fade en vez de cambio inmediato de escena - transitionToState(State::FADE_TO_ENDING); - Audio::get()->fadeOutMusic(Defaults::Music::FADE_DURATION_MS); // Fade out de música - return true; - } - - return false; -} - // Obtiene la cantidad total de items que hay en el mapeado del juego auto Game::getTotalItems() -> int { int items = 0; @@ -683,57 +653,12 @@ void Game::togglePause() { scoreboard_->setPaused(paused_); } -// Da vidas al jugador cuando está en la Jail -void Game::restAtJail(float delta_time) { - if (room_->getName() != "THE JAIL" || scoreboard_data_->lives == 9) { - jail_restore_time_ = 0.0F; // Reset timer cuando no está en la Jail - return; - } - - if (!paused_) { - jail_restore_time_ += delta_time; - } - - // Incrementa el numero de vidas - if (jail_restore_time_ >= JAIL_RESTORE_INTERVAL) { - jail_restore_time_ -= JAIL_RESTORE_INTERVAL; // Mantiene el excedente para precisión - scoreboard_data_->lives++; - Audio::get()->playSound(Defaults::Sound::HIT, Audio::Group::GAME); - } -} - -// Crea la textura con el nombre de la habitación -void Game::fillRoomNameTexture() { - // Pone la textura como destino de renderizado - auto previuos_renderer = Screen::get()->getRendererSurface(); - Screen::get()->setRendererSurface(room_name_surface_); - - // Rellena la textura de color - room_name_surface_->clear(stringToColor("white")); - - // Escribe el texto en la textura - auto text = Resource::Cache::get()->getText("smb2"); - text->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, GameCanvas::CENTER_X, text->getCharacterSize() / 2, room_->getName(), 1, room_->getBGColor()); - - // Deja el renderizador por defecto - Screen::get()->setRendererSurface(previuos_renderer); -} - // Inicializa al jugador void Game::initPlayer(const Player::SpawnData& spawn_point, std::shared_ptr room) { const Player::Data PLAYER{.spawn_data = spawn_point, .animations_path = "player.yaml", .room = std::move(room)}; player_ = std::make_shared(PLAYER); } -// Crea la textura para poner el nombre de la habitación -void Game::createRoomNameTexture() { - auto text = Resource::Cache::get()->getText("smb2"); - room_name_surface_ = std::make_shared(Options::game.width, text->getCharacterSize() * 2); - - // Establece el destino de la textura - room_name_rect_ = {.x = 0.0F, .y = PlayArea::HEIGHT, .w = Options::game.width, .h = text->getCharacterSize() * 2.0F}; -} - // Hace sonar la música void Game::keepMusicPlaying() { const std::string MUSIC_PATH = mode_ == Mode::GAME ? Defaults::Music::GAME_TRACK : Defaults::Music::TITLE_TRACK; diff --git a/source/game/scenes/game.hpp b/source/game/scenes/game.hpp index 111f948..752e9ed 100644 --- a/source/game/scenes/game.hpp +++ b/source/game/scenes/game.hpp @@ -42,7 +42,6 @@ class Game { static constexpr float BLACK_SCREEN_DURATION = 0.30F; // Duración de la pantalla negra en segundos (20 frames a 66.67fps) static constexpr float GAME_OVER_THRESHOLD = 0.255F; // Tiempo antes del game over en segundos (17 frames a 66.67fps) static constexpr float DEMO_ROOM_DURATION = 6.0F; // Duración de cada habitación en modo demo en segundos (400 frames) - static constexpr float JAIL_RESTORE_INTERVAL = 1.5F; // Intervalo de restauración de vidas en la Jail en segundos (100 frames) static constexpr float FADE_STEP_INTERVAL = 0.05F; // Intervalo entre pasos de fade en segundos static constexpr float POST_FADE_DELAY = 2.0F; // Duración de la pantalla negra después del fade @@ -57,7 +56,6 @@ class Game { void update(); // Actualiza el juego, las variables, comprueba la entrada, etc. void render(); // Pinta los objetos en pantalla void handleEvents(); // Comprueba los eventos de la cola - void renderRoomName(); // Escribe el nombre de la pantalla void transitionToState(State new_state); // Cambia al estado especificado y resetea los timers void updatePlaying(float delta_time); // Actualiza el juego en estado PLAYING void updateBlackScreen(float delta_time); // Actualiza el juego en estado BLACK_SCREEN @@ -77,15 +75,11 @@ class Game { void handleIfPlayerIsAlive(); // Comprueba si el jugador esta vivo void killPlayer(); // Mata al jugador void setScoreBoardColor(); // Pone el color del marcador en función del color del borde de la habitación - auto isGameCompleted() -> bool; // Comprueba si ha finalizado el juego static auto getTotalItems() -> int; // Obtiene la cantidad total de items que hay en el mapeado del juego void togglePause(); // Pone el juego en pausa - void restAtJail(float delta_time); // Da vidas al jugador cuando está en la Jail - void fillRoomNameTexture(); // Pone el nombre de la habitación en la textura void checkSomeCheevos(); // Comprueba algunos logros void checkEndGameCheevos(); // Comprueba los logros de completar el juego void initPlayer(const Player::SpawnData& spawn_point, std::shared_ptr room); // Inicializa al jugador - void createRoomNameTexture(); // Crea la textura para poner el nombre de la habitación void keepMusicPlaying(); // Hace sonar la música void demoInit(); // DEMO MODE: Inicializa las variables para el modo demo void demoCheckRoomChange(float delta_time); // DEMO MODE: Comprueba si se ha de cambiar de habitación @@ -103,7 +97,6 @@ class Game { std::shared_ptr room_tracker_; // Lleva el control de las habitaciones visitadas std::shared_ptr room_; // Objeto encargado de gestionar cada habitación del juego std::shared_ptr player_; // Objeto con el jugador - std::shared_ptr room_name_surface_; // Textura para escribir el nombre de la habitación std::shared_ptr game_backbuffer_surface_; // Backbuffer para efectos de fade // Variables de estado del juego @@ -120,10 +113,6 @@ class Game { // Variables de demo mode DemoData demo_; // Variables para el modo demo - // Variables de efectos visuales - SDL_FRect room_name_rect_; // Rectangulo donde pintar la textura con el nombre de la habitación - float jail_restore_time_{0.0F}; // Tiempo acumulado para restauración de vidas en la Jail - #ifdef _DEBUG // Variables de debug para arrastre con ratón bool debug_dragging_player_{false}; // Indica si estamos arrastrando al jugador con el ratón