This commit is contained in:
2026-04-11 18:40:03 +02:00
parent bb38600aac
commit 72741896c1
27 changed files with 163 additions and 163 deletions

View File

@@ -210,10 +210,10 @@ void Game::handleEvents() {
if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_9 && static_cast<int>(event.key.repeat) == 0) {
if (MapEditor::get()->isActive()) {
GameControl::exit_editor();
Notifier::get()->show({Locale::get()->get("game.editor_disabled")}); // NOLINT(readability-static-accessed-through-instance)
Notifier::get()->show({Locale::get()->get("game.editor_disabled")});
} else {
GameControl::enter_editor();
Notifier::get()->show({Locale::get()->get("game.editor_enabled")}); // NOLINT(readability-static-accessed-through-instance)
Notifier::get()->show({Locale::get()->get("game.editor_enabled")});
}
} else if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_G && static_cast<int>(event.key.repeat) == 0 && MapEditor::get()->isActive()) {
MapEditor::get()->showGrid(!MapEditor::get()->isGridEnabled());
@@ -259,9 +259,9 @@ void Game::handleInput() {
}
// Input de pausa solo en estado PLAYING
if (Input::get()->checkAction(InputAction::PAUSE, Input::DO_NOT_ALLOW_REPEAT)) { // NOLINT(readability-static-accessed-through-instance)
if (Input::get()->checkAction(InputAction::PAUSE, Input::DO_NOT_ALLOW_REPEAT)) {
togglePause();
Notifier::get()->show({paused_ ? Locale::get()->get("game.paused") : Locale::get()->get("game.running")}); // NOLINT(readability-static-accessed-through-instance)
Notifier::get()->show({paused_ ? Locale::get()->get("game.paused") : Locale::get()->get("game.running")});
}
GlobalInputs::handle();
@@ -611,7 +611,7 @@ void Game::renderPostFadeEnding() {
static void toggleCheat(Options::Cheat::State& cheat, const std::string& label) {
cheat = (cheat == Options::Cheat::State::ENABLED) ? Options::Cheat::State::DISABLED : Options::Cheat::State::ENABLED;
const bool ENABLED = (cheat == Options::Cheat::State::ENABLED);
Notifier::get()->show({label + (ENABLED ? Locale::get()->get("game.enabled") : Locale::get()->get("game.disabled"))}, Notifier::Style::DEFAULT, -1, true); // NOLINT(readability-static-accessed-through-instance)
Notifier::get()->show({label + (ENABLED ? Locale::get()->get("game.enabled") : Locale::get()->get("game.disabled"))}, Notifier::Style::DEFAULT, -1, true);
}
// Pone la información de debug en pantalla
@@ -638,7 +638,7 @@ void Game::renderDebugInfo() {
}
// Comprueba los eventos
void Game::handleDebugEvents(const SDL_Event& event) { // NOLINT(readability-convert-member-functions-to-static)
void Game::handleDebugEvents(const SDL_Event& event) {
if (event.type == SDL_EVENT_KEY_DOWN && static_cast<int>(event.key.repeat) == 0) {
switch (event.key.key) {
case SDLK_R:
@@ -662,15 +662,15 @@ void Game::handleDebugEvents(const SDL_Event& event) { // NOLINT(readability-co
break;
case SDLK_1:
toggleCheat(Options::cheats.infinite_lives, Locale::get()->get("game.cheat_infinite_lives")); // NOLINT(readability-static-accessed-through-instance)
toggleCheat(Options::cheats.infinite_lives, Locale::get()->get("game.cheat_infinite_lives"));
break;
case SDLK_2:
toggleCheat(Options::cheats.invincible, Locale::get()->get("game.cheat_invincible")); // NOLINT(readability-static-accessed-through-instance)
toggleCheat(Options::cheats.invincible, Locale::get()->get("game.cheat_invincible"));
break;
case SDLK_7:
Notifier::get()->show({Locale::get()->get("achievements.header"), Locale::get()->get("achievements.c11")}, Notifier::Style::CHEEVO, -1, false, "F7"); // NOLINT(readability-static-accessed-through-instance)
Notifier::get()->show({Locale::get()->get("achievements.header"), Locale::get()->get("achievements.c11")}, Notifier::Style::CHEEVO, -1, false, "F7");
break;
case SDLK_0: {
@@ -679,7 +679,7 @@ void Game::handleDebugEvents(const SDL_Event& event) { // NOLINT(readability-co
invincible_before_debug_ = (Options::cheats.invincible == Options::Cheat::State::ENABLED);
}
Debug::get()->toggleEnabled();
Notifier::get()->show({Debug::get()->isEnabled() ? Locale::get()->get("game.debug_enabled") : Locale::get()->get("game.debug_disabled")}); // NOLINT(readability-static-accessed-through-instance)
Notifier::get()->show({Debug::get()->isEnabled() ? Locale::get()->get("game.debug_enabled") : Locale::get()->get("game.debug_disabled")});
room_->redrawMap();
if (Debug::get()->isEnabled()) {
Options::cheats.invincible = Options::Cheat::State::ENABLED;
@@ -779,7 +779,7 @@ auto Game::changeRoom(const std::string& room_path) -> bool {
}
// Verifica que exista el fichero que se va a cargar
if (!Resource::List::get()->get(room_path).empty()) { // NOLINT(readability-static-accessed-through-instance)
if (!Resource::List::get()->get(room_path).empty()) {
// Obtiene la habitación del caché o la crea
room_ = getOrCreateRoom(room_path);
@@ -1013,7 +1013,7 @@ void Game::togglePause() {
}
// Inicializa al jugador
void Game::initPlayer(const Player::SpawnData& spawn_point, std::shared_ptr<Room> room) { // NOLINT(readability-convert-member-functions-to-static)
void Game::initPlayer(const Player::SpawnData& spawn_point, std::shared_ptr<Room> room) {
const bool IGNORE_INPUT = player_ != nullptr && player_->getIgnoreInput();
std::string player_animations = Player::skinToAnimationPath(Defaults::Game::Player::SKIN);
const Player::Data PLAYER{.spawn_data = spawn_point, .animations_path = player_animations, .room = std::move(room)};