Compare commits

..

2 Commits

Author SHA1 Message Date
228968c728 claude: mogut initBalloonFormations() a un fitxer extern 2025-07-20 20:21:14 +02:00
f6228ae0c1 iwyu
clang-format
2025-07-20 19:33:06 +02:00
35 changed files with 725 additions and 388 deletions

View File

@@ -10,3 +10,10 @@ AlignOperands: false
AlignAfterOpenBracket: DontAlign AlignAfterOpenBracket: DontAlign
BinPackArguments: false BinPackArguments: false
BinPackParameters: false BinPackParameters: false
SortIncludes: CaseSensitive
IncludeBlocks: Merge
IncludeCategories:
- Regex: '.*'
Priority: 1
SortPriority: -1

View File

@@ -0,0 +1,277 @@
# Archivo de configuración de formaciones de globos
# Formato por línea: x, y, vel_x, tipo, tamaño, tiempo_creacion
# Variables disponibles:
# X1_0, X1_50, X1_100, X2_0, X2_100, X3_0, X3_100, X4_0, X4_100
# QUARTER1_X4, QUARTER3_X4, Y_BASE
# BALLOON_SIZE_0, BALLOON_SIZE_1, BALLOON_SIZE_2, BALLOON_SIZE_3
# VEL_POSITIVE, VEL_NEGATIVE
formation: 0
# Dos enemigos BALLOON4 uno a cada extremo
X4_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE4, 300
X4_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE4, 300
formation: 1
# Dos enemigos BALLOON4 uno a cada cuarto. Ambos van hacia el centro
QUARTER1_X4, Y_BASE, VEL_POSITIVE, BALLOON, SIZE4, 300
QUARTER3_X4, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE4, 300
formation: 2
# Cuatro enemigos BALLOON2 uno detrás del otro. A la izquierda y hacia el centro
X2_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 300
X2_0 + BALLOON_SIZE_1 + 1, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 290
X2_0 + (BALLOON_SIZE_1 + 1) * 2, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 280
X2_0 + (BALLOON_SIZE_1 + 1) * 3, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 270
formation: 3
# Cuatro enemigos BALLOON2 uno detrás del otro. A la derecha y hacia el centro
X2_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 300
X2_100 - BALLOON_SIZE_1 - 1, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 290
X2_100 - (BALLOON_SIZE_1 + 1) * 2, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 280
X2_100 - (BALLOON_SIZE_1 + 1) * 3, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 270
formation: 4
# Tres enemigos BALLOON3. 0, 25, 50. Hacia la derecha
X3_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 300
X3_0 + BALLOON_SIZE_2 * 2, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 290
X3_0 + BALLOON_SIZE_2 * 4, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 280
formation: 5
# Tres enemigos BALLOON3. 50, 75, 100. Hacia la izquierda
X3_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 300
X3_100 - BALLOON_SIZE_2 * 2, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 290
X3_100 - BALLOON_SIZE_2 * 4, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 280
formation: 6
# Tres enemigos BALLOON3. 0, 0, 0. Hacia la derecha
X3_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 300
X3_0 + BALLOON_SIZE_2 + 1, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 290
X3_0 + (BALLOON_SIZE_2 + 1) * 2, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 280
formation: 7
# Tres enemigos BALLOON3. 100, 100, 100. Hacia la izquierda
X3_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 300
X3_100 - BALLOON_SIZE_2 - 1, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 290
X3_100 - (BALLOON_SIZE_2 + 1) * 2, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 280
formation: 8
# Seis enemigos BALLOON1. 0, 0, 0, 0, 0, 0. Hacia la derecha
X1_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 300
X1_0 + BALLOON_SIZE_0 + 1, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 290
X1_0 + (BALLOON_SIZE_0 + 1) * 2, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 280
X1_0 + (BALLOON_SIZE_0 + 1) * 3, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 270
X1_0 + (BALLOON_SIZE_0 + 1) * 4, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 260
X1_0 + (BALLOON_SIZE_0 + 1) * 5, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 250
formation: 9
# Seis enemigos BALLOON1. 100, 100, 100, 100, 100, 100. Hacia la izquierda
X1_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 300
X1_100 - BALLOON_SIZE_0 - 1, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 290
X1_100 - (BALLOON_SIZE_0 + 1) * 2, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 280
X1_100 - (BALLOON_SIZE_0 + 1) * 3, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 270
X1_100 - (BALLOON_SIZE_0 + 1) * 4, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 260
X1_100 - (BALLOON_SIZE_0 + 1) * 5, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 250
formation: 10
# Tres enemigos BALLOON4 seguidos desde la izquierda. Hacia la derecha
X4_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE4, 300
X4_0 + BALLOON_SIZE_3 + 1, Y_BASE, VEL_POSITIVE, BALLOON, SIZE4, 285
X4_0 + (BALLOON_SIZE_3 + 1) * 2, Y_BASE, VEL_POSITIVE, BALLOON, SIZE4, 270
formation: 11
# Tres enemigos BALLOON4 seguidos desde la derecha. Hacia la izquierda
X4_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE4, 300
X4_100 - BALLOON_SIZE_3 - 1, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE4, 285
X4_100 - (BALLOON_SIZE_3 + 1) * 2, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE4, 270
formation: 12
# Seis enemigos BALLOON2 uno detrás del otro. A la izquierda y hacia el centro
X2_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 300
X2_0 + BALLOON_SIZE_1 + 1, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 290
X2_0 + (BALLOON_SIZE_1 + 1) * 2, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 280
X2_0 + (BALLOON_SIZE_1 + 1) * 3, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 270
X2_0 + (BALLOON_SIZE_1 + 1) * 4, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 260
X2_0 + (BALLOON_SIZE_1 + 1) * 5, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 250
formation: 13
# Seis enemigos BALLOON2 uno detrás del otro. A la derecha y hacia el centro
X2_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 300
X2_100 - BALLOON_SIZE_1 - 1, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 290
X2_100 - (BALLOON_SIZE_1 + 1) * 2, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 280
X2_100 - (BALLOON_SIZE_1 + 1) * 3, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 270
X2_100 - (BALLOON_SIZE_1 + 1) * 4, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 260
X2_100 - (BALLOON_SIZE_1 + 1) * 5, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 250
formation: 14
# Cinco enemigos BALLOON3. Hacia la derecha. Separados
X3_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 300
X3_0 + BALLOON_SIZE_2 * 2, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 290
X3_0 + BALLOON_SIZE_2 * 4, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 280
X3_0 + BALLOON_SIZE_2 * 6, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 270
X3_0 + BALLOON_SIZE_2 * 8, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 260
formation: 15
# Cinco enemigos BALLOON3. Hacia la izquierda. Separados
X3_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 300
X3_100 - BALLOON_SIZE_2 * 2, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 290
X3_100 - BALLOON_SIZE_2 * 4, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 280
X3_100 - BALLOON_SIZE_2 * 6, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 270
X3_100 - BALLOON_SIZE_2 * 8, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 260
formation: 16
# Cinco enemigos BALLOON3. Hacia la derecha. Juntos
X3_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 300
X3_0 + BALLOON_SIZE_2 + 1, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 290
X3_0 + (BALLOON_SIZE_2 + 1) * 2, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 280
X3_0 + (BALLOON_SIZE_2 + 1) * 3, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 270
X3_0 + (BALLOON_SIZE_2 + 1) * 4, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 260
formation: 17
# Cinco enemigos BALLOON3. Hacia la izquierda. Juntos
X3_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 300
X3_100 - BALLOON_SIZE_2 - 1, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 290
X3_100 - (BALLOON_SIZE_2 + 1) * 2, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 280
X3_100 - (BALLOON_SIZE_2 + 1) * 3, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 270
X3_100 - (BALLOON_SIZE_2 + 1) * 4, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 260
formation: 18
# Doce enemigos BALLOON1. Hacia la derecha. Juntos
X1_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 300
X1_0 + BALLOON_SIZE_0 + 1, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 290
X1_0 + (BALLOON_SIZE_0 + 1) * 2, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 280
X1_0 + (BALLOON_SIZE_0 + 1) * 3, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 270
X1_0 + (BALLOON_SIZE_0 + 1) * 4, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 260
X1_0 + (BALLOON_SIZE_0 + 1) * 5, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 250
X1_0 + (BALLOON_SIZE_0 + 1) * 6, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 240
X1_0 + (BALLOON_SIZE_0 + 1) * 7, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 230
X1_0 + (BALLOON_SIZE_0 + 1) * 8, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 220
X1_0 + (BALLOON_SIZE_0 + 1) * 9, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 210
X1_0 + (BALLOON_SIZE_0 + 1) * 10, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 200
X1_0 + (BALLOON_SIZE_0 + 1) * 11, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 190
formation: 19
# Doce enemigos BALLOON1. Hacia la izquierda. Juntos
X1_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 300
X1_100 - BALLOON_SIZE_0 - 1, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 290
X1_100 - (BALLOON_SIZE_0 + 1) * 2, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 280
X1_100 - (BALLOON_SIZE_0 + 1) * 3, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 270
X1_100 - (BALLOON_SIZE_0 + 1) * 4, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 260
X1_100 - (BALLOON_SIZE_0 + 1) * 5, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 250
X1_100 - (BALLOON_SIZE_0 + 1) * 6, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 240
X1_100 - (BALLOON_SIZE_0 + 1) * 7, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 230
X1_100 - (BALLOON_SIZE_0 + 1) * 8, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 220
X1_100 - (BALLOON_SIZE_0 + 1) * 9, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 210
X1_100 - (BALLOON_SIZE_0 + 1) * 10, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 200
X1_100 - (BALLOON_SIZE_0 + 1) * 11, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 190
formation: 20
# Cuatro enemigos BALLOON4 seguidos desde la izquierda/derecha. Simétricos
X4_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE4, 300
X4_0 + BALLOON_SIZE_3 + 1, Y_BASE, VEL_POSITIVE, BALLOON, SIZE4, 300
X4_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE4, 300
X4_100 - BALLOON_SIZE_3 - 1, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE4, 300
formation: 21
# Diez enemigos BALLOON2 uno detrás del otro. Izquierda/derecha. Simétricos
X2_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 300
X2_0 + BALLOON_SIZE_1 + 1, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 297
X2_0 + (BALLOON_SIZE_1 + 1) * 2, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 294
X2_0 + (BALLOON_SIZE_1 + 1) * 3, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 291
X2_0 + (BALLOON_SIZE_1 + 1) * 4, Y_BASE, VEL_POSITIVE, BALLOON, SIZE2, 288
X2_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 300
X2_100 - BALLOON_SIZE_1 - 1, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 297
X2_100 - (BALLOON_SIZE_1 + 1) * 2, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 294
X2_100 - (BALLOON_SIZE_1 + 1) * 3, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 291
X2_100 - (BALLOON_SIZE_1 + 1) * 4, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE2, 288
formation: 22
# Diez enemigos BALLOON3. Hacia la derecha/izquierda. Separados. Simétricos
X3_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 300
X3_0 + BALLOON_SIZE_2 * 2, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 290
X3_0 + BALLOON_SIZE_2 * 4, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 280
X3_0 + BALLOON_SIZE_2 * 6, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 270
X3_0 + BALLOON_SIZE_2 * 8, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 260
X3_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 300
X3_100 - BALLOON_SIZE_2 * 2, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 290
X3_100 - BALLOON_SIZE_2 * 4, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 280
X3_100 - BALLOON_SIZE_2 * 6, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 270
X3_100 - BALLOON_SIZE_2 * 8, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 260
formation: 23
# Diez enemigos BALLOON3. Hacia la derecha. Juntos. Simétricos
X3_0, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 300
X3_0 + BALLOON_SIZE_2 + 1, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 290
X3_0 + (BALLOON_SIZE_2 + 1) * 2, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 280
X3_0 + (BALLOON_SIZE_2 + 1) * 3, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 270
X3_0 + (BALLOON_SIZE_2 + 1) * 4, Y_BASE, VEL_POSITIVE, BALLOON, SIZE3, 260
X3_100, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 300
X3_100 - BALLOON_SIZE_2 - 1, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 290
X3_100 - (BALLOON_SIZE_2 + 1) * 2, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 280
X3_100 - (BALLOON_SIZE_2 + 1) * 3, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 270
X3_100 - (BALLOON_SIZE_2 + 1) * 4, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE3, 260
formation: 24
# Treinta enemigos BALLOON1. Del centro hacia los extremos. Juntos. Simétricos
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 300
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 305
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 310
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 315
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 320
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 325
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 330
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 335
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 340
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 345
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 350
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 355
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 300
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 305
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 310
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 315
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 320
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 325
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 330
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 335
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 340
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 345
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 350
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 355
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 360
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 360
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 365
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 365
X1_50, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 370
X1_50, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 370
formation: 25
# Treinta enemigos BALLOON1. Del centro hacia adentro. Juntos. Simétricos
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 300
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 295
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 290
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 285
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 280
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 275
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 270
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 265
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 260
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 255
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 250
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 245
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 300
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 295
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 290
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 285
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 280
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 275
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 270
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 265
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 260
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 255
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 250
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 245
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 240
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 240
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 235
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 235
X1_50 + 20, Y_BASE, VEL_NEGATIVE, BALLOON, SIZE1, 230
X1_50 - 20, Y_BASE, VEL_POSITIVE, BALLOON, SIZE1, 230

