style: aplicar readability-uppercase-literal-suffix
- Cambiar todos los literales float de minúscula a mayúscula (1.0f → 1.0F)
- 657 correcciones aplicadas automáticamente con clang-tidy
- Check 1/N completado
🤖 Generated with Claude Code
This commit is contained in:
@@ -105,7 +105,7 @@ void DebrisManager::explotar(const std::shared_ptr<Graphics::Shape>& shape,
|
||||
// 5. Velocitat inicial (base ± variació aleatòria + velocitat heretada)
|
||||
float speed =
|
||||
velocitat_base +
|
||||
((std::rand() / static_cast<float>(RAND_MAX)) * 2.0f - 1.0f) *
|
||||
((std::rand() / static_cast<float>(RAND_MAX)) * 2.0F - 1.0F) *
|
||||
Defaults::Physics::Debris::VARIACIO_VELOCITAT;
|
||||
|
||||
// Heredar velocitat de l'objecte original (suma vectorial)
|
||||
@@ -116,7 +116,7 @@ void DebrisManager::explotar(const std::shared_ptr<Graphics::Shape>& shape,
|
||||
// 6. Herència de velocitat angular amb cap + conversió d'excés
|
||||
|
||||
// 6a. Rotació de TRAYECTORIA amb cap + conversió tangencial
|
||||
if (std::abs(velocitat_angular) > 0.01f) {
|
||||
if (std::abs(velocitat_angular) > 0.01F) {
|
||||
// FASE 1: Aplicar herència i variació (igual que abans)
|
||||
float factor_herencia =
|
||||
Defaults::Physics::Debris::FACTOR_HERENCIA_MIN +
|
||||
@@ -127,20 +127,20 @@ void DebrisManager::explotar(const std::shared_ptr<Graphics::Shape>& shape,
|
||||
float velocitat_ang_heretada = velocitat_angular * factor_herencia;
|
||||
|
||||
float variacio =
|
||||
(std::rand() / static_cast<float>(RAND_MAX)) * 0.2f - 0.1f;
|
||||
velocitat_ang_heretada *= (1.0f + variacio);
|
||||
(std::rand() / static_cast<float>(RAND_MAX)) * 0.2F - 0.1F;
|
||||
velocitat_ang_heretada *= (1.0F + variacio);
|
||||
|
||||
// FASE 2: Aplicar cap i calcular excés
|
||||
constexpr float CAP = Defaults::Physics::Debris::VELOCITAT_ROT_MAX;
|
||||
float abs_ang = std::abs(velocitat_ang_heretada);
|
||||
float sign_ang = (velocitat_ang_heretada >= 0.0f) ? 1.0f : -1.0f;
|
||||
float sign_ang = (velocitat_ang_heretada >= 0.0F) ? 1.0F : -1.0F;
|
||||
|
||||
if (abs_ang > CAP) {
|
||||
// Excés: convertir a velocitat tangencial
|
||||
float excess = abs_ang - CAP;
|
||||
|
||||
// Radi de la forma (enemics = 20 px)
|
||||
float radius = 20.0f;
|
||||
float radius = 20.0F;
|
||||
|
||||
// Velocitat tangencial = ω_excés × radi
|
||||
float v_tangential = excess * radius;
|
||||
@@ -161,18 +161,18 @@ void DebrisManager::explotar(const std::shared_ptr<Graphics::Shape>& shape,
|
||||
debris->velocitat_rot = velocitat_ang_heretada;
|
||||
}
|
||||
} else {
|
||||
debris->velocitat_rot = 0.0f; // Nave: sin curvas
|
||||
debris->velocitat_rot = 0.0F; // Nave: sin curvas
|
||||
}
|
||||
|
||||
// 6b. Rotació VISUAL (proporcional según factor_herencia_visual)
|
||||
if (factor_herencia_visual > 0.01f && std::abs(velocitat_angular) > 0.01f) {
|
||||
if (factor_herencia_visual > 0.01F && std::abs(velocitat_angular) > 0.01F) {
|
||||
// Heredar rotación visual con factor proporcional
|
||||
debris->velocitat_rot_visual = debris->velocitat_rot * factor_herencia_visual;
|
||||
|
||||
// Variació aleatòria petita (±5%) per naturalitat
|
||||
float variacio_visual =
|
||||
(std::rand() / static_cast<float>(RAND_MAX)) * 0.1f - 0.05f;
|
||||
debris->velocitat_rot_visual *= (1.0f + variacio_visual);
|
||||
(std::rand() / static_cast<float>(RAND_MAX)) * 0.1F - 0.05F;
|
||||
debris->velocitat_rot_visual *= (1.0F + variacio_visual);
|
||||
} else {
|
||||
// Rotació visual aleatòria (factor = 0.0 o sin velocidad angular)
|
||||
debris->velocitat_rot_visual =
|
||||
@@ -187,10 +187,10 @@ void DebrisManager::explotar(const std::shared_ptr<Graphics::Shape>& shape,
|
||||
}
|
||||
}
|
||||
|
||||
debris->angle_rotacio = 0.0f;
|
||||
debris->angle_rotacio = 0.0F;
|
||||
|
||||
// 7. Configurar vida i shrinking
|
||||
debris->temps_vida = 0.0f;
|
||||
debris->temps_vida = 0.0F;
|
||||
debris->temps_max = Defaults::Physics::Debris::TEMPS_VIDA;
|
||||
debris->factor_shrink = Defaults::Physics::Debris::SHRINK_RATE;
|
||||
|
||||
@@ -222,26 +222,26 @@ void DebrisManager::actualitzar(float delta_time) {
|
||||
float speed = std::sqrt(debris.velocitat.x * debris.velocitat.x +
|
||||
debris.velocitat.y * debris.velocitat.y);
|
||||
|
||||
if (speed > 1.0f) {
|
||||
if (speed > 1.0F) {
|
||||
// Calcular direcció normalitzada
|
||||
float dir_x = debris.velocitat.x / speed;
|
||||
float dir_y = debris.velocitat.y / speed;
|
||||
|
||||
// Aplicar acceleració negativa (fricció)
|
||||
float nova_speed = speed + debris.acceleracio * delta_time;
|
||||
if (nova_speed < 0.0f)
|
||||
nova_speed = 0.0f;
|
||||
if (nova_speed < 0.0F)
|
||||
nova_speed = 0.0F;
|
||||
|
||||
debris.velocitat.x = dir_x * nova_speed;
|
||||
debris.velocitat.y = dir_y * nova_speed;
|
||||
} else {
|
||||
// Velocitat molt baixa, aturar
|
||||
debris.velocitat.x = 0.0f;
|
||||
debris.velocitat.y = 0.0f;
|
||||
debris.velocitat.x = 0.0F;
|
||||
debris.velocitat.y = 0.0F;
|
||||
}
|
||||
|
||||
// 2b. Rotar vector de velocitat (trayectoria curva)
|
||||
if (std::abs(debris.velocitat_rot) > 0.01f) {
|
||||
if (std::abs(debris.velocitat_rot) > 0.01F) {
|
||||
// Calcular angle de rotació aquest frame
|
||||
float dangle = debris.velocitat_rot * delta_time;
|
||||
|
||||
@@ -257,21 +257,21 @@ void DebrisManager::actualitzar(float delta_time) {
|
||||
}
|
||||
|
||||
// 2c. Aplicar fricció angular (desacceleració gradual)
|
||||
if (std::abs(debris.velocitat_rot) > 0.01f) {
|
||||
float sign = (debris.velocitat_rot > 0) ? 1.0f : -1.0f;
|
||||
if (std::abs(debris.velocitat_rot) > 0.01F) {
|
||||
float sign = (debris.velocitat_rot > 0) ? 1.0F : -1.0F;
|
||||
float reduccion =
|
||||
Defaults::Physics::Debris::FRICCIO_ANGULAR * delta_time;
|
||||
debris.velocitat_rot -= sign * reduccion;
|
||||
|
||||
// Evitar canvi de signe (no pot passar de CW a CCW)
|
||||
if ((debris.velocitat_rot > 0) != (sign > 0)) {
|
||||
debris.velocitat_rot = 0.0f;
|
||||
debris.velocitat_rot = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Calcular centre del segment
|
||||
Punt centre = {(debris.p1.x + debris.p2.x) / 2.0f,
|
||||
(debris.p1.y + debris.p2.y) / 2.0f};
|
||||
Punt centre = {(debris.p1.x + debris.p2.x) / 2.0F,
|
||||
(debris.p1.y + debris.p2.y) / 2.0F};
|
||||
|
||||
// 4. Actualitzar posició del centre
|
||||
centre.x += debris.velocitat.x * delta_time;
|
||||
@@ -282,15 +282,15 @@ void DebrisManager::actualitzar(float delta_time) {
|
||||
|
||||
// 6. Aplicar shrinking (reducció de distància entre punts)
|
||||
float shrink_factor =
|
||||
1.0f - (debris.factor_shrink * debris.temps_vida / debris.temps_max);
|
||||
shrink_factor = std::max(0.0f, shrink_factor); // No negatiu
|
||||
1.0F - (debris.factor_shrink * debris.temps_vida / debris.temps_max);
|
||||
shrink_factor = std::max(0.0F, shrink_factor); // No negatiu
|
||||
|
||||
// Calcular distància original entre punts
|
||||
float dx = debris.p2.x - debris.p1.x;
|
||||
float dy = debris.p2.y - debris.p1.y;
|
||||
|
||||
// 7. Reconstruir segment amb nova mida i rotació
|
||||
float half_length = std::sqrt(dx * dx + dy * dy) * shrink_factor / 2.0f;
|
||||
float half_length = std::sqrt(dx * dx + dy * dy) * shrink_factor / 2.0F;
|
||||
float original_angle = std::atan2(dy, dx);
|
||||
float new_angle = original_angle + debris.angle_rotacio;
|
||||
|
||||
@@ -330,8 +330,8 @@ Punt DebrisManager::calcular_direccio_explosio(const Punt& p1,
|
||||
const Punt& p2,
|
||||
const Punt& centre_objecte) const {
|
||||
// 1. Calcular centre del segment
|
||||
float centro_seg_x = (p1.x + p2.x) / 2.0f;
|
||||
float centro_seg_y = (p1.y + p2.y) / 2.0f;
|
||||
float centro_seg_x = (p1.x + p2.x) / 2.0F;
|
||||
float centro_seg_y = (p1.y + p2.y) / 2.0F;
|
||||
|
||||
// 2. Calcular vector des del centre de l'objecte cap al centre del segment
|
||||
// Això garanteix que la direcció sempre apunte cap a fora (direcció radial)
|
||||
@@ -340,10 +340,10 @@ Punt DebrisManager::calcular_direccio_explosio(const Punt& p1,
|
||||
|
||||
// 3. Normalitzar (obtenir vector unitari)
|
||||
float length = std::sqrt(dx * dx + dy * dy);
|
||||
if (length < 0.001f) {
|
||||
if (length < 0.001F) {
|
||||
// Segment al centre (cas extrem molt improbable), retornar direcció aleatòria
|
||||
float angle_rand =
|
||||
(std::rand() / static_cast<float>(RAND_MAX)) * 2.0f * Defaults::Math::PI;
|
||||
(std::rand() / static_cast<float>(RAND_MAX)) * 2.0F * Defaults::Math::PI;
|
||||
return {std::cos(angle_rand), std::sin(angle_rand)};
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ Punt DebrisManager::calcular_direccio_explosio(const Punt& p1,
|
||||
|
||||
// 4. Afegir variació aleatòria petita (±15°) per varietat visual
|
||||
float angle_variacio =
|
||||
((std::rand() % 30) - 15) * Defaults::Math::PI / 180.0f;
|
||||
((std::rand() % 30) - 15) * Defaults::Math::PI / 180.0F;
|
||||
|
||||
float cos_v = std::cos(angle_variacio);
|
||||
float sin_v = std::sin(angle_variacio);
|
||||
|
||||
@@ -34,10 +34,10 @@ class DebrisManager {
|
||||
float angle,
|
||||
float escala,
|
||||
float velocitat_base,
|
||||
float brightness = 1.0f,
|
||||
const Punt& velocitat_objecte = {0.0f, 0.0f},
|
||||
float velocitat_angular = 0.0f,
|
||||
float factor_herencia_visual = 0.0f,
|
||||
float brightness = 1.0F,
|
||||
const Punt& velocitat_objecte = {0.0F, 0.0F},
|
||||
float velocitat_angular = 0.0F,
|
||||
float factor_herencia_visual = 0.0F,
|
||||
const std::string& sound = Defaults::Sound::EXPLOSION);
|
||||
|
||||
// Actualitzar tots els fragments actius
|
||||
|
||||
@@ -26,9 +26,9 @@ void GestorPuntuacioFlotant::crear(int punts, const Punt& posicio) {
|
||||
pf->posicio = posicio;
|
||||
pf->velocitat = {Defaults::FloatingScore::VELOCITY_X,
|
||||
Defaults::FloatingScore::VELOCITY_Y};
|
||||
pf->temps_vida = 0.0f;
|
||||
pf->temps_vida = 0.0F;
|
||||
pf->temps_max = Defaults::FloatingScore::LIFETIME;
|
||||
pf->brightness = 1.0f;
|
||||
pf->brightness = 1.0F;
|
||||
pf->actiu = true;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ void GestorPuntuacioFlotant::actualitzar(float delta_time) {
|
||||
|
||||
// 3. Calcular brightness (fade lineal)
|
||||
float progress = pf.temps_vida / pf.temps_max; // 0.0 → 1.0
|
||||
pf.brightness = 1.0f - progress; // 1.0 → 0.0
|
||||
pf.brightness = 1.0F - progress; // 1.0 → 0.0
|
||||
|
||||
// 4. Desactivar quan acaba el temps
|
||||
if (pf.temps_vida >= pf.temps_max) {
|
||||
|
||||
Reference in New Issue
Block a user