Lint: rename públicos al inglés + refactor cognitive-complexity + unused-includes

Identifier-naming: rename de métodos públicos y cross-file al inglés
(camelBack), traducción de campos y locales en el proceso (TitleShip,
StageManager, SpawnController, ShipAnimator, helpers de PlayArea, etc.).

Refactor por cognitive-complexity (>25): GameScene::draw (59→3) con 9
helpers de estado, PhysicsWorld::resolveBodyCollisions (35→5) extrayendo
resolveBodyPair, Options::load{Window,Physics,Audio}ConfigFromYaml
(32/49/57→5/2/3) con templates readField, TitleScene::update (68→4) con
5 sub-pasos por estado + handleSkipInput/handleStartInput +
triggerExitForJoinedPlayers, DebrisManager::explode (39→3) con
extractSegments/spawnDebris/applyAngularVelocity/applyVisualRotation.

use-anyofallof: bucles → std::ranges::any_of/all_of en Input,
ShipAnimator y SpawnController.

readability-static-accessed-through-instance: Director::run y
VectorText::getTextWidth/Height invocados por clase.

readability-convert-member-functions-to-static: ResourcePack::decryptData.

unused-includes: eliminación de <utility>, <cstdint>, <vector>,
<iostream>, defaults.hpp y otros no usados directamente en headers y
unidades de traducción. Restablecido core/defaults.hpp en title_scene.cpp
(falsa "unused" del header).

Bug fix: eliminado isActive() duplicado en Bullet (redeclaración tras
rename de esta_activa→isActive que chocaba con el override de Entity).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
JailDesignerandClaude Opus 4.7 committed 2026-05-20 13:41:33 +02:00
1 parent 4e5ab6be1d
commit bbbb8d47ae
53 files changed
+818 -894

No files matched your search