View File

@@ -16,5 +16,11 @@ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -S "$BASE_DIR" -B "$BUILD_DIR"
# 🛠️ Ejecutar IWYU con fix_includes.py # 🛠️ Ejecutar IWYU con fix_includes.py
echo "🚀 Ejecutando IWYU..." echo "🚀 Ejecutando IWYU..."
iwyu_tool.py -p "$BUILD_DIR" -- -Xiwyu --mapping_file="$MAPPING_FILE" -Xiwyu --verbose=3 \ iwyu_tool.py -p "$BUILD_DIR" -- -Xiwyu --mapping_file="$MAPPING_FILE" -Xiwyu --verbose=3 \
| python3 /usr/bin/fix_includes.py --update_comments --reorder --nosafe_headers --dry_run | python3 /usr/bin/fix_includes.py --update_comments --reorder --nosafe_headers
# 🧹 Reemplazar // for por // Para en líneas de #include
echo "✍️ Corrigiendo comentarios en includes..."
find "$BASE_DIR" -type f \( -name "*.cpp" -o -name "*.h" \) -exec \
sed -i '/^#include .*\/\/ for/s/\/\/ for/\/\/ Para/' {} +
echo "✅ Script completado."

26
linux_utils/run_iwyu_dry_run.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
# 🏁 Ruta base del proyecto
BASE_DIR="/home/sergio/gitea/coffee_crisis_arcade_edition"
# 📁 Ruta al build
BUILD_DIR="$BASE_DIR/build"
# 📄 Archivo de mapping personalizado
MAPPING_FILE="$BASE_DIR/linux_utils/sdl3_mapping.imp"
# 📦 Generar compile_commands.json
echo "🔧 Generando compile_commands.json..."
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -S "$BASE_DIR" -B "$BUILD_DIR"
# 🛠️ Ejecutar IWYU con fix_includes.py
echo "🚀 Ejecutando IWYU..."
iwyu_tool.py -p "$BUILD_DIR" -- -Xiwyu --mapping_file="$MAPPING_FILE" -Xiwyu --verbose=3 \
| python3 /usr/bin/fix_includes.py --update_comments --reorder --nosafe_headers --dry_run
# 🧹 Reemplazar // for por // Para en líneas de #include
echo "✍️ Corrigiendo comentarios en includes..."
find "$BASE_DIR" -type f \( -name "*.cpp" -o -name "*.h" \) -exec \
sed -i '/^#include .*\/\/ for/s/\/\/ for/\/\/ Para/' {} +
echo "✅ Script completado."

View File

@@ -1,10 +1,12 @@
#include "asset.h" #include "asset.h"
#include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_LogError #include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_LogError, SDL_LogWarn
#include <algorithm> // Para find_if, max #include <algorithm> // Para max
#include <fstream> // Para basic_ifstream, ifstream #include <fstream> // Para basic_ifstream, ifstream
#include <string> // Para allocator, string, char_traits, operator+ #include <functional> // Para identity
#include <ranges> // Para __find_if_fn, find_if
#include <string> // Para allocator, string, operator==, operator+, char_traits, basic_string
#include "utils.h" // Para getFileName #include "utils.h" // Para getFileName

View File

@@ -1,11 +1,10 @@
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include "background.h" #include "background.h"
#include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_FRect, SDL_Creat... #include <SDL3/SDL.h> // Para SDL_FRect, SDL_SetRenderTarget, SDL_CreateTexture, SDL_DestroyTexture, SDL_GetRenderTarget, SDL_RenderTexture, SDL_SetTextureAlphaMod, SDL_SetTextureBlendMode, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_RenderClear, SDL_SetRenderDrawColor, SDL_TextureAccess, SDL_FPoint
#include <algorithm> // Para clamp, max #include <algorithm> // Para clamp, max
#include <cmath> // Para cos, sin, M_PI #include <cmath> // Para M_PI, cos, sin
#include <string> // Para basic_string
#include "moving_sprite.h" // Para MovingSprite #include "moving_sprite.h" // Para MovingSprite
#include "param.h" // Para Param, ParamBackground, param #include "param.h" // Para Param, ParamBackground, param

View File

