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)};

View File

@@ -94,7 +94,7 @@ void Logo::updateJAILGAMES(float delta_time) {
}
// Calcula el índice de color según el progreso (0.0-1.0)
auto Logo::getColorIndex(float progress) const -> int { // NOLINT(readability-convert-member-functions-to-static)
auto Logo::getColorIndex(float progress) const -> int {
// Asegurar que progress esté en el rango [0.0, 1.0]
progress = std::clamp(progress, 0.0F, 1.0F);
@@ -213,7 +213,7 @@ void Logo::update() {
}
// Dibuja en pantalla
void Logo::render() { // NOLINT(readability-convert-member-functions-to-static)
void Logo::render() {
// Prepara para empezar a dibujar en la textura de juego
Screen::get()->start();
Screen::get()->clearSurface(0);
@@ -234,7 +234,7 @@ void Logo::endSection() {
}
// Inicializa el vector de colores
void Logo::initColors() { // NOLINT(readability-convert-member-functions-to-static)
void Logo::initColors() {
// Inicializa el vector de colores
const std::vector<Uint8> COLORS = {
0,
@@ -251,7 +251,7 @@ void Logo::initColors() { // NOLINT(readability-convert-member-functions-to-sta
}
// Crea los sprites de cada linea
void Logo::initSprites() { // NOLINT(readability-convert-member-functions-to-static)
void Logo::initSprites() {
const float WIDTH = jailgames_surface_->getWidth();
jailgames_initial_x_.reserve(jailgames_surface_->getHeight());

View File

@@ -351,7 +351,7 @@ auto Title::isKeyValid(SDL_Scancode scancode) -> bool {
}
// Verifica si una tecla ya fue usada en pasos anteriores
auto Title::isKeyDuplicate(SDL_Scancode scancode, int current_step) -> bool { // NOLINT(readability-convert-member-functions-to-static)
auto Title::isKeyDuplicate(SDL_Scancode scancode, int current_step) -> bool {
for (int i = 0; i < current_step; i++) {
if (temp_keys_[i] == scancode) {
return true;
@@ -361,7 +361,7 @@ auto Title::isKeyDuplicate(SDL_Scancode scancode, int current_step) -> bool { /
}
// Aplica y guarda las teclas redefinidas
void Title::applyKeyboardRemap() { // NOLINT(readability-convert-member-functions-to-static)
void Title::applyKeyboardRemap() {
// Guardar las nuevas teclas en Options::controls
Options::keyboard_controls.key_left = temp_keys_[0];
Options::keyboard_controls.key_right = temp_keys_[1];
@@ -399,17 +399,17 @@ void Title::renderKeyboardRemap() const {
const int KEYS_START_Y = START_Y + (2 * LINE_SPACING);
if (remap_step_ > 0) {
const std::string LEFT_KEY = SDL_GetScancodeName(temp_keys_[0]);
const std::string LEFT_MSG = loc->get("title.keys.label0") + LEFT_KEY; // NOLINT(readability-static-accessed-through-instance)
const std::string LEFT_MSG = loc->get("title.keys.label0") + LEFT_KEY;
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, KEYS_START_Y, LEFT_MSG, 1, COLOR);
}
if (remap_step_ > 1) {
const std::string RIGHT_KEY = SDL_GetScancodeName(temp_keys_[1]);
const std::string RIGHT_MSG = loc->get("title.keys.label1") + RIGHT_KEY; // NOLINT(readability-static-accessed-through-instance)
const std::string RIGHT_MSG = loc->get("title.keys.label1") + RIGHT_KEY;
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, KEYS_START_Y + LINE_SPACING, RIGHT_MSG, 1, COLOR);
}
if (remap_step_ >= 3) {
const std::string JUMP_KEY = SDL_GetScancodeName(temp_keys_[2]);
const std::string JUMP_MSG = loc->get("title.keys.label2") + JUMP_KEY; // NOLINT(readability-static-accessed-through-instance)
const std::string JUMP_MSG = loc->get("title.keys.label2") + JUMP_KEY;
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, KEYS_START_Y + (2 * LINE_SPACING), JUMP_MSG, 1, COLOR);
}
@@ -443,17 +443,17 @@ void Title::renderJoystickRemap() const {
const int BUTTONS_START_Y = START_Y + (2 * LINE_SPACING);
if (remap_step_ > 0) {
const std::string LEFT_BTN = getButtonName(temp_buttons_[0]);
const std::string LEFT_MSG = loc->get("title.keys.label0") + LEFT_BTN; // NOLINT(readability-static-accessed-through-instance)
const std::string LEFT_MSG = loc->get("title.keys.label0") + LEFT_BTN;
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, BUTTONS_START_Y, LEFT_MSG, 1, COLOR);
}
if (remap_step_ > 1) {
const std::string RIGHT_BTN = getButtonName(temp_buttons_[1]);
const std::string RIGHT_MSG = loc->get("title.keys.label1") + RIGHT_BTN; // NOLINT(readability-static-accessed-through-instance)
const std::string RIGHT_MSG = loc->get("title.keys.label1") + RIGHT_BTN;
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, BUTTONS_START_Y + LINE_SPACING, RIGHT_MSG, 1, COLOR);
}
if (remap_step_ >= 3) {
const std::string JUMP_BTN = getButtonName(temp_buttons_[2]);
const std::string JUMP_MSG = loc->get("title.keys.label2") + JUMP_BTN; // NOLINT(readability-static-accessed-through-instance)
const std::string JUMP_MSG = loc->get("title.keys.label2") + JUMP_BTN;
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, BUTTONS_START_Y + (2 * LINE_SPACING), JUMP_MSG, 1, COLOR);
}
@@ -522,7 +522,7 @@ void Title::handleJoystickRemap(const SDL_Event& event) {
}
// Valida si un botón está duplicado
auto Title::isButtonDuplicate(int button, int current_step) -> bool { // NOLINT(readability-convert-member-functions-to-static)
auto Title::isButtonDuplicate(int button, int current_step) -> bool {
for (int i = 0; i < current_step; ++i) {
if (temp_buttons_[i] == button) {
return true;
@@ -532,7 +532,7 @@ auto Title::isButtonDuplicate(int button, int current_step) -> bool { // NOLINT
}
// Aplica y guarda los botones del gamepad redefinidos
void Title::applyJoystickRemap() { // NOLINT(readability-convert-member-functions-to-static)
void Title::applyJoystickRemap() {
// Guardar los nuevos botones en Options::gamepad_controls
Options::gamepad_controls.button_left = temp_buttons_[0];
Options::gamepad_controls.button_right = temp_buttons_[1];
@@ -546,7 +546,7 @@ void Title::applyJoystickRemap() { // NOLINT(readability-convert-member-functio
}
// Retorna el nombre amigable del botón del gamepad
auto Title::getButtonName(int button) -> std::string { // NOLINT(readability-convert-member-functions-to-static)
auto Title::getButtonName(int button) -> std::string {
// Triggers especiales
if (button == Input::TRIGGER_L2_AS_BUTTON) {
return "L2";