From 1077c13fd043dba6bd8f0a593cb615faca63d1f9 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Mon, 30 Mar 2026 20:48:21 +0200 Subject: [PATCH] amb la consola oberta el jugador te els inputs deshabilitats. si moria amb la consola oberta, recuperava els inputs i es movia mentre escrius comandos en la consola --- source/game/entities/player.hpp | 1 + source/game/scenes/game.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/source/game/entities/player.hpp b/source/game/entities/player.hpp index 9262436..bd9d685 100644 --- a/source/game/entities/player.hpp +++ b/source/game/entities/player.hpp @@ -106,6 +106,7 @@ class Player { [[nodiscard]] auto isAlive() const -> bool { return is_alive_; } // Comprueba si el jugador esta vivo void setPaused(bool value) { is_paused_ = value; } // Pone el jugador en modo pausa void setIgnoreInput(bool value) { ignore_input_ = value; } // Ignora inputs del jugador (física sigue activa) + [[nodiscard]] auto getIgnoreInput() const -> bool { return ignore_input_; } #ifdef _DEBUG // --- Funciones de debug --- diff --git a/source/game/scenes/game.cpp b/source/game/scenes/game.cpp index 9fcdd5f..1b52702 100644 --- a/source/game/scenes/game.cpp +++ b/source/game/scenes/game.cpp @@ -882,9 +882,11 @@ void Game::checkEndGameCheevos() { // NOLINT(readability-convert-member-functio // Inicializa al jugador void Game::initPlayer(const Player::SpawnData& spawn_point, std::shared_ptr room) { // NOLINT(readability-convert-member-functions-to-static) + const bool IGNORE_INPUT = player_ != nullptr && player_->getIgnoreInput(); std::string player_animations = (Options::game.player_skin == 2) ? "player2.yaml" : "player.yaml"; const Player::Data PLAYER{.spawn_data = spawn_point, .animations_path = player_animations, .room = std::move(room)}; player_ = std::make_shared(PLAYER); + if (IGNORE_INPUT) { player_->setIgnoreInput(true); } } // Crea la textura para poner el nombre de la habitación