@@ -1,333 +1,256 @@
#include "asset.h"
#include "balloon.h" // Para BalloonType, BalloonSize, BALLOON_SIZE, BALLOON_VELX_NEGATIVE, BALLOON_VELX_POSITIVE
#include "balloon_formations.h" #include "balloon_formations.h"
#include "param.h" // Para Param, ParamGame, param
#include "balloon.h" // Para BALLOON_VELX_NEGATIVE, BALLOON_VELX_POSITIVE #include "utils.h" // Para Zone, BLOCK
#include "param.h" // Para param #include <array> // Para array
#include "utils.h" // Para ParamGame, Param, Zone, BLOCK #include <fstream>
#include <map>
#include <sstream>
#include <string>
void BalloonFormations::initBalloonFormations() { void BalloonFormations::initBalloonFormations() {
constexpr int Y4 = -BLOCK; // Calcular posiciones base
constexpr int Y_BASE = -BLOCK;
const int X4_0 = param.game.play_area.rect.x; const int X4_0 = param.game.play_area.rect.x;
const int X4_100 = param.game.play_area.rect.w - BALLOON_SIZE[3]; const int X4_100 = param.game.play_area.rect.w - BALLOON_SIZE[3];
constexpr int Y3 = -BLOCK;
const int X3_0 = param.game.play_area.rect.x; const int X3_0 = param.game.play_area.rect.x;
const int X3_100 = param.game.play_area.rect.w - BALLOON_SIZE[2]; const int X3_100 = param.game.play_area.rect.w - BALLOON_SIZE[2];
constexpr int Y2 = -BLOCK;
const int X2_0 = param.game.play_area.rect.x; const int X2_0 = param.game.play_area.rect.x;
const int X2_100 = param.game.play_area.rect.w - BALLOON_SIZE[1]; const int X2_100 = param.game.play_area.rect.w - BALLOON_SIZE[1];
constexpr int Y1 = -BLOCK;
const int X1_0 = param.game.play_area.rect.x; const int X1_0 = param.game.play_area.rect.x;
const int X1_50 = param.game.play_area.center_x - (BALLOON_SIZE[0] / 2); const int X1_50 = param.game.play_area.center_x - (BALLOON_SIZE[0] / 2);
const int X1_100 = param.game.play_area.rect.w - BALLOON_SIZE[0]; const int X1_100 = param.game.play_area.rect.w - BALLOON_SIZE[0];
// Variables calculadas para posiciones especiales
const int QUARTER1_X4 = param.game.play_area.first_quarter_x - (BALLOON_SIZE[3] / 2);
const int QUARTER3_X4 = param.game.play_area.third_quarter_x - (BALLOON_SIZE[3] / 2);
// Mapa de variables para reemplazar en el archivo
std::map<std::string, int> variables = {
{"X1_0", X1_0},
{"X1_50", X1_50},
{"X1_100", X1_100},
{"X2_0", X2_0},
{"X2_100", X2_100},
{"X3_0", X3_0},
{"X3_100", X3_100},
{"X4_0", X4_0},
{"X4_100", X4_100},
{"QUARTER1_X4", QUARTER1_X4},
{"QUARTER3_X4", QUARTER3_X4},
{"Y_BASE", Y_BASE},
{"BALLOON_SIZE_0", BALLOON_SIZE[0]},
{"BALLOON_SIZE_1", BALLOON_SIZE[1]},
{"BALLOON_SIZE_2", BALLOON_SIZE[2]},
{"BALLOON_SIZE_3", BALLOON_SIZE[3]},
{"VEL_POSITIVE", BALLOON_VELX_POSITIVE},
{"VEL_NEGATIVE", BALLOON_VELX_NEGATIVE}};
balloon_formation_.reserve(NUMBER_OF_BALLOON_FORMATIONS); balloon_formation_.reserve(NUMBER_OF_BALLOON_FORMATIONS);
constexpr int CREATION_TIME = 300; if (!loadFormationsFromFile(Asset::get()->get("balloon_formations.txt"), variables)) {
// Fallback: cargar formaciones por defecto si falla la carga del archivo
loadDefaultFormations();
}
}
// #00 - Dos enemigos BALLOON4 uno a cada extremo auto BalloonFormations::loadFormationsFromFile(const std::string& filename, const std::map<std::string, int>& variables) -> bool {
{ std::ifstream file(filename);
std::vector<BalloonFormationParams> init_params = { if (!file.is_open()) {
BalloonFormationParams(X4_0, Y4, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE4, CREATION_TIME), return false;
BalloonFormationParams(X4_100, Y4, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE4, CREATION_TIME)};
balloon_formation_.emplace_back(2, init_params);
} }
// #01 - Dos enemigos BALLOON4 uno a cada cuarto. Ambos van hacia el centro std::string line;
{ int current_formation = -1;
std::vector<BalloonFormationParams> init_params = { std::vector<BalloonFormationParams> current_params;
BalloonFormationParams(param.game.play_area.first_quarter_x - (BALLOON_SIZE[3] / 2), Y4, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE4, CREATION_TIME),
BalloonFormationParams(param.game.play_area.third_quarter_x - (BALLOON_SIZE[3] / 2), Y4, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE4, CREATION_TIME)};
balloon_formation_.emplace_back(2, init_params);
}
// #02 - Cuatro enemigos BALLOON2 uno detrás del otro. A la izquierda y hacia el centro while (std::getline(file, line)) {
{ // Eliminar espacios en blanco al inicio y final
std::vector<BalloonFormationParams> init_params; line = trim(line);
for (int i = 0; i < 4; ++i) {
init_params.emplace_back(X2_0 + (i * (BALLOON_SIZE[1] + 1)), Y2, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE2, CREATION_TIME - (10 * i)); // Saltar líneas vacías y comentarios
if (line.empty() || line[0] == '#') {
continue;
} }
balloon_formation_.emplace_back(4, init_params);
}
// #03 - Cuatro enemigos BALLOON2 uno detrás del otro. A la derecha y hacia el centro // Verificar si es una nueva formación
{ if (line.substr(0, 10) == "formation:") {
std::vector<BalloonFormationParams> init_params; // Guardar formación anterior si existe
for (int i = 0; i < 4; ++i) { if (current_formation >= 0 && !current_params.empty()) {
init_params.emplace_back(X2_100 - (i * (BALLOON_SIZE[1] + 1)), Y2, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE2, CREATION_TIME - (10 * i)); balloon_formation_.emplace_back(current_params.size(), current_params);
}
// Iniciar nueva formación
current_formation = std::stoi(line.substr(10));
current_params.clear();
continue;
} }
balloon_formation_.emplace_back(4, init_params);
}
// #04 - Tres enemigos BALLOON3. 0, 25, 50. Hacia la derecha // Procesar línea de parámetros de balloon
{ if (current_formation >= 0) {
std::vector<BalloonFormationParams> init_params; auto params = parseBalloonLine(line, variables);
for (int i = 0; i < 3; ++i) { if (params.has_value()) {
init_params.emplace_back(X3_0 + (i * (BALLOON_SIZE[2] * 2)), Y3, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE3, CREATION_TIME - (10 * i)); current_params.push_back(params.value());
}
balloon_formation_.emplace_back(3, init_params);
}
// #05 - Tres enemigos BALLOON3. 50, 75, 100. Hacia la izquierda
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 3; ++i) {
init_params.emplace_back(X3_100 - (i * (BALLOON_SIZE[2] * 2)), Y3, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE3, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(3, init_params);
}
// #06 - Tres enemigos BALLOON3. 0, 0, 0. Hacia la derecha
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 3; ++i) {
init_params.emplace_back(X3_0 + (i * (BALLOON_SIZE[2] + 1)), Y3, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE3, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(3, init_params);
}
// #07 - Tres enemigos BALLOON3. 100, 100, 100. Hacia la izquierda
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 3; ++i) {
init_params.emplace_back(X3_100 - (i * (BALLOON_SIZE[2] + 1)), Y3, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE3, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(3, init_params);
}
// #08 - Seis enemigos BALLOON1. 0, 0, 0, 0, 0, 0. Hacia la derecha
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 6; ++i) {
init_params.emplace_back(X1_0 + (i * (BALLOON_SIZE[0] + 1)), Y1, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE1, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(6, init_params);
}
// #09 - Seis enemigos BALLOON1. 100, 100, 100, 100, 100, 100. Hacia la izquierda
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 6; ++i) {
init_params.emplace_back(X1_100 - (i * (BALLOON_SIZE[0] + 1)), Y1, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE1, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(6, init_params);
}
// #10 - Tres enemigos BALLOON4 seguidos desde la izquierda. Hacia la derecha
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 3; ++i) {
init_params.emplace_back(X4_0 + (i * (BALLOON_SIZE[3] + 1)), Y4, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE4, CREATION_TIME - (15 * i));
}
balloon_formation_.emplace_back(3, init_params);
}
// #11 - Tres enemigos BALLOON4 seguidos desde la derecha. Hacia la izquierda
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 3; ++i) {
init_params.emplace_back(X4_100 - (i * (BALLOON_SIZE[3] + 1)), Y4, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE4, CREATION_TIME - (15 * i));
}
balloon_formation_.emplace_back(3, init_params);
}
// #12 - Seis enemigos BALLOON2 uno detrás del otro. A la izquierda y hacia el centro
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 6; ++i) {
init_params.emplace_back(X2_0 + (i * (BALLOON_SIZE[1] + 1)), Y2, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE2, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(6, init_params);
}
// #13 - Seis enemigos BALLOON2 uno detrás del otro. A la derecha y hacia el centro
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 6; ++i) {
init_params.emplace_back(X2_100 - (i * (BALLOON_SIZE[1] + 1)), Y2, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE2, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(6, init_params);
}
// #14 - Cinco enemigos BALLOON3. Hacia la derecha. Separados
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 5; ++i) {
init_params.emplace_back(X3_0 + (i * (BALLOON_SIZE[2] * 2)), Y3, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE3, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(5, init_params);
}
// #15 - Cinco enemigos BALLOON3. Hacia la izquierda. Separados
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 5; ++i) {
init_params.emplace_back(X3_100 - (i * (BALLOON_SIZE[2] * 2)), Y3, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE3, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(5, init_params);
}
// #16 - Cinco enemigos BALLOON3. Hacia la derecha. Juntos
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 5; ++i) {
init_params.emplace_back(X3_0 + (i * (BALLOON_SIZE[2] + 1)), Y3, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE3, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(5, init_params);
}
// #17 - Cinco enemigos BALLOON3. Hacia la izquierda. Juntos
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 5; ++i) {
init_params.emplace_back(X3_100 - (i * (BALLOON_SIZE[2] + 1)), Y3, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE3, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(5, init_params);
}
// #18 - Doce enemigos BALLOON1. Hacia la derecha. Juntos
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 12; ++i) {
init_params.emplace_back(X1_0 + (i * (BALLOON_SIZE[0] + 1)), Y1, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE1, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(12, init_params);
}
// #19 - Doce enemigos BALLOON1. Hacia la izquierda. Juntos
{
std::vector<BalloonFormationParams> init_params;
for (int i = 0; i < 12; ++i) {
init_params.emplace_back(X1_100 - (i * (BALLOON_SIZE[0] + 1)), Y1, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE1, CREATION_TIME - (10 * i));
}
balloon_formation_.emplace_back(12, init_params);
}
// #20 - Dos enemigos BALLOON4 seguidos desde la izquierda/derecha. Simétricos
{
std::vector<BalloonFormationParams> init_params;
const int HALF = 4 / 2;
for (int i = 0; i < 4; ++i) {
if (i < HALF) {
init_params.emplace_back(X4_0 + (i * (BALLOON_SIZE[3] + 1)), Y4, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE4, CREATION_TIME + (0 * i));
} else {
init_params.emplace_back(X4_100 - ((i - HALF) * (BALLOON_SIZE[3] + 1)), Y4, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE4, CREATION_TIME + (0 * i));
} }
} }
balloon_formation_.emplace_back(4, init_params);
} }
// #20 - Dos enemigos BALLOON4 seguidos desde la izquierda/derecha. Simétricos // Guardar última formación
{ if (current_formation >= 0 && !current_params.empty()) {
std::vector<BalloonFormationParams> init_params; balloon_formation_.emplace_back(current_params.size(), current_params);
const int HALF = 4 / 2; }
for (int i = 0; i < 4; ++i) {
if (i < HALF) { // Crear variantes flotantes (formaciones 50-99)
init_params.emplace_back(X4_0 + (i * (BALLOON_SIZE[3] + 1)), Y4, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE4, CREATION_TIME + (0 * i)); createFloaterVariants();
} else {
init_params.emplace_back(X4_100 - ((i - HALF) * (BALLOON_SIZE[3] + 1)), Y4, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE4, CREATION_TIME + (0 * i)); // Añadir formación de prueba
addTestFormation();
file.close();
return true;
}
auto BalloonFormations::parseBalloonLine(const std::string& line, const std::map<std::string, int>& variables) -> std::optional<BalloonFormationParams> {
std::istringstream iss(line);
std::string token;
std::vector<std::string> tokens;
// Dividir por comas
while (std::getline(iss, token, ',')) {
tokens.push_back(trim(token));
}
if (tokens.size() != 6) {
return std::nullopt;
}
try {
int x = evaluateExpression(tokens[0], variables);
int y = evaluateExpression(tokens[1], variables);
int vel_x = evaluateExpression(tokens[2], variables);
BalloonType type = (tokens[3] == "BALLOON") ? BalloonType::BALLOON : BalloonType::FLOATER;
BalloonSize size;
if (tokens[4] == "SIZE1") {
size = BalloonSize::SIZE1;
} else if (tokens[4] == "SIZE2") {
size = BalloonSize::SIZE2;
} else if (tokens[4] == "SIZE3") {
size = BalloonSize::SIZE3;
} else if (tokens[4] == "SIZE4") {
size = BalloonSize::SIZE4;
} else {
return std::nullopt;
}
int creation_time = evaluateExpression(tokens[5], variables);
return BalloonFormationParams(x, y, vel_x, type, size, creation_time);
} catch (const std::exception&) {
return std::nullopt;
}
}
auto BalloonFormations::evaluateExpression(const std::string& expr, const std::map<std::string, int>& variables) -> int {
std::string trimmed_expr = trim(expr);
// Si es un número directo
if ((std::isdigit(trimmed_expr[0]) != 0) || (trimmed_expr[0] == '-' && trimmed_expr.length() > 1)) {
return std::stoi(trimmed_expr);
}
// Si es una variable simple
if (variables.find(trimmed_expr) != variables.end()) {
return variables.at(trimmed_expr);
}
// Evaluación de expresiones simples (suma, resta, multiplicación)
return evaluateSimpleExpression(trimmed_expr, variables);
}
auto BalloonFormations::evaluateSimpleExpression(const std::string& expr, const std::map<std::string, int>& variables) -> int {
// Buscar operadores (+, -, *, /)
for (size_t i = 1; i < expr.length(); ++i) {
char op = expr[i];
if (op == '+' || op == '-' || op == '*' || op == '/') {
std::string left = trim(expr.substr(0, i));
std::string right = trim(expr.substr(i + 1));
int left_val = evaluateExpression(left, variables);
int right_val = evaluateExpression(right, variables);
switch (op) {
case '+':
return left_val + right_val;
case '-':
return left_val - right_val;
case '*':
return left_val * right_val;
case '/':
return right_val != 0 ? left_val / right_val : 0;
} }
} }
balloon_formation_.emplace_back(4, init_params);
} }
// #21 - Diez enemigos BALLOON2 uno detrás del otro. Izquierda/derecha. Simétricos // Si no se encuentra operador, intentar como variable o número
{ return variables.find(expr) != variables.end() ? variables.at(expr) : std::stoi(expr);
std::vector<BalloonFormationParams> init_params; }
const int HALF = 10 / 2;
for (int i = 0; i < 10; ++i) {
if (i < HALF) {
init_params.emplace_back(X2_0 + (i * (BALLOON_SIZE[1] + 1)), Y2, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE2, CREATION_TIME - (3 * i));
} else {
init_params.emplace_back(X2_100 - ((i - HALF) * (BALLOON_SIZE[1] + 1)), Y2, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE2, CREATION_TIME - (3 * (i - HALF)));
}
}
balloon_formation_.emplace_back(10, init_params);
}
// #22 - Diez enemigos BALLOON3. Hacia la derecha/izquierda. Separados. Simétricos auto BalloonFormations::trim(const std::string& str) -> std::string {
{ size_t start = str.find_first_not_of(" \t\r\n");
std::vector<BalloonFormationParams> init_params; if (start == std::string::npos) {
const int HALF = 10 / 2; return "";
for (int i = 0; i < 10; ++i) {
if (i < HALF) {
init_params.emplace_back(X3_0 + (i * (BALLOON_SIZE[2] * 2)), Y3, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE3, CREATION_TIME - (10 * i));
} else {
init_params.emplace_back(X3_100 - ((i - HALF) * (BALLOON_SIZE[2] * 2)), Y3, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE3, CREATION_TIME - (10 * (i - HALF)));
}
}
balloon_formation_.emplace_back(10, init_params);
} }
size_t end = str.find_last_not_of(" \t\r\n");
return str.substr(start, end - start + 1);
}
// #23 - Diez enemigos BALLOON3. Hacia la derecha. Juntos. Simétricos void BalloonFormations::createFloaterVariants() {
{
std::vector<BalloonFormationParams> init_params;
const int HALF = 10 / 2;
for (int i = 0; i < 10; ++i) {
if (i < HALF) {
init_params.emplace_back(X3_0 + (i * (BALLOON_SIZE[2] + 1)), Y3, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE3, CREATION_TIME - (10 * i));
} else {
init_params.emplace_back(X3_100 - ((i - HALF) * (BALLOON_SIZE[2] + 1)), Y3, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE3, CREATION_TIME - (10 * (i - HALF)));
}
}
balloon_formation_.emplace_back(10, init_params);
}
// #24 - Treinta enemigos BALLOON1. Del centro hacia los extremos. Juntos. Simétricos
{
std::vector<BalloonFormationParams> init_params;
const int HALF = 30 / 2;
for (int i = 0; i < 30; ++i) {
if (i < HALF) {
init_params.emplace_back(X1_50, Y1, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE1, CREATION_TIME + (5 * i));
} else {
init_params.emplace_back(X1_50, Y1, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE1, CREATION_TIME + (5 * (i - HALF)));
}
}
balloon_formation_.emplace_back(30, init_params);
}
// #25 - Treinta enemigos BALLOON1. Del centro hacia adentro. Juntos. Simétricos
{
std::vector<BalloonFormationParams> init_params;
const int HALF = 30 / 2;
for (int i = 0; i < 30; ++i) {
if (i < HALF) {
init_params.emplace_back(X1_50 + 20, Y1, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE1, CREATION_TIME - (5 * i));
} else {
init_params.emplace_back(X1_50 - 20, Y1, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE1, CREATION_TIME - (5 * (i - HALF)));
}
}
balloon_formation_.emplace_back(30, init_params);
}
// Reservar espacio para el vector
balloon_formation_.resize(100); balloon_formation_.resize(100);
// Crea las mismas formaciones pero con hexágonos a partir de la posición 50 del vector // Crear variantes flotantes de las primeras 50 formaciones
for (int k = 0; k < 50; k++) { for (size_t k = 0; k < 50 && k < balloon_formation_.size(); k++) {
std::vector<BalloonFormationParams> init_params; std::vector<BalloonFormationParams> floater_params;
for (int i = 0; i < balloon_formation_.at(k).number_of_balloons; i++) { floater_params.reserve(balloon_formation_[k].number_of_balloons);
init_params.emplace_back(
balloon_formation_.at(k).init.at(i).x, for (int i = 0; i < balloon_formation_[k].number_of_balloons; i++) {
balloon_formation_.at(k).init.at(i).y, const auto& original = balloon_formation_[k].init[i];
balloon_formation_.at(k).init.at(i).vel_x, floater_params.emplace_back(
BalloonType::FLOATER, original.x, original.y, original.vel_x, BalloonType::FLOATER, original.size, original.creation_counter);
balloon_formation_.at(k).init.at(i).size,
balloon_formation_.at(k).init.at(i).creation_counter);
} }
balloon_formation_.at(k + 50) = BalloonFormationUnit(balloon_formation_.at(k).number_of_balloons, init_params);
balloon_formation_[k + 50] = BalloonFormationUnit(
balloon_formation_[k].number_of_balloons, floater_params);
} }
}
// TEST void BalloonFormations::addTestFormation() {
std::vector<BalloonFormationParams> test_params = { std::vector<BalloonFormationParams> test_params = {
{10, Y1, 0, BalloonType::FLOATER, BalloonSize::SIZE1, 200}, {10, -BLOCK, 0, BalloonType::FLOATER, BalloonSize::SIZE1, 200},
{50, Y1, 0, BalloonType::FLOATER, BalloonSize::SIZE2, 200}, {50, -BLOCK, 0, BalloonType::FLOATER, BalloonSize::SIZE2, 200},
{90, Y1, 0, BalloonType::FLOATER, BalloonSize::SIZE3, 200}, {90, -BLOCK, 0, BalloonType::FLOATER, BalloonSize::SIZE3, 200},
{140, Y1, 0, BalloonType::FLOATER, BalloonSize::SIZE4, 200}}; {140, -BLOCK, 0, BalloonType::FLOATER, BalloonSize::SIZE4, 200}};
balloon_formation_.at(99) = BalloonFormationUnit(4, test_params); balloon_formation_[99] = BalloonFormationUnit(4, test_params);
}
void BalloonFormations::loadDefaultFormations() {
// Código de fallback con algunas formaciones básicas hardcodeadas
// para que el juego funcione aunque falle la carga del archivo
const int Y_BASE = -BLOCK;
const int X4_0 = param.game.play_area.rect.x;
const int X4_100 = param.game.play_area.rect.w - BALLOON_SIZE[3];
constexpr int CREATION_TIME = 300;
// Formación básica #00
std::vector<BalloonFormationParams> basic_formation = {
BalloonFormationParams(X4_0, Y_BASE, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE4, CREATION_TIME),
BalloonFormationParams(X4_100, Y_BASE, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE4, CREATION_TIME)};
balloon_formation_.emplace_back(2, basic_formation);
} }
// Inicializa los conjuntos de formaciones // Inicializa los conjuntos de formaciones
@@ -337,41 +260,131 @@ void BalloonFormations::initBalloonFormationPools() {
// Set #0 // Set #0
balloon_formation_pool_.at(0) = { balloon_formation_pool_.at(0) = {
&balloon_formation_.at(0), &balloon_formation_.at(1), &balloon_formation_.at(2), &balloon_formation_.at(3), &balloon_formation_.at(4), &balloon_formation_.at(5), &balloon_formation_.at(6), &balloon_formation_.at(7), &balloon_formation_.at(8), &balloon_formation_.at(9)}; &balloon_formation_.at(0),
&balloon_formation_.at(1),
&balloon_formation_.at(2),
&balloon_formation_.at(3),
&balloon_formation_.at(4),
&balloon_formation_.at(5),
&balloon_formation_.at(6),
&balloon_formation_.at(7),
&balloon_formation_.at(8),
&balloon_formation_.at(9)};
// Set #1 // Set #1
balloon_formation_pool_.at(1) = { balloon_formation_pool_.at(1) = {
&balloon_formation_.at(10), &balloon_formation_.at(11), &balloon_formation_.at(12), &balloon_formation_.at(13), &balloon_formation_.at(14), &balloon_formation_.at(15), &balloon_formation_.at(16), &balloon_formation_.at(17), &balloon_formation_.at(18), &balloon_formation_.at(19)}; &balloon_formation_.at(10),
&balloon_formation_.at(11),
&balloon_formation_.at(12),
&balloon_formation_.at(13),
&balloon_formation_.at(14),
&balloon_formation_.at(15),
&balloon_formation_.at(16),
&balloon_formation_.at(17),
&balloon_formation_.at(18),
&balloon_formation_.at(19)};
// Set #2 // Set #2
balloon_formation_pool_.at(2) = { balloon_formation_pool_.at(2) = {
&balloon_formation_.at(0), &balloon_formation_.at(1), &balloon_formation_.at(2), &balloon_formation_.at(3), &balloon_formation_.at(4), &balloon_formation_.at(55), &balloon_formation_.at(56), &balloon_formation_.at(57), &balloon_formation_.at(58), &balloon_formation_.at(59)}; &balloon_formation_.at(0),
&balloon_formation_.at(1),
&balloon_formation_.at(2),
&balloon_formation_.at(3),
&balloon_formation_.at(4),
&balloon_formation_.at(55),
&balloon_formation_.at(56),
&balloon_formation_.at(57),
&balloon_formation_.at(58),
&balloon_formation_.at(59)};
// Set #3 // Set #3
balloon_formation_pool_.at(3) = { balloon_formation_pool_.at(3) = {
&balloon_formation_.at(50), &balloon_formation_.at(51), &balloon_formation_.at(52), &balloon_formation_.at(53), &balloon_formation_.at(54), &balloon_formation_.at(5), &balloon_formation_.at(6), &balloon_formation_.at(7), &balloon_formation_.at(8), &balloon_formation_.at(9)}; &balloon_formation_.at(50),
&balloon_formation_.at(51),
&balloon_formation_.at(52),
&balloon_formation_.at(53),
&balloon_formation_.at(54),
&balloon_formation_.at(5),
&balloon_formation_.at(6),
&balloon_formation_.at(7),
&balloon_formation_.at(8),
&balloon_formation_.at(9)};
// Set #4 // Set #4
balloon_formation_pool_.at(4) = { balloon_formation_pool_.at(4) = {
&balloon_formation_.at(60), &balloon_formation_.at(61), &balloon_formation_.at(62), &balloon_formation_.at(63), &balloon_formation_.at(64), &balloon_formation_.at(65), &balloon_formation_.at(66), &balloon_formation_.at(67), &balloon_formation_.at(68), &balloon_formation_.at(69)}; &balloon_formation_.at(60),
&balloon_formation_.at(61),
&balloon_formation_.at(62),
&balloon_formation_.at(63),
&balloon_formation_.at(64),
&balloon_formation_.at(65),
&balloon_formation_.at(66),
&balloon_formation_.at(67),
&balloon_formation_.at(68),
&balloon_formation_.at(69)};
// Set #5 // Set #5
balloon_formation_pool_.at(5) = { balloon_formation_pool_.at(5) = {
&balloon_formation_.at(10), &balloon_formation_.at(61), &balloon_formation_.at(12), &balloon_formation_.at(63), &balloon_formation_.at(14), &balloon_formation_.at(65), &balloon_formation_.at(16), &balloon_formation_.at(67), &balloon_formation_.at(18), &balloon_formation_.at(69)}; &balloon_formation_.at(10),
&balloon_formation_.at(61),
&balloon_formation_.at(12),
&balloon_formation_.at(63),
&balloon_formation_.at(14),
&balloon_formation_.at(65),
&balloon_formation_.at(16),
&balloon_formation_.at(67),
&balloon_formation_.at(18),
&balloon_formation_.at(69)};
// Set #6 // Set #6
balloon_formation_pool_.at(6) = { balloon_formation_pool_.at(6) = {
&balloon_formation_.at(60), &balloon_formation_.at(11), &balloon_formation_.at(62), &balloon_formation_.at(13), &balloon_formation_.at(64), &balloon_formation_.at(15), &balloon_formation_.at(66), &balloon_formation_.at(17), &balloon_formation_.at(68), &balloon_formation_.at(19)}; &balloon_formation_.at(60),
&balloon_formation_.at(11),
&balloon_formation_.at(62),
&balloon_formation_.at(13),
&balloon_formation_.at(64),
&balloon_formation_.at(15),
&balloon_formation_.at(66),
&balloon_formation_.at(17),
&balloon_formation_.at(68),
&balloon_formation_.at(19)};
// Set #7 // Set #7
balloon_formation_pool_.at(7) = { balloon_formation_pool_.at(7) = {
&balloon_formation_.at(20), &balloon_formation_.at(21), &balloon_formation_.at(22), &balloon_formation_.at(23), &balloon_formation_.at(24), &balloon_formation_.at(65), &balloon_formation_.at(66), &balloon_formation_.at(67), &balloon_formation_.at(68), &balloon_formation_.at(69)}; &balloon_formation_.at(20),
&balloon_formation_.at(21),
&balloon_formation_.at(22),
&balloon_formation_.at(23),
&balloon_formation_.at(24),
&balloon_formation_.at(65),
&balloon_formation_.at(66),
&balloon_formation_.at(67),
&balloon_formation_.at(68),
&balloon_formation_.at(69)};
// Set #8 // Set #8
balloon_formation_pool_.at(8) = { balloon_formation_pool_.at(8) = {
&balloon_formation_.at(70), &balloon_formation_.at(71), &balloon_formation_.at(72), &balloon_formation_.at(73), &balloon_formation_.at(74), &balloon_formation_.at(15), &balloon_formation_.at(16), &balloon_formation_.at(17), &balloon_formation_.at(18), &balloon_formation_.at(19)}; &balloon_formation_.at(70),
&balloon_formation_.at(71),
&balloon_formation_.at(72),
&balloon_formation_.at(73),
&balloon_formation_.at(74),
&balloon_formation_.at(15),
&balloon_formation_.at(16),
&balloon_formation_.at(17),
&balloon_formation_.at(18),
&balloon_formation_.at(19)};
// Set #9 // Set #9
balloon_formation_pool_.at(9) = { balloon_formation_pool_.at(9) = {
&balloon_formation_.at(20), &balloon_formation_.at(21), &balloon_formation_.at(22), &balloon_formation_.at(23), &balloon_formation_.at(24), &balloon_formation_.at(70), &balloon_formation_.at(71), &balloon_formation_.at(72), &balloon_formation_.at(73), &balloon_formation_.at(74)}; &balloon_formation_.at(20),
&balloon_formation_.at(21),
&balloon_formation_.at(22),
&balloon_formation_.at(23),
&balloon_formation_.at(24),
&balloon_formation_.at(70),
&balloon_formation_.at(71),
&balloon_formation_.at(72),
&balloon_formation_.at(73),
&balloon_formation_.at(74)};
} }