+7 -7
View File
@@ -48,7 +48,7 @@ Bullet::Bullet(Rendering::Renderer* renderer)
void Bullet::init() {
// Inicialment inactiva
esta_ = false;
is_active_ = false;
center_ = {.x = 0.0F, .y = 0.0F};
angle_ = 0.0F;
grace_timer_ = 0.0F;
@@ -63,7 +63,7 @@ void Bullet::init() {
void Bullet::disparar(const Vec2& position, float angle, uint8_t owner_id) {
// Activar bullet
esta_ = true;
is_active_ = true;
// Almacenar propietario (0=P1, 1=P2)
owner_id_ = owner_id;
@@ -90,7 +90,7 @@ void Bullet::disparar(const Vec2& position, float angle, uint8_t owner_id) {
}
void Bullet::update(float delta_time) {
if (!esta_) {
if (!is_active_) {
return;
}
@@ -106,7 +106,7 @@ void Bullet::update(float delta_time) {
float max_x;
float min_y;
float max_y;
Constants::obtenir_limits_zona_segurs(Defaults::Entities::BULLET_RADIUS,
Constants::getSafePlayAreaBounds(Defaults::Entities::BULLET_RADIUS,
min_x,
max_x,
min_y,
@@ -125,16 +125,16 @@ void Bullet::postUpdate(float /*delta_time*/) {
}
void Bullet::desactivar() {
esta_ = false;
is_active_ = false;
// Detener el cuerpo físico para que no acumule deriva mientras inactiva.
body_.velocity = Vec2{};
body_.angular_velocity = 0.0F;
}
void Bullet::draw() const {
if (esta_ && shape_) {
if (is_active_ && shape_) {
// Les bales roten segons l'angle de trayectòria (estático tras disparo)
Rendering::render_shape(renderer_, shape_, center_, angle_, 1.0F, 1.0F, brightness_,
Rendering::renderShape(renderer_, shape_, center_, angle_, 1.0F, 1.0F, brightness_,
/*rotation_3d=*/nullptr, Defaults::Palette::BULLET);
}
}
+3 -4
View File
@@ -23,18 +23,17 @@ class Bullet : public Entities::Entity {
void draw() const override;
// Override: Interfaz de Entity
[[nodiscard]] auto isActive() const -> bool override { return esta_; }
[[nodiscard]] auto isActive() const -> bool override { return is_active_; }
// Override: Interfaz de colisión (gameplay-level: PLAYAREA bounds-check)
[[nodiscard]] auto getCollisionRadius() const -> float override {
return Defaults::Entities::BULLET_RADIUS;
}
[[nodiscard]] auto isCollidable() const -> bool override {
return esta_ && grace_timer_ <= 0.0F;
return is_active_ && grace_timer_ <= 0.0F;
}
// Getters (API pública sin cambios)
[[nodiscard]] auto esta_activa() const -> bool { return esta_; }
[[nodiscard]] auto getOwnerId() const -> uint8_t { return owner_id_; }
[[nodiscard]] auto getGraceTimer() const -> float { return grace_timer_; }
void desactivar();
@@ -43,7 +42,7 @@ class Bullet : public Entities::Entity {
// Miembros específicos de Bullet (heredados: renderer_, shape_, center_, angle_, brightness_, body_).
// Inicializados en la declaración para que tanto el ctor por defecto como el que toma renderer
// dejen el objeto en estado coherente (proyectil inactivo, sin owner, sin grace timer).
bool esta_{false};
bool is_active_{false};
uint8_t owner_id_{0}; // 0=P1, 1=P2
float grace_timer_{0.0F}; // Grace period timer (0.0 = vulnerable)
};
+3 -3
View File
@@ -113,7 +113,7 @@ void Enemy::init(EnemyType type, const Vec2* ship_pos) {
float max_x;
float min_y;
float max_y;
Constants::obtenir_limits_zona_segurs(Defaults::Entities::ENEMY_RADIUS, min_x, max_x, min_y, max_y);
Constants::getSafePlayAreaBounds(Defaults::Entities::ENEMY_RADIUS, min_x, max_x, min_y, max_y);
if (ship_pos != nullptr) {
bool found_safe_position = false;
@@ -229,7 +229,7 @@ void Enemy::draw() const {
case EnemyType::QUADRAT: color = Defaults::Palette::QUADRAT; break;
case EnemyType::MOLINILLO: color = Defaults::Palette::MOLINILLO; break;
}
Rendering::render_shape(renderer_, shape_, center_, rotacio_, SCALE, 1.0F, brightness_,
Rendering::renderShape(renderer_, shape_, center_, rotacio_, SCALE, 1.0F, brightness_,
/*rotation_3d=*/nullptr, color);
}
@@ -436,7 +436,7 @@ auto Enemy::attemptSafeSpawn(const Vec2& ship_pos, float& out_x, float& out_y) -
float max_x;
float min_y;
float max_y;
Constants::obtenir_limits_zona_segurs(Defaults::Entities::ENEMY_RADIUS, min_x, max_x, min_y, max_y);
Constants::getSafePlayAreaBounds(Defaults::Entities::ENEMY_RADIUS, min_x, max_x, min_y, max_y);
const int RANGE_X = static_cast<int>(max_x - min_x);
const int RANGE_Y = static_cast<int>(max_y - min_y);
+2 -2
View File
@@ -46,7 +46,7 @@ void Ship::init(const Vec2* spawn_point, bool activar_invulnerabilitat) {
} else {
float centre_x;
float centre_y;
Constants::obtenir_centre_zona(centre_x, centre_y);
Constants::getPlayAreaCenter(centre_x, centre_y);
center_ = {.x = centre_x, .y = centre_y};
}
@@ -158,6 +158,6 @@ void Ship::draw() const {
const float VISUAL_PUSH = SPEED / 33.33F;
const float SCALE = 1.0F + (VISUAL_PUSH / 12.0F);
Rendering::render_shape(renderer_, shape_, center_, angle_, SCALE, 1.0F, brightness_,
Rendering::renderShape(renderer_, shape_, center_, angle_, SCALE, 1.0F, brightness_,
/*rotation_3d=*/nullptr, Defaults::Palette::SHIP);
}