From 7af77fb3dd25e66f939f297ec5f307f8588598bc Mon Sep 17 00:00:00 2001 From: Sergio Date: Sat, 21 Mar 2026 09:26:17 +0100 Subject: [PATCH] =?UTF-8?q?refactor:=20eliminar=20c=C3=B3digo=20muerto=20(?= =?UTF-8?q?constantes=20legacy=20y=20m=C3=A9todos=20sin=20usar)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - defines.hpp: eliminar WINDOW_ZOOM_MIN, WINDOW_ZOOM_MAX (legacy), ROTOBALL_TRANSITION_TIME y LOGO_MODE_MIN_BALLS (reemplazada por LOGO_MIN_SCENARIO_IDX) - resource_pack: eliminar encryptData/decryptData (XOR preparado pero nunca integrado en el pipeline de carga/guardado) Co-Authored-By: Claude Sonnet 4.6 --- source/defines.hpp | 46 ++++++++++++++++++---------------------- source/resource_pack.cpp | 11 ---------- source/resource_pack.hpp | 2 -- 3 files changed, 21 insertions(+), 38 deletions(-) diff --git a/source/defines.hpp b/source/defines.hpp index ed0e6af..4fcdebb 100644 --- a/source/defines.hpp +++ b/source/defines.hpp @@ -12,15 +12,12 @@ constexpr int DEFAULT_SCREEN_WIDTH = 1280; // Ancho lógico por defecto (si no constexpr int DEFAULT_SCREEN_HEIGHT = 720; // Alto lógico por defecto (si no hay -h) constexpr int DEFAULT_WINDOW_ZOOM = 1; // Zoom inicial de ventana (1x = sin zoom) -// Configuración de zoom dinámico de ventana (legacy, solo usado en initialize()) -constexpr int WINDOW_ZOOM_MIN = 1; // Zoom mínimo (legacy, para validación inicial) -constexpr int WINDOW_ZOOM_MAX = 10; // Zoom máximo teórico (legacy) constexpr int WINDOW_DESKTOP_MARGIN = 10; // Margen mínimo con bordes del escritorio constexpr int WINDOW_DECORATION_HEIGHT = 30; // Altura estimada de decoraciones del SO // Configuración de escala de ventana por pasos (F1/F2) constexpr float WINDOW_SCALE_STEP = 0.1f; // Incremento/decremento por pulsación (10%) -constexpr float WINDOW_SCALE_MIN = 0.5f; // Escala mínima (50% de la resolución base) +constexpr float WINDOW_SCALE_MIN = 0.5f; // Escala mínima (50% de la resolución base) // Configuración de física constexpr float GRAVITY_FORCE = 0.2f; // Fuerza de gravedad (píxeles/frame²) @@ -58,30 +55,31 @@ constexpr float GRAVITY_CHANGE_LATERAL_MAX = 0.08f; // Velocidad lateral máxim constexpr float BALL_SPAWN_MARGIN = 0.15f; // Margen lateral para spawn (0.25 = 25% a cada lado) // Escenarios de número de pelotas (teclas 1-8) -// Fase 1 (instanced rendering): límit pràctic ~100K a 60fps (physics bound) -constexpr int SCENE_BALLS_1 = 10; -constexpr int SCENE_BALLS_2 = 50; -constexpr int SCENE_BALLS_3 = 100; -constexpr int SCENE_BALLS_4 = 500; -constexpr int SCENE_BALLS_5 = 1000; -constexpr int SCENE_BALLS_6 = 5000; -constexpr int SCENE_BALLS_7 = 10000; -constexpr int SCENE_BALLS_8 = 50000; // Máximo escenario estándar (tecla 8) +constexpr int SCENE_BALLS_1 = 10; +constexpr int SCENE_BALLS_2 = 50; +constexpr int SCENE_BALLS_3 = 100; +constexpr int SCENE_BALLS_4 = 500; +constexpr int SCENE_BALLS_5 = 1000; +constexpr int SCENE_BALLS_6 = 5000; +constexpr int SCENE_BALLS_7 = 10000; +constexpr int SCENE_BALLS_8 = 50000; // Máximo escenario estándar (tecla 8) constexpr int SCENARIO_COUNT = 8; constexpr int BALL_COUNT_SCENARIOS[SCENARIO_COUNT] = { - SCENE_BALLS_1, SCENE_BALLS_2, SCENE_BALLS_3, SCENE_BALLS_4, - SCENE_BALLS_5, SCENE_BALLS_6, SCENE_BALLS_7, SCENE_BALLS_8 -}; + SCENE_BALLS_1, + SCENE_BALLS_2, + SCENE_BALLS_3, + SCENE_BALLS_4, + SCENE_BALLS_5, + SCENE_BALLS_6, + SCENE_BALLS_7, + SCENE_BALLS_8}; constexpr int BOIDS_MAX_BALLS = SCENE_BALLS_5; // 1 000 bolas máximo en modo BOIDS - -// Límites de escenario para modos automáticos (índices en BALL_COUNT_SCENARIOS) -// 0 1 2 3 4 5 6 7 -constexpr int DEMO_AUTO_MIN_SCENARIO = 2; // mínimo 100 bolas -constexpr int DEMO_AUTO_MAX_SCENARIO = 7; // máximo sin restricción hardware (ajustado por benchmark) -constexpr int LOGO_MIN_SCENARIO_IDX = 4; // mínimo 1000 bolas (sustituye LOGO_MODE_MIN_BALLS) -constexpr int CUSTOM_SCENARIO_IDX = 8; // Escenario custom opcional (tecla 9, --custom-balls) +constexpr int DEMO_AUTO_MIN_SCENARIO = 2; // mínimo 100 bolas +constexpr int DEMO_AUTO_MAX_SCENARIO = 7; // máximo sin restricción hardware (ajustado por benchmark) +constexpr int LOGO_MIN_SCENARIO_IDX = 4; // mínimo 1000 bolas (sustituye LOGO_MODE_MIN_BALLS) +constexpr int CUSTOM_SCENARIO_IDX = 8; // Escenario custom opcional (tecla 9, --custom-balls) // Estructura para representar colores RGB struct Color { @@ -186,7 +184,6 @@ enum class ScalingMode { constexpr float ROTOBALL_RADIUS_FACTOR = 0.333f; // Radio como proporción de altura de pantalla (80/240 ≈ 0.333) constexpr float ROTOBALL_ROTATION_SPEED_Y = 1.5f; // Velocidad rotación eje Y (rad/s) constexpr float ROTOBALL_ROTATION_SPEED_X = 0.8f; // Velocidad rotación eje X (rad/s) -constexpr float ROTOBALL_TRANSITION_TIME = 1.5f; // Tiempo de transición (segundos) constexpr int ROTOBALL_MIN_BRIGHTNESS = 50; // Brillo mínimo (fondo, 0-255) constexpr int ROTOBALL_MAX_BRIGHTNESS = 255; // Brillo máximo (frente, 0-255) @@ -295,7 +292,6 @@ constexpr int DEMO_LITE_WEIGHT_IMPULSE = 10; // Aplicar impulso (10%) // TOTAL: 100 // Configuración de Modo LOGO (easter egg - "marca de agua") -constexpr int LOGO_MODE_MIN_BALLS = 500; // Mínimo de pelotas para activar modo logo constexpr float LOGO_MODE_SHAPE_SCALE = 1.2f; // Escala de figura en modo logo (120%) constexpr float LOGO_ACTION_INTERVAL_MIN = 3.0f; // Tiempo mínimo entre alternancia SHAPE/PHYSICS (escalado con resolución) constexpr float LOGO_ACTION_INTERVAL_MAX = 5.0f; // Tiempo máximo entre alternancia SHAPE/PHYSICS (escalado con resolución) diff --git a/source/resource_pack.cpp b/source/resource_pack.cpp index 8d6d8cd..71f5ccf 100644 --- a/source/resource_pack.cpp +++ b/source/resource_pack.cpp @@ -231,17 +231,6 @@ void ResourcePack::clear() { // FUNCIONES AUXILIARES // ============================================================================ -void ResourcePack::encryptData(unsigned char* data, size_t size) { - for (size_t i = 0; i < size; i++) { - data[i] ^= XOR_KEY; - } -} - -void ResourcePack::decryptData(unsigned char* data, size_t size) { - // XOR es simétrico - encryptData(data, size); -} - uint32_t ResourcePack::calculateChecksum(const unsigned char* data, size_t size) { uint32_t checksum = 0; for (size_t i = 0; i < size; i++) { diff --git a/source/resource_pack.hpp b/source/resource_pack.hpp index 30ad978..da7a039 100644 --- a/source/resource_pack.hpp +++ b/source/resource_pack.hpp @@ -58,8 +58,6 @@ private: bool isLoaded_; // Funciones auxiliares - void encryptData(unsigned char* data, size_t size); - void decryptData(unsigned char* data, size_t size); uint32_t calculateChecksum(const unsigned char* data, size_t size); std::string normalizePath(const std::string& path); };