From fa6fbeb09c06672cb4530ed44a64e1d4b66417d8 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 24 Jul 2025 14:00:05 +0200 Subject: [PATCH] ja s'ha liat la cosa per no fer pull, ostia --- data/config/balloon_formations.txt | 386 ++++++++++++++--------------- source/balloon.cpp | 38 +-- source/balloon.h | 8 +- source/balloon_formations.cpp | 78 +++--- source/balloon_formations.h | 46 ++-- source/balloon_manager.cpp | 12 +- source/options.cpp | 2 +- source/sections/game.cpp | 12 +- 8 files changed, 298 insertions(+), 284 deletions(-) diff --git a/data/config/balloon_formations.txt b/data/config/balloon_formations.txt index f64a6b5..279c35b 100644 --- a/data/config/balloon_formations.txt +++ b/data/config/balloon_formations.txt @@ -3,275 +3,275 @@ # Variables disponibles: # X1_0, X1_50, X1_100, X2_0, X2_100, X3_0, X3_100, X4_0, X4_100 # QUARTER1_X4, QUARTER3_X4, DEFAULT_POS_Y -# SIZE_0, SIZE_1, SIZE_2, SIZE_3 +# SMALL, MEDIUM, LARGE, EXTRALARGE # RIGHT, LEFT formation: 0 # Dos enemigos BALLOON3 uno a cada extremo -X4_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_3, 0 -X4_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_3, 0 +X4_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, EXTRALARGE, 0 +X4_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, EXTRALARGE, 0 formation: 1 # Dos enemigos BALLOON3 uno a cada cuarto. Ambos van hacia el centro -QUARTER1_X4, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_3, 0 -QUARTER3_X4, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_3, 0 +QUARTER1_X4, 0, DEFAULT_POS_Y, RIGHT, BALLOON, EXTRALARGE, 0 +QUARTER3_X4, 0, DEFAULT_POS_Y, LEFT, BALLOON, EXTRALARGE, 0 formation: 2 # Cuatro enemigos BALLOON1 uno detrás del otro. A la izquierda y hacia el centro -X2_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 30 -X2_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 20 -X2_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 10 -X2_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 0 +X2_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 30 +X2_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 20 +X2_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 10 +X2_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 0 formation: 3 # Cuatro enemigos BALLOON1 uno detrás del otro. A la derecha y hacia el centro -X2_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 30 -X2_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 20 -X2_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 10 -X2_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 0 +X2_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 30 +X2_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 20 +X2_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 10 +X2_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 0 formation: 4 # Tres enemigos BALLOON2. 0, 25, 50. Hacia la derecha -X3_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 20 -X3_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 10 -X3_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 0 +X3_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 20 +X3_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 10 +X3_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 0 formation: 5 # Tres enemigos BALLOON2. 50, 75, 100. Hacia la izquierda -X3_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 20 -X3_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 10 -X3_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 0 +X3_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 20 +X3_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 10 +X3_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 0 formation: 6 # Tres enemigos BALLOON2. 0, 0, 0. Hacia la derecha -X3_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 20 -X3_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 10 -X3_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 0 +X3_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 20 +X3_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 10 +X3_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 0 formation: 7 # Tres enemigos BALLOON2. 100, 100, 100. Hacia la izquierda -X3_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 20 -X3_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 10 -X3_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 0 +X3_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 20 +X3_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 10 +X3_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 0 formation: 8 # Seis enemigos BALLOON0. 0, 0, 0, 0, 0, 0. Hacia la derecha -X1_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 50 -X1_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 40 -X1_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 30 -X1_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 20 -X1_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 10 -X1_0, 5, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 0 +X1_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 50 +X1_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 40 +X1_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 30 +X1_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 20 +X1_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 10 +X1_0, 5, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 0 formation: 9 # Seis enemigos BALLOON0. 100, 100, 100, 100, 100, 100. Hacia la izquierda -X1_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 50 -X1_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 40 -X1_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 30 -X1_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 20 -X1_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 10 -X1_100, -5, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 0 +X1_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 50 +X1_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 40 +X1_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 30 +X1_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 20 +X1_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 10 +X1_100, -5, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 0 formation: 10 # Tres enemigos BALLOON3 seguidos desde la izquierda. Hacia la derecha -X4_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_3, 30 -X4_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_3, 15 -X4_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_3, 0 +X4_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, EXTRALARGE, 30 +X4_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, EXTRALARGE, 15 +X4_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, EXTRALARGE, 0 formation: 11 # Tres enemigos BALLOON3 seguidos desde la derecha. Hacia la izquierda -X4_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_3, 30 -X4_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_3, 15 -X4_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_3, 0 +X4_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, EXTRALARGE, 30 +X4_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, EXTRALARGE, 15 +X4_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, EXTRALARGE, 0 formation: 12 # Seis enemigos BALLOON1 uno detrás del otro. A la izquierda y hacia el centro -X2_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 50 -X2_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 40 -X2_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 30 -X2_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 20 -X2_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 10 -X2_0, 5, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 0 +X2_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 50 +X2_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 40 +X2_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 30 +X2_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 20 +X2_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 10 +X2_0, 5, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 0 formation: 13 # Seis enemigos BALLOON1 uno detrás del otro. A la derecha y hacia el centro -X2_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 50 -X2_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 40 -X2_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 30 -X2_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 20 -X2_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 10 -X2_100, -5, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 0 +X2_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 50 +X2_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 40 +X2_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 30 +X2_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 20 +X2_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 10 +X2_100, -5, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 0 formation: 14 # Cinco enemigos BALLOON2. Hacia la derecha. Separados -X3_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 40 -X3_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 30 -X3_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 20 -X3_0, 6, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 10 -X3_0, 8, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 0 +X3_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 40 +X3_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 30 +X3_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 20 +X3_0, 6, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 10 +X3_0, 8, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 0 formation: 15 # Cinco enemigos BALLOON2. Hacia la izquierda. Separados -X3_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 40 -X3_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 30 -X3_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 20 -X3_100, -6, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 10 -X3_100, -8, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 0 +X3_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 40 +X3_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 30 +X3_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 20 +X3_100, -6, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 10 +X3_100, -8, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 0 formation: 16 # Cinco enemigos BALLOON2. Hacia la derecha. Juntos -X3_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 40 -X3_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 30 -X3_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 20 -X3_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 10 -X3_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 0 +X3_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 40 +X3_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 30 +X3_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 20 +X3_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 10 +X3_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 0 formation: 17 # Cinco enemigos BALLOON2. Hacia la izquierda. Juntos -X3_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 40 -X3_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 30 -X3_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 20 -X3_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 10 -X3_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 0 +X3_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 40 +X3_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 30 +X3_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 20 +X3_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 10 +X3_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 0 formation: 18 # Doce enemigos BALLOON0. Hacia la derecha. Juntos -X1_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 110 -X1_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 100 -X1_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 90 -X1_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 80 -X1_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 70 -X1_0, 5, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 60 -X1_0, 6, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 50 -X1_0, 7, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 40 -X1_0, 8, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 30 -X1_0, 9, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 20 -X1_0, 10, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 10 -X1_0, 11, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 0 +X1_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 110 +X1_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 100 +X1_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 90 +X1_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 80 +X1_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 70 +X1_0, 5, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 60 +X1_0, 6, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 50 +X1_0, 7, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 40 +X1_0, 8, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 30 +X1_0, 9, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 20 +X1_0, 10, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 10 +X1_0, 11, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 0 formation: 19 # Doce enemigos BALLOON0. Hacia la izquierda. Juntos -X1_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 110 -X1_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 100 -X1_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 90 -X1_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 80 -X1_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 70 -X1_100, -5, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 60 -X1_100, -6, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 50 -X1_100, -7, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 40 -X1_100, -8, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 30 -X1_100, -9, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 20 -X1_100, -10, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 10 -X1_100, -11, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 0 +X1_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 110 +X1_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 100 +X1_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 90 +X1_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 80 +X1_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 70 +X1_100, -5, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 60 +X1_100, -6, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 50 +X1_100, -7, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 40 +X1_100, -8, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 30 +X1_100, -9, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 20 +X1_100, -10, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 10 +X1_100, -11, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 0 formation: 20 # Cuatro enemigos BALLOON3 seguidos desde la izquierda/derecha. Simétricos -X4_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_3, 0 -X4_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_3, 0 -X4_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_3, 0 -X4_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_3, 0 +X4_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, EXTRALARGE, 0 +X4_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, EXTRALARGE, 0 +X4_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, EXTRALARGE, 0 +X4_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, EXTRALARGE, 0 formation: 21 # Diez enemigos BALLOON1 uno detrás del otro. Izquierda/derecha. Simétricos -X2_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 12 -X2_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 9 -X2_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 6 -X2_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 3 -X2_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_1, 0 -X2_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 12 -X2_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 9 -X2_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 6 -X2_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 3 -X2_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_1, 0 +X2_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 12 +X2_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 9 +X2_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 6 +X2_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 3 +X2_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, MEDIUM, 0 +X2_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 12 +X2_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 9 +X2_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 6 +X2_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 3 +X2_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, MEDIUM, 0 formation: 22 # Diez enemigos BALLOON2. Hacia la derecha/izquierda. Separados. Simétricos -X3_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 40 -X3_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 30 -X3_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 20 -X3_0, 6, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 10 -X3_0, 8, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 0 -X3_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 40 -X3_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 30 -X3_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 20 -X3_100, -6, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 10 -X3_100, -8, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 0 +X3_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 40 +X3_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 30 +X3_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 20 +X3_0, 6, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 10 +X3_0, 8, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 0 +X3_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 40 +X3_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 30 +X3_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 20 +X3_100, -6, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 10 +X3_100, -8, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 0 formation: 23 # Diez enemigos BALLOON2. Hacia la derecha. Juntos. Simétricos -X3_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 40 -X3_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 30 -X3_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 20 -X3_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 10 -X3_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_2, 0 -X3_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 40 -X3_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 30 -X3_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 20 -X3_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 10 -X3_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_2, 0 +X3_0, 0, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 40 +X3_0, 1, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 30 +X3_0, 2, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 20 +X3_0, 3, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 10 +X3_0, 4, DEFAULT_POS_Y, RIGHT, BALLOON, LARGE, 0 +X3_100, 0, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 40 +X3_100, -1, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 30 +X3_100, -2, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 20 +X3_100, -3, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 10 +X3_100, -4, DEFAULT_POS_Y, LEFT, BALLOON, LARGE, 0 formation: 24 # Treinta enemigos BALLOON0. Del centro hacia los extremos. Juntos. Simétricos -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 0 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 5 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 10 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 15 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 20 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 25 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 30 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 35 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 40 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 45 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 50 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 55 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 60 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 65 -X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 70 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 0 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 5 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 10 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 15 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 20 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 25 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 30 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 35 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 40 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 45 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 50 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 55 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 60 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 65 -X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 70 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 0 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 5 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 10 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 15 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 20 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 25 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 30 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 35 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 40 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 45 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 50 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 55 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 60 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 65 +X1_50, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 70 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 0 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 5 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 10 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 15 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 20 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 25 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 30 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 35 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 40 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 45 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 50 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 55 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 60 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 65 +X1_50, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 70 formation: 25 # Treinta enemigos BALLOON0. Del centro hacia adentro. Juntos. Simétricos -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 70 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 65 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 60 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 55 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 50 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 45 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 40 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 35 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 30 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 25 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 20 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 15 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 10 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 5 -X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SIZE_0, 0 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 70 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 65 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 60 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 55 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 50 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 45 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 40 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 35 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 30 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 25 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 20 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 15 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 10 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 5 -X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SIZE_0, 0 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 70 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 65 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 60 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 55 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 50 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 45 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 40 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 35 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 30 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 25 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 20 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 15 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 10 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 5 +X1_50 + 20, 0, DEFAULT_POS_Y, LEFT, BALLOON, SMALL, 0 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 70 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 65 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 60 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 55 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 50 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 45 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 40 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 35 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 30 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 25 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 20 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 15 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 10 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 5 +X1_50 - 20, 0, DEFAULT_POS_Y, RIGHT, BALLOON, SMALL, 0 diff --git a/source/balloon.cpp b/source/balloon.cpp index d775336..71c631e 100644 --- a/source/balloon.cpp +++ b/source/balloon.cpp @@ -33,12 +33,12 @@ Balloon::Balloon(float x, float y, Type type, Size size, float vel_x, float spee const int INDEX = static_cast(size_); gravity_ = param.balloon.settings.at(INDEX).grav; default_vy_ = param.balloon.settings.at(INDEX).vel; - h_ = w_ = SIZE[INDEX]; - power_ = POWER[INDEX]; - menace_ = MENACE[INDEX]; - score_ = SCORE[INDEX]; - bouncing_sound_ = BOUNCING_SOUND[INDEX]; - popping_sound_ = POPPING_SOUND[INDEX]; + h_ = w_ = SIZE.at(INDEX); + power_ = POWER.at(INDEX); + menace_ = MENACE.at(INDEX); + score_ = SCORE.at(INDEX); + bouncing_sound_ = BOUNCING_SOUND.at(INDEX); + popping_sound_ = POPPING_SOUND.at(INDEX); break; } @@ -48,20 +48,20 @@ Balloon::Balloon(float x, float y, Type type, Size size, float vel_x, float spee gravity_ = 0.00F; const int INDEX = static_cast(size_); - h_ = w_ = SIZE[INDEX]; - power_ = POWER[INDEX]; - menace_ = MENACE[INDEX]; - score_ = SCORE[INDEX]; - bouncing_sound_ = BOUNCING_SOUND[INDEX]; - popping_sound_ = POPPING_SOUND[INDEX]; + h_ = w_ = SIZE.at(INDEX); + power_ = POWER.at(INDEX); + menace_ = MENACE.at(INDEX); + score_ = SCORE.at(INDEX); + bouncing_sound_ = BOUNCING_SOUND.at(INDEX); + popping_sound_ = POPPING_SOUND.at(INDEX); break; } case Type::POWERBALL: { constexpr int INDEX = 3; - h_ = w_ = SIZE[4]; - bouncing_sound_ = BOUNCING_SOUND[3]; + h_ = w_ = SIZE.at(4); + bouncing_sound_ = BOUNCING_SOUND.at(3); popping_sound_ = "power_ball_explosion.wav"; power_ = score_ = menace_ = 0; @@ -107,7 +107,7 @@ void Balloon::render() { // Renderiza el fondo azul { auto sp = std::make_unique(sprite_->getTexture(), sprite_->getPosition()); - sp->setSpriteClip(0, 0, SIZE[4], SIZE[4]); + sp->setSpriteClip(0, 0, SIZE.at(4), SIZE.at(4)); sp->render(); } @@ -121,7 +121,7 @@ void Balloon::render() { // Añade la máscara del borde y los reflejos { auto sp = std::make_unique(sprite_->getTexture(), sprite_->getPosition()); - sp->setSpriteClip(SIZE[4] * 2, 0, SIZE[4], SIZE[4]); + sp->setSpriteClip(SIZE.at(4) * 2, 0, SIZE.at(4), SIZE.at(4)); sp->render(); } } else { @@ -352,7 +352,7 @@ void Balloon::applyBounceEffect() { // Activa el efecto void Balloon::enableBounceEffect() { // Los globos pequeños no tienen efecto de rebote - if (size_ == Size::SIZE_0) { + if (size_ == Size::SMALL) { return; } bounce_effect_.enabled = true; @@ -371,8 +371,8 @@ void Balloon::disableBounceEffect() { void Balloon::updateBounceEffect() { if (bounce_effect_.enabled) { const int INDEX = bounce_effect_.counter / bounce_effect_.speed; - bounce_effect_.horizontal_zoom = bounce_effect_.horizontal_zoom_values[INDEX]; - bounce_effect_.verical_zoom = bounce_effect_.vertical_zoom_values[INDEX]; + bounce_effect_.horizontal_zoom = bounce_effect_.horizontal_zoom_values.at(INDEX); + bounce_effect_.verical_zoom = bounce_effect_.vertical_zoom_values.at(INDEX); applyBounceEffect(); diff --git a/source/balloon.h b/source/balloon.h index ee09560..c3ca2f2 100644 --- a/source/balloon.h +++ b/source/balloon.h @@ -42,10 +42,10 @@ class Balloon { static constexpr int POWERBALL_COUNTER = 8; enum class Size : Uint8 { - SIZE_0 = 0, - SIZE_1 = 1, - SIZE_2 = 2, - SIZE_3 = 3, + SMALL = 0, + MEDIUM = 1, + LARGE = 2, + EXTRALARGE = 3, }; enum class Type : Uint8 { diff --git a/source/balloon_formations.cpp b/source/balloon_formations.cpp index a116222..4724b00 100644 --- a/source/balloon_formations.cpp +++ b/source/balloon_formations.cpp @@ -11,7 +11,7 @@ #include // Para allocator, char_traits, operator==, string, operator<=>, basic_string, stoi, getline #include "asset.h" // Para Asset -#include "balloon.h" // Para BALLOON_SIZE, BalloonSize, BalloonType, BALLOON_VELX_NEGATIVE, BALLOON_VELX_POSITIVE +#include "balloon.h" // Para Balloon::SIZE, Balloon::Size, Balloon::Type, Balloon::VELX_NEGATIVE, Balloon::VELX_POSITIVE #include "param.h" // Para Param, ParamGame, param #include "utils.h" // Para Zone, BLOCK @@ -20,18 +20,18 @@ void BalloonFormations::initFormations() { const int DEFAULT_POS_Y = param.game.play_area.rect.h - BALLOON_SPAWN_HEIGHT; const int X4_0 = param.game.play_area.rect.x; - const int X4_100 = param.game.play_area.rect.w - BALLOON_SIZE.at(3); + const int X4_100 = param.game.play_area.rect.w - Balloon::SIZE.at(3); const int X3_0 = param.game.play_area.rect.x; - const int X3_100 = param.game.play_area.rect.w - BALLOON_SIZE.at(2); + const int X3_100 = param.game.play_area.rect.w - Balloon::SIZE.at(2); const int X2_0 = param.game.play_area.rect.x; - const int X2_100 = param.game.play_area.rect.w - BALLOON_SIZE.at(1); + const int X2_100 = param.game.play_area.rect.w - Balloon::SIZE.at(1); const int X1_0 = param.game.play_area.rect.x; - const int X1_50 = param.game.play_area.center_x - (BALLOON_SIZE.at(0) / 2); - const int X1_100 = param.game.play_area.rect.w - BALLOON_SIZE.at(0); + const int X1_50 = param.game.play_area.center_x - (Balloon::SIZE.at(0) / 2); + const int X1_100 = param.game.play_area.rect.w - Balloon::SIZE.at(0); // Variables calculadas para posiciones especiales - const int QUARTER1_X4 = param.game.play_area.first_quarter_x - (BALLOON_SIZE.at(3) / 2); - const int QUARTER3_X4 = param.game.play_area.third_quarter_x - (BALLOON_SIZE.at(3) / 2); + const int QUARTER1_X4 = param.game.play_area.first_quarter_x - (Balloon::SIZE.at(3) / 2); + const int QUARTER3_X4 = param.game.play_area.third_quarter_x - (Balloon::SIZE.at(3) / 2); // Mapa de variables para reemplazar en el archivo std::map variables = { @@ -47,12 +47,12 @@ void BalloonFormations::initFormations() { {"QUARTER1_X4", QUARTER1_X4}, {"QUARTER3_X4", QUARTER3_X4}, {"DEFAULT_POS_Y", DEFAULT_POS_Y}, - {"BALLOON_SIZE_0", BALLOON_SIZE.at(0)}, - {"BALLOON_SIZE_1", BALLOON_SIZE.at(1)}, - {"BALLOON_SIZE_2", BALLOON_SIZE.at(2)}, - {"BALLOON_SIZE_3", BALLOON_SIZE.at(3)}, - {"RIGHT", BALLOON_VELX_POSITIVE}, - {"LEFT", BALLOON_VELX_NEGATIVE}}; + {"BALLOON_SIZE_0", Balloon::SIZE.at(0)}, + {"BALLOON_SIZE_1", Balloon::SIZE.at(1)}, + {"BALLOON_SIZE_2", Balloon::SIZE.at(2)}, + {"BALLOON_SIZE_3", Balloon::SIZE.at(3)}, + {"RIGHT", Balloon::VELX_POSITIVE}, + {"LEFT", Balloon::VELX_NEGATIVE}}; balloon_formation_.reserve(NUMBER_OF_BALLOON_FORMATIONS); @@ -111,8 +111,10 @@ auto BalloonFormations::loadFormationsFromFile(const std::string& filename, cons // Crear variantes flotantes (formaciones 50-99) createFloaterVariants(); +#ifdef _DEBUG // Añadir formación de prueba addTestFormation(); +#endif file.close(); return true; @@ -138,21 +140,21 @@ auto BalloonFormations::parseBalloonLine(const std::string& line, const std::map int y = evaluateExpression(tokens.at(2), variables); float vel_x = evaluateExpression(tokens.at(3), variables); - BalloonType type = (tokens.at(4) == "BALLOON") ? BalloonType::BALLOON : BalloonType::FLOATER; + Balloon::Type type = (tokens.at(4) == "BALLOON") ? Balloon::Type::BALLOON : Balloon::Type::FLOATER; - BalloonSize size; - if (tokens.at(5) == "SIZE_0") { - size = BalloonSize::SIZE_0; - desp = desp * (BALLOON_SIZE.at(0) + 1); - } else if (tokens.at(5) == "SIZE_1") { - size = BalloonSize::SIZE_1; - desp = desp * (BALLOON_SIZE.at(1) + 1); - } else if (tokens.at(5) == "SIZE_2") { - size = BalloonSize::SIZE_2; - desp = desp * (BALLOON_SIZE.at(2) + 1); - } else if (tokens.at(5) == "SIZE_3") { - size = BalloonSize::SIZE_3; - desp = desp * (BALLOON_SIZE.at(3) + 1); + Balloon::Size size; + if (tokens.at(5) == "SMALL") { + size = Balloon::Size::SMALL; + desp = desp * (Balloon::SIZE.at(0) + 1); + } else if (tokens.at(5) == "MEDIUM") { + size = Balloon::Size::MEDIUM; + desp = desp * (Balloon::SIZE.at(1) + 1); + } else if (tokens.at(5) == "LARGE") { + size = Balloon::Size::LARGE; + desp = desp * (Balloon::SIZE.at(2) + 1); + } else if (tokens.at(5) == "EXTRALARGE") { + size = Balloon::Size::EXTRALARGE; + desp = desp * (Balloon::SIZE.at(3) + 1); } else { return std::nullopt; } @@ -230,36 +232,36 @@ void BalloonFormations::createFloaterVariants() { for (int i = 0; i < balloon_formation_.at(k).number_of_balloons; i++) { const auto& original = balloon_formation_.at(k).init.at(i); floater_params.emplace_back( - original.x, original.y, original.vel_x, BalloonType::FLOATER, original.size, original.creation_counter); + original.x, original.y, original.vel_x, Balloon::Type::FLOATER, original.size, original.creation_counter); } balloon_formation_.at(k + 50) = BalloonFormationUnit( balloon_formation_.at(k).number_of_balloons, floater_params); } } - +#ifdef _DEBUG void BalloonFormations::addTestFormation() { std::vector test_params = { - {10, -BLOCK, 0, BalloonType::FLOATER, BalloonSize::SIZE_0, 200}, - {50, -BLOCK, 0, BalloonType::FLOATER, BalloonSize::SIZE_1, 200}, - {90, -BLOCK, 0, BalloonType::FLOATER, BalloonSize::SIZE_2, 200}, - {140, -BLOCK, 0, BalloonType::FLOATER, BalloonSize::SIZE_3, 200}}; + {10, -BLOCK, 0, Balloon::Type::FLOATER, Balloon::Size::SMALL, 200}, + {50, -BLOCK, 0, Balloon::Type::FLOATER, Balloon::Size::MEDIUM, 200}, + {90, -BLOCK, 0, Balloon::Type::FLOATER, Balloon::Size::LARGE, 200}, + {140, -BLOCK, 0, Balloon::Type::FLOATER, Balloon::Size::EXTRALARGE, 200}}; balloon_formation_.at(99) = BalloonFormationUnit(4, test_params); } - +#endif 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 DEFAULT_POS_Y = param.game.play_area.rect.h - BALLOON_SPAWN_HEIGHT; const int X4_0 = param.game.play_area.rect.x; - const int X4_100 = param.game.play_area.rect.w - BALLOON_SIZE.at(3); + const int X4_100 = param.game.play_area.rect.w - Balloon::SIZE.at(3); // Formación básica #00 std::vector basic_formation = { - BalloonFormationParams(X4_0, DEFAULT_POS_Y, BALLOON_VELX_POSITIVE, BalloonType::BALLOON, BalloonSize::SIZE_3, CREATION_TIME), - BalloonFormationParams(X4_100, DEFAULT_POS_Y, BALLOON_VELX_NEGATIVE, BalloonType::BALLOON, BalloonSize::SIZE_3, CREATION_TIME)}; + BalloonFormationParams(X4_0, DEFAULT_POS_Y, Balloon::VELX_POSITIVE, Balloon::Type::BALLOON, Balloon::Size::EXTRALARGE, CREATION_TIME), + BalloonFormationParams(X4_100, DEFAULT_POS_Y, Balloon::VELX_NEGATIVE, Balloon::Type::BALLOON, Balloon::Size::EXTRALARGE, CREATION_TIME)}; balloon_formation_.emplace_back(2, basic_formation); } diff --git a/source/balloon_formations.h b/source/balloon_formations.h index 26951cf..1ca733b 100644 --- a/source/balloon_formations.h +++ b/source/balloon_formations.h @@ -6,24 +6,24 @@ #include // Para string #include // Para vector -#include "balloon.h" // Para BalloonSize, BalloonType +#include "balloon.h" // Para Balloon::Size, Balloon::Type // --- Constantes de configuración --- // --- Estructuras de datos --- struct BalloonFormationParams { - int x = 0; // Posición en el eje X donde crear el globo - int y = 0; // Posición en el eje Y donde crear el globo - float vel_x = 0.0F; // Velocidad inicial en el eje X - BalloonType type = BalloonType::BALLOON; // Tipo de globo - BalloonSize size = BalloonSize::SIZE_0; // Tamaño de globo - int creation_counter = 0; // Temporizador para la creación del globo + int x = 0; // Posición en el eje X donde crear el globo + int y = 0; // Posición en el eje Y donde crear el globo + float vel_x = 0.0F; // Velocidad inicial en el eje X + Balloon::Type type = Balloon::Type::BALLOON; // Tipo de globo + Balloon::Size size = Balloon::Size::SMALL; // Tamaño de globo + int creation_counter = 0; // Temporizador para la creación del globo // Constructor por defecto BalloonFormationParams() = default; // Constructor con parámetros - BalloonFormationParams(int x_val, int y_val, float vel_x_val, BalloonType type_val, BalloonSize size_val, int creation_counter_val) + BalloonFormationParams(int x_val, int y_val, float vel_x_val, Balloon::Type type_val, Balloon::Size size_val, int creation_counter_val) : x(x_val), y(y_val), vel_x(vel_x_val), type(type_val), size(size_val), creation_counter(creation_counter_val) {} }; @@ -68,15 +68,27 @@ class BalloonFormations { std::vector balloon_formation_; // Vector con todas las formaciones enemigas std::vector balloon_formation_pool_; // Conjuntos de formaciones enemigas - // --- Métodos internos de inicialización --- - void initFormations(); // Inicializa la lista principal de formaciones de globos disponibles - void initFormationPools(); // Prepara las estructuras de agrupamiento o reutilización de formaciones (pools) + // --- Inicialización de formaciones --- + void initFormations(); // Inicializa la lista principal de formaciones de globos disponibles + void initFormationPools(); // Prepara las estructuras de agrupamiento o reutilización de formaciones (pools) + + // --- Carga y análisis de datos --- auto loadFormationsFromFile(const std::string& filename, const std::map& variables) -> bool; // Carga las formaciones desde un archivo, evaluando variables dinámicas auto parseBalloonLine(const std::string& line, const std::map& variables) -> std::optional; // Parsea una línea individual del archivo y genera parámetros de formación - auto evaluateExpression(const std::string& expr, const std::map& variables) -> float; // Evalúa expresiones matemáticas con variables definidas (complejas) - auto evaluateSimpleExpression(const std::string& expr, const std::map& variables) -> float; // 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 + + // --- Evaluación de expresiones --- + auto evaluateExpression(const std::string& expr, const std::map& variables) -> float; // Evalúa expresiones matemáticas con variables definidas (complejas) + auto evaluateSimpleExpression(const std::string& expr, const std::map& variables) -> float; // Evalúa expresiones más sencillas (sin paréntesis o operadores avanzados) + + // --- Utilidades --- + static auto trim(const std::string& str) -> std::string; // Elimina espacios en blanco al inicio y fin de una cadena + + // --- Generación de variantes --- + void createFloaterVariants(); // Genera variantes de globos flotantes según configuración o aleatoriedad + void loadDefaultFormations(); // Carga las formaciones por defecto incluidas en el juego si no hay archivo externo + +// --- Depuración (solo en modo DEBUG) --- +#ifdef _DEBUG + void addTestFormation(); // Añade una formación de prueba para debug o validación en tiempo de desarrollo +#endif }; diff --git a/source/balloon_manager.cpp b/source/balloon_manager.cpp index 2b07a3f..4f0e7b5 100644 --- a/source/balloon_manager.cpp +++ b/source/balloon_manager.cpp @@ -214,7 +214,7 @@ void BalloonManager::createPowerBall() { const std::array POS_X = {LEFT, LEFT, CENTER, CENTER, RIGHT, RIGHT}; const std::array VEL_X = {Balloon::VELX_POSITIVE, Balloon::VELX_POSITIVE, Balloon::VELX_POSITIVE, Balloon::VELX_NEGATIVE, Balloon::VELX_NEGATIVE, Balloon::VELX_NEGATIVE}; - balloons_.emplace_back(std::make_unique(POS_X[LUCK], POS_Y, Balloon::Type::POWERBALL, Balloon::Size::SIZE_3, VEL_X[LUCK], balloon_speed_, CREATION_TIME, play_area_, balloon_textures_[4], balloon_animations_[4])); + balloons_.emplace_back(std::make_unique(POS_X[LUCK], POS_Y, Balloon::Type::POWERBALL, Balloon::Size::EXTRALARGE, VEL_X[LUCK], balloon_speed_, CREATION_TIME, play_area_, balloon_textures_[4], balloon_animations_[4])); balloons_.back()->setInvulnerable(true); power_ball_enabled_ = true; @@ -242,7 +242,7 @@ auto BalloonManager::popBalloon(std::shared_ptr balloon) -> int { balloon_deploy_counter_ = 20; } else { score = balloon->getScore(); - if (balloon->getSize() != Balloon::Size::SIZE_0) { + if (balloon->getSize() != Balloon::Size::SMALL) { createChildBalloon(balloon, "LEFT"); createChildBalloon(balloon, "RIGHT"); } @@ -261,16 +261,16 @@ auto BalloonManager::destroyBalloon(std::shared_ptr &balloon) -> int { // Calcula la puntuación y el poder que generaria el globo en caso de romperlo a él y a sus hijos switch (balloon->getSize()) { - case Balloon::Size::SIZE_3: + case Balloon::Size::EXTRALARGE: score = Balloon::SCORE.at(3) + (2 * Balloon::SCORE.at(2)) + (4 * Balloon::SCORE.at(1)) + (8 * Balloon::SCORE.at(0)); break; - case Balloon::Size::SIZE_2: + case Balloon::Size::LARGE: score = Balloon::SCORE.at(2) + (2 * Balloon::SCORE.at(1)) + (4 * Balloon::SCORE.at(0)); break; - case Balloon::Size::SIZE_1: + case Balloon::Size::MEDIUM: score = Balloon::SCORE.at(1) + (2 * Balloon::SCORE.at(0)); break; - case Balloon::Size::SIZE_0: + case Balloon::Size::SMALL: score = Balloon::SCORE.at(0); break; default: diff --git a/source/options.cpp b/source/options.cpp index 2953ffb..29cc616 100644 --- a/source/options.cpp +++ b/source/options.cpp @@ -206,7 +206,7 @@ void parseAndSetController(const std::string& var, const std::string& value) { auto set(const std::string& var, const std::string& value) -> bool { // Clausula de protección: ignora líneas vacías o comentarios if (var.empty() || var.starts_with("#")) { - return false; + return true; } // Un mapa estático asegura que se inicializa solo una vez diff --git a/source/sections/game.cpp b/source/sections/game.cpp index 15e0b2a..e7f0ec5 100644 --- a/source/sections/game.cpp +++ b/source/sections/game.cpp @@ -11,7 +11,7 @@ #include "asset.h" // Para Asset #include "audio.h" // Para Audio #include "background.h" // Para Background -#include "balloon.h" // Para Balloon, BALLOON_SPEED +#include "balloon.h" // Para Balloon, Balloon::SPEED #include "balloon_manager.h" // Para BalloonManager #include "bullet.h" // Para Bullet, BulletType, BulletMoveStatus #include "color.h" // Para Color, FLASH_COLOR @@ -1539,21 +1539,21 @@ void Game::initDifficultyVars() { // Variables relacionadas con la dificultad switch (difficulty_) { case Difficulty::Code::EASY: { - balloon_manager_->setDefaultBalloonSpeed(BALLOON_SPEED[0]); + balloon_manager_->setDefaultBalloonSpeed(Balloon::SPEED.at(0)); difficulty_score_multiplier_ = 0.5F; scoreboard_->setColor(param.scoreboard.easy_color); break; } case Difficulty::Code::NORMAL: { - balloon_manager_->setDefaultBalloonSpeed(BALLOON_SPEED[0]); + balloon_manager_->setDefaultBalloonSpeed(Balloon::SPEED.at(0)); difficulty_score_multiplier_ = 1.0F; scoreboard_->setColor(param.scoreboard.normal_color); break; } case Difficulty::Code::HARD: { - balloon_manager_->setDefaultBalloonSpeed(BALLOON_SPEED[4]); + balloon_manager_->setDefaultBalloonSpeed(Balloon::SPEED.at(4)); difficulty_score_multiplier_ = 1.5F; scoreboard_->setColor(param.scoreboard.hard_color); break; @@ -1768,8 +1768,8 @@ void Game::checkAndUpdateBalloonSpeed() { constexpr std::array THRESHOLDS = {0.2F, 0.4F, 0.6F, 0.8F}; for (size_t i = 0; i < std::size(THRESHOLDS); ++i) { - if (balloon_manager_->getBalloonSpeed() == BALLOON_SPEED[i] && PERCENT > THRESHOLDS[i]) { - balloon_manager_->setBalloonSpeed(BALLOON_SPEED[i + 1]); + if (balloon_manager_->getBalloonSpeed() == Balloon::SPEED.at(i) && PERCENT > THRESHOLDS[i]) { + balloon_manager_->setBalloonSpeed(Balloon::SPEED.at(i + 1)); break; // Salir del bucle una vez actualizada la velocidad y aplicada } }