Fase 1d: rename del codi restant (effects, stage_system, locals)

Sweep final del naming a CamelCase/camelBack/lower_case:

Fitxers renombrats:
- effects/gestor_puntuacio_flotant.{hpp,cpp} -> floating_score_manager.{hpp,cpp}
- effects/puntuacio_flotant.hpp -> floating_score.hpp

Tipus (CamelCase):
- GestorPuntuacioFlotant -> FloatingScoreManager
- PuntuacioFlotant -> FloatingScore
- ConfigStage -> StageConfig
- ConfigSistemaStages -> StageSystemConfig
- NauTitol -> TitleShip
- EstatNau -> ShipState

Metodes publics (camelBack):
- obte_renderer -> getRenderer
- get_num_actius -> getActiveCount
- calcular_direccio_explosio -> computeExplosionDirection
- trobar_slot_lliure -> findFreeSlot
- explotar -> explode
- reiniciar -> reset
- es_valida -> isValid
- parsejar_fitxer -> parseFile
- carregar -> load
- crear_explosio -> createExplosion
- registrar_puntuacio -> registerScore
- construir_marcador -> buildScoreboard
- render_centered -> renderCentered

Camps struct publics (snake_case):
- actiu/actius -> active
- rotacio -> rotation, rotacio_visual -> visual_rotation
- acceleracio -> acceleration
- velocitat -> velocity
- escala/escala_inicial/objectiu/actual -> scale/initial_scale/...
- posicio/posicio_inicial/objectiu/actual -> position/initial_position/...
- fase_oscilacio -> oscillation_phase
- temps_estat -> state_time
- jugador_id -> player_id
- estat -> state
- brillantor -> brightness
- tipus -> type

Camps privats (sufix _):
- naus_ -> ships_, orni_ -> enemies_, bales_ -> bullets_
- gestor_puntuacio_ -> floating_score_manager_
- punt_mort_ -> death_position_, punt_spawn_ -> spawn_position_
- itocado_per_jugador_ -> hit_timer_per_player_
- vides_per_jugador_ -> lives_per_player_
- puntuacio_per_jugador_ -> score_per_player_
- estat_game_over_ -> game_over_state_
- continues_usados_ -> continues_used_

Constants:
- MARGE_ESQ/DRET/DALT/BAIX -> MARGIN_LEFT/RIGHT/TOP/BOTTOM

Variables locals i parametres comuns (snake_case):
- nau -> ship, enemic -> enemy, bala -> bullet
- forma -> shape, punt(s) -> point(s)
- jugador -> player, partida -> match
- temps -> time, missatge -> message

Diff: 59 fitxers, +1000/-1000 (simetric). Compila i enllaça.

