Fase 1e: cierre de naming sweep (#pragma once, locals, comentarios castellano)
Tres tareas de pulido para cerrar la Fase 1 por completo: #pragma once uniforme: - sdl_manager.hpp y game_scene.hpp pasan de #ifndef/#define guards a #pragma once. Los archivos externos (stb_vorbis.h, fkyaml_node.hpp) se mantienen intactos (codigo de terceros). Variables locales y parametros restantes (catalan -> ingles): - fitxer -> file, moviment -> movement, inici -> start - comptador -> counter, escalada -> scaled - missatges -> messages, llista -> list - alçada -> height, amplada -> width, llargada -> length - origen -> origin, distancia -> distance, valor -> value, desti -> target - neteja -> clear, presenta -> present (SDLManager) - total_enemics -> total_enemies, configurar -> configure, iniciar -> start Comentarios catalan -> castellano: - Cabeceras de fichero actualizadas con nombres nuevos (escena_joc.hpp -> game_scene.hpp, etc.) - Palabras tecnicas: trasllacio->traslacion, col-lisio->colision, inicialitzacio->inicializacion, posicio->posicion, rotacio->rotacion, velocitat->velocidad, acceleracio->aceleracion, explosio->explosion, renderitzat->renderizado, calcul->calculo, transicio->transicion, comprovacio->comprobacion, substitucio->sustitucion, utilitzacio->utilizacion, opcio->opcion, configuracio->configuracion, funcio->funcion, distancia, animacio->animacion - Determinantes y conectores: aquest->este, aquesta->esta, amb->con, sense->sin, pero->pero, mai->nunca, nomes->solo, tambe->tambien, sempre->siempre, ja->ya, mateix->mismo, vegada->vez, dintre->dentro, fora->fuera, dreta->derecha, esquerra->izquierda, sortir->salir, sortida->salida, petit->pequeno, gran->grande, nou->nuevo, vell->viejo, molt->mucho, els->los, les->las, totes les->todas las, d'->de, com->como, quan->cuando, mentre->mientras, despres->despues, abans->antes, durant->durante, fins->hasta, encara->aun, llavors->entonces, aixi->asi, perque->porque - Sustantivos: classe->clase, metode->metodo, parametre->parametro, versio->version, entitat->entidad, joc->juego, nivell->nivel, enemic->enemigo, naus->naves, bales->balas, fitxer->archivo, pentagon->pentagono, pun- tuacio->puntuacion, flotant->flotante, titol->titulo, objectiu->objetivo, mostra->muestra, tipus->tipo Strings literales preservados en valenciano segun decision del usuario: el texto del HUD del juego (puntuaciones, mensajes en pantalla, archivo de config) se mantiene en valenciano original. 70 fitxers tocats, +1117 / -1123. Compila i enllaca. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+21
-21
@@ -135,8 +135,8 @@ static const std::unordered_map<int, std::string> BUTTON_TO_STRING = {
|
||||
{SDL_GAMEPAD_BUTTON_DPAD_DOWN, "DPAD_DOWN"},
|
||||
{SDL_GAMEPAD_BUTTON_DPAD_LEFT, "DPAD_LEFT"},
|
||||
{SDL_GAMEPAD_BUTTON_DPAD_RIGHT, "DPAD_RIGHT"},
|
||||
{100, "L2_AS_BUTTON"}, // Trigger L2 com a botó digital
|
||||
{101, "R2_AS_BUTTON"} // Trigger R2 com a botó digital
|
||||
{100, "L2_AS_BUTTON"}, // Trigger L2 como a botó digital
|
||||
{101, "R2_AS_BUTTON"} // Trigger R2 como a botó digital
|
||||
};
|
||||
|
||||
// Mapa invers: string a botó de gamepad
|
||||
@@ -178,7 +178,7 @@ static auto stringToButton(const std::string& str) -> int {
|
||||
|
||||
// ========== FI FUNCIONS AUXILIARS ==========
|
||||
|
||||
// Inicialitzar opcions amb valors per defecte de Defaults::
|
||||
// Inicialitzar opciones con valors per defecte de Defaults::
|
||||
void init() {
|
||||
#ifdef _DEBUG
|
||||
console = true;
|
||||
@@ -219,10 +219,10 @@ void init() {
|
||||
version = std::string(Project::VERSION);
|
||||
}
|
||||
|
||||
// Establir la ruta del fitxer de configuració
|
||||
// Establir la ruta del file de configuración
|
||||
void setConfigFile(const std::string& path) { config_file_path = path; }
|
||||
|
||||
// Funcions auxiliars per load seccions del YAML
|
||||
// Funciones auxiliars per load seccions del YAML
|
||||
|
||||
static void loadWindowConfigFromYaml(const fkyaml::node& yaml) {
|
||||
if (yaml.contains("window")) {
|
||||
@@ -372,7 +372,7 @@ static void loadRenderingConfigFromYaml(const fkyaml::node& yaml) {
|
||||
if (rend.contains("vsync")) {
|
||||
try {
|
||||
int val = rend["vsync"].get_value<int>();
|
||||
// Validar: només 0 o 1
|
||||
// Validar: solo 0 o 1
|
||||
rendering.vsync = (val == 0 || val == 1) ? val : Defaults::Rendering::VSYNC_DEFAULT;
|
||||
} catch (...) {
|
||||
rendering.vsync = Defaults::Rendering::VSYNC_DEFAULT;
|
||||
@@ -446,7 +446,7 @@ static void loadAudioConfigFromYaml(const fkyaml::node& yaml) {
|
||||
}
|
||||
}
|
||||
|
||||
// Carregar controls del player 1 des de YAML
|
||||
// Carregar controls del player 1 desde YAML
|
||||
static void loadPlayer1ControlsFromYaml(const fkyaml::node& yaml) {
|
||||
if (!yaml.contains("player1")) {
|
||||
return;
|
||||
@@ -494,7 +494,7 @@ static void loadPlayer1ControlsFromYaml(const fkyaml::node& yaml) {
|
||||
}
|
||||
}
|
||||
|
||||
// Carregar controls del player 2 des de YAML
|
||||
// Carregar controls del player 2 desde YAML
|
||||
static void loadPlayer2ControlsFromYaml(const fkyaml::node& yaml) {
|
||||
if (!yaml.contains("player2")) {
|
||||
return;
|
||||
@@ -542,22 +542,22 @@ static void loadPlayer2ControlsFromYaml(const fkyaml::node& yaml) {
|
||||
}
|
||||
}
|
||||
|
||||
// Carregar configuració des del fitxer YAML
|
||||
// Carregar configuración des del file YAML
|
||||
auto loadFromFile() -> bool {
|
||||
const std::string CONFIG_VERSION = std::string(Project::VERSION);
|
||||
|
||||
std::ifstream file(config_file_path);
|
||||
if (!file.good()) {
|
||||
// El fitxer no existeix → crear-ne un de nou amb valors per defecte
|
||||
// El file no existeix → crear-ne un de nuevo con valors per defecte
|
||||
if (console) {
|
||||
std::cout << "Fitxer de config no trobat, creant-ne un de nou: "
|
||||
std::cout << "Archivo de config no trobat, creant-ne un de nuevo: "
|
||||
<< config_file_path << '\n';
|
||||
}
|
||||
saveToFile();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Llegir tot el contingut del fitxer
|
||||
// Llegir todo el contingut del file
|
||||
std::string content((std::istreambuf_iterator<char>(file)),
|
||||
std::istreambuf_iterator<char>());
|
||||
file.close();
|
||||
@@ -566,15 +566,15 @@ auto loadFromFile() -> bool {
|
||||
// Parsejar YAML
|
||||
auto yaml = fkyaml::node::deserialize(content);
|
||||
|
||||
// Validar versió
|
||||
// Validar versión
|
||||
if (yaml.contains("version")) {
|
||||
version = yaml["version"].get_value<std::string>();
|
||||
}
|
||||
|
||||
if (CONFIG_VERSION != version) {
|
||||
// Versió incompatible → regenerar config
|
||||
// Versión incompatible → regenerar config
|
||||
if (console) {
|
||||
std::cout << "Versió de config incompatible (esperada: "
|
||||
std::cout << "Versión de config incompatible (esperada: "
|
||||
<< CONFIG_VERSION << ", trobada: " << version
|
||||
<< "), regenerant config\n";
|
||||
}
|
||||
@@ -593,7 +593,7 @@ auto loadFromFile() -> bool {
|
||||
loadPlayer2ControlsFromYaml(yaml);
|
||||
|
||||
if (console) {
|
||||
std::cout << "Config carregada correctament des de: " << config_file_path
|
||||
std::cout << "Config carregada correctament desde: " << config_file_path
|
||||
<< '\n';
|
||||
}
|
||||
|
||||
@@ -603,7 +603,7 @@ auto loadFromFile() -> bool {
|
||||
// Error de parsejat YAML → regenerar config
|
||||
if (console) {
|
||||
std::cerr << "Error parsejant YAML: " << e.what() << '\n';
|
||||
std::cerr << "Creant config nou amb valors per defecte\n";
|
||||
std::cerr << "Creant config nuevo con valors per defecte\n";
|
||||
}
|
||||
init();
|
||||
saveToFile();
|
||||
@@ -645,19 +645,19 @@ static void savePlayer2ControlsToYaml(std::ofstream& file) {
|
||||
file << " gamepad_name: \"" << player2.gamepad_name << "\" # Buit = segon disponible\n\n";
|
||||
}
|
||||
|
||||
// Guardar configuració al fitxer YAML
|
||||
// Guardar configuración al file YAML
|
||||
auto saveToFile() -> bool {
|
||||
std::ofstream file(config_file_path);
|
||||
if (!file.is_open()) {
|
||||
if (console) {
|
||||
std::cerr << "No s'ha pogut obrir el fitxer de config per escriure: "
|
||||
std::cerr << "No s'ha pogut obrir el file de config per escriure: "
|
||||
<< config_file_path << '\n';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Escriure manualment per controlar format i comentaris
|
||||
file << "# Orni Attack - Fitxer de Configuració\n";
|
||||
file << "# Orni Attack - Archivo de Configuración\n";
|
||||
file << "# Auto-generat. Les edicions manuals es preserven si són "
|
||||
"vàlides.\n\n";
|
||||
|
||||
@@ -670,7 +670,7 @@ auto saveToFile() -> bool {
|
||||
file << " fullscreen: " << (window.fullscreen ? "true" : "false") << "\n";
|
||||
file << " zoom_factor: " << window.zoom_factor << " # 0.5x-max (0.1 increments)\n\n";
|
||||
|
||||
file << "# FÍSICA (tots els valors en px/s, rad/s, etc.)\n";
|
||||
file << "# FÍSICA (todos los valors en px/s, rad/s, etc.)\n";
|
||||
file << "physics:\n";
|
||||
file << " rotation_speed: " << physics.rotation_speed << " # rad/s\n";
|
||||
file << " acceleration: " << physics.acceleration << " # px/s²\n";
|
||||
|
||||
Reference in New Issue
Block a user