clang-tidy

This commit is contained in:
2026-03-21 23:08:07 +01:00
parent d946ab7943
commit 55b58ded70
19 changed files with 112 additions and 155 deletions

View File

@@ -366,6 +366,13 @@ void Game::renderPostFadeEnding() {
}
#ifdef _DEBUG
// Helper: alterna un cheat y muestra notificación con su estado
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 ? " ENABLED" : " DISABLED")}, Notifier::Style::DEFAULT, -1, true);
}
// Pasa la información de debug
void Game::updateDebugInfo() {
// Debug::get()->add("X = " + std::to_string(static_cast<int>(player_->x_)) + ", Y = " + std::to_string(static_cast<int>(player_->y_)));
@@ -437,20 +444,17 @@ void Game::handleDebugEvents(const SDL_Event& event) {
break;
case SDLK_1:
Options::cheats.infinite_lives = Options::cheats.infinite_lives == Options::Cheat::State::ENABLED ? Options::Cheat::State::DISABLED : Options::Cheat::State::ENABLED;
Notifier::get()->show({std::string("INFINITE LIVES ") + (Options::cheats.infinite_lives == Options::Cheat::State::ENABLED ? "ENABLED" : "DISABLED")}, Notifier::Style::DEFAULT, -1, true);
toggleCheat(Options::cheats.infinite_lives, "INFINITE LIVES");
player_->setColor();
break;
case SDLK_2:
Options::cheats.invincible = Options::cheats.invincible == Options::Cheat::State::ENABLED ? Options::Cheat::State::DISABLED : Options::Cheat::State::ENABLED;
Notifier::get()->show({std::string("INVINCIBLE ") + (Options::cheats.invincible == Options::Cheat::State::ENABLED ? "ENABLED" : "DISABLED")}, Notifier::Style::DEFAULT, -1, true);
toggleCheat(Options::cheats.invincible, "INVINCIBLE");
player_->setColor();
break;
case SDLK_3:
Options::cheats.jail_is_open = Options::cheats.jail_is_open == Options::Cheat::State::ENABLED ? Options::Cheat::State::DISABLED : Options::Cheat::State::ENABLED;
Notifier::get()->show({std::string("JAIL IS OPEN ") + (Options::cheats.jail_is_open == Options::Cheat::State::ENABLED ? "ENABLED" : "DISABLED")}, Notifier::Style::DEFAULT, -1, true);
toggleCheat(Options::cheats.jail_is_open, "JAIL IS OPEN");
break;
case SDLK_7:
@@ -506,7 +510,7 @@ void Game::handleDebugMouseDrag(float delta_time) {
// Calcular distancia al objetivo
float dx = game_x - player_x;
float dy = game_y - player_y;
float distance = std::sqrt(dx * dx + dy * dy);
float distance = std::sqrt((dx * dx) + (dy * dy));
// Constantes de velocidad con ease-in (aceleración progresiva)
constexpr float DRAG_SPEED_MIN = 30.0F; // Velocidad inicial (pixels/segundo)
@@ -517,13 +521,13 @@ void Game::handleDebugMouseDrag(float delta_time) {
if (!debug_dragging_player_) {
debug_drag_speed_ = DRAG_SPEED_MIN; // Iniciar con velocidad mínima
}
debug_drag_speed_ = std::min(DRAG_SPEED_MAX, debug_drag_speed_ + DRAG_ACCELERATION * delta_time);
debug_drag_speed_ = std::min(DRAG_SPEED_MAX, debug_drag_speed_ + (DRAG_ACCELERATION * delta_time));
if (distance > 1.0F) {
// Calcular el movimiento con la velocidad actual
float move_factor = std::min(1.0F, debug_drag_speed_ * delta_time / distance);
float new_x = player_x + dx * move_factor;
float new_y = player_y + dy * move_factor;
float new_x = player_x + (dx * move_factor);
float new_y = player_y + (dy * move_factor);
// Mover el jugador hacia la posición del cursor
player_->setDebugPosition(new_x, new_y);