Compare commits
52 Commits
a1bdb6add3
...
v2.1a
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d52c45f5c | |||
| 3276027044 | |||
| 8041595976 | |||
| fa53c1b01a | |||
| 20b362160e | |||
| 5cabbfc487 | |||
| 9f5e001c70 | |||
| 112c3afc76 | |||
| f4215384fe | |||
| 7796cee51a | |||
| f83154c062 | |||
| 9e73f7f97d | |||
| 742ca02573 | |||
| d77757853d | |||
| ca7ae7418e | |||
| f880bb7d74 | |||
| 9784b5517a | |||
| 88041eba23 | |||
| 698721ae03 | |||
| c7109a46cd | |||
| bb20522172 | |||
| bebc016f3c | |||
| 56c1a1d7f3 | |||
| 50d2a5d1c7 | |||
| 83103ddfea | |||
| f4f7bb52b3 | |||
| b861f33867 | |||
| 2576d62002 | |||
| 02312e1342 | |||
| 83a34d61bf | |||
| 8076d8a765 | |||
| 901757b9b2 | |||
| f5ba15a4af | |||
| 6eda55cdae | |||
| 18c36ad3fb | |||
| a5adf1ba01 | |||
| d5ab7cbe2a | |||
| adad58ccfa | |||
| 33b7c6082e | |||
| 5fd1ffa865 | |||
| 9f93de1d06 | |||
| c3fd348a61 | |||
| ddb70c8c85 | |||
| 95d6396dfa | |||
| 99b61c4b2d | |||
| 91b868572e | |||
| 9c35fadd55 | |||
| 80ca04fd64 | |||
| 4ac7496eff | |||
| b6225d2d2f | |||
| a148c38ef8 | |||
| 902d901698 |
5
.gitignore
vendored
@@ -1,5 +1,6 @@
|
|||||||
.vscode
|
.vscode
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
bin
|
bin
|
||||||
data/config.bin
|
data/config/config.txt
|
||||||
data/score.bin
|
data/config/config.bin
|
||||||
|
data/config/score.bin
|
||||||
9
Makefile
@@ -1,11 +1,16 @@
|
|||||||
executable = coffee_crisis
|
executable = coffee_crisis
|
||||||
|
|
||||||
|
windows:
|
||||||
|
@echo off
|
||||||
|
if not exist bin\ (mkdir bin)
|
||||||
|
g++ -std=c++11 -Wall -O2 source/*.cpp -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -o bin/$(executable).exe
|
||||||
|
strip -s -R .comment -R .gnu.version bin/$(executable).exe --strip-unneeded
|
||||||
macos:
|
macos:
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
g++ -std=c++11 -Wall -O2 source/*.cpp -o bin/$(executable)_macos -lSDL2
|
g++ source/*.cpp -std=c++11 -Wall -O2 -lSDL2 -ffunction-sections -fdata-sections -o bin/$(executable)_macos
|
||||||
linux:
|
linux:
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
g++ source/*.cpp -std=c++11 -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o bin/$(executable)_linux
|
g++ source/*.cpp -std=c++11 -Wall -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
|
strip -s -R .comment -R .gnu.version bin/$(executable)_linux --strip-unneeded
|
||||||
opendingux:
|
opendingux:
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 57 KiB |
37
data/gfx/balloon1.ani
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
frameWidth=8
|
||||||
|
frameHeight=8
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=orange
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=0,1,2,3,4,5,6,7,8,9
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=blue
|
||||||
|
speed=20
|
||||||
|
loop=0
|
||||||
|
frames=12,13,14,15,16,17,18,19,20,21
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=green
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=24,25,26,27,28,29,30,31,32,33
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=red
|
||||||
|
speed=20
|
||||||
|
loop=0
|
||||||
|
frames=36,37,38,39,40,41,42,43,44,45
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=pop
|
||||||
|
speed=5
|
||||||
|
loop=-1
|
||||||
|
frames=48,49,50,51,52,53,54,55,56,57,58,59
|
||||||
|
[/animation]
|
||||||
BIN
data/gfx/balloon1.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
37
data/gfx/balloon2.ani
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
frameWidth=13
|
||||||
|
frameHeight=13
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=orange
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=0,1,2,3,4,5,6,7,8,9
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=blue
|
||||||
|
speed=20
|
||||||
|
loop=0
|
||||||
|
frames=12,13,14,15,16,17,18,19,20,21
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=green
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=24,25,26,27,28,29,30,31,32,33
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=red
|
||||||
|
speed=20
|
||||||
|
loop=0
|
||||||
|
frames=36,37,38,39,40,41,42,43,44,45
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=pop
|
||||||
|
speed=5
|
||||||
|
loop=-1
|
||||||
|
frames=48,49,50,51,52,53,54,55,56,57,58,59
|
||||||
|
[/animation]
|
||||||
BIN
data/gfx/balloon2.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
37
data/gfx/balloon3.ani
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
frameWidth=21
|
||||||
|
frameHeight=21
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=orange
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=0,1,2,3,4,5,6,7,8,9
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=blue
|
||||||
|
speed=20
|
||||||
|
loop=0
|
||||||
|
frames=12,13,14,15,16,17,18,19,20,21
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=green
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=24,25,26,27,28,29,30,31,32,33
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=red
|
||||||
|
speed=20
|
||||||
|
loop=0
|
||||||
|
frames=36,37,38,39,40,41,42,43,44,45
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=pop
|
||||||
|
speed=5
|
||||||
|
loop=-1
|
||||||
|
frames=48,49,50,51,52,53,54,55,56,57,58,59
|
||||||
|
[/animation]
|
||||||
BIN
data/gfx/balloon3.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
44
data/gfx/balloon4.ani
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
frameWidth=37
|
||||||
|
frameHeight=37
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=orange
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=0,1,2,3,4,5,6,7,8,9
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=blue
|
||||||
|
speed=20
|
||||||
|
loop=0
|
||||||
|
frames=12,13,14,15,16,17,18,19,20,21
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=green
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=24,25,26,27,28,29,30,31,32,33
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=red
|
||||||
|
speed=20
|
||||||
|
loop=0
|
||||||
|
frames=36,37,38,39,40,41,42,43,44,45
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=powerball
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=10
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=pop
|
||||||
|
speed=5
|
||||||
|
loop=-1
|
||||||
|
frames=48,49,50,51,52,53,54,55,56,57,58,59
|
||||||
|
[/animation]
|
||||||
BIN
data/gfx/balloon4.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 14 KiB |
BIN
data/gfx/game_buildings.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
data/gfx/game_clouds.png
Normal file
|
After Width: | Height: | Size: 901 B |
BIN
data/gfx/game_grass.png
Normal file
|
After Width: | Height: | Size: 468 B |
BIN
data/gfx/game_power_meter.png
Normal file
|
After Width: | Height: | Size: 270 B |
BIN
data/gfx/game_sky_colors.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 795 B After Width: | Height: | Size: 438 B |
@@ -3,7 +3,7 @@ frameHeight=16
|
|||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=default
|
name=default
|
||||||
speed=8
|
speed=10
|
||||||
loop=-1
|
loop=0
|
||||||
frames=0,1,2,3,4,5,6
|
frames=0,1
|
||||||
[/animation]
|
[/animation]
|
||||||
BIN
data/gfx/item_clock.png
Normal file
|
After Width: | Height: | Size: 334 B |
@@ -3,7 +3,7 @@ frameHeight=16
|
|||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=default
|
name=default
|
||||||
speed=8
|
speed=10
|
||||||
loop=-1
|
loop=0
|
||||||
frames=0,1,2,3,4,5,6
|
frames=0,1
|
||||||
[/animation]
|
[/animation]
|
||||||
BIN
data/gfx/item_coffee.png
Normal file
|
After Width: | Height: | Size: 462 B |
9
data/gfx/item_coffee_machine.ani
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
frameWidth=23
|
||||||
|
frameHeight=29
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=default
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=0,1,2,3
|
||||||
|
[/animation]
|
||||||
BIN
data/gfx/item_coffee_machine.png
Normal file
|
After Width: | Height: | Size: 553 B |
@@ -3,7 +3,7 @@ frameHeight=16
|
|||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=default
|
name=default
|
||||||
speed=8
|
speed=10
|
||||||
loop=-1
|
loop=0
|
||||||
frames=0,1,2,3,4,5,6
|
frames=0,1
|
||||||
[/animation]
|
[/animation]
|
||||||
BIN
data/gfx/item_points1_disk.png
Normal file
|
After Width: | Height: | Size: 263 B |
@@ -3,7 +3,7 @@ frameHeight=16
|
|||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=default
|
name=default
|
||||||
speed=8
|
speed=10
|
||||||
loop=-1
|
loop=0
|
||||||
frames=0,1,2,3,4,5,6
|
frames=0,1
|
||||||
[/animation]
|
[/animation]
|
||||||
BIN
data/gfx/item_points2_gavina.png
Normal file
|
After Width: | Height: | Size: 422 B |
9
data/gfx/item_points3_pacmar.ani
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
frameWidth=16
|
||||||
|
frameHeight=16
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=default
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=0,1
|
||||||
|
[/animation]
|
||||||
BIN
data/gfx/item_points3_pacmar.png
Normal file
|
After Width: | Height: | Size: 388 B |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.5 KiB |
BIN
data/gfx/menu_game_over.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
data/gfx/menu_game_over_end.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 654 B |
BIN
data/gfx/player_arounder_body.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
data/gfx/player_arounder_death.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
data/gfx/player_arounder_fire.png
Normal file
|
After Width: | Height: | Size: 887 B |
BIN
data/gfx/player_arounder_head.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
data/gfx/player_arounder_legs.png
Normal file
|
After Width: | Height: | Size: 443 B |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
BIN
data/gfx/player_bal1_death.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
data/gfx/player_bal1_fire.png
Normal file
|
After Width: | Height: | Size: 835 B |
BIN
data/gfx/player_bal1_head.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 529 B After Width: | Height: | Size: 529 B |
176
data/gfx/player_body.ani
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
frameWidth=24
|
||||||
|
frameHeight=24
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=walk
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=0,1,2,3
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=stand
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=4,5,6,7
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=walk_1C
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=8,9,10,11
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=stand_1C
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=12,13,14,15
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=walk_2C
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=16,17,18,19
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=stand_2C
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=20,21,22,23
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=sideshoot
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=24,25,26,27
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=centershoot
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=28,29,30,31
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=sideshoot_1C
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=32,33,34,35
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=centershoot_1C
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=36,37,38,39
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=sideshoot_2C
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=40,41,42,43
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=centershoot_2C
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=44,45,46,47
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=walk_pwr
|
||||||
|
speed=3
|
||||||
|
loop=0
|
||||||
|
frames=0,1,2,3
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=stand_pwr
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=4,5,6,7
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=walk_1C_pwr
|
||||||
|
speed=3
|
||||||
|
loop=0
|
||||||
|
frames=8,9,10,11
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=stand_1C_pwr
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=12,13,14,15
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=walk_2C_pwr
|
||||||
|
speed=3
|
||||||
|
loop=0
|
||||||
|
frames=16,17,18,19
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=stand_2C_pwr
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=20,21,22,23
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=sideshoot_pwr
|
||||||
|
speed=2
|
||||||
|
loop=0
|
||||||
|
frames=24,25,26,27
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=centershoot_pwr
|
||||||
|
speed=2
|
||||||
|
loop=0
|
||||||
|
frames=28,29,30,31
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=sideshoot_1C_pwr
|
||||||
|
speed=2
|
||||||
|
loop=0
|
||||||
|
frames=32,33,34,35
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=centershoot_1C_pwr
|
||||||
|
speed=2
|
||||||
|
loop=0
|
||||||
|
frames=36,37,38,39
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=sideshoot_2C_pwr
|
||||||
|
speed=2
|
||||||
|
loop=0
|
||||||
|
frames=40,41,42,43
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=centershoot_2C_pwr
|
||||||
|
speed=2
|
||||||
|
loop=0
|
||||||
|
frames=44,45,46,47
|
||||||
|
[/animation]
|
||||||
9
data/gfx/player_death.ani
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
frameWidth=24
|
||||||
|
frameHeight=24
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=default
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=0,1,2,3
|
||||||
|
[/animation]
|
||||||
9
data/gfx/player_fire.ani
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
frameWidth=28
|
||||||
|
frameHeight=32
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=default
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=0,1,2,3
|
||||||
|
[/animation]
|
||||||
114
data/gfx/player_head.ani
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
frameWidth=24
|
||||||
|
frameHeight=24
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=walk
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=0,1,2,3
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=stand
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=4,5,6,7
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=walk_1C
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=8,9,10,11
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=stand_1C
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=12,13,14,15
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=walk_pwr
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=16,17,18,19
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=stand_pwr
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=20,21,22,23
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=walk_1C_pwr
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=24,25,26,27
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=stand_1C_pwr
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=28,29,30,31
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=sideshoot
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=16,17,18,19
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=centershoot
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=20,21,22,23
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=sideshoot_1C
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=24,25,26,27
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=centershoot_1C
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=28,29,30,31
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=sideshoot_pwr
|
||||||
|
speed=2
|
||||||
|
loop=0
|
||||||
|
frames=16,17,18,19
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=centershoot_pwr
|
||||||
|
speed=2
|
||||||
|
loop=0
|
||||||
|
frames=20,21,22,23
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=sideshoot_1C_pwr
|
||||||
|
speed=2
|
||||||
|
loop=0
|
||||||
|
frames=24,25,26,27
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=centershoot_1C_pwr
|
||||||
|
speed=2
|
||||||
|
loop=0
|
||||||
|
frames=28,29,30,31
|
||||||
|
[/animation]
|
||||||
16
data/gfx/player_legs.ani
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
frameWidth=24
|
||||||
|
frameHeight=24
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=walk
|
||||||
|
speed=5
|
||||||
|
loop=0
|
||||||
|
frames=0,1,2,3
|
||||||
|
[/animation]
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=stand
|
||||||
|
speed=10
|
||||||
|
loop=0
|
||||||
|
frames=4,5,6,7
|
||||||
|
[/animation]
|
||||||
@@ -1,160 +1,239 @@
|
|||||||
## 0 - MENU DEL TITULO
|
## 0 - MENU DEL TITULO
|
||||||
JUGAR
|
JUGAR
|
||||||
|
|
||||||
## 1 - MENU DEL TITULO
|
## 1 - MENU DEL TITULO
|
||||||
OPCIONS
|
OPCIONS
|
||||||
|
|
||||||
## 2 - MENU DEL TITULO
|
## 2 - MENU DEL TITULO
|
||||||
INSTRUCCIONS
|
INSTRUCCIONS
|
||||||
|
|
||||||
## 3 - MENU DEL TITULO
|
## 3 - MENU DEL TITULO
|
||||||
EIXIR
|
EIXIR
|
||||||
|
|
||||||
## 4 - MENU DE OPCIONES
|
## 4 - MENU DE OPCIONES
|
||||||
FINESTRA
|
FINESTRA
|
||||||
|
|
||||||
## 5 - MENU DE OPCIONES
|
## 5 - MENU DE OPCIONES
|
||||||
PANTALLA COMPLETA
|
PANTALLA COMPLETA
|
||||||
|
|
||||||
## 6 - MENU DE OPCIONES
|
## 6 - MENU DE OPCIONES
|
||||||
PANTALLA COMPLETA FALSA
|
PANTALLA COMPLETA FALSA
|
||||||
|
|
||||||
## 7 - MENU DE OPCIONES
|
## 7 - MENU DE OPCIONES
|
||||||
TAMANY DE FINESTRA
|
TAMANY DE FINESTRA
|
||||||
|
|
||||||
## 8 - MENU DE OPCIONES
|
## 8 - MENU DE OPCIONES
|
||||||
IDIOMA
|
IDIOMA
|
||||||
|
|
||||||
## 9 - MENU DE OPCIONES
|
## 9 - MENU DE OPCIONES
|
||||||
[ ACEPTAR ]
|
[ ACEPTAR ]
|
||||||
|
|
||||||
## 10 - MENU DE OPCIONES
|
## 10 - MENU DE OPCIONES
|
||||||
[ CANCELAR ]
|
[ CANCELAR ]
|
||||||
|
|
||||||
## 11 - INSTRUCCIONES
|
## 11 - INSTRUCCIONES
|
||||||
OBJECTIU
|
OBJECTIU
|
||||||
|
|
||||||
## 12 - INSTRUCCIONES
|
## 12 - INSTRUCCIONES
|
||||||
HAS D'EXPLOTAR
|
HAS D'EXPLOTAR
|
||||||
|
|
||||||
## 13 - INSTRUCCIONES
|
## 13 - INSTRUCCIONES
|
||||||
TANTS GLOBUS COM PUGUES
|
TANTS GLOBUS COM PUGUES
|
||||||
|
|
||||||
## 14 - INSTRUCCIONES
|
## 14 - INSTRUCCIONES
|
||||||
LA DIFICULTAT AUGMENTA
|
LA DIFICULTAT AUGMENTA
|
||||||
|
|
||||||
## 15 - INSTRUCCIONES
|
## 15 - INSTRUCCIONES
|
||||||
A MESURA QUE VAS PUNTUANT
|
A MESURA QUE VAS PUNTUANT
|
||||||
|
|
||||||
## 16 - INSTRUCCIONES
|
## 16 - INSTRUCCIONES
|
||||||
OBJECTES
|
OBJECTES
|
||||||
|
|
||||||
## 17 - INSTRUCCIONES
|
## 17 - INSTRUCCIONES
|
||||||
1.000 PUNTS
|
1.000 PUNTS
|
||||||
|
|
||||||
## 18 - INSTRUCCIONES
|
## 18 - INSTRUCCIONES
|
||||||
2.500 PUNTS
|
2.500 PUNTS
|
||||||
|
|
||||||
## 19 - INSTRUCCIONES
|
## 19 - INSTRUCCIONES
|
||||||
5.000 PUNTS
|
5.000 PUNTS
|
||||||
|
|
||||||
## 20 - INSTRUCCIONES
|
## 20 - INSTRUCCIONES
|
||||||
PARA EL TEMPS
|
PARA EL TEMPS
|
||||||
|
|
||||||
## 21 - INSTRUCCIONES
|
## 21 - INSTRUCCIONES
|
||||||
VIDA EXTRA
|
VIDA EXTRA
|
||||||
|
|
||||||
## 22 - INSTRUCCIONES
|
## 22 - INSTRUCCIONES
|
||||||
PREM UNA TECLA PER A TORNAR
|
PREM UNA TECLA PER A TORNAR
|
||||||
|
|
||||||
## 23 - TITULO
|
## 23 - TITULO
|
||||||
PREM QUALSEVOL TECLA
|
PREM QUALSEVOL TECLA
|
||||||
|
|
||||||
## 24 - MENU SELECCION DE IDIOMA
|
## 24 - MENU SELECCION DE IDIOMA
|
||||||
ESPA{OL (ESPANYOL)
|
ESPA{OL (ESPANYOL)
|
||||||
|
|
||||||
## 25 - MENU SELECCION DE IDIOMA
|
## 25 - MENU SELECCION DE IDIOMA
|
||||||
BALOONCIA
|
BALOONCIA
|
||||||
|
|
||||||
## 26 - MENU SELECCION DE IDIOMA
|
## 26 - MENU SELECCION DE IDIOMA
|
||||||
ENGLISH (ANGLES)
|
ENGLISH (ANGLES)
|
||||||
|
|
||||||
## 27 - INTRO
|
## 27 - INTRO
|
||||||
Un dia qualsevol de l'any 2000
|
Un dia qualsevol de l'any 2000
|
||||||
|
|
||||||
## 28 - INTRO
|
## 28 - INTRO
|
||||||
Tot esta tranquil a la UPV
|
Tot esta tranquil a la UPV
|
||||||
|
|
||||||
## 29 - INTRO
|
## 29 - INTRO
|
||||||
Fins que un desaprensiu...
|
Fins que un desaprensiu...
|
||||||
|
|
||||||
## 30 - INTRO
|
## 30 - INTRO
|
||||||
HEY! ME ANE A FERME UN CORTAET...
|
HEY! ME ANE A FERME UN CORTAET...
|
||||||
|
|
||||||
## 31 - INTRO
|
## 31 - INTRO
|
||||||
UAAAAAAAAAAAAA!!!
|
UAAAAAAAAAAAAA!!!
|
||||||
|
|
||||||
## 32 - INTRO
|
## 32 - INTRO
|
||||||
Espera un moment...
|
Espera un moment...
|
||||||
|
|
||||||
## 33 - INTRO
|
## 33 - INTRO
|
||||||
Si resulta que no tinc solt!
|
Si resulta que no tinc solt!
|
||||||
|
|
||||||
## 34 - INTRO
|
## 34 - INTRO
|
||||||
MERDA DE MAQUINA!
|
MERDA DE MAQUINA!
|
||||||
|
|
||||||
## 35 - INTRO
|
## 35 - INTRO
|
||||||
Blop... blop... blop...
|
Blop... blop... blop...
|
||||||
|
|
||||||
## 36 - TEXTOS DEL JUEGO
|
## 36 - TEXTOS DEL JUEGO
|
||||||
Temps detes:
|
Temps detes:
|
||||||
|
|
||||||
## 37 - TEXTOS DEL JUEGO
|
## 37 - TEXTOS DEL JUEGO
|
||||||
D E M O
|
D E M O
|
||||||
|
|
||||||
## 38 - TEXTOS DEL JUEGO
|
## 38 - TEXTOS DEL JUEGO
|
||||||
fases mes!
|
fases mes!
|
||||||
## 39 -
|
|
||||||
|
|
||||||
## 40 -
|
## 39 - MENU SELECCION DE JUGADOR
|
||||||
|
Selecciona personatge
|
||||||
|
|
||||||
## 41 -
|
## 40 - MENU SELECCION DE JUGADOR
|
||||||
|
Enrere
|
||||||
|
|
||||||
|
## 41 - MENU DE PAUSA
|
||||||
|
Menu de pausa
|
||||||
|
|
||||||
## 42 -
|
## 42 -
|
||||||
|
-
|
||||||
|
|
||||||
## 43 - PANTALLA DE GAME OVER
|
## 43 - PANTALLA DE GAME OVER
|
||||||
FI DEL JOC
|
FI DEL JOC
|
||||||
|
|
||||||
## 44 - PANTALLA DE GAME OVER
|
## 44 - PANTALLA DE GAME OVER
|
||||||
ELS TEUS PUNTS:
|
ELS TEUS PUNTS:
|
||||||
|
|
||||||
## 45 - PANTALLA DE GAME OVER
|
## 45 - PANTALLA DE GAME OVER
|
||||||
CONTINUAR?
|
CONTINUAR?
|
||||||
|
|
||||||
## 46 - MENU DE PAUSA
|
## 46 - MENU DE PAUSA
|
||||||
CONTINUAR
|
CONTINUAR
|
||||||
|
|
||||||
## 47 - MENU DE PAUSA
|
## 47 - MENU DE PAUSA
|
||||||
EIXIR DEL JOC
|
EIXIR DEL JOC
|
||||||
|
|
||||||
## 48 - MENU GAME OVER
|
## 48 - MENU GAME OVER
|
||||||
SI
|
SI
|
||||||
|
|
||||||
## 49 - MENU GAME OVER
|
## 49 - MENU GAME OVER
|
||||||
NO
|
NO
|
||||||
|
|
||||||
## 50 - TEXTO DE COMPLETAR EL JUEGO
|
## 50 - TEXTO DE COMPLETAR EL JUEGO
|
||||||
Felicitats!!
|
Felicitats!!
|
||||||
|
|
||||||
## 51 - MENU DEL TITULO
|
## 51 - MENU DEL TITULO
|
||||||
1 JUGADOR
|
1 JUGADOR
|
||||||
|
|
||||||
## 52 - MENU DEL TITULO
|
## 52 - MENU DEL TITULO
|
||||||
2 JUGADORS
|
2 JUGADORS
|
||||||
|
|
||||||
## 53 MARCADOR
|
## 53 MARCADOR
|
||||||
jugador 1
|
jugador 1
|
||||||
|
|
||||||
## 54 MARCADOR
|
## 54 MARCADOR
|
||||||
jugador 2
|
jugador 2
|
||||||
|
|
||||||
## 55 MARCADOR
|
## 55 MARCADOR
|
||||||
mult
|
mult
|
||||||
|
|
||||||
## 56 MARCADOR
|
## 56 MARCADOR
|
||||||
max. puntuacio
|
max. puntuacio
|
||||||
|
|
||||||
## 57 MARCADOR
|
## 57 MARCADOR
|
||||||
fase
|
fase
|
||||||
|
|
||||||
## 58 - MENU DE OPCIONES
|
## 58 - MENU DE OPCIONES
|
||||||
MODE DE VISUALITZACIO
|
MODE DE VISUALITZACIO
|
||||||
|
|
||||||
## 59 - MENU DE OPCIONES
|
## 59 - MENU DE OPCIONES
|
||||||
DIFICULTAT
|
DIFICULTAT
|
||||||
|
|
||||||
## 60 - MENU DE OPCIONES
|
## 60 - MENU DE OPCIONES
|
||||||
FILTRE
|
FILTRE
|
||||||
|
|
||||||
## 61 - MENU DE OPCIONES
|
## 61 - MENU DE OPCIONES
|
||||||
SINC. VERTICAL
|
SINC. VERTICAL
|
||||||
|
|
||||||
## 62 - MENU DE OPCIONES
|
## 62 - MENU DE OPCIONES
|
||||||
CONTROLS DEL JUGADOR 1
|
CONTROLS DEL JUGADOR 1
|
||||||
|
|
||||||
## 63 - MENU DE OPCIONES
|
## 63 - MENU DE OPCIONES
|
||||||
CONTROLS DEL JUGADOR 2
|
CONTROLS DEL JUGADOR 2
|
||||||
|
|
||||||
## 64 -
|
## 64 -
|
||||||
|
-
|
||||||
|
|
||||||
## 65 -
|
## 65 -
|
||||||
|
-
|
||||||
|
|
||||||
## 66 - MENU DE OPCIONES
|
## 66 - MENU DE OPCIONES
|
||||||
FACIL
|
FACIL
|
||||||
|
|
||||||
## 67 - MENU DE OPCIONES
|
## 67 - MENU DE OPCIONES
|
||||||
NORMAL
|
NORMAL
|
||||||
|
|
||||||
## 68 - MENU DE OPCIONES
|
## 68 - MENU DE OPCIONES
|
||||||
DIFICIL
|
DIFICIL
|
||||||
|
|
||||||
## 69 - MENU DE OPCIONES
|
## 69 - MENU DE OPCIONES
|
||||||
TECLAT
|
TECLAT
|
||||||
|
|
||||||
## 70 - MENU DE OPCIONES
|
## 70 - MENU DE OPCIONES
|
||||||
MANDO
|
MANDO
|
||||||
|
|
||||||
## 71 - MENU DE OPCIONES
|
## 71 - MENU DE OPCIONES
|
||||||
LINEAL
|
LINEAL
|
||||||
|
|
||||||
## 72 - MENU DE OPCIONES
|
## 72 - MENU DE OPCIONES
|
||||||
NEAREST
|
NEAREST
|
||||||
|
|
||||||
## 73 - MENU DE OPCIONES
|
## 73 - MENU DE OPCIONES
|
||||||
ACTIVADA
|
ACTIVADA
|
||||||
|
|
||||||
## 74 - MENU DE OPCIONES
|
## 74 - MENU DE OPCIONES
|
||||||
DESACTIVADA
|
DESACTIVADA
|
||||||
|
|
||||||
## 75 - JUEGO
|
## 75 - JUEGO
|
||||||
Endavant!
|
Endavant!
|
||||||
|
|
||||||
## 76 - JUEGO
|
## 76 - JUEGO
|
||||||
1.000.000 de punts!
|
1.000.000 de punts!
|
||||||
|
|
||||||
## 77 - PANTALLA DE GAME OVER
|
## 77 - PANTALLA DE GAME OVER
|
||||||
PUNTS J1:
|
PUNTS J1:
|
||||||
|
|
||||||
## 78 - PANTALLA DE GAME OVER
|
## 78 - PANTALLA DE GAME OVER
|
||||||
PUNTS J2:
|
PUNTS J2:
|
||||||
|
|
||||||
## 79 - TEXTOS DEL JUEGO
|
## 79 - TEXTOS DEL JUEGO
|
||||||
Ultima fase!
|
Ultima fase!
|
||||||
@@ -1,160 +1,239 @@
|
|||||||
## 0 - MENU DEL TITULO
|
## 0 - MENU DEL TITULO
|
||||||
PLAY
|
PLAY
|
||||||
|
|
||||||
## 1 - MENU DEL TITULO
|
## 1 - MENU DEL TITULO
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
|
||||||
## 2 - MENU DEL TITULO
|
## 2 - MENU DEL TITULO
|
||||||
HOW TO PLAY
|
HOW TO PLAY
|
||||||
|
|
||||||
## 3 - MENU DEL TITULO
|
## 3 - MENU DEL TITULO
|
||||||
QUIT
|
QUIT
|
||||||
|
|
||||||
## 4 - MENU DE OPCIONES
|
## 4 - MENU DE OPCIONES
|
||||||
WINDOW
|
WINDOW
|
||||||
|
|
||||||
## 5 - MENU DE OPCIONES
|
## 5 - MENU DE OPCIONES
|
||||||
FULLSCREEN
|
FULLSCREEN
|
||||||
|
|
||||||
## 6 - MENU DE OPCIONES
|
## 6 - MENU DE OPCIONES
|
||||||
FAKE FULLSCREEN
|
FAKE FULLSCREEN
|
||||||
|
|
||||||
## 7 - MENU DE OPCIONES
|
## 7 - MENU DE OPCIONES
|
||||||
WINDOW SIZE
|
WINDOW SIZE
|
||||||
|
|
||||||
## 8 - MENU DE OPCIONES
|
## 8 - MENU DE OPCIONES
|
||||||
LANGUAGE
|
LANGUAGE
|
||||||
|
|
||||||
## 9 - MENU DE OPCIONES
|
## 9 - MENU DE OPCIONES
|
||||||
[ ACCEPT ]
|
[ ACCEPT ]
|
||||||
|
|
||||||
## 10 - MENU DE OPCIONES
|
## 10 - MENU DE OPCIONES
|
||||||
[ CANCEL ]
|
[ CANCEL ]
|
||||||
|
|
||||||
## 11 - INSTRUCCIONES
|
## 11 - INSTRUCCIONES
|
||||||
OBJECTIVE
|
OBJECTIVE
|
||||||
|
|
||||||
## 12 - INSTRUCCIONES
|
## 12 - INSTRUCCIONES
|
||||||
YOU HAVE TO POP AS MANY
|
YOU HAVE TO POP AS MANY
|
||||||
|
|
||||||
## 13 - INSTRUCCIONES
|
## 13 - INSTRUCCIONES
|
||||||
BALLOONS AS YOU CAN
|
BALLOONS AS YOU CAN
|
||||||
|
|
||||||
## 14 - INSTRUCCIONES
|
## 14 - INSTRUCCIONES
|
||||||
DIFFICULTY WILL BE INCREASED
|
DIFFICULTY WILL BE INCREASED
|
||||||
|
|
||||||
## 15 - INSTRUCCIONES
|
## 15 - INSTRUCCIONES
|
||||||
AS YOU SCORE POINTS
|
AS YOU SCORE POINTS
|
||||||
|
|
||||||
## 16 - INSTRUCCIONES
|
## 16 - INSTRUCCIONES
|
||||||
ITEMS
|
ITEMS
|
||||||
|
|
||||||
## 17 - INSTRUCCIONES
|
## 17 - INSTRUCCIONES
|
||||||
1.000 POINTS
|
1.000 POINTS
|
||||||
|
|
||||||
## 18 - INSTRUCCIONES
|
## 18 - INSTRUCCIONES
|
||||||
2.500 POINTS
|
2.500 POINTS
|
||||||
|
|
||||||
## 19 - INSTRUCCIONES
|
## 19 - INSTRUCCIONES
|
||||||
5.000 POINTS
|
5.000 POINTS
|
||||||
|
|
||||||
## 20 - INSTRUCCIONES
|
## 20 - INSTRUCCIONES
|
||||||
TIME STOPPER
|
TIME STOPPER
|
||||||
|
|
||||||
## 21 - INSTRUCCIONES
|
## 21 - INSTRUCCIONES
|
||||||
EXTRA HIT
|
EXTRA HIT
|
||||||
|
|
||||||
## 22 - INSTRUCCIONES
|
## 22 - INSTRUCCIONES
|
||||||
PRESS ANY KEY TO RETURN
|
PRESS ANY KEY TO RETURN
|
||||||
|
|
||||||
## 23 - TITULO
|
## 23 - TITULO
|
||||||
PRESS ANY KEY
|
PRESS ANY KEY
|
||||||
|
|
||||||
## 24 - MENU SELECCION DE IDIOMA
|
## 24 - MENU SELECCION DE IDIOMA
|
||||||
ESPA{OL (SPANISH)
|
ESPA{OL (SPANISH)
|
||||||
|
|
||||||
## 25 - MENU SELECCION DE IDIOMA
|
## 25 - MENU SELECCION DE IDIOMA
|
||||||
BALOONCIA (VALENCIAN)
|
BALOONCIA (VALENCIAN)
|
||||||
|
|
||||||
## 26 - MENU SELECCION DE IDIOMA
|
## 26 - MENU SELECCION DE IDIOMA
|
||||||
ENGLISH
|
ENGLISH
|
||||||
|
|
||||||
## 27 - INTRO
|
## 27 - INTRO
|
||||||
Any day of the year 2000
|
Any day of the year 2000
|
||||||
|
|
||||||
## 28 - INTRO
|
## 28 - INTRO
|
||||||
Everything is quiet at the UPV
|
Everything is quiet at the UPV
|
||||||
|
|
||||||
## 29 - INTRO
|
## 29 - INTRO
|
||||||
Until a bastard arrives...
|
Until a bastard arrives...
|
||||||
|
|
||||||
## 30 - INTRO
|
## 30 - INTRO
|
||||||
YO! GONNA TAKE A CAFELITO...
|
YO! GONNA TAKE A CAFELITO...
|
||||||
|
|
||||||
## 31 - INTRO
|
## 31 - INTRO
|
||||||
AAAAAAAARGHHHH!!!
|
AAAAAAAARGHHHH!!!
|
||||||
|
|
||||||
## 32 - INTRO
|
## 32 - INTRO
|
||||||
Wait a moment...
|
Wait a moment...
|
||||||
|
|
||||||
## 33 - INTRO
|
## 33 - INTRO
|
||||||
I don't have any loose!
|
I don't have any loose!
|
||||||
|
|
||||||
## 34 - INTRO
|
## 34 - INTRO
|
||||||
FUCKING MACHINE!
|
FUCKING MACHINE!
|
||||||
|
|
||||||
## 35 - INTRO
|
## 35 - INTRO
|
||||||
Blop... blop... blop...
|
Blop... blop... blop...
|
||||||
|
|
||||||
## 36 - TEXTOS DEL JUEGO
|
## 36 - TEXTOS DEL JUEGO
|
||||||
Time stopped:
|
Time stopped:
|
||||||
|
|
||||||
## 37 - TEXTOS DEL JUEGO
|
## 37 - TEXTOS DEL JUEGO
|
||||||
D E M O
|
D E M O
|
||||||
|
|
||||||
## 38 - TEXTOS DEL JUEGO
|
## 38 - TEXTOS DEL JUEGO
|
||||||
stages left!
|
stages left!
|
||||||
## 39 -
|
|
||||||
|
|
||||||
## 40 -
|
## 39 - MENU SELECCION DE JUGADOR
|
||||||
|
Select Player
|
||||||
|
|
||||||
## 41 -
|
## 40 - MENU SELECCION DE JUGADOR
|
||||||
|
Back
|
||||||
|
|
||||||
|
## 41 - MENU DE PAUSA
|
||||||
|
Pause Menu
|
||||||
|
|
||||||
## 42 -
|
## 42 -
|
||||||
|
-
|
||||||
|
|
||||||
## 43 - PANTALLA DE GAME OVER
|
## 43 - PANTALLA DE GAME OVER
|
||||||
GAME OVER
|
GAME OVER
|
||||||
|
|
||||||
## 44 - PANTALLA DE GAME OVER
|
## 44 - PANTALLA DE GAME OVER
|
||||||
YOUR SCORE:
|
YOUR SCORE:
|
||||||
|
|
||||||
## 45 - PANTALLA DE GAME OVER
|
## 45 - PANTALLA DE GAME OVER
|
||||||
CONTINUE?
|
CONTINUE?
|
||||||
|
|
||||||
## 46 - MENU DE PAUSA
|
## 46 - MENU DE PAUSA
|
||||||
CONTINUE
|
CONTINUE
|
||||||
|
|
||||||
## 47 - MENU DE PAUSA
|
## 47 - MENU DE PAUSA
|
||||||
LEAVE GAME
|
LEAVE GAME
|
||||||
|
|
||||||
## 48 - MENU GAME OVER
|
## 48 - MENU GAME OVER
|
||||||
YES
|
YES
|
||||||
|
|
||||||
## 49 - MENU GAME OVER
|
## 49 - MENU GAME OVER
|
||||||
NO
|
NO
|
||||||
|
|
||||||
## 50 - TEXTO DE COMPLETAR EL JUEGO
|
## 50 - TEXTO DE COMPLETAR EL JUEGO
|
||||||
Congratulations!!
|
Congratulations!!
|
||||||
|
|
||||||
## 51 - MENU DEL TITULO
|
## 51 - MENU DEL TITULO
|
||||||
1 PLAYER
|
1 PLAYER
|
||||||
|
|
||||||
## 52 - MENU DEL TITULO
|
## 52 - MENU DEL TITULO
|
||||||
2 PLAYERS
|
2 PLAYERS
|
||||||
|
|
||||||
## 53 - MARCADOR
|
## 53 - MARCADOR
|
||||||
player 1
|
player 1
|
||||||
|
|
||||||
## 54 - MARCADOR
|
## 54 - MARCADOR
|
||||||
player 2
|
player 2
|
||||||
|
|
||||||
## 55 - MARCADOR
|
## 55 - MARCADOR
|
||||||
mult
|
mult
|
||||||
|
|
||||||
## 56 - MARCADOR
|
## 56 - MARCADOR
|
||||||
high score
|
high score
|
||||||
|
|
||||||
## 57 - MARCADOR
|
## 57 - MARCADOR
|
||||||
stage
|
stage
|
||||||
|
|
||||||
## 58 - MENU DE OPCIONES
|
## 58 - MENU DE OPCIONES
|
||||||
DISPLAY MODE
|
DISPLAY MODE
|
||||||
|
|
||||||
## 59 - MENU DE OPCIONES
|
## 59 - MENU DE OPCIONES
|
||||||
DIFFICULTY
|
DIFFICULTY
|
||||||
|
|
||||||
## 60 - MENU DE OPCIONES
|
## 60 - MENU DE OPCIONES
|
||||||
FILTER
|
FILTER
|
||||||
|
|
||||||
## 61 - MENU DE OPCIONES
|
## 61 - MENU DE OPCIONES
|
||||||
VSYNC
|
VSYNC
|
||||||
|
|
||||||
## 62 - MENU DE OPCIONES
|
## 62 - MENU DE OPCIONES
|
||||||
PLAYER 1 CONTROLS
|
PLAYER 1 CONTROLS
|
||||||
|
|
||||||
## 63 - MENU DE OPCIONES
|
## 63 - MENU DE OPCIONES
|
||||||
PLAYER 2 CONTROLS
|
PLAYER 2 CONTROLS
|
||||||
|
|
||||||
## 64 -
|
## 64 -
|
||||||
|
-
|
||||||
|
|
||||||
## 65 -
|
## 65 -
|
||||||
|
-
|
||||||
|
|
||||||
## 66 - MENU DE OPCIONES
|
## 66 - MENU DE OPCIONES
|
||||||
EASY
|
EASY
|
||||||
|
|
||||||
## 67 - MENU DE OPCIONES
|
## 67 - MENU DE OPCIONES
|
||||||
NORMAL
|
NORMAL
|
||||||
|
|
||||||
## 68 - MENU DE OPCIONES
|
## 68 - MENU DE OPCIONES
|
||||||
HARD
|
HARD
|
||||||
|
|
||||||
## 69 - MENU DE OPCIONES
|
## 69 - MENU DE OPCIONES
|
||||||
KEYBOARD
|
KEYBOARD
|
||||||
|
|
||||||
## 70 - MENU DE OPCIONES
|
## 70 - MENU DE OPCIONES
|
||||||
GAME CONTROLLER
|
GAME CONTROLLER
|
||||||
|
|
||||||
## 71 - MENU DE OPCIONES
|
## 71 - MENU DE OPCIONES
|
||||||
LINEAL
|
LINEAL
|
||||||
|
|
||||||
## 72 - MENU DE OPCIONES
|
## 72 - MENU DE OPCIONES
|
||||||
NEAREST
|
NEAREST
|
||||||
|
|
||||||
## 73 - MENU DE OPCIONES
|
## 73 - MENU DE OPCIONES
|
||||||
ON
|
ON
|
||||||
|
|
||||||
## 74 - MENU DE OPCIONES
|
## 74 - MENU DE OPCIONES
|
||||||
OFF
|
OFF
|
||||||
|
|
||||||
## 75 - JUEGO
|
## 75 - JUEGO
|
||||||
Get Ready!
|
Get Ready!
|
||||||
|
|
||||||
## 76 - JUEGO
|
## 76 - JUEGO
|
||||||
1.000.000 points!
|
1.000.000 points!
|
||||||
|
|
||||||
## 77 - PANTALLA DE GAME OVER
|
## 77 - PANTALLA DE GAME OVER
|
||||||
PLAYER1 SCORE:
|
PLAYER1 SCORE:
|
||||||
|
|
||||||
## 78 - PANTALLA DE GAME OVER
|
## 78 - PANTALLA DE GAME OVER
|
||||||
PLAYER2 SCORE:
|
PLAYER2 SCORE:
|
||||||
|
|
||||||
## 79 - TEXTOS DEL JUEGO
|
## 79 - TEXTOS DEL JUEGO
|
||||||
Last stage!
|
Last stage!
|
||||||
@@ -1,160 +1,239 @@
|
|||||||
## 0 - MENU DEL TITULO
|
## 0 - MENU DEL TITULO
|
||||||
JUGAR
|
JUGAR
|
||||||
|
|
||||||
## 1 - MENU DEL TITULO
|
## 1 - MENU DEL TITULO
|
||||||
OPCIONES
|
OPCIONES
|
||||||
|
|
||||||
## 2 - MENU DEL TITULO
|
## 2 - MENU DEL TITULO
|
||||||
INSTRUCCIONES
|
INSTRUCCIONES
|
||||||
|
|
||||||
## 3 - MENU DEL TITULO
|
## 3 - MENU DEL TITULO
|
||||||
SALIR
|
SALIR
|
||||||
|
|
||||||
## 4 - MENU DE OPCIONES
|
## 4 - MENU DE OPCIONES
|
||||||
VENTANA
|
VENTANA
|
||||||
|
|
||||||
## 5 - MENU DE OPCIONES
|
## 5 - MENU DE OPCIONES
|
||||||
PANTALLA COMPLETA
|
PANTALLA COMPLETA
|
||||||
|
|
||||||
## 6 - MENU DE OPCIONES
|
## 6 - MENU DE OPCIONES
|
||||||
PANTALLA COMPLETA FALSA
|
PANTALLA COMPLETA FALSA
|
||||||
|
|
||||||
## 7 - MENU DE OPCIONES
|
## 7 - MENU DE OPCIONES
|
||||||
TAMA{O DE VENTANA
|
TAMA{O DE VENTANA
|
||||||
|
|
||||||
## 8 - MENU DE OPCIONES
|
## 8 - MENU DE OPCIONES
|
||||||
IDIOMA
|
IDIOMA
|
||||||
|
|
||||||
## 9 - MENU DE OPCIONES
|
## 9 - MENU DE OPCIONES
|
||||||
[ ACEPTAR ]
|
[ ACEPTAR ]
|
||||||
|
|
||||||
## 10 - MENU DE OPCIONES
|
## 10 - MENU DE OPCIONES
|
||||||
[ CANCELAR ]
|
[ CANCELAR ]
|
||||||
|
|
||||||
## 11 - INSTRUCCIONES
|
## 11 - INSTRUCCIONES
|
||||||
OBJETIVO
|
OBJETIVO
|
||||||
|
|
||||||
## 12 - INSTRUCCIONES
|
## 12 - INSTRUCCIONES
|
||||||
TIENES QUE EXPLOTAR
|
TIENES QUE EXPLOTAR
|
||||||
|
|
||||||
## 13 - INSTRUCCIONES
|
## 13 - INSTRUCCIONES
|
||||||
TANTOS GLOBOS COMO PUEDAS
|
TANTOS GLOBOS COMO PUEDAS
|
||||||
|
|
||||||
## 14 - INSTRUCCIONES
|
## 14 - INSTRUCCIONES
|
||||||
LA DIFICULTAD SE INCREMENTA
|
LA DIFICULTAD SE INCREMENTA
|
||||||
|
|
||||||
## 15 - INSTRUCCIONES
|
## 15 - INSTRUCCIONES
|
||||||
A MEDIDA QUE VAS PUNTUANDO
|
A MEDIDA QUE VAS PUNTUANDO
|
||||||
|
|
||||||
## 16 - INSTRUCCIONES
|
## 16 - INSTRUCCIONES
|
||||||
OBJETOS
|
OBJETOS
|
||||||
|
|
||||||
## 17 - INSTRUCCIONES
|
## 17 - INSTRUCCIONES
|
||||||
1.000 PUNTOS
|
1.000 PUNTOS
|
||||||
|
|
||||||
## 18 - INSTRUCCIONES
|
## 18 - INSTRUCCIONES
|
||||||
2.500 PUNTOS
|
2.500 PUNTOS
|
||||||
|
|
||||||
## 19 - INSTRUCCIONES
|
## 19 - INSTRUCCIONES
|
||||||
5.000 PUNTOS
|
5.000 PUNTOS
|
||||||
|
|
||||||
## 20 - INSTRUCCIONES
|
## 20 - INSTRUCCIONES
|
||||||
DETIENE EL TIEMPO
|
DETIENE EL TIEMPO
|
||||||
|
|
||||||
## 21 - INSTRUCCIONES
|
## 21 - INSTRUCCIONES
|
||||||
VIDA EXTRA
|
VIDA EXTRA
|
||||||
|
|
||||||
## 22 - INSTRUCCIONES
|
## 22 - INSTRUCCIONES
|
||||||
PULSA UNA TECLA PARA VOLVER
|
PULSA UNA TECLA PARA VOLVER
|
||||||
|
|
||||||
## 23 - TITULO
|
## 23 - TITULO
|
||||||
PULSA CUALQUIER TECLA
|
PULSA CUALQUIER TECLA
|
||||||
|
|
||||||
## 24 - MENU SELECCION DE IDIOMA
|
## 24 - MENU SELECCION DE IDIOMA
|
||||||
ESPA{OL
|
ESPA{OL
|
||||||
|
|
||||||
## 25 - MENU SELECCION DE IDIOMA
|
## 25 - MENU SELECCION DE IDIOMA
|
||||||
BALOONCIA (VALENCIANO)
|
BALOONCIA (VALENCIANO)
|
||||||
|
|
||||||
## 26 - MENU SELECCION DE IDIOMA
|
## 26 - MENU SELECCION DE IDIOMA
|
||||||
ENGLISH (INGLES)
|
ENGLISH (INGLES)
|
||||||
|
|
||||||
## 27 - INTRO
|
## 27 - INTRO
|
||||||
Un dia cualquiera del a{o 2000
|
Un dia cualquiera del a{o 2000
|
||||||
|
|
||||||
## 28 - INTRO
|
## 28 - INTRO
|
||||||
Todo esta tranquilo en la UPV
|
Todo esta tranquilo en la UPV
|
||||||
|
|
||||||
## 29 - INTRO
|
## 29 - INTRO
|
||||||
Hasta que un desaprensivo...
|
Hasta que un desaprensivo...
|
||||||
|
|
||||||
## 30 - INTRO
|
## 30 - INTRO
|
||||||
HEY! VOY A SACARME UN TALLADET...
|
HEY! VOY A SACARME UN TALLADET...
|
||||||
|
|
||||||
## 31 - INTRO
|
## 31 - INTRO
|
||||||
UAAAAAAAAAAAAA!!!
|
UAAAAAAAAAAAAA!!!
|
||||||
|
|
||||||
## 32 - INTRO
|
## 32 - INTRO
|
||||||
Espera un momento...
|
Espera un momento...
|
||||||
|
|
||||||
## 33 - INTRO
|
## 33 - INTRO
|
||||||
Si no llevo suelto encima!
|
Si no llevo suelto encima!
|
||||||
|
|
||||||
## 34 - INTRO
|
## 34 - INTRO
|
||||||
MIERDA DE MAQUINA!
|
MIERDA DE MAQUINA!
|
||||||
|
|
||||||
## 35 - INTRO
|
## 35 - INTRO
|
||||||
Blop... blop... blop...
|
Blop... blop... blop...
|
||||||
|
|
||||||
## 36 - TEXTOS DEL JUEGO
|
## 36 - TEXTOS DEL JUEGO
|
||||||
Tiempo:
|
Tiempo:
|
||||||
|
|
||||||
## 37 - TEXTOS DEL JUEGO
|
## 37 - TEXTOS DEL JUEGO
|
||||||
D E M O
|
D E M O
|
||||||
|
|
||||||
## 38 - TEXTOS DEL JUEGO
|
## 38 - TEXTOS DEL JUEGO
|
||||||
fases mas!
|
fases mas!
|
||||||
## 39 -
|
|
||||||
|
|
||||||
## 40 -
|
## 39 - MENU SELECCION DE JUGADOR
|
||||||
|
Selecciona jugador
|
||||||
|
|
||||||
## 41 -
|
## 40 - MENU SELECCION DE JUGADOR
|
||||||
|
Volver
|
||||||
|
|
||||||
|
## 41 - MENU DE PAUSA
|
||||||
|
Menu de pausa
|
||||||
|
|
||||||
## 42 -
|
## 42 -
|
||||||
|
-
|
||||||
|
|
||||||
## 43 - PANTALLA DE GAME OVER
|
## 43 - PANTALLA DE GAME OVER
|
||||||
FIN DE JUEGO
|
FIN DE JUEGO
|
||||||
|
|
||||||
## 44 - PANTALLA DE GAME OVER
|
## 44 - PANTALLA DE GAME OVER
|
||||||
TU PUNTUACION:
|
TU PUNTUACION:
|
||||||
|
|
||||||
## 45 - PANTALLA DE GAME OVER
|
## 45 - PANTALLA DE GAME OVER
|
||||||
CONTINUAR?
|
CONTINUAR?
|
||||||
|
|
||||||
## 46 - MENU DE PAUSA
|
## 46 - MENU DE PAUSA
|
||||||
CONTINUAR
|
CONTINUAR
|
||||||
|
|
||||||
## 47 - MENU DE PAUSA
|
## 47 - MENU DE PAUSA
|
||||||
SALIR DEL JUEGO
|
SALIR DEL JUEGO
|
||||||
|
|
||||||
## 48 - MENU GAME OVER
|
## 48 - MENU GAME OVER
|
||||||
SI
|
SI
|
||||||
|
|
||||||
## 49 - MENU GAME OVER
|
## 49 - MENU GAME OVER
|
||||||
NO
|
NO
|
||||||
|
|
||||||
## 50 - TEXTO DE COMPLETAR EL JUEGO
|
## 50 - TEXTO DE COMPLETAR EL JUEGO
|
||||||
Felicidades!!
|
Felicidades!!
|
||||||
|
|
||||||
## 51 - MENU DEL TITULO
|
## 51 - MENU DEL TITULO
|
||||||
1 JUGADOR
|
1 JUGADOR
|
||||||
|
|
||||||
## 52 - MENU DEL TITULO
|
## 52 - MENU DEL TITULO
|
||||||
2 JUGADORES
|
2 JUGADORES
|
||||||
|
|
||||||
## 53 - MARCADOR
|
## 53 - MARCADOR
|
||||||
jugador 1
|
jugador 1
|
||||||
|
|
||||||
## 54 - MARCADOR
|
## 54 - MARCADOR
|
||||||
jugador 2
|
jugador 2
|
||||||
|
|
||||||
## 55 - MARCADOR
|
## 55 - MARCADOR
|
||||||
mult
|
mult
|
||||||
|
|
||||||
## 56 - MARCADOR
|
## 56 - MARCADOR
|
||||||
max. puntuacion
|
max. puntuacion
|
||||||
|
|
||||||
## 57 - MARCADOR
|
## 57 - MARCADOR
|
||||||
FASE
|
FASE
|
||||||
|
|
||||||
## 58 - MENU DE OPCIONES
|
## 58 - MENU DE OPCIONES
|
||||||
MODO DE VISUALIZACION
|
MODO DE VISUALIZACION
|
||||||
|
|
||||||
## 59 - MENU DE OPCIONES
|
## 59 - MENU DE OPCIONES
|
||||||
DIFICULTAD
|
DIFICULTAD
|
||||||
|
|
||||||
## 60 - MENU DE OPCIONES
|
## 60 - MENU DE OPCIONES
|
||||||
FILTRO
|
FILTRO
|
||||||
|
|
||||||
## 61 - MENU DE OPCIONES
|
## 61 - MENU DE OPCIONES
|
||||||
SINC. VERTICAL
|
SINC. VERTICAL
|
||||||
|
|
||||||
## 62 - MENU DE OPCIONES
|
## 62 - MENU DE OPCIONES
|
||||||
CONTROLES DEL JUGADOR 1
|
CONTROLES DEL JUGADOR 1
|
||||||
|
|
||||||
## 63 - MENU DE OPCIONES
|
## 63 - MENU DE OPCIONES
|
||||||
CONTROLES DEL JUGADOR 2
|
CONTROLES DEL JUGADOR 2
|
||||||
|
|
||||||
## 64 -
|
## 64 -
|
||||||
|
-
|
||||||
|
|
||||||
## 65 -
|
## 65 -
|
||||||
|
-
|
||||||
|
|
||||||
## 66 - MENU DE OPCIONES
|
## 66 - MENU DE OPCIONES
|
||||||
FACIL
|
FACIL
|
||||||
|
|
||||||
## 67 - MENU DE OPCIONES
|
## 67 - MENU DE OPCIONES
|
||||||
NORMAL
|
NORMAL
|
||||||
|
|
||||||
## 68 - MENU DE OPCIONES
|
## 68 - MENU DE OPCIONES
|
||||||
DIFICIL
|
DIFICIL
|
||||||
|
|
||||||
## 69 - MENU DE OPCIONES
|
## 69 - MENU DE OPCIONES
|
||||||
TECLADO
|
TECLADO
|
||||||
|
|
||||||
## 70 - MENU DE OPCIONES
|
## 70 - MENU DE OPCIONES
|
||||||
MANDO
|
MANDO
|
||||||
|
|
||||||
## 71 - MENU DE OPCIONES
|
## 71 - MENU DE OPCIONES
|
||||||
LINEAL
|
LINEAL
|
||||||
|
|
||||||
## 72 - MENU DE OPCIONES
|
## 72 - MENU DE OPCIONES
|
||||||
NEAREST
|
NEAREST
|
||||||
|
|
||||||
## 73 - MENU DE OPCIONES
|
## 73 - MENU DE OPCIONES
|
||||||
ACTIVADA
|
ACTIVADA
|
||||||
|
|
||||||
## 74 - MENU DE OPCIONES
|
## 74 - MENU DE OPCIONES
|
||||||
DESACTIVADA
|
DESACTIVADA
|
||||||
|
|
||||||
## 75 - JUEGO
|
## 75 - JUEGO
|
||||||
Adelante!
|
Adelante!
|
||||||
|
|
||||||
## 76 - JUEGO
|
## 76 - JUEGO
|
||||||
1.000.000 de puntos!
|
1.000.000 de puntos!
|
||||||
|
|
||||||
## 77 - PANTALLA DE GAME OVER
|
## 77 - PANTALLA DE GAME OVER
|
||||||
PUNTUACION J1:
|
PUNTUACION J1:
|
||||||
|
|
||||||
## 78 - PANTALLA DE GAME OVER
|
## 78 - PANTALLA DE GAME OVER
|
||||||
PUNTUACION J2:
|
PUNTUACION J2:
|
||||||
|
|
||||||
## 79 - TEXTOS DEL JUEGO
|
## 79 - TEXTOS DEL JUEGO
|
||||||
Ultima fase!
|
Ultima fase!
|
||||||
29
data/menu/gameover.men
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
font_png=smb2.png
|
||||||
|
font_txt=smb2.txt
|
||||||
|
|
||||||
|
sound_move=menu_move.wav
|
||||||
|
sound_accept=menu_select.wav
|
||||||
|
|
||||||
|
name=GAME OVER
|
||||||
|
x=0
|
||||||
|
y=120
|
||||||
|
backgroundType=0
|
||||||
|
backgroundColor=128,64,0,0
|
||||||
|
|
||||||
|
areElementsCenteredOnX=true
|
||||||
|
isCenteredOnX=true
|
||||||
|
centerX=199
|
||||||
|
|
||||||
|
selector_color=255,122,0,255
|
||||||
|
selector_text_color=255,255,235
|
||||||
|
|
||||||
|
defaultActionWhenCancel=1
|
||||||
|
|
||||||
|
[item]
|
||||||
|
text=SI
|
||||||
|
hPaddingDown=2
|
||||||
|
[/item]
|
||||||
|
|
||||||
|
[item]
|
||||||
|
text=NO
|
||||||
|
[/item]
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
font_png=smb2.png
|
font_png=smb2.png
|
||||||
font_txt=smb2.txt
|
font_txt=smb2.txt
|
||||||
|
|
||||||
sound_cancel=menu_cancel.wav
|
|
||||||
sound_accept=menu_select.wav
|
|
||||||
sound_move=menu_move.wav
|
sound_move=menu_move.wav
|
||||||
|
sound_accept=menu_select.wav
|
||||||
|
|
||||||
name=OPTIONS
|
name=OPTIONS
|
||||||
x=0
|
x=0
|
||||||
@@ -20,7 +19,7 @@ isCenteredOnY=true
|
|||||||
centerY=96
|
centerY=96
|
||||||
|
|
||||||
selector_color=229,28,35,255
|
selector_color=229,28,35,255
|
||||||
selector_text_color=255,180,0
|
selector_text_color=255,241,118
|
||||||
|
|
||||||
defaultActionWhenCancel=13
|
defaultActionWhenCancel=13
|
||||||
|
|
||||||
|
|||||||
35
data/menu/pause.men
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
font_png=smb2.png
|
||||||
|
font_txt=smb2.txt
|
||||||
|
|
||||||
|
sound_move=menu_move.wav
|
||||||
|
sound_accept=menu_select.wav
|
||||||
|
|
||||||
|
name=PAUSE
|
||||||
|
x=0
|
||||||
|
y=80
|
||||||
|
backgroundType=1
|
||||||
|
backgroundColor=41,57,65,240
|
||||||
|
|
||||||
|
areElementsCenteredOnX=true
|
||||||
|
isCenteredOnX=true
|
||||||
|
centerX=128
|
||||||
|
|
||||||
|
selector_color=255,122,0,255
|
||||||
|
selector_text_color=255,255,255
|
||||||
|
|
||||||
|
defaultActionWhenCancel=1
|
||||||
|
|
||||||
|
[item]
|
||||||
|
text=PAUSE MENU
|
||||||
|
hPaddingDown=7
|
||||||
|
selectable=false
|
||||||
|
[/item]
|
||||||
|
|
||||||
|
[item]
|
||||||
|
text=CONTINUE
|
||||||
|
hPaddingDown=2
|
||||||
|
[/item]
|
||||||
|
|
||||||
|
[item]
|
||||||
|
text=LEAVE GAME
|
||||||
|
[/item]
|
||||||
40
data/menu/player_select.men
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
font_png=smb2.png
|
||||||
|
font_txt=smb2.txt
|
||||||
|
|
||||||
|
sound_move=menu_move.wav
|
||||||
|
sound_accept=menu_select.wav
|
||||||
|
|
||||||
|
name=PLAYER_SELECT
|
||||||
|
x=0
|
||||||
|
y=116
|
||||||
|
backgroundType=0
|
||||||
|
backgroundColor=48,48,64,192
|
||||||
|
|
||||||
|
areElementsCenteredOnX=true
|
||||||
|
isCenteredOnX=true
|
||||||
|
centerX=128
|
||||||
|
|
||||||
|
selector_color=229,28,35,0
|
||||||
|
selector_text_color=255,180,0
|
||||||
|
|
||||||
|
defaultActionWhenCancel=3
|
||||||
|
|
||||||
|
[item]
|
||||||
|
text=SELECT PLAYER
|
||||||
|
hPaddingDown=7
|
||||||
|
selectable=false
|
||||||
|
[/item]
|
||||||
|
|
||||||
|
[item]
|
||||||
|
text=BAL1
|
||||||
|
hPaddingDown=2
|
||||||
|
[/item]
|
||||||
|
|
||||||
|
[item]
|
||||||
|
text=AROUNDER
|
||||||
|
hPaddingDown=7
|
||||||
|
[/item]
|
||||||
|
|
||||||
|
[item]
|
||||||
|
text=BACK
|
||||||
|
[/item]
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
font_png=smb2.png
|
font_png=smb2.png
|
||||||
font_txt=smb2.txt
|
font_txt=smb2.txt
|
||||||
|
|
||||||
sound_cancel=menu_cancel.wav
|
|
||||||
sound_accept=menu_select.wav
|
|
||||||
sound_move=menu_move.wav
|
sound_move=menu_move.wav
|
||||||
|
sound_accept=menu_select.wav
|
||||||
|
|
||||||
name=TITLE
|
name=TITLE
|
||||||
x=0
|
x=0
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
|
|
||||||
#include "animatedsprite.h"
|
#include "animatedsprite.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
AnimatedSprite::AnimatedSprite(LTexture *texture, SDL_Renderer *renderer, std::string file)
|
AnimatedSprite::AnimatedSprite(LTexture *texture, SDL_Renderer *renderer, std::string file, std::vector<std::string> *buffer)
|
||||||
{
|
{
|
||||||
// Copia los punteros
|
// Copia los punteros
|
||||||
setTexture(texture);
|
setTexture(texture);
|
||||||
@@ -11,7 +10,12 @@ AnimatedSprite::AnimatedSprite(LTexture *texture, SDL_Renderer *renderer, std::s
|
|||||||
// Carga las animaciones
|
// Carga las animaciones
|
||||||
if (file != "")
|
if (file != "")
|
||||||
{
|
{
|
||||||
load(file);
|
loadFromFile(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (buffer)
|
||||||
|
{
|
||||||
|
loadFromVector(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
@@ -161,7 +165,7 @@ SDL_Rect AnimatedSprite::getAnimationClip(int indexA, Uint8 indexF)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Carga la animación desde un fichero
|
// Carga la animación desde un fichero
|
||||||
bool AnimatedSprite::load(std::string filePath)
|
bool AnimatedSprite::loadFromFile(std::string filePath)
|
||||||
{
|
{
|
||||||
int framesPerRow = 0;
|
int framesPerRow = 0;
|
||||||
int frameWidth = 0;
|
int frameWidth = 0;
|
||||||
@@ -179,7 +183,7 @@ bool AnimatedSprite::load(std::string filePath)
|
|||||||
if (file.good())
|
if (file.good())
|
||||||
{
|
{
|
||||||
// Procesa el fichero linea a linea
|
// Procesa el fichero linea a linea
|
||||||
printf("Reading file %s\n", filename.c_str());
|
std::cout << "Loading animation from file: " << filePath.c_str() << std::endl;
|
||||||
while (std::getline(file, line))
|
while (std::getline(file, line))
|
||||||
{
|
{
|
||||||
// Si la linea contiene el texto [animation] se realiza el proceso de carga de una animación
|
// Si la linea contiene el texto [animation] se realiza el proceso de carga de una animación
|
||||||
@@ -204,14 +208,17 @@ bool AnimatedSprite::load(std::string filePath)
|
|||||||
{
|
{
|
||||||
buffer.name = line.substr(pos + 1, line.length());
|
buffer.name = line.substr(pos + 1, line.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (line.substr(0, pos) == "speed")
|
else if (line.substr(0, pos) == "speed")
|
||||||
{
|
{
|
||||||
buffer.speed = std::stoi(line.substr(pos + 1, line.length()));
|
buffer.speed = std::stoi(line.substr(pos + 1, line.length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (line.substr(0, pos) == "loop")
|
else if (line.substr(0, pos) == "loop")
|
||||||
{
|
{
|
||||||
buffer.loop = std::stoi(line.substr(pos + 1, line.length()));
|
buffer.loop = std::stoi(line.substr(pos + 1, line.length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (line.substr(0, pos) == "frames")
|
else if (line.substr(0, pos) == "frames")
|
||||||
{
|
{
|
||||||
// Se introducen los valores separados por comas en un vector
|
// Se introducen los valores separados por comas en un vector
|
||||||
@@ -221,12 +228,13 @@ bool AnimatedSprite::load(std::string filePath)
|
|||||||
while (getline(ss, tmp, ','))
|
while (getline(ss, tmp, ','))
|
||||||
{
|
{
|
||||||
// Comprueba que el tile no sea mayor que el maximo indice permitido
|
// Comprueba que el tile no sea mayor que el maximo indice permitido
|
||||||
const int numTile = std::stoi(tmp) > maxTiles ? 0 : std::stoi(tmp);
|
const int numTile = std::stoi(tmp) > maxTiles ? 0 : std::stoi(tmp);
|
||||||
rect.x = (numTile % framesPerRow) * frameWidth;
|
rect.x = (numTile % framesPerRow) * frameWidth;
|
||||||
rect.y = (numTile / framesPerRow) * frameHeight;
|
rect.y = (numTile / framesPerRow) * frameHeight;
|
||||||
buffer.frames.push_back(rect);
|
buffer.frames.push_back(rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
||||||
@@ -286,7 +294,6 @@ bool AnimatedSprite::load(std::string filePath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
printf("Closing file %s\n\n", filename.c_str());
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
// El fichero no se puede abrir
|
// El fichero no se puede abrir
|
||||||
@@ -302,6 +309,144 @@ bool AnimatedSprite::load(std::string filePath)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Carga la animación desde un vector
|
||||||
|
bool AnimatedSprite::loadFromVector(std::vector<std::string> *source)
|
||||||
|
{
|
||||||
|
// Inicializa variables
|
||||||
|
int framesPerRow = 0;
|
||||||
|
int frameWidth = 0;
|
||||||
|
int frameHeight = 0;
|
||||||
|
int maxTiles = 0;
|
||||||
|
|
||||||
|
// Indicador de éxito en el proceso
|
||||||
|
bool success = true;
|
||||||
|
std::string line;
|
||||||
|
|
||||||
|
// Recorre todo el vector
|
||||||
|
int index = 0;
|
||||||
|
while (index < (int)source->size())
|
||||||
|
{
|
||||||
|
// Lee desde el vector
|
||||||
|
line = source->at(index);
|
||||||
|
|
||||||
|
// 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
|
||||||
|
{
|
||||||
|
// Aumenta el indice para leer la siguiente linea
|
||||||
|
index++;
|
||||||
|
line = source->at(index);
|
||||||
|
|
||||||
|
// 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, frameWidth, frameHeight};
|
||||||
|
while (getline(ss, tmp, ','))
|
||||||
|
{
|
||||||
|
// Comprueba que el tile no sea mayor que el maximo indice permitido
|
||||||
|
const int numTile = std::stoi(tmp) > maxTiles ? 0 : std::stoi(tmp);
|
||||||
|
rect.x = (numTile % framesPerRow) * frameWidth;
|
||||||
|
rect.y = (numTile / framesPerRow) * frameHeight;
|
||||||
|
buffer.frames.push_back(rect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Warning: unknown parameter " << line.substr(0, pos).c_str() << std::endl;
|
||||||
|
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) == "framesPerRow")
|
||||||
|
{
|
||||||
|
framesPerRow = std::stoi(line.substr(pos + 1, line.length()));
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (line.substr(0, pos) == "frameWidth")
|
||||||
|
{
|
||||||
|
frameWidth = std::stoi(line.substr(pos + 1, line.length()));
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (line.substr(0, pos) == "frameHeight")
|
||||||
|
{
|
||||||
|
frameHeight = std::stoi(line.substr(pos + 1, line.length()));
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Warning: unknown parameter " << line.substr(0, pos).c_str() << std::endl;
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normaliza valores
|
||||||
|
if (framesPerRow == 0 && frameWidth > 0)
|
||||||
|
{
|
||||||
|
framesPerRow = texture->getWidth() / frameWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxTiles == 0 && frameWidth > 0 && frameHeight > 0)
|
||||||
|
{
|
||||||
|
const int w = texture->getWidth() / frameWidth;
|
||||||
|
const int h = texture->getHeight() / frameHeight;
|
||||||
|
maxTiles = w * h;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Una vez procesada la linea, aumenta el indice para pasar a la siguiente
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pone un valor por defecto
|
||||||
|
setPos({0, 0, frameWidth, frameHeight});
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
// Establece la animacion actual
|
// Establece la animacion actual
|
||||||
void AnimatedSprite::setCurrentAnimation(std::string name)
|
void AnimatedSprite::setCurrentAnimation(std::string name)
|
||||||
{
|
{
|
||||||
@@ -348,4 +493,12 @@ void AnimatedSprite::setAnimationCounter(int value)
|
|||||||
{
|
{
|
||||||
a.counter = value;
|
a.counter = value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reinicia la animación
|
||||||
|
void AnimatedSprite::resetAnimation()
|
||||||
|
{
|
||||||
|
animation.at(currentAnimation).currentFrame = 0;
|
||||||
|
animation.at(currentAnimation).counter = 0;
|
||||||
|
animation.at(currentAnimation).completed = false;
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#ifndef ANIMATEDSPRITE_H
|
#ifndef ANIMATEDSPRITE_H
|
||||||
#define ANIMATEDSPRITE_H
|
#define ANIMATEDSPRITE_H
|
||||||
@@ -29,7 +30,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
AnimatedSprite(LTexture *texture = nullptr, SDL_Renderer *renderer = nullptr, std::string file = "");
|
AnimatedSprite(LTexture *texture = nullptr, SDL_Renderer *renderer = nullptr, std::string file = "", std::vector<std::string> *buffer = nullptr);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~AnimatedSprite();
|
~AnimatedSprite();
|
||||||
@@ -66,7 +67,10 @@ public:
|
|||||||
int getIndex(std::string name);
|
int getIndex(std::string name);
|
||||||
|
|
||||||
// Carga la animación desde un fichero
|
// Carga la animación desde un fichero
|
||||||
bool load(std::string filePath);
|
bool loadFromFile(std::string filePath);
|
||||||
|
|
||||||
|
// Carga la animación desde un vector
|
||||||
|
bool loadFromVector(std::vector<std::string> *source);
|
||||||
|
|
||||||
// Establece la animacion actual
|
// Establece la animacion actual
|
||||||
void setCurrentAnimation(std::string name = "default");
|
void setCurrentAnimation(std::string name = "default");
|
||||||
@@ -80,6 +84,9 @@ public:
|
|||||||
|
|
||||||
// OLD - Establece el contador para todas las animaciones
|
// OLD - Establece el contador para todas las animaciones
|
||||||
void setAnimationCounter(int value);
|
void setAnimationCounter(int value);
|
||||||
|
|
||||||
|
// Reinicia la animación
|
||||||
|
void resetAnimation();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "animatedsprite.h"
|
#include "animatedsprite.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#ifndef BALLOON_H
|
#ifndef BALLOON_H
|
||||||
#define BALLOON_H
|
#define BALLOON_H
|
||||||
@@ -85,37 +86,39 @@ private:
|
|||||||
std::vector<float> h; // Vector con los valores de zoom para el alto 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
|
// Objetos
|
||||||
float mPosY; // Posición en el eje Y
|
AnimatedSprite *sprite; // Sprite del objeto globo
|
||||||
Uint8 mWidth; // Ancho
|
|
||||||
Uint8 mHeight; // Alto
|
// Variables
|
||||||
float mVelX; // Velocidad en el eje X. Cantidad de pixeles a desplazarse
|
float posX; // Posición en el eje X
|
||||||
float mVelY; // Velocidad en el eje Y. Cantidad de pixeles a desplazarse
|
float posY; // Posición en el eje Y
|
||||||
float mGravity; // Aceleración en el eje Y. Modifica la velocidad
|
Uint8 width; // Ancho
|
||||||
float mDefaultVelY; // Velocidad inicial que tienen al rebotar contra el suelo
|
Uint8 height; // Alto
|
||||||
float mMaxVelY; // Máxima velocidad que puede alcanzar el objeto en el eje Y
|
float velX; // Velocidad en el eje X. Cantidad de pixeles a desplazarse
|
||||||
AnimatedSprite *mSprite; // Sprite del objeto globo
|
float velY; // Velocidad en el eje Y. Cantidad de pixeles a desplazarse
|
||||||
bool mBeingCreated; // Indica si el globo se está creando
|
float gravity; // Aceleración en el eje Y. Modifica la velocidad
|
||||||
bool mBlinking; // Indica si el globo está intermitente
|
float defaultVelY; // Velocidad inicial que tienen al rebotar contra el suelo
|
||||||
bool mEnabled; // Indica si el globo esta activo
|
float maxVelY; // Máxima velocidad que puede alcanzar el objeto en el eje Y
|
||||||
bool mInvulnerable; // Indica si el globo es invulnerable
|
bool beingCreated; // Indica si el globo se está creando
|
||||||
bool mPopping; // Indica si el globo está explotando
|
bool blinking; // Indica si el globo está intermitente
|
||||||
bool mStopped; // Indica si el globo está parado
|
bool enabled; // Indica si el globo esta activo
|
||||||
bool mVisible; // Indica si el globo es visible
|
bool invulnerable; // Indica si el globo es invulnerable
|
||||||
circle_t mCollider; // Circulo de colisión del objeto
|
bool popping; // Indica si el globo está explotando
|
||||||
Uint16 mCreationCounter; // Temporizador para controlar el estado "creandose"
|
bool stopped; // Indica si el globo está parado
|
||||||
Uint16 mCreationCounterIni; // Valor inicial para el temporizador para controlar el estado "creandose"
|
bool visible; // Indica si el globo es visible
|
||||||
Uint16 mScore; // Puntos que da el globo al ser destruido
|
circle_t collider; // Circulo de colisión del objeto
|
||||||
Uint16 mStoppedCounter; // Contador para controlar el estado "parado"
|
Uint16 creationCounter; // Temporizador para controlar el estado "creandose"
|
||||||
Uint16 mTimeToLive; // Indica el tiempo de vida que le queda al globo
|
Uint16 creationCounterIni; // Valor inicial para el temporizador para controlar el estado "creandose"
|
||||||
Uint8 mKind; // Tipo de globo
|
Uint16 score; // Puntos que da el globo al ser destruido
|
||||||
Uint8 mMenace; // Cantidad de amenaza que genera el globo
|
Uint16 stoppedCounter; // Contador para controlar el estado "parado"
|
||||||
Uint32 mCounter; // Contador interno
|
Uint8 kind; // Tipo de globo
|
||||||
float mTravelY; // Distancia que ha de recorrer el globo en el eje Y antes de que se le aplique la gravedad
|
Uint8 menace; // Cantidad de amenaza que genera el globo
|
||||||
float mSpeed; // Velocidad a la que se mueven los globos
|
Uint32 counter; // Contador interno
|
||||||
Uint8 mSize; // Tamaño del globo
|
float travelY; // Distancia que ha de recorrer el globo en el eje Y antes de que se le aplique la gravedad
|
||||||
Uint8 mPower; // Cantidad de poder que alberga el globo
|
float speed; // Velocidad a la que se mueven los globos
|
||||||
bouncing mBouncing; // Contiene las variables para el efecto de rebote
|
Uint8 size; // Tamaño del globo
|
||||||
|
Uint8 power; // Cantidad de poder que alberga el globo
|
||||||
|
bouncing bouncing; // Contiene las variables para el efecto de rebote
|
||||||
|
|
||||||
// Alinea el circulo de colisión con la posición del objeto globo
|
// Alinea el circulo de colisión con la posición del objeto globo
|
||||||
void updateColliders();
|
void updateColliders();
|
||||||
@@ -136,17 +139,11 @@ private:
|
|||||||
void updateAnimation();
|
void updateAnimation();
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void setBeingCreated(bool state);
|
void setBeingCreated(bool value);
|
||||||
|
|
||||||
// Establece el valor de la variable
|
|
||||||
void setTimeToLive(Uint16 time);
|
|
||||||
|
|
||||||
// Obtiene del valor de la variable
|
|
||||||
Uint16 getTimeToLive();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 creationtimer, LTexture *texture, SDL_Renderer *renderer);
|
Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 creationtimer, LTexture *texture, std::vector<std::string> *animation, SDL_Renderer *renderer);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Balloon();
|
~Balloon();
|
||||||
@@ -203,25 +200,25 @@ public:
|
|||||||
Uint8 getClass();
|
Uint8 getClass();
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void setStop(bool state);
|
void setStop(bool value);
|
||||||
|
|
||||||
// Obtiene del valor de la variable
|
// Obtiene del valor de la variable
|
||||||
bool isStopped();
|
bool isStopped();
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void setBlink(bool state);
|
void setBlink(bool value);
|
||||||
|
|
||||||
// Obtiene del valor de la variable
|
// Obtiene del valor de la variable
|
||||||
bool isBlinking();
|
bool isBlinking();
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void setVisible(bool state);
|
void setVisible(bool value);
|
||||||
|
|
||||||
// Obtiene del valor de la variable
|
// Obtiene del valor de la variable
|
||||||
bool isVisible();
|
bool isVisible();
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void setInvulnerable(bool state);
|
void setInvulnerable(bool value);
|
||||||
|
|
||||||
// Obtiene del valor de la variable
|
// Obtiene del valor de la variable
|
||||||
bool isInvulnerable();
|
bool isInvulnerable();
|
||||||
@@ -230,7 +227,7 @@ public:
|
|||||||
bool isBeingCreated();
|
bool isBeingCreated();
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void setPopping(bool state);
|
void setPopping(bool value);
|
||||||
|
|
||||||
// Obtiene del valor de la variable
|
// Obtiene del valor de la variable
|
||||||
bool isPopping();
|
bool isPopping();
|
||||||
|
|||||||
@@ -4,59 +4,71 @@
|
|||||||
// Constructor
|
// Constructor
|
||||||
Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, LTexture *texture, SDL_Renderer *renderer)
|
Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, LTexture *texture, SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
mSprite = new Sprite({x,y,10,10},texture, renderer);
|
sprite = new Sprite({x, y, 10, 10}, texture, renderer);
|
||||||
|
|
||||||
// Posición inicial del objeto
|
// Posición inicial del objeto
|
||||||
mPosX = x;
|
posX = x;
|
||||||
mPosY = y;
|
posY = y;
|
||||||
|
|
||||||
// Alto y ancho del objeto
|
// Alto y ancho del objeto
|
||||||
mWidth = 10;
|
width = 10;
|
||||||
mHeight = mWidth;
|
height = 10;
|
||||||
|
|
||||||
// Velocidad inicial en el eje Y
|
// Velocidad inicial en el eje Y
|
||||||
mVelY = -3;
|
velY = -3;
|
||||||
|
|
||||||
// Tipo de bala
|
// Tipo de bala
|
||||||
mKind = kind;
|
this->kind = kind;
|
||||||
|
|
||||||
// Identificador del dueño del objeto
|
// Identificador del dueño del objeto
|
||||||
mOwner = owner;
|
this->owner = owner;
|
||||||
|
|
||||||
// Valores especificos según el tipo
|
// Valores especificos según el tipo
|
||||||
switch (kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case BULLET_UP:
|
case BULLET_UP:
|
||||||
// Establece la velocidad inicial
|
// Establece la velocidad inicial
|
||||||
mVelX = 0;
|
velX = 0;
|
||||||
|
|
||||||
// Rectangulo con los gráficos del objeto
|
// Rectangulo con los gráficos del objeto
|
||||||
if (!poweredUp)
|
if (!poweredUp)
|
||||||
mSprite->setSpriteClip(0 * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
{
|
||||||
|
sprite->setSpriteClip(0 * width, 0, sprite->getWidth(), sprite->getHeight());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
mSprite->setSpriteClip((0 + 3) * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
{
|
||||||
|
sprite->setSpriteClip((0 + 3) * width, 0, sprite->getWidth(), sprite->getHeight());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BULLET_LEFT:
|
case BULLET_LEFT:
|
||||||
// Establece la velocidad inicial
|
// Establece la velocidad inicial
|
||||||
mVelX = -2;
|
velX = -2;
|
||||||
|
|
||||||
// Rectangulo con los gráficos del objeto
|
// Rectangulo con los gráficos del objeto
|
||||||
if (!poweredUp)
|
if (!poweredUp)
|
||||||
mSprite->setSpriteClip(1 * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
{
|
||||||
|
sprite->setSpriteClip(1 * width, 0, sprite->getWidth(), sprite->getHeight());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
mSprite->setSpriteClip((1 + 3) * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
{
|
||||||
|
sprite->setSpriteClip((1 + 3) * width, 0, sprite->getWidth(), sprite->getHeight());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BULLET_RIGHT:
|
case BULLET_RIGHT:
|
||||||
// Establece la velocidad inicial
|
// Establece la velocidad inicial
|
||||||
mVelX = 2;
|
velX = 2;
|
||||||
|
|
||||||
// Rectangulo con los gráficos del objeto
|
// Rectangulo con los gráficos del objeto
|
||||||
if (!poweredUp)
|
if (!poweredUp)
|
||||||
mSprite->setSpriteClip(2 * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
{
|
||||||
|
sprite->setSpriteClip(2 * width, 0, sprite->getWidth(), sprite->getHeight());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
mSprite->setSpriteClip((2 + 3) * mWidth, 0, mSprite->getWidth(), mSprite->getHeight());
|
{
|
||||||
|
sprite->setSpriteClip((2 + 3) * width, 0, sprite->getWidth(), sprite->getHeight());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -64,7 +76,7 @@ Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, LTexture *text
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece el tamaño del circulo de colisión
|
// Establece el tamaño del circulo de colisión
|
||||||
mCollider.r = mWidth / 2;
|
collider.r = width / 2;
|
||||||
|
|
||||||
// Alinea el circulo de colisión con el objeto
|
// Alinea el circulo de colisión con el objeto
|
||||||
shiftColliders();
|
shiftColliders();
|
||||||
@@ -73,14 +85,13 @@ Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, LTexture *text
|
|||||||
// Destructor
|
// Destructor
|
||||||
Bullet::~Bullet()
|
Bullet::~Bullet()
|
||||||
{
|
{
|
||||||
delete mSprite;
|
delete sprite;
|
||||||
mSprite = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pinta el objeto en pantalla
|
// Pinta el objeto en pantalla
|
||||||
void Bullet::render()
|
void Bullet::render()
|
||||||
{
|
{
|
||||||
mSprite->render();
|
sprite->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actualiza la posición y estado del objeto en horizontal
|
// Actualiza la posición y estado del objeto en horizontal
|
||||||
@@ -90,34 +101,34 @@ Uint8 Bullet::move()
|
|||||||
Uint8 msg = BULLET_MOVE_OK;
|
Uint8 msg = BULLET_MOVE_OK;
|
||||||
|
|
||||||
// Mueve el objeto a su nueva posición
|
// Mueve el objeto a su nueva posición
|
||||||
mPosX += mVelX;
|
posX += velX;
|
||||||
|
|
||||||
// Si el objeto se sale del area de juego por los laterales
|
// Si el objeto se sale del area de juego por los laterales
|
||||||
if ((mPosX < PLAY_AREA_LEFT) || (mPosX + mWidth > PLAY_AREA_RIGHT))
|
if ((posX < PLAY_AREA_LEFT - width) || (posX > PLAY_AREA_RIGHT))
|
||||||
{
|
{
|
||||||
// Se deshabilita
|
// Se deshabilita
|
||||||
mKind = NO_KIND;
|
kind = NO_KIND;
|
||||||
|
|
||||||
// Mensaje de salida
|
// Mensaje de salida
|
||||||
msg = BULLET_MOVE_OUT;
|
msg = BULLET_MOVE_OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mueve el objeto a su nueva posición en vertical
|
// Mueve el objeto a su nueva posición en vertical
|
||||||
mPosY += int(mVelY);
|
posY += int(velY);
|
||||||
|
|
||||||
// Si el objeto se sale del area de juego por la parte superior o inferior
|
// Si el objeto se sale del area de juego por la parte superior
|
||||||
if ((mPosY < PLAY_AREA_TOP) || (mPosY + mHeight > PLAY_AREA_BOTTOM))
|
if (posY < PLAY_AREA_TOP - height)
|
||||||
{
|
{
|
||||||
// Se deshabilita
|
// Se deshabilita
|
||||||
mKind = NO_KIND;
|
kind = NO_KIND;
|
||||||
|
|
||||||
// Mensaje de salida
|
// Mensaje de salida
|
||||||
msg = BULLET_MOVE_OUT;
|
msg = BULLET_MOVE_OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actualiza la posición del sprite
|
// Actualiza la posición del sprite
|
||||||
mSprite->setPosX(mPosX);
|
sprite->setPosX(posX);
|
||||||
mSprite->setPosY(mPosY);
|
sprite->setPosY(posY);
|
||||||
|
|
||||||
// Alinea el circulo de colisión con el objeto
|
// Alinea el circulo de colisión con el objeto
|
||||||
shiftColliders();
|
shiftColliders();
|
||||||
@@ -125,66 +136,76 @@ Uint8 Bullet::move()
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba si el objeto está activo
|
// Comprueba si el objeto está habilitado
|
||||||
bool Bullet::isActive()
|
bool Bullet::isEnabled()
|
||||||
{
|
{
|
||||||
if (mKind == NO_KIND)
|
if (kind == NO_KIND)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deshabilita el objeto
|
||||||
|
void Bullet::disable()
|
||||||
|
{
|
||||||
|
kind = NO_KIND;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene el valor de la variable
|
// Obtiene el valor de la variable
|
||||||
int Bullet::getPosX()
|
int Bullet::getPosX()
|
||||||
{
|
{
|
||||||
return mPosX;
|
return posX;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene el valor de la variable
|
// Obtiene el valor de la variable
|
||||||
int Bullet::getPosY()
|
int Bullet::getPosY()
|
||||||
{
|
{
|
||||||
return mPosY;
|
return posY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void Bullet::setPosX(int x)
|
void Bullet::setPosX(int x)
|
||||||
{
|
{
|
||||||
mPosX = x;
|
posX = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void Bullet::setPosY(int y)
|
void Bullet::setPosY(int y)
|
||||||
{
|
{
|
||||||
mPosY = y;
|
posY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene el valor de la variable
|
// Obtiene el valor de la variable
|
||||||
int Bullet::getVelY()
|
int Bullet::getVelY()
|
||||||
{
|
{
|
||||||
return mVelY;
|
return velY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene el valor de la variable
|
// Obtiene el valor de la variable
|
||||||
int Bullet::getKind()
|
int Bullet::getKind()
|
||||||
{
|
{
|
||||||
return mKind;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene el valor de la variable
|
// Obtiene el valor de la variable
|
||||||
int Bullet::getOwner()
|
int Bullet::getOwner()
|
||||||
{
|
{
|
||||||
return mOwner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene el circulo de colisión
|
// Obtiene el circulo de colisión
|
||||||
circle_t &Bullet::getCollider()
|
circle_t &Bullet::getCollider()
|
||||||
{
|
{
|
||||||
return mCollider;
|
return collider;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alinea el circulo de colisión con el objeto
|
// Alinea el circulo de colisión con el objeto
|
||||||
void Bullet::shiftColliders()
|
void Bullet::shiftColliders()
|
||||||
{
|
{
|
||||||
mCollider.x = mPosX + mCollider.r;
|
collider.x = posX + collider.r;
|
||||||
mCollider.y = mPosY + mCollider.r;
|
collider.y = posY + collider.r;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,16 +20,19 @@
|
|||||||
class Bullet
|
class Bullet
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int mPosX; // Posición en el eje X
|
// Objetos
|
||||||
int mPosY; // Posición en el eje Y
|
Sprite *sprite; // Sprite con los graficos y métodos de pintado
|
||||||
Uint8 mWidth; // Ancho del objeto
|
|
||||||
Uint8 mHeight; // Alto del objeto
|
// Variables
|
||||||
int mVelX; // Velocidad en el eje X
|
int posX; // Posición en el eje X
|
||||||
int mVelY; // Velocidad en el eje Y
|
int posY; // Posición en el eje Y
|
||||||
int mKind; // Tipo de objeto
|
Uint8 width; // Ancho del objeto
|
||||||
int mOwner; // Identificador del dueño del objeto
|
Uint8 height; // Alto del objeto
|
||||||
Sprite *mSprite; // Sprite con los graficos y métodos de pintado
|
int velX; // Velocidad en el eje X
|
||||||
circle_t mCollider; // Circulo de colisión del objeto
|
int velY; // Velocidad en el eje Y
|
||||||
|
int kind; // Tipo de objeto
|
||||||
|
int owner; // Identificador del dueño del objeto
|
||||||
|
circle_t collider; // Circulo de colisión del objeto
|
||||||
|
|
||||||
// Alinea el circulo de colisión con el objeto
|
// Alinea el circulo de colisión con el objeto
|
||||||
void shiftColliders();
|
void shiftColliders();
|
||||||
@@ -47,8 +50,11 @@ public:
|
|||||||
// Actualiza la posición y estado del objeto
|
// Actualiza la posición y estado del objeto
|
||||||
Uint8 move();
|
Uint8 move();
|
||||||
|
|
||||||
// Comprueba si el objeto está activo
|
// Comprueba si el objeto está habilitado
|
||||||
bool isActive();
|
bool isEnabled();
|
||||||
|
|
||||||
|
// Deshabilita el objeto
|
||||||
|
void disable();
|
||||||
|
|
||||||
// Obtiene el valor de la variable
|
// Obtiene el valor de la variable
|
||||||
int getPosX();
|
int getPosX();
|
||||||
|
|||||||
@@ -7,10 +7,8 @@
|
|||||||
// Constructor
|
// Constructor
|
||||||
Director::Director(std::string path)
|
Director::Director(std::string path)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
section.name = PROG_SECTION_GAME;
|
section.name = PROG_SECTION_LOGO;
|
||||||
section.subsection = GAME_SECTION_PLAY_1P;
|
|
||||||
|
|
||||||
// Crea el objeto que controla los ficheros de recursos
|
// Crea el objeto que controla los ficheros de recursos
|
||||||
asset = new Asset(path.substr(0, path.find_last_of("\\/")) + "/../");
|
asset = new Asset(path.substr(0, path.find_last_of("\\/")) + "/../");
|
||||||
@@ -100,7 +98,8 @@ bool Director::initSDL()
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
// Inicializa SDL
|
// Inicializa SDL
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_AUDIO) < 0)
|
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
|
||||||
|
// if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_AUDIO) < 0)
|
||||||
{
|
{
|
||||||
printf("SDL could not initialize!\nSDL Error: %s\n", SDL_GetError());
|
printf("SDL could not initialize!\nSDL Error: %s\n", SDL_GetError());
|
||||||
success = false;
|
success = false;
|
||||||
@@ -127,9 +126,13 @@ bool Director::initSDL()
|
|||||||
{
|
{
|
||||||
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
|
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
|
||||||
if (options->vSync)
|
if (options->vSync)
|
||||||
|
{
|
||||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
||||||
|
}
|
||||||
|
|
||||||
if (renderer == nullptr)
|
if (renderer == nullptr)
|
||||||
{
|
{
|
||||||
@@ -179,7 +182,6 @@ bool Director::setFileList()
|
|||||||
asset->add("data/sound/hiscore.wav", t_sound);
|
asset->add("data/sound/hiscore.wav", t_sound);
|
||||||
asset->add("data/sound/itemdrop.wav", t_sound);
|
asset->add("data/sound/itemdrop.wav", t_sound);
|
||||||
asset->add("data/sound/itempickup.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_move.wav", t_sound);
|
||||||
asset->add("data/sound/menu_select.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/player_collision.wav", t_sound);
|
||||||
@@ -189,13 +191,40 @@ bool Director::setFileList()
|
|||||||
asset->add("data/sound/powerball.wav", t_sound);
|
asset->add("data/sound/powerball.wav", t_sound);
|
||||||
|
|
||||||
// Texturas
|
// Texturas
|
||||||
asset->add("data/gfx/balloon.png", t_bitmap);
|
asset->add("data/gfx/balloon1.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/balloon1.ani", t_data);
|
||||||
|
asset->add("data/gfx/balloon2.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/balloon2.ani", t_data);
|
||||||
|
asset->add("data/gfx/balloon3.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/balloon3.ani", t_data);
|
||||||
|
asset->add("data/gfx/balloon4.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/balloon4.ani", t_data);
|
||||||
asset->add("data/gfx/bullet.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_buildings.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/game_clouds.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/game_grass.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/game_power_meter.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/game_sky_colors.png", t_bitmap);
|
||||||
asset->add("data/gfx/game_text.png", t_bitmap);
|
asset->add("data/gfx/game_text.png", t_bitmap);
|
||||||
|
|
||||||
asset->add("data/gfx/intro.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/logo.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/menu_game_over.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/menu_game_over_end.png", t_bitmap);
|
||||||
|
|
||||||
|
asset->add("data/gfx/item_points1_disk.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/item_points1_disk.ani", t_data);
|
||||||
|
asset->add("data/gfx/item_points2_gavina.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/item_points2_gavina.ani", t_data);
|
||||||
|
asset->add("data/gfx/item_points3_pacmar.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/item_points3_pacmar.ani", t_data);
|
||||||
|
asset->add("data/gfx/item_clock.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/item_clock.ani", t_data);
|
||||||
|
asset->add("data/gfx/item_coffee.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/item_coffee.ani", t_data);
|
||||||
|
asset->add("data/gfx/item_coffee_machine.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/item_coffee_machine.ani", t_data);
|
||||||
|
|
||||||
asset->add("data/gfx/title_bg_tile.png", t_bitmap);
|
asset->add("data/gfx/title_bg_tile.png", t_bitmap);
|
||||||
asset->add("data/gfx/title_coffee.png", t_bitmap);
|
asset->add("data/gfx/title_coffee.png", t_bitmap);
|
||||||
@@ -204,15 +233,23 @@ bool Director::setFileList()
|
|||||||
asset->add("data/gfx/title_dust.ani", t_data);
|
asset->add("data/gfx/title_dust.ani", t_data);
|
||||||
asset->add("data/gfx/title_gradient.png", t_bitmap);
|
asset->add("data/gfx/title_gradient.png", t_bitmap);
|
||||||
|
|
||||||
asset->add("data/gfx/player1_head.png", t_bitmap);
|
asset->add("data/gfx/player_head.ani", t_data);
|
||||||
asset->add("data/gfx/player1_body.png", t_bitmap);
|
asset->add("data/gfx/player_body.ani", t_data);
|
||||||
asset->add("data/gfx/player1_legs.png", t_bitmap);
|
asset->add("data/gfx/player_legs.ani", t_data);
|
||||||
asset->add("data/gfx/player1_death.png", t_bitmap);
|
asset->add("data/gfx/player_death.ani", t_data);
|
||||||
|
asset->add("data/gfx/player_fire.ani", t_data);
|
||||||
|
|
||||||
asset->add("data/gfx/player2_head.png", t_bitmap);
|
asset->add("data/gfx/player_bal1_head.png", t_bitmap);
|
||||||
asset->add("data/gfx/player2_body.png", t_bitmap);
|
asset->add("data/gfx/player_bal1_body.png", t_bitmap);
|
||||||
asset->add("data/gfx/player2_legs.png", t_bitmap);
|
asset->add("data/gfx/player_bal1_legs.png", t_bitmap);
|
||||||
asset->add("data/gfx/player2_death.png", t_bitmap);
|
asset->add("data/gfx/player_bal1_death.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/player_bal1_fire.png", t_bitmap);
|
||||||
|
|
||||||
|
asset->add("data/gfx/player_arounder_head.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/player_arounder_body.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/player_arounder_legs.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/player_arounder_death.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/player_arounder_fire.png", t_bitmap);
|
||||||
|
|
||||||
// Fuentes
|
// Fuentes
|
||||||
asset->add("data/font/8bithud.png", t_font);
|
asset->add("data/font/8bithud.png", t_font);
|
||||||
@@ -236,6 +273,9 @@ bool Director::setFileList()
|
|||||||
// Menus
|
// Menus
|
||||||
asset->add("data/menu/title.men", t_data);
|
asset->add("data/menu/title.men", t_data);
|
||||||
asset->add("data/menu/options.men", t_data);
|
asset->add("data/menu/options.men", t_data);
|
||||||
|
asset->add("data/menu/pause.men", t_data);
|
||||||
|
asset->add("data/menu/gameover.men", t_data);
|
||||||
|
asset->add("data/menu/player_select.men", t_data);
|
||||||
|
|
||||||
return asset->check();
|
return asset->check();
|
||||||
}
|
}
|
||||||
@@ -261,6 +301,7 @@ bool Director::loadConfigFile()
|
|||||||
options->windowSize = 3;
|
options->windowSize = 3;
|
||||||
options->language = ba_BA;
|
options->language = ba_BA;
|
||||||
options->difficulty = DIFFICULTY_NORMAL;
|
options->difficulty = DIFFICULTY_NORMAL;
|
||||||
|
options->playerSelected = 0;
|
||||||
options->filter = FILTER_NEAREST;
|
options->filter = FILTER_NEAREST;
|
||||||
options->vSync = true;
|
options->vSync = true;
|
||||||
options->screenWidth = GAME_WIDTH;
|
options->screenWidth = GAME_WIDTH;
|
||||||
|
|||||||
3606
source/game.cpp
294
source/game.h
@@ -18,6 +18,7 @@
|
|||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "writer.h"
|
#include "writer.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#ifndef GAME_H
|
#ifndef GAME_H
|
||||||
#define GAME_H
|
#define GAME_H
|
||||||
@@ -30,17 +31,13 @@
|
|||||||
#define STAGE_COUNTER 200
|
#define STAGE_COUNTER 200
|
||||||
#define SHAKE_COUNTER 10
|
#define SHAKE_COUNTER 10
|
||||||
#define HELP_COUNTER 1000
|
#define HELP_COUNTER 1000
|
||||||
|
#define GAME_COMPLETED_START_FADE 500
|
||||||
|
#define GAME_COMPLETED_END 700
|
||||||
|
|
||||||
// Formaciones enemigas
|
// Formaciones enemigas
|
||||||
#define NUMBER_OF_ENEMY_FORMATIONS 100
|
#define NUMBER_OF_ENEMY_FORMATIONS 100
|
||||||
#define MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION 50
|
#define MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION 50
|
||||||
|
|
||||||
// Cantidad de elementos del vector de SmartSprites
|
|
||||||
#define MAX_SMART_SPRITES 10
|
|
||||||
|
|
||||||
// Cantidad máxima posible de balas
|
|
||||||
#define MAX_BULLETS 50
|
|
||||||
|
|
||||||
// Porcentaje de aparición de los objetos
|
// Porcentaje de aparición de los objetos
|
||||||
#define ITEM_POINTS_1_DISK_ODDS 10
|
#define ITEM_POINTS_1_DISK_ODDS 10
|
||||||
#define ITEM_POINTS_2_GAVINA_ODDS 6
|
#define ITEM_POINTS_2_GAVINA_ODDS 6
|
||||||
@@ -50,9 +47,6 @@
|
|||||||
#define ITEM_POWER_BALL_ODDS 0
|
#define ITEM_POWER_BALL_ODDS 0
|
||||||
#define ITEM_COFFEE_MACHINE_ODDS 4
|
#define ITEM_COFFEE_MACHINE_ODDS 4
|
||||||
|
|
||||||
// Cantidad de objetos simultaneos
|
|
||||||
#define MAX_ITEMS 10
|
|
||||||
|
|
||||||
// Valores para las variables asociadas a los objetos
|
// Valores para las variables asociadas a los objetos
|
||||||
#define TIME_STOPPED_COUNTER 300
|
#define TIME_STOPPED_COUNTER 300
|
||||||
|
|
||||||
@@ -120,138 +114,144 @@ private:
|
|||||||
demoKeys_t dataFile[TOTAL_DEMO_DATA]; // Datos del fichero con los movimientos para la demo
|
demoKeys_t dataFile[TOTAL_DEMO_DATA]; // Datos del fichero con los movimientos para la demo
|
||||||
};
|
};
|
||||||
|
|
||||||
struct debug_t
|
// Objetos
|
||||||
{
|
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||||
bool enabled; // Indica si se va a mostrar la información de debug
|
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||||
Uint8 enemySet; // Escoge el set enemigo a generar
|
Asset *asset; // Objeto que gestiona todos los ficheros de recursos
|
||||||
Uint8 gradR, gradG, gradB; // Colores RGB para modificar el color del gradiente de fondo
|
Lang *lang; // Objeto para gestionar los textos en diferentes idiomas
|
||||||
float hudW, hudH; // Multiplica el tamaño del hud de debug;
|
Input *input; // Manejador de entrada
|
||||||
};
|
|
||||||
|
|
||||||
SDL_Renderer *mRenderer; // El renderizador de la ventana
|
|
||||||
Screen *mScreen; // Objeto encargado de dibujar en pantalla
|
|
||||||
Asset *mAsset; // Objeto que gestiona todos los ficheros de recursos
|
|
||||||
Lang *mLang; // Objeto para gestionar los textos en diferentes idiomas
|
|
||||||
Input *mInput; // Manejador de entrada
|
|
||||||
|
|
||||||
int mNumPlayers; // Numero de jugadores
|
|
||||||
std::vector<Player *> players; // Vector con los jugadores
|
std::vector<Player *> players; // Vector con los jugadores
|
||||||
std::vector<Balloon *> balloons; // Vector con los globos
|
std::vector<Balloon *> balloons; // Vector con los globos
|
||||||
std::vector<Bullet *> bullets; // Vector con las balas
|
std::vector<Bullet *> bullets; // Vector con las balas
|
||||||
std::vector<Item *> items; // Vector con los items
|
std::vector<Item *> items; // Vector con los items
|
||||||
std::vector<SmartSprite *> smartSprites; // Vector con los smartsprites
|
std::vector<SmartSprite *> smartSprites; // Vector con los smartsprites
|
||||||
|
|
||||||
LTexture *mTextureBalloon; // Textura para los enemigos
|
LTexture *bulletTexture; // Textura para las balas
|
||||||
LTexture *mTextureBullet; // Textura para las balas
|
std::vector<LTexture *> itemTextures; // Vector con las texturas de los items
|
||||||
LTexture *mTextureGameBG; // Textura para el fondo del juego
|
std::vector<LTexture *> balloonTextures; // Vector con las texturas de los globos
|
||||||
LTexture *mTextureGameText; // Textura para los sprites con textos
|
std::vector<LTexture *> player1Textures; // Vector con las texturas del jugador
|
||||||
LTexture *mTextureItems; // Textura para los items
|
std::vector<LTexture *> player2Textures; // Vector con las texturas del jugador
|
||||||
LTexture *mTexturePlayer1Head; // Textura para la cabeza del jugador1
|
std::vector<std::vector<LTexture *>> playerTextures; // Vector con todas las texturas de los jugadores;
|
||||||
LTexture *mTexturePlayer1Body; // Textura para el cuerpo del jugador1
|
|
||||||
LTexture *mTexturePlayer1Death; // Textura para la animación de muerte del jugador1
|
|
||||||
LTexture *mTexturePlayer1Legs; // Textura para las piernas del jugador
|
|
||||||
LTexture *mTexturePlayer2Head; // Textura para la cabeza del jugador2
|
|
||||||
LTexture *mTexturePlayer2Body; // Textura para el cuerpo del jugador2
|
|
||||||
LTexture *mTexturePlayer2Death; // Textura para la animación de muerte del jugador2
|
|
||||||
LTexture *mTexturePlayer2Legs; // Textura para las piernas del jugador
|
|
||||||
|
|
||||||
Text *mText; // Fuente para los textos del juego
|
LTexture *gameBuildingsTexture; // Textura con los edificios de fondo
|
||||||
Text *mTextBig; // Fuente de texto grande
|
LTexture *gameCloudsTexture; // Textura con las nubes de fondo
|
||||||
Text *mTextScoreBoard; // Fuente para el marcador del juego
|
LTexture *gameGrassTexture; // Textura con la hierba del suelo
|
||||||
Text *mTextNokia2; // Otra fuente de texto para mesajes
|
LTexture *gamePowerMeterTexture; // Textura con el marcador de poder de la fase
|
||||||
Text *mTextNokiaBig2; // Y la versión en grande
|
LTexture *gameSkyColorsTexture; // Textura con los diferentes colores de fondo del juego
|
||||||
|
LTexture *gameTextTexture; // Textura para los sprites con textos
|
||||||
|
LTexture *gameOverTexture; // Textura para la pantalla de game over
|
||||||
|
LTexture *gameOverEndTexture; // Textura para la pantalla de game over de acabar el juego
|
||||||
|
|
||||||
Menu *mMenuGameOver; // Menú de la pantalla de game over
|
std::vector<std::vector<std::string> *> itemAnimations; // Vector con las animaciones de los items
|
||||||
Menu *mMenuPause; // Menú de la pantalla de pausa
|
std::vector<std::vector<std::string> *> playerAnimations; // Vector con las animaciones del jugador
|
||||||
|
std::vector<std::vector<std::string> *> balloonAnimations; // Vector con las animaciones de los globos
|
||||||
|
|
||||||
Fade *mFade; // Objeto para renderizar fades
|
Text *text; // Fuente para los textos del juego
|
||||||
SDL_Event *mEventHandler; // Manejador de eventos
|
Text *textBig; // Fuente de texto grande
|
||||||
|
Text *textScoreBoard; // Fuente para el marcador del juego
|
||||||
|
Text *textNokia2; // Otra fuente de texto para mensajes
|
||||||
|
Text *textNokiaBig2; // Y la versión en grande
|
||||||
|
|
||||||
MovingSprite *mClouds1a; // Sprite para las nubes superiores
|
Menu *gameOverMenu; // Menú de la pantalla de game over
|
||||||
MovingSprite *mClouds1b; // Sprite para las nubes superiores
|
Menu *pauseMenu; // Menú de la pantalla de pausa
|
||||||
MovingSprite *mClouds2a; // Sprite para las nubes inferiores
|
|
||||||
MovingSprite *mClouds2b; // Sprite para las nubes inferiores
|
|
||||||
SmartSprite *m1000Bitmap; // Sprite con el texto 1.000
|
|
||||||
SmartSprite *m2500Bitmap; // Sprite con el texto 2.500
|
|
||||||
SmartSprite *m5000Bitmap; // Sprite con el texto 5.000
|
|
||||||
Sprite *mSpriteBackground; // Sprite con los graficos frontales del fondo
|
|
||||||
Sprite *mSpriteGetReady; // Sprite para el texto de GetReady del principio de la partida
|
|
||||||
Sprite *mSpriteGradient; // Sprite con los graficos del degradado de color de fondo
|
|
||||||
Sprite *mSpriteGrass; // Sprite para la hierba
|
|
||||||
Sprite *mSpritePowerMeter; // Sprite para el medidor de poder de la fase
|
|
||||||
Sprite *mSpriteScoreBoard; // Sprite para el fondo del marcador
|
|
||||||
|
|
||||||
JA_Sound mSoundBalloon; // Sonido para la explosión del globo
|
Fade *fade; // Objeto para renderizar fades
|
||||||
JA_Sound mSoundBullet; // Sonido para los disparos
|
SDL_Event *eventHandler; // Manejador de eventos
|
||||||
JA_Sound mSoundPlayerCollision; // Sonido para la colisión del jugador con un enemigo
|
|
||||||
JA_Sound mSoundHiScore; // Sonido para cuando se alcanza la máxima puntuación
|
|
||||||
JA_Sound mSoundItemDrop; // Sonido para cuando se genera un item
|
|
||||||
JA_Sound mSoundItemPickup; // Sonido para cuando se recoge un item
|
|
||||||
JA_Sound mSoundCoffeeOut; // Sonido para cuando el jugador pierde el café al recibir un impacto
|
|
||||||
JA_Sound mSoundStageChange; // Sonido para cuando se cambia de fase
|
|
||||||
JA_Sound mSoundBubble1; // Sonido para cuando el jugador muere
|
|
||||||
JA_Sound mSoundBubble2; // Sonido para cuando el jugador muere
|
|
||||||
JA_Sound mSoundBubble3; // Sonido para cuando el jugador muere
|
|
||||||
JA_Sound mSoundBubble4; // Sonido para cuando el jugador muere
|
|
||||||
JA_Sound mSoundClock; // Sonido para cuando se detiene el tiempo con el item reloj
|
|
||||||
JA_Sound mSoundPowerBall; // Sonido para cuando se explota una Power Ball
|
|
||||||
JA_Sound mSoundCollision; // Sonido para cuando la máquina de café toca el suelo
|
|
||||||
|
|
||||||
JA_Music mMusicPlaying; // Musica de fondo
|
MovingSprite *clouds1A; // Sprite para las nubes superiores
|
||||||
|
MovingSprite *clouds1B; // Sprite para las nubes superiores
|
||||||
|
MovingSprite *clouds2A; // Sprite para las nubes inferiores
|
||||||
|
MovingSprite *clouds2B; // Sprite para las nubes inferiores
|
||||||
|
SmartSprite *n1000Sprite; // Sprite con el texto 1.000
|
||||||
|
SmartSprite *n2500Sprite; // Sprite con el texto 2.500
|
||||||
|
SmartSprite *n5000Sprite; // Sprite con el texto 5.000
|
||||||
|
|
||||||
Uint32 mTicks; // Contador de ticks para ajustar la velocidad del programa
|
Sprite *buildingsSprite; // Sprite con los edificios de fondo
|
||||||
Uint8 mTicksSpeed; // Velocidad a la que se repiten los bucles del programa
|
Sprite *skyColorsSprite; // Sprite con los graficos del degradado de color de fondo
|
||||||
|
Sprite *grassSprite; // Sprite para la hierba
|
||||||
|
Sprite *powerMeterSprite; // Sprite para el medidor de poder de la fase
|
||||||
|
Sprite *gameOverSprite; // Sprite para dibujar los graficos del game over
|
||||||
|
Sprite *gameOverEndSprite; // Sprite para dibujar los graficos del game over de acabar el juego
|
||||||
|
|
||||||
Uint32 mHiScore; // Puntuación máxima
|
JA_Sound balloonSound; // Sonido para la explosión del globo
|
||||||
bool mHiScoreAchieved; // Indica si se ha superado la puntuación máxima
|
JA_Sound bulletSound; // Sonido para los disparos
|
||||||
section_t mSection; // Seccion actual dentro del juego
|
JA_Sound playerCollisionSound; // Sonido para la colisión del jugador con un enemigo
|
||||||
stage_t mStage[10]; // Variable con los datos de cada pantalla
|
JA_Sound hiScoreSound; // Sonido para cuando se alcanza la máxima puntuación
|
||||||
Uint8 mCurrentStage; // Indica la fase actual
|
JA_Sound itemDropSound; // Sonido para cuando se genera un item
|
||||||
Uint8 mStageBitmapCounter; // Contador para el tiempo visible del texto de Stage
|
JA_Sound itemPickUpSound; // Sonido para cuando se recoge un item
|
||||||
float mStageBitmapPath[STAGE_COUNTER]; // Vector con los puntos Y por donde se desplaza el texto
|
JA_Sound coffeeOutSound; // Sonido para cuando el jugador pierde el café al recibir un impacto
|
||||||
float mGetReadyBitmapPath[STAGE_COUNTER]; // Vector con los puntos X por donde se desplaza el texto
|
JA_Sound stageChangeSound; // Sonido para cuando se cambia de fase
|
||||||
Uint16 mDeathCounter; // Contador para la animación de muerte del jugador
|
JA_Sound bubble1Sound; // Sonido para cuando el jugador muere
|
||||||
Uint8 mDeathIndex; // Indice del vector de smartsprites que contiene el sprite del jugador
|
JA_Sound bubble2Sound; // Sonido para cuando el jugador muere
|
||||||
Uint8 mMenaceCurrent; // Nivel de amenaza actual
|
JA_Sound bubble3Sound; // Sonido para cuando el jugador muere
|
||||||
Uint8 mMenaceThreshold; // Umbral del nivel de amenaza. Si el nivel de amenaza cae por debajo del umbral, se generan más globos. Si el umbral aumenta, aumenta el numero de globos
|
JA_Sound bubble4Sound; // Sonido para cuando el jugador muere
|
||||||
bool mTimeStopped; // Indica si el tiempo está detenido
|
JA_Sound clockSound; // Sonido para cuando se detiene el tiempo con el item reloj
|
||||||
Uint16 mTimeStoppedCounter; // Temporizador para llevar la cuenta del tiempo detenido
|
JA_Sound powerBallSound; // Sonido para cuando se explota una Power Ball
|
||||||
Uint32 mCounter; // Contador para el juego
|
JA_Sound coffeeMachineSound; // Sonido para cuando la máquina de café toca el suelo
|
||||||
Uint32 mScoreDataFile[TOTAL_SCORE_DATA]; // Datos del fichero de puntos
|
|
||||||
SDL_Rect mGradientRect[4]; // Vector con las coordenadas de los 4 gradientes
|
|
||||||
Uint16 mBalloonsPopped; // Lleva la cuenta de los globos explotados
|
|
||||||
Uint8 mLastEnemyDeploy; // Guarda cual ha sido la última formación desplegada para no repetir;
|
|
||||||
int mEnemyDeployCounter; // Cuando se lanza una formación, se le da un valor y no sale otra hasta que llegue a cero
|
|
||||||
float mEnemySpeed; // Velocidad a la que se mueven los enemigos
|
|
||||||
float mDefaultEnemySpeed; // Velocidad base de los enemigos, sin incrementar
|
|
||||||
effect_t mEffect; // Variable para gestionar los efectos visuales
|
|
||||||
helper_t mHelper; // Variable para gestionar las ayudas
|
|
||||||
bool mPowerBallEnabled; // Indica si hay una powerball ya activa
|
|
||||||
Uint8 mPowerBallCounter; // Contador de formaciones enemigas entre la aparicion de una PowerBall y otra
|
|
||||||
bool mCoffeeMachineEnabled; // Indica si hay una máquina de café en el terreno de juego
|
|
||||||
Uint8 mPostFade; // Qué hacer al acabar el fade
|
|
||||||
float mSin[360]; // Vector con los valores del seno para 360 grados
|
|
||||||
bool mGameCompleted; // Indica si se ha completado la partida, llegando al final de la ultima pantalla
|
|
||||||
int mGameCompletedCounter; // Contador para el tramo final, cuando se ha completado la partida y ya no aparecen más enemigos
|
|
||||||
Uint8 mDifficulty; // Dificultad del juego
|
|
||||||
float mDifficultyScoreMultiplier; // Multiplicador de puntos en función de la dificultad
|
|
||||||
struct options_t *mOptions; // Variable con todas las variables de las opciones del programa
|
|
||||||
Uint8 mOnePlayerControl; // Variable para almacenar el valor de las opciones
|
|
||||||
enemyFormation_t mEnemyFormation[NUMBER_OF_ENEMY_FORMATIONS]; // Vector con todas las formaciones enemigas
|
|
||||||
enemyPool_t mEnemyPool[10]; // Variable con los diferentes conjuntos de formaciones enemigas
|
|
||||||
Uint8 mLastStageReached; // Contiene el numero de la última pantalla que se ha alcanzado
|
|
||||||
|
|
||||||
demo_t mDemo; // Variable con todas las variables relacionadas con el modo demo
|
JA_Music gameMusic; // Musica de fondo
|
||||||
debug_t mDebug; // Variable con las opciones de debug
|
|
||||||
|
|
||||||
// Inicializa el vector con los valores del seno
|
// Variables
|
||||||
void initSin();
|
int numPlayers; // Numero de jugadores
|
||||||
|
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||||
|
Uint8 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||||
|
Uint32 hiScore; // Puntuación máxima
|
||||||
|
bool hiScoreAchieved; // Indica si se ha superado la puntuación máxima
|
||||||
|
section_t section; // Seccion actual dentro del juego
|
||||||
|
stage_t stage[10]; // Variable con los datos de cada pantalla
|
||||||
|
Uint8 currentStage; // Indica la fase actual
|
||||||
|
Uint8 stageBitmapCounter; // Contador para el tiempo visible del texto de Stage
|
||||||
|
float stageBitmapPath[STAGE_COUNTER]; // Vector con los puntos Y por donde se desplaza el texto
|
||||||
|
float getReadyBitmapPath[STAGE_COUNTER]; // Vector con los puntos X por donde se desplaza el texto
|
||||||
|
Uint16 deathCounter; // Contador para la animación de muerte del jugador
|
||||||
|
Uint8 menaceCurrent; // Nivel de amenaza actual
|
||||||
|
Uint8 menaceThreshold; // Umbral del nivel de amenaza. Si el nivel de amenaza cae por debajo del umbral, se generan más globos. Si el umbral aumenta, aumenta el numero de globos
|
||||||
|
bool timeStopped; // Indica si el tiempo está detenido
|
||||||
|
Uint16 timeStoppedCounter; // Temporizador para llevar la cuenta del tiempo detenido
|
||||||
|
Uint32 counter; // Contador para el juego
|
||||||
|
Uint32 scoreDataFile[TOTAL_SCORE_DATA]; // Datos del fichero de puntos
|
||||||
|
SDL_Rect skyColorsRect[4]; // Vector con las coordenadas de los 4 colores de cielo
|
||||||
|
Uint16 balloonsPopped; // Lleva la cuenta de los globos explotados
|
||||||
|
Uint8 lastEnemyDeploy; // Guarda cual ha sido la última formación desplegada para no repetir;
|
||||||
|
int enemyDeployCounter; // Cuando se lanza una formación, se le da un valor y no sale otra hasta que llegue a cero
|
||||||
|
float enemySpeed; // Velocidad a la que se mueven los enemigos
|
||||||
|
float defaultEnemySpeed; // Velocidad base de los enemigos, sin incrementar
|
||||||
|
effect_t effect; // Variable para gestionar los efectos visuales
|
||||||
|
helper_t helper; // Variable para gestionar las ayudas
|
||||||
|
bool powerBallEnabled; // Indica si hay una powerball ya activa
|
||||||
|
Uint8 powerBallCounter; // Contador de formaciones enemigas entre la aparicion de una PowerBall y otra
|
||||||
|
bool coffeeMachineEnabled; // Indica si hay una máquina de café en el terreno de juego
|
||||||
|
bool gameCompleted; // Indica si se ha completado la partida, llegando al final de la ultima pantalla
|
||||||
|
int gameCompletedCounter; // Contador para el tramo final, cuando se ha completado la partida y ya no aparecen más enemigos
|
||||||
|
Uint8 difficulty; // Dificultad del juego
|
||||||
|
float difficultyScoreMultiplier; // Multiplicador de puntos en función de la dificultad
|
||||||
|
color_t difficultyColor; // Color asociado a la dificultad
|
||||||
|
struct options_t *options; // Variable con todas las variables de las opciones del programa
|
||||||
|
Uint8 onePlayerControl; // Variable para almacenar el valor de las opciones
|
||||||
|
enemyFormation_t enemyFormation[NUMBER_OF_ENEMY_FORMATIONS]; // Vector con todas las formaciones enemigas
|
||||||
|
enemyPool_t enemyPool[10]; // Variable con los diferentes conjuntos de formaciones enemigas
|
||||||
|
Uint8 lastStageReached; // Contiene el numero de la última pantalla que se ha alcanzado
|
||||||
|
demo_t demo; // Variable con todas las variables relacionadas con el modo demo
|
||||||
|
int totalPowerToCompleteGame; // La suma del poder necesario para completar todas las fases
|
||||||
|
int cloudsSpeed; // Velocidad a la que se desplazan las nubes
|
||||||
|
int pauseCounter; // Contador para salir del menu de pausa y volver al juego
|
||||||
|
bool leavingPauseMenu; // Indica si esta saliendo del menu de pausa para volver al juego
|
||||||
|
|
||||||
|
// Actualiza el juego
|
||||||
|
void update();
|
||||||
|
|
||||||
|
// Dibuja el juego
|
||||||
|
void render();
|
||||||
|
|
||||||
|
// Comprueba los eventos que hay en cola
|
||||||
|
void checkEventHandler();
|
||||||
|
|
||||||
// Inicializa las variables necesarias para la sección 'Game'
|
// Inicializa las variables necesarias para la sección 'Game'
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
// Carga los recursos necesarios para la sección 'Game'
|
// Carga los recursos necesarios para la sección 'Game'
|
||||||
bool loadMedia();
|
void loadMedia();
|
||||||
|
|
||||||
// Carga el fichero de puntos
|
// Carga el fichero de puntos
|
||||||
bool loadScoreFile();
|
bool loadScoreFile();
|
||||||
@@ -293,7 +293,10 @@ private:
|
|||||||
void renderScoreBoard();
|
void renderScoreBoard();
|
||||||
|
|
||||||
// Actualiza las variables del jugador
|
// Actualiza las variables del jugador
|
||||||
void updatePlayer();
|
void updatePlayers();
|
||||||
|
|
||||||
|
// Dibuja a los jugadores
|
||||||
|
void renderPlayers();
|
||||||
|
|
||||||
// Actualiza las variables de la fase
|
// Actualiza las variables de la fase
|
||||||
void updateStage();
|
void updateStage();
|
||||||
@@ -311,7 +314,7 @@ private:
|
|||||||
void renderBalloons();
|
void renderBalloons();
|
||||||
|
|
||||||
// Crea un globo nuevo en el vector de globos
|
// Crea un globo nuevo en el vector de globos
|
||||||
Uint8 createNewBalloon(float x, int y, Uint8 kind, float velx, float speed, Uint16 stoppedcounter, LTexture *texture);
|
Uint8 createBalloon(float x, int y, Uint8 kind, float velx, float speed, Uint16 stoppedcounter);
|
||||||
|
|
||||||
// Crea una PowerBall
|
// Crea una PowerBall
|
||||||
void createPowerBall();
|
void createPowerBall();
|
||||||
@@ -349,6 +352,9 @@ private:
|
|||||||
// Obtiene el numero de globos activos
|
// Obtiene el numero de globos activos
|
||||||
Uint8 countBalloons();
|
Uint8 countBalloons();
|
||||||
|
|
||||||
|
// Vacia el vector de globos
|
||||||
|
void freeBalloons();
|
||||||
|
|
||||||
// Comprueba la colisión entre el jugador y los globos activos
|
// Comprueba la colisión entre el jugador y los globos activos
|
||||||
bool checkPlayerBalloonCollision(Player *player);
|
bool checkPlayerBalloonCollision(Player *player);
|
||||||
|
|
||||||
@@ -367,6 +373,9 @@ private:
|
|||||||
// Crea un objeto bala
|
// Crea un objeto bala
|
||||||
void createBullet(int x, int y, Uint8 kind, bool poweredUp, int owner);
|
void createBullet(int x, int y, Uint8 kind, bool poweredUp, int owner);
|
||||||
|
|
||||||
|
// Vacia el vector de balas
|
||||||
|
void freeBullets();
|
||||||
|
|
||||||
// Actualiza los items
|
// Actualiza los items
|
||||||
void updateItems();
|
void updateItems();
|
||||||
|
|
||||||
@@ -377,11 +386,17 @@ private:
|
|||||||
Uint8 dropItem();
|
Uint8 dropItem();
|
||||||
|
|
||||||
// Crea un objeto item
|
// Crea un objeto item
|
||||||
void createItem(LTexture *texture, SDL_Renderer *renderer, Uint8 type, float x, float y);
|
void createItem(Uint8 kind, float x, float y);
|
||||||
|
|
||||||
|
// Vacia el vector de items
|
||||||
|
void freeItems();
|
||||||
|
|
||||||
// Crea un objeto SmartSprite
|
// Crea un objeto SmartSprite
|
||||||
void createItemScoreSprite(int x, int y, SmartSprite *sprite);
|
void createItemScoreSprite(int x, int y, SmartSprite *sprite);
|
||||||
|
|
||||||
|
// Vacia el vector de smartsprites
|
||||||
|
void freeSmartSprites();
|
||||||
|
|
||||||
// Dibuja el efecto de flash
|
// Dibuja el efecto de flash
|
||||||
void renderFlashEffect();
|
void renderFlashEffect();
|
||||||
|
|
||||||
@@ -391,9 +406,6 @@ private:
|
|||||||
// Crea un SmartSprite para arrojar el item café al recibir un impacto
|
// Crea un SmartSprite para arrojar el item café al recibir un impacto
|
||||||
void throwCoffee(int x, int y);
|
void throwCoffee(int x, int y);
|
||||||
|
|
||||||
// Crea un SmartSprite para arrojar al jugador al morir
|
|
||||||
void throwPlayer(int x, int y, Player *player);
|
|
||||||
|
|
||||||
// Actualiza los SmartSprites
|
// Actualiza los SmartSprites
|
||||||
void updateSmartSprites();
|
void updateSmartSprites();
|
||||||
|
|
||||||
@@ -433,18 +445,12 @@ private:
|
|||||||
// Gestiona el nivel de amenaza
|
// Gestiona el nivel de amenaza
|
||||||
void updateMenace();
|
void updateMenace();
|
||||||
|
|
||||||
// Actualiza el campo de juego
|
|
||||||
void updatePlayField();
|
|
||||||
|
|
||||||
// Actualiza el fondo
|
// Actualiza el fondo
|
||||||
void updateBackground();
|
void updateBackground();
|
||||||
|
|
||||||
// Dibuja el fondo
|
// Dibuja el fondo
|
||||||
void renderBackground();
|
void renderBackground();
|
||||||
|
|
||||||
// Dibuja el campo de juego
|
|
||||||
void renderPlayField();
|
|
||||||
|
|
||||||
// Gestiona la entrada durante el juego
|
// Gestiona la entrada durante el juego
|
||||||
void checkGameInput();
|
void checkGameInput();
|
||||||
|
|
||||||
@@ -460,15 +466,24 @@ private:
|
|||||||
// Agita la pantalla
|
// Agita la pantalla
|
||||||
void shakeScreen();
|
void shakeScreen();
|
||||||
|
|
||||||
|
// Actualiza las variables del menu de pausa del juego
|
||||||
|
void updatePausedGame();
|
||||||
|
|
||||||
|
// Dibuja el menu de pausa del juego
|
||||||
|
void renderPausedGame();
|
||||||
|
|
||||||
// Bucle para el menu de pausa del juego
|
// Bucle para el menu de pausa del juego
|
||||||
void runPausedGame();
|
void runPausedGame();
|
||||||
|
|
||||||
|
// Actualiza los elementos de la pantalla de game over
|
||||||
|
void updateGameOverScreen();
|
||||||
|
|
||||||
|
// Dibuja los elementos de la pantalla de game over
|
||||||
|
void renderGameOverScreen();
|
||||||
|
|
||||||
// Bucle para la pantalla de game over
|
// Bucle para la pantalla de game over
|
||||||
void runGameOverScreen();
|
void runGameOverScreen();
|
||||||
|
|
||||||
// Dibuja la informacion de debug en pantalla
|
|
||||||
void renderDebugInfo();
|
|
||||||
|
|
||||||
// Indica si se puede crear una powerball
|
// Indica si se puede crear una powerball
|
||||||
bool canPowerBallBeCreated();
|
bool canPowerBallBeCreated();
|
||||||
|
|
||||||
@@ -487,9 +502,18 @@ private:
|
|||||||
// Comprueba si todos los jugadores han muerto
|
// Comprueba si todos los jugadores han muerto
|
||||||
bool allPlayersAreDead();
|
bool allPlayersAreDead();
|
||||||
|
|
||||||
|
// Carga las animaciones
|
||||||
|
void loadAnimations(std::string filePath, std::vector<std::string> *buffer);
|
||||||
|
|
||||||
|
// Elimina todos los objetos contenidos en vectores
|
||||||
|
void deleteAllVectorObjects();
|
||||||
|
|
||||||
|
// Recarga las texturas
|
||||||
|
void reloadTextures();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *screen, Asset *mAsset, Lang *lang, Input *input, bool demo, options_t *options);
|
Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang, Input *input, bool demo, options_t *options);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Game();
|
~Game();
|
||||||
|
|||||||
@@ -3,212 +3,248 @@
|
|||||||
const Uint8 SELF = 0;
|
const Uint8 SELF = 0;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Instructions::Instructions(SDL_Renderer *renderer, Screen *screen, Asset *mAsset, Lang *lang)
|
Instructions::Instructions(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang)
|
||||||
{
|
{
|
||||||
// Copia los punteros
|
// Copia los punteros
|
||||||
mRenderer = renderer;
|
this->renderer = renderer;
|
||||||
mScreen = screen;
|
this->screen = screen;
|
||||||
this->mAsset = mAsset;
|
this->asset = asset;
|
||||||
mLang = lang;
|
this->lang = lang;
|
||||||
|
|
||||||
// Reserva memoria para los punteros
|
// Reserva memoria para los punteros
|
||||||
mEventHandler = new SDL_Event();
|
LTexture *item1 = new LTexture(renderer, asset->get("item_points1_disk.png"));
|
||||||
mItemTexture = new LTexture(mRenderer,mAsset->get("items.png"));
|
itemTextures.push_back(item1);
|
||||||
mSprite = new Sprite(0, 0, GAME_WIDTH, GAME_HEIGHT, mItemTexture, mRenderer);
|
|
||||||
mText = new Text(mAsset->get("smb2.png"), mAsset->get("smb2.txt"), mRenderer);
|
LTexture *item2 = new LTexture(renderer, asset->get("item_points2_gavina.png"));
|
||||||
|
itemTextures.push_back(item2);
|
||||||
|
|
||||||
|
LTexture *item3 = new LTexture(renderer, asset->get("item_points3_pacmar.png"));
|
||||||
|
itemTextures.push_back(item3);
|
||||||
|
|
||||||
|
LTexture *item4 = new LTexture(renderer, asset->get("item_clock.png"));
|
||||||
|
itemTextures.push_back(item4);
|
||||||
|
|
||||||
|
LTexture *item5 = new LTexture(renderer, asset->get("item_coffee.png"));
|
||||||
|
itemTextures.push_back(item5);
|
||||||
|
|
||||||
|
LTexture *item6 = new LTexture(renderer, asset->get("item_coffee_machine.png"));
|
||||||
|
itemTextures.push_back(item6);
|
||||||
|
|
||||||
|
eventHandler = new SDL_Event();
|
||||||
|
|
||||||
|
sprite = new Sprite(0, 0, 16, 16, itemTextures.at(0), renderer);
|
||||||
|
text = new Text(asset->get("smb2.png"), asset->get("smb2.txt"), renderer);
|
||||||
|
|
||||||
// Crea un backbuffer para el renderizador
|
// Crea un backbuffer para el renderizador
|
||||||
mBackbuffer = SDL_CreateTexture(mRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAME_WIDTH, GAME_HEIGHT);
|
backbuffer = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAME_WIDTH, GAME_HEIGHT);
|
||||||
if (mBackbuffer == nullptr)
|
if (backbuffer == nullptr)
|
||||||
{
|
{
|
||||||
printf("Backbuffer could not be created!\nSDL Error: %s\n", SDL_GetError());
|
printf("Backbuffer could not be created!\nSDL Error: %s\n", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inicializa variables
|
||||||
|
section.name = SELF;
|
||||||
|
ticks = 0;
|
||||||
|
ticksSpeed = 15;
|
||||||
|
manualQuit = false;
|
||||||
|
counter = 0;
|
||||||
|
counterEnd = 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
Instructions::~Instructions()
|
Instructions::~Instructions()
|
||||||
{
|
{
|
||||||
mRenderer = nullptr;
|
for (auto texture : itemTextures)
|
||||||
mScreen = nullptr;
|
{
|
||||||
mAsset = nullptr;
|
texture->unload();
|
||||||
mLang = nullptr;
|
delete texture;
|
||||||
|
}
|
||||||
|
itemTextures.clear();
|
||||||
|
|
||||||
mItemTexture->unload();
|
delete sprite;
|
||||||
delete mItemTexture;
|
delete eventHandler;
|
||||||
mItemTexture = nullptr;
|
delete text;
|
||||||
|
|
||||||
delete mSprite;
|
SDL_DestroyTexture(backbuffer);
|
||||||
mSprite = nullptr;
|
|
||||||
|
|
||||||
delete mEventHandler;
|
|
||||||
mEventHandler = nullptr;
|
|
||||||
|
|
||||||
delete mText;
|
|
||||||
mText = nullptr;
|
|
||||||
|
|
||||||
SDL_DestroyTexture(mBackbuffer);
|
|
||||||
mBackbuffer = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inicializa las variables necesarias para la sección 'Instructions'
|
// Actualiza las variables
|
||||||
void Instructions::init()
|
void Instructions::update()
|
||||||
{
|
{
|
||||||
// Inicializa variables
|
// Comprueba los eventos
|
||||||
mSection.name = SELF;
|
checkEventHandler();
|
||||||
mTicks = 0;
|
|
||||||
mTicksSpeed = 15;
|
// Actualiza las variables
|
||||||
mManualQuit = false;
|
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||||
mCounter = 0;
|
{
|
||||||
|
// Actualiza el contador de ticks
|
||||||
|
ticks = SDL_GetTicks();
|
||||||
|
|
||||||
|
if (mode == m_auto)
|
||||||
|
{ // Modo automático
|
||||||
|
counter++;
|
||||||
|
|
||||||
|
if (counter == counterEnd)
|
||||||
|
{
|
||||||
|
section.name = PROG_SECTION_TITLE;
|
||||||
|
section.subsection = TITLE_SECTION_1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Modo manual
|
||||||
|
++counter %= 60000;
|
||||||
|
|
||||||
|
if (manualQuit)
|
||||||
|
{
|
||||||
|
section.name = PROG_SECTION_TITLE;
|
||||||
|
section.subsection = TITLE_SECTION_3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pinta en pantalla
|
||||||
|
void Instructions::render()
|
||||||
|
{
|
||||||
|
// Pinta en pantalla
|
||||||
|
SDL_Rect window = {0, 0, GAME_WIDTH, GAME_HEIGHT};
|
||||||
|
SDL_Rect srcRect = {0, 0, 16, 16};
|
||||||
|
|
||||||
|
const color_t orangeColor = {0xFF, 0x7A, 0x00};
|
||||||
|
|
||||||
|
const SDL_Rect destRect1 = {60, 88 + (16 * 0), 16, 16}; // Disquito
|
||||||
|
const SDL_Rect destRect2 = {60, 88 + (16 * 1), 16, 16}; // Gavineixon
|
||||||
|
const SDL_Rect destRect3 = {60, 88 + (16 * 2), 16, 16}; // Pacmar
|
||||||
|
const SDL_Rect destRect4 = {60, 88 + (16 * 3), 16, 16}; // Time Stopper
|
||||||
|
const SDL_Rect destRect5 = {60, 88 + (16 * 4), 16, 16}; // Coffee
|
||||||
|
|
||||||
|
// Pinta en el backbuffer el texto y los sprites
|
||||||
|
SDL_SetRenderTarget(renderer, backbuffer);
|
||||||
|
SDL_SetRenderDrawColor(renderer, bgColor.r, bgColor.g, bgColor.b, 255);
|
||||||
|
SDL_RenderClear(renderer);
|
||||||
|
|
||||||
|
// Escribe el texto
|
||||||
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 8, lang->getText(11), 1, orangeColor, 1, shdwTxtColor);
|
||||||
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 24, lang->getText(12), 1, noColor, 1, shdwTxtColor);
|
||||||
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 34, lang->getText(13), 1, noColor, 1, shdwTxtColor);
|
||||||
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 48, lang->getText(14), 1, noColor, 1, shdwTxtColor);
|
||||||
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 58, lang->getText(15), 1, noColor, 1, shdwTxtColor);
|
||||||
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 75, lang->getText(16), 1, orangeColor, 1, shdwTxtColor);
|
||||||
|
|
||||||
|
text->writeShadowed(84, 92, lang->getText(17), shdwTxtColor);
|
||||||
|
text->writeShadowed(84, 108, lang->getText(18), shdwTxtColor);
|
||||||
|
text->writeShadowed(84, 124, lang->getText(19), shdwTxtColor);
|
||||||
|
text->writeShadowed(84, 140, lang->getText(20), shdwTxtColor);
|
||||||
|
text->writeShadowed(84, 156, lang->getText(21), shdwTxtColor);
|
||||||
|
|
||||||
|
if ((mode == m_manual) && (counter % 50 > 14))
|
||||||
|
{
|
||||||
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, GAME_HEIGHT - 12, lang->getText(22), 1, orangeColor, 1, shdwTxtColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disquito
|
||||||
|
sprite->setTexture(itemTextures.at(0));
|
||||||
|
sprite->setPos(destRect1);
|
||||||
|
srcRect.y = 16 * (((counter + 12) / 36) % 2);
|
||||||
|
sprite->setSpriteClip(srcRect);
|
||||||
|
sprite->render();
|
||||||
|
|
||||||
|
// Gavineixon
|
||||||
|
sprite->setTexture(itemTextures.at(1));
|
||||||
|
sprite->setPos(destRect2);
|
||||||
|
srcRect.y = 16 * (((counter + 9) / 36) % 2);
|
||||||
|
sprite->setSpriteClip(srcRect);
|
||||||
|
sprite->render();
|
||||||
|
|
||||||
|
// Pacmar
|
||||||
|
sprite->setTexture(itemTextures.at(2));
|
||||||
|
sprite->setPos(destRect3);
|
||||||
|
srcRect.y = 16 * (((counter + 6) / 36) % 2);
|
||||||
|
sprite->setSpriteClip(srcRect);
|
||||||
|
sprite->render();
|
||||||
|
|
||||||
|
// Time Stopper
|
||||||
|
sprite->setTexture(itemTextures.at(3));
|
||||||
|
sprite->setPos(destRect4);
|
||||||
|
srcRect.y = 16 * (((counter + 3) / 36) % 2);
|
||||||
|
sprite->setSpriteClip(srcRect);
|
||||||
|
sprite->render();
|
||||||
|
|
||||||
|
// Coffee
|
||||||
|
sprite->setTexture(itemTextures.at(4));
|
||||||
|
sprite->setPos(destRect5);
|
||||||
|
srcRect.y = 16 * (((counter + 0) / 36) % 2);
|
||||||
|
sprite->setSpriteClip(srcRect);
|
||||||
|
sprite->render();
|
||||||
|
|
||||||
|
// Cambia el destino de renderizado
|
||||||
|
SDL_SetRenderTarget(renderer, nullptr);
|
||||||
|
|
||||||
|
// Prepara para empezar a dibujar en la textura de juego
|
||||||
|
screen->start();
|
||||||
|
|
||||||
|
// Limpia la pantalla
|
||||||
|
screen->clean(bgColor);
|
||||||
|
|
||||||
|
// Establece la ventana del backbuffer
|
||||||
|
if (mode == m_auto)
|
||||||
|
{
|
||||||
|
window.y = std::max(8, GAME_HEIGHT - counter + 100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copia el backbuffer al renderizador
|
||||||
|
SDL_RenderCopy(renderer, backbuffer, nullptr, &window);
|
||||||
|
|
||||||
|
// Vuelca el contenido del renderizador en pantalla
|
||||||
|
screen->blit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comprueba los eventos
|
||||||
|
void Instructions::checkEventHandler()
|
||||||
|
{
|
||||||
|
// Comprueba los eventos que hay en la cola
|
||||||
|
while (SDL_PollEvent(eventHandler) != 0)
|
||||||
|
{
|
||||||
|
// Evento de salida de la aplicación
|
||||||
|
if (eventHandler->type == SDL_QUIT)
|
||||||
|
{
|
||||||
|
section.name = PROG_SECTION_QUIT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((eventHandler->type == SDL_KEYUP) || (eventHandler->type == SDL_JOYBUTTONUP))
|
||||||
|
{
|
||||||
|
if (mode == m_auto)
|
||||||
|
{
|
||||||
|
JA_StopMusic();
|
||||||
|
section.name = PROG_SECTION_TITLE;
|
||||||
|
section.subsection = TITLE_SECTION_1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (counter > 30)
|
||||||
|
{
|
||||||
|
manualQuit = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bucle para la pantalla de instrucciones
|
// Bucle para la pantalla de instrucciones
|
||||||
void Instructions::run(Uint8 mode)
|
section_t Instructions::run(mode_e mode)
|
||||||
{
|
{
|
||||||
init();
|
this->mode = mode;
|
||||||
|
|
||||||
while (mSection.name == SELF)
|
while (section.name == SELF)
|
||||||
{
|
{
|
||||||
// Comprueba los eventos que hay en la cola
|
update();
|
||||||
while (SDL_PollEvent(mEventHandler) != 0)
|
render();
|
||||||
{
|
|
||||||
// Evento de salida de la aplicación
|
|
||||||
if (mEventHandler->type == SDL_QUIT)
|
|
||||||
{
|
|
||||||
mSection.name = PROG_SECTION_QUIT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((mEventHandler->type == SDL_KEYDOWN) || (mEventHandler->type == SDL_JOYBUTTONDOWN))
|
|
||||||
{
|
|
||||||
if (mode == INSTRUCTIONS_MODE_AUTO)
|
|
||||||
{
|
|
||||||
JA_StopMusic();
|
|
||||||
mSection.name = PROG_SECTION_TITLE;
|
|
||||||
mSection.subsection = TITLE_SECTION_1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
mManualQuit = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actualiza las variables
|
|
||||||
if (SDL_GetTicks() - mTicks > mTicksSpeed)
|
|
||||||
{
|
|
||||||
// Actualiza el contador de ticks
|
|
||||||
mTicks = SDL_GetTicks();
|
|
||||||
|
|
||||||
// Modo automático
|
|
||||||
if (mode == INSTRUCTIONS_MODE_AUTO)
|
|
||||||
{
|
|
||||||
mCounter++;
|
|
||||||
|
|
||||||
if (mCounter == INSTRUCTIONS_COUNTER)
|
|
||||||
{
|
|
||||||
mSection.name = PROG_SECTION_TITLE;
|
|
||||||
mSection.subsection = TITLE_SECTION_1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Modo manual
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++mCounter %= 60000;
|
|
||||||
|
|
||||||
if (mManualQuit)
|
|
||||||
{
|
|
||||||
mSection.name = PROG_SECTION_TITLE;
|
|
||||||
mSection.subsection = TITLE_SECTION_3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pinta en pantalla
|
|
||||||
SDL_Rect window = {0, 0, GAME_WIDTH, GAME_HEIGHT};
|
|
||||||
SDL_Rect srcRect = {0, 0, 16, 16};
|
|
||||||
|
|
||||||
const color_t orangeColor = {0xFF, 0x7A, 0x00};
|
|
||||||
|
|
||||||
const SDL_Rect destRect1 = {60, 88 + (16 * 0), 16, 16}; // Disquito
|
|
||||||
const SDL_Rect destRect2 = {60, 88 + (16 * 1), 16, 16}; // Gavineixon
|
|
||||||
const SDL_Rect destRect3 = {60, 88 + (16 * 2), 16, 16}; // Pacmar
|
|
||||||
const SDL_Rect destRect4 = {60, 88 + (16 * 3), 16, 16}; // Time Stopper
|
|
||||||
const SDL_Rect destRect5 = {60, 88 + (16 * 4), 16, 16}; // Coffee
|
|
||||||
|
|
||||||
// Pinta en el backbuffer el texto y los sprites
|
|
||||||
SDL_SetRenderTarget(mRenderer, mBackbuffer);
|
|
||||||
SDL_SetRenderDrawColor(mRenderer, bgColor.r, bgColor.g, bgColor.b, 255);
|
|
||||||
SDL_RenderClear(mRenderer);
|
|
||||||
|
|
||||||
// Escribe el texto
|
|
||||||
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 8, mLang->getText(11), 1, orangeColor, 1, shdwTxtColor);
|
|
||||||
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 24, mLang->getText(12), 1, noColor, 1, shdwTxtColor);
|
|
||||||
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 34, mLang->getText(13), 1, noColor, 1, shdwTxtColor);
|
|
||||||
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 48, mLang->getText(14), 1, noColor, 1, shdwTxtColor);
|
|
||||||
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 58, mLang->getText(15), 1, noColor, 1, shdwTxtColor);
|
|
||||||
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 75, mLang->getText(16), 1, orangeColor, 1, shdwTxtColor);
|
|
||||||
|
|
||||||
mText->writeShadowed(84, 92, mLang->getText(17), shdwTxtColor);
|
|
||||||
mText->writeShadowed(84, 108, mLang->getText(18), shdwTxtColor);
|
|
||||||
mText->writeShadowed(84, 124, mLang->getText(19), shdwTxtColor);
|
|
||||||
mText->writeShadowed(84, 140, mLang->getText(20), shdwTxtColor);
|
|
||||||
mText->writeShadowed(84, 156, mLang->getText(21), shdwTxtColor);
|
|
||||||
|
|
||||||
if ((mode == INSTRUCTIONS_MODE_MANUAL) && (mCounter % 50 > 14))
|
|
||||||
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, GAME_HEIGHT - 12, mLang->getText(22), 1, orangeColor, 1, shdwTxtColor);
|
|
||||||
|
|
||||||
// Disquito
|
|
||||||
mSprite->setPos(destRect1);
|
|
||||||
srcRect.x = 0;
|
|
||||||
srcRect.y = 16 * (((mCounter + 12) / 36) % 2);
|
|
||||||
mSprite->setSpriteClip(srcRect);
|
|
||||||
mSprite->render();
|
|
||||||
|
|
||||||
// Gavineixon
|
|
||||||
mSprite->setPos(destRect2);
|
|
||||||
srcRect.x += srcRect.w;
|
|
||||||
srcRect.y = 16 * (((mCounter + 9) / 36) % 2);
|
|
||||||
mSprite->setSpriteClip(srcRect);
|
|
||||||
mSprite->render();
|
|
||||||
|
|
||||||
// Pacmar
|
|
||||||
mSprite->setPos(destRect3);
|
|
||||||
srcRect.x += srcRect.w;
|
|
||||||
srcRect.y = 16 * (((mCounter + 6) / 36) % 2);
|
|
||||||
mSprite->setSpriteClip(srcRect);
|
|
||||||
mSprite->render();
|
|
||||||
|
|
||||||
// Time Stopper
|
|
||||||
mSprite->setPos(destRect4);
|
|
||||||
srcRect.x += srcRect.w;
|
|
||||||
srcRect.y = 16 * (((mCounter + 3) / 36) % 2);
|
|
||||||
mSprite->setSpriteClip(srcRect);
|
|
||||||
mSprite->render();
|
|
||||||
|
|
||||||
// Coffee
|
|
||||||
mSprite->setPos(destRect5);
|
|
||||||
srcRect.x += (srcRect.w * 2); // Se salta el icono del TNT
|
|
||||||
srcRect.y = 16 * (((mCounter + 0) / 36) % 2);
|
|
||||||
mSprite->setSpriteClip(srcRect);
|
|
||||||
mSprite->render();
|
|
||||||
|
|
||||||
// Cambia el destino de renderizado
|
|
||||||
SDL_SetRenderTarget(mRenderer, nullptr);
|
|
||||||
|
|
||||||
// Prepara para empezar a dibujar en la textura de juego
|
|
||||||
mScreen->start();
|
|
||||||
|
|
||||||
// Limpia la pantalla
|
|
||||||
mScreen->clean(bgColor);
|
|
||||||
|
|
||||||
// Establece la ventana del backbuffer
|
|
||||||
if (mode == INSTRUCTIONS_MODE_AUTO)
|
|
||||||
window.y = std::max(8, GAME_HEIGHT - mCounter + 100);
|
|
||||||
else
|
|
||||||
window.y = 0;
|
|
||||||
|
|
||||||
// Copia el backbuffer al renderizador
|
|
||||||
SDL_RenderCopy(mRenderer, mBackbuffer, nullptr, &window);
|
|
||||||
|
|
||||||
// Vuelca el contenido del renderizador en pantalla
|
|
||||||
mScreen->blit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return section;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,31 +12,35 @@
|
|||||||
#ifndef INSTRUCTIONS_H
|
#ifndef INSTRUCTIONS_H
|
||||||
#define INSTRUCTIONS_H
|
#define INSTRUCTIONS_H
|
||||||
|
|
||||||
// Contadores
|
enum mode_e
|
||||||
#define INSTRUCTIONS_COUNTER 600
|
{
|
||||||
|
m_manual,
|
||||||
// Modo para las instrucciones
|
m_auto
|
||||||
#define INSTRUCTIONS_MODE_MANUAL 0
|
};
|
||||||
#define INSTRUCTIONS_MODE_AUTO 1
|
|
||||||
|
|
||||||
// Clase Instructions
|
// Clase Instructions
|
||||||
class Instructions
|
class Instructions
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
SDL_Renderer *mRenderer; // El renderizador de la ventana
|
// Objetos
|
||||||
Screen *mScreen; // Objeto encargado de dibujar en pantalla
|
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||||
LTexture *mItemTexture; // Textura con los graficos
|
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||||
SDL_Event *mEventHandler; // Manejador de eventos
|
std::vector<LTexture *> itemTextures; // Vector con las texturas de los items
|
||||||
SDL_Texture *mBackbuffer; // Textura para usar como backbuffer
|
SDL_Event *eventHandler; // Manejador de eventos
|
||||||
Sprite *mSprite; // Sprite con la textura de las instrucciones
|
SDL_Texture *backbuffer; // Textura para usar como backbuffer
|
||||||
Asset *mAsset; // Objeto que gestiona todos los ficheros de recursos
|
Sprite *sprite; // Sprite con la textura de las instrucciones
|
||||||
Lang *mLang; // Objeto para gestionar los textos en diferentes idiomas
|
Asset *asset; // Objeto que gestiona todos los ficheros de recursos
|
||||||
Text *mText; // Objeto para escribir texto
|
Lang *lang; // Objeto para gestionar los textos en diferentes idiomas
|
||||||
Uint16 mCounter; // Contador
|
Text *text; // Objeto para escribir texto
|
||||||
section_t mSection; // Estado del bucle principal para saber si continua o se sale
|
|
||||||
Uint32 mTicks; // Contador de ticks para ajustar la velocidad del programa
|
// Variables
|
||||||
Uint32 mTicksSpeed; // Velocidad a la que se repiten los bucles del programa
|
Uint16 counter; // Contador
|
||||||
bool mManualQuit; // Indica si se quiere salir del modo manual
|
Uint16 counterEnd; // Valor final para el contador
|
||||||
|
section_t section; // Estado del bucle principal para saber si continua o se sale
|
||||||
|
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||||
|
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||||
|
bool manualQuit; // Indica si se quiere salir del modo manual
|
||||||
|
mode_e mode; // Modo en el que se van a ejecutar las instrucciones
|
||||||
|
|
||||||
// Actualiza las variables
|
// Actualiza las variables
|
||||||
void update();
|
void update();
|
||||||
@@ -44,8 +48,8 @@ private:
|
|||||||
// Pinta en pantalla
|
// Pinta en pantalla
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
// Inicializa las variables
|
// Comprueba los eventos
|
||||||
void init();
|
void checkEventHandler();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
@@ -55,7 +59,7 @@ public:
|
|||||||
~Instructions();
|
~Instructions();
|
||||||
|
|
||||||
// Bucle principal
|
// Bucle principal
|
||||||
void run(Uint8 mode);
|
section_t run(mode_e mode);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -101,19 +101,19 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang)
|
|||||||
|
|
||||||
// Un dia qualsevol de l'any 2000
|
// Un dia qualsevol de l'any 2000
|
||||||
texts.at(0)->setCaption(lang->getText(27));
|
texts.at(0)->setCaption(lang->getText(27));
|
||||||
texts.at(0)->setSpeed(10);
|
texts.at(0)->setSpeed(8);
|
||||||
|
|
||||||
// Tot esta tranquil a la UPV
|
// Tot esta tranquil a la UPV
|
||||||
texts.at(1)->setCaption(lang->getText(28));
|
texts.at(1)->setCaption(lang->getText(28));
|
||||||
texts.at(1)->setSpeed(10);
|
texts.at(1)->setSpeed(8);
|
||||||
|
|
||||||
// Fins que un desaprensiu...
|
// Fins que un desaprensiu...
|
||||||
texts.at(2)->setCaption(lang->getText(29));
|
texts.at(2)->setCaption(lang->getText(29));
|
||||||
texts.at(2)->setSpeed(15);
|
texts.at(2)->setSpeed(12);
|
||||||
|
|
||||||
// HEY! ME ANE A FERME UN CORTAET...
|
// HEY! ME ANE A FERME UN CORTAET...
|
||||||
texts.at(3)->setCaption(lang->getText(30));
|
texts.at(3)->setCaption(lang->getText(30));
|
||||||
texts.at(3)->setSpeed(10);
|
texts.at(3)->setSpeed(8);
|
||||||
|
|
||||||
// UAAAAAAAAAAAAA!!!
|
// UAAAAAAAAAAAAA!!!
|
||||||
texts.at(4)->setCaption(lang->getText(31));
|
texts.at(4)->setCaption(lang->getText(31));
|
||||||
@@ -121,7 +121,7 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang)
|
|||||||
|
|
||||||
// Espera un moment...
|
// Espera un moment...
|
||||||
texts.at(5)->setCaption(lang->getText(32));
|
texts.at(5)->setCaption(lang->getText(32));
|
||||||
texts.at(5)->setSpeed(20);
|
texts.at(5)->setSpeed(16);
|
||||||
|
|
||||||
// Si resulta que no tinc solt!
|
// Si resulta que no tinc solt!
|
||||||
texts.at(6)->setCaption(lang->getText(33));
|
texts.at(6)->setCaption(lang->getText(33));
|
||||||
@@ -133,7 +133,7 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang)
|
|||||||
|
|
||||||
// Blop... blop... blop...
|
// Blop... blop... blop...
|
||||||
texts.at(8)->setCaption(lang->getText(35));
|
texts.at(8)->setCaption(lang->getText(35));
|
||||||
texts.at(8)->setSpeed(20);
|
texts.at(8)->setSpeed(16);
|
||||||
|
|
||||||
for (auto text : texts)
|
for (auto text : texts)
|
||||||
{
|
{
|
||||||
@@ -190,6 +190,37 @@ void Intro::checkEventHandler()
|
|||||||
JA_StopMusic();
|
JA_StopMusic();
|
||||||
section.name = PROG_SECTION_TITLE;
|
section.name = PROG_SECTION_TITLE;
|
||||||
section.subsection = TITLE_SECTION_1;
|
section.subsection = TITLE_SECTION_1;
|
||||||
|
|
||||||
|
switch (eventHandler->key.keysym.scancode)
|
||||||
|
{
|
||||||
|
case SDL_SCANCODE_F:
|
||||||
|
screen->switchVideoMode();
|
||||||
|
texture->reLoad();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F1:
|
||||||
|
screen->setWindowSize(1);
|
||||||
|
texture->reLoad();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F2:
|
||||||
|
screen->setWindowSize(2);
|
||||||
|
texture->reLoad();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F3:
|
||||||
|
screen->setWindowSize(3);
|
||||||
|
texture->reLoad();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F4:
|
||||||
|
screen->setWindowSize(4);
|
||||||
|
texture->reLoad();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
240
source/item.cpp
@@ -2,120 +2,67 @@
|
|||||||
#include "item.h"
|
#include "item.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Item::Item(LTexture *texture, SDL_Renderer *renderer, Uint8 type, float x, float y)
|
Item::Item(Uint8 kind, float x, float y, LTexture *texture, std::vector<std::string> *animation, SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
mSprite = new AnimatedSprite(texture, renderer);
|
sprite = new AnimatedSprite(texture, renderer, "", animation);
|
||||||
|
|
||||||
mClass = type;
|
this->kind = kind;
|
||||||
mEnabled = true;
|
enabled = true;
|
||||||
mTimeToLive = 600;
|
timeToLive = 600;
|
||||||
mPosX = x;
|
accelX = 0.0f;
|
||||||
mPosY = y;
|
floorCollision = false;
|
||||||
mWidth = 16;
|
|
||||||
mHeight = 16;
|
|
||||||
mVelX = -1.0f + ((rand() % 5) * 0.5f);
|
|
||||||
mVelY = -4.0f;
|
|
||||||
mAccelX = 0.0f;
|
|
||||||
mAccelY = 0.2f;
|
|
||||||
mFloorCollision = false;
|
|
||||||
mCollider.r = mWidth / 2;
|
|
||||||
shiftColliders();
|
|
||||||
|
|
||||||
mSprite->setAnimationFrames(0, 0, 0, 48, mWidth, mHeight);
|
if (kind == ITEM_COFFEE_MACHINE)
|
||||||
mSprite->setAnimationFrames(0, 1, 0, 64, mWidth, mHeight);
|
|
||||||
mSprite->setCurrentFrame(0);
|
|
||||||
mSprite->setAnimationCounter(0);
|
|
||||||
mSprite->setAnimationSpeed(0, 10);
|
|
||||||
mSprite->setAnimationLoop(0, true);
|
|
||||||
mSprite->setSpriteClip(mSprite->getAnimationClip(0, 0));
|
|
||||||
mSprite->setPosX(mPosX);
|
|
||||||
mSprite->setPosY(mPosY);
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
{
|
||||||
case NO_KIND:
|
width = 23;
|
||||||
mEnabled = false;
|
height = 29;
|
||||||
mTimeToLive = 0;
|
posX = (((int)x + (PLAY_AREA_WIDTH / 2)) % (PLAY_AREA_WIDTH - width - 5)) + 2;
|
||||||
mPosX = 0;
|
posY = PLAY_AREA_TOP - height;
|
||||||
mPosY = 0;
|
velX = 0.0f;
|
||||||
mWidth = 0;
|
velY = -0.1f;
|
||||||
mHeight = 0;
|
accelY = 0.1f;
|
||||||
mVelX = 0;
|
collider.r = 10;
|
||||||
mVelY = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ITEM_POINTS_1_DISK:
|
|
||||||
mSprite->setAnimationFrames(0, 0, 16 * 0, 16 * 0, mWidth, mHeight);
|
|
||||||
mSprite->setAnimationFrames(0, 1, 16 * 0, 16 * 1, mWidth, mHeight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ITEM_POINTS_2_GAVINA:
|
|
||||||
mSprite->setAnimationFrames(0, 0, 16 * 1, 16 * 0, mWidth, mHeight);
|
|
||||||
mSprite->setAnimationFrames(0, 1, 16 * 1, 16 * 1, mWidth, mHeight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ITEM_POINTS_3_PACMAR:
|
|
||||||
mSprite->setAnimationFrames(0, 0, 16 * 2, 16 * 0, mWidth, mHeight);
|
|
||||||
mSprite->setAnimationFrames(0, 1, 16 * 2, 16 * 1, mWidth, mHeight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ITEM_CLOCK:
|
|
||||||
mSprite->setAnimationFrames(0, 0, 16 * 3, 16 * 0, mWidth, mHeight);
|
|
||||||
mSprite->setAnimationFrames(0, 1, 16 * 3, 16 * 1, mWidth, mHeight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ITEM_COFFEE:
|
|
||||||
mSprite->setAnimationFrames(0, 0, 16 * 5, 16 * 0, mWidth, mHeight);
|
|
||||||
mSprite->setAnimationFrames(0, 1, 16 * 5, 16 * 1, mWidth, mHeight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ITEM_COFFEE_MACHINE:
|
|
||||||
mWidth = 32;
|
|
||||||
mHeight = 32;
|
|
||||||
mPosX = (((int)x + (PLAY_AREA_WIDTH / 2)) % (PLAY_AREA_WIDTH - mWidth - 5)) + 2;
|
|
||||||
mPosY = PLAY_AREA_TOP - mHeight;
|
|
||||||
mVelX = 0.0f;
|
|
||||||
mVelY = -0.1f;
|
|
||||||
mAccelY = 0.1f;
|
|
||||||
mSprite->setAnimationFrames(0, 0, 32 * 0, 16 * 2, mWidth, mHeight);
|
|
||||||
mSprite->setAnimationFrames(0, 1, 32 * 1, 16 * 2, mWidth, mHeight);
|
|
||||||
mSprite->setAnimationFrames(0, 2, 32 * 2, 16 * 2, mWidth, mHeight);
|
|
||||||
mSprite->setAnimationFrames(0, 3, 32 * 3, 16 * 2, mWidth, mHeight);
|
|
||||||
mSprite->setPosX(mPosX);
|
|
||||||
mSprite->setPosY(mPosY);
|
|
||||||
mCollider.r = 10;
|
|
||||||
shiftColliders();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
width = 16;
|
||||||
|
height = 16;
|
||||||
|
posX = x;
|
||||||
|
posY = y;
|
||||||
|
velX = -1.0f + ((rand() % 5) * 0.5f);
|
||||||
|
velY = -4.0f;
|
||||||
|
accelY = 0.2f;
|
||||||
|
collider.r = width / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprite->setPosX(posX);
|
||||||
|
sprite->setPosY(posY);
|
||||||
|
shiftColliders();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
Item::~Item()
|
Item::~Item()
|
||||||
{
|
{
|
||||||
delete mSprite;
|
delete sprite;
|
||||||
mSprite = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Centra el objeto en la posición X
|
// Centra el objeto en la posición X
|
||||||
void Item::allignTo(int x)
|
void Item::allignTo(int x)
|
||||||
{
|
{
|
||||||
mPosX = float(x - (mWidth / 2));
|
posX = float(x - (width / 2));
|
||||||
|
|
||||||
if (mPosX < PLAY_AREA_LEFT)
|
if (posX < PLAY_AREA_LEFT)
|
||||||
{
|
{
|
||||||
mPosX = PLAY_AREA_LEFT + 1;
|
posX = PLAY_AREA_LEFT + 1;
|
||||||
}
|
}
|
||||||
else if ((mPosX + mWidth) > PLAY_AREA_RIGHT)
|
else if ((posX + width) > PLAY_AREA_RIGHT)
|
||||||
{
|
{
|
||||||
mPosX = float(PLAY_AREA_RIGHT - mWidth - 1);
|
posX = float(PLAY_AREA_RIGHT - width - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Posición X,Y del sprite
|
// Posición X,Y del sprite
|
||||||
mSprite->setPosX(int(mPosX));
|
sprite->setPosX(int(posX));
|
||||||
mSprite->setPosY(int(mPosY));
|
sprite->setPosY(int(posY));
|
||||||
|
|
||||||
// Alinea el circulo de colisión con el objeto
|
// Alinea el circulo de colisión con el objeto
|
||||||
shiftColliders();
|
shiftColliders();
|
||||||
@@ -124,15 +71,15 @@ void Item::allignTo(int x)
|
|||||||
// Pinta el objeto en la pantalla
|
// Pinta el objeto en la pantalla
|
||||||
void Item::render()
|
void Item::render()
|
||||||
{
|
{
|
||||||
if (mEnabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
if (mTimeToLive > 200)
|
if (timeToLive > 200)
|
||||||
{
|
{
|
||||||
mSprite->render();
|
sprite->render();
|
||||||
}
|
}
|
||||||
else if (mTimeToLive % 20 > 10)
|
else if (timeToLive % 20 > 10)
|
||||||
{
|
{
|
||||||
mSprite->render();
|
sprite->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,149 +87,142 @@ void Item::render()
|
|||||||
// Actualiza la posición y estados del objeto
|
// Actualiza la posición y estados del objeto
|
||||||
void Item::move()
|
void Item::move()
|
||||||
{
|
{
|
||||||
mFloorCollision = false;
|
floorCollision = false;
|
||||||
|
|
||||||
// Calcula la nueva posición
|
// Calcula la nueva posición
|
||||||
mPosX += mVelX;
|
posX += velX;
|
||||||
mPosY += mVelY;
|
posY += velY;
|
||||||
|
|
||||||
// Aplica las aceleraciones a la velocidad
|
// Aplica las aceleraciones a la velocidad
|
||||||
mVelX += mAccelX;
|
velX += accelX;
|
||||||
mVelY += mAccelY;
|
velY += accelY;
|
||||||
|
|
||||||
// Si queda fuera de pantalla, corregimos su posición y cambiamos su sentido
|
// Si queda fuera de pantalla, corregimos su posición y cambiamos su sentido
|
||||||
if ((mPosX < PLAY_AREA_LEFT) || (mPosX + mWidth > PLAY_AREA_RIGHT))
|
if ((posX < PLAY_AREA_LEFT) || (posX + width > PLAY_AREA_RIGHT))
|
||||||
{
|
{
|
||||||
// Corregir posición
|
// Corregir posición
|
||||||
mPosX -= mVelX;
|
posX -= velX;
|
||||||
|
|
||||||
// Invertir sentido
|
// Invertir sentido
|
||||||
mVelX = -mVelX;
|
velX = -velX;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si se sale por arriba rebota (excepto la maquina de café)
|
// Si se sale por arriba rebota (excepto la maquina de café)
|
||||||
if ((mPosY < PLAY_AREA_TOP) && !(mClass == ITEM_COFFEE_MACHINE))
|
if ((posY < PLAY_AREA_TOP) && !(kind == ITEM_COFFEE_MACHINE))
|
||||||
{
|
{
|
||||||
// Corrige
|
// Corrige
|
||||||
mPosY = PLAY_AREA_TOP;
|
posY -= velY;
|
||||||
|
|
||||||
// Invierte el sentido
|
// Invierte el sentido
|
||||||
mVelY = -mVelY;
|
velY = -velY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si el objeto se sale por la parte inferior
|
// Si el objeto se sale por la parte inferior
|
||||||
if (mPosY + mHeight > PLAY_AREA_BOTTOM)
|
if (posY + height > PLAY_AREA_BOTTOM)
|
||||||
{
|
{
|
||||||
// Corrige
|
// Corrige
|
||||||
mPosY -= mVelY;
|
posY -= velY;
|
||||||
|
|
||||||
// Detiene el objeto
|
// Detiene el objeto
|
||||||
mVelY = 0;
|
velY = 0;
|
||||||
mVelX = 0;
|
velX = 0;
|
||||||
mAccelX = 0;
|
accelX = 0;
|
||||||
mAccelY = 0;
|
accelY = 0;
|
||||||
mPosY = PLAY_AREA_BOTTOM - mHeight;
|
posY = PLAY_AREA_BOTTOM - height;
|
||||||
if (mClass == ITEM_COFFEE_MACHINE)
|
if (kind == ITEM_COFFEE_MACHINE)
|
||||||
mFloorCollision = true;
|
{
|
||||||
|
floorCollision = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actualiza la posición del sprite
|
// Actualiza la posición del sprite
|
||||||
mSprite->setPosX(int(mPosX));
|
sprite->setPosX(int(posX));
|
||||||
mSprite->setPosY(int(mPosY));
|
sprite->setPosY(int(posY));
|
||||||
|
shiftColliders();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pone a cero todos los valores del objeto
|
// Pone a cero todos los valores del objeto
|
||||||
void Item::erase()
|
void Item::disable()
|
||||||
{
|
{
|
||||||
// init(NO_KIND, 0, 0, nullptr, nullptr);
|
enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actualiza el objeto a su posicion, animación y controla los contadores
|
// Actualiza el objeto a su posicion, animación y controla los contadores
|
||||||
void Item::update()
|
void Item::update()
|
||||||
{
|
{
|
||||||
if (mEnabled)
|
move();
|
||||||
{
|
sprite->animate();
|
||||||
move();
|
updateTimeToLive();
|
||||||
shiftColliders();
|
checkTimeToLive();
|
||||||
mSprite->animate();
|
|
||||||
updateTimeToLive();
|
|
||||||
checkTimeToLive();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actualiza el contador
|
// Actualiza el contador
|
||||||
void Item::updateTimeToLive()
|
void Item::updateTimeToLive()
|
||||||
{
|
{
|
||||||
if (mTimeToLive > 0)
|
if (timeToLive > 0)
|
||||||
{
|
{
|
||||||
mTimeToLive--;
|
timeToLive--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba si el objeto sigue vivo
|
// Comprueba si el objeto sigue vivo
|
||||||
void Item::checkTimeToLive()
|
void Item::checkTimeToLive()
|
||||||
{
|
{
|
||||||
if (mTimeToLive == 0)
|
if (timeToLive == 0)
|
||||||
erase();
|
disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene del valor de la variable
|
// Obtiene del valor de la variable
|
||||||
float Item::getPosX()
|
float Item::getPosX()
|
||||||
{
|
{
|
||||||
return mPosX;
|
return posX;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene del valor de la variable
|
// Obtiene del valor de la variable
|
||||||
float Item::getPosY()
|
float Item::getPosY()
|
||||||
{
|
{
|
||||||
return mPosY;
|
return posY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene del valor de la variable
|
// Obtiene del valor de la variable
|
||||||
int Item::getWidth()
|
int Item::getWidth()
|
||||||
{
|
{
|
||||||
return mWidth;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene del valor de la variable
|
// Obtiene del valor de la variable
|
||||||
int Item::getHeight()
|
int Item::getHeight()
|
||||||
{
|
{
|
||||||
return mHeight;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene del valor de la variable
|
// Obtiene del valor de la variable
|
||||||
int Item::getClass()
|
int Item::getClass()
|
||||||
{
|
{
|
||||||
return mClass;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene el valor de la variable
|
// Obtiene el valor de la variable
|
||||||
bool Item::isEnabled()
|
bool Item::isEnabled()
|
||||||
{
|
{
|
||||||
return mEnabled;
|
return enabled;
|
||||||
}
|
|
||||||
|
|
||||||
// Establece el valor de la variable
|
|
||||||
void Item::setEnabled(bool value)
|
|
||||||
{
|
|
||||||
mEnabled = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene el circulo de colisión
|
// Obtiene el circulo de colisión
|
||||||
circle_t &Item::getCollider()
|
circle_t &Item::getCollider()
|
||||||
{
|
{
|
||||||
return mCollider;
|
return collider;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alinea el circulo de colisión con la posición del objeto
|
// Alinea el circulo de colisión con la posición del objeto
|
||||||
void Item::shiftColliders()
|
void Item::shiftColliders()
|
||||||
{
|
{
|
||||||
mCollider.x = int(mPosX + (mWidth / 2));
|
collider.x = int(posX + (width / 2));
|
||||||
mCollider.y = int(mPosY + (mHeight / 2));
|
collider.y = int(posY + (height / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Informa si el objeto ha colisionado con el suelo
|
// Informa si el objeto ha colisionado con el suelo
|
||||||
bool Item::floorCollision()
|
bool Item::isOnFloor()
|
||||||
{
|
{
|
||||||
return mFloorCollision;
|
return floorCollision;
|
||||||
}
|
}
|
||||||
@@ -8,42 +8,44 @@
|
|||||||
#define ITEM_H
|
#define ITEM_H
|
||||||
|
|
||||||
// Tipos de objetos
|
// Tipos de objetos
|
||||||
#define ITEM_POINTS_1_DISK 1
|
#define ITEM_POINTS_1_DISK 0
|
||||||
#define ITEM_POINTS_2_GAVINA 2
|
#define ITEM_POINTS_2_GAVINA 1
|
||||||
#define ITEM_POINTS_3_PACMAR 3
|
#define ITEM_POINTS_3_PACMAR 2
|
||||||
#define ITEM_CLOCK 4
|
#define ITEM_CLOCK 3
|
||||||
#define ITEM_COFFEE 5
|
#define ITEM_COFFEE 4
|
||||||
#define ITEM_POWER_BALL 6
|
#define ITEM_COFFEE_MACHINE 5
|
||||||
#define ITEM_COFFEE_MACHINE 7
|
|
||||||
|
|
||||||
// Clase Item
|
// Clase Item
|
||||||
class Item
|
class Item
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
float mPosX; // Posición X del objeto
|
// Objetos
|
||||||
float mPosY; // Posición Y del objeto
|
AnimatedSprite *sprite; // Sprite con los graficos del objeto
|
||||||
Uint8 mWidth; // Ancho del objeto
|
|
||||||
Uint8 mHeight; // Alto del objeto
|
|
||||||
float mVelX; // Velocidad en el eje X
|
|
||||||
float mVelY; // Velocidad en el eje Y
|
|
||||||
float mAccelX; // Aceleración en el eje X
|
|
||||||
float mAccelY; // Aceleración en el eje Y
|
|
||||||
bool mFloorCollision; // Indica si el objeto colisiona con el suelo
|
|
||||||
|
|
||||||
AnimatedSprite *mSprite; // Sprite con los graficos del objeto
|
// Variables
|
||||||
|
float posX; // Posición X del objeto
|
||||||
Uint8 mClass; // Especifica el tipo de objeto que es
|
float posY; // Posición Y del objeto
|
||||||
bool mEnabled; // Especifica si el objeto está habilitado
|
Uint8 width; // Ancho del objeto
|
||||||
circle_t mCollider; // Circulo de colisión del objeto
|
Uint8 height; // Alto del objeto
|
||||||
|
float velX; // Velocidad en el eje X
|
||||||
|
float velY; // Velocidad en el eje Y
|
||||||
|
float accelX; // Aceleración en el eje X
|
||||||
|
float accelY; // Aceleración en el eje Y
|
||||||
|
bool floorCollision; // Indica si el objeto colisiona con el suelo
|
||||||
|
Uint8 kind; // Especifica el tipo de objeto que es
|
||||||
|
bool enabled; // Especifica si el objeto está habilitado
|
||||||
|
circle_t collider; // Circulo de colisión del objeto
|
||||||
|
|
||||||
// Alinea el circulo de colisión con la posición del objeto
|
// Alinea el circulo de colisión con la posición del objeto
|
||||||
void shiftColliders();
|
void shiftColliders();
|
||||||
|
|
||||||
|
// Actualiza la posición y estados del objeto
|
||||||
|
void move();
|
||||||
public:
|
public:
|
||||||
Uint16 mTimeToLive; // Temporizador con el tiempo que el objeto está presente
|
Uint16 timeToLive; // Temporizador con el tiempo que el objeto está presente
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Item(LTexture *texture, SDL_Renderer *renderer, Uint8 type, float x, float y);
|
Item(Uint8 kind, float x, float y, LTexture *texture, std::vector<std::string> *animation, SDL_Renderer *renderer);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Item();
|
~Item();
|
||||||
@@ -54,11 +56,9 @@ public:
|
|||||||
// Pinta el objeto en la pantalla
|
// Pinta el objeto en la pantalla
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
// Actualiza la posición y estados del objeto
|
|
||||||
void move();
|
|
||||||
|
|
||||||
// Pone a cero todos los valores del objeto
|
// Pone a cero todos los valores del objeto
|
||||||
void erase();
|
void disable();
|
||||||
|
|
||||||
// Actualiza al objeto a su posicion, animación y controla los contadores
|
// Actualiza al objeto a su posicion, animación y controla los contadores
|
||||||
void update();
|
void update();
|
||||||
@@ -87,14 +87,11 @@ public:
|
|||||||
// Obtiene el valor de la variable
|
// Obtiene el valor de la variable
|
||||||
bool isEnabled();
|
bool isEnabled();
|
||||||
|
|
||||||
// Establece el valor de la variable
|
|
||||||
void setEnabled(bool value);
|
|
||||||
|
|
||||||
// Obtiene el circulo de colisión
|
// Obtiene el circulo de colisión
|
||||||
circle_t &getCollider();
|
circle_t &getCollider();
|
||||||
|
|
||||||
// Informa si el objeto ha colisionado con el suelo
|
// Informa si el objeto ha colisionado con el suelo
|
||||||
bool floorCollision();
|
bool isOnFloor();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -46,20 +46,20 @@ bool Lang::setLang(Uint8 lang)
|
|||||||
if (rfile.is_open() && rfile.good())
|
if (rfile.is_open() && rfile.good())
|
||||||
{
|
{
|
||||||
success = true;
|
success = true;
|
||||||
std::string buffer;
|
std::string line;
|
||||||
|
|
||||||
// lee el resto de datos del fichero
|
// lee el resto de datos del fichero
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int line_read = 0;
|
while (std::getline(rfile, line))
|
||||||
while (std::getline(rfile, buffer))
|
|
||||||
{
|
{
|
||||||
// Almacena solo las lineas impares
|
// Almacena solo las lineas que no empiezan por # o no esten vacias
|
||||||
if (line_read % 2 == 1)
|
const bool test1 = line.substr(0,1) != "#";
|
||||||
mTextStrings[index++] = buffer;
|
const bool test2 = !line.empty();
|
||||||
|
if (test1 && test2)
|
||||||
// Limpia el buffer
|
{
|
||||||
buffer.clear();
|
mTextStrings[index] = line;
|
||||||
line_read++;
|
index++;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Logo::Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset)
|
|||||||
// Reserva memoria para los punteros
|
// Reserva memoria para los punteros
|
||||||
eventHandler = new SDL_Event();
|
eventHandler = new SDL_Event();
|
||||||
texture = new LTexture(renderer, asset->get("logo.png"));
|
texture = new LTexture(renderer, asset->get("logo.png"));
|
||||||
sprite = new Sprite(0, 0, GAME_WIDTH, GAME_HEIGHT, texture, renderer);
|
sprite = new Sprite(14, 75, 226, 44, texture, renderer);
|
||||||
|
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
counter = 0;
|
counter = 0;
|
||||||
@@ -104,7 +104,7 @@ void Logo::render()
|
|||||||
screen->start();
|
screen->start();
|
||||||
|
|
||||||
// Limpia la pantalla
|
// Limpia la pantalla
|
||||||
screen->clean(bgColor);
|
screen->clean({238, 238, 238});
|
||||||
|
|
||||||
// Dibuja los objetos
|
// Dibuja los objetos
|
||||||
sprite->render();
|
sprite->render();
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ void LTexture::setAlpha(Uint8 alpha)
|
|||||||
// Renderiza la textura en un punto específico
|
// Renderiza la textura en un punto específico
|
||||||
void LTexture::render(SDL_Renderer *renderer, int x, int y, SDL_Rect *clip, float zoomW, float zoomH, double angle, SDL_Point *center, SDL_RendererFlip flip)
|
void LTexture::render(SDL_Renderer *renderer, int x, int y, SDL_Rect *clip, float zoomW, float zoomH, double angle, SDL_Point *center, SDL_RendererFlip flip)
|
||||||
{
|
{
|
||||||
// Establece el destini de renderizado en la pantalla
|
// Establece el destino de renderizado en la pantalla
|
||||||
SDL_Rect renderQuad = {x, y, width, height};
|
SDL_Rect renderQuad = {x, y, width, height};
|
||||||
|
|
||||||
// Obtiene las dimesiones del clip de renderizado
|
// Obtiene las dimesiones del clip de renderizado
|
||||||
|
|||||||
105
source/menu.cpp
@@ -20,6 +20,7 @@ Menu::Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file)
|
|||||||
itemSelected = MENU_NO_OPTION;
|
itemSelected = MENU_NO_OPTION;
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
|
w = 0;
|
||||||
rectBG.rect = {0, 0, 0, 0};
|
rectBG.rect = {0, 0, 0, 0};
|
||||||
rectBG.color = {0, 0, 0};
|
rectBG.color = {0, 0, 0};
|
||||||
rectBG.a = 0;
|
rectBG.a = 0;
|
||||||
@@ -57,6 +58,9 @@ Menu::Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file)
|
|||||||
{
|
{
|
||||||
load(file);
|
load(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deja el cursor en el primer elemento
|
||||||
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu::~Menu()
|
Menu::~Menu()
|
||||||
@@ -157,7 +161,7 @@ bool Menu::load(std::string file_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
printf("Closing file %s\n\n", filename.c_str());
|
printf("Closing file %s\n", filename.c_str());
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
// El fichero no se puede abrir
|
// El fichero no se puede abrir
|
||||||
@@ -491,6 +495,13 @@ void Menu::reset()
|
|||||||
selector.originH = selector.targetH = item[0].rect.h;
|
selector.originH = selector.targetH = item[0].rect.h;
|
||||||
selector.moving = false;
|
selector.moving = false;
|
||||||
selector.resizing = false;
|
selector.resizing = false;
|
||||||
|
|
||||||
|
// Si el primer elemento no es seleccionable, incrementa el selector
|
||||||
|
if (!item[selector.index].selectable)
|
||||||
|
{
|
||||||
|
increaseSelectorIndex();
|
||||||
|
setSelectorPos(selector.index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actualiza el menu para recolocarlo correctamente y establecer el tamaño
|
// Actualiza el menu para recolocarlo correctamente y establecer el tamaño
|
||||||
@@ -554,7 +565,7 @@ bool Menu::decreaseSelectorIndex()
|
|||||||
// Calcula cual es el siguiente elemento
|
// Calcula cual es el siguiente elemento
|
||||||
if (selector.index == 0)
|
if (selector.index == 0)
|
||||||
{
|
{
|
||||||
selector.index = item.size();
|
selector.index = item.size() - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -565,7 +576,7 @@ bool Menu::decreaseSelectorIndex()
|
|||||||
{
|
{
|
||||||
if (selector.index == 0)
|
if (selector.index == 0)
|
||||||
{
|
{
|
||||||
selector.index = item.size();
|
selector.index = item.size() - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -608,8 +619,6 @@ void Menu::render()
|
|||||||
|
|
||||||
// Renderiza el rectangulo del selector
|
// Renderiza el rectangulo del selector
|
||||||
const SDL_Rect temp = {selector.rect.x, selector.rect.y - 1, selector.rect.w, selector.rect.h + 1};
|
const SDL_Rect temp = {selector.rect.x, selector.rect.y - 1, selector.rect.w, selector.rect.h + 1};
|
||||||
// temp.y--;
|
|
||||||
// temp.h++;
|
|
||||||
SDL_SetRenderDrawColor(renderer, selector.color.r, selector.color.g, selector.color.b, selector.a);
|
SDL_SetRenderDrawColor(renderer, selector.color.r, selector.color.g, selector.color.b, selector.a);
|
||||||
SDL_RenderFillRect(renderer, &temp);
|
SDL_RenderFillRect(renderer, &temp);
|
||||||
|
|
||||||
@@ -628,17 +637,18 @@ void Menu::render()
|
|||||||
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
|
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
|
||||||
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color);
|
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (item[i].selectable)
|
else if (item[i].selectable)
|
||||||
{
|
{
|
||||||
text->write(item[i].rect.x, item[i].rect.y, item[i].label);
|
text->write(item[i].rect.x, item[i].rect.y, item[i].label);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (item[i].greyed)
|
else if (item[i].greyed)
|
||||||
{
|
{
|
||||||
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, colorGreyed);
|
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, colorGreyed);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// No seleccionable
|
{ // No seleccionable
|
||||||
{
|
|
||||||
if ((item[i].linkedUp) && (i == selector.index + 1))
|
if ((item[i].linkedUp) && (i == selector.index + 1))
|
||||||
{
|
{
|
||||||
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
|
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
|
||||||
@@ -653,13 +663,45 @@ void Menu::render()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece el rectangulo de fondo del menu y el selector
|
// Establece el rectangulo de fondo del menu y el selector
|
||||||
void Menu::setRectSize()
|
void Menu::setRectSize(int w, int h)
|
||||||
{
|
{
|
||||||
rectBG.rect.w = findWidth() + text->getCharacterSize();
|
// Establece el ancho
|
||||||
rectBG.rect.h = findHeight() + text->getCharacterSize();
|
if (w == 0)
|
||||||
|
{ // Si no se pasa un valor, se busca si hay uno prefijado
|
||||||
|
if (this->w == 0)
|
||||||
|
{ // Si no hay prefijado, coge el item mas ancho
|
||||||
|
rectBG.rect.w = findWidth() + text->getCharacterSize();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Si hay prefijado, coge ese
|
||||||
|
rectBG.rect.w = this->w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Si se pasa un valor, se usa y se prefija
|
||||||
|
rectBG.rect.w = w;
|
||||||
|
this->w = w;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Establece el alto
|
||||||
|
if (h == 0)
|
||||||
|
{ // Si no se pasa un valor, se busca de manera automatica
|
||||||
|
rectBG.rect.h = findHeight() + text->getCharacterSize();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Si se pasa un valor, se aplica
|
||||||
|
rectBG.rect.h = h;
|
||||||
|
}
|
||||||
|
|
||||||
// La posición X es la del menú menos medio caracter
|
// La posición X es la del menú menos medio caracter
|
||||||
rectBG.rect.x = x - (text->getCharacterSize() / 2);
|
if (this->w != 0)
|
||||||
|
{ // Si el ancho esta prefijado, la x coinccide
|
||||||
|
rectBG.rect.x = x;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Si el ancho es automatico, se le da un poco de margen
|
||||||
|
rectBG.rect.x = x - (text->getCharacterSize() / 2);
|
||||||
|
}
|
||||||
|
|
||||||
// La posición Y es la del menu menos la altura de medio caracter
|
// La posición Y es la del menu menos la altura de medio caracter
|
||||||
rectBG.rect.y = y - (text->getCharacterSize() / 2);
|
rectBG.rect.y = y - (text->getCharacterSize() / 2);
|
||||||
@@ -692,10 +734,28 @@ void Menu::setSelectorTextColor(color_t color)
|
|||||||
void Menu::centerMenuOnX(int value)
|
void Menu::centerMenuOnX(int value)
|
||||||
{
|
{
|
||||||
isCenteredOnX = true;
|
isCenteredOnX = true;
|
||||||
centerX = value;
|
if (value != 0)
|
||||||
|
{
|
||||||
|
centerX = value;
|
||||||
|
}
|
||||||
|
else if (centerX == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Establece la nueva posición centrada en funcion del elemento más ancho
|
// Establece la nueva posición centrada en funcion del elemento más ancho o del ancho fijo del menu
|
||||||
x = (value) - (findWidth() / 2);
|
if (w != 0)
|
||||||
|
{ // Si se ha definido un ancho fijo
|
||||||
|
x = (centerX) - (w / 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Si se actua en función del elemento más ancho
|
||||||
|
x = (centerX) - (findWidth() / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actualiza el rectangulo de fondo y del selector
|
||||||
|
rectBG.rect.x = x;
|
||||||
|
selector.rect.x = x;
|
||||||
|
|
||||||
// Reposiciona los elementos del menu
|
// Reposiciona los elementos del menu
|
||||||
for (auto &i : item)
|
for (auto &i : item)
|
||||||
@@ -705,6 +765,12 @@ void Menu::centerMenuOnX(int value)
|
|||||||
|
|
||||||
// Recalcula el rectangulo de fondo
|
// Recalcula el rectangulo de fondo
|
||||||
setRectSize();
|
setRectSize();
|
||||||
|
|
||||||
|
// Vuelve a centrar los elementos si fuera el caso
|
||||||
|
if (areElementsCenteredOnX)
|
||||||
|
{
|
||||||
|
centerMenuElementsOnX();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Centra el menu respecto un punto en el eje Y
|
// Centra el menu respecto un punto en el eje Y
|
||||||
@@ -738,13 +804,13 @@ void Menu::centerMenuElementsOnX()
|
|||||||
void Menu::addItem(std::string text, int hPaddingDown, bool selectable, bool greyed, bool linkedDown)
|
void Menu::addItem(std::string text, int hPaddingDown, bool selectable, bool greyed, bool linkedDown)
|
||||||
{
|
{
|
||||||
item_t temp;
|
item_t temp;
|
||||||
|
|
||||||
if (item.empty())
|
if (item.empty())
|
||||||
{// Si es el primer item coge la posición en el eje Y del propio menu
|
{ // Si es el primer item coge la posición en el eje Y del propio menu
|
||||||
temp.rect.y = y;
|
temp.rect.y = y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{// En caso contrario, coge la posición en el eje Y a partir del último elemento
|
{ // En caso contrario, coge la posición en el eje Y a partir del último elemento
|
||||||
temp.rect.y = item.back().rect.y + item.back().rect.h + item.back().hPaddingDown;
|
temp.rect.y = item.back().rect.y + item.back().rect.h + item.back().hPaddingDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -755,7 +821,7 @@ void Menu::addItem(std::string text, int hPaddingDown, bool selectable, bool gre
|
|||||||
temp.linkedDown = linkedDown;
|
temp.linkedDown = linkedDown;
|
||||||
|
|
||||||
item.push_back(temp);
|
item.push_back(temp);
|
||||||
|
|
||||||
setItemCaption(item.size() - 1, text);
|
setItemCaption(item.size() - 1, text);
|
||||||
|
|
||||||
if (item.size() > 1)
|
if (item.size() > 1)
|
||||||
@@ -777,9 +843,6 @@ void Menu::setItemCaption(int index, std::string text)
|
|||||||
item.at(index).rect.w = this->text->lenght(item.at(index).label);
|
item.at(index).rect.w = this->text->lenght(item.at(index).label);
|
||||||
item.at(index).rect.h = this->text->getCharacterSize();
|
item.at(index).rect.h = this->text->getCharacterSize();
|
||||||
reorganize();
|
reorganize();
|
||||||
|
|
||||||
const std::string t = item.at(index).label + ":" + std::to_string(item.at(index).rect.w);
|
|
||||||
printf("Adding menu item -> %s\n", t.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece el indice del itemm que se usará por defecto al cancelar el menu
|
// Establece el indice del itemm que se usará por defecto al cancelar el menu
|
||||||
|
|||||||
@@ -68,6 +68,13 @@ private:
|
|||||||
int a; // Cantidad de transparencia para el rectangulo del selector
|
int a; // Cantidad de transparencia para el rectangulo del selector
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Objetos
|
||||||
|
SDL_Renderer *renderer; // Puntero al renderizador de la ventana
|
||||||
|
Text *text; // Texto para poder escribir los items del menu
|
||||||
|
Input *input; // Gestor de eventos de entrada de teclado o gamepad
|
||||||
|
Asset *asset; // Objeto para gestionar los ficheros de recursos
|
||||||
|
|
||||||
|
// Variables
|
||||||
std::string name; // Nombre del menu
|
std::string name; // Nombre del menu
|
||||||
int x; // Posición en el eje X de la primera letra del primer elemento
|
int x; // Posición en el eje X de la primera letra del primer elemento
|
||||||
int y; // Posición en el eje Y de la primera letra del primer elemento
|
int y; // Posición en el eje Y de la primera letra del primer elemento
|
||||||
@@ -85,10 +92,6 @@ private:
|
|||||||
JA_Sound soundAccept; // Sonido al aceptar o elegir una opción del menu
|
JA_Sound soundAccept; // Sonido al aceptar o elegir una opción del menu
|
||||||
JA_Sound soundCancel; // Sonido al cancelar el menu
|
JA_Sound soundCancel; // Sonido al cancelar el menu
|
||||||
JA_Sound soundMove; // Sonido al mover el selector
|
JA_Sound soundMove; // Sonido al mover el selector
|
||||||
SDL_Renderer *renderer; // Puntero al renderizador de la ventana
|
|
||||||
Text *text; // Texto para poder escribir los items del menu
|
|
||||||
Input *input; // Gestor de eventos de entrada de teclado o gamepad
|
|
||||||
Asset *asset; // Objeto para gestionar los ficheros de recursos
|
|
||||||
color_t colorGreyed; // Color para los elementos agrisados
|
color_t colorGreyed; // Color para los elementos agrisados
|
||||||
rectangle_t rectBG; // Rectangulo de fondo del menu
|
rectangle_t rectBG; // Rectangulo de fondo del menu
|
||||||
std::vector<item_t> item; // Estructura para cada elemento del menu
|
std::vector<item_t> item; // Estructura para cada elemento del menu
|
||||||
@@ -108,9 +111,6 @@ private:
|
|||||||
// Inicializa las variables
|
// Inicializa las variables
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
// Establece el rectangulo de fondo del menu
|
|
||||||
void setRectSize();
|
|
||||||
|
|
||||||
// Actualiza el menu para recolocarlo correctamente y establecer el tamaño
|
// Actualiza el menu para recolocarlo correctamente y establecer el tamaño
|
||||||
void reorganize();
|
void reorganize();
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file="");
|
Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file = "");
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Menu();
|
~Menu();
|
||||||
@@ -179,7 +179,7 @@ public:
|
|||||||
void setSelectorTextColor(color_t color);
|
void setSelectorTextColor(color_t color);
|
||||||
|
|
||||||
// Centra el menu respecto a un punto en el eje X
|
// Centra el menu respecto a un punto en el eje X
|
||||||
void centerMenuOnX(int value);
|
void centerMenuOnX(int value = 0);
|
||||||
|
|
||||||
// Centra el menu respecto a un punto en el eje Y
|
// Centra el menu respecto a un punto en el eje Y
|
||||||
void centerMenuOnY(int value);
|
void centerMenuOnY(int value);
|
||||||
@@ -219,6 +219,9 @@ public:
|
|||||||
|
|
||||||
// Establece la fuente de texto que se utilizará
|
// Establece la fuente de texto que se utilizará
|
||||||
void setText(std::string font_png, std::string font_txt);
|
void setText(std::string font_png, std::string font_txt);
|
||||||
|
|
||||||
|
// Establece el rectangulo de fondo del menu
|
||||||
|
void setRectSize(int w = 0, int h = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vel
|
|||||||
spriteClip = {0, 0, w, h};
|
spriteClip = {0, 0, w, h};
|
||||||
|
|
||||||
// Establece el centro de rotación
|
// Establece el centro de rotación
|
||||||
center = {0, 0};
|
center = nullptr;
|
||||||
|
|
||||||
// Establece el tipo de volteado
|
// Establece el tipo de volteado
|
||||||
currentFlip = SDL_FLIP_NONE;
|
currentFlip = SDL_FLIP_NONE;
|
||||||
@@ -73,7 +73,7 @@ void MovingSprite::clear()
|
|||||||
|
|
||||||
angle = 0.0; // Angulo para dibujarlo
|
angle = 0.0; // Angulo para dibujarlo
|
||||||
rotateEnabled = false; // Indica si ha de rotar
|
rotateEnabled = false; // Indica si ha de rotar
|
||||||
center = {0, 0}; // Centro de rotación
|
center = nullptr; // Centro de rotación
|
||||||
rotateSpeed = 0; // Velocidad de giro
|
rotateSpeed = 0; // Velocidad de giro
|
||||||
rotateAmount = 0.0; // Cantidad de grados a girar en cada iteración
|
rotateAmount = 0.0; // Cantidad de grados a girar en cada iteración
|
||||||
counter = 0; // Contador interno
|
counter = 0; // Contador interno
|
||||||
@@ -101,7 +101,9 @@ void MovingSprite::move()
|
|||||||
void MovingSprite::render()
|
void MovingSprite::render()
|
||||||
{
|
{
|
||||||
if (enabled)
|
if (enabled)
|
||||||
texture->render(renderer, (int)x, (int)y, &spriteClip, zoomW, zoomH, angle, ¢er, currentFlip);
|
{
|
||||||
|
texture->render(renderer, (int)x, (int)y, &spriteClip, zoomW, zoomH, angle, center, currentFlip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene el valor de la variable
|
// Obtiene el valor de la variable
|
||||||
@@ -265,7 +267,14 @@ void MovingSprite::setRotate(bool value)
|
|||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void MovingSprite::setRotateSpeed(int value)
|
void MovingSprite::setRotateSpeed(int value)
|
||||||
{
|
{
|
||||||
rotateSpeed = value;
|
if (value < 1)
|
||||||
|
{
|
||||||
|
rotateSpeed = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rotateSpeed = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ protected:
|
|||||||
int rotateSpeed; // Velocidad de giro
|
int rotateSpeed; // Velocidad de giro
|
||||||
double rotateAmount; // Cantidad de grados a girar en cada iteración
|
double rotateAmount; // Cantidad de grados a girar en cada iteración
|
||||||
int counter; // Contador interno
|
int counter; // Contador interno
|
||||||
SDL_Point center; // Centro de rotación
|
SDL_Point *center; // Centro de rotación
|
||||||
SDL_RendererFlip currentFlip; // Indica como se voltea el sprite
|
SDL_RendererFlip currentFlip; // Indica como se voltea el sprite
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "asset.h"
|
||||||
|
#include "ltexture.h"
|
||||||
#include "animatedsprite.h"
|
#include "animatedsprite.h"
|
||||||
|
|
||||||
#ifndef PLAYER_H
|
#ifndef PLAYER_H
|
||||||
@@ -21,24 +23,6 @@
|
|||||||
#define PLAYER_STATUS_FIRING_RIGHT 2
|
#define PLAYER_STATUS_FIRING_RIGHT 2
|
||||||
#define PLAYER_STATUS_FIRING_NO 3
|
#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
|
|
||||||
|
|
||||||
#define PLAYER_ANIMATION_HEAD_WALKING_LEFT 0
|
|
||||||
#define PLAYER_ANIMATION_HEAD_FIRING_LEFT 1
|
|
||||||
#define PLAYER_ANIMATION_HEAD_WALKING_RIGHT 2
|
|
||||||
#define PLAYER_ANIMATION_HEAD_FIRING_RIGHT 3
|
|
||||||
#define PLAYER_ANIMATION_HEAD_WALKING_STOP 4
|
|
||||||
#define PLAYER_ANIMATION_HEAD_FIRING_UP 5
|
|
||||||
|
|
||||||
// Variables del jugador
|
// Variables del jugador
|
||||||
#define PLAYER_INVULNERABLE_COUNTER 200
|
#define PLAYER_INVULNERABLE_COUNTER 200
|
||||||
#define PLAYER_POWERUP_COUNTER 1500
|
#define PLAYER_POWERUP_COUNTER 1500
|
||||||
@@ -47,41 +31,46 @@
|
|||||||
class Player
|
class Player
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
float mPosX; // Posicion en el eje X
|
// Objetos
|
||||||
int mPosY; // Posicion en el eje Y
|
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||||
|
AnimatedSprite *headSprite; // Sprite para dibujar la cabeza
|
||||||
|
AnimatedSprite *bodySprite; // Sprite para dibujar el cuerpo
|
||||||
|
AnimatedSprite *legsSprite; // Sprite para dibujar las piernas
|
||||||
|
AnimatedSprite *deathSprite; // Sprite para dibujar el jugador derrotado
|
||||||
|
AnimatedSprite *fireSprite; // Sprite para dibujar el aura del jugador con el poder a tope
|
||||||
|
|
||||||
Uint8 mWidth; // Anchura
|
// Variables
|
||||||
Uint8 mHeight; // Altura
|
float posX; // Posicion en el eje X
|
||||||
|
int posY; // Posicion en el eje Y
|
||||||
|
|
||||||
float mVelX; // Cantidad de pixeles a desplazarse en el eje X
|
Uint8 width; // Anchura
|
||||||
int mVelY; // Cantidad de pixeles a desplazarse en el eje Y
|
Uint8 height; // Altura
|
||||||
|
|
||||||
float mBaseSpeed; // Velocidad base del jugador
|
float velX; // Cantidad de pixeles a desplazarse en el eje X
|
||||||
int mCooldown; // Contador durante el cual no puede disparar
|
int velY; // Cantidad de pixeles a desplazarse en el eje Y
|
||||||
|
|
||||||
Uint32 mScore; // Puntos del jugador
|
float baseSpeed; // Velocidad base del jugador
|
||||||
float mScoreMultiplier; // Multiplicador de puntos
|
int cooldown; // Contador durante el cual no puede disparar
|
||||||
|
|
||||||
Uint8 mStatusWalking; // Estado del jugador
|
Uint32 score; // Puntos del jugador
|
||||||
Uint8 mStatusFiring; // Estado del jugador
|
float scoreMultiplier; // Multiplicador de puntos
|
||||||
|
|
||||||
bool mAlive; // Indica si el jugador está vivo
|
Uint8 statusWalking; // Estado del jugador
|
||||||
Uint16 mDeathCounter; // Contador para la animación de morirse
|
Uint8 statusFiring; // Estado del jugador
|
||||||
bool mInvulnerable; // Indica si el jugador es invulnerable
|
|
||||||
Uint16 mInvulnerableCounter; // Contador para la invulnerabilidad
|
|
||||||
bool mExtraHit; // Indica si el jugador tiene un toque extra
|
|
||||||
Uint8 mCoffees; // Indica cuantos cafes lleva acumulados
|
|
||||||
bool mPowerUp; // Indica si el jugador tiene activo el modo PowerUp
|
|
||||||
Uint8 mPowerUpHeadOffset; // Variable para dibujar la cabeza normal o la del powerup
|
|
||||||
bool mInput; // Indica si puede recibir ordenes de entrada
|
|
||||||
|
|
||||||
AnimatedSprite *mSpriteLegs; // Sprite para dibujar las piernas
|
bool alive; // Indica si el jugador está vivo
|
||||||
AnimatedSprite *mSpriteBody; // Sprite para dibujar el cuerpo
|
Uint16 deathCounter; // Contador para la animación de morirse
|
||||||
AnimatedSprite *mSpriteHead; // Sprite para dibujar la cabeza
|
bool invulnerable; // Indica si el jugador es invulnerable
|
||||||
LTexture *mPlayerDeadTexture; // Textura con los gráficos para la animación de muerte
|
Uint16 invulnerableCounter; // Contador para la invulnerabilidad
|
||||||
|
bool extraHit; // Indica si el jugador tiene un toque extra
|
||||||
|
Uint8 coffees; // Indica cuantos cafes lleva acumulados
|
||||||
|
bool powerUp; // Indica si el jugador tiene activo el modo PowerUp
|
||||||
|
Uint16 powerUpCounter; // Temporizador para el modo PowerUp
|
||||||
|
bool input; // Indica si puede recibir ordenes de entrada
|
||||||
|
circle_t collider; // Circulo de colisión del jugador
|
||||||
|
|
||||||
circle_t mCollider; // Circulo de colisión del jugador
|
// Actualiza el circulo de colisión a la posición del jugador
|
||||||
void shiftColliders(); // Actualiza el circulo de colisión a la posición del jugador
|
void shiftColliders();
|
||||||
|
|
||||||
// Actualiza el valor de la variable
|
// Actualiza el valor de la variable
|
||||||
void updateInvulnerableCounter();
|
void updateInvulnerableCounter();
|
||||||
@@ -93,11 +82,8 @@ private:
|
|||||||
void updatePowerUpHeadOffset();
|
void updatePowerUpHeadOffset();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Uint8 mDeathIndex; // Apaño rapidito. Indice de SmartSprite donde esta ubicado el sprite de morirse
|
|
||||||
Uint16 mPowerUpCounter; // Temporizador para el modo PowerUp
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Player(float x, int y, LTexture *textureLegs, LTexture *textureBody, LTexture *textureHead, LTexture *textureDead, SDL_Renderer *renderer);
|
Player(float x, int y, SDL_Renderer *renderer, std::vector<LTexture *> texture, std::vector<std::vector<std::string> *> animations);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Player();
|
~Player();
|
||||||
@@ -105,15 +91,21 @@ public:
|
|||||||
// Iniciador
|
// Iniciador
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
// Actualiza al jugador a su posicion, animación y controla los contadores
|
||||||
|
void update();
|
||||||
|
|
||||||
|
// Pinta el jugador en pantalla
|
||||||
|
void render();
|
||||||
|
|
||||||
|
// Pone las texturas del jugador
|
||||||
|
void setPlayerTextures(std::vector<LTexture *> texture);
|
||||||
|
|
||||||
// Actua en consecuencia de la entrada recibida
|
// Actua en consecuencia de la entrada recibida
|
||||||
void setInput(Uint8 input);
|
void setInput(Uint8 input);
|
||||||
|
|
||||||
// Mueve el jugador a la posición y animación que le corresponde
|
// Mueve el jugador a la posición y animación que le corresponde
|
||||||
void move();
|
void move();
|
||||||
|
|
||||||
// Pinta el jugador en pantalla
|
|
||||||
void render();
|
|
||||||
|
|
||||||
// Establece el estado del jugador
|
// Establece el estado del jugador
|
||||||
void setWalkingStatus(Uint8 status);
|
void setWalkingStatus(Uint8 status);
|
||||||
|
|
||||||
@@ -144,9 +136,6 @@ public:
|
|||||||
// Actualiza el valor de la variable
|
// Actualiza el valor de la variable
|
||||||
void updateCooldown();
|
void updateCooldown();
|
||||||
|
|
||||||
// Actualiza al jugador a su posicion, animación y controla los contadores
|
|
||||||
void update();
|
|
||||||
|
|
||||||
// Obtiene la puntuación del jugador
|
// Obtiene la puntuación del jugador
|
||||||
Uint32 getScore();
|
Uint32 getScore();
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options, i
|
|||||||
// Crea la textura donde se dibujan los graficos del juego
|
// Crea la textura donde se dibujan los graficos del juego
|
||||||
gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight);
|
gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight);
|
||||||
if (gameCanvas == NULL)
|
if (gameCanvas == NULL)
|
||||||
|
{
|
||||||
printf("TitleSurface could not be created!\nSDL Error: %s\n", SDL_GetError());
|
printf("TitleSurface could not be created!\nSDL Error: %s\n", SDL_GetError());
|
||||||
|
}
|
||||||
|
|
||||||
// Establece el modo de video
|
// Establece el modo de video
|
||||||
setVideoMode(options->fullScreenMode);
|
setVideoMode(options->fullScreenMode);
|
||||||
|
|||||||
@@ -8,7 +8,18 @@ SmartSprite::SmartSprite(LTexture *texture, SDL_Renderer *renderer)
|
|||||||
setTexture(texture);
|
setTexture(texture);
|
||||||
setRenderer(renderer);
|
setRenderer(renderer);
|
||||||
|
|
||||||
// Inicializa variables
|
// Inicializa el objeto
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
SmartSprite::~SmartSprite()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inicializa el objeto
|
||||||
|
void SmartSprite::init()
|
||||||
|
{
|
||||||
enabled = false;
|
enabled = false;
|
||||||
enabledCounter = 0;
|
enabledCounter = 0;
|
||||||
onDestination = false;
|
onDestination = false;
|
||||||
@@ -18,11 +29,6 @@ SmartSprite::SmartSprite(LTexture *texture, SDL_Renderer *renderer)
|
|||||||
finished = false;
|
finished = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
|
||||||
SmartSprite::~SmartSprite()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actualiza la posición y comprueba si ha llegado a su destino
|
// Actualiza la posición y comprueba si ha llegado a su destino
|
||||||
void SmartSprite::update()
|
void SmartSprite::update()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ public:
|
|||||||
// Destructor
|
// Destructor
|
||||||
~SmartSprite();
|
~SmartSprite();
|
||||||
|
|
||||||
|
// Inicializa el objeto
|
||||||
|
void init();
|
||||||
|
|
||||||
// Actualiza la posición y comprueba si ha llegado a su destino
|
// Actualiza la posición y comprueba si ha llegado a su destino
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ Sprite::Sprite(int x, int y, int w, int h, LTexture *texture, SDL_Renderer *rend
|
|||||||
this->texture = texture;
|
this->texture = texture;
|
||||||
|
|
||||||
// Establece el rectangulo de donde coger la imagen
|
// Establece el rectangulo de donde coger la imagen
|
||||||
spriteClip = {x, y, w, h};
|
spriteClip = {0, 0, w, h};
|
||||||
|
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
enabled = true;
|
enabled = true;
|
||||||
@@ -41,7 +41,7 @@ Sprite::Sprite(SDL_Rect rect, LTexture *texture, SDL_Renderer *renderer)
|
|||||||
this->texture = texture;
|
this->texture = texture;
|
||||||
|
|
||||||
// Establece el rectangulo de donde coger la imagen
|
// Establece el rectangulo de donde coger la imagen
|
||||||
spriteClip = {x, y, w, h};
|
spriteClip = {0, 0, w, h};
|
||||||
|
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
enabled = true;
|
enabled = true;
|
||||||
@@ -148,6 +148,12 @@ void Sprite::setTexture(LTexture *texture)
|
|||||||
this->texture = texture;
|
this->texture = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Obten el valor de la variable
|
||||||
|
SDL_Renderer *Sprite::getRenderer()
|
||||||
|
{
|
||||||
|
return renderer;
|
||||||
|
}
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void Sprite::setRenderer(SDL_Renderer *renderer)
|
void Sprite::setRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ public:
|
|||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void setTexture(LTexture *texture);
|
void setTexture(LTexture *texture);
|
||||||
|
|
||||||
|
// Obten el valor de la variable
|
||||||
|
SDL_Renderer *getRenderer();
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void setRenderer(SDL_Renderer *renderer);
|
void setRenderer(SDL_Renderer *renderer);
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ void Text::initOffsetFromFile(std::string file)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
printf("Text loaded: %s\n\n", filename.c_str());
|
printf("Text loaded: %s\n", filename.c_str());
|
||||||
rfile.close();
|
rfile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
606
source/title.cpp
@@ -11,7 +11,9 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
|||||||
this->options = options;
|
this->options = options;
|
||||||
this->lang = lang;
|
this->lang = lang;
|
||||||
|
|
||||||
// Reserva memoria para los punteros propios
|
this->section = section;
|
||||||
|
|
||||||
|
// Reserva memoria para los punteros
|
||||||
eventHandler = new SDL_Event();
|
eventHandler = new SDL_Event();
|
||||||
fade = new Fade(renderer);
|
fade = new Fade(renderer);
|
||||||
|
|
||||||
@@ -31,6 +33,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
|||||||
|
|
||||||
menu.title = new Menu(renderer, asset, input, asset->get("title.men"));
|
menu.title = new Menu(renderer, asset, input, asset->get("title.men"));
|
||||||
menu.options = new Menu(renderer, asset, input, asset->get("options.men"));
|
menu.options = new Menu(renderer, asset, input, asset->get("options.men"));
|
||||||
|
menu.playerSelect = new Menu(renderer, asset, input, asset->get("player_select.men"));
|
||||||
|
|
||||||
// Sonidos
|
// Sonidos
|
||||||
crashSound = JA_LoadSound(asset->get("title.wav").c_str());
|
crashSound = JA_LoadSound(asset->get("title.wav").c_str());
|
||||||
@@ -38,8 +41,52 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
|||||||
// Musicas
|
// Musicas
|
||||||
titleMusic = JA_LoadMusic(asset->get("title.ogg").c_str());
|
titleMusic = JA_LoadMusic(asset->get("title.ogg").c_str());
|
||||||
|
|
||||||
|
// Inicializa los valores
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
Title::~Title()
|
||||||
|
{
|
||||||
|
delete eventHandler;
|
||||||
|
delete fade;
|
||||||
|
|
||||||
|
dustTexture->unload();
|
||||||
|
delete dustTexture;
|
||||||
|
|
||||||
|
coffeeTexture->unload();
|
||||||
|
delete coffeeTexture;
|
||||||
|
|
||||||
|
crisisTexture->unload();
|
||||||
|
delete crisisTexture;
|
||||||
|
|
||||||
|
gradientTexture->unload();
|
||||||
|
delete gradientTexture;
|
||||||
|
|
||||||
|
delete coffeeBitmap;
|
||||||
|
delete crisisBitmap;
|
||||||
|
delete dustBitmapL;
|
||||||
|
delete dustBitmapR;
|
||||||
|
delete gradient;
|
||||||
|
|
||||||
|
delete text1;
|
||||||
|
delete text2;
|
||||||
|
|
||||||
|
delete menu.title;
|
||||||
|
delete menu.options;
|
||||||
|
delete menu.playerSelect;
|
||||||
|
|
||||||
|
JA_DeleteSound(crashSound);
|
||||||
|
JA_DeleteMusic(titleMusic);
|
||||||
|
|
||||||
|
SDL_DestroyTexture(background);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inicializa los valores
|
||||||
|
void Title::init()
|
||||||
|
{
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
this->section = section;
|
section.subsection = TITLE_SECTION_1;
|
||||||
counter = TITLE_COUNTER;
|
counter = TITLE_COUNTER;
|
||||||
backgroundCounter = 0;
|
backgroundCounter = 0;
|
||||||
backgroundMode = rand() % 2;
|
backgroundMode = rand() % 2;
|
||||||
@@ -50,7 +97,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
|||||||
ticks = 0;
|
ticks = 0;
|
||||||
ticksSpeed = 15;
|
ticksSpeed = 15;
|
||||||
fade->init(0x17, 0x17, 0x26);
|
fade->init(0x17, 0x17, 0x26);
|
||||||
demo = false;
|
demo = true;
|
||||||
|
|
||||||
// Pone valores por defecto a las opciones de control
|
// Pone valores por defecto a las opciones de control
|
||||||
options->input.clear();
|
options->input.clear();
|
||||||
@@ -83,6 +130,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inicializa el bitmap de Coffee
|
// Inicializa el bitmap de Coffee
|
||||||
|
coffeeBitmap->init();
|
||||||
coffeeBitmap->setPosX(45);
|
coffeeBitmap->setPosX(45);
|
||||||
coffeeBitmap->setPosY(11 - 200);
|
coffeeBitmap->setPosY(11 - 200);
|
||||||
coffeeBitmap->setWidth(167);
|
coffeeBitmap->setWidth(167);
|
||||||
@@ -98,6 +146,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
|||||||
coffeeBitmap->setDestY(11);
|
coffeeBitmap->setDestY(11);
|
||||||
|
|
||||||
// Inicializa el bitmap de Crisis
|
// Inicializa el bitmap de Crisis
|
||||||
|
crisisBitmap->init();
|
||||||
crisisBitmap->setPosX(60);
|
crisisBitmap->setPosX(60);
|
||||||
crisisBitmap->setPosY(57 + 200);
|
crisisBitmap->setPosY(57 + 200);
|
||||||
crisisBitmap->setWidth(137);
|
crisisBitmap->setWidth(137);
|
||||||
@@ -113,6 +162,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
|||||||
crisisBitmap->setDestY(57);
|
crisisBitmap->setDestY(57);
|
||||||
|
|
||||||
// Inicializa el bitmap de DustRight
|
// Inicializa el bitmap de DustRight
|
||||||
|
dustBitmapR->resetAnimation();
|
||||||
dustBitmapR->setPosX(218);
|
dustBitmapR->setPosX(218);
|
||||||
dustBitmapR->setPosY(47);
|
dustBitmapR->setPosY(47);
|
||||||
dustBitmapR->setWidth(16);
|
dustBitmapR->setWidth(16);
|
||||||
@@ -120,6 +170,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
|||||||
dustBitmapR->setFlip(SDL_FLIP_HORIZONTAL);
|
dustBitmapR->setFlip(SDL_FLIP_HORIZONTAL);
|
||||||
|
|
||||||
// Inicializa el bitmap de DustLeft
|
// Inicializa el bitmap de DustLeft
|
||||||
|
dustBitmapL->resetAnimation();
|
||||||
dustBitmapL->setPosX(33);
|
dustBitmapL->setPosX(33);
|
||||||
dustBitmapL->setPosY(47);
|
dustBitmapL->setPosY(47);
|
||||||
dustBitmapL->setWidth(16);
|
dustBitmapL->setWidth(16);
|
||||||
@@ -144,43 +195,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actualiza los textos de los menus
|
// Actualiza los textos de los menus
|
||||||
// updateMenuLabels();
|
updateMenuLabels();
|
||||||
}
|
|
||||||
|
|
||||||
// Destructor
|
|
||||||
Title::~Title()
|
|
||||||
{
|
|
||||||
delete eventHandler;
|
|
||||||
delete fade;
|
|
||||||
|
|
||||||
dustTexture->unload();
|
|
||||||
delete dustTexture;
|
|
||||||
|
|
||||||
coffeeTexture->unload();
|
|
||||||
delete coffeeTexture;
|
|
||||||
|
|
||||||
crisisTexture->unload();
|
|
||||||
delete crisisTexture;
|
|
||||||
|
|
||||||
gradientTexture->unload();
|
|
||||||
delete gradientTexture;
|
|
||||||
|
|
||||||
delete coffeeBitmap;
|
|
||||||
delete crisisBitmap;
|
|
||||||
delete dustBitmapL;
|
|
||||||
delete dustBitmapR;
|
|
||||||
delete gradient;
|
|
||||||
|
|
||||||
delete text1;
|
|
||||||
delete text2;
|
|
||||||
|
|
||||||
delete menu.title;
|
|
||||||
delete menu.options;
|
|
||||||
|
|
||||||
JA_DeleteSound(crashSound);
|
|
||||||
JA_DeleteMusic(titleMusic);
|
|
||||||
|
|
||||||
SDL_DestroyTexture(background);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actualiza las variables del objeto
|
// Actualiza las variables del objeto
|
||||||
@@ -201,8 +216,8 @@ void Title::update()
|
|||||||
case TITLE_SECTION_1:
|
case TITLE_SECTION_1:
|
||||||
{
|
{
|
||||||
// Actualiza los objetos
|
// Actualiza los objetos
|
||||||
mCoffeeBitmap->update();
|
coffeeBitmap->update();
|
||||||
mCrisisBitmap->update();
|
crisisBitmap->update();
|
||||||
|
|
||||||
// Si los objetos han llegado a su destino, cambiamos de Sección
|
// Si los objetos han llegado a su destino, cambiamos de Sección
|
||||||
if (coffeeBitmap->hasFinished() && crisisBitmap->hasFinished())
|
if (coffeeBitmap->hasFinished() && crisisBitmap->hasFinished())
|
||||||
@@ -210,12 +225,12 @@ void Title::update()
|
|||||||
section.subsection = TITLE_SECTION_2;
|
section.subsection = TITLE_SECTION_2;
|
||||||
|
|
||||||
// Pantallazo blanco
|
// Pantallazo blanco
|
||||||
SDL_SetRenderDrawColor(mRenderer, 0xFF, 0xFF, 0xFF, 0xFF);
|
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||||
SDL_RenderClear(mRenderer);
|
SDL_RenderClear(renderer);
|
||||||
SDL_RenderPresent(mRenderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
|
||||||
// Reproduce el efecto sonoro
|
// Reproduce el efecto sonoro
|
||||||
JA_PlaySound(mSound);
|
JA_PlaySound(crashSound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -225,20 +240,20 @@ void Title::update()
|
|||||||
{
|
{
|
||||||
// Agita la pantalla
|
// Agita la pantalla
|
||||||
static const int v[] = {-1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 0};
|
static const int v[] = {-1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 0};
|
||||||
static const int a = mCoffeeBitmap->getPosX();
|
static const int a = coffeeBitmap->getPosX();
|
||||||
static const int b = mCrisisBitmap->getPosX();
|
static const int b = crisisBitmap->getPosX();
|
||||||
static int step = 0;
|
static int step = 0;
|
||||||
|
|
||||||
mCoffeeBitmap->setPosX(a + v[step / 3]);
|
coffeeBitmap->setPosX(a + v[step / 3]);
|
||||||
mCrisisBitmap->setPosX(b + v[step / 3]);
|
crisisBitmap->setPosX(b + v[step / 3]);
|
||||||
mDustBitmapR->update();
|
dustBitmapR->update();
|
||||||
mDustBitmapL->update();
|
dustBitmapL->update();
|
||||||
|
|
||||||
step++;
|
step++;
|
||||||
|
|
||||||
if (step == 33)
|
if (step == 33)
|
||||||
{
|
{
|
||||||
mSection.subsection = TITLE_SECTION_3;
|
section.subsection = TITLE_SECTION_3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -246,181 +261,251 @@ void Title::update()
|
|||||||
// Sección 3 - La pantalla de titulo con el menú y la música
|
// Sección 3 - La pantalla de titulo con el menú y la música
|
||||||
case TITLE_SECTION_3:
|
case TITLE_SECTION_3:
|
||||||
{
|
{
|
||||||
// Reproduce la música
|
if (counter > 0)
|
||||||
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
|
{ // Reproduce la música
|
||||||
{
|
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
|
||||||
JA_PlayMusic(titleMusic);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actualiza el contador de ticks
|
|
||||||
ticks = SDL_GetTicks();
|
|
||||||
|
|
||||||
dustBitmapR->update();
|
|
||||||
dustBitmapL->update();
|
|
||||||
|
|
||||||
// Actualiza la lógica del titulo
|
|
||||||
menu.active->update();
|
|
||||||
fade->update();
|
|
||||||
|
|
||||||
if (fade->hasEnded())
|
|
||||||
{
|
|
||||||
switch (postFade)
|
|
||||||
{
|
{
|
||||||
case 0: // 1 PLAYER
|
JA_PlayMusic(titleMusic);
|
||||||
section.name = PROG_SECTION_GAME;
|
}
|
||||||
section.subsection = GAME_SECTION_PLAY_1P;
|
|
||||||
JA_StopMusic();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1: // 2 PLAYERS
|
dustBitmapR->update();
|
||||||
section.name = PROG_SECTION_GAME;
|
dustBitmapL->update();
|
||||||
section.subsection = GAME_SECTION_PLAY_2P;
|
|
||||||
JA_StopMusic();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2: // QUIT
|
// Actualiza la lógica del titulo
|
||||||
section.name = PROG_SECTION_QUIT;
|
fade->update();
|
||||||
JA_StopMusic();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3: // TIME OUT
|
if (fade->hasEnded())
|
||||||
|
{
|
||||||
|
switch (postFade)
|
||||||
|
{
|
||||||
|
case 0: // 1 PLAYER
|
||||||
|
section.name = PROG_SECTION_GAME;
|
||||||
|
section.subsection = GAME_SECTION_PLAY_1P;
|
||||||
|
JA_StopMusic();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: // 2 PLAYERS
|
||||||
|
section.name = PROG_SECTION_GAME;
|
||||||
|
section.subsection = GAME_SECTION_PLAY_2P;
|
||||||
|
JA_StopMusic();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: // QUIT
|
||||||
|
section.name = PROG_SECTION_QUIT;
|
||||||
|
JA_StopMusic();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: // TIME OUT
|
||||||
|
counter = TITLE_COUNTER;
|
||||||
|
menu.active->reset();
|
||||||
|
if (demo)
|
||||||
|
{
|
||||||
|
runDemoGame();
|
||||||
|
if (section.name != PROG_SECTION_QUIT)
|
||||||
|
{
|
||||||
|
runInstructions(m_auto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
section.name = PROG_SECTION_LOGO;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actualiza el tileado de fondo
|
||||||
|
updateBG();
|
||||||
|
|
||||||
|
// Comprueba las entradas para el menu
|
||||||
|
if (menuVisible == true)
|
||||||
|
{
|
||||||
|
menu.active->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comprueba si se ha seleccionado algún item del menú de titulo
|
||||||
|
if (menu.active->getName() == "TITLE")
|
||||||
|
{
|
||||||
|
switch (menu.active->getItemSelected())
|
||||||
|
{
|
||||||
|
case 0: // 1 PLAYER -> Cambia al manu de selección de jugador
|
||||||
|
menu.active = menu.playerSelect;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: // 2 PLAYERS
|
||||||
|
postFade = 1;
|
||||||
|
fade->activateFade();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: // OPTIONS
|
||||||
|
menu.active = menu.options;
|
||||||
|
optionsPrevious = *options;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: // QUIT
|
||||||
|
postFade = 2;
|
||||||
|
fade->activateFade();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comprueba si se ha seleccionado algún item del menú de selección de jugador
|
||||||
|
if (menu.active->getName() == "PLAYER_SELECT")
|
||||||
|
{
|
||||||
|
switch (menu.active->getItemSelected())
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
// Este item no se puede seleccionar y actua de titulo
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: // BAL1
|
||||||
|
postFade = 0;
|
||||||
|
options->playerSelected = 0;
|
||||||
|
fade->activateFade();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: // AROUNDER
|
||||||
|
postFade = 0;
|
||||||
|
options->playerSelected = 1;
|
||||||
|
fade->activateFade();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: // BACK
|
||||||
|
menu.active = menu.title;
|
||||||
|
menu.playerSelect->reset();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comprueba si se ha seleccionado algún item de opciones
|
||||||
|
if (menu.active->getName() == "OPTIONS")
|
||||||
|
{
|
||||||
|
switch (menu.active->getItemSelected())
|
||||||
|
{
|
||||||
|
case 0: // Difficulty
|
||||||
|
if (options->difficulty == DIFFICULTY_EASY)
|
||||||
|
options->difficulty = DIFFICULTY_NORMAL;
|
||||||
|
else if (options->difficulty == DIFFICULTY_NORMAL)
|
||||||
|
options->difficulty = DIFFICULTY_HARD;
|
||||||
|
else
|
||||||
|
options->difficulty = DIFFICULTY_EASY;
|
||||||
|
updateMenuLabels();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: // PLAYER 1 CONTROLS
|
||||||
|
updatePlayerInputs(0);
|
||||||
|
updateMenuLabels();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: // PLAYER 2 CONTROLS
|
||||||
|
updatePlayerInputs(1);
|
||||||
|
updateMenuLabels();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5: // Language
|
||||||
|
options->language++;
|
||||||
|
if (options->language == 3)
|
||||||
|
options->language = 0;
|
||||||
|
updateMenuLabels();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6: // Display mode
|
||||||
|
switchFullScreenModeVar();
|
||||||
|
if (options->fullScreenMode != 0)
|
||||||
|
{
|
||||||
|
menu.options->setSelectable(8, false);
|
||||||
|
menu.options->setGreyed(8, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menu.options->setSelectable(8, true);
|
||||||
|
menu.options->setGreyed(8, false);
|
||||||
|
}
|
||||||
|
updateMenuLabels();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8: // Windows size
|
||||||
|
options->windowSize++;
|
||||||
|
if (options->windowSize == 5)
|
||||||
|
options->windowSize = 1;
|
||||||
|
updateMenuLabels();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 9: // FILTER
|
||||||
|
if (options->filter == FILTER_LINEAL)
|
||||||
|
options->filter = FILTER_NEAREST;
|
||||||
|
else
|
||||||
|
options->filter = FILTER_LINEAL;
|
||||||
|
updateMenuLabels();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 10: // VSYNC
|
||||||
|
if (options->vSync)
|
||||||
|
options->vSync = false;
|
||||||
|
else
|
||||||
|
options->vSync = true;
|
||||||
|
updateMenuLabels();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 11: // HOW TO PLAY
|
||||||
|
runInstructions(m_manual);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 12: // ACCEPT
|
||||||
|
applyOptions();
|
||||||
|
menu.active->reset();
|
||||||
|
menu.active = menu.title;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 13: // CANCEL
|
||||||
|
options = &optionsPrevious;
|
||||||
|
updateMenuLabels();
|
||||||
|
menu.active->reset();
|
||||||
|
menu.active = menu.title;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (menu.active->getName() == "TITLE")
|
||||||
|
{
|
||||||
|
counter--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (counter == 0)
|
||||||
|
{
|
||||||
|
if (demo)
|
||||||
|
{
|
||||||
|
runDemoGame();
|
||||||
|
if (section.name != PROG_SECTION_QUIT)
|
||||||
|
{
|
||||||
|
runInstructions(m_auto);
|
||||||
|
}
|
||||||
|
init();
|
||||||
|
demo = false;
|
||||||
counter = TITLE_COUNTER;
|
counter = TITLE_COUNTER;
|
||||||
menu.active->reset();
|
|
||||||
if (demo)
|
|
||||||
{
|
|
||||||
runDemoGame();
|
|
||||||
runInstructions(INSTRUCTIONS_MODE_AUTO);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
section.name = PROG_SECTION_LOGO;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
|
||||||
// Actualiza el tileado de fondo
|
|
||||||
updateBG();
|
|
||||||
|
|
||||||
// Comprueba las entradas para el menu
|
|
||||||
if (menuVisible == true)
|
|
||||||
{
|
|
||||||
menu.active->checkInput();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Comprueba si se ha seleccionado algún item del menú
|
|
||||||
if (menu.active->getName() == "TITLE")
|
|
||||||
{
|
|
||||||
switch (menu.active->getItemSelected())
|
|
||||||
{
|
{
|
||||||
case 0: // 1 PLAYER
|
section.name = PROG_SECTION_LOGO;
|
||||||
postFade = 0;
|
|
||||||
fade->activateFade();
|
|
||||||
break;
|
|
||||||
case 1: // 2 PLAYERS
|
|
||||||
postFade = 1;
|
|
||||||
fade->activateFade();
|
|
||||||
break;
|
|
||||||
case 2: // OPTIONS
|
|
||||||
menu.active = menu.options;
|
|
||||||
optionsPrevious = *options;
|
|
||||||
break;
|
|
||||||
case 3: // QUIT
|
|
||||||
postFade = 2;
|
|
||||||
fade->activateFade();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba si se ha seleccionado algún item de opciones
|
// Sección Instrucciones
|
||||||
if (menu.active->getName() == "OPTIONS")
|
if (section.subsection == TITLE_SECTION_INSTRUCTIONS)
|
||||||
{
|
{
|
||||||
switch (menu.active->getItemSelected())
|
runInstructions(m_auto);
|
||||||
{
|
counter = TITLE_COUNTER;
|
||||||
case 0: // Difficulty
|
demo = true;
|
||||||
if (options->difficulty == DIFFICULTY_EASY)
|
|
||||||
options->difficulty = DIFFICULTY_NORMAL;
|
|
||||||
else if (options->difficulty == DIFFICULTY_NORMAL)
|
|
||||||
options->difficulty = DIFFICULTY_HARD;
|
|
||||||
else
|
|
||||||
options->difficulty = DIFFICULTY_EASY;
|
|
||||||
updateMenuLabels();
|
|
||||||
break;
|
|
||||||
case 1: // PLAYER 1 CONTROLS
|
|
||||||
updatePlayerInputs(0);
|
|
||||||
updateMenuLabels();
|
|
||||||
break;
|
|
||||||
case 3: // PLAYER 2 CONTROLS
|
|
||||||
updatePlayerInputs(1);
|
|
||||||
updateMenuLabels();
|
|
||||||
break;
|
|
||||||
case 5: // Language
|
|
||||||
options->language++;
|
|
||||||
if (options->language == 3)
|
|
||||||
options->language = 0;
|
|
||||||
updateMenuLabels();
|
|
||||||
break;
|
|
||||||
case 6: // Display mode
|
|
||||||
switchFullScreenModeVar();
|
|
||||||
if (options->fullScreenMode != 0)
|
|
||||||
{
|
|
||||||
menu.options->setSelectable(8, false);
|
|
||||||
menu.options->setGreyed(8, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
menu.options->setSelectable(8, true);
|
|
||||||
menu.options->setGreyed(8, false);
|
|
||||||
}
|
|
||||||
updateMenuLabels();
|
|
||||||
break;
|
|
||||||
case 8: // Windows size
|
|
||||||
options->windowSize++;
|
|
||||||
if (options->windowSize == 5)
|
|
||||||
options->windowSize = 1;
|
|
||||||
updateMenuLabels();
|
|
||||||
break;
|
|
||||||
case 9: // FILTER
|
|
||||||
if (options->filter == FILTER_LINEAL)
|
|
||||||
options->filter = FILTER_NEAREST;
|
|
||||||
else
|
|
||||||
options->filter = FILTER_LINEAL;
|
|
||||||
updateMenuLabels();
|
|
||||||
break;
|
|
||||||
case 10: // VSYNC
|
|
||||||
if (options->vSync)
|
|
||||||
options->vSync = false;
|
|
||||||
else
|
|
||||||
options->vSync = true;
|
|
||||||
updateMenuLabels();
|
|
||||||
break;
|
|
||||||
case 11: // HOW TO PLAY
|
|
||||||
runInstructions(INSTRUCTIONS_MODE_MANUAL);
|
|
||||||
break;
|
|
||||||
case 12: // ACCEPT
|
|
||||||
applyOptions();
|
|
||||||
menu.active->reset();
|
|
||||||
menu.active = menu.title;
|
|
||||||
break;
|
|
||||||
case 13: // CANCEL
|
|
||||||
options = &optionsPrevious;
|
|
||||||
updateMenuLabels();
|
|
||||||
menu.active->reset();
|
|
||||||
menu.active = menu.title;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (menu.active->getName() == "TITLE")
|
|
||||||
{
|
|
||||||
counter--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,23 +526,23 @@ void Title::render()
|
|||||||
case TITLE_SECTION_1:
|
case TITLE_SECTION_1:
|
||||||
{
|
{
|
||||||
// Prepara para empezar a dibujar en la textura de juego
|
// Prepara para empezar a dibujar en la textura de juego
|
||||||
mScreen->start();
|
screen->start();
|
||||||
|
|
||||||
// Limpia la pantalla
|
// Limpia la pantalla
|
||||||
mScreen->clean(bgColor);
|
screen->clean(bgColor);
|
||||||
|
|
||||||
// Dibuja el tileado de fondo
|
// Dibuja el tileado de fondo
|
||||||
SDL_RenderCopy(mRenderer, mBackground, &mBackgroundWindow, nullptr);
|
SDL_RenderCopy(renderer, background, &backgroundWindow, nullptr);
|
||||||
|
|
||||||
// Dibuja el degradado
|
// Dibuja el degradado
|
||||||
mGradient->render();
|
gradient->render();
|
||||||
|
|
||||||
// Dibuja los objetos
|
// Dibuja los objetos
|
||||||
mCoffeeBitmap->render();
|
coffeeBitmap->render();
|
||||||
mCrisisBitmap->render();
|
crisisBitmap->render();
|
||||||
|
|
||||||
// Vuelca el contenido del renderizador en pantalla
|
// Vuelca el contenido del renderizador en pantalla
|
||||||
mScreen->blit();
|
screen->blit();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -569,6 +654,40 @@ void Title::checkEventHandler()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0)
|
||||||
|
{
|
||||||
|
switch (eventHandler->key.keysym.scancode)
|
||||||
|
{
|
||||||
|
case SDL_SCANCODE_F:
|
||||||
|
screen->switchVideoMode();
|
||||||
|
reloadTextures();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F1:
|
||||||
|
screen->setWindowSize(1);
|
||||||
|
reloadTextures();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F2:
|
||||||
|
screen->setWindowSize(2);
|
||||||
|
reloadTextures();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F3:
|
||||||
|
screen->setWindowSize(3);
|
||||||
|
reloadTextures();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F4:
|
||||||
|
screen->setWindowSize(4);
|
||||||
|
reloadTextures();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (section.subsection == TITLE_SECTION_3)
|
if (section.subsection == TITLE_SECTION_3)
|
||||||
{ // Si se pulsa alguna tecla durante la tercera sección del titulo
|
{ // Si se pulsa alguna tecla durante la tercera sección del titulo
|
||||||
if ((eventHandler->type == SDL_KEYUP) || (eventHandler->type == SDL_JOYBUTTONUP))
|
if ((eventHandler->type == SDL_KEYUP) || (eventHandler->type == SDL_JOYBUTTONUP))
|
||||||
@@ -792,6 +911,14 @@ void Title::updateMenuLabels()
|
|||||||
// Recoloca el menu de titulo
|
// Recoloca el menu de titulo
|
||||||
menu.title->centerMenuOnX(SCREEN_CENTER_X);
|
menu.title->centerMenuOnX(SCREEN_CENTER_X);
|
||||||
menu.title->centerMenuElementsOnX();
|
menu.title->centerMenuElementsOnX();
|
||||||
|
|
||||||
|
// Establece las etiquetas del menu de seleccion de jugador
|
||||||
|
menu.playerSelect->setItemCaption(0, lang->getText(39)); // SELECT PLAYER
|
||||||
|
menu.playerSelect->setItemCaption(3, lang->getText(40)); // BACK
|
||||||
|
|
||||||
|
// Recoloca el menu de selección de jugador
|
||||||
|
menu.playerSelect->centerMenuOnX(SCREEN_CENTER_X);
|
||||||
|
menu.playerSelect->centerMenuElementsOnX();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aplica las opciones de menu seleccionadas
|
// Aplica las opciones de menu seleccionadas
|
||||||
@@ -812,32 +939,29 @@ section_t Title::run()
|
|||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
render();
|
render();
|
||||||
// Sección 3 - La pantalla de titulo con el menú y la música
|
|
||||||
|
|
||||||
// Sección Instrucciones
|
|
||||||
// if (section.subsection == TITLE_SECTION_INSTRUCTIONS)
|
|
||||||
//{
|
|
||||||
// runInstructions(INSTRUCTIONS_MODE_AUTO);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ejecuta la parte donde se muestran las instrucciones
|
// Ejecuta la parte donde se muestran las instrucciones
|
||||||
void Title::runInstructions(Uint8 mode)
|
section_t Title::runInstructions(mode_e mode)
|
||||||
{
|
{
|
||||||
instructions = new Instructions(renderer, screen, asset, lang);
|
instructions = new Instructions(renderer, screen, asset, lang);
|
||||||
instructions->run(mode);
|
section = instructions->run(mode);
|
||||||
delete instructions;
|
delete instructions;
|
||||||
|
|
||||||
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ejecuta el juego en modo demo
|
// Ejecuta el juego en modo demo
|
||||||
void Title::runDemoGame()
|
section_t Title::runDemoGame()
|
||||||
{
|
{
|
||||||
demoGame = new Game(1, 0, renderer, screen, asset, lang, input, true, options);
|
demoGame = new Game(1, 0, renderer, screen, asset, lang, input, true, options);
|
||||||
demoGame->run();
|
section = demoGame->run();
|
||||||
delete demoGame;
|
delete demoGame;
|
||||||
|
|
||||||
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modifica las opciones para los controles de los jugadores
|
// Modifica las opciones para los controles de los jugadores
|
||||||
@@ -960,4 +1084,14 @@ void Title::checkInputDevices()
|
|||||||
temp.deviceType = INPUT_USE_KEYBOARD;
|
temp.deviceType = INPUT_USE_KEYBOARD;
|
||||||
availableInputDevices.push_back(temp);
|
availableInputDevices.push_back(temp);
|
||||||
printf("Device %i:\t%s\n\n", (int)availableInputDevices.size(), temp.name.c_str());
|
printf("Device %i:\t%s\n\n", (int)availableInputDevices.size(), temp.name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recarga las texturas
|
||||||
|
void Title::reloadTextures()
|
||||||
|
{
|
||||||
|
dustTexture->reLoad();
|
||||||
|
coffeeTexture->reLoad();
|
||||||
|
crisisTexture->reLoad();
|
||||||
|
gradientTexture->reLoad();
|
||||||
|
createTiledBackground();
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
#define TITLE_H
|
#define TITLE_H
|
||||||
|
|
||||||
// Textos
|
// Textos
|
||||||
#define TEXT_COPYRIGHT "@2020,2022 JailDesigner (v2.1)"
|
#define TEXT_COPYRIGHT "@2020,2022 JailDesigner (v2.1a)"
|
||||||
|
|
||||||
// Contadores
|
// Contadores
|
||||||
#define TITLE_COUNTER 800
|
#define TITLE_COUNTER 800
|
||||||
@@ -35,10 +35,11 @@ class Title
|
|||||||
private:
|
private:
|
||||||
struct menu_t
|
struct menu_t
|
||||||
{
|
{
|
||||||
Menu *title; // Menu de la pantalla de título
|
Menu *title; // Menu de la pantalla de título
|
||||||
Menu *options; // Menú de la pantalla de opciones
|
Menu *options; // Menú de la pantalla de opciones
|
||||||
Menu *active; // Menu activo (de momento para la pantalla del titulo)
|
Menu *playerSelect; // Menu para elegir jugador
|
||||||
bool keyPressed; // Variable para evitar la repetición de teclas en los menus
|
Menu *active; // Menu activo (de momento para la pantalla del titulo)
|
||||||
|
bool keyPressed; // Variable para evitar la repetición de teclas en los menus
|
||||||
};
|
};
|
||||||
|
|
||||||
// Objetos
|
// Objetos
|
||||||
@@ -91,6 +92,9 @@ private:
|
|||||||
std::vector<input_t> availableInputDevices; // Vector con todos los metodos de control disponibles
|
std::vector<input_t> availableInputDevices; // Vector con todos los metodos de control disponibles
|
||||||
std::vector<int> deviceIndex; // Indice para el jugador [i] del vector de dispositivos de entrada disponibles
|
std::vector<int> deviceIndex; // Indice para el jugador [i] del vector de dispositivos de entrada disponibles
|
||||||
|
|
||||||
|
// Inicializa los valores
|
||||||
|
void init();
|
||||||
|
|
||||||
// Actualiza las variables del objeto
|
// Actualiza las variables del objeto
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
@@ -113,10 +117,10 @@ private:
|
|||||||
void applyOptions();
|
void applyOptions();
|
||||||
|
|
||||||
// Ejecuta la parte donde se muestran las instrucciones
|
// Ejecuta la parte donde se muestran las instrucciones
|
||||||
void runInstructions(Uint8 mode);
|
section_t runInstructions(mode_e mode);
|
||||||
|
|
||||||
// Ejecuta el juego en modo demo
|
// Ejecuta el juego en modo demo
|
||||||
void runDemoGame();
|
section_t runDemoGame();
|
||||||
|
|
||||||
// Modifica las opciones para los controles de los jugadores
|
// Modifica las opciones para los controles de los jugadores
|
||||||
bool updatePlayerInputs(int numPlayer);
|
bool updatePlayerInputs(int numPlayer);
|
||||||
@@ -127,6 +131,9 @@ private:
|
|||||||
// Comprueba cuantos mandos hay conectados para gestionar el menu de opciones
|
// Comprueba cuantos mandos hay conectados para gestionar el menu de opciones
|
||||||
void checkInputDevices();
|
void checkInputDevices();
|
||||||
|
|
||||||
|
// Recarga las texturas
|
||||||
|
void reloadTextures();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset, options_t *options, Lang *lang, section_t section);
|
Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset, options_t *options, Lang *lang, section_t section);
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ struct input_t
|
|||||||
struct options_t
|
struct options_t
|
||||||
{
|
{
|
||||||
Uint8 difficulty; // Dificultad del juego
|
Uint8 difficulty; // Dificultad del juego
|
||||||
|
Uint8 playerSelected; // Jugador seleccionado para el modo 1P
|
||||||
std::vector<input_t> input; // Modo de control (teclado o mando)
|
std::vector<input_t> input; // Modo de control (teclado o mando)
|
||||||
Uint8 language; // Idioma usado en el juego
|
Uint8 language; // Idioma usado en el juego
|
||||||
Uint32 fullScreenMode; // Contiene el valor del modo de pantalla completa
|
Uint32 fullScreenMode; // Contiene el valor del modo de pantalla completa
|
||||||
|
|||||||