Pendents per a futures fases (no bloquejants):
- Comentaris de capçalera en catala -> castella
- Variables locals/parametres minoritaris en catala
- Include guards (queden alguns #ifndef en lloc de #pragma once)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-19 11:44:45 +02:00
parent 5871d29d48
commit 7ee359b910
59 changed files with 998 additions and 998 deletions
+26 -26
View File
@@ -22,11 +22,11 @@ Starfield::Starfield(SDL_Renderer* renderer,
punt_fuga_(punt_fuga),
area_(area),
densitat_(densitat) {
// Carregar forma d'estrella amb ShapeLoader
// Carregar shape d'estrella amb ShapeLoader
shape_estrella_ = ShapeLoader::load("star.shp");
if (!shape_estrella_ || !shape_estrella_->es_valida()) {
std::cerr << "ERROR: No s'ha pogut carregar star.shp" << '\n';
if (!shape_estrella_ || !shape_estrella_->isValid()) {
std::cerr << "ERROR: No s'ha pogut load star.shp" << '\n';
return;
}
@@ -60,8 +60,8 @@ Starfield::Starfield(SDL_Renderer* renderer,
// Calcular posició des de la distància
float radi = estrella.distancia_centre * radi_max_;
estrella.posicio.x = punt_fuga_.x + (radi * std::cos(estrella.angle));
estrella.posicio.y = punt_fuga_.y + (radi * std::sin(estrella.angle));
estrella.position.x = punt_fuga_.x + (radi * std::cos(estrella.angle));
estrella.position.y = punt_fuga_.y + (radi * std::sin(estrella.angle));
estrelles_.push_back(estrella);
}
@@ -70,27 +70,27 @@ Starfield::Starfield(SDL_Renderer* renderer,
// Inicialitzar una estrella (nova o regenerada)
void Starfield::inicialitzar_estrella(Estrella& estrella) const {
// Angle aleatori des del punt de fuga cap a fora
// Angle aleatori des del point de fuga cap a fora
estrella.angle = (static_cast<float>(rand()) / RAND_MAX) * 2.0F * Defaults::Math::PI;
// Distància inicial petita (5% del radi màxim) - neix prop del centre
estrella.distancia_centre = 0.05F;
// Posició inicial: molt prop del punt de fuga
// Posició inicial: molt prop del point de fuga
float radi = estrella.distancia_centre * radi_max_;
estrella.posicio.x = punt_fuga_.x + (radi * std::cos(estrella.angle));
estrella.posicio.y = punt_fuga_.y + (radi * std::sin(estrella.angle));
estrella.position.x = punt_fuga_.x + (radi * std::cos(estrella.angle));
estrella.position.y = punt_fuga_.y + (radi * std::sin(estrella.angle));
}
// Verificar si una estrella està fora de l'àrea
bool Starfield::fora_area(const Estrella& estrella) const {
return (estrella.posicio.x < area_.x ||
estrella.posicio.x > area_.x + area_.w ||
estrella.posicio.y < area_.y ||
estrella.posicio.y > area_.y + area_.h);
return (estrella.position.x < area_.x ||
estrella.position.x > area_.x + area_.w ||
estrella.position.y < area_.y ||
estrella.position.y > area_.y + area_.h);
}
// Calcular escala dinàmica segons distància del centre
// Calcular scale dinàmica segons distància del centre
float Starfield::calcular_escala(const Estrella& estrella) const {
const CapaConfig& capa = capes_[estrella.capa];
@@ -119,16 +119,16 @@ void Starfield::update(float delta_time) {
const CapaConfig& capa = capes_[estrella.capa];
// Moure cap a fora des del centre
float velocitat = capa.velocitat_base;
float dx = velocitat * std::cos(estrella.angle) * delta_time;
float dy = velocitat * std::sin(estrella.angle) * delta_time;
float velocity = capa.velocitat_base;
float dx = velocity * std::cos(estrella.angle) * delta_time;
float dy = velocity * std::sin(estrella.angle) * delta_time;
estrella.posicio.x += dx;
estrella.posicio.y += dy;
estrella.position.x += dx;
estrella.position.y += dy;
// Actualitzar distància del centre
float dx_centre = estrella.posicio.x - punt_fuga_.x;
float dy_centre = estrella.posicio.y - punt_fuga_.y;
float dx_centre = estrella.position.x - punt_fuga_.x;
float dy_centre = estrella.position.y - punt_fuga_.y;
float dist_px = std::sqrt((dx_centre * dx_centre) + (dy_centre * dy_centre));
estrella.distancia_centre = dist_px / radi_max_;
@@ -146,22 +146,22 @@ void Starfield::set_brightness(float multiplier) {
// Dibuixar totes les estrelles
void Starfield::draw() {
if (!shape_estrella_->es_valida()) {
if (!shape_estrella_->isValid()) {
return;
}
for (const auto& estrella : estrelles_) {
// Calcular escala i brightness dinàmicament
float escala = calcular_escala(estrella);
// Calcular scale i brightness dinàmicament
float scale = calcular_escala(estrella);
float brightness = calcular_brightness(estrella);
// Renderitzar estrella sense rotació
Rendering::render_shape(
renderer_,
shape_estrella_,
estrella.posicio,
estrella.position,
0.0F, // angle (les estrelles no giren)
escala, // escala dinàmica
scale, // scale dinàmica
1.0F, // progress (sempre visible)
brightness // brightness dinàmica
);