Compare commits
152 Commits
v1.4
...
c8bebfd2d9
| Author | SHA1 | Date | |
|---|---|---|---|
| c8bebfd2d9 | |||
| 35e7abcd3c | |||
| b092d3f86a | |||
| 837bcbd1da | |||
| 26bc47d9f6 | |||
| 9e089e9092 | |||
| 25616e1e6c | |||
| ed67e429d8 | |||
| 4ebd034b59 | |||
| 38f3e2e4d3 | |||
| 6493b73f4f | |||
| 6637ba9f10 | |||
| a74c8d5122 | |||
| 4df0db088f | |||
| 27cb772933 | |||
| 778b07cce1 | |||
| 1fa5c75466 | |||
| 0b00acf31b | |||
| 2979a6752c | |||
| f6494e69c8 | |||
| 5167a5857d | |||
| 28fe1130cf | |||
| e92b7eab4e | |||
| 14f7a79927 | |||
| 4f6a6a4918 | |||
| f5b35cee6b | |||
| 454791fe96 | |||
| 3f165be114 | |||
| 778672a6f5 | |||
| 8c919abc9d | |||
| 7e37da3999 | |||
| 842d5dd56b | |||
| ea3f16b8ac | |||
| 3fe0861e4f | |||
| b28d798545 | |||
| bdf092d46e | |||
| 09421a093d | |||
| a7d7cdd047 | |||
| bffefcad77 | |||
| b408de5fa0 | |||
| f70145a0bf | |||
| 02c7790835 | |||
| 2d10e640bd | |||
| 737829cb68 | |||
| d3f17bc93a | |||
| b7490ed1c1 | |||
| 836deb720d | |||
| 7e9a1cb049 | |||
| f928195a05 | |||
| 84b09a4987 | |||
| f0b9a1d134 | |||
| 64369921ec | |||
| 70ae7f67a9 | |||
| 2ea86ef39f | |||
| 658bb71441 | |||
| 0b996ea321 | |||
| cf072424c6 | |||
| 42c0f19c68 | |||
| 8d1cabb288 | |||
| 87aeaab6b8 | |||
| ad5fb0fc22 | |||
| 8e6d546b97 | |||
| f916381a9b | |||
| fd94aea99b | |||
| cda4d3a566 | |||
| 22ca349171 | |||
| 74c08884ae | |||
| 005eab5694 | |||
| 56dd646dde | |||
| eb7f534b3b | |||
| 384cfa7156 | |||
| 224b176108 | |||
| 02b528ea8c | |||
| 4de3d69bb8 | |||
| c373d10720 | |||
| 88e5303d28 | |||
| 697e5d796f | |||
| 0baf73b9ae | |||
| 0341a0fe9d | |||
| e9fcacd7c6 | |||
| 502835453a | |||
| 914b9e4123 | |||
| 946ab62c30 | |||
| 13be9df131 | |||
| a54d71c990 | |||
| cc8ef6e927 | |||
| 3f53ba333b | |||
| aac11d05aa | |||
| acbdcf2fc1 | |||
| c12a7dc885 | |||
| ff0102256c | |||
| 75031038c8 | |||
| 70324570c8 | |||
| 5d6047b642 | |||
| 97d5140ef9 | |||
| dafba0648f | |||
| d240f8123c | |||
| 3cb822ee6c | |||
| 6d2fd16ec2 | |||
| e93aba2522 | |||
| 5768c1f7a2 | |||
| 30c8a31a48 | |||
| a2a6262ffe | |||
| dbd22fa719 | |||
| 5bb5022ebf | |||
| 3440dea0a5 | |||
| 36eaf1de4f | |||
| c3d560a9b6 | |||
| 09cee79122 | |||
| 03cbc67cfb | |||
| 23d9bb0e3d | |||
| f9d6917770 | |||
| bf45482c10 | |||
| 39a59336e4 | |||
| 7c0201f913 | |||
| b61fd84e22 | |||
| 52ea512eab | |||
|
|
26ac51b1be | ||
| fb1ff3c97a | |||
| 943fb7bf27 | |||
| 2fd4334259 | |||
| eb8f84a4b8 | |||
| e793e08e85 | |||
| 837306f16e | |||
| 182631b2b7 | |||
| 5cc9b16d59 | |||
| 6224ed2779 | |||
| fc3a4efc5f | |||
| 2be1e566b2 | |||
| 017f691841 | |||
| 43c5ddcd1e | |||
| ef9f855785 | |||
| a70402ab5e | |||
| 91bed82fd2 | |||
| 90812f2140 | |||
| 0c0b677474 | |||
| 63bae5c504 | |||
| 5847c79ffb | |||
| 176d0d4f90 | |||
| a0e94035db | |||
| 9b5eaf36e1 | |||
| f97291110f | |||
| e9ff516b1d | |||
| 2330820a15 | |||
| 36bb6b8fe8 | |||
| d84137daa7 | |||
| 4980c0f712 | |||
| b8cc628dd7 | |||
| b663916a59 | |||
| 6c1c6cbc42 | |||
| bcb012fc65 | |||
| 67acc46222 |
12
.gitignore
vendored
@@ -1,11 +1,5 @@
|
||||
.vscode
|
||||
*.DS_Store
|
||||
bin
|
||||
dll
|
||||
icon
|
||||
media_work
|
||||
releases
|
||||
resources
|
||||
scripts
|
||||
.DS_Store
|
||||
todo.txt
|
||||
data/config.bin
|
||||
data/score.bin
|
||||
data/score.bin
|
||||
19
.vscode/c_cpp_properties.json
vendored
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"defines": [],
|
||||
"macFrameworkPath": [
|
||||
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
|
||||
],
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"intelliSenseMode": "macos-clang-x64",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++11"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
21
.vscode/launch.json
vendored
@@ -1,21 +0,0 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "g++ - Build and debug",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/bin/coffee_crisis_macos_debug",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}/bin",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "lldb",
|
||||
"preLaunchTask": "C/C++: g++ build"
|
||||
}
|
||||
]
|
||||
}
|
||||
19
.vscode/settings.json
vendored
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"cstddef": "cpp",
|
||||
"__tuple": "cpp",
|
||||
"array": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"__bit_reference": "cpp",
|
||||
"__hash_table": "cpp",
|
||||
"__split_buffer": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"iterator": "cpp",
|
||||
"string": "cpp",
|
||||
"string_view": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"vector": "cpp",
|
||||
"iosfwd": "cpp",
|
||||
"stdexcept": "cpp"
|
||||
}
|
||||
}
|
||||
31
.vscode/tasks.json
vendored
@@ -1,31 +0,0 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "C/C++: g++ build",
|
||||
"command": "/usr/bin/g++",
|
||||
"args": [
|
||||
"-g",
|
||||
"${workspaceFolder}/source/*.cpp",
|
||||
"-std=c++11",
|
||||
"-Wall",
|
||||
"-O2",
|
||||
"-lSDL2",
|
||||
"-o",
|
||||
"${workspaceFolder}/bin/coffee_crisis_macos_debug"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "compiler: /usr/bin/g++"
|
||||
}
|
||||
]
|
||||
}
|
||||
11
Makefile
@@ -1,6 +1,13 @@
|
||||
executable = coffee_crisis
|
||||
|
||||
macos:
|
||||
mkdir -p bin
|
||||
g++ -std=c++11 -Wall -O2 source/*.cpp -o bin/coffee_crisis_macos -lSDL2
|
||||
g++ -std=c++11 -Wall -O2 source/*.cpp -o bin/$(executable)_macos -lSDL2
|
||||
linux:
|
||||
mkdir -p bin
|
||||
g++ -std=c++11 -Wall -O2 source/*.cpp -o bin/coffee_crisis_linux -lSDL2
|
||||
g++ source/*.cpp -std=c++11 -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o bin/$(executable)_linux
|
||||
strip -s -R .comment -R .gnu.version bin/$(executable)_linux --strip-unneeded
|
||||
opendingux:
|
||||
mkdir -p bin
|
||||
/opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc -D GCWZERO -O2 -std=c++11 -I/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/SDL2 -D_GNU_SOURCE=1 -D_REENTRANT -lSDL2 -lSDL2_mixer -lstdc++ source/*.cpp -o bin/$(executable)_opendingux
|
||||
/opt/gcw0-toolchain/usr/bin/mksquashfs ./default.gcw0.desktop ./icon.png ./bin ./data ./media coffee_crisis.opk -all-root -noappend -no-exports -no-xattrs
|
||||
24
README.md
@@ -1,6 +1,6 @@
|
||||
# Coffee Crisis
|
||||
|
||||
Coffe Crisis es un juego arcade que pondrá a prueba tus reflejos. Realizado entre el verano de 2020 y el invierno de 2021. Intenta conseguir todos los puntos que puedas con una sola vida y ayuda a Bal1 a defender la UPV ante la invasión de la cafeína.
|
||||
Coffee Crisis es un juego arcade que pondrá a prueba tus reflejos. Empezado durante el verano de 2020 y terminado un año despues, en el verano de 2021. Intenta conseguir todos los puntos que puedas con una sola vida a traves de los 10 niveles de juego y ayuda a Bal1 a defender la UPV de la invasión de la cafeína esférica y saltarina.
|
||||
|
||||
## Compilar
|
||||
|
||||
@@ -8,10 +8,10 @@ Para compilar el código se necesitan tener las librerías SDL instaladas en el
|
||||
|
||||
En Linux:
|
||||
```bash
|
||||
sudo apt install lib-SDL2 g++
|
||||
sudo apt install libsdl2-dev g++
|
||||
```
|
||||
|
||||
En macos es más facil instalarlas con [brew](https://brew.sh):
|
||||
En macOS se pueden instalar fácilmente con [brew](https://brew.sh):
|
||||
```bash
|
||||
brew install sdl2 g++
|
||||
```
|
||||
@@ -23,21 +23,31 @@ En Linux:
|
||||
make linux
|
||||
```
|
||||
|
||||
En macos:
|
||||
En macOS:
|
||||
```bash
|
||||
make macos
|
||||
```
|
||||
|
||||
## Como ejecutar
|
||||
|
||||
Para ejecutar el juego hay que escribir en la terminal la orden que se muestra a continuación.
|
||||
|
||||
En Linux:
|
||||
```bash
|
||||
./bin/coffee_crisis
|
||||
bin/coffee_crisis_linux
|
||||
```
|
||||
|
||||
En macOS:
|
||||
```bash
|
||||
bin/coffee_crisis_macos
|
||||
```
|
||||
|
||||
En macOS tambien puedes hacer doble click sobre el archivo coffee_crisis_macos que hay en la carpeta bin
|
||||
|
||||
## Agradecimientos
|
||||
A los jailers y a la jail. Y entre ellos, a JailDoctor por estar siempre ahí apoyándonos/obligándonos a sacar un Jailgame más.
|
||||
|
||||
Y por supuesto a ti por estar aquí.
|
||||
|
||||
## License
|
||||
Buscar una licencia para que quiera haga con el código lo que le de la gana, menos sacar beneficio económico... que si lo hacen me expliquen como.
|
||||
## Licencia
|
||||
Usa el código para lo que quieras: aprender, reirte, curiosear... excepto para sacar beneficio económico. Si lo consigues, por favor avísame y vamos a medias.
|
||||
BIN
data/config/config.bin
Normal file
1144
data/config/gamecontrollerdb.txt
Normal file
BIN
data/config/score.bin
Normal file
BIN
data/font/8bithud.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
194
data/font/8bithud.txt
Normal file
@@ -0,0 +1,194 @@
|
||||
# box width
|
||||
8
|
||||
# box height
|
||||
8
|
||||
# 32 espacio ( )
|
||||
2
|
||||
# 33 !
|
||||
2
|
||||
# 34 "
|
||||
5
|
||||
# 35 #
|
||||
6
|
||||
# 36 $
|
||||
6
|
||||
# 37 %
|
||||
6
|
||||
# 38 &
|
||||
6
|
||||
# 39 '
|
||||
2
|
||||
# 40 (
|
||||
3
|
||||
# 41 )
|
||||
3
|
||||
# 42 *
|
||||
4
|
||||
# 43 +
|
||||
3
|
||||
# 44 ,
|
||||
2
|
||||
# 45 -
|
||||
3
|
||||
# 46 .
|
||||
2
|
||||
# 47 /
|
||||
4
|
||||
# 48 0
|
||||
6
|
||||
# 49 1
|
||||
6
|
||||
# 50 2
|
||||
6
|
||||
# 51 3
|
||||
6
|
||||
# 52 4
|
||||
6
|
||||
# 53 5
|
||||
6
|
||||
# 54 6
|
||||
6
|
||||
# 55 7
|
||||
6
|
||||
# 56 8
|
||||
6
|
||||
# 57 9
|
||||
6
|
||||
# 58 :
|
||||
2
|
||||
# 59 ;
|
||||
2
|
||||
# 60 <
|
||||
4
|
||||
# 61 =
|
||||
3
|
||||
# 62 >
|
||||
4
|
||||
# 63 ?
|
||||
6
|
||||
# 64 @
|
||||
8
|
||||
# 65 A
|
||||
6
|
||||
# 66 B
|
||||
6
|
||||
# 67 C
|
||||
6
|
||||
# 68 D
|
||||
6
|
||||
# 69 E
|
||||
6
|
||||
# 70 F
|
||||
6
|
||||
# 71 G
|
||||
6
|
||||
# 72 H
|
||||
6
|
||||
# 73 I
|
||||
6
|
||||
# 74 J
|
||||
6
|
||||
# 75 K
|
||||
6
|
||||
# 76 L
|
||||
6
|
||||
# 77 M
|
||||
6
|
||||
# 78 N
|
||||
6
|
||||
# 79 O
|
||||
6
|
||||
# 80 P
|
||||
6
|
||||
# 81 Q
|
||||
6
|
||||
# 82 R
|
||||
6
|
||||
# 83 S
|
||||
6
|
||||
# 84 T
|
||||
6
|
||||
# 85 U
|
||||
6
|
||||
# 86 V
|
||||
5
|
||||
# 87 W
|
||||
6
|
||||
# 88 X
|
||||
6
|
||||
# 89 Y
|
||||
6
|
||||
# 90 Z
|
||||
6
|
||||
# 91 [
|
||||
3
|
||||
# 92 \
|
||||
5
|
||||
# 93 ]
|
||||
3
|
||||
# 94 ^
|
||||
4
|
||||
# 95 _
|
||||
6
|
||||
# 96 `
|
||||
2
|
||||
# 97 a
|
||||
5
|
||||
# 98 b
|
||||
5
|
||||
# 99 c
|
||||
5
|
||||
# 100 d
|
||||
5
|
||||
# 101 e
|
||||
5
|
||||
# 102 f
|
||||
5
|
||||
# 103 g
|
||||
5
|
||||
# 104 h
|
||||
5
|
||||
# 105 i
|
||||
4
|
||||
# 106 j
|
||||
5
|
||||
# 107 k
|
||||
5
|
||||
# 108 l
|
||||
5
|
||||
# 109 m
|
||||
6
|
||||
# 110 n
|
||||
5
|
||||
# 111 o
|
||||
5
|
||||
# 112 p
|
||||
5
|
||||
# 113 q
|
||||
5
|
||||
# 114 r
|
||||
5
|
||||
# 115 s
|
||||
5
|
||||
# 116 t
|
||||
4
|
||||
# 117 u
|
||||
5
|
||||
# 118 v
|
||||
5
|
||||
# 119 w
|
||||
6
|
||||
# 120 x
|
||||
4
|
||||
# 121 y
|
||||
4
|
||||
# 122 z
|
||||
5
|
||||
# 123 {
|
||||
3
|
||||
# 124 |
|
||||
2
|
||||
# 125 }
|
||||
3
|
||||
# 126 ~
|
||||
3
|
||||
BIN
data/font/nokia.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
194
data/font/nokia.txt
Normal file
@@ -0,0 +1,194 @@
|
||||
# box width
|
||||
10
|
||||
# box height
|
||||
10
|
||||
# 32 espacio ( )
|
||||
5
|
||||
# 33 !
|
||||
4
|
||||
# 34 "
|
||||
5
|
||||
# 35 #
|
||||
7
|
||||
# 36 $
|
||||
7
|
||||
# 37 %
|
||||
8
|
||||
# 38 &
|
||||
8
|
||||
# 39 '
|
||||
3
|
||||
# 40 (
|
||||
5
|
||||
# 41 )
|
||||
5
|
||||
# 42 *
|
||||
7
|
||||
# 43 +
|
||||
7
|
||||
# 44 ,
|
||||
4
|
||||
# 45 -
|
||||
6
|
||||
# 46 .
|
||||
4
|
||||
# 47 /
|
||||
5
|
||||
# 48 0
|
||||
7
|
||||
# 49 1
|
||||
5
|
||||
# 50 2
|
||||
7
|
||||
# 51 3
|
||||
7
|
||||
# 52 4
|
||||
7
|
||||
# 53 5
|
||||
7
|
||||
# 54 6
|
||||
7
|
||||
# 55 7
|
||||
7
|
||||
# 56 8
|
||||
7
|
||||
# 57 9
|
||||
7
|
||||
# 58 :
|
||||
4
|
||||
# 59 ;
|
||||
4
|
||||
# 60 <
|
||||
6
|
||||
# 61 =
|
||||
6
|
||||
# 62 >
|
||||
6
|
||||
# 63 ?
|
||||
7
|
||||
# 64 @
|
||||
8
|
||||
# 65 A
|
||||
7
|
||||
# 66 B
|
||||
7
|
||||
# 67 C
|
||||
7
|
||||
# 68 D
|
||||
7
|
||||
# 69 E
|
||||
7
|
||||
# 70 F
|
||||
7
|
||||
# 71 G
|
||||
7
|
||||
# 72 H
|
||||
7
|
||||
# 73 I
|
||||
4
|
||||
# 74 J
|
||||
6
|
||||
# 75 K
|
||||
8
|
||||
# 76 L
|
||||
6
|
||||
# 77 M
|
||||
9
|
||||
# 78 N
|
||||
8
|
||||
# 79 O
|
||||
8
|
||||
# 80 P
|
||||
7
|
||||
# 81 Q
|
||||
8
|
||||
# 82 R
|
||||
7
|
||||
# 83 S
|
||||
6
|
||||
# 84 T
|
||||
8
|
||||
# 85 U
|
||||
7
|
||||
# 86 V
|
||||
8
|
||||
# 87 W
|
||||
9
|
||||
# 88 X
|
||||
8
|
||||
# 89 Y
|
||||
8
|
||||
# 90 Z
|
||||
7
|
||||
# 91 [
|
||||
4
|
||||
# 92 \
|
||||
5
|
||||
# 93 ]
|
||||
4
|
||||
# 94 ^
|
||||
5
|
||||
# 95 _
|
||||
8
|
||||
# 96 `
|
||||
4
|
||||
# 97 a
|
||||
7
|
||||
# 98 b
|
||||
7
|
||||
# 99 c
|
||||
6
|
||||
# 100 d
|
||||
7
|
||||
# 101 e
|
||||
7
|
||||
# 102 f
|
||||
5
|
||||
# 103 g
|
||||
7
|
||||
# 104 h
|
||||
7
|
||||
# 105 i
|
||||
4
|
||||
# 106 j
|
||||
5
|
||||
# 107 k
|
||||
7
|
||||
# 108 l
|
||||
4
|
||||
# 109 m
|
||||
10
|
||||
# 110 n
|
||||
7
|
||||
# 111 o
|
||||
7
|
||||
# 112 p
|
||||
7
|
||||
# 113 q
|
||||
7
|
||||
# 114 r
|
||||
6
|
||||
# 115 s
|
||||
6
|
||||
# 116 t
|
||||
5
|
||||
# 117 u
|
||||
7
|
||||
# 118 v
|
||||
7
|
||||
# 119 w
|
||||
9
|
||||
# 120 x
|
||||
7
|
||||
# 121 y
|
||||
7
|
||||
# 122 z
|
||||
7
|
||||
# 123 { -> ñ
|
||||
7
|
||||
# 124 | -> ç
|
||||
7
|
||||
# 125 }
|
||||
0
|
||||
# 126 ~
|
||||
0
|
||||
BIN
data/font/nokia2.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
194
data/font/nokia2.txt
Normal file
@@ -0,0 +1,194 @@
|
||||
# box width
|
||||
10
|
||||
# box height
|
||||
10
|
||||
# 32 espacio ( )
|
||||
5
|
||||
# 33 !
|
||||
4
|
||||
# 34 "
|
||||
5
|
||||
# 35 #
|
||||
7
|
||||
# 36 $
|
||||
7
|
||||
# 37 %
|
||||
8
|
||||
# 38 &
|
||||
8
|
||||
# 39 '
|
||||
3
|
||||
# 40 (
|
||||
5
|
||||
# 41 )
|
||||
5
|
||||
# 42 *
|
||||
7
|
||||
# 43 +
|
||||
7
|
||||
# 44 ,
|
||||
4
|
||||
# 45 -
|
||||
6
|
||||
# 46 .
|
||||
4
|
||||
# 47 /
|
||||
5
|
||||
# 48 0
|
||||
7
|
||||
# 49 1
|
||||
5
|
||||
# 50 2
|
||||
7
|
||||
# 51 3
|
||||
7
|
||||
# 52 4
|
||||
7
|
||||
# 53 5
|
||||
7
|
||||
# 54 6
|
||||
7
|
||||
# 55 7
|
||||
7
|
||||
# 56 8
|
||||
7
|
||||
# 57 9
|
||||
7
|
||||
# 58 :
|
||||
4
|
||||
# 59 ;
|
||||
4
|
||||
# 60 <
|
||||
6
|
||||
# 61 =
|
||||
6
|
||||
# 62 >
|
||||
6
|
||||
# 63 ?
|
||||
7
|
||||
# 64 @
|
||||
8
|
||||
# 65 A
|
||||
7
|
||||
# 66 B
|
||||
7
|
||||
# 67 C
|
||||
7
|
||||
# 68 D
|
||||
7
|
||||
# 69 E
|
||||
7
|
||||
# 70 F
|
||||
7
|
||||
# 71 G
|
||||
7
|
||||
# 72 H
|
||||
7
|
||||
# 73 I
|
||||
4
|
||||
# 74 J
|
||||
6
|
||||
# 75 K
|
||||
8
|
||||
# 76 L
|
||||
6
|
||||
# 77 M
|
||||
9
|
||||
# 78 N
|
||||
8
|
||||
# 79 O
|
||||
8
|
||||
# 80 P
|
||||
7
|
||||
# 81 Q
|
||||
8
|
||||
# 82 R
|
||||
7
|
||||
# 83 S
|
||||
6
|
||||
# 84 T
|
||||
8
|
||||
# 85 U
|
||||
7
|
||||
# 86 V
|
||||
8
|
||||
# 87 W
|
||||
9
|
||||
# 88 X
|
||||
8
|
||||
# 89 Y
|
||||
8
|
||||
# 90 Z
|
||||
7
|
||||
# 91 [
|
||||
4
|
||||
# 92 \
|
||||
5
|
||||
# 93 ]
|
||||
4
|
||||
# 94 ^
|
||||
5
|
||||
# 95 _
|
||||
8
|
||||
# 96 `
|
||||
4
|
||||
# 97 a
|
||||
7
|
||||
# 98 b
|
||||
7
|
||||
# 99 c
|
||||
6
|
||||
# 100 d
|
||||
7
|
||||
# 101 e
|
||||
7
|
||||
# 102 f
|
||||
5
|
||||
# 103 g
|
||||
7
|
||||
# 104 h
|
||||
7
|
||||
# 105 i
|
||||
4
|
||||
# 106 j
|
||||
5
|
||||
# 107 k
|
||||
7
|
||||
# 108 l
|
||||
4
|
||||
# 109 m
|
||||
10
|
||||
# 110 n
|
||||
7
|
||||
# 111 o
|
||||
7
|
||||
# 112 p
|
||||
7
|
||||
# 113 q
|
||||
7
|
||||
# 114 r
|
||||
6
|
||||
# 115 s
|
||||
6
|
||||
# 116 t
|
||||
5
|
||||
# 117 u
|
||||
7
|
||||
# 118 v
|
||||
7
|
||||
# 119 w
|
||||
9
|
||||
# 120 x
|
||||
7
|
||||
# 121 y
|
||||
7
|
||||
# 122 z
|
||||
7
|
||||
# 123 { -> ñ
|
||||
7
|
||||
# 124 | -> ç
|
||||
7
|
||||
# 125 }
|
||||
0
|
||||
# 126 ~
|
||||
0
|
||||
BIN
data/font/nokia_big2.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
194
data/font/nokia_big2.txt
Normal file
@@ -0,0 +1,194 @@
|
||||
# box width
|
||||
20
|
||||
# box height
|
||||
20
|
||||
# 32 espacio ( )
|
||||
8
|
||||
# 33 !
|
||||
8
|
||||
# 34 "
|
||||
10
|
||||
# 35 #
|
||||
14
|
||||
# 36 $
|
||||
14
|
||||
# 37 %
|
||||
16
|
||||
# 38 &
|
||||
16
|
||||
# 39 '
|
||||
6
|
||||
# 40 (
|
||||
10
|
||||
# 41 )
|
||||
10
|
||||
# 42 *
|
||||
14
|
||||
# 43 +
|
||||
14
|
||||
# 44 ,
|
||||
8
|
||||
# 45 -
|
||||
12
|
||||
# 46 .
|
||||
8
|
||||
# 47 /
|
||||
10
|
||||
# 48 0
|
||||
14
|
||||
# 49 1
|
||||
10
|
||||
# 50 2
|
||||
14
|
||||
# 51 6
|
||||
14
|
||||
# 52 8
|
||||
14
|
||||
# 53 10
|
||||
14
|
||||
# 54 12
|
||||
14
|
||||
# 55 14
|
||||
14
|
||||
# 56 16
|
||||
14
|
||||
# 57 18
|
||||
14
|
||||
# 58 :
|
||||
8
|
||||
# 59 ;
|
||||
8
|
||||
# 60 <
|
||||
12
|
||||
# 61 =
|
||||
12
|
||||
# 62 >
|
||||
12
|
||||
# 63 ?
|
||||
14
|
||||
# 64 @
|
||||
16
|
||||
# 65 A
|
||||
14
|
||||
# 66 B
|
||||
14
|
||||
# 67 C
|
||||
14
|
||||
# 68 D
|
||||
14
|
||||
# 69 E
|
||||
14
|
||||
# 70 F
|
||||
14
|
||||
# 71 G
|
||||
14
|
||||
# 72 H
|
||||
14
|
||||
# 73 I
|
||||
8
|
||||
# 74 J
|
||||
12
|
||||
# 75 K
|
||||
16
|
||||
# 76 L
|
||||
12
|
||||
# 77 M
|
||||
18
|
||||
# 78 N
|
||||
16
|
||||
# 79 O
|
||||
16
|
||||
# 80 P
|
||||
14
|
||||
# 81 Q
|
||||
16
|
||||
# 82 R
|
||||
14
|
||||
# 83 S
|
||||
12
|
||||
# 84 T
|
||||
16
|
||||
# 85 U
|
||||
14
|
||||
# 86 V
|
||||
16
|
||||
# 87 W
|
||||
18
|
||||
# 88 X
|
||||
16
|
||||
# 89 Y
|
||||
16
|
||||
# 90 Z
|
||||
14
|
||||
# 91 [
|
||||
8
|
||||
# 92 \
|
||||
10
|
||||
# 93 ]
|
||||
8
|
||||
# 94 ^
|
||||
10
|
||||
# 95 _
|
||||
16
|
||||
# 96 `
|
||||
8
|
||||
# 97 a
|
||||
14
|
||||
# 98 b
|
||||
14
|
||||
# 99 c
|
||||
12
|
||||
# 100 d
|
||||
14
|
||||
# 101 e
|
||||
14
|
||||
# 102 f
|
||||
10
|
||||
# 103 g
|
||||
14
|
||||
# 104 h
|
||||
14
|
||||
# 105 i
|
||||
8
|
||||
# 106 j
|
||||
10
|
||||
# 107 k
|
||||
14
|
||||
# 108 l
|
||||
8
|
||||
# 109 m
|
||||
20
|
||||
# 110 n
|
||||
14
|
||||
# 111 o
|
||||
14
|
||||
# 112 p
|
||||
14
|
||||
# 113 q
|
||||
14
|
||||
# 114 r
|
||||
12
|
||||
# 115 s
|
||||
12
|
||||
# 116 t
|
||||
10
|
||||
# 117 u
|
||||
14
|
||||
# 118 v
|
||||
14
|
||||
# 119 w
|
||||
18
|
||||
# 120 x
|
||||
14
|
||||
# 121 y
|
||||
14
|
||||
# 122 z
|
||||
14
|
||||
# 123 { -> ñ
|
||||
14
|
||||
# 124 | -> ç
|
||||
14
|
||||
# 125 }
|
||||
0
|
||||
# 126 ~
|
||||
0
|
||||
BIN
data/font/smb2.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
194
data/font/smb2.txt
Normal file
@@ -0,0 +1,194 @@
|
||||
# box width
|
||||
8
|
||||
# box height
|
||||
8
|
||||
# 32 espacio ( )
|
||||
7
|
||||
# 33 !
|
||||
7
|
||||
# 34 "
|
||||
7
|
||||
# 35 #
|
||||
7
|
||||
# 36 $
|
||||
7
|
||||
# 37 %
|
||||
7
|
||||
# 38 &
|
||||
7
|
||||
# 39 '
|
||||
7
|
||||
# 40 (
|
||||
7
|
||||
# 41 )
|
||||
7
|
||||
# 42 *
|
||||
7
|
||||
# 43 +
|
||||
7
|
||||
# 44 ,
|
||||
7
|
||||
# 45 -
|
||||
7
|
||||
# 46 .
|
||||
7
|
||||
# 47 /
|
||||
7
|
||||
# 48 0
|
||||
7
|
||||
# 49 1
|
||||
7
|
||||
# 50 2
|
||||
7
|
||||
# 51 3
|
||||
7
|
||||
# 52 4
|
||||
7
|
||||
# 53 5
|
||||
7
|
||||
# 54 6
|
||||
7
|
||||
# 55 7
|
||||
7
|
||||
# 56 8
|
||||
7
|
||||
# 57 9
|
||||
7
|
||||
# 58 :
|
||||
7
|
||||
# 59 ;
|
||||
7
|
||||
# 60 <
|
||||
7
|
||||
# 61 =
|
||||
7
|
||||
# 62 >
|
||||
7
|
||||
# 63 ?
|
||||
7
|
||||
# 64 @
|
||||
7
|
||||
# 65 A
|
||||
7
|
||||
# 66 B
|
||||
7
|
||||
# 67 C
|
||||
7
|
||||
# 68 D
|
||||
7
|
||||
# 69 E
|
||||
7
|
||||
# 70 F
|
||||
7
|
||||
# 71 G
|
||||
7
|
||||
# 72 H
|
||||
7
|
||||
# 73 I
|
||||
7
|
||||
# 74 J
|
||||
7
|
||||
# 75 K
|
||||
7
|
||||
# 76 L
|
||||
7
|
||||
# 77 M
|
||||
7
|
||||
# 78 N
|
||||
7
|
||||
# 79 O
|
||||
7
|
||||
# 80 P
|
||||
7
|
||||
# 81 Q
|
||||
7
|
||||
# 82 R
|
||||
7
|
||||
# 83 S
|
||||
7
|
||||
# 84 T
|
||||
7
|
||||
# 85 U
|
||||
7
|
||||
# 86 V
|
||||
7
|
||||
# 87 W
|
||||
7
|
||||
# 88 X
|
||||
7
|
||||
# 89 Y
|
||||
7
|
||||
# 90 Z
|
||||
7
|
||||
# 91 [
|
||||
7
|
||||
# 92 \
|
||||
7
|
||||
# 93 ]
|
||||
7
|
||||
# 94 ^
|
||||
7
|
||||
# 95 _
|
||||
7
|
||||
# 96 `
|
||||
7
|
||||
# 97 a
|
||||
7
|
||||
# 98 b
|
||||
7
|
||||
# 99 c
|
||||
7
|
||||
# 100 d
|
||||
7
|
||||
# 101 e
|
||||
7
|
||||
# 102 f
|
||||
7
|
||||
# 103 g
|
||||
7
|
||||
# 104 h
|
||||
7
|
||||
# 105 i
|
||||
7
|
||||
# 106 j
|
||||
7
|
||||
# 107 k
|
||||
7
|
||||
# 108 l
|
||||
7
|
||||
# 109 m
|
||||
7
|
||||
# 110 n
|
||||
7
|
||||
# 111 o
|
||||
7
|
||||
# 112 p
|
||||
7
|
||||
# 113 q
|
||||
7
|
||||
# 114 r
|
||||
7
|
||||
# 115 s
|
||||
7
|
||||
# 116 t
|
||||
7
|
||||
# 117 u
|
||||
7
|
||||
# 118 v
|
||||
7
|
||||
# 119 w
|
||||
7
|
||||
# 120 x
|
||||
7
|
||||
# 121 y
|
||||
7
|
||||
# 122 z
|
||||
7
|
||||
# 123 {
|
||||
7
|
||||
# 124 |
|
||||
7
|
||||
# 125 }
|
||||
7
|
||||
# 126 ~
|
||||
7
|
||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
194
data/font/smb2_big.txt
Normal file
@@ -0,0 +1,194 @@
|
||||
# box width
|
||||
16
|
||||
# box height
|
||||
16
|
||||
# 32 espacio ( )
|
||||
16
|
||||
# 33 !
|
||||
16
|
||||
# 34 "
|
||||
16
|
||||
# 35 #
|
||||
16
|
||||
# 36 $
|
||||
16
|
||||
# 37 %
|
||||
16
|
||||
# 38 &
|
||||
16
|
||||
# 39 '
|
||||
16
|
||||
# 40 (
|
||||
16
|
||||
# 41 )
|
||||
16
|
||||
# 42 *
|
||||
16
|
||||
# 43 +
|
||||
16
|
||||
# 44 ,
|
||||
16
|
||||
# 45 -
|
||||
16
|
||||
# 46 .
|
||||
16
|
||||
# 47 /
|
||||
16
|
||||
# 48 0
|
||||
16
|
||||
# 49 1
|
||||
16
|
||||
# 50 2
|
||||
16
|
||||
# 51 3
|
||||
16
|
||||
# 52 4
|
||||
16
|
||||
# 53 5
|
||||
16
|
||||
# 54 6
|
||||
16
|
||||
# 55 7
|
||||
16
|
||||
# 56 8
|
||||
16
|
||||
# 57 9
|
||||
16
|
||||
# 58 :
|
||||
16
|
||||
# 59 ;
|
||||
16
|
||||
# 60 <
|
||||
16
|
||||
# 61 =
|
||||
16
|
||||
# 62 >
|
||||
16
|
||||
# 63 ?
|
||||
16
|
||||
# 64 @
|
||||
16
|
||||
# 65 A
|
||||
16
|
||||
# 66 B
|
||||
16
|
||||
# 67 C
|
||||
16
|
||||
# 68 D
|
||||
16
|
||||
# 69 E
|
||||
16
|
||||
# 70 F
|
||||
16
|
||||
# 71 G
|
||||
16
|
||||
# 72 H
|
||||
16
|
||||
# 73 I
|
||||
16
|
||||
# 74 J
|
||||
16
|
||||
# 75 K
|
||||
16
|
||||
# 76 L
|
||||
16
|
||||
# 77 M
|
||||
16
|
||||
# 78 N
|
||||
16
|
||||
# 79 O
|
||||
16
|
||||
# 80 P
|
||||
16
|
||||
# 81 Q
|
||||
16
|
||||
# 82 R
|
||||
16
|
||||
# 83 S
|
||||
16
|
||||
# 84 T
|
||||
16
|
||||
# 85 U
|
||||
16
|
||||
# 86 V
|
||||
16
|
||||
# 87 W
|
||||
16
|
||||
# 88 X
|
||||
16
|
||||
# 89 Y
|
||||
16
|
||||
# 90 Z
|
||||
16
|
||||
# 91 [
|
||||
16
|
||||
# 92 \
|
||||
16
|
||||
# 93 ]
|
||||
16
|
||||
# 94 ^
|
||||
16
|
||||
# 95 _
|
||||
16
|
||||
# 96 `
|
||||
16
|
||||
# 97 a
|
||||
16
|
||||
# 98 b
|
||||
16
|
||||
# 99 c
|
||||
16
|
||||
# 100 d
|
||||
16
|
||||
# 101 e
|
||||
16
|
||||
# 102 f
|
||||
16
|
||||
# 103 g
|
||||
16
|
||||
# 104 h
|
||||
16
|
||||
# 105 i
|
||||
16
|
||||
# 106 j
|
||||
16
|
||||
# 107 k
|
||||
16
|
||||
# 108 l
|
||||
16
|
||||
# 109 m
|
||||
16
|
||||
# 110 n
|
||||
16
|
||||
# 111 o
|
||||
16
|
||||
# 112 p
|
||||
16
|
||||
# 113 q
|
||||
16
|
||||
# 114 r
|
||||
16
|
||||
# 115 s
|
||||
16
|
||||
# 116 t
|
||||
16
|
||||
# 117 u
|
||||
16
|
||||
# 118 v
|
||||
16
|
||||
# 119 w
|
||||
16
|
||||
# 120 x
|
||||
16
|
||||
# 121 y
|
||||
16
|
||||
# 122 z
|
||||
16
|
||||
# 123 {
|
||||
16
|
||||
# 124 |
|
||||
16
|
||||
# 125 }
|
||||
16
|
||||
# 126 ~
|
||||
16
|
||||
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
BIN
data/gfx/bullet.png
Normal file
|
After Width: | Height: | Size: 644 B |
BIN
data/gfx/game_bg.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 795 B After Width: | Height: | Size: 795 B |
BIN
data/gfx/intro.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
data/gfx/items.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
data/gfx/logo.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
data/gfx/player1_body.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
data/gfx/player1_death.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
data/gfx/player1_head.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 785 B After Width: | Height: | Size: 785 B |
BIN
data/gfx/player2_body.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
data/gfx/player2_death.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
data/gfx/player2_head.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
data/gfx/player2_legs.png
Normal file
|
After Width: | Height: | Size: 654 B |
BIN
data/gfx/title.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
160
data/lang/ba_BA.txt
Normal file
@@ -0,0 +1,160 @@
|
||||
## 0 - MENU DEL TITULO
|
||||
JUGAR
|
||||
## 1 - MENU DEL TITULO
|
||||
OPCIONS
|
||||
## 2 - MENU DEL TITULO
|
||||
INSTRUCCIONS
|
||||
## 3 - MENU DEL TITULO
|
||||
EIXIR
|
||||
## 4 - MENU DE OPCIONES
|
||||
FINESTRA
|
||||
## 5 - MENU DE OPCIONES
|
||||
PANTALLA COMPLETA
|
||||
## 6 - MENU DE OPCIONES
|
||||
PANTALLA COMPLETA FALSA
|
||||
## 7 - MENU DE OPCIONES
|
||||
TAMANY DE FINESTRA
|
||||
## 8 - MENU DE OPCIONES
|
||||
IDIOMA
|
||||
## 9 - MENU DE OPCIONES
|
||||
[ ACEPTAR ]
|
||||
## 10 - MENU DE OPCIONES
|
||||
[ CANCELAR ]
|
||||
## 11 - INSTRUCCIONES
|
||||
OBJECTIU
|
||||
## 12 - INSTRUCCIONES
|
||||
HAS D'EXPLOTAR
|
||||
## 13 - INSTRUCCIONES
|
||||
TANTS GLOBUS COM PUGUES
|
||||
## 14 - INSTRUCCIONES
|
||||
LA DIFICULTAT AUGMENTA
|
||||
## 15 - INSTRUCCIONES
|
||||
A MESURA QUE VAS PUNTUANT
|
||||
## 16 - INSTRUCCIONES
|
||||
OBJECTES
|
||||
## 17 - INSTRUCCIONES
|
||||
1.000 PUNTS
|
||||
## 18 - INSTRUCCIONES
|
||||
2.500 PUNTS
|
||||
## 19 - INSTRUCCIONES
|
||||
5.000 PUNTS
|
||||
## 20 - INSTRUCCIONES
|
||||
PARA EL TEMPS
|
||||
## 21 - INSTRUCCIONES
|
||||
VIDA EXTRA
|
||||
## 22 - INSTRUCCIONES
|
||||
PREM UNA TECLA PER A TORNAR
|
||||
## 23 - TITULO
|
||||
PREM QUALSEVOL TECLA
|
||||
## 24 - MENU SELECCION DE IDIOMA
|
||||
ESPA{OL (ESPANYOL)
|
||||
## 25 - MENU SELECCION DE IDIOMA
|
||||
BALOONCIA
|
||||
## 26 - MENU SELECCION DE IDIOMA
|
||||
ENGLISH (ANGLES)
|
||||
## 27 - INTRO
|
||||
Un dia qualsevol de l'any 2000
|
||||
## 28 - INTRO
|
||||
Tot esta tranquil a la UPV
|
||||
## 29 - INTRO
|
||||
Fins que un desaprensiu...
|
||||
## 30 - INTRO
|
||||
HEY! ME ANE A FERME UN CORTAET...
|
||||
## 31 - INTRO
|
||||
UAAAAAAAAAAAAA!!!
|
||||
## 32 - INTRO
|
||||
Espera un moment...
|
||||
## 33 - INTRO
|
||||
Si resulta que no tinc solt!
|
||||
## 34 - INTRO
|
||||
MERDA DE MAQUINA!
|
||||
## 35 - INTRO
|
||||
Blop... blop... blop...
|
||||
## 36 - TEXTOS DEL JUEGO
|
||||
Temps detes:
|
||||
## 37 - TEXTOS DEL JUEGO
|
||||
D E M O
|
||||
## 38 - TEXTOS DEL JUEGO
|
||||
fases mes!
|
||||
## 39 -
|
||||
|
||||
## 40 -
|
||||
|
||||
## 41 -
|
||||
|
||||
## 42 -
|
||||
|
||||
## 43 - PANTALLA DE GAME OVER
|
||||
FI DEL JOC
|
||||
## 44 - PANTALLA DE GAME OVER
|
||||
ELS TEUS PUNTS:
|
||||
## 45 - PANTALLA DE GAME OVER
|
||||
CONTINUAR?
|
||||
## 46 - MENU DE PAUSA
|
||||
CONTINUAR
|
||||
## 47 - MENU DE PAUSA
|
||||
EIXIR DEL JOC
|
||||
## 48 - MENU GAME OVER
|
||||
SI
|
||||
## 49 - MENU GAME OVER
|
||||
NO
|
||||
## 50 - TEXTO DE COMPLETAR EL JUEGO
|
||||
Felicitats!!
|
||||
## 51 - MENU DEL TITULO
|
||||
1 JUGADOR
|
||||
## 52 - MENU DEL TITULO
|
||||
2 JUGADORS
|
||||
## 53 MARCADOR
|
||||
jugador 1
|
||||
## 54 MARCADOR
|
||||
jugador 2
|
||||
## 55 MARCADOR
|
||||
mult
|
||||
## 56 MARCADOR
|
||||
max. puntuacio
|
||||
## 57 MARCADOR
|
||||
fase
|
||||
## 58 - MENU DE OPCIONES
|
||||
MODE DE VISUALITZACIO
|
||||
## 59 - MENU DE OPCIONES
|
||||
DIFICULTAT
|
||||
## 60 - MENU DE OPCIONES
|
||||
FILTRE
|
||||
## 61 - MENU DE OPCIONES
|
||||
SINC. VERTICAL
|
||||
## 62 - MENU DE OPCIONES
|
||||
CONTROLS DEL JUGADOR 1
|
||||
## 63 - MENU DE OPCIONES
|
||||
CONTROLS DEL JUGADOR 2
|
||||
## 64 -
|
||||
|
||||
## 65 -
|
||||
|
||||
## 66 - MENU DE OPCIONES
|
||||
FACIL
|
||||
## 67 - MENU DE OPCIONES
|
||||
NORMAL
|
||||
## 68 - MENU DE OPCIONES
|
||||
DIFICIL
|
||||
## 69 - MENU DE OPCIONES
|
||||
TECLAT
|
||||
## 70 - MENU DE OPCIONES
|
||||
MANDO
|
||||
## 71 - MENU DE OPCIONES
|
||||
LINEAL
|
||||
## 72 - MENU DE OPCIONES
|
||||
NEAREST
|
||||
## 73 - MENU DE OPCIONES
|
||||
ACTIVADA
|
||||
## 74 - MENU DE OPCIONES
|
||||
DESACTIVADA
|
||||
## 75 - JUEGO
|
||||
Endavant!
|
||||
## 76 - JUEGO
|
||||
1.000.000 de punts!
|
||||
## 77 - PANTALLA DE GAME OVER
|
||||
PUNTS J1:
|
||||
## 78 - PANTALLA DE GAME OVER
|
||||
PUNTS J2:
|
||||
## 79 - TEXTOS DEL JUEGO
|
||||
Ultima fase!
|
||||
160
data/lang/en_UK.txt
Normal file
@@ -0,0 +1,160 @@
|
||||
## 0 - MENU DEL TITULO
|
||||
PLAY
|
||||
## 1 - MENU DEL TITULO
|
||||
OPTIONS
|
||||
## 2 - MENU DEL TITULO
|
||||
HOW TO PLAY
|
||||
## 3 - MENU DEL TITULO
|
||||
QUIT
|
||||
## 4 - MENU DE OPCIONES
|
||||
WINDOW
|
||||
## 5 - MENU DE OPCIONES
|
||||
FULLSCREEN
|
||||
## 6 - MENU DE OPCIONES
|
||||
FAKE FULLSCREEN
|
||||
## 7 - MENU DE OPCIONES
|
||||
WINDOW SIZE
|
||||
## 8 - MENU DE OPCIONES
|
||||
LANGUAGE
|
||||
## 9 - MENU DE OPCIONES
|
||||
[ ACCEPT ]
|
||||
## 10 - MENU DE OPCIONES
|
||||
[ CANCEL ]
|
||||
## 11 - INSTRUCCIONES
|
||||
OBJECTIVE
|
||||
## 12 - INSTRUCCIONES
|
||||
YOU HAVE TO POP AS MANY
|
||||
## 13 - INSTRUCCIONES
|
||||
BALLOONS AS YOU CAN
|
||||
## 14 - INSTRUCCIONES
|
||||
DIFFICULTY WILL BE INCREASED
|
||||
## 15 - INSTRUCCIONES
|
||||
AS YOU SCORE POINTS
|
||||
## 16 - INSTRUCCIONES
|
||||
ITEMS
|
||||
## 17 - INSTRUCCIONES
|
||||
1.000 POINTS
|
||||
## 18 - INSTRUCCIONES
|
||||
2.500 POINTS
|
||||
## 19 - INSTRUCCIONES
|
||||
5.000 POINTS
|
||||
## 20 - INSTRUCCIONES
|
||||
TIME STOPPER
|
||||
## 21 - INSTRUCCIONES
|
||||
EXTRA HIT
|
||||
## 22 - INSTRUCCIONES
|
||||
PRESS ANY KEY TO RETURN
|
||||
## 23 - TITULO
|
||||
PRESS ANY KEY
|
||||
## 24 - MENU SELECCION DE IDIOMA
|
||||
ESPA{OL (SPANISH)
|
||||
## 25 - MENU SELECCION DE IDIOMA
|
||||
BALOONCIA (VALENCIAN)
|
||||
## 26 - MENU SELECCION DE IDIOMA
|
||||
ENGLISH
|
||||
## 27 - INTRO
|
||||
Any day of the year 2000
|
||||
## 28 - INTRO
|
||||
Everything is quiet at the UPV
|
||||
## 29 - INTRO
|
||||
Until a bastard arrives...
|
||||
## 30 - INTRO
|
||||
YO! GONNA TAKE A CAFELITO...
|
||||
## 31 - INTRO
|
||||
AAAAAAAARGHHHH!!!
|
||||
## 32 - INTRO
|
||||
Wait a moment...
|
||||
## 33 - INTRO
|
||||
I don't have any loose!
|
||||
## 34 - INTRO
|
||||
FUCKING MACHINE!
|
||||
## 35 - INTRO
|
||||
Blop... blop... blop...
|
||||
## 36 - TEXTOS DEL JUEGO
|
||||
Time stopped:
|
||||
## 37 - TEXTOS DEL JUEGO
|
||||
D E M O
|
||||
## 38 - TEXTOS DEL JUEGO
|
||||
stages left!
|
||||
## 39 -
|
||||
|
||||
## 40 -
|
||||
|
||||
## 41 -
|
||||
|
||||
## 42 -
|
||||
|
||||
## 43 - PANTALLA DE GAME OVER
|
||||
GAME OVER
|
||||
## 44 - PANTALLA DE GAME OVER
|
||||
YOUR SCORE:
|
||||
## 45 - PANTALLA DE GAME OVER
|
||||
CONTINUE?
|
||||
## 46 - MENU DE PAUSA
|
||||
CONTINUE
|
||||
## 47 - MENU DE PAUSA
|
||||
LEAVE GAME
|
||||
## 48 - MENU GAME OVER
|
||||
YES
|
||||
## 49 - MENU GAME OVER
|
||||
NO
|
||||
## 50 - TEXTO DE COMPLETAR EL JUEGO
|
||||
Congratulations!!
|
||||
## 51 - MENU DEL TITULO
|
||||
1 PLAYER
|
||||
## 52 - MENU DEL TITULO
|
||||
2 PLAYERS
|
||||
## 53 - MARCADOR
|
||||
player 1
|
||||
## 54 - MARCADOR
|
||||
player 2
|
||||
## 55 - MARCADOR
|
||||
mult
|
||||
## 56 - MARCADOR
|
||||
high score
|
||||
## 57 - MARCADOR
|
||||
stage
|
||||
## 58 - MENU DE OPCIONES
|
||||
DISPLAY MODE
|
||||
## 59 - MENU DE OPCIONES
|
||||
DIFFICULTY
|
||||
## 60 - MENU DE OPCIONES
|
||||
FILTER
|
||||
## 61 - MENU DE OPCIONES
|
||||
VSYNC
|
||||
## 62 - MENU DE OPCIONES
|
||||
PLAYER 1 CONTROLS
|
||||
## 63 - MENU DE OPCIONES
|
||||
PLAYER 2 CONTROLS
|
||||
## 64 -
|
||||
|
||||
## 65 -
|
||||
|
||||
## 66 - MENU DE OPCIONES
|
||||
EASY
|
||||
## 67 - MENU DE OPCIONES
|
||||
NORMAL
|
||||
## 68 - MENU DE OPCIONES
|
||||
HARD
|
||||
## 69 - MENU DE OPCIONES
|
||||
KEYBOARD
|
||||
## 70 - MENU DE OPCIONES
|
||||
GAME CONTROLLER
|
||||
## 71 - MENU DE OPCIONES
|
||||
LINEAL
|
||||
## 72 - MENU DE OPCIONES
|
||||
NEAREST
|
||||
## 73 - MENU DE OPCIONES
|
||||
ON
|
||||
## 74 - MENU DE OPCIONES
|
||||
OFF
|
||||
## 75 - JUEGO
|
||||
Get Ready!
|
||||
## 76 - JUEGO
|
||||
1.000.000 points!
|
||||
## 77 - PANTALLA DE GAME OVER
|
||||
PLAYER1 SCORE:
|
||||
## 78 - PANTALLA DE GAME OVER
|
||||
PLAYER2 SCORE:
|
||||
## 79 - TEXTOS DEL JUEGO
|
||||
Last stage!
|
||||
160
data/lang/es_ES.txt
Normal file
@@ -0,0 +1,160 @@
|
||||
## 0 - MENU DEL TITULO
|
||||
JUGAR
|
||||
## 1 - MENU DEL TITULO
|
||||
OPCIONES
|
||||
## 2 - MENU DEL TITULO
|
||||
INSTRUCCIONES
|
||||
## 3 - MENU DEL TITULO
|
||||
SALIR
|
||||
## 4 - MENU DE OPCIONES
|
||||
VENTANA
|
||||
## 5 - MENU DE OPCIONES
|
||||
PANTALLA COMPLETA
|
||||
## 6 - MENU DE OPCIONES
|
||||
PANTALLA COMPLETA FALSA
|
||||
## 7 - MENU DE OPCIONES
|
||||
TAMA{O DE VENTANA
|
||||
## 8 - MENU DE OPCIONES
|
||||
IDIOMA
|
||||
## 9 - MENU DE OPCIONES
|
||||
[ ACEPTAR ]
|
||||
## 10 - MENU DE OPCIONES
|
||||
[ CANCELAR ]
|
||||
## 11 - INSTRUCCIONES
|
||||
OBJETIVO
|
||||
## 12 - INSTRUCCIONES
|
||||
TIENES QUE EXPLOTAR
|
||||
## 13 - INSTRUCCIONES
|
||||
TANTOS GLOBOS COMO PUEDAS
|
||||
## 14 - INSTRUCCIONES
|
||||
LA DIFICULTAD SE INCREMENTA
|
||||
## 15 - INSTRUCCIONES
|
||||
A MEDIDA QUE VAS PUNTUANDO
|
||||
## 16 - INSTRUCCIONES
|
||||
OBJETOS
|
||||
## 17 - INSTRUCCIONES
|
||||
1.000 PUNTOS
|
||||
## 18 - INSTRUCCIONES
|
||||
2.500 PUNTOS
|
||||
## 19 - INSTRUCCIONES
|
||||
5.000 PUNTOS
|
||||
## 20 - INSTRUCCIONES
|
||||
DETIENE EL TIEMPO
|
||||
## 21 - INSTRUCCIONES
|
||||
VIDA EXTRA
|
||||
## 22 - INSTRUCCIONES
|
||||
PULSA UNA TECLA PARA VOLVER
|
||||
## 23 - TITULO
|
||||
PULSA CUALQUIER TECLA
|
||||
## 24 - MENU SELECCION DE IDIOMA
|
||||
ESPA{OL
|
||||
## 25 - MENU SELECCION DE IDIOMA
|
||||
BALOONCIA (VALENCIANO)
|
||||
## 26 - MENU SELECCION DE IDIOMA
|
||||
ENGLISH (INGLES)
|
||||
## 27 - INTRO
|
||||
Un dia cualquiera del a{o 2000
|
||||
## 28 - INTRO
|
||||
Todo esta tranquilo en la UPV
|
||||
## 29 - INTRO
|
||||
Hasta que un desaprensivo...
|
||||
## 30 - INTRO
|
||||
HEY! VOY A SACARME UN TALLADET...
|
||||
## 31 - INTRO
|
||||
UAAAAAAAAAAAAA!!!
|
||||
## 32 - INTRO
|
||||
Espera un momento...
|
||||
## 33 - INTRO
|
||||
Si no llevo suelto encima!
|
||||
## 34 - INTRO
|
||||
MIERDA DE MAQUINA!
|
||||
## 35 - INTRO
|
||||
Blop... blop... blop...
|
||||
## 36 - TEXTOS DEL JUEGO
|
||||
Tiempo:
|
||||
## 37 - TEXTOS DEL JUEGO
|
||||
D E M O
|
||||
## 38 - TEXTOS DEL JUEGO
|
||||
fases mas!
|
||||
## 39 -
|
||||
|
||||
## 40 -
|
||||
|
||||
## 41 -
|
||||
|
||||
## 42 -
|
||||
|
||||
## 43 - PANTALLA DE GAME OVER
|
||||
FIN DE JUEGO
|
||||
## 44 - PANTALLA DE GAME OVER
|
||||
TU PUNTUACION:
|
||||
## 45 - PANTALLA DE GAME OVER
|
||||
CONTINUAR?
|
||||
## 46 - MENU DE PAUSA
|
||||
CONTINUAR
|
||||
## 47 - MENU DE PAUSA
|
||||
SALIR DEL JUEGO
|
||||
## 48 - MENU GAME OVER
|
||||
SI
|
||||
## 49 - MENU GAME OVER
|
||||
NO
|
||||
## 50 - TEXTO DE COMPLETAR EL JUEGO
|
||||
Felicidades!!
|
||||
## 51 - MENU DEL TITULO
|
||||
1 JUGADOR
|
||||
## 52 - MENU DEL TITULO
|
||||
2 JUGADORES
|
||||
## 53 - MARCADOR
|
||||
jugador 1
|
||||
## 54 - MARCADOR
|
||||
jugador 2
|
||||
## 55 - MARCADOR
|
||||
mult
|
||||
## 56 - MARCADOR
|
||||
max. puntuacion
|
||||
## 57 - MARCADOR
|
||||
FASE
|
||||
## 58 - MENU DE OPCIONES
|
||||
MODO DE VISUALIZACION
|
||||
## 59 - MENU DE OPCIONES
|
||||
DIFICULTAD
|
||||
## 60 - MENU DE OPCIONES
|
||||
FILTRO
|
||||
## 61 - MENU DE OPCIONES
|
||||
SINC. VERTICAL
|
||||
## 62 - MENU DE OPCIONES
|
||||
CONTROLES DEL JUGADOR 1
|
||||
## 63 - MENU DE OPCIONES
|
||||
CONTROLES DEL JUGADOR 2
|
||||
## 64 -
|
||||
|
||||
## 65 -
|
||||
|
||||
## 66 - MENU DE OPCIONES
|
||||
FACIL
|
||||
## 67 - MENU DE OPCIONES
|
||||
NORMAL
|
||||
## 68 - MENU DE OPCIONES
|
||||
DIFICIL
|
||||
## 69 - MENU DE OPCIONES
|
||||
TECLADO
|
||||
## 70 - MENU DE OPCIONES
|
||||
MANDO
|
||||
## 71 - MENU DE OPCIONES
|
||||
LINEAL
|
||||
## 72 - MENU DE OPCIONES
|
||||
NEAREST
|
||||
## 73 - MENU DE OPCIONES
|
||||
ACTIVADA
|
||||
## 74 - MENU DE OPCIONES
|
||||
DESACTIVADA
|
||||
## 75 - JUEGO
|
||||
Adelante!
|
||||
## 76 - JUEGO
|
||||
1.000.000 de puntos!
|
||||
## 77 - PANTALLA DE GAME OVER
|
||||
PUNTUACION J1:
|
||||
## 78 - PANTALLA DE GAME OVER
|
||||
PUNTUACION J2:
|
||||
## 79 - TEXTOS DEL JUEGO
|
||||
Ultima fase!
|
||||
BIN
data/music/playing.ogg
Normal file
BIN
data/music/title.ogg
Normal file
BIN
data/sound/clock.wav
Normal file
BIN
data/sound/powerball.wav
Normal file
BIN
media/.DS_Store
vendored
BIN
media/gfx/.DS_Store
vendored
|
Before Width: | Height: | Size: 348 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 146 B |
|
Before Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 672 B |
|
Before Width: | Height: | Size: 3.6 KiB |
BIN
media/music/.DS_Store
vendored
@@ -1,10 +0,0 @@
|
||||
playing.ogg
|
||||
ARCADE GOBLINS
|
||||
https://soundimage.org/chiptunes-3/
|
||||
|
||||
title.ogg
|
||||
ARCADE STORIES
|
||||
https://soundimage.org/chiptunes-3/
|
||||
|
||||
intro.ogg
|
||||
JailDoctor
|
||||
@@ -1,59 +0,0 @@
|
||||
bullet.wav
|
||||
Gun11.wav
|
||||
http://www.themotionmonkey.co.uk/free-resources/retro-arcade-sounds/
|
||||
|
||||
balloon.wav
|
||||
Impact3.wav
|
||||
http://www.themotionmonkey.co.uk/free-resources/retro-arcade-sounds/
|
||||
|
||||
player_collision.wav
|
||||
Impact5.wav
|
||||
http://www.themotionmonkey.co.uk/free-resources/retro-arcade-sounds/
|
||||
|
||||
title.wav
|
||||
Explosion2.wav
|
||||
http://www.themotionmonkey.co.uk/free-resources/retro-arcade-sounds/
|
||||
|
||||
menu_select.wav
|
||||
kenney_digitalaudio/powerUp2.ogg
|
||||
www.kenney.nl
|
||||
|
||||
menu_move.wav
|
||||
kenney_uiaudio/switch11.ogg
|
||||
www.kenney.nl
|
||||
|
||||
hiscore.wav
|
||||
kenney_digitalaudio/powerUp1.ogg
|
||||
www.kenney.nl
|
||||
|
||||
itemdrop.wav
|
||||
kenney_digitalaudio/PowerUp10.ogg
|
||||
www.kenney.nl
|
||||
|
||||
itempickup.wav
|
||||
kenney_digitalaudio/PowerUp7.ogg
|
||||
www.kenney.nl
|
||||
|
||||
coffeeout.wav
|
||||
kenney_digitalaudio/lowDown.ogg
|
||||
www.kenney.nl
|
||||
|
||||
stage_change.wav
|
||||
JailDoctor
|
||||
|
||||
menu_cancel.wav
|
||||
kenney_digitalaudio/lowRandom.ogg
|
||||
kenney_digitalaudio/pepSound1.ogg <-
|
||||
www.kenney.nl
|
||||
|
||||
bubble1.wav
|
||||
JailDoctor
|
||||
|
||||
bubble2.wav
|
||||
JailDoctor
|
||||
|
||||
bubble3.wav
|
||||
JailDoctor
|
||||
|
||||
bubble4.wav
|
||||
JailDoctor
|
||||
BIN
source/.DS_Store
vendored
@@ -1,125 +1,333 @@
|
||||
#include "const.h"
|
||||
|
||||
#include "animatedsprite.h"
|
||||
#include <iostream>
|
||||
|
||||
// Constructor
|
||||
AnimatedSprite::AnimatedSprite()
|
||||
AnimatedSprite::AnimatedSprite(LTexture *texture, SDL_Renderer *renderer, std::string file)
|
||||
{
|
||||
init(nullptr, nullptr);
|
||||
// Copia los punteros
|
||||
setTexture(texture);
|
||||
setRenderer(renderer);
|
||||
|
||||
// Carga las animaciones
|
||||
load(file);
|
||||
|
||||
// Inicializa variables
|
||||
currentAnimation = 0;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
AnimatedSprite::~AnimatedSprite()
|
||||
{
|
||||
init(nullptr, nullptr);
|
||||
for (auto &a : animation)
|
||||
{
|
||||
a.frames.clear();
|
||||
}
|
||||
animation.clear();
|
||||
}
|
||||
|
||||
// Iniciador
|
||||
void AnimatedSprite::init(LTexture *texture, SDL_Renderer *renderer)
|
||||
// Obtiene el indice de la animación a partir del nombre
|
||||
int AnimatedSprite::getIndex(std::string name)
|
||||
{
|
||||
mRenderer = renderer;
|
||||
mTexture = texture;
|
||||
for (Uint8 i = 0; i < 20; i++)
|
||||
int index = -1;
|
||||
|
||||
for (auto a : animation)
|
||||
{
|
||||
mAnimation[i].numFrames = 0;
|
||||
mAnimation[i].speed = 0;
|
||||
mAnimation[i].loop = true;
|
||||
mAnimation[i].completed = false;
|
||||
for (Uint8 j = 0; i < 20; i++)
|
||||
index++;
|
||||
if (a.name == name)
|
||||
{
|
||||
mAnimation[i].frames[j].x = 0;
|
||||
mAnimation[i].frames[j].y = 0;
|
||||
mAnimation[i].frames[j].w = 0;
|
||||
mAnimation[i].frames[j].h = 0;
|
||||
return index;
|
||||
}
|
||||
}
|
||||
mCurrentFrame = 0;
|
||||
mAnimationCounter = 0;
|
||||
|
||||
printf("** Warning: could not find \"%s\" animation\n", name.c_str());
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Calcula el frame correspondiente a la animación
|
||||
void AnimatedSprite::animate(int index)
|
||||
void AnimatedSprite::animate()
|
||||
{
|
||||
// Calculamos el frame actual a partir del contador
|
||||
mCurrentFrame = mAnimationCounter / mAnimation[index].speed;
|
||||
|
||||
// Si alcanzamos el final de la animación, reiniciamos el contador de la animación
|
||||
// en función de la variable loop
|
||||
if (mCurrentFrame >= mAnimation[index].numFrames)
|
||||
if (!enabled || animation[currentAnimation].speed == 0)
|
||||
{
|
||||
if (mAnimation[index].loop)
|
||||
{
|
||||
mAnimationCounter = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Calcula el frame actual a partir del contador
|
||||
animation[currentAnimation].currentFrame = animation[currentAnimation].counter / animation[currentAnimation].speed;
|
||||
|
||||
// Si alcanza el final de la animación, reinicia el contador de la animación
|
||||
// en función de la variable loop y coloca el nuevo frame
|
||||
if (animation[currentAnimation].currentFrame >= (int)animation[currentAnimation].frames.size())
|
||||
{
|
||||
if (animation[currentAnimation].loop == -1)
|
||||
{ // Si no hay loop, deja el último frame
|
||||
animation[currentAnimation].currentFrame = animation[currentAnimation].frames.size();
|
||||
animation[currentAnimation].completed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCurrentFrame = mAnimation[index].numFrames;
|
||||
{ // Si hay loop, vuelve al frame indicado
|
||||
animation[currentAnimation].counter = 0;
|
||||
animation[currentAnimation].currentFrame = animation[currentAnimation].loop;
|
||||
}
|
||||
}
|
||||
// En caso contrario
|
||||
else
|
||||
{
|
||||
// Escogemos el frame correspondiente de la animación
|
||||
setSpriteClip(mAnimation[index].frames[mCurrentFrame]);
|
||||
// Escoge el frame correspondiente de la animación
|
||||
setSpriteClip(animation[currentAnimation].frames[animation[currentAnimation].currentFrame]);
|
||||
|
||||
// Incrementamos el contador de la animacion
|
||||
++mAnimationCounter;
|
||||
// Incrementa el contador de la animacion
|
||||
animation[currentAnimation].counter++;
|
||||
}
|
||||
}
|
||||
|
||||
// Establece el frame actual de la animación
|
||||
void AnimatedSprite::setCurrentFrame(Uint8 num)
|
||||
void AnimatedSprite::setCurrentFrame(int num)
|
||||
{
|
||||
mCurrentFrame = num;
|
||||
// Descarta valores fuera de rango
|
||||
if (num >= (int)animation[currentAnimation].frames.size())
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
|
||||
// Cambia el valor de la variable
|
||||
animation[currentAnimation].counter = animation[currentAnimation].speed * num;
|
||||
|
||||
// Escoge el frame correspondiente de la animación
|
||||
setSpriteClip(animation[currentAnimation].frames[animation[currentAnimation].currentFrame]);
|
||||
}
|
||||
|
||||
// Establece el valor del contador
|
||||
void AnimatedSprite::setAnimationCounter(Uint16 num)
|
||||
void AnimatedSprite::setAnimationCounter(std::string name, int num)
|
||||
{
|
||||
mAnimationCounter = num;
|
||||
animation[getIndex(name)].counter = num;
|
||||
}
|
||||
|
||||
// Establece la velocidad de una animación
|
||||
void AnimatedSprite::setAnimationSpeed(std::string name, int speed)
|
||||
{
|
||||
animation[getIndex(name)].counter = speed;
|
||||
}
|
||||
|
||||
// Establece la velocidad de una animación
|
||||
void AnimatedSprite::setAnimationSpeed(int index, int speed)
|
||||
{
|
||||
animation[index].counter = speed;
|
||||
}
|
||||
|
||||
// Establece si la animación se reproduce en bucle
|
||||
void AnimatedSprite::setAnimationLoop(std::string name, int loop)
|
||||
{
|
||||
animation[getIndex(name)].loop = loop;
|
||||
}
|
||||
|
||||
// Establece si la animación se reproduce en bucle
|
||||
void AnimatedSprite::setAnimationLoop(int index, int loop)
|
||||
{
|
||||
animation[index].loop = loop;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void AnimatedSprite::setAnimationCompleted(std::string name, bool value)
|
||||
{
|
||||
animation[getIndex(name)].completed = value;
|
||||
}
|
||||
|
||||
// OLD - Establece el valor de la variable
|
||||
void AnimatedSprite::setAnimationCompleted(int index, bool value)
|
||||
{
|
||||
animation[index].completed = value;
|
||||
}
|
||||
|
||||
// Comprueba si ha terminado la animación
|
||||
bool AnimatedSprite::animationIsCompleted()
|
||||
{
|
||||
return animation[currentAnimation].completed;
|
||||
}
|
||||
|
||||
// Devuelve el rectangulo de una animación y frame concreto
|
||||
SDL_Rect AnimatedSprite::getAnimationClip(std::string name, Uint8 index)
|
||||
{
|
||||
return animation[getIndex(name)].frames[index];
|
||||
}
|
||||
|
||||
// Carga la animación desde un fichero
|
||||
bool AnimatedSprite::load(std::string filePath)
|
||||
{
|
||||
int frames_per_row = 0;
|
||||
int frame_width = 0;
|
||||
int frame_height = 0;
|
||||
|
||||
// Indicador de éxito en la carga
|
||||
bool success = true;
|
||||
|
||||
const std::string filename = filePath.substr(filePath.find_last_of("\\/") + 1);
|
||||
std::ifstream file(filePath);
|
||||
std::string line;
|
||||
|
||||
// El fichero se puede abrir
|
||||
if (file.good())
|
||||
{
|
||||
// Procesa el fichero linea a linea
|
||||
printf("Reading file %s\n", filename.c_str());
|
||||
while (std::getline(file, line))
|
||||
{
|
||||
// Si la linea contiene el texto [animation] se realiza el proceso de carga de una animación
|
||||
if (line == "[animation]")
|
||||
{
|
||||
t_animation buffer;
|
||||
buffer.counter = 0;
|
||||
buffer.currentFrame = 0;
|
||||
buffer.completed = false;
|
||||
|
||||
do
|
||||
{
|
||||
std::getline(file, line);
|
||||
|
||||
// Encuentra la posición del caracter '='
|
||||
int pos = line.find("=");
|
||||
|
||||
// Procesa las dos subcadenas
|
||||
if (pos != (int)line.npos)
|
||||
{
|
||||
if (line.substr(0, pos) == "name")
|
||||
{
|
||||
buffer.name = line.substr(pos + 1, line.length());
|
||||
}
|
||||
else if (line.substr(0, pos) == "speed")
|
||||
{
|
||||
buffer.speed = std::stoi(line.substr(pos + 1, line.length()));
|
||||
}
|
||||
else if (line.substr(0, pos) == "loop")
|
||||
{
|
||||
buffer.loop = std::stoi(line.substr(pos + 1, line.length()));
|
||||
}
|
||||
else if (line.substr(0, pos) == "frames")
|
||||
{
|
||||
// Se introducen los valores separados por comas en un vector
|
||||
std::stringstream ss(line.substr(pos + 1, line.length()));
|
||||
std::string tmp;
|
||||
SDL_Rect rect = {0, 0, frame_width, frame_height};
|
||||
while (getline(ss, tmp, ','))
|
||||
{
|
||||
int num_tile = std::stoi(tmp);
|
||||
rect.x = (num_tile % frames_per_row) * frame_width;
|
||||
rect.y = (num_tile / frames_per_row) * frame_height;
|
||||
buffer.frames.push_back(rect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
} while (line != "[/animation]");
|
||||
|
||||
// Añade la animación al vector de animaciones
|
||||
animation.push_back(buffer);
|
||||
}
|
||||
|
||||
// En caso contrario se parsea el fichero para buscar las variables y los valores
|
||||
else
|
||||
{
|
||||
// Encuentra la posición del caracter '='
|
||||
int pos = line.find("=");
|
||||
|
||||
// Procesa las dos subcadenas
|
||||
if (pos != (int)line.npos)
|
||||
{
|
||||
if (line.substr(0, pos) == "frames_per_row")
|
||||
{
|
||||
frames_per_row = std::stoi(line.substr(pos + 1, line.length()));
|
||||
}
|
||||
|
||||
else if (line.substr(0, pos) == "frame_width")
|
||||
{
|
||||
frame_width = std::stoi(line.substr(pos + 1, line.length()));
|
||||
|
||||
// Normaliza valores
|
||||
if (frames_per_row == 0)
|
||||
{
|
||||
frames_per_row = texture->getWidth() / frame_width;
|
||||
}
|
||||
}
|
||||
|
||||
else if (line.substr(0, pos) == "frame_height")
|
||||
{
|
||||
frame_height = std::stoi(line.substr(pos + 1, line.length()));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cierra el fichero
|
||||
printf("Closing file %s\n\n", filename.c_str());
|
||||
file.close();
|
||||
}
|
||||
// El fichero no se puede abrir
|
||||
else
|
||||
{
|
||||
printf("Warning: Unable to open %s file\n", filename.c_str());
|
||||
success = false;
|
||||
}
|
||||
|
||||
// Pone un valor por defecto
|
||||
setPos({0, 0, frame_width, frame_height});
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
// Establece la animacion actual
|
||||
void AnimatedSprite::setCurrentAnimation(std::string name)
|
||||
{
|
||||
const int newAnimation = getIndex(name);
|
||||
if (currentAnimation != newAnimation)
|
||||
{
|
||||
currentAnimation = newAnimation;
|
||||
animation[currentAnimation].currentFrame = 0;
|
||||
animation[currentAnimation].counter = 0;
|
||||
animation[currentAnimation].completed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Establece la animacion actual
|
||||
void AnimatedSprite::setCurrentAnimation(int index)
|
||||
{
|
||||
const int newAnimation = index;
|
||||
if (currentAnimation != newAnimation)
|
||||
{
|
||||
currentAnimation = newAnimation;
|
||||
animation[currentAnimation].currentFrame = 0;
|
||||
animation[currentAnimation].counter = 0;
|
||||
animation[currentAnimation].completed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza las variables del objeto
|
||||
void AnimatedSprite::update()
|
||||
{
|
||||
animate();
|
||||
MovingSprite::update();
|
||||
}
|
||||
|
||||
// Establece el rectangulo para un frame de una animación
|
||||
void AnimatedSprite::setAnimationFrames(Uint8 index_animation, Uint8 index_frame, int x, int y, int w, int h)
|
||||
{
|
||||
mAnimation[index_animation].frames[index_frame].x = x;
|
||||
mAnimation[index_animation].frames[index_frame].y = y;
|
||||
mAnimation[index_animation].frames[index_frame].w = w;
|
||||
mAnimation[index_animation].frames[index_frame].h = h;
|
||||
animation[index_animation].frames.push_back({x, y, w, h});
|
||||
}
|
||||
|
||||
// Establece la velocidad de una animación
|
||||
void AnimatedSprite::setAnimationSpeed(Uint8 index, Uint8 speed)
|
||||
// OLD - Establece el contador para todas las animaciones
|
||||
void AnimatedSprite::setAnimationCounter(int value)
|
||||
{
|
||||
mAnimation[index].speed = speed;
|
||||
}
|
||||
|
||||
// Establece el numero de frames de una animación
|
||||
void AnimatedSprite::setAnimationNumFrames(Uint8 index, Uint8 num)
|
||||
{
|
||||
mAnimation[index].numFrames = num;
|
||||
}
|
||||
|
||||
// Establece si la animación se reproduce en bucle
|
||||
void AnimatedSprite::setAnimationLoop(Uint8 index, bool loop)
|
||||
{
|
||||
mAnimation[index].loop = loop;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void AnimatedSprite::setCompleted(Uint8 index, bool value)
|
||||
{
|
||||
mAnimation[index].completed = value;
|
||||
}
|
||||
|
||||
// Comprueba si ha terminado la animación
|
||||
bool AnimatedSprite::isCompleted(Uint8 index)
|
||||
{
|
||||
return mAnimation[index].completed;
|
||||
}
|
||||
|
||||
// Devuelve el rectangulo de una animación y frame concreto
|
||||
SDL_Rect AnimatedSprite::getAnimationClip(Uint8 index_animation, Uint8 index_frame)
|
||||
{
|
||||
return mAnimation[index_animation].frames[index_frame];
|
||||
for (auto &a:animation)
|
||||
{
|
||||
a.counter = value;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +1,84 @@
|
||||
#pragma once
|
||||
#include "ifdefs.h"
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "movingsprite.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#ifndef ANIMATEDSPRITE_H
|
||||
#define ANIMATEDSPRITE_H
|
||||
|
||||
#define MAX_FRAMES 30
|
||||
#define MAX_ANIMATIONS 20
|
||||
|
||||
// Clase AnimatedSprite
|
||||
class AnimatedSprite : public MovingSprite
|
||||
{
|
||||
private:
|
||||
struct sAnimation
|
||||
struct t_animation
|
||||
{
|
||||
SDL_Rect frames[MAX_FRAMES]; // Cada uno de los frames que componen la animación
|
||||
Uint8 numFrames; // Numero de frames que componen la animación
|
||||
Uint8 speed; // Velocidad de la animación
|
||||
bool loop; // Indica si la animación se reproduce en bucle
|
||||
bool completed; // Indica si ha finalizado la animación
|
||||
std::string name; // Nombre de la animacion
|
||||
std::vector<SDL_Rect> frames; // Cada uno de los frames que componen la animación
|
||||
int speed; // Velocidad de la animación
|
||||
int loop; // Indica a que frame vuelve la animación al terminar. -1 para que no vuelva
|
||||
bool completed; // Indica si ha finalizado la animación
|
||||
int currentFrame; // Frame actual
|
||||
int counter; // Contador para las animaciones
|
||||
};
|
||||
sAnimation mAnimation[MAX_ANIMATIONS]; // Vector con las diferentes animaciones
|
||||
|
||||
Uint8 mCurrentFrame; // Frame actual
|
||||
Uint16 mAnimationCounter; // Contador para las animaciones
|
||||
std::vector<t_animation> animation; // Vector con las diferentes animaciones
|
||||
int currentAnimation; // Animacion activa
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
AnimatedSprite();
|
||||
AnimatedSprite(LTexture *texture = nullptr, SDL_Renderer *renderer = nullptr, std::string file = "");
|
||||
|
||||
// Destructor
|
||||
~AnimatedSprite();
|
||||
|
||||
// Iniciador
|
||||
void init(LTexture *texture, SDL_Renderer *renderer);
|
||||
|
||||
// Calcula el frame correspondiente a la animación
|
||||
void animate(int index);
|
||||
// Calcula el frame correspondiente a la animación actual
|
||||
void animate();
|
||||
|
||||
// Establece el frame actual de la animación
|
||||
void setCurrentFrame(Uint8 num);
|
||||
void setCurrentFrame(int num);
|
||||
|
||||
// Establece el valor del contador
|
||||
void setAnimationCounter(Uint16 num);
|
||||
|
||||
// Establece el rectangulo para un frame de una animación
|
||||
void setAnimationFrames(Uint8 index_animation, Uint8 index_frame, int x, int y, int w, int h);
|
||||
void setAnimationCounter(std::string name, int num);
|
||||
|
||||
// Establece la velocidad de una animación
|
||||
void setAnimationSpeed(Uint8 index, Uint8 speed);
|
||||
void setAnimationSpeed(std::string name, int speed);
|
||||
void setAnimationSpeed(int index, int speed);
|
||||
|
||||
// Establece el numero de frames de una animación
|
||||
void setAnimationNumFrames(Uint8 index, Uint8 num);
|
||||
|
||||
// Establece si la animación se reproduce en bucle
|
||||
void setAnimationLoop(Uint8 index, bool loop);
|
||||
// Establece el frame al que vuelve la animación al finalizar
|
||||
void setAnimationLoop(std::string name, int loop);
|
||||
void setAnimationLoop(int index, int loop);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setCompleted(Uint8 index, bool value);
|
||||
void setAnimationCompleted(std::string name, bool value);
|
||||
void setAnimationCompleted(int index, bool value);
|
||||
|
||||
// Comprueba si ha terminado la animación
|
||||
bool isCompleted(Uint8 index);
|
||||
bool animationIsCompleted();
|
||||
|
||||
// Devuelve el rectangulo de una animación y frame concreto
|
||||
SDL_Rect getAnimationClip(Uint8 index_animation, Uint8 index_frame);
|
||||
SDL_Rect getAnimationClip(std::string name, Uint8 index);
|
||||
|
||||
// Obtiene el indice de la animación a partir del nombre
|
||||
int getIndex(std::string name);
|
||||
|
||||
// Carga la animación desde un fichero
|
||||
bool load(std::string filePath);
|
||||
|
||||
// Establece la animacion actual
|
||||
void setCurrentAnimation(std::string name = "default");
|
||||
void setCurrentAnimation(int index = 0);
|
||||
|
||||
// Actualiza las variables del objeto
|
||||
void update();
|
||||
|
||||
// OLD - Establece el rectangulo para un frame de una animación
|
||||
void setAnimationFrames(Uint8 index_animation, Uint8 index_frame, int x, int y, int w, int h);
|
||||
|
||||
// OLD - Establece el contador para todas las animaciones
|
||||
void setAnimationCounter(int value);
|
||||
};
|
||||
|
||||
#endif
|
||||
160
source/asset.cpp
Normal file
@@ -0,0 +1,160 @@
|
||||
#include "asset.h"
|
||||
|
||||
// Constructor
|
||||
Asset::Asset(std::string path)
|
||||
{
|
||||
executablePath = path;
|
||||
longest_name = 0;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
Asset::~Asset()
|
||||
{
|
||||
}
|
||||
|
||||
// Añade un elemento a la lista
|
||||
void Asset::add(std::string file, enum assetType_e type, bool required)
|
||||
{
|
||||
item_t temp;
|
||||
temp.file = executablePath + file;
|
||||
temp.type = type;
|
||||
temp.required = required;
|
||||
fileList.push_back(temp);
|
||||
|
||||
const std::string filename = file.substr(file.find_last_of("\\/") + 1);
|
||||
longest_name = SDL_max(longest_name, filename.size());
|
||||
}
|
||||
|
||||
// Devuelve el fichero de un elemento de la lista a partir de una cadena
|
||||
std::string Asset::get(std::string text)
|
||||
{
|
||||
for (auto f : fileList)
|
||||
{
|
||||
if (f.file.find(text) != std::string::npos)
|
||||
{
|
||||
return f.file;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Warning: file %s not found\n", text.c_str());
|
||||
return "";
|
||||
}
|
||||
|
||||
// Comprueba que existen todos los elementos
|
||||
bool Asset::check()
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
printf("\n** Checking files.\n");
|
||||
|
||||
// Comprueba la lista de ficheros clasificandolos por tipo
|
||||
for (int type = 0; type < t_maxAssetType; ++type)
|
||||
{
|
||||
// Comprueba si hay ficheros de ese tipo
|
||||
bool any = false;
|
||||
|
||||
for (auto f : fileList)
|
||||
{
|
||||
if ((f.required) && (f.type == type))
|
||||
{
|
||||
any = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Si hay ficheros de ese tipo, comprueba si existen
|
||||
if (any)
|
||||
{
|
||||
printf("\n>> %s FILES\n", getTypeName(type).c_str());
|
||||
|
||||
for (auto f : fileList)
|
||||
{
|
||||
if ((f.required) && (f.type == type))
|
||||
{
|
||||
success &= checkFile(f.file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Resultado
|
||||
if (success)
|
||||
{
|
||||
printf("\n** All files OK.\n\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n** A file is missing. Exiting.\n\n");
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
// Comprueba que existe un fichero
|
||||
bool Asset::checkFile(std::string path)
|
||||
{
|
||||
bool success = false;
|
||||
std::string result = "ERROR";
|
||||
|
||||
// Comprueba si existe el fichero
|
||||
const std::string filename = path.substr(path.find_last_of("\\/") + 1);
|
||||
SDL_RWops *file = SDL_RWFromFile(path.c_str(), "r+b");
|
||||
|
||||
if (file != nullptr)
|
||||
{
|
||||
result = "OK";
|
||||
success = true;
|
||||
SDL_RWclose(file);
|
||||
}
|
||||
|
||||
const std::string s = "Checking file %-" + std::to_string(longest_name) + "s [" + result + "]\n";
|
||||
printf(s.c_str(), filename.c_str());
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
// Devuelve el nombre del tipo de recurso
|
||||
std::string Asset::getTypeName(int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case t_bitmap:
|
||||
return "BITMAP";
|
||||
break;
|
||||
|
||||
case t_music:
|
||||
return "MUSIC";
|
||||
break;
|
||||
|
||||
case t_sound:
|
||||
return "SOUND";
|
||||
break;
|
||||
|
||||
case t_font:
|
||||
return "FONT";
|
||||
break;
|
||||
|
||||
case t_lang:
|
||||
return "LANG";
|
||||
break;
|
||||
|
||||
case t_data:
|
||||
return "DATA";
|
||||
break;
|
||||
|
||||
case t_room:
|
||||
return "ROOM";
|
||||
break;
|
||||
|
||||
case t_enemy:
|
||||
return "ENEMY";
|
||||
break;
|
||||
|
||||
case t_item:
|
||||
return "ITEM";
|
||||
break;
|
||||
|
||||
default:
|
||||
return "ERROR";
|
||||
break;
|
||||
}
|
||||
}
|
||||
64
source/asset.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifndef ASSET_H
|
||||
#define ASSET_H
|
||||
|
||||
enum assetType_e
|
||||
{
|
||||
t_bitmap,
|
||||
t_music,
|
||||
t_sound,
|
||||
t_font,
|
||||
t_lang,
|
||||
t_data,
|
||||
t_room,
|
||||
t_enemy,
|
||||
t_item,
|
||||
t_maxAssetType
|
||||
};
|
||||
|
||||
// Clase Asset
|
||||
class Asset
|
||||
{
|
||||
private:
|
||||
// Estructura para definir un item
|
||||
struct item_t
|
||||
{
|
||||
std::string file; // Ruta del fichero desde la raiz del directorio
|
||||
enum assetType_e type; // Indica el tipo de recurso
|
||||
bool required; // Indica si es un fichero que debe de existir
|
||||
};
|
||||
|
||||
int longest_name; // Contiene la longitud del nombre de fichero mas largo
|
||||
|
||||
std::vector<item_t> fileList;
|
||||
std::string executablePath;
|
||||
|
||||
// Comprueba que existe un fichero
|
||||
bool checkFile(std::string path);
|
||||
|
||||
// Devuelve el nombre del tipo de recurso
|
||||
std::string getTypeName(int type);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Asset(std::string path);
|
||||
|
||||
// Destructor
|
||||
~Asset();
|
||||
|
||||
// Añade un elemento a la lista
|
||||
void add(std::string file, enum assetType_e type, bool required = true);
|
||||
|
||||
// Devuelve un elemento de la lista a partir de una cadena
|
||||
std::string get(std::string text);
|
||||
|
||||
// Comprueba que existen todos los elementos
|
||||
bool check();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -2,21 +2,11 @@
|
||||
#include "balloon.h"
|
||||
|
||||
// Constructor
|
||||
Balloon::Balloon()
|
||||
Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 creationtimer, LTexture *texture, SDL_Renderer *renderer)
|
||||
{
|
||||
mSprite = new AnimatedSprite();
|
||||
disable();
|
||||
}
|
||||
|
||||
// Destructor
|
||||
Balloon::~Balloon()
|
||||
{
|
||||
delete mSprite;
|
||||
}
|
||||
|
||||
// Inicializador
|
||||
void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16 creationtimer, LTexture *texture, SDL_Renderer *renderer)
|
||||
{
|
||||
const Uint8 NUM_FRAMES_BALLON = 10;
|
||||
const Uint8 NUM_FRAMES_BALLON_POP = 12;
|
||||
const Uint8 NUM_FRAMES_BALLON_BORN = 10;
|
||||
@@ -34,8 +24,10 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mEnabled = true;
|
||||
|
||||
// Alto y ancho del objeto
|
||||
mWidth = BALLOON_SIZE_1;
|
||||
mHeight = BALLOON_SIZE_1;
|
||||
mWidth = BALLOON_WIDTH_1;
|
||||
mHeight = BALLOON_WIDTH_1;
|
||||
mSize = BALLOON_SIZE_1;
|
||||
mPower = 1;
|
||||
|
||||
// Inicializa los valores de velocidad y gravedad
|
||||
mVelX = velx;
|
||||
@@ -45,20 +37,26 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mDefaultVelY = 2.6f;
|
||||
|
||||
// Puntos que da el globo al ser destruido
|
||||
mScore = 50;
|
||||
mScore = BALLOON_SCORE_1;
|
||||
|
||||
// Amenaza que genera el globo
|
||||
mMenace = 1;
|
||||
|
||||
// Establece los frames de cada animación
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
{
|
||||
mSprite->setAnimationFrames(BALLOON_MOVING_ANIMATION, i, 50 + OFFSET_ORANGE_BALLOONS, 21 + (37 * i), getWidth(), getHeight());
|
||||
}
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
{
|
||||
mSprite->setAnimationFrames(BALLOON_BORN_ANIMATION, i, 50 + OFFSET_BLUE_BALLOONS, 21 + (37 * i), getWidth(), getHeight());
|
||||
}
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
{
|
||||
mSprite->setAnimationFrames(BALLOON_POP_ANIMATION, i, 50 + OFFSET_EXPLOSIONS, 21 + (37 * i), getWidth(), getHeight());
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -66,8 +64,10 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mEnabled = true;
|
||||
|
||||
// Alto y ancho del objeto
|
||||
mWidth = BALLOON_SIZE_2;
|
||||
mHeight = BALLOON_SIZE_2;
|
||||
mWidth = BALLOON_WIDTH_2;
|
||||
mHeight = BALLOON_WIDTH_2;
|
||||
mSize = BALLOON_SIZE_2;
|
||||
mPower = 3;
|
||||
|
||||
// Inicializa los valores de velocidad y gravedad
|
||||
mVelX = velx;
|
||||
@@ -77,19 +77,19 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mDefaultVelY = 3.5f;
|
||||
|
||||
// Puntos que da el globo al ser destruido
|
||||
mScore = 100;
|
||||
mScore = BALLOON_SCORE_2;
|
||||
|
||||
// Amenaza que genera el globo
|
||||
mMenace = 2;
|
||||
|
||||
// Establece los frames de cada animación
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_MOVING_ANIMATION, i, 37 + OFFSET_ORANGE_BALLOONS, 21 + (37 * i), getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_BORN_ANIMATION, i, 37 + OFFSET_BLUE_BALLOONS, 21 + (37 * i), getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_POP_ANIMATION, i, 37 + OFFSET_EXPLOSIONS, 21 + (37 * i), getWidth(), getHeight());
|
||||
|
||||
break;
|
||||
@@ -98,8 +98,10 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mEnabled = true;
|
||||
|
||||
// Alto y ancho del objeto
|
||||
mWidth = BALLOON_SIZE_3;
|
||||
mHeight = BALLOON_SIZE_3;
|
||||
mWidth = BALLOON_WIDTH_3;
|
||||
mHeight = BALLOON_WIDTH_3;
|
||||
mSize = BALLOON_SIZE_3;
|
||||
mPower = 7;
|
||||
|
||||
// Inicializa los valores de velocidad y gravedad
|
||||
mVelX = velx;
|
||||
@@ -109,19 +111,19 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mDefaultVelY = 4.50f;
|
||||
|
||||
// Puntos que da el globo al ser destruido
|
||||
mScore = 200;
|
||||
mScore = BALLOON_SCORE_3;
|
||||
|
||||
// Amenaza que genera el globo
|
||||
mMenace = 4;
|
||||
|
||||
// Establece los frames de cada animación
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_MOVING_ANIMATION, i, 37 + OFFSET_ORANGE_BALLOONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_BORN_ANIMATION, i, 37 + OFFSET_BLUE_BALLOONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_POP_ANIMATION, i, 37 + OFFSET_EXPLOSIONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
break;
|
||||
@@ -130,8 +132,10 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mEnabled = true;
|
||||
|
||||
// Alto y ancho del objeto
|
||||
mWidth = BALLOON_SIZE_4;
|
||||
mHeight = BALLOON_SIZE_4;
|
||||
mWidth = BALLOON_WIDTH_4;
|
||||
mHeight = BALLOON_WIDTH_4;
|
||||
mSize = BALLOON_SIZE_4;
|
||||
mPower = 15;
|
||||
|
||||
// Inicializa los valores de velocidad y gravedad
|
||||
mVelX = velx;
|
||||
@@ -141,19 +145,19 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mDefaultVelY = 4.95f;
|
||||
|
||||
// Puntos que da el globo al ser destruido
|
||||
mScore = 400;
|
||||
mScore = BALLOON_SCORE_4;
|
||||
|
||||
// Amenaza que genera el globo
|
||||
mMenace = 8;
|
||||
|
||||
// Establece los frames de cada animación
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_MOVING_ANIMATION, i, OFFSET_ORANGE_BALLOONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_BORN_ANIMATION, i, OFFSET_BLUE_BALLOONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_POP_ANIMATION, i, OFFSET_EXPLOSIONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
break;
|
||||
@@ -162,8 +166,10 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mEnabled = true;
|
||||
|
||||
// Alto y ancho del objeto
|
||||
mWidth = BALLOON_SIZE_1;
|
||||
mHeight = BALLOON_SIZE_1;
|
||||
mWidth = BALLOON_WIDTH_1;
|
||||
mHeight = BALLOON_WIDTH_1;
|
||||
mSize = BALLOON_SIZE_1;
|
||||
mPower = 1;
|
||||
|
||||
// Inicializa los valores de velocidad y gravedad
|
||||
mVelX = velx;
|
||||
@@ -173,19 +179,19 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mDefaultVelY = abs(velx) * 2;
|
||||
|
||||
// Puntos que da el globo al ser destruido
|
||||
mScore = 50;
|
||||
mScore = BALLOON_SCORE_1;
|
||||
|
||||
// Amenaza que genera el globo
|
||||
mMenace = 1;
|
||||
|
||||
// Establece los frames de cada animación
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_MOVING_ANIMATION, i, 50 + OFFSET_GREEN_BALLOONS, 21 + (37 * i), getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_BORN_ANIMATION, i, 50 + OFFSET_PURPLE_BALLOONS, 21 + (37 * i), getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_POP_ANIMATION, i, 50 + OFFSET_EXPLOSIONS, 21 + (37 * i), getWidth(), getHeight());
|
||||
|
||||
break;
|
||||
@@ -194,8 +200,10 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mEnabled = true;
|
||||
|
||||
// Alto y ancho del objeto
|
||||
mWidth = BALLOON_SIZE_2;
|
||||
mHeight = BALLOON_SIZE_2;
|
||||
mWidth = BALLOON_WIDTH_2;
|
||||
mHeight = BALLOON_WIDTH_2;
|
||||
mSize = BALLOON_SIZE_2;
|
||||
mPower = 3;
|
||||
|
||||
// Inicializa los valores de velocidad y gravedad
|
||||
mVelX = velx;
|
||||
@@ -205,19 +213,19 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mDefaultVelY = abs(velx) * 2;
|
||||
|
||||
// Puntos que da el globo al ser destruido
|
||||
mScore = 100;
|
||||
mScore = BALLOON_SCORE_2;
|
||||
|
||||
// Amenaza que genera el globo
|
||||
mMenace = 2;
|
||||
|
||||
// Establece los frames de cada animación
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_MOVING_ANIMATION, i, 37 + OFFSET_GREEN_BALLOONS, 21 + (37 * i), getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_BORN_ANIMATION, i, 37 + OFFSET_PURPLE_BALLOONS, 21 + (37 * i), getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_POP_ANIMATION, i, 37 + OFFSET_EXPLOSIONS, 21 + (37 * i), getWidth(), getHeight());
|
||||
|
||||
break;
|
||||
@@ -226,8 +234,10 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mEnabled = true;
|
||||
|
||||
// Alto y ancho del objeto
|
||||
mWidth = BALLOON_SIZE_3;
|
||||
mHeight = BALLOON_SIZE_3;
|
||||
mWidth = BALLOON_WIDTH_3;
|
||||
mHeight = BALLOON_WIDTH_3;
|
||||
mSize = BALLOON_SIZE_3;
|
||||
mPower = 7;
|
||||
|
||||
// Inicializa los valores de velocidad y gravedad
|
||||
mVelX = velx;
|
||||
@@ -237,19 +247,19 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mDefaultVelY = abs(velx) * 2;
|
||||
|
||||
// Puntos que da el globo al ser destruido
|
||||
mScore = 200;
|
||||
mScore = BALLOON_SCORE_3;
|
||||
|
||||
// Amenaza que genera el globo
|
||||
mMenace = 4;
|
||||
|
||||
// Establece los frames de cada animación
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_MOVING_ANIMATION, i, 37 + OFFSET_GREEN_BALLOONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_BORN_ANIMATION, i, 37 + OFFSET_PURPLE_BALLOONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_POP_ANIMATION, i, 37 + OFFSET_EXPLOSIONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
break;
|
||||
@@ -258,8 +268,10 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mEnabled = true;
|
||||
|
||||
// Alto y ancho del objeto
|
||||
mWidth = BALLOON_SIZE_4;
|
||||
mHeight = BALLOON_SIZE_4;
|
||||
mWidth = BALLOON_WIDTH_4;
|
||||
mHeight = BALLOON_WIDTH_4;
|
||||
mSize = BALLOON_SIZE_4;
|
||||
mPower = 15;
|
||||
|
||||
// Inicializa los valores de velocidad y gravedad
|
||||
mVelX = velx;
|
||||
@@ -269,19 +281,19 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mDefaultVelY = abs(velx) * 2;
|
||||
|
||||
// Puntos que da el globo al ser destruido
|
||||
mScore = 400;
|
||||
mScore = BALLOON_SCORE_4;
|
||||
|
||||
// Amenaza que genera el globo
|
||||
mMenace = 8;
|
||||
|
||||
// Establece los frames de cada animación
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_MOVING_ANIMATION, i, OFFSET_GREEN_BALLOONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_BORN_ANIMATION, i, OFFSET_PURPLE_BALLOONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_POP_ANIMATION, i, OFFSET_EXPLOSIONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
break;
|
||||
@@ -290,8 +302,10 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mEnabled = true;
|
||||
|
||||
// Alto y ancho del objeto
|
||||
mWidth = BALLOON_SIZE_4;
|
||||
mHeight = BALLOON_SIZE_4;
|
||||
mWidth = BALLOON_WIDTH_4;
|
||||
mHeight = BALLOON_WIDTH_4;
|
||||
mSize = 4;
|
||||
mPower = 0;
|
||||
|
||||
// Inicializa los valores de velocidad y gravedad
|
||||
mVelX = velx;
|
||||
@@ -307,15 +321,19 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mMenace = 0;
|
||||
|
||||
// Establece los frames de cada animación
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_MOVING_ANIMATION, i, OFFSET_POWER_BALL, 37 * i, getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_BORN_ANIMATION, i, OFFSET_BLUE_BALLOONS, 37 * i, getWidth(), getHeight());
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_BORN; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_BORN_ANIMATION, i, OFFSET_POWER_BALL, 37 * i, getWidth(), getHeight());
|
||||
|
||||
for (Uint8 i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
for (int i = 0; i < NUM_FRAMES_BALLON_POP; i++)
|
||||
mSprite->setAnimationFrames(BALLOON_POP_ANIMATION, i, OFFSET_EXPLOSIONS, 37 * i, getWidth(), getHeight());
|
||||
|
||||
// Añade rotación al sprite
|
||||
mSprite->setRotate(false);
|
||||
mSprite->setRotateSpeed(1);
|
||||
mSprite->setRotateAmount(2.0);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -328,13 +346,16 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mPosX = x;
|
||||
mPosY = y;
|
||||
|
||||
mBouncing.enabled = false; // Si el efecto está activo
|
||||
mBouncing.counter = 0; // Countador para el efecto
|
||||
mBouncing.speed = 0; // Velocidad a la que transcurre el efecto
|
||||
mBouncing.zoomW = 1.0f; // Zoom aplicado a la anchura
|
||||
mBouncing.zoomH = 1.0f; // Zoom aplicado a la altura
|
||||
mBouncing.despX = 0.0f; // Desplazamiento de pixeles en el eje X antes de pintar el objeto con zoom
|
||||
// Valores para el efecto de rebote
|
||||
mBouncing.enabled = false;
|
||||
mBouncing.counter = 0;
|
||||
mBouncing.speed = 0;
|
||||
mBouncing.zoomW = 1.0f;
|
||||
mBouncing.zoomH = 1.0f;
|
||||
mBouncing.despX = 0.0f;
|
||||
mBouncing.despY = 0.0f;
|
||||
mBouncing.w = {1.10f, 1.05f, 1.00f, 0.95f, 0.90f, 0.95f, 1.00f, 1.02f, 1.05f, 1.02f};
|
||||
mBouncing.h = {0.90f, 0.95f, 1.00f, 1.05f, 1.10f, 1.05f, 1.00f, 0.98f, 0.95f, 0.98f};
|
||||
|
||||
// Textura con los gráficos del sprite
|
||||
mSprite->setTexture(texture);
|
||||
@@ -381,13 +402,13 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mKind = kind;
|
||||
|
||||
// Inicializa las variables para la animación
|
||||
mSprite->setCurrentFrame(0);
|
||||
mSprite->setAnimationCounter(0);
|
||||
// mSprite->setCurrentFrame(0);
|
||||
// mSprite->setAnimationCounter(0);
|
||||
|
||||
// Establece el numero de frames de cada animacion
|
||||
mSprite->setAnimationNumFrames(BALLOON_MOVING_ANIMATION, NUM_FRAMES_BALLON);
|
||||
mSprite->setAnimationNumFrames(BALLOON_POP_ANIMATION, NUM_FRAMES_BALLON_POP);
|
||||
mSprite->setAnimationNumFrames(BALLOON_BORN_ANIMATION, NUM_FRAMES_BALLON_BORN);
|
||||
// mSprite->setAnimationNumFrames(BALLOON_MOVING_ANIMATION, NUM_FRAMES_BALLON);
|
||||
// mSprite->setAnimationNumFrames(BALLOON_POP_ANIMATION, NUM_FRAMES_BALLON_POP);
|
||||
// mSprite->setAnimationNumFrames(BALLOON_BORN_ANIMATION, NUM_FRAMES_BALLON_BORN);
|
||||
|
||||
// Establece la velocidad de cada animación
|
||||
mSprite->setAnimationSpeed(BALLOON_MOVING_ANIMATION, 10);
|
||||
@@ -403,19 +424,22 @@ void Balloon::init(float x, float y, Uint8 kind, float velx, float speed, Uint16
|
||||
mSprite->setSpriteClip(mSprite->getAnimationClip(0, 0));
|
||||
}
|
||||
|
||||
// Destructor
|
||||
Balloon::~Balloon()
|
||||
{
|
||||
delete mSprite;
|
||||
mSprite = nullptr;
|
||||
}
|
||||
|
||||
// Centra el globo en la posición X
|
||||
void Balloon::allignTo(int x)
|
||||
{
|
||||
mPosX = float(x - (mWidth / 2));
|
||||
|
||||
if (mPosX < PLAY_AREA_LEFT)
|
||||
{
|
||||
mPosX = PLAY_AREA_LEFT + 1;
|
||||
}
|
||||
else if ((mPosX + mWidth) > PLAY_AREA_RIGHT)
|
||||
{
|
||||
mPosX = float(PLAY_AREA_RIGHT - mWidth - 1);
|
||||
}
|
||||
|
||||
// Posición X,Y del sprite
|
||||
mSprite->setPosX(getPosX());
|
||||
@@ -471,6 +495,9 @@ void Balloon::move()
|
||||
// Invierte sentido
|
||||
mVelX = -mVelX;
|
||||
|
||||
// Invierte la rotación
|
||||
mSprite->switchRotate();
|
||||
|
||||
// Activa el efecto de rebote
|
||||
bounceStart();
|
||||
}
|
||||
@@ -505,10 +532,12 @@ void Balloon::move()
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Para aplicar la gravedad, el diseño original la aplicaba en cada iteración del bucle
|
||||
Al añadir el modificador de velocidad se reduce la distancia que recorre el objeto y por
|
||||
tanto recibe mas gravedad. Para solucionarlo se va a aplicar la gravedad cuando se haya
|
||||
recorrido una distancia igual a la velocidad en Y, que era el cálculo inicial
|
||||
|
||||
*/
|
||||
|
||||
// Incrementa la variable que calcula la distancia acumulada en Y
|
||||
@@ -524,11 +553,6 @@ void Balloon::move()
|
||||
mVelY += mGravity;
|
||||
std::min(mVelY, mMaxVelY);
|
||||
}
|
||||
// Aplica la gravedad al objeto
|
||||
//if (mVelY > mMaxVelY)
|
||||
// mVelY = mMaxVelY;
|
||||
//else if (mCounter % 1 == 0)
|
||||
// mVelY += mGravity;
|
||||
|
||||
// Actualiza la posición del sprite
|
||||
mSprite->setPosX(getPosX());
|
||||
@@ -539,33 +563,38 @@ void Balloon::move()
|
||||
// Deshabilita el globo y pone a cero todos los valores
|
||||
void Balloon::disable()
|
||||
{
|
||||
mEnabled = false;
|
||||
|
||||
mPosX = 0.0f;
|
||||
mPosY = 0.0f;
|
||||
mWidth = 0;
|
||||
mHeight = 0;
|
||||
mVelX = 0.0f;
|
||||
mVelY = 0.0f;
|
||||
mGravity = 0.0f;
|
||||
mDefaultVelY = 0.0f;
|
||||
mMaxVelY = 0.0f;
|
||||
mBeingCreated = false;
|
||||
mBlinking = false;
|
||||
mInvulnerable = false;
|
||||
mPopping = false;
|
||||
mStopped = false;
|
||||
mVisible = false;
|
||||
mCollider.r = 0;
|
||||
mCollider.x = 0;
|
||||
mCollider.y = 0;
|
||||
mCollider.r = 0;
|
||||
mCounter = 0;
|
||||
mCreationCounter = 0;
|
||||
mCreationCounterIni = 0;
|
||||
mDefaultVelY = 0.0f;
|
||||
mEnabled = false;
|
||||
mGravity = 0.0f;
|
||||
mHeight = 0;
|
||||
mInvulnerable = false;
|
||||
mKind = 0;
|
||||
mMaxVelY = 0.0f;
|
||||
mMenace = 0;
|
||||
mPopping = false;
|
||||
mPosX = 0.0f;
|
||||
mPosY = 0.0f;
|
||||
mPower = 0;
|
||||
mScore = 0;
|
||||
mSize = 0;
|
||||
mSpeed = 0;
|
||||
mStopped = false;
|
||||
mStoppedCounter = 0;
|
||||
mTimeToLive = 0;
|
||||
mKind = 0;
|
||||
mMenace = 0;
|
||||
mTravelY = 0;
|
||||
mVelX = 0.0f;
|
||||
mVelY = 0.0f;
|
||||
mVisible = false;
|
||||
mWidth = 0;
|
||||
mSprite->clear();
|
||||
}
|
||||
|
||||
// Explosiona el globo
|
||||
@@ -573,6 +602,7 @@ void Balloon::pop()
|
||||
{
|
||||
setPopping(true);
|
||||
mSprite->setAnimationCounter(0);
|
||||
mSprite->disableRotate();
|
||||
setTimeToLive(120);
|
||||
setStop(true);
|
||||
setStoppedTimer(2000);
|
||||
@@ -585,6 +615,7 @@ void Balloon::update()
|
||||
{
|
||||
if (mEnabled)
|
||||
{
|
||||
mSprite->MovingSprite::update();
|
||||
move();
|
||||
updateAnimation();
|
||||
updateColliders();
|
||||
@@ -602,9 +633,9 @@ void Balloon::updateState()
|
||||
{
|
||||
setInvulnerable(true);
|
||||
setStop(true);
|
||||
if (mSprite->isCompleted(BALLOON_POP_ANIMATION))
|
||||
if (mSprite->animationIsCompleted())
|
||||
{
|
||||
mSprite->setCompleted(BALLOON_POP_ANIMATION, false);
|
||||
mSprite->setAnimationCompleted(BALLOON_POP_ANIMATION, false);
|
||||
mTimeToLive = 0;
|
||||
disable();
|
||||
}
|
||||
@@ -646,12 +677,6 @@ void Balloon::updateState()
|
||||
updateColliders();
|
||||
}
|
||||
|
||||
// Hace visible el globo de forma intermitente
|
||||
//if (mCreationCounter > 100)
|
||||
// setVisible(mCreationCounter / 10 % 2 == 0);
|
||||
//else
|
||||
// setVisible(mCreationCounter / 5 % 2 == 0);
|
||||
|
||||
mCreationCounter--;
|
||||
}
|
||||
// El contador ha llegado a cero
|
||||
@@ -661,6 +686,14 @@ void Balloon::updateState()
|
||||
setStop(false);
|
||||
setVisible(true);
|
||||
setInvulnerable(false);
|
||||
if (mKind == POWER_BALL)
|
||||
{
|
||||
mSprite->setRotate(true);
|
||||
if (mVelX > 0.0f)
|
||||
mSprite->setRotateAmount(2.0);
|
||||
else
|
||||
mSprite->setRotateAmount(-2.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Solo comprueba el estado detenido cuando no se está creando
|
||||
@@ -668,10 +701,14 @@ void Balloon::updateState()
|
||||
{
|
||||
// Si está detenido, reduce el contador
|
||||
if (mStoppedCounter > 0)
|
||||
{
|
||||
mStoppedCounter--;
|
||||
}
|
||||
// Si el contador ha llegado a cero, ya no está detenido
|
||||
else if (!isPopping()) // Quitarles el estado "detenido" si no estan explosionandoxq
|
||||
else if (!isPopping())
|
||||
{ // Quitarles el estado "detenido" si no estan explosionando
|
||||
setStop(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -680,11 +717,19 @@ void Balloon::updateAnimation()
|
||||
{
|
||||
// Establece el frame de animación
|
||||
if (isPopping())
|
||||
mSprite->animate(BALLOON_POP_ANIMATION);
|
||||
{
|
||||
mSprite->setCurrentAnimation(BALLOON_POP_ANIMATION);
|
||||
}
|
||||
else if (isBeingCreated())
|
||||
mSprite->animate(BALLOON_BORN_ANIMATION);
|
||||
{
|
||||
mSprite->setCurrentAnimation(BALLOON_BORN_ANIMATION);
|
||||
}
|
||||
else
|
||||
mSprite->animate(BALLOON_MOVING_ANIMATION);
|
||||
{
|
||||
mSprite->setCurrentAnimation(BALLOON_MOVING_ANIMATION);
|
||||
}
|
||||
|
||||
mSprite->animate();
|
||||
}
|
||||
|
||||
// Comprueba si el globo está habilitado
|
||||
@@ -741,6 +786,12 @@ int Balloon::getKind()
|
||||
return mKind;
|
||||
}
|
||||
|
||||
// Obtiene del valor de la variable
|
||||
Uint8 Balloon::getSize()
|
||||
{
|
||||
return mSize;
|
||||
}
|
||||
|
||||
// Obtiene la clase a la que pertenece el globo
|
||||
Uint8 Balloon::getClass()
|
||||
{
|
||||
@@ -863,7 +914,6 @@ circle_t &Balloon::getCollider()
|
||||
// Alinea el circulo de colisión con la posición del objeto globo
|
||||
void Balloon::updateColliders()
|
||||
{
|
||||
// Align collider to center of balloon
|
||||
mCollider.x = Uint16(mPosX + mCollider.r);
|
||||
mCollider.y = mPosY + mCollider.r;
|
||||
}
|
||||
@@ -877,6 +927,12 @@ Uint8 Balloon::getMenace()
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Obtiene le valor de la variable
|
||||
Uint8 Balloon::getPower()
|
||||
{
|
||||
return mPower;
|
||||
}
|
||||
|
||||
void Balloon::bounceStart()
|
||||
{
|
||||
mBouncing.enabled = true;
|
||||
@@ -887,6 +943,7 @@ void Balloon::bounceStart()
|
||||
mBouncing.despX = 0;
|
||||
mBouncing.despY = 0;
|
||||
}
|
||||
|
||||
void Balloon::bounceStop()
|
||||
{
|
||||
mBouncing.enabled = false;
|
||||
@@ -898,6 +955,7 @@ void Balloon::bounceStop()
|
||||
mBouncing.despX = 0.0f;
|
||||
mBouncing.despY = 0.0f;
|
||||
}
|
||||
|
||||
void Balloon::updateBounce()
|
||||
{
|
||||
if (mBouncing.enabled)
|
||||
|
||||
137
source/balloon.h
@@ -1,16 +1,90 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "utils.h"
|
||||
#include "animatedsprite.h"
|
||||
#include <vector>
|
||||
|
||||
#ifndef BALLOON_H
|
||||
#define BALLOON_H
|
||||
|
||||
// Cantidad de elementos del vector con los valores de la deformación del globo al rebotar
|
||||
#define MAX_BOUNCE 10
|
||||
|
||||
// Clase globo
|
||||
// Tipos de globo
|
||||
#define BALLOON_1 1
|
||||
#define BALLOON_2 2
|
||||
#define BALLOON_3 3
|
||||
#define BALLOON_4 4
|
||||
#define HEXAGON_1 5
|
||||
#define HEXAGON_2 6
|
||||
#define HEXAGON_3 7
|
||||
#define HEXAGON_4 8
|
||||
#define POWER_BALL 9
|
||||
|
||||
// Puntos de globo
|
||||
#define BALLOON_SCORE_1 50
|
||||
#define BALLOON_SCORE_2 100
|
||||
#define BALLOON_SCORE_3 200
|
||||
#define BALLOON_SCORE_4 400
|
||||
|
||||
// Tamaños de globo
|
||||
#define BALLOON_SIZE_1 1
|
||||
#define BALLOON_SIZE_2 2
|
||||
#define BALLOON_SIZE_3 3
|
||||
#define BALLOON_SIZE_4 4
|
||||
|
||||
// Clases de globo
|
||||
#define BALLOON_CLASS 0
|
||||
#define HEXAGON_CLASS 1
|
||||
|
||||
// Velocidad del globo
|
||||
#define BALLOON_VELX_POSITIVE 0.7f
|
||||
#define BALLOON_VELX_NEGATIVE -0.7f
|
||||
|
||||
// Indice para las animaciones de los globos
|
||||
#define BALLOON_MOVING_ANIMATION 0
|
||||
#define BALLOON_POP_ANIMATION 1
|
||||
#define BALLOON_BORN_ANIMATION 2
|
||||
|
||||
// Cantidad posible de globos
|
||||
#define MAX_BALLOONS 100
|
||||
|
||||
// Velocidades a las que se mueven los globos
|
||||
#define BALLOON_SPEED_1 0.60f
|
||||
#define BALLOON_SPEED_2 0.70f
|
||||
#define BALLOON_SPEED_3 0.80f
|
||||
#define BALLOON_SPEED_4 0.90f
|
||||
#define BALLOON_SPEED_5 1.00f
|
||||
|
||||
// Tamaño de los globos
|
||||
#define BALLOON_WIDTH_1 8
|
||||
#define BALLOON_WIDTH_2 13
|
||||
#define BALLOON_WIDTH_3 21
|
||||
#define BALLOON_WIDTH_4 37
|
||||
|
||||
// PowerBall
|
||||
#define POWERBALL_SCREENPOWER_MINIMUM 10
|
||||
#define POWERBALL_COUNTER 8
|
||||
|
||||
// Clase Balloon
|
||||
class Balloon
|
||||
{
|
||||
private:
|
||||
// Estructura para las variables para el efecto de los rebotes
|
||||
struct bouncing
|
||||
{
|
||||
bool enabled; // Si el efecto está activo
|
||||
Uint8 counter; // Countador para el efecto
|
||||
Uint8 speed; // Velocidad a la que transcurre el efecto
|
||||
float zoomW; // Zoom aplicado a la anchura
|
||||
float zoomH; // Zoom aplicado a la altura
|
||||
float despX; // Desplazamiento de pixeles en el eje X antes de pintar el objeto con zoom
|
||||
float despY; // Desplazamiento de pixeles en el eje Y antes de pintar el objeto con zoom
|
||||
std::vector<float> w; // Vector con los valores de zoom para el ancho del globo
|
||||
std::vector<float> h; // Vector con los valores de zoom para el alto del globo
|
||||
};
|
||||
|
||||
float mPosX; // Posición en el eje X
|
||||
float mPosY; // Posición en el eje Y
|
||||
Uint8 mWidth; // Ancho
|
||||
@@ -39,43 +113,44 @@ private:
|
||||
Uint32 mCounter; // Contador interno
|
||||
float mTravelY; // Distancia que ha de recorrer el globo en el eje Y antes de que se le aplique la gravedad
|
||||
float mSpeed; // Velocidad a la que se mueven los globos
|
||||
Uint8 mSize; // Tamaño del globo
|
||||
Uint8 mPower; // Cantidad de poder que alberga el globo
|
||||
bouncing mBouncing; // Contiene las variables para el efecto de rebote
|
||||
|
||||
struct bouncing // Estructura para las variables para el efecto de los rebotes
|
||||
{
|
||||
bool enabled; // Si el efecto está activo
|
||||
Uint8 counter; // Countador para el efecto
|
||||
Uint8 speed; // Velocidad a la que transcurre el efecto
|
||||
float zoomW; // Zoom aplicado a la anchura
|
||||
float zoomH; // Zoom aplicado a la altura
|
||||
float despX; // Desplazamiento de pixeles en el eje X antes de pintar el objeto con zoom
|
||||
float despY; // idem
|
||||
// Alinea el circulo de colisión con la posición del objeto globo
|
||||
void updateColliders();
|
||||
|
||||
// Vector con los valores de zoom para el ancho y alto del globo
|
||||
float w[MAX_BOUNCE] = {1.10f, 1.05f, 1.00f, 0.95f, 0.90f, 0.95f, 1.00f, 1.02f, 1.05f, 1.02f};
|
||||
float h[MAX_BOUNCE] = {0.90f, 0.95f, 1.00f, 1.05f, 1.10f, 1.05f, 1.00f, 0.98f, 0.95f, 0.98f};
|
||||
};
|
||||
bouncing mBouncing;
|
||||
// Activa el efecto
|
||||
void bounceStart();
|
||||
|
||||
void updateColliders(); // Alinea el circulo de colisión con la posición del objeto globo
|
||||
void bounceStart(); // Activa el efecto
|
||||
void bounceStop(); // Detiene el efecto
|
||||
void updateBounce(); // Aplica el efecto
|
||||
void updateState(); // Actualiza los estados del globo
|
||||
void updateAnimation(); // Establece la animación correspondiente
|
||||
void setBeingCreated(bool state); // Establece el valor de la variable
|
||||
void setTimeToLive(Uint16 time); // Establece el valor de la variable
|
||||
Uint16 getTimeToLive(); // Obtiene del valor de la variable
|
||||
// Detiene el efecto
|
||||
void bounceStop();
|
||||
|
||||
// Aplica el efecto
|
||||
void updateBounce();
|
||||
|
||||
// Actualiza los estados del globo
|
||||
void updateState();
|
||||
|
||||
// Establece la animación correspondiente
|
||||
void updateAnimation();
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setBeingCreated(bool state);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setTimeToLive(Uint16 time);
|
||||
|
||||
// Obtiene del valor de la variable
|
||||
Uint16 getTimeToLive();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Balloon();
|
||||
Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 creationtimer, LTexture *texture, SDL_Renderer *renderer);
|
||||
|
||||
// Destructor
|
||||
~Balloon();
|
||||
|
||||
// Inicializador
|
||||
void init(float x, float y, Uint8 kind, float velx, float speed, Uint16 creationtimer, LTexture *texture, SDL_Renderer *renderer);
|
||||
|
||||
// Centra el globo en la posición X
|
||||
void allignTo(int x);
|
||||
|
||||
@@ -121,6 +196,9 @@ public:
|
||||
// Obtiene del valor de la variable
|
||||
int getKind();
|
||||
|
||||
// Obtiene del valor de la variable
|
||||
Uint8 getSize();
|
||||
|
||||
// Obtiene la clase a la que pertenece el globo
|
||||
Uint8 getClass();
|
||||
|
||||
@@ -171,6 +249,9 @@ public:
|
||||
|
||||
// Obtiene le valor de la variable
|
||||
Uint8 getMenace();
|
||||
|
||||
// Obtiene le valor de la variable
|
||||
Uint8 getPower();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,18 +5,18 @@
|
||||
Bullet::Bullet()
|
||||
{
|
||||
mSprite = new Sprite();
|
||||
init(0, 0, NO_KIND, nullptr, nullptr);
|
||||
mKind = NO_KIND;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
Bullet::~Bullet()
|
||||
{
|
||||
init(0, 0, NO_KIND, nullptr, nullptr);
|
||||
delete mSprite;
|
||||
mSprite = nullptr;
|
||||
}
|
||||
|
||||
// Iniciador
|
||||
void Bullet::init(int x, int y, int kind, LTexture *texture, SDL_Renderer *renderer)
|
||||
void Bullet::init(int x, int y, int kind, bool poweredUp, int owner, LTexture *texture, SDL_Renderer *renderer)
|
||||
{
|
||||
// Posición inicial del objeto
|
||||
mPosX = x;
|
||||
@@ -32,6 +32,9 @@ void Bullet::init(int x, int y, int kind, LTexture *texture, SDL_Renderer *rende
|
||||
// Tipo de bala
|
||||
mKind = kind;
|
||||
|
||||
// Identificador del dueño del objeto
|
||||
mOwner = owner;
|
||||
|
||||
// Textura con los gráficos del objeto
|
||||
mSprite->setTexture(texture);
|
||||
|
||||
@@ -54,7 +57,10 @@ void Bullet::init(int x, int y, int kind, LTexture *texture, SDL_Renderer *rende
|
||||
mVelX = 0;
|
||||
|
||||
// Rectangulo con los gráficos del objeto
|
||||
mSprite->setSpriteClip(0 * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
||||
if (!poweredUp)
|
||||
mSprite->setSpriteClip(0 * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
||||
else
|
||||
mSprite->setSpriteClip((0 + 3) * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
||||
break;
|
||||
|
||||
case BULLET_LEFT:
|
||||
@@ -62,7 +68,10 @@ void Bullet::init(int x, int y, int kind, LTexture *texture, SDL_Renderer *rende
|
||||
mVelX = -2;
|
||||
|
||||
// Rectangulo con los gráficos del objeto
|
||||
mSprite->setSpriteClip(1 * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
||||
if (!poweredUp)
|
||||
mSprite->setSpriteClip(1 * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
||||
else
|
||||
mSprite->setSpriteClip((1 + 3) * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
||||
break;
|
||||
|
||||
case BULLET_RIGHT:
|
||||
@@ -70,7 +79,10 @@ void Bullet::init(int x, int y, int kind, LTexture *texture, SDL_Renderer *rende
|
||||
mVelX = 2;
|
||||
|
||||
// Rectangulo con los gráficos del objeto
|
||||
mSprite->setSpriteClip(2 * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
||||
if (!poweredUp)
|
||||
mSprite->setSpriteClip(2 * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
||||
else
|
||||
mSprite->setSpriteClip((2 + 3) * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -94,7 +106,7 @@ void Bullet::render()
|
||||
Uint8 Bullet::move()
|
||||
{
|
||||
// Variable con el valor de retorno
|
||||
Uint8 msg = MSG_OK;
|
||||
Uint8 msg = BULLET_MOVE_OK;
|
||||
|
||||
// Mueve el objeto a su nueva posición
|
||||
mPosX += mVelX;
|
||||
@@ -106,7 +118,7 @@ Uint8 Bullet::move()
|
||||
mKind = NO_KIND;
|
||||
|
||||
// Mensaje de salida
|
||||
msg = MSG_BULLET_OUT;
|
||||
msg = BULLET_MOVE_OUT;
|
||||
}
|
||||
|
||||
// Mueve el objeto a su nueva posición en vertical
|
||||
@@ -119,7 +131,7 @@ Uint8 Bullet::move()
|
||||
mKind = NO_KIND;
|
||||
|
||||
// Mensaje de salida
|
||||
msg = MSG_BULLET_OUT;
|
||||
msg = BULLET_MOVE_OUT;
|
||||
}
|
||||
|
||||
// Actualiza la posición del sprite
|
||||
@@ -132,35 +144,19 @@ Uint8 Bullet::move()
|
||||
return msg;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
void Bullet::testMove()
|
||||
{
|
||||
// Update sprite position
|
||||
mSprite->setPosX(mPosX);
|
||||
mSprite->setPosY(mPosY);
|
||||
|
||||
// Update circle colliders
|
||||
shiftColliders();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Deshabilita el objeto
|
||||
void Bullet::erase()
|
||||
{
|
||||
init(0, 0, 0, nullptr, nullptr);
|
||||
init(0, 0, 0, false, -1, nullptr, nullptr);
|
||||
}
|
||||
|
||||
// Comprueba si el objeto está activo
|
||||
bool Bullet::isActive()
|
||||
{
|
||||
if (mKind == NO_KIND)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
@@ -199,6 +195,12 @@ int Bullet::getKind()
|
||||
return mKind;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
int Bullet::getOwner()
|
||||
{
|
||||
return mOwner;
|
||||
}
|
||||
|
||||
// Obtiene el circulo de colisión
|
||||
circle_t &Bullet::getCollider()
|
||||
{
|
||||
|
||||
@@ -1,13 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "utils.h"
|
||||
#include "sprite.h"
|
||||
|
||||
#ifndef BULLET_H
|
||||
#define BULLET_H
|
||||
|
||||
// Clase bala
|
||||
// Tipos de bala
|
||||
#define BULLET_UP 1
|
||||
#define BULLET_LEFT 2
|
||||
#define BULLET_RIGHT 3
|
||||
|
||||
// Tipos de retorno de la funcion move de la bala
|
||||
#define BULLET_MOVE_OK 0
|
||||
#define BULLET_MOVE_OUT 1
|
||||
|
||||
// Clase Bullet
|
||||
class Bullet
|
||||
{
|
||||
private:
|
||||
int mPosX; // Posición en el eje X
|
||||
int mPosY; // Posición en el eje Y
|
||||
Uint8 mWidth; // Ancho del objeto
|
||||
Uint8 mHeight; // Alto del objeto
|
||||
int mVelX; // Velocidad en el eje X
|
||||
int mVelY; // Velocidad en el eje Y
|
||||
int mKind; // Tipo de objeto
|
||||
int mOwner; // Identificador del dueño del objeto
|
||||
Sprite *mSprite; // Sprite con los graficos y métodos de pintado
|
||||
circle_t mCollider; // Circulo de colisión del objeto
|
||||
|
||||
// Alinea el circulo de colisión con el objeto
|
||||
void shiftColliders();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Bullet();
|
||||
@@ -16,11 +42,11 @@ public:
|
||||
~Bullet();
|
||||
|
||||
// Iniciador
|
||||
void init(int x, int y, int kind, LTexture* texture, SDL_Renderer *renderer);
|
||||
|
||||
void init(int x, int y, int kind, bool poweredUp, int owner, LTexture *texture, SDL_Renderer *renderer);
|
||||
|
||||
// Pinta el objeto en pantalla
|
||||
void render();
|
||||
|
||||
|
||||
// Actualiza la posición y estado del objeto
|
||||
Uint8 move();
|
||||
|
||||
@@ -48,33 +74,11 @@ public:
|
||||
// Obtiene el valor de la variable
|
||||
int getKind();
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
int getOwner();
|
||||
|
||||
// Obtiene el circulo de colisión
|
||||
circle_t &getCollider();
|
||||
|
||||
private:
|
||||
// Posición X/Y del objeto
|
||||
int mPosX;
|
||||
int mPosY;
|
||||
|
||||
// Alto y ancho el objeto
|
||||
Uint8 mWidth;
|
||||
Uint8 mHeight;
|
||||
|
||||
// Velocidad del objeto
|
||||
int mVelX;
|
||||
int mVelY;
|
||||
|
||||
// Tipo de objeto
|
||||
int mKind;
|
||||
|
||||
// Sprite con los graficos y métodos de pintado
|
||||
Sprite *mSprite;
|
||||
|
||||
// Balloon's collision circle
|
||||
circle_t mCollider;
|
||||
|
||||
// Alinea el circulo de colisión con el objeto
|
||||
void shiftColliders();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "sprite.h"
|
||||
|
||||
#ifndef COFFEEDROP_H
|
||||
|
||||
292
source/const.h
@@ -1,87 +1,25 @@
|
||||
#pragma once
|
||||
#include "ifdefs.h"
|
||||
#include <string>
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "utils.h"
|
||||
#include "lang.h"
|
||||
|
||||
#ifndef CONST_H
|
||||
#define CONST_H
|
||||
|
||||
// Textos
|
||||
#define WINDOW_CAPTION "Coffee Crisis"
|
||||
#define TEXT_COPYRIGHT "@2020,2021 JAILDESIGNER (V1.4)"
|
||||
|
||||
// Recursos
|
||||
#define BINFILE_SCORE 0
|
||||
#define BINFILE_DEMO 1
|
||||
#define BINFILE_CONFIG 2
|
||||
|
||||
#define TOTAL_BINFILE 3
|
||||
|
||||
#define MUSIC_INTRO 0
|
||||
#define MUSIC_PLAYING 1
|
||||
#define MUSIC_TITLE 2
|
||||
|
||||
#define TOTAL_MUSIC 3
|
||||
|
||||
#define SOUND_BALLOON 0
|
||||
#define SOUND_BUBBLE1 1
|
||||
#define SOUND_BUBBLE2 2
|
||||
#define SOUND_BUBBLE3 3
|
||||
#define SOUND_BUBBLE4 4
|
||||
#define SOUND_BULLET 5
|
||||
#define SOUND_COFFEE_OUT 6
|
||||
#define SOUND_HISCORE 7
|
||||
#define SOUND_ITEM_DROP 8
|
||||
#define SOUND_ITEM_PICKUP 9
|
||||
#define SOUND_MENU_CANCEL 10
|
||||
#define SOUND_MENU_MOVE 11
|
||||
#define SOUND_MENU_SELECT 12
|
||||
#define SOUND_PLAYER_COLLISION 13
|
||||
#define SOUND_STAGE_CHANGE 14
|
||||
#define SOUND_TITLE 15
|
||||
|
||||
#define TOTAL_SOUND 16
|
||||
|
||||
#define TEXTURE_BALLOON 0
|
||||
#define TEXTURE_BULLET 1
|
||||
#define TEXTURE_FONT_BLACK 2
|
||||
#define TEXTURE_FONT_BLACK_X2 3
|
||||
#define TEXTURE_FONT_NOKIA 4
|
||||
#define TEXTURE_FONT_WHITE 5
|
||||
#define TEXTURE_FONT_WHITE_X2 6
|
||||
#define TEXTURE_GAME_BG 7
|
||||
#define TEXTURE_GAME_TEXT 8
|
||||
#define TEXTURE_INTRO 9
|
||||
#define TEXTURE_ITEMS 10
|
||||
#define TEXTURE_LOGO 11
|
||||
#define TEXTURE_MENU 12
|
||||
#define TEXTURE_PLAYER_BODY 13
|
||||
#define TEXTURE_PLAYER_DEATH 14
|
||||
#define TEXTURE_PLAYER_LEGS 15
|
||||
#define TEXTURE_TITLE 16
|
||||
|
||||
#define TOTAL_TEXTURE 17
|
||||
|
||||
// Tamaño de bloque
|
||||
#define BLOCK 8
|
||||
#define HALF_BLOCK BLOCK / 2
|
||||
|
||||
// Tamaño de la pantalla real
|
||||
#define SCREEN_WIDTH 256
|
||||
const int SCREEN_HEIGHT = SCREEN_WIDTH * 3 / 4;
|
||||
|
||||
// Tamaño de la pantalla que se muestra
|
||||
const int VIEW_WIDTH = SCREEN_WIDTH * 3;
|
||||
const int VIEW_HEIGHT = SCREEN_HEIGHT * 3;
|
||||
|
||||
// Cantidad de enteros a escribir en los ficheros de datos
|
||||
#define TOTAL_SCORE_DATA 3
|
||||
#define TOTAL_DEMO_DATA 2000
|
||||
// Tamaño de la pantalla de juego
|
||||
#define GAME_WIDTH 256
|
||||
#define GAME_HEIGHT 192
|
||||
|
||||
// Zona de juego
|
||||
const int PLAY_AREA_TOP = (0 * BLOCK);
|
||||
const int PLAY_AREA_BOTTOM = SCREEN_HEIGHT - (4 * BLOCK);
|
||||
const int PLAY_AREA_BOTTOM = GAME_HEIGHT - (4 * BLOCK);
|
||||
const int PLAY_AREA_LEFT = (0 * BLOCK);
|
||||
const int PLAY_AREA_RIGHT = SCREEN_WIDTH - (0 * BLOCK);
|
||||
const int PLAY_AREA_RIGHT = GAME_WIDTH - (0 * BLOCK);
|
||||
const int PLAY_AREA_WIDTH = PLAY_AREA_RIGHT - PLAY_AREA_LEFT;
|
||||
const int PLAY_AREA_HEIGHT = PLAY_AREA_BOTTOM - PLAY_AREA_TOP;
|
||||
const int PLAY_AREA_CENTER_X = PLAY_AREA_LEFT + (PLAY_AREA_WIDTH / 2);
|
||||
@@ -92,213 +30,41 @@ const int PLAY_AREA_FIRST_QUARTER_Y = PLAY_AREA_HEIGHT / 4;
|
||||
const int PLAY_AREA_THIRD_QUARTER_Y = (PLAY_AREA_HEIGHT / 4) * 3;
|
||||
|
||||
// Anclajes de pantalla
|
||||
const int SCREEN_CENTER_X = SCREEN_WIDTH / 2;
|
||||
const int SCREEN_FIRST_QUARTER_X = SCREEN_WIDTH / 4;
|
||||
const int SCREEN_THIRD_QUARTER_X = (SCREEN_WIDTH / 4) * 3;
|
||||
const int SCREEN_CENTER_Y = SCREEN_HEIGHT / 2;
|
||||
const int SCREEN_FIRST_QUARTER_Y = SCREEN_HEIGHT / 4;
|
||||
const int SCREEN_THIRD_QUARTER_Y = (SCREEN_HEIGHT / 4) * 3;
|
||||
|
||||
// Opciones de menu
|
||||
#define MENU_NO_OPTION -1
|
||||
#define MENU_OPTION_START 0
|
||||
#define MENU_OPTION_QUIT 1
|
||||
#define MENU_OPTION_TOTAL 2
|
||||
|
||||
// Tipos de fondos para el menu
|
||||
#define MENU_BACKGROUND_TRANSPARENT 0
|
||||
#define MENU_BACKGROUND_SOLID 1
|
||||
|
||||
// Estados del jugador
|
||||
#define PLAYER_STATUS_WALKING_LEFT 0
|
||||
#define PLAYER_STATUS_WALKING_RIGHT 1
|
||||
#define PLAYER_STATUS_WALKING_STOP 2
|
||||
|
||||
#define PLAYER_STATUS_FIRING_UP 0
|
||||
#define PLAYER_STATUS_FIRING_LEFT 1
|
||||
#define PLAYER_STATUS_FIRING_RIGHT 2
|
||||
#define PLAYER_STATUS_FIRING_NO 3
|
||||
|
||||
#define PLAYER_ANIMATION_LEGS_WALKING_LEFT 0
|
||||
#define PLAYER_ANIMATION_LEGS_WALKING_RIGHT 1
|
||||
#define PLAYER_ANIMATION_LEGS_WALKING_STOP 2
|
||||
|
||||
#define PLAYER_ANIMATION_BODY_WALKING_LEFT 0
|
||||
#define PLAYER_ANIMATION_BODY_FIRING_LEFT 1
|
||||
#define PLAYER_ANIMATION_BODY_WALKING_RIGHT 2
|
||||
#define PLAYER_ANIMATION_BODY_FIRING_RIGHT 3
|
||||
#define PLAYER_ANIMATION_BODY_WALKING_STOP 4
|
||||
#define PLAYER_ANIMATION_BODY_FIRING_UP 5
|
||||
|
||||
// Variables del jugador
|
||||
#define PLAYER_INVULNERABLE_COUNTER 200
|
||||
const int SCREEN_CENTER_X = GAME_WIDTH / 2;
|
||||
const int SCREEN_FIRST_QUARTER_X = GAME_WIDTH / 4;
|
||||
const int SCREEN_THIRD_QUARTER_X = (GAME_WIDTH / 4) * 3;
|
||||
const int SCREEN_CENTER_Y = GAME_HEIGHT / 2;
|
||||
const int SCREEN_FIRST_QUARTER_Y = GAME_HEIGHT / 4;
|
||||
const int SCREEN_THIRD_QUARTER_Y = (GAME_HEIGHT / 4) * 3;
|
||||
|
||||
// Secciones del programa
|
||||
#define PROG_SECTION_LOGO 0
|
||||
#define PROG_SECTION_INTRO 1
|
||||
#define PROG_SECTION_TITLE 2
|
||||
#define PROG_SECTION_GAME 3
|
||||
#define PROG_SECTION_QUIT 4
|
||||
|
||||
// Secciones del juego
|
||||
#define GAME_SECTION_PLAY 0
|
||||
#define GAME_SECTION_PAUSE 1
|
||||
#define GAME_SECTION_GAMEOVER 2
|
||||
|
||||
// Secciones del titulo
|
||||
#define TITLE_SECTION_1 0
|
||||
#define TITLE_SECTION_2 1
|
||||
#define TITLE_SECTION_3 2
|
||||
#define TITLE_SECTION_INSTRUCTIONS 3
|
||||
// Subsecciones
|
||||
#define GAME_SECTION_PLAY_1P 0
|
||||
#define GAME_SECTION_PLAY_2P 1
|
||||
#define GAME_SECTION_PAUSE 2
|
||||
#define GAME_SECTION_GAMEOVER 3
|
||||
#define TITLE_SECTION_1 3
|
||||
#define TITLE_SECTION_2 4
|
||||
#define TITLE_SECTION_3 5
|
||||
#define TITLE_SECTION_INSTRUCTIONS 6
|
||||
|
||||
// Estados de cada elemento que pertenece a un evento
|
||||
#define EVENT_WAITING 1
|
||||
#define EVENT_RUNNING 2
|
||||
#define EVENT_COMPLETED 3
|
||||
|
||||
// Cantidad de eventos de la intro
|
||||
#define INTRO_TOTAL_BITMAPS 6
|
||||
#define INTRO_TOTAL_TEXTS 9
|
||||
const int INTRO_TOTAL_EVENTS = INTRO_TOTAL_BITMAPS + INTRO_TOTAL_TEXTS;
|
||||
|
||||
// Cantidad de eventos de la pantalla de titulo
|
||||
#define TITLE_TOTAL_EVENTS 2
|
||||
|
||||
// Relaciones de Id con nomnbres
|
||||
#define BITMAP0 0
|
||||
#define BITMAP1 1
|
||||
#define BITMAP2 2
|
||||
#define BITMAP3 3
|
||||
#define BITMAP4 4
|
||||
#define BITMAP5 5
|
||||
#define TEXT0 6
|
||||
#define TEXT1 7
|
||||
#define TEXT2 8
|
||||
#define TEXT3 9
|
||||
#define TEXT4 10
|
||||
#define TEXT5 11
|
||||
#define TEXT6 12
|
||||
#define TEXT7 13
|
||||
#define TEXT8 14
|
||||
|
||||
// Anclajes para el marcador de puntos
|
||||
const int SCORE_WORD_X = (SCREEN_WIDTH / 4) - ((5 * BLOCK) / 2);
|
||||
const int SCORE_WORD_Y = SCREEN_HEIGHT - (3 * BLOCK) + 2;
|
||||
const int SCORE_NUMBER_X = (SCREEN_WIDTH / 4) - ((6 * BLOCK) / 2);
|
||||
const int SCORE_NUMBER_Y = SCREEN_HEIGHT - (2 * BLOCK) + 2;
|
||||
|
||||
const int HISCORE_WORD_X = ((SCREEN_WIDTH / 4) * 3) - ((8 * BLOCK) / 2);
|
||||
const int HISCORE_WORD_Y = SCREEN_HEIGHT - (3 * BLOCK) + 2;
|
||||
const int HISCORE_NUMBER_X = ((SCREEN_WIDTH / 4) * 3) - ((6 * BLOCK) / 2);
|
||||
const int HISCORE_NUMBER_Y = SCREEN_HEIGHT - (2 * BLOCK) + 2;
|
||||
|
||||
const int MULTIPLIER_WORD_X = (SCREEN_WIDTH / 2) - ((4 * BLOCK) / 2);
|
||||
const int MULTIPLIER_WORD_Y = SCREEN_HEIGHT - (3 * BLOCK) + 2;
|
||||
const int MULTIPLIER_NUMBER_X = (SCREEN_WIDTH / 2) - ((3 * BLOCK) / 2);
|
||||
const int MULTIPLIER_NUMBER_Y = SCREEN_HEIGHT - (2 * BLOCK) + 2;
|
||||
|
||||
// Ningun tipo
|
||||
#define NO_KIND 0
|
||||
|
||||
// Tipos de globo
|
||||
#define BALLOON_1 1
|
||||
#define BALLOON_2 2
|
||||
#define BALLOON_3 3
|
||||
#define BALLOON_4 4
|
||||
#define HEXAGON_1 5
|
||||
#define HEXAGON_2 6
|
||||
#define HEXAGON_3 7
|
||||
#define HEXAGON_4 8
|
||||
#define POWER_BALL 9
|
||||
|
||||
// Clases de globo
|
||||
#define BALLOON_CLASS 0
|
||||
#define HEXAGON_CLASS 1
|
||||
|
||||
// Velocidad del globo
|
||||
#define BALLOON_VELX_POSITIVE 0.7f
|
||||
#define BALLOON_VELX_NEGATIVE -0.7f
|
||||
|
||||
// Indice para las animaciones de los globos
|
||||
#define BALLOON_MOVING_ANIMATION 0
|
||||
#define BALLOON_POP_ANIMATION 1
|
||||
#define BALLOON_BORN_ANIMATION 2
|
||||
|
||||
// Cantidad posible de globos
|
||||
#define MAX_BALLOONS 100
|
||||
|
||||
// Velocidades a las que se mueven los enemigos
|
||||
#define BALLOON_SPEED_1 0.60f
|
||||
#define BALLOON_SPEED_2 0.70f
|
||||
#define BALLOON_SPEED_3 0.80f
|
||||
#define BALLOON_SPEED_4 0.90f
|
||||
#define BALLOON_SPEED_5 1.00f
|
||||
|
||||
// Tamaño de los globos
|
||||
#define BALLOON_SIZE_1 8
|
||||
#define BALLOON_SIZE_2 13
|
||||
#define BALLOON_SIZE_3 21
|
||||
#define BALLOON_SIZE_4 37
|
||||
|
||||
// Tipos de bala
|
||||
#define BULLET_UP 1
|
||||
#define BULLET_LEFT 2
|
||||
#define BULLET_RIGHT 3
|
||||
|
||||
// Cantidad posible de globos
|
||||
#define MAX_BULLETS 50
|
||||
|
||||
// Tipos de objetos
|
||||
#define ITEM_POINTS_1_DISK 1
|
||||
#define ITEM_POINTS_2_GAVINA 2
|
||||
#define ITEM_POINTS_3_PACMAR 3
|
||||
#define ITEM_CLOCK 4
|
||||
#define ITEM_TNT 5
|
||||
#define ITEM_COFFEE 6
|
||||
#define ITEM_POWER_BALL 7
|
||||
|
||||
// Cantidad de objetos simultaneos
|
||||
#define MAX_ITEMS 5
|
||||
|
||||
// Valores para las variables asociadas a los objetos
|
||||
#define REMAINING_EXPLOSIONS 3
|
||||
#define REMAINING_EXPLOSIONS_COUNTER 50
|
||||
#define TIME_STOPPED_COUNTER 300
|
||||
|
||||
// Estados de entrada
|
||||
#define NO_INPUT 0
|
||||
#define INPUT_UP 1
|
||||
#define INPUT_DOWN 2
|
||||
#define INPUT_LEFT 3
|
||||
#define INPUT_RIGHT 4
|
||||
#define INPUT_ACCEPT 5
|
||||
#define INPUT_CANCEL 6
|
||||
#define INPUT_FIRE_UP 7
|
||||
#define INPUT_FIRE_LEFT 8
|
||||
#define INPUT_FIRE_RIGHT 9
|
||||
#define INPUT_PAUSE 10
|
||||
|
||||
// Zona muerta del mando analógico
|
||||
#define JOYSTICK_DEAD_ZONE 8000
|
||||
|
||||
// Tipos de mensajes para el retorno de las funciones
|
||||
#define MSG_OK 0
|
||||
#define MSG_BULLET_OUT 1
|
||||
|
||||
// Tipos de texto
|
||||
#define TEXT_FIXED 0
|
||||
#define TEXT_VARIABLE 1
|
||||
|
||||
// Cantidad de elementos del vector de SmartSprites
|
||||
#define MAX_SMART_SPRITES 10
|
||||
|
||||
// Cantidad máxima de gotas de café
|
||||
#define MAX_COFFEE_DROPS 100
|
||||
|
||||
// Contadores
|
||||
#define TITLE_COUNTER 800
|
||||
#define STAGE_COUNTER 200
|
||||
#define INSTRUCTIONS_COUNTER 600
|
||||
#define DEATH_COUNTER 350
|
||||
#define SHAKE_COUNTER 10
|
||||
// Colores
|
||||
const color_t bgColor = {0x27, 0x27, 0x36};
|
||||
const color_t noColor = {0xFF, 0xFF, 0xFF};
|
||||
const color_t shdwTxtColor = {0x43, 0x43, 0x4F};
|
||||
|
||||
#endif
|
||||
460
source/director.cpp
Normal file
@@ -0,0 +1,460 @@
|
||||
#include "const.h"
|
||||
#include "utils.h"
|
||||
#include "director.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
// Constructor
|
||||
Director::Director(std::string path)
|
||||
{
|
||||
|
||||
// Crea el objeto que controla los ficheros de recursos
|
||||
asset = new Asset(path.substr(0, path.find_last_of("\\/")) + "../");
|
||||
|
||||
// Establece la lista de ficheros
|
||||
Uint8 section = PROG_SECTION_LOGO;
|
||||
if (!setFileList())
|
||||
{// Si falta algún fichero no inicies el programa
|
||||
section = PROG_SECTION_QUIT;
|
||||
}
|
||||
|
||||
// Crea el objeto de idioma
|
||||
lang = new Lang(asset);
|
||||
|
||||
// Crea el puntero a la estructura y carga el fichero de configuración
|
||||
options = new options_t;
|
||||
loadConfigFile();
|
||||
|
||||
// Crea los objetos
|
||||
input = new Input(asset->get("controllerdb.txt"));
|
||||
|
||||
// Inicializa SDL
|
||||
initSDL();
|
||||
|
||||
// Crea el objeto para dibujar en pantalla (Requiere initSDL)
|
||||
screen = new Screen(window, renderer, options, GAME_WIDTH, GAME_HEIGHT);
|
||||
|
||||
// Inicializa JailAudio
|
||||
initJailAudio();
|
||||
|
||||
// Aplica las opciones
|
||||
lang->setLang(options->language);
|
||||
|
||||
// Inicializa el resto de variables
|
||||
init(section);
|
||||
}
|
||||
|
||||
Director::~Director()
|
||||
{
|
||||
saveConfigFile();
|
||||
|
||||
delete asset;
|
||||
asset = nullptr;
|
||||
|
||||
delete input;
|
||||
input = nullptr;
|
||||
|
||||
delete screen;
|
||||
screen = nullptr;
|
||||
|
||||
delete lang;
|
||||
lang = nullptr;
|
||||
|
||||
delete options;
|
||||
options = nullptr;
|
||||
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
renderer = nullptr;
|
||||
window = nullptr;
|
||||
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
// Inicia las variables necesarias para arrancar el programa
|
||||
void Director::init(Uint8 name)
|
||||
{
|
||||
// Sección
|
||||
section.name = name;
|
||||
section.subsection = 0;
|
||||
|
||||
// Textos
|
||||
lang->setLang(options->language);
|
||||
|
||||
// Controles
|
||||
input->bindKey(INPUT_UP, SDL_SCANCODE_UP);
|
||||
input->bindKey(INPUT_DOWN, SDL_SCANCODE_DOWN);
|
||||
input->bindKey(INPUT_LEFT, SDL_SCANCODE_LEFT);
|
||||
input->bindKey(INPUT_RIGHT, SDL_SCANCODE_RIGHT);
|
||||
input->bindKey(INPUT_ACCEPT, SDL_SCANCODE_RETURN);
|
||||
input->bindKey(INPUT_CANCEL, SDL_SCANCODE_ESCAPE);
|
||||
input->bindKey(INPUT_BUTTON_1, SDL_SCANCODE_Q);
|
||||
input->bindKey(INPUT_BUTTON_2, SDL_SCANCODE_W);
|
||||
input->bindKey(INPUT_BUTTON_3, SDL_SCANCODE_E);
|
||||
input->bindKey(INPUT_BUTTON_PAUSE, SDL_SCANCODE_ESCAPE); // PAUSE
|
||||
input->bindKey(INPUT_BUTTON_ESCAPE, SDL_SCANCODE_ESCAPE); // ESCAPE
|
||||
|
||||
input->bindGameControllerButton(INPUT_UP, SDL_CONTROLLER_BUTTON_DPAD_UP);
|
||||
input->bindGameControllerButton(INPUT_DOWN, SDL_CONTROLLER_BUTTON_DPAD_DOWN);
|
||||
input->bindGameControllerButton(INPUT_LEFT, SDL_CONTROLLER_BUTTON_DPAD_LEFT);
|
||||
input->bindGameControllerButton(INPUT_RIGHT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT);
|
||||
input->bindGameControllerButton(INPUT_ACCEPT, SDL_CONTROLLER_BUTTON_B);
|
||||
input->bindGameControllerButton(INPUT_CANCEL, SDL_CONTROLLER_BUTTON_A);
|
||||
input->bindGameControllerButton(INPUT_BUTTON_1, SDL_CONTROLLER_BUTTON_X);
|
||||
input->bindGameControllerButton(INPUT_BUTTON_2, SDL_CONTROLLER_BUTTON_Y);
|
||||
input->bindGameControllerButton(INPUT_BUTTON_3, SDL_CONTROLLER_BUTTON_B);
|
||||
input->bindGameControllerButton(INPUT_BUTTON_PAUSE, SDL_CONTROLLER_BUTTON_GUIDE); // PAUSE
|
||||
input->bindGameControllerButton(INPUT_BUTTON_ESCAPE, SDL_CONTROLLER_BUTTON_GUIDE); // ESCAPE
|
||||
}
|
||||
|
||||
// Inicializa JailAudio
|
||||
void Director::initJailAudio()
|
||||
{
|
||||
JA_Init(48000, AUDIO_S16, 2);
|
||||
}
|
||||
|
||||
// Arranca SDL y crea la ventana
|
||||
bool Director::initSDL()
|
||||
{
|
||||
// Indicador de éxito
|
||||
bool success = true;
|
||||
|
||||
// Inicializa SDL
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_AUDIO) < 0)
|
||||
{
|
||||
printf("SDL could not initialize!\nSDL Error: %s\n", SDL_GetError());
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Inicia el generador de numeros aleatorios
|
||||
std::srand(static_cast<unsigned int>(SDL_GetTicks()));
|
||||
|
||||
// Establece el filtro de la textura
|
||||
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(options->filter).c_str()))
|
||||
{
|
||||
printf("Warning: Nearest texture filtering not enabled!\n");
|
||||
}
|
||||
|
||||
// Crea la ventana
|
||||
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, options->screenWidth * options->windowSize, options->screenHeight * options->windowSize, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
if (window == nullptr)
|
||||
{
|
||||
printf("Window could not be created!\nSDL Error: %s\n", SDL_GetError());
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
|
||||
if (options->vSync)
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||
else
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
||||
|
||||
if (renderer == nullptr)
|
||||
{
|
||||
printf("Renderer could not be created!\nSDL Error: %s\n", SDL_GetError());
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Inicializa el color de renderizado
|
||||
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF);
|
||||
|
||||
// Establece el tamaño del buffer de renderizado
|
||||
SDL_RenderSetLogicalSize(renderer, options->screenWidth, options->screenHeight);
|
||||
|
||||
// Establece el modo de mezcla
|
||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
return success;
|
||||
}
|
||||
|
||||
// Crea el indice de ficheros
|
||||
bool Director::setFileList()
|
||||
{
|
||||
// Ficheros de configuración
|
||||
asset->add("data/config/score.bin", t_data, false);
|
||||
asset->add("data/config/demo.bin", t_data);
|
||||
asset->add("data/config/config.bin", t_data, false);
|
||||
asset->add("data/config/gamecontrollerdb.txt", t_data);
|
||||
|
||||
// Musicas
|
||||
asset->add("data/music/intro.ogg", t_music);
|
||||
asset->add("data/music/playing.ogg", t_music);
|
||||
asset->add("data/music/title.ogg", t_music);
|
||||
|
||||
// Sonidos
|
||||
asset->add("data/sound/balloon.wav", t_sound);
|
||||
asset->add("data/sound/bubble1.wav", t_sound);
|
||||
asset->add("data/sound/bubble2.wav", t_sound);
|
||||
asset->add("data/sound/bubble3.wav", t_sound);
|
||||
asset->add("data/sound/bubble4.wav", t_sound);
|
||||
asset->add("data/sound/bullet.wav", t_sound);
|
||||
asset->add("data/sound/coffeeout.wav", t_sound);
|
||||
asset->add("data/sound/hiscore.wav", t_sound);
|
||||
asset->add("data/sound/itemdrop.wav", t_sound);
|
||||
asset->add("data/sound/itempickup.wav", t_sound);
|
||||
asset->add("data/sound/menu_cancel.wav", t_sound);
|
||||
asset->add("data/sound/menu_move.wav", t_sound);
|
||||
asset->add("data/sound/menu_select.wav", t_sound);
|
||||
asset->add("data/sound/player_collision.wav", t_sound);
|
||||
asset->add("data/sound/stage_change.wav", t_sound);
|
||||
asset->add("data/sound/title.wav", t_sound);
|
||||
asset->add("data/sound/clock.wav", t_sound);
|
||||
asset->add("data/sound/powerball.wav", t_sound);
|
||||
|
||||
// Texturas
|
||||
asset->add("data/gfx/balloon.png", t_bitmap);
|
||||
asset->add("data/gfx/bullet.png", t_bitmap);
|
||||
asset->add("data/gfx/game_bg.png", t_bitmap);
|
||||
asset->add("data/gfx/game_text.png", t_bitmap);
|
||||
asset->add("data/gfx/intro.png", t_bitmap);
|
||||
asset->add("data/gfx/items.png", t_bitmap);
|
||||
asset->add("data/gfx/logo.png", t_bitmap);
|
||||
asset->add("data/gfx/player1_body.png", t_bitmap);
|
||||
asset->add("data/gfx/player1_death.png", t_bitmap);
|
||||
asset->add("data/gfx/player1_legs.png", t_bitmap);
|
||||
asset->add("data/gfx/title.png", t_bitmap);
|
||||
asset->add("data/gfx/player1_head.png", t_bitmap);
|
||||
asset->add("data/gfx/player2_body.png", t_bitmap);
|
||||
asset->add("data/gfx/player2_death.png", t_bitmap);
|
||||
asset->add("data/gfx/player2_legs.png", t_bitmap);
|
||||
asset->add("data/gfx/player2_head.png", t_bitmap);
|
||||
|
||||
// Fuentes
|
||||
asset->add("data/font/8bithud.png", t_font);
|
||||
asset->add("data/font/8bithud.txt", t_font);
|
||||
asset->add("data/font/nokia.png", t_font);
|
||||
asset->add("data/font/nokia_big2.png", t_font);
|
||||
asset->add("data/font/nokia.txt", t_font);
|
||||
asset->add("data/font/nokia2.png", t_font);
|
||||
asset->add("data/font/nokia2.txt", t_font);
|
||||
asset->add("data/font/nokia_big2.txt", t_font);
|
||||
asset->add("data/font/smb2_big.png", t_font);
|
||||
asset->add("data/font/smb2_big.txt", t_font);
|
||||
asset->add("data/font/smb2.png", t_font);
|
||||
asset->add("data/font/smb2.txt", t_font);
|
||||
|
||||
// Textos
|
||||
asset->add("data/lang/es_ES.txt", t_lang);
|
||||
asset->add("data/lang/en_UK.txt", t_lang);
|
||||
asset->add("data/lang/ba_BA.txt", t_lang);
|
||||
|
||||
return asset->check();
|
||||
}
|
||||
|
||||
// Carga el fichero de configuración
|
||||
bool Director::loadConfigFile()
|
||||
{
|
||||
// Pone unos valores por defecto
|
||||
options->fullScreenMode = 0;
|
||||
options->windowSize = 3;
|
||||
options->language = ba_BA;
|
||||
options->difficulty = DIFFICULTY_NORMAL;
|
||||
options->input[0].deviceType = INPUT_USE_KEYBOARD;
|
||||
options->input[1].deviceType = INPUT_USE_GAMECONTROLLER;
|
||||
options->filter = FILTER_NEAREST;
|
||||
options->vSync = true;
|
||||
options->screenWidth = GAME_WIDTH;
|
||||
options->screenHeight = GAME_HEIGHT;
|
||||
options->integerScale = true;
|
||||
options->keepAspect = true;
|
||||
options->borderSize = 0.0f;
|
||||
options->borderEnabled = false;
|
||||
|
||||
// Indicador de éxito en la carga
|
||||
bool success = true;
|
||||
|
||||
const std::string p = asset->get("config.bin");
|
||||
std::string filename = p.substr(p.find_last_of("\\/") + 1);
|
||||
SDL_RWops *file = SDL_RWFromFile(p.c_str(), "r+b");
|
||||
|
||||
// El fichero no existe
|
||||
if (file == nullptr)
|
||||
{
|
||||
printf("Warning: Unable to open %s file\n", filename.c_str());
|
||||
|
||||
// Crea el fichero para escritura
|
||||
file = SDL_RWFromFile(p.c_str(), "w+b");
|
||||
if (file != nullptr)
|
||||
{
|
||||
printf("New file (%s) created!\n", filename.c_str());
|
||||
|
||||
// Escribe los datos
|
||||
SDL_RWwrite(file, &options->fullScreenMode, sizeof(options->fullScreenMode), 1);
|
||||
SDL_RWwrite(file, &options->windowSize, sizeof(options->windowSize), 1);
|
||||
SDL_RWwrite(file, &options->language, sizeof(options->language), 1);
|
||||
SDL_RWwrite(file, &options->difficulty, sizeof(options->difficulty), 1);
|
||||
SDL_RWwrite(file, &options->input[0].deviceType, sizeof(options->input[0].deviceType), 1);
|
||||
SDL_RWwrite(file, &options->input[1].deviceType, sizeof(options->input[1].deviceType), 1);
|
||||
SDL_RWwrite(file, &options->filter, sizeof(options->filter), 1);
|
||||
SDL_RWwrite(file, &options->vSync, sizeof(options->vSync), 1);
|
||||
SDL_RWwrite(file, &options->screenWidth, sizeof(options->screenWidth), 1);
|
||||
SDL_RWwrite(file, &options->screenHeight, sizeof(options->screenHeight), 1);
|
||||
SDL_RWwrite(file, &options->integerScale, sizeof(options->integerScale), 1);
|
||||
SDL_RWwrite(file, &options->keepAspect, sizeof(options->keepAspect), 1);
|
||||
|
||||
// Cierra el fichero
|
||||
SDL_RWclose(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error: Unable to create file %s\n", filename.c_str());
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
// El fichero existe
|
||||
else
|
||||
{
|
||||
// Carga los datos
|
||||
printf("Reading file %s\n", filename.c_str());
|
||||
SDL_RWread(file, &options->fullScreenMode, sizeof(options->fullScreenMode), 1);
|
||||
SDL_RWread(file, &options->windowSize, sizeof(options->windowSize), 1);
|
||||
SDL_RWread(file, &options->language, sizeof(options->language), 1);
|
||||
SDL_RWread(file, &options->difficulty, sizeof(options->difficulty), 1);
|
||||
SDL_RWread(file, &options->input[0].deviceType, sizeof(options->input[0].deviceType), 1);
|
||||
SDL_RWread(file, &options->input[1].deviceType, sizeof(options->input[1].deviceType), 1);
|
||||
SDL_RWread(file, &options->filter, sizeof(options->filter), 1);
|
||||
SDL_RWread(file, &options->vSync, sizeof(options->vSync), 1);
|
||||
SDL_RWread(file, &options->screenWidth, sizeof(options->screenWidth), 1);
|
||||
SDL_RWread(file, &options->screenHeight, sizeof(options->screenHeight), 1);
|
||||
SDL_RWread(file, &options->integerScale, sizeof(options->integerScale), 1);
|
||||
SDL_RWread(file, &options->keepAspect, sizeof(options->keepAspect), 1);
|
||||
|
||||
// Normaliza los valores
|
||||
if (!((options->fullScreenMode == 0) ||
|
||||
(options->fullScreenMode == SDL_WINDOW_FULLSCREEN) ||
|
||||
(options->fullScreenMode == SDL_WINDOW_FULLSCREEN_DESKTOP)))
|
||||
options->fullScreenMode = 0;
|
||||
if ((options->windowSize < 1) || (options->windowSize > 4))
|
||||
options->windowSize = 3;
|
||||
if ((options->language < 0) || (options->language > MAX_LANGUAGES))
|
||||
options->language = en_UK;
|
||||
|
||||
// Cierra el fichero
|
||||
SDL_RWclose(file);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
// Guarda el fichero de configuración
|
||||
bool Director::saveConfigFile()
|
||||
{
|
||||
bool success = true;
|
||||
const std::string p = asset->get("config.bin");
|
||||
std::string filename = p.substr(p.find_last_of("\\/") + 1);
|
||||
SDL_RWops *file = SDL_RWFromFile(p.c_str(), "w+b");
|
||||
if (file != nullptr)
|
||||
{
|
||||
// Guarda los datos
|
||||
SDL_RWwrite(file, &options->fullScreenMode, sizeof(options->fullScreenMode), 1);
|
||||
SDL_RWwrite(file, &options->windowSize, sizeof(options->windowSize), 1);
|
||||
SDL_RWwrite(file, &options->language, sizeof(options->language), 1);
|
||||
SDL_RWwrite(file, &options->difficulty, sizeof(options->difficulty), 1);
|
||||
SDL_RWwrite(file, &options->input[0].deviceType, sizeof(options->input[0].deviceType), 1);
|
||||
SDL_RWwrite(file, &options->input[1].deviceType, sizeof(options->input[1].deviceType), 1);
|
||||
SDL_RWwrite(file, &options->filter, sizeof(options->filter), 1);
|
||||
SDL_RWwrite(file, &options->vSync, sizeof(options->vSync), 1);
|
||||
SDL_RWwrite(file, &options->screenWidth, sizeof(options->screenWidth), 1);
|
||||
SDL_RWwrite(file, &options->screenHeight, sizeof(options->screenHeight), 1);
|
||||
SDL_RWwrite(file, &options->integerScale, sizeof(options->integerScale), 1);
|
||||
SDL_RWwrite(file, &options->keepAspect, sizeof(options->keepAspect), 1);
|
||||
|
||||
printf("Writing file %s\n", filename.c_str());
|
||||
|
||||
// Cierra el fichero
|
||||
SDL_RWclose(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error: Unable to save %s file! %s\n", filename.c_str(), SDL_GetError());
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
Uint8 Director::getSubsection()
|
||||
{
|
||||
return section.subsection;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
Uint8 Director::getSection()
|
||||
{
|
||||
return section.name;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Director::setSection(section_t section)
|
||||
{
|
||||
section = section;
|
||||
}
|
||||
|
||||
void Director::runLogo()
|
||||
{
|
||||
logo = new Logo(renderer, screen, asset);
|
||||
setSection(logo->run());
|
||||
delete logo;
|
||||
}
|
||||
|
||||
void Director::runIntro()
|
||||
{
|
||||
intro = new Intro(renderer, screen, asset, lang);
|
||||
setSection(intro->run());
|
||||
delete intro;
|
||||
}
|
||||
|
||||
void Director::runTitle()
|
||||
{
|
||||
title = new Title(window, renderer, screen, input, asset, options, lang);
|
||||
setSection(title->run(section.subsection));
|
||||
delete title;
|
||||
}
|
||||
|
||||
void Director::runGame()
|
||||
{
|
||||
if (section.subsection == GAME_SECTION_PLAY_1P)
|
||||
{
|
||||
game = new Game(1, 0, renderer, screen, asset, lang, input, false, options);
|
||||
}
|
||||
|
||||
else if (section.subsection == GAME_SECTION_PLAY_2P)
|
||||
{
|
||||
game = new Game(2, 0, renderer, screen, asset, lang, input, false, options);
|
||||
}
|
||||
|
||||
setSection(game->run());
|
||||
delete game;
|
||||
}
|
||||
|
||||
void Director::run()
|
||||
{
|
||||
// Bucle principal
|
||||
while (!(getSection() == PROG_SECTION_QUIT))
|
||||
{
|
||||
switch (getSection())
|
||||
{
|
||||
case PROG_SECTION_LOGO:
|
||||
runLogo();
|
||||
break;
|
||||
|
||||
case PROG_SECTION_INTRO:
|
||||
runIntro();
|
||||
break;
|
||||
|
||||
case PROG_SECTION_TITLE:
|
||||
runTitle();
|
||||
break;
|
||||
|
||||
case PROG_SECTION_GAME:
|
||||
runGame();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
100
source/director.h
Normal file
@@ -0,0 +1,100 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "asset.h"
|
||||
#include "balloon.h"
|
||||
#include "bullet.h"
|
||||
#include "coffeedrop.h"
|
||||
#include "const.h"
|
||||
#include "fade.h"
|
||||
#include "game.h"
|
||||
#include "input.h"
|
||||
#include "intro.h"
|
||||
#include "item.h"
|
||||
#include "jail_audio.h"
|
||||
#include "logo.h"
|
||||
#include "menu.h"
|
||||
#include "movingsprite.h"
|
||||
#include "player.h"
|
||||
#include "screen.h"
|
||||
#include "smartsprite.h"
|
||||
#include "sprite.h"
|
||||
#include "text.h"
|
||||
#include "title.h"
|
||||
#include "utils.h"
|
||||
#include "writer.h"
|
||||
|
||||
#ifndef DIRECTOR_H
|
||||
#define DIRECTOR_H
|
||||
|
||||
// Textos
|
||||
#define WINDOW_CAPTION "Coffee Crisis"
|
||||
|
||||
// Clase Director
|
||||
class Director
|
||||
{
|
||||
private:
|
||||
SDL_Window *window; // La ventana donde dibujamos
|
||||
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||
Logo *logo; // Objeto para la sección del logo
|
||||
Intro *intro; // Objeto para la sección de la intro
|
||||
Title *title; // Objeto para la sección del titulo y el menu de opciones
|
||||
Game *game; // Objeto para la sección del juego
|
||||
Input *input; // Objeto Input para gestionar las entradas
|
||||
Lang *lang; // Objeto para gestionar los textos en diferentes idiomas
|
||||
Asset *asset; // Objeto que gestiona todos los ficheros de recursos
|
||||
struct options_t *options; // Variable con todas las opciones del programa
|
||||
section_t section; // Sección y subsección actual del programa;
|
||||
|
||||
// Inicializa jail_audio
|
||||
void initJailAudio();
|
||||
|
||||
// Arranca SDL y crea la ventana
|
||||
bool initSDL();
|
||||
|
||||
// Crea el indice de ficheros
|
||||
bool setFileList();
|
||||
|
||||
// Carga el fichero de configuración
|
||||
bool loadConfigFile();
|
||||
|
||||
// Guarda el fichero de configuración
|
||||
bool saveConfigFile();
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
Uint8 getSubsection();
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
Uint8 getSection();
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setSection(section_t section);
|
||||
|
||||
// Ejecuta la seccion de juego con el logo
|
||||
void runLogo();
|
||||
|
||||
// Ejecuta la seccion de juego de la introducción
|
||||
void runIntro();
|
||||
|
||||
// Ejecuta la seccion de juego con el titulo y los menus
|
||||
void runTitle();
|
||||
|
||||
// Ejecuta la seccion de juego donde se juega
|
||||
void runGame();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Director(std::string path);
|
||||
|
||||
// Destructor
|
||||
~Director();
|
||||
|
||||
// Inicia las variables necesarias para arrancar el programa
|
||||
void init(Uint8 name);
|
||||
|
||||
// Bucle principal
|
||||
void run();
|
||||
};
|
||||
|
||||
#endif
|
||||
160
source/fade.cpp
Normal file
@@ -0,0 +1,160 @@
|
||||
#include "fade.h"
|
||||
#include "const.h"
|
||||
|
||||
// Constructor
|
||||
Fade::Fade(SDL_Renderer *renderer)
|
||||
{
|
||||
mRenderer = renderer;
|
||||
|
||||
mBackbuffer = SDL_CreateTexture(mRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAME_WIDTH, GAME_HEIGHT);
|
||||
if (mBackbuffer == nullptr)
|
||||
printf("Backbuffer could not be created!\nSDL Error: %s\n", SDL_GetError());
|
||||
}
|
||||
|
||||
// Destructor
|
||||
Fade::~Fade()
|
||||
{
|
||||
SDL_DestroyTexture(mBackbuffer);
|
||||
mBackbuffer = nullptr;
|
||||
}
|
||||
|
||||
// Inicializa las variables
|
||||
void Fade::init(Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
mFadeType = FADE_CENTER;
|
||||
mEnabled = false;
|
||||
mFinished = false;
|
||||
mCounter = 0;
|
||||
mR = r;
|
||||
mG = g;
|
||||
mB = b;
|
||||
}
|
||||
|
||||
// Pinta una transición en pantalla
|
||||
void Fade::render()
|
||||
{
|
||||
if (mEnabled && !mFinished)
|
||||
{
|
||||
switch (mFadeType)
|
||||
{
|
||||
case FADE_FULLSCREEN:
|
||||
mRect1 = {0, 0, GAME_WIDTH, GAME_HEIGHT};
|
||||
|
||||
for (int i = 0; i < 256; i += 4)
|
||||
{
|
||||
// Dibujamos sobre el renderizador
|
||||
SDL_SetRenderTarget(mRenderer, nullptr);
|
||||
|
||||
// Copia el backbuffer con la imagen que había al renderizador
|
||||
SDL_RenderCopy(mRenderer, mBackbuffer, nullptr, nullptr);
|
||||
|
||||
SDL_SetRenderDrawColor(mRenderer, mR, mG, mB, i);
|
||||
SDL_RenderFillRect(mRenderer, &mRect1);
|
||||
|
||||
// Vuelca el renderizador en pantalla
|
||||
SDL_RenderPresent(mRenderer);
|
||||
}
|
||||
|
||||
// Deja todos los buffers del mismo color
|
||||
SDL_SetRenderTarget(mRenderer, mBackbuffer);
|
||||
SDL_SetRenderDrawColor(mRenderer, mR, mG, mB, 255);
|
||||
SDL_RenderClear(mRenderer);
|
||||
|
||||
SDL_SetRenderTarget(mRenderer, nullptr);
|
||||
SDL_SetRenderDrawColor(mRenderer, mR, mG, mB, 255);
|
||||
SDL_RenderClear(mRenderer);
|
||||
break;
|
||||
|
||||
case FADE_CENTER:
|
||||
mRect1 = {0, 0, GAME_WIDTH, 0};
|
||||
mRect2 = {0, 0, GAME_WIDTH, 0};
|
||||
|
||||
SDL_SetRenderDrawColor(mRenderer, mR, mG, mB, 64);
|
||||
|
||||
for (int i = 0; i < mCounter; i++)
|
||||
{
|
||||
mRect1.h = mRect2.h = i * 4;
|
||||
mRect2.y = GAME_HEIGHT - (i * 4);
|
||||
|
||||
SDL_RenderFillRect(mRenderer, &mRect1);
|
||||
SDL_RenderFillRect(mRenderer, &mRect2);
|
||||
}
|
||||
|
||||
if ((mCounter * 4) > GAME_HEIGHT)
|
||||
mFinished = true;
|
||||
break;
|
||||
|
||||
case FADE_RANDOM_SQUARE:
|
||||
mRect1 = {0, 0, 32, 32};
|
||||
|
||||
for (Uint16 i = 0; i < 50; i++)
|
||||
{
|
||||
// Crea un color al azar
|
||||
mR = 255 * (rand() % 2);
|
||||
mG = 255 * (rand() % 2);
|
||||
mB = 255 * (rand() % 2);
|
||||
SDL_SetRenderDrawColor(mRenderer, mR, mG, mB, 64);
|
||||
|
||||
// Dibujamos sobre el backbuffer
|
||||
SDL_SetRenderTarget(mRenderer, mBackbuffer);
|
||||
|
||||
mRect1.x = rand() % (GAME_WIDTH - mRect1.w);
|
||||
mRect1.y = rand() % (GAME_HEIGHT - mRect1.h);
|
||||
SDL_RenderFillRect(mRenderer, &mRect1);
|
||||
|
||||
// Volvemos a usar el renderizador de forma normal
|
||||
SDL_SetRenderTarget(mRenderer, nullptr);
|
||||
|
||||
// Copiamos el backbuffer al renderizador
|
||||
SDL_RenderCopy(mRenderer, mBackbuffer, nullptr, nullptr);
|
||||
|
||||
// Volcamos el renderizador en pantalla
|
||||
SDL_RenderPresent(mRenderer);
|
||||
SDL_Delay(100);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (mFinished)
|
||||
{
|
||||
SDL_SetRenderDrawColor(mRenderer, mR, mG, mB, 255);
|
||||
SDL_RenderClear(mRenderer);
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza las variables internas
|
||||
void Fade::update()
|
||||
{
|
||||
if (mEnabled)
|
||||
mCounter++;
|
||||
}
|
||||
|
||||
// Activa el fade
|
||||
void Fade::activateFade()
|
||||
{
|
||||
mEnabled = true;
|
||||
mFinished = false;
|
||||
mCounter = 0;
|
||||
}
|
||||
|
||||
// Comprueba si está activo
|
||||
bool Fade::isEnabled()
|
||||
{
|
||||
return mEnabled;
|
||||
}
|
||||
|
||||
// Comprueba si ha terminado la transicion
|
||||
bool Fade::hasEnded()
|
||||
{
|
||||
return mFinished;
|
||||
}
|
||||
|
||||
// Establece el tipo de fade
|
||||
void Fade::setFadeType(Uint8 fadeType)
|
||||
{
|
||||
mFadeType = fadeType;
|
||||
}
|
||||
57
source/fade.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "ltexture.h"
|
||||
|
||||
#ifndef FADE_H
|
||||
#define FADE_H
|
||||
|
||||
// Tipos de fundido
|
||||
#define FADE_FULLSCREEN 0
|
||||
#define FADE_CENTER 1
|
||||
#define FADE_RANDOM_SQUARE 2
|
||||
|
||||
// Clase Fade
|
||||
class Fade
|
||||
{
|
||||
private:
|
||||
SDL_Renderer *mRenderer; // El renderizador de la ventana
|
||||
SDL_Texture *mBackbuffer; // Textura para usar como backbuffer
|
||||
Uint8 mFadeType; // Tipo de fade a realizar
|
||||
Uint16 mCounter; // Contador interno
|
||||
bool mEnabled; // Indica si el fade está activo
|
||||
bool mFinished; // Indica si ha terminado la transición
|
||||
Uint8 mR, mG, mB; // Colores para el fade
|
||||
SDL_Rect mRect1; // Rectangulo usado para crear los efectos de transición
|
||||
SDL_Rect mRect2; // Rectangulo usado para crear los efectos de transición
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Fade(SDL_Renderer *renderer);
|
||||
|
||||
// Destructor
|
||||
~Fade();
|
||||
|
||||
// Inicializa las variables
|
||||
void init(Uint8 r, Uint8 g, Uint8 b);
|
||||
|
||||
// Pinta una transición en pantalla
|
||||
void render();
|
||||
|
||||
// Actualiza las variables internas
|
||||
void update();
|
||||
|
||||
// Activa el fade
|
||||
void activateFade();
|
||||
|
||||
// Comprueba si ha terminado la transicion
|
||||
bool hasEnded();
|
||||
|
||||
// Comprueba si está activo
|
||||
bool isEnabled();
|
||||
|
||||
// Establece el tipo de fade
|
||||
void setFadeType(Uint8 fadeType);
|
||||
};
|
||||
|
||||
#endif
|
||||