View File

@@ -1,8 +1,12 @@
#pragma once #pragma once
#include <vector>
#include "balloon.h" // Para BALLOON_VELX_NEGATIVE, BALLOON_VELX_POSITIVE #include "balloon.h" // Para BALLOON_VELX_NEGATIVE, BALLOON_VELX_POSITIVE
#include <fstream>
#include <map>
#include <optional>
#include <sstream>
#include <string>
#include <vector>
// --- Constantes de configuración --- // --- Constantes de configuración ---
constexpr int NUMBER_OF_BALLOON_FORMATIONS = 100; constexpr int NUMBER_OF_BALLOON_FORMATIONS = 100;
@@ -32,14 +36,14 @@ struct BalloonFormationUnit {
std::vector<BalloonFormationParams> init; // Vector con todas las inicializaciones de los globos de la formación std::vector<BalloonFormationParams> init; // Vector con todas las inicializaciones de los globos de la formación
// Constructor con parámetros // Constructor con parámetros
BalloonFormationUnit(int num_balloons, const std::vector<BalloonFormationParams> &init_params) BalloonFormationUnit(int num_balloons, const std::vector<BalloonFormationParams>& init_params)
: number_of_balloons(num_balloons), init(init_params) {} : number_of_balloons(num_balloons), init(init_params) {}
// Constructor por defecto // Constructor por defecto
BalloonFormationUnit() : number_of_balloons(0) {} BalloonFormationUnit() : number_of_balloons(0) {}
}; };
using BalloonFormationPool = std::vector<const BalloonFormationUnit *>; using BalloonFormationPool = std::vector<const BalloonFormationUnit*>;
// --- Clase BalloonFormations --- // --- Clase BalloonFormations ---
class BalloonFormations { class BalloonFormations {
@@ -52,9 +56,9 @@ class BalloonFormations {
~BalloonFormations() = default; ~BalloonFormations() = default;
// --- Getters --- // --- Getters ---
auto getPool(int pool) -> const BalloonFormationPool & { return balloon_formation_pool_.at(pool); } auto getPool(int pool) -> const BalloonFormationPool& { return balloon_formation_pool_.at(pool); }
auto getSet(int pool, int set) -> const BalloonFormationUnit & { return *balloon_formation_pool_.at(pool).at(set); } auto getSet(int pool, int set) -> const BalloonFormationUnit& { return *balloon_formation_pool_.at(pool).at(set); }
[[nodiscard]] auto getSet(int set) const -> const BalloonFormationUnit & { return balloon_formation_.at(set); } [[nodiscard]] auto getSet(int set) const -> const BalloonFormationUnit& { return balloon_formation_.at(set); }
private: private:
// --- Datos --- // --- Datos ---
@@ -62,6 +66,14 @@ class BalloonFormations {
std::vector<BalloonFormationPool> balloon_formation_pool_; // Conjuntos de formaciones enemigas std::vector<BalloonFormationPool> balloon_formation_pool_; // Conjuntos de formaciones enemigas
// --- Métodos internos de inicialización --- // --- Métodos internos de inicialización ---
void initBalloonFormations(); void initBalloonFormations(); // Inicializa la lista principal de formaciones de globos disponibles
void initBalloonFormationPools(); void initBalloonFormationPools(); // Prepara las estructuras de agrupamiento o reutilización de formaciones (pools)
auto loadFormationsFromFile(const std::string& filename, const std::map<std::string, int>& variables) -> bool; // Carga las formaciones desde un archivo, evaluando variables dinámicas
auto parseBalloonLine(const std::string& line, const std::map<std::string, int>& variables) -> std::optional<BalloonFormationParams>; // Parsea una línea individual del archivo y genera parámetros de formación
auto evaluateExpression(const std::string& expr, const std::map<std::string, int>& variables) -> int; // Evalúa expresiones matemáticas con variables definidas (complejas)
auto evaluateSimpleExpression(const std::string& expr, const std::map<std::string, int>& variables) -> int; // Evalúa expresiones más sencillas (sin paréntesis o operadores avanzados)
static auto trim(const std::string& str) -> std::string; // Elimina espacios en blanco al inicio y fin de una cadena
void createFloaterVariants(); // Genera variantes de globos flotantes según configuración o aleatoriedad
void addTestFormation(); // Añade una formación de prueba para debug o validación en tiempo de desarrollo
void loadDefaultFormations(); // Carga las formaciones por defecto incluidas en el juego si no hay archivo externo
}; };

View File

@@ -2,11 +2,12 @@
#include <SDL3/SDL.h> // Para SDL_FRect #include <SDL3/SDL.h> // Para SDL_FRect
#include <array> // Para array
#include <memory> // Para shared_ptr, unique_ptr #include <memory> // Para shared_ptr, unique_ptr
#include <string> // Para string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector
#include "balloon.h" // Para BALLOON_SPEED, Balloon #include "balloon.h" // Para BALLOON_SPEED, Balloon, BalloonSize (ptr only), BalloonType (ptr only)
#include "balloon_formations.h" // Para BalloonFormations #include "balloon_formations.h" // Para BalloonFormations
#include "explosions.h" // Para Explosions #include "explosions.h" // Para Explosions
#include "param.h" // Para Param, ParamGame, param #include "param.h" // Para Param, ParamGame, param

View File

@@ -3,6 +3,7 @@
#include <SDL3/SDL.h> // Para Uint8 #include <SDL3/SDL.h> // Para Uint8
#include <memory> // Para unique_ptr #include <memory> // Para unique_ptr
#include <string> // Para string
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.h" // Para AnimatedSprite
#include "utils.h" // Para Circle #include "utils.h" // Para Circle

View File

@@ -1,10 +1,11 @@
#include "define_buttons.h" #include "define_buttons.h"
#include <ranges> #include <algorithm> // Para max, __all_of_fn, all_of
#include <functional> // Para identity
#include "input.h" // Para Input, InputAction #include "input.h" // Para Input, InputAction
#include "lang.h" // Para getText #include "lang.h" // Para getText
#include "options.h" // Para OptionsController, Options, options #include "options.h" // Para GamepadOptions, controllers
#include "param.h" // Para Param, param, ParamGame, ParamTitle #include "param.h" // Para Param, param, ParamGame, ParamTitle
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "text.h" // Para Text #include "text.h" // Para Text

View File

@@ -258,6 +258,7 @@ void Director::setFileList() {
Asset::get()->add(PREFIX + "/data/config/demo1.bin", AssetType::DEMODATA); Asset::get()->add(PREFIX + "/data/config/demo1.bin", AssetType::DEMODATA);
Asset::get()->add(PREFIX + "/data/config/demo2.bin", AssetType::DEMODATA); Asset::get()->add(PREFIX + "/data/config/demo2.bin", AssetType::DEMODATA);
Asset::get()->add(PREFIX + "/data/config/gamecontrollerdb.txt", AssetType::DATA); Asset::get()->add(PREFIX + "/data/config/gamecontrollerdb.txt", AssetType::DATA);
Asset::get()->add(PREFIX + "/data/config/balloon_formations.txt", AssetType::DATA);
// Musicas // Musicas
Asset::get()->add(PREFIX + "/data/music/intro.ogg", AssetType::MUSIC); Asset::get()->add(PREFIX + "/data/music/intro.ogg", AssetType::MUSIC);

View File

@@ -14,7 +14,7 @@ class Director {
~Director(); ~Director();
// --- Bucle principal --- // --- Bucle principal ---
auto run() -> int; static auto run() -> int;
private: private:
// --- Variables internas --- // --- Variables internas ---

View File

@@ -1,7 +1,6 @@
#include "gif.h" #include "gif.h"
#include <SDL3/SDL.h> // Para SDL_LogError, SDL_LogCategory, SDL_LogInfo #include <SDL3/SDL.h> // Para SDL_LogError, SDL_LogCategory, SDL_LogInfo
#include <cstring> // Para memcpy, size_t #include <cstring> // Para memcpy, size_t
#include <stdexcept> // Para runtime_error #include <stdexcept> // Para runtime_error
#include <string> // Para char_traits, operator==, basic_string, string #include <string> // Para char_traits, operator==, basic_string, string

View File

@@ -2,7 +2,6 @@
#include <SDL3/SDL.h> // Para SDL_GL_GetProcAddress, SDL_LogError #include <SDL3/SDL.h> // Para SDL_GL_GetProcAddress, SDL_LogError
#include <stdint.h> // Para uintptr_t #include <stdint.h> // Para uintptr_t
#include <cstring> // Para strncmp #include <cstring> // Para strncmp
#include <stdexcept> // Para runtime_error #include <stdexcept> // Para runtime_error
#include <vector> // Para vector #include <vector> // Para vector

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_Texture, SDL_Window #include <SDL3/SDL.h> // Para SDL_Texture, SDL_Window
#include <string> // Para basic_string, string #include <string> // Para basic_string, string
namespace shader { namespace shader {

View File

@@ -1,9 +1,8 @@
#include "game_logo.h" #include "game_logo.h"
#include <SDL3/SDL.h> // Para SDL_SetTextureScaleMode, SDL_FlipMode #include <SDL3/SDL.h> // Para SDL_SetTextureScaleMode, SDL_FlipMode, SDL_ScaleMode
#include <algorithm> // Para max #include <algorithm> // Para max
#include <string> // Para basic_string
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.h" // Para AnimatedSprite
#include "audio.h" // Para Audio #include "audio.h" // Para Audio

View File

@@ -192,15 +192,13 @@ auto Item::getCoffeeMachineSpawn(int player_x, int item_width, int area_width, i
if (can_spawn_right) { if (can_spawn_right) {
// Solo lado derecho disponible // Solo lado derecho disponible
return rand() % (RIGHT_BOUND - exclude_right) + exclude_right; return rand() % (RIGHT_BOUND - exclude_right) + exclude_right;
} else { } // No hay espacio suficiente lejos del jugador
// No hay espacio suficiente lejos del jugador // Por ahora, intentar spawn en el extremo más lejano posible
// Por ahora, intentar spawn en el extremo más lejano posible int distance_to_left = abs(player_x - LEFT_BOUND);
int distance_to_left = abs(player_x - LEFT_BOUND); int distance_to_right = abs(RIGHT_BOUND - player_x);
int distance_to_right = abs(RIGHT_BOUND - player_x);
if (distance_to_left > distance_to_right) { if (distance_to_left > distance_to_right) {
return LEFT_BOUND; return LEFT_BOUND;
}
return RIGHT_BOUND - item_width;
} }
return RIGHT_BOUND - item_width;
} }

View File

@@ -8,6 +8,7 @@ Actualizando a la versión "Arcade Edition" en 08/05/2024
*/ */
#include <memory> // Para make_unique, unique_ptr #include <memory> // Para make_unique, unique_ptr
#include <span> // Para span
#include "director.h" // Para Director #include "director.h" // Para Director

View File

@@ -58,7 +58,7 @@ void Notifier::update() {
auto Notifier::shouldProcessNotification(int index) const -> bool { auto Notifier::shouldProcessNotification(int index) const -> bool {
// Si la notificación anterior está "saliendo", no hagas nada // Si la notificación anterior está "saliendo", no hagas nada
return !(index > 0 && notifications_[index - 1].state == NotificationStatus::RISING); return index <= 0 || notifications_[index - 1].state != NotificationStatus::RISING;
} }
void Notifier::processNotification(int index) { void Notifier::processNotification(int index) {

View File

@@ -1,7 +1,6 @@
// IWYU pragma: no_include <bits/std_abs.h> // IWYU pragma: no_include <bits/std_abs.h>
#include "path_sprite.h" #include "path_sprite.h"
#include <cmath> // Para abs
#include <functional> // Para function #include <functional> // Para function
#include <utility> // Para move #include <utility> // Para move

View File

@@ -1,10 +1,11 @@
#include "scoreboard.h" #include "scoreboard.h"
#include <SDL3/SDL.h> // Para SDL_DestroyTexture, SDL_SetRenderDrawColor #include <SDL3/SDL.h> // Para SDL_DestroyTexture, SDL_SetRenderDrawColor, SDL_SetRenderTarget, SDL_CreateTexture, SDL_GetRenderTarget, SDL_GetTicks, SDL_RenderClear, SDL_RenderLine, SDL_RenderTexture, SDL_SetTextureBlendMode, SDL_FRect, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_Texture, SDL_TextureAccess
#include <cmath> // Para roundf #include <algorithm> // Para max
#include <iomanip> // Para operator<<, setfill, setw #include <cmath> // Para roundf
#include <sstream> // Para basic_ostringstream, basic_ostream, basic_os... #include <iomanip> // Para operator<<, setfill, setw
#include <sstream> // Para basic_ostream, basic_ostringstream, basic_ostream::operator<<, ostringstream
#include "enter_name.h" // Para NAME_SIZE #include "enter_name.h" // Para NAME_SIZE
#include "lang.h" // Para getText #include "lang.h" // Para getText

View File

@@ -1,15 +1,14 @@
// IWYU pragma: no_include <bits/std_abs.h> // IWYU pragma: no_include <bits/std_abs.h>
#include "credits.h" #include "credits.h"
#include <SDL3/SDL.h> // Para SDL_RenderFillRect, SDL_RenderTexture #include <SDL3/SDL.h> // Para SDL_RenderFillRect, SDL_RenderTexture, SDL_SetRenderTarget, SDL_SetRenderDrawColor, SDL_CreateTexture, SDL_DestroyTexture, SDL_GetTicks, SDL_GetRenderTarget, SDL_PixelFormat, SDL_PollEvent, SDL_RenderClear, SDL_RenderRect, SDL_SetTextureBlendMode, SDL_TextureAccess, SDL_BLENDMODE_BLEND, SDL_Event
#include <algorithm> // Para max, min, clamp #include <algorithm> // Para max, min, clamp
#include <array> // Para array #include <array> // Para array
#include <cmath> // Para abs #include <stdexcept> // Para runtime_error
#include <stdexcept> // Para runtime_error #include <string> // Para basic_string, string
#include <string> // Para basic_string, string #include <string_view> // Para string_view
#include <string_view> #include <vector> // Para vector
#include <vector> // Para vector
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "balloon_manager.h" // Para BalloonManager #include "balloon_manager.h" // Para BalloonManager
@@ -28,7 +27,7 @@
#include "texture.h" // Para Texture #include "texture.h" // Para Texture
#include "tiled_bg.h" // Para TiledBG, TiledBGMode #include "tiled_bg.h" // Para TiledBG, TiledBGMode
#include "ui/service_menu.h" // Para ServiceMenu #include "ui/service_menu.h" // Para ServiceMenu
#include "utils.h" // Para Color, Zone, SHADOW_TEXT_COLOR, NO_TEXT... #include "utils.h" // Para Zone, SHADOW_TEXT_COLOR, NO_TEXT_COLOR, Color
// Textos // Textos
constexpr std::string_view TEXT_COPYRIGHT = "@2020,2025 JailDesigner"; constexpr std::string_view TEXT_COPYRIGHT = "@2020,2025 JailDesigner";

View File

@@ -6,27 +6,24 @@
#include <string> // Para string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector
#include "bullet.h" // Para Bullet, BulletType (ptr only)
#include "item.h" // Para Item, ItemType (ptr only)
#include "manage_hiscore_table.h" // Para HiScoreEntry #include "manage_hiscore_table.h" // Para HiScoreEntry
#include "options.h" // Para SettingsOptions, settings, DifficultyCode (ptr only) #include "options.h" // Para SettingsOptions, settings, DifficultyCode (ptr only)
#include "path_sprite.h" // Para PathSprite, Path
#include "player.h" // Para Player #include "player.h" // Para Player
#include "smart_sprite.h" // Para SmartSprite
#include "utils.h" // Para Demo #include "utils.h" // Para Demo
class Background; class Background;
class Balloon; class Balloon;
class BalloonManager; class BalloonManager;
class Bullet;
class Fade; class Fade;
class Input; class Input;
class Item;
class PathSprite;
class Scoreboard; class Scoreboard;
class Screen; class Screen;
class SmartSprite;
class Tabe; class Tabe;
class Texture; class Texture;
enum class BulletType : Uint8;
enum class ItemType;
struct Path;
// Modo demo // Modo demo
constexpr bool GAME_MODE_DEMO_OFF = false; constexpr bool GAME_MODE_DEMO_OFF = false;

View File

@@ -6,14 +6,13 @@
#include <string> // Para string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector
#include "utils.h" // Para Color #include "path_sprite.h" // Para Path, PathSprite (ptr only)
#include "utils.h" // Para Color
class Background; class Background;
class Fade; class Fade;
class PathSprite;
class Sprite; class Sprite;
enum class FadeMode : Uint8; enum class FadeMode : Uint8;
struct Path;
/* /*
Esta clase gestiona un estado del programa. Se encarga de mostrar la tabla con las puntuaciones Esta clase gestiona un estado del programa. Se encarga de mostrar la tabla con las puntuaciones

View File

@@ -5,8 +5,9 @@
#include <memory> // Para unique_ptr, shared_ptr #include <memory> // Para unique_ptr, shared_ptr
#include <vector> // Para vector #include <vector> // Para vector
#include "sprite.h" // Para Sprite
class Fade; class Fade;
class Sprite;
class Text; class Text;
class Texture; class Texture;
class TiledBG; class TiledBG;

View File

@@ -1,11 +1,12 @@
#include "intro.h" #include "intro.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderDrawColor, SDL... #include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderDrawColor, SDL_FRect, SDL_RenderFillRect, SDL_GetRenderTarget, SDL_RenderClear, SDL_RenderRect, SDL_SetRenderTarget, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_PollEvent, SDL_RenderTexture, SDL_TextureAccess, SDLK_A, SDLK_C, SDLK_D, SDLK_F, SDLK_S, SDLK_V, SDLK_X, SDLK_Z, SDL_Event, SDL_EventType, Uint32
#include <algorithm> // Para max
#include <array> // Para array #include <array> // Para array
#include <functional> // Para function #include <functional> // Para function
#include <iostream> // Para basic_ostream, basic_ostream::operator<< #include <iostream> // Para basic_ostream, basic_ostream::operator<<, operator<<, cout, endl, hex
#include <string> // Para basic_string, char_traits, string #include <string> // Para char_traits, basic_string, string
#include <utility> // Para move #include <utility> // Para move
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
@@ -13,7 +14,7 @@
#include "global_inputs.h" // Para check #include "global_inputs.h" // Para check
#include "input.h" // Para Input #include "input.h" // Para Input
#include "lang.h" // Para getText #include "lang.h" // Para getText
#include "param.h" // Para Param, param, ParamGame, ParamIntro, Para... #include "param.h" // Para Param, param, ParamGame, ParamIntro, ParamTitle
#include "path_sprite.h" // Para PathSprite, PathType #include "path_sprite.h" // Para PathSprite, PathType
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
@@ -21,7 +22,7 @@
#include "text.h" // Para Text #include "text.h" // Para Text
#include "texture.h" // Para Texture #include "texture.h" // Para Texture
#include "tiled_bg.h" // Para TiledBG, TiledBGMode #include "tiled_bg.h" // Para TiledBG, TiledBGMode
#include "utils.h" // Para Color, Zone, easeInOutExpo, easeInElastic #include "utils.h" // Para Color, Zone, easeInOutExpo, easeInElastic, easeOutBounce, easeOutElastic, easeOutQuad, easeOutQuint
#include "writer.h" // Para Writer #include "writer.h" // Para Writer
#ifdef DEBUG #ifdef DEBUG

View File

@@ -1,9 +1,9 @@
#include "logo.h" #include "logo.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_PollEvent, SDL_Event #include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_PollEvent, SDL_Event, SDL_FRect
#include <string> // Para basic_string #include <algorithm> // Para max
#include <utility> // Para move #include <utility> // Para move
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "global_events.h" // Para check #include "global_events.h" // Para check

View File

@@ -2,12 +2,13 @@
#include <SDL3/SDL.h> // Para SDL_FPoint, Uint64 #include <SDL3/SDL.h> // Para SDL_FPoint, Uint64
#include <memory> // Para shared_ptr, unique_ptr #include <memory> // Para unique_ptr, shared_ptr
#include <vector> // Para vector #include <vector> // Para vector
class Sprite; #include "sprite.h" // Para Sprite
#include "utils.h" // Para Color
class Texture; class Texture;
struct Color;
/* /*
Esta clase gestiona un estado del programa. Se encarga de dibujar por pantalla el Esta clase gestiona un estado del programa. Se encarga de dibujar por pantalla el

View File

@@ -4,10 +4,8 @@
#include <SDL3/SDL.h> // Para SDL_FlipMode, SDL_GetTicks #include <SDL3/SDL.h> // Para SDL_FlipMode, SDL_GetTicks
#include <algorithm> // Para max #include <algorithm> // Para max
#include <array> #include <array> // Para array
#include <cmath> // Para abs #include <cstdlib> // Para rand, abs
#include <cstdlib> // Para rand, abs
#include <string> // Para basic_string
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "param.h" // Para Param, ParamGame, param #include "param.h" // Para Param, ParamGame, param

View File

@@ -1,12 +1,11 @@
#include "tiled_bg.h" #include "tiled_bg.h"
#include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_CreateTexture, SDL_De... #include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_CreateTexture, SDL_DestroyTexture, SDL_FRect, SDL_GetRenderTarget, SDL_RenderTexture, SDL_PixelFormat, SDL_TextureAccess
#include <cmath> // Para sin #include <cmath> // Para sin
#include <cstdlib> // Para rand #include <cstdlib> // Para rand
#include <memory> // Para unique_ptr, make_unique #include <memory> // Para allocator, unique_ptr, make_unique
#include <numbers> #include <numbers> // Para pi
#include <string> // Para basic_string
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "screen.h" // Para Screen #include "screen.h" // Para Screen

View File

@@ -1,8 +1,7 @@
#include "menu_renderer.h" #include "menu_renderer.h"
#include <algorithm> // Para max #include <algorithm> // Para max
#include <string> // Para basic_string #include <utility> // Para pair, move
#include <utility> // Para pair, move
#include "menu_option.h" // Para MenuOption #include "menu_option.h" // Para MenuOption
#include "param.h" // Para Param, param, ParamServiceMenu, ParamGame #include "param.h" // Para Param, param, ParamServiceMenu, ParamGame

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FRect, Uint32 #include <SDL3/SDL.h> // Para SDL_FRect, Uint32
#include <array> #include <array>
#include <cstddef> // Para size_t #include <cstddef> // Para size_t
#include <memory> // Para shared_ptr, unique_ptr #include <memory> // Para shared_ptr, unique_ptr

View File

@@ -1,10 +1,12 @@
#include "ui/service_menu.h" #include "ui/service_menu.h"
#include <algorithm> // Para max
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "lang.h" // Para getText, getCodeFromName, getNameFromCode #include "lang.h" // Para getText, getCodeFromName, getNameFromCode
#include "menu_option.h" // Para MenuOption, BoolOption, ActionOption, Int... #include "menu_option.h" // Para MenuOption, BoolOption, ActionOption, IntOption, FolderOption, ListOption
#include "menu_renderer.h" // Para MenuRenderer #include "menu_renderer.h" // Para MenuRenderer
#include "options.h" // Para PendingChanges, VideoOptions, pending_cha... #include "options.h" // Para PendingChanges, VideoOptions, pending_changes, video, AudioOptions, SettingsOptions, audio, checkPendingChanges, settings, WindowOptions, getDifficultyCodeFromName, getDifficultyNameFromCode, window, MusicOptions, SoundOptions
#include "param.h" // Para Param, param, ParamGame, ParamServiceMenu #include "param.h" // Para Param, param, ParamGame, ParamServiceMenu
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "screen.h" // Para Screen #include "screen.h" // Para Screen

View File

@@ -1,12 +1,13 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint8, SDL_FRect, SDL_FPoint, SDL_Renderer #include <SDL3/SDL.h> // Para Uint8, SDL_FRect, SDL_FPoint, SDL_Renderer
#include <bits/std_abs.h> // Para abs
#include <algorithm> // Para max, min #include <algorithm> // Para max, min
#include <array> // Para array #include <array> // Para array
#include <cctype> // Para isxdigit #include <cctype> // Para isxdigit
#include <cstdint> // Para int32_t #include <cstdint> // Para int32_t
#include <cstdlib> // Para abs, size_t #include <cstdlib> // Para size_t, abs
#include <stdexcept> // Para invalid_argument #include <stdexcept> // Para invalid_argument
#include <string> // Para string, basic_string, stoi #include <string> // Para string, basic_string, stoi
#include <vector> // Para vector #include <vector> // Para vector