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
+34 -34
View File
@@ -29,7 +29,7 @@ static float calcular_progress_letra(size_t letra_index, size_t num_letras, floa
return 1.0F;
}
// Calcular temps per lletra
// Calcular time per lletra
float duration_per_letra = 1.0F / static_cast<float>(num_letras);
float step = threshold * duration_per_letra;
float start = static_cast<float>(letra_index) * step;
@@ -50,7 +50,7 @@ LogoScene::LogoScene(SDLManager& sdl, SceneContext& context)
context_(context),
estat_actual_(AnimationState::PRE_ANIMATION),
temps_estat_actual_(0.0F),
debris_manager_(std::make_unique<Effects::DebrisManager>(sdl.obte_renderer())),
debris_manager_(std::make_unique<Effects::DebrisManager>(sdl.getRenderer())),
lletra_explosio_index_(0),
temps_des_ultima_explosio_(0.0F) {
std::cout << "SceneType Logo: Inicialitzant...\n";
@@ -113,7 +113,7 @@ void LogoScene::run() {
// Actualitzar colors oscil·lats (efecte verd global)
sdl_.updateColors(delta_time);
// Actualitzar context de renderitzat (factor d'escala global)
// Actualitzar context de renderitzat (factor d'scale global)
sdl_.updateRenderingContext();
// Dibuixar
@@ -142,20 +142,20 @@ void LogoScene::inicialitzar_lletres() {
float ancho_total = 0.0F;
for (const auto& fitxer : fitxers) {
auto forma = ShapeLoader::load(fitxer);
if (!forma || !forma->es_valida()) {
auto shape = ShapeLoader::load(fitxer);
if (!shape || !shape->isValid()) {
std::cerr << "[LogoScene] Error carregant " << fitxer << '\n';
continue;
}
// Calcular bounding box de la forma (trobar ancho)
// Calcular bounding box de la shape (trobar ancho)
float min_x = FLT_MAX;
float max_x = -FLT_MAX;
for (const auto& prim : forma->get_primitives()) {
for (const auto& punt : prim.points) {
min_x = std::min(min_x, punt.x);
max_x = std::max(max_x, punt.x);
for (const auto& prim : shape->get_primitives()) {
for (const auto& point : prim.points) {
min_x = std::min(min_x, point.x);
max_x = std::max(max_x, point.x);
}
}
@@ -164,9 +164,9 @@ void LogoScene::inicialitzar_lletres() {
// IMPORTANT: Escalar ancho i offset amb ESCALA_FINAL
// per que les posicions finals coincideixin amb la mida real de les lletres
float ancho = ancho_sin_escalar * ESCALA_FINAL;
float offset_centre = (forma->getCenter().x - min_x) * ESCALA_FINAL;
float offset_centre = (shape->getCenter().x - min_x) * ESCALA_FINAL;
lletres_.push_back({forma,
lletres_.push_back({shape,
{.x = 0.0F, .y = 0.0F}, // Posició es calcularà després
ancho,
offset_centre});
@@ -188,11 +188,11 @@ void LogoScene::inicialitzar_lletres() {
float x_actual = x_inicial;
for (auto& lletra : lletres_) {
// Posicionar el centre de la forma (shape_centre) en pantalla
// Posicionar el centre de la shape (shape_centre) en pantalla
// Usar offset_centre en lloc de ancho/2 perquè shape_centre
// pot no estar exactament al mig del bounding box
lletra.posicio.x = x_actual + lletra.offset_centre;
lletra.posicio.y = y_centre;
lletra.position.x = x_actual + lletra.offset_centre;
lletra.position.y = y_centre;
// Avançar per a següent lletra
x_actual += lletra.ancho + ESPAI_ENTRE_LLETRES;
@@ -204,9 +204,9 @@ void LogoScene::inicialitzar_lletres() {
void LogoScene::canviar_estat(AnimationState nou_estat) {
estat_actual_ = nou_estat;
temps_estat_actual_ = 0.0F; // Reset temps
temps_estat_actual_ = 0.0F; // Reset time
// Inicialitzar estat d'explosió
// Inicialitzar state d'explosió
if (nou_estat == AnimationState::EXPLOSION) {
lletra_explosio_index_ = 0;
temps_des_ultima_explosio_ = 0.0F;
@@ -223,7 +223,7 @@ void LogoScene::canviar_estat(AnimationState nou_estat) {
Audio::get()->playMusic("title.ogg");
}
std::cout << "[LogoScene] Canvi a estat: " << static_cast<int>(nou_estat)
std::cout << "[LogoScene] Canvi a state: " << static_cast<int>(nou_estat)
<< "\n";
}
@@ -235,21 +235,21 @@ bool LogoScene::totes_lletres_completes() const {
void LogoScene::actualitzar_explosions(float delta_time) {
temps_des_ultima_explosio_ += delta_time;
// Comprovar si és el moment d'explotar la següent lletra
// Comprovar si és el moment d'explode la següent lletra
if (temps_des_ultima_explosio_ >= DELAY_ENTRE_EXPLOSIONS) {
if (lletra_explosio_index_ < lletres_.size()) {
// Explotar lletra actual (en ordre aleatori)
size_t index_actual = ordre_explosio_[lletra_explosio_index_];
const auto& lletra = lletres_[index_actual];
debris_manager_->explotar(
lletra.forma, // Forma a explotar
lletra.posicio, // Posició
debris_manager_->explode(
lletra.shape, // Forma a explode
lletra.position, // Posició
0.0F, // Angle (sense rotació)
ESCALA_FINAL, // Escala (lletres a escala final)
ESCALA_FINAL, // Escala (lletres a scale final)
VELOCITAT_EXPLOSIO, // Velocitat base
1.0F, // Brightness màxim (per defecte)
{.x = 0.0F, .y = 0.0F} // Sense velocitat (per defecte)
{.x = 0.0F, .y = 0.0F} // Sense velocity (per defecte)
);
std::cout << "[LogoScene] Explota lletra " << lletra_explosio_index_ << "\n";
@@ -364,21 +364,21 @@ void LogoScene::draw() {
Vec2 pos_actual;
pos_actual.x =
ORIGEN_ZOOM.x + ((lletra.posicio.x - ORIGEN_ZOOM.x) * letra_progress);
ORIGEN_ZOOM.x + ((lletra.position.x - ORIGEN_ZOOM.x) * letra_progress);
pos_actual.y =
ORIGEN_ZOOM.y + ((lletra.posicio.y - ORIGEN_ZOOM.y) * letra_progress);
ORIGEN_ZOOM.y + ((lletra.position.y - ORIGEN_ZOOM.y) * letra_progress);
float t = letra_progress;
float ease_factor = 1.0F - ((1.0F - t) * (1.0F - t));
float escala_actual =
float current_scale =
ESCALA_INICIAL + ((ESCALA_FINAL - ESCALA_INICIAL) * ease_factor);
Rendering::render_shape(
sdl_.obte_renderer(),
lletra.forma,
sdl_.getRenderer(),
lletra.shape,
pos_actual,
0.0F,
escala_actual,
current_scale,
1.0F);
}
}
@@ -397,9 +397,9 @@ void LogoScene::draw() {
const auto& lletra = lletres_[i];
Rendering::render_shape(
sdl_.obte_renderer(),
lletra.forma,
lletra.posicio,
sdl_.getRenderer(),
lletra.shape,
lletra.position,
0.0F,
ESCALA_FINAL,
1.0F);
@@ -409,7 +409,7 @@ void LogoScene::draw() {
// POST_EXPLOSION: No draw lletres, només debris (a baix)
// Sempre draw debris (si n'hi ha d'actius)
// Sempre draw debris (si n'hi ha d'active)
debris_manager_->draw();
sdl_.presenta();