Compare commits
14 Commits
ca7ae7418e
...
v2.1a
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d52c45f5c | |||
| 3276027044 | |||
| 8041595976 | |||
| fa53c1b01a | |||
| 20b362160e | |||
| 5cabbfc487 | |||
| 9f5e001c70 | |||
| 112c3afc76 | |||
| f4215384fe | |||
| 7796cee51a | |||
| f83154c062 | |||
| 9e73f7f97d | |||
| 742ca02573 | |||
| d77757853d |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,6 +1,6 @@
|
|||||||
.vscode
|
.vscode
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
bin
|
bin
|
||||||
data/config.txt
|
data/config/config.txt
|
||||||
data/config.bin
|
data/config/config.bin
|
||||||
data/score.bin
|
data/config/score.bin
|
||||||
5
Makefile
5
Makefile
@@ -3,10 +3,11 @@ executable = coffee_crisis
|
|||||||
windows:
|
windows:
|
||||||
@echo off
|
@echo off
|
||||||
if not exist bin\ (mkdir bin)
|
if not exist bin\ (mkdir bin)
|
||||||
g++ -std=c++11 -Wall -O2 source/*.cpp -lmingw32 -lSDL2main -lSDL2 -o bin/$(executable).exe
|
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++ source/*.cpp -std=c++11 -Wall -O2 -lSDL2 -o bin/$(executable)_macos
|
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 -Wall -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
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -43,6 +43,8 @@ loop=0
|
|||||||
frames=20,21,22,23
|
frames=20,21,22,23
|
||||||
[/animation]
|
[/animation]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=sideshoot
|
name=sideshoot
|
||||||
speed=5
|
speed=5
|
||||||
@@ -84,3 +86,91 @@ speed=5
|
|||||||
loop=0
|
loop=0
|
||||||
frames=44,45,46,47
|
frames=44,45,46,47
|
||||||
[/animation]
|
[/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]
|
||||||
@@ -61,54 +61,54 @@ frames=28,29,30,31
|
|||||||
name=sideshoot
|
name=sideshoot
|
||||||
speed=5
|
speed=5
|
||||||
loop=0
|
loop=0
|
||||||
frames=32,33,34,35
|
frames=16,17,18,19
|
||||||
[/animation]
|
[/animation]
|
||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=centershoot
|
name=centershoot
|
||||||
speed=5
|
speed=5
|
||||||
loop=0
|
loop=0
|
||||||
frames=36,37,38,39
|
frames=20,21,22,23
|
||||||
[/animation]
|
[/animation]
|
||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=sideshoot_1C
|
name=sideshoot_1C
|
||||||
speed=5
|
speed=5
|
||||||
loop=0
|
loop=0
|
||||||
frames=40,41,42,43
|
frames=24,25,26,27
|
||||||
[/animation]
|
[/animation]
|
||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=centershoot_1C
|
name=centershoot_1C
|
||||||
speed=5
|
speed=5
|
||||||
loop=0
|
loop=0
|
||||||
frames=44,45,46,47
|
frames=28,29,30,31
|
||||||
[/animation]
|
[/animation]
|
||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=sideshoot_pwr
|
name=sideshoot_pwr
|
||||||
speed=5
|
speed=2
|
||||||
loop=0
|
loop=0
|
||||||
frames=48,49,50,51
|
frames=16,17,18,19
|
||||||
[/animation]
|
[/animation]
|
||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=centershoot_pwr
|
name=centershoot_pwr
|
||||||
speed=5
|
speed=2
|
||||||
loop=0
|
loop=0
|
||||||
frames=52,53,54,55
|
frames=20,21,22,23
|
||||||
[/animation]
|
[/animation]
|
||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=sideshoot_1C_pwr
|
name=sideshoot_1C_pwr
|
||||||
speed=5
|
speed=2
|
||||||
loop=0
|
loop=0
|
||||||
frames=56,57,58,59
|
frames=24,25,26,27
|
||||||
[/animation]
|
[/animation]
|
||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=centershoot_1C_pwr
|
name=centershoot_1C_pwr
|
||||||
speed=5
|
speed=2
|
||||||
loop=0
|
loop=0
|
||||||
frames=60,61,62,63
|
frames=28,29,30,31
|
||||||
[/animation]
|
[/animation]
|
||||||
@@ -115,14 +115,14 @@ D E M O
|
|||||||
## 38 - TEXTOS DEL JUEGO
|
## 38 - TEXTOS DEL JUEGO
|
||||||
fases mes!
|
fases mes!
|
||||||
|
|
||||||
## 39 -
|
## 39 - MENU SELECCION DE JUGADOR
|
||||||
-
|
Selecciona personatge
|
||||||
|
|
||||||
## 40 -
|
## 40 - MENU SELECCION DE JUGADOR
|
||||||
-
|
Enrere
|
||||||
|
|
||||||
## 41 -
|
## 41 - MENU DE PAUSA
|
||||||
-
|
Menu de pausa
|
||||||
|
|
||||||
## 42 -
|
## 42 -
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -115,14 +115,14 @@ D E M O
|
|||||||
## 38 - TEXTOS DEL JUEGO
|
## 38 - TEXTOS DEL JUEGO
|
||||||
stages left!
|
stages left!
|
||||||
|
|
||||||
## 39 -
|
## 39 - MENU SELECCION DE JUGADOR
|
||||||
-
|
Select Player
|
||||||
|
|
||||||
## 40 -
|
## 40 - MENU SELECCION DE JUGADOR
|
||||||
-
|
Back
|
||||||
|
|
||||||
## 41 -
|
## 41 - MENU DE PAUSA
|
||||||
-
|
Pause Menu
|
||||||
|
|
||||||
## 42 -
|
## 42 -
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -115,14 +115,14 @@ D E M O
|
|||||||
## 38 - TEXTOS DEL JUEGO
|
## 38 - TEXTOS DEL JUEGO
|
||||||
fases mas!
|
fases mas!
|
||||||
|
|
||||||
## 39 -
|
## 39 - MENU SELECCION DE JUGADOR
|
||||||
-
|
Selecciona jugador
|
||||||
|
|
||||||
## 40 -
|
## 40 - MENU SELECCION DE JUGADOR
|
||||||
-
|
Volver
|
||||||
|
|
||||||
## 41 -
|
## 41 - MENU DE PAUSA
|
||||||
-
|
Menu de pausa
|
||||||
|
|
||||||
## 42 -
|
## 42 -
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -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=GAME OVER
|
name=GAME OVER
|
||||||
x=0
|
x=0
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
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=PAUSE
|
name=PAUSE
|
||||||
x=0
|
x=0
|
||||||
y=96
|
y=80
|
||||||
backgroundType=1
|
backgroundType=1
|
||||||
backgroundColor=41,57,65,240
|
backgroundColor=41,57,65,240
|
||||||
|
|
||||||
@@ -18,7 +17,13 @@ centerX=128
|
|||||||
selector_color=255,122,0,255
|
selector_color=255,122,0,255
|
||||||
selector_text_color=255,255,255
|
selector_text_color=255,255,255
|
||||||
|
|
||||||
defaultActionWhenCancel=0
|
defaultActionWhenCancel=1
|
||||||
|
|
||||||
|
[item]
|
||||||
|
text=PAUSE MENU
|
||||||
|
hPaddingDown=7
|
||||||
|
selectable=false
|
||||||
|
[/item]
|
||||||
|
|
||||||
[item]
|
[item]
|
||||||
text=CONTINUE
|
text=CONTINUE
|
||||||
|
|||||||
40
data/menu/player_select.men
Normal file
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
|
||||||
|
|||||||
Binary file not shown.
@@ -8,11 +8,7 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
section.name = PROG_SECTION_TITLE;
|
|
||||||
section.subsection = TITLE_SECTION_1;
|
|
||||||
|
|
||||||
// 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("\\/")) + "/../");
|
||||||
@@ -186,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);
|
||||||
@@ -280,6 +275,7 @@ bool Director::setFileList()
|
|||||||
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/pause.men", t_data);
|
||||||
asset->add("data/menu/gameover.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();
|
||||||
}
|
}
|
||||||
@@ -305,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;
|
||||||
|
|||||||
554
source/game.cpp
554
source/game.cpp
@@ -14,7 +14,7 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr
|
|||||||
// Pasa variables
|
// Pasa variables
|
||||||
this->demo.enabled = demo;
|
this->demo.enabled = demo;
|
||||||
this->numPlayers = numPlayers;
|
this->numPlayers = numPlayers;
|
||||||
this->currentStage = 9; // currentStage;
|
this->currentStage = currentStage;
|
||||||
lastStageReached = currentStage;
|
lastStageReached = currentStage;
|
||||||
if (numPlayers == 1)
|
if (numPlayers == 1)
|
||||||
{ // Si solo juega un jugador, permite jugar tanto con teclado como con mando
|
{ // Si solo juega un jugador, permite jugar tanto con teclado como con mando
|
||||||
@@ -199,14 +199,14 @@ void Game::init()
|
|||||||
// Crea los jugadores
|
// Crea los jugadores
|
||||||
if (numPlayers == 1)
|
if (numPlayers == 1)
|
||||||
{
|
{
|
||||||
Player *player = new Player(PLAY_AREA_CENTER_X - 11, PLAY_AREA_BOTTOM - 24, renderer, player1Textures, playerAnimations);
|
Player *player = new Player(PLAY_AREA_CENTER_X - 11, PLAY_AREA_BOTTOM - 24, renderer, playerTextures.at(options->playerSelected), playerAnimations);
|
||||||
players.push_back(player);
|
players.push_back(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (numPlayers == 2)
|
else if (numPlayers == 2)
|
||||||
{
|
{
|
||||||
Player *player1 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, renderer, player1Textures, playerAnimations);
|
Player *player1 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, renderer, playerTextures.at(0), playerAnimations);
|
||||||
Player *player2 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, renderer, player2Textures, playerAnimations);
|
Player *player2 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, renderer, playerTextures.at(1), playerAnimations);
|
||||||
players.push_back(player1);
|
players.push_back(player1);
|
||||||
players.push_back(player2);
|
players.push_back(player2);
|
||||||
}
|
}
|
||||||
@@ -273,6 +273,8 @@ void Game::init()
|
|||||||
powerBallEnabled = false;
|
powerBallEnabled = false;
|
||||||
powerBallCounter = 0;
|
powerBallCounter = 0;
|
||||||
coffeeMachineEnabled = false;
|
coffeeMachineEnabled = false;
|
||||||
|
pauseCounter = 0;
|
||||||
|
leavingPauseMenu = false;
|
||||||
|
|
||||||
if (demo.enabled)
|
if (demo.enabled)
|
||||||
{
|
{
|
||||||
@@ -307,9 +309,6 @@ void Game::init()
|
|||||||
totalPowerToCompleteGame += stage[i].powerToComplete;
|
totalPowerToCompleteGame += stage[i].powerToComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
balloonsPopped = totalPowerToCompleteGame - 20;
|
|
||||||
stage[9].currentPower = stage[9].powerToComplete - 20;
|
|
||||||
|
|
||||||
// Modo demo
|
// Modo demo
|
||||||
demo.recording = false;
|
demo.recording = false;
|
||||||
demo.counter = 0;
|
demo.counter = 0;
|
||||||
@@ -450,6 +449,8 @@ void Game::loadMedia()
|
|||||||
LTexture *player1Fire = new LTexture(renderer, asset->get("player_bal1_fire.png"));
|
LTexture *player1Fire = new LTexture(renderer, asset->get("player_bal1_fire.png"));
|
||||||
player1Textures.push_back(player1Fire);
|
player1Textures.push_back(player1Fire);
|
||||||
|
|
||||||
|
playerTextures.push_back(player1Textures);
|
||||||
|
|
||||||
// Texturas - Player2
|
// Texturas - Player2
|
||||||
LTexture *player2Head = new LTexture(renderer, asset->get("player_arounder_head.png"));
|
LTexture *player2Head = new LTexture(renderer, asset->get("player_arounder_head.png"));
|
||||||
player2Textures.push_back(player2Head);
|
player2Textures.push_back(player2Head);
|
||||||
@@ -466,6 +467,8 @@ void Game::loadMedia()
|
|||||||
LTexture *player2Fire = new LTexture(renderer, asset->get("player_arounder_fire.png"));
|
LTexture *player2Fire = new LTexture(renderer, asset->get("player_arounder_fire.png"));
|
||||||
player2Textures.push_back(player2Fire);
|
player2Textures.push_back(player2Fire);
|
||||||
|
|
||||||
|
playerTextures.push_back(player2Textures);
|
||||||
|
|
||||||
// Animaciones -- Jugador
|
// Animaciones -- Jugador
|
||||||
std::vector<std::string> *playerHeadAnimation = new std::vector<std::string>;
|
std::vector<std::string> *playerHeadAnimation = new std::vector<std::string>;
|
||||||
loadAnimations(asset->get("player_head.ani"), playerHeadAnimation);
|
loadAnimations(asset->get("player_head.ani"), playerHeadAnimation);
|
||||||
@@ -544,8 +547,9 @@ void Game::loadMedia()
|
|||||||
gameOverMenu->setRectSize(w, 0);
|
gameOverMenu->setRectSize(w, 0);
|
||||||
gameOverMenu->centerMenuOnX(199);
|
gameOverMenu->centerMenuOnX(199);
|
||||||
pauseMenu = new Menu(renderer, asset, input, asset->get("pause.men"));
|
pauseMenu = new Menu(renderer, asset, input, asset->get("pause.men"));
|
||||||
pauseMenu->setItemCaption(0, lang->getText(46));
|
pauseMenu->setItemCaption(0, lang->getText(41));
|
||||||
pauseMenu->setItemCaption(1, lang->getText(47));
|
pauseMenu->setItemCaption(1, lang->getText(46));
|
||||||
|
pauseMenu->setItemCaption(2, lang->getText(47));
|
||||||
|
|
||||||
// Sonidos
|
// Sonidos
|
||||||
balloonSound = JA_LoadSound(asset->get("balloon.wav").c_str());
|
balloonSound = JA_LoadSound(asset->get("balloon.wav").c_str());
|
||||||
@@ -1526,7 +1530,6 @@ void Game::updateHiScore()
|
|||||||
{
|
{
|
||||||
// Si la puntuación actual es mayor que la máxima puntuación
|
// Si la puntuación actual es mayor que la máxima puntuación
|
||||||
for (auto player : players)
|
for (auto player : players)
|
||||||
// for (int i = 0; i < numPlayers; i++)
|
|
||||||
if (player->getScore() > hiScore)
|
if (player->getScore() > hiScore)
|
||||||
{
|
{
|
||||||
// Actualiza la máxima puntuación
|
// Actualiza la máxima puntuación
|
||||||
@@ -1548,8 +1551,6 @@ void Game::updateHiScore()
|
|||||||
// Transforma un valor numérico en una cadena de 6 cifras
|
// Transforma un valor numérico en una cadena de 6 cifras
|
||||||
std::string Game::updateScoreText(Uint32 num)
|
std::string Game::updateScoreText(Uint32 num)
|
||||||
{
|
{
|
||||||
// return (std::to_string(num));
|
|
||||||
|
|
||||||
if ((num >= 0) && (num <= 9))
|
if ((num >= 0) && (num <= 9))
|
||||||
{
|
{
|
||||||
return ("000000" + std::to_string(num));
|
return ("000000" + std::to_string(num));
|
||||||
@@ -1781,8 +1782,7 @@ void Game::updateDeath()
|
|||||||
|
|
||||||
// Renderiza el fade final cuando se acaba la partida
|
// Renderiza el fade final cuando se acaba la partida
|
||||||
void Game::renderDeathFade(int counter)
|
void Game::renderDeathFade(int counter)
|
||||||
// Counter debe ir de 0 a 150
|
{ // Counter debe ir de 0 a 150
|
||||||
{
|
|
||||||
SDL_SetRenderDrawColor(renderer, 0x27, 0x27, 0x36, 255);
|
SDL_SetRenderDrawColor(renderer, 0x27, 0x27, 0x36, 255);
|
||||||
|
|
||||||
if (counter < 150)
|
if (counter < 150)
|
||||||
@@ -1790,15 +1790,19 @@ void Game::renderDeathFade(int counter)
|
|||||||
// 192 / 6 = 32, 6 cuadrados de 32 pixeles
|
// 192 / 6 = 32, 6 cuadrados de 32 pixeles
|
||||||
SDL_Rect rect[12];
|
SDL_Rect rect[12];
|
||||||
Uint8 h = counter / 3;
|
Uint8 h = counter / 3;
|
||||||
for (int i = 0; i < 12; i++)
|
for (int i = 0; i < 12; ++i)
|
||||||
{
|
{
|
||||||
rect[i].x = 0;
|
rect[i].x = 0;
|
||||||
rect[i].y = i * 16;
|
rect[i].y = i * 16;
|
||||||
rect[i].w = GAME_WIDTH;
|
rect[i].w = GAME_WIDTH;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
|
{
|
||||||
rect[i].h = h;
|
rect[i].h = h;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
rect[i].h = std::max(rect[i - 1].h - 3, 0);
|
rect[i].h = std::max(rect[i - 1].h - 3, 0);
|
||||||
|
}
|
||||||
SDL_RenderFillRect(renderer, &rect[i]);
|
SDL_RenderFillRect(renderer, &rect[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2741,10 +2745,7 @@ void Game::update()
|
|||||||
checkBulletBalloonCollision();
|
checkBulletBalloonCollision();
|
||||||
|
|
||||||
// Comprueba el nivel de amenaza para ver si se han de crear nuevos enemigos
|
// Comprueba el nivel de amenaza para ver si se han de crear nuevos enemigos
|
||||||
if (!gameCompleted)
|
updateMenace();
|
||||||
{
|
|
||||||
updateMenace();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actualiza la velocidad de los enemigos
|
// Actualiza la velocidad de los enemigos
|
||||||
updateBalloonSpeed();
|
updateBalloonSpeed();
|
||||||
@@ -2897,6 +2898,11 @@ void Game::render()
|
|||||||
// Gestiona el nivel de amenaza
|
// Gestiona el nivel de amenaza
|
||||||
void Game::updateMenace()
|
void Game::updateMenace()
|
||||||
{
|
{
|
||||||
|
if (gameCompleted)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const float percent = stage[currentStage].currentPower / stage[currentStage].powerToComplete;
|
const float percent = stage[currentStage].currentPower / stage[currentStage].powerToComplete;
|
||||||
const Uint8 difference = stage[currentStage].maxMenace - stage[currentStage].minMenace;
|
const Uint8 difference = stage[currentStage].maxMenace - stage[currentStage].minMenace;
|
||||||
|
|
||||||
@@ -3069,11 +3075,6 @@ void Game::checkGameInput()
|
|||||||
if (input->checkInput(INPUT_CANCEL, REPEAT_FALSE, options->input[i].deviceType, options->input[i].id))
|
if (input->checkInput(INPUT_CANCEL, REPEAT_FALSE, options->input[i].deviceType, options->input[i].id))
|
||||||
{
|
{
|
||||||
section.subsection = GAME_SECTION_PAUSE;
|
section.subsection = GAME_SECTION_PAUSE;
|
||||||
|
|
||||||
if (JA_GetMusicState() == JA_MUSIC_PLAYING)
|
|
||||||
{
|
|
||||||
JA_PauseMusic();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (demo.counter < TOTAL_DEMO_DATA)
|
if (demo.counter < TOTAL_DEMO_DATA)
|
||||||
@@ -3273,112 +3274,301 @@ section_t Game::run()
|
|||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bucle para el menu de pausa del juego
|
// Actualiza las variables del menu de pausa del juego
|
||||||
void Game::runPausedGame()
|
void Game::updatePausedGame()
|
||||||
{
|
{
|
||||||
// Reinicia el menu
|
// Comprueba los eventos que hay en la cola
|
||||||
pauseMenu->reset();
|
checkEventHandler();
|
||||||
|
|
||||||
while ((section.subsection == GAME_SECTION_PAUSE) && (section.name == PROG_SECTION_GAME))
|
// Calcula la lógica de los objetos
|
||||||
|
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||||
{
|
{
|
||||||
// Comprueba los eventos que hay en la cola
|
// Actualiza el contador de ticks
|
||||||
checkEventHandler();
|
ticks = SDL_GetTicks();
|
||||||
|
|
||||||
// Calcula la lógica de los objetos
|
if (leavingPauseMenu)
|
||||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
|
||||||
{
|
{
|
||||||
// Actualiza el contador de ticks
|
if (pauseCounter > 0)
|
||||||
ticks = SDL_GetTicks();
|
{ // El contador está descendiendo
|
||||||
|
const bool a = pauseCounter == 90;
|
||||||
|
const bool b = pauseCounter == 60;
|
||||||
|
const bool c = pauseCounter == 30;
|
||||||
|
if (a || b || c)
|
||||||
|
{
|
||||||
|
JA_PlaySound(clockSound);
|
||||||
|
}
|
||||||
|
pauseCounter--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Ha finalizado el contador
|
||||||
|
section.name = PROG_SECTION_GAME;
|
||||||
|
section.subsection = numPlayers == 1 ? GAME_SECTION_PLAY_1P : GAME_SECTION_PLAY_2P;
|
||||||
|
|
||||||
// Actualiza la lógica del menu
|
if (JA_GetMusicState() == JA_MUSIC_PAUSED)
|
||||||
|
{
|
||||||
|
JA_ResumeMusic();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Actualiza la lógica del menu de pausa
|
||||||
pauseMenu->update();
|
pauseMenu->update();
|
||||||
|
|
||||||
|
// Comprueba las entradas para el menu
|
||||||
|
pauseMenu->checkInput();
|
||||||
|
|
||||||
|
// Comprueba si se ha seleccionado algún item del menú
|
||||||
|
switch (pauseMenu->getItemSelected())
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
leavingPauseMenu = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
fade->setFadeType(FADE_CENTER);
|
||||||
|
fade->activateFade();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actualiza el fade
|
||||||
fade->update();
|
fade->update();
|
||||||
if (fade->hasEnded())
|
if (fade->hasEnded())
|
||||||
{
|
{
|
||||||
section.name = PROG_SECTION_TITLE;
|
section.name = PROG_SECTION_TITLE;
|
||||||
section.subsection = TITLE_SECTION_1;
|
section.subsection = TITLE_SECTION_1;
|
||||||
JA_StopMusic();
|
JA_StopMusic();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dibuja el menu de pausa del juego
|
||||||
|
void Game::renderPausedGame()
|
||||||
|
{
|
||||||
|
// Prepara para empezar a dibujar en la textura de juego
|
||||||
|
screen->start();
|
||||||
|
|
||||||
|
// Limpia la pantalla
|
||||||
|
screen->clean(bgColor);
|
||||||
|
|
||||||
|
// Pinta el escenario
|
||||||
|
{
|
||||||
|
renderBackground();
|
||||||
|
renderBalloons();
|
||||||
|
renderBullets();
|
||||||
|
renderMessages();
|
||||||
|
renderItems();
|
||||||
|
renderSmartSprites();
|
||||||
|
renderScoreBoard();
|
||||||
|
renderPlayers();
|
||||||
|
|
||||||
|
if ((deathCounter <= 150) && !players.at(0)->isAlive())
|
||||||
|
{
|
||||||
|
renderDeathFade(150 - deathCounter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((gameCompleted) && (gameCompletedCounter >= GAME_COMPLETED_START_FADE))
|
||||||
|
{
|
||||||
|
renderDeathFade(gameCompletedCounter - GAME_COMPLETED_START_FADE);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderFlashEffect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (leavingPauseMenu)
|
||||||
|
{
|
||||||
|
textNokiaBig2->writeCentered(SCREEN_CENTER_X, PLAY_AREA_FIRST_QUARTER_Y, std::to_string((pauseCounter / 30) + 1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pauseMenu->render();
|
||||||
|
}
|
||||||
|
fade->render();
|
||||||
|
|
||||||
|
// Vuelca el contenido del renderizador en pantalla
|
||||||
|
screen->blit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bucle para el menu de pausa del juego
|
||||||
|
void Game::runPausedGame()
|
||||||
|
{
|
||||||
|
// Pone en pausa la música
|
||||||
|
if (JA_GetMusicState() == JA_MUSIC_PLAYING)
|
||||||
|
{
|
||||||
|
JA_PauseMusic();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reinicia el menu
|
||||||
|
pauseMenu->reset();
|
||||||
|
leavingPauseMenu = false;
|
||||||
|
|
||||||
|
// Inicializa variables
|
||||||
|
pauseCounter = 90;
|
||||||
|
|
||||||
|
while ((section.subsection == GAME_SECTION_PAUSE) && (section.name == PROG_SECTION_GAME))
|
||||||
|
{
|
||||||
|
updatePausedGame();
|
||||||
|
renderPausedGame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actualiza los elementos de la pantalla de game over
|
||||||
|
void Game::updateGameOverScreen()
|
||||||
|
{
|
||||||
|
// Variables
|
||||||
|
static int postFade = 0;
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
else if (eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0)
|
||||||
|
{
|
||||||
|
if (gameCompleted)
|
||||||
|
{
|
||||||
|
postFade = 1;
|
||||||
|
fade->activateFade();
|
||||||
|
JA_PlaySound(itemPickUpSound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calcula la lógica de los objetos
|
||||||
|
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||||
|
{
|
||||||
|
// Actualiza el contador de ticks
|
||||||
|
ticks = SDL_GetTicks();
|
||||||
|
|
||||||
|
// Actualiza la lógica del menu
|
||||||
|
gameOverMenu->update();
|
||||||
|
|
||||||
|
// Actualiza el fade
|
||||||
|
fade->update();
|
||||||
|
|
||||||
|
// Si ha terminado el fade, actua segun se haya operado
|
||||||
|
if (fade->hasEnded())
|
||||||
|
{
|
||||||
|
switch (postFade)
|
||||||
|
{
|
||||||
|
case 0: // YES
|
||||||
|
section.name = PROG_SECTION_GAME;
|
||||||
|
deleteAllVectorObjects();
|
||||||
|
init();
|
||||||
|
section.subsection = numPlayers == 1 ? GAME_SECTION_PLAY_1P : GAME_SECTION_PLAY_2P;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: // NO
|
||||||
|
section.name = PROG_SECTION_TITLE;
|
||||||
|
section.subsection = TITLE_SECTION_1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepara para empezar a dibujar en la textura de juego
|
// Comprueba las entradas para el menu solo si no esta el juego completo
|
||||||
screen->start();
|
if (!gameCompleted)
|
||||||
|
|
||||||
// Limpia la pantalla
|
|
||||||
screen->clean(bgColor);
|
|
||||||
|
|
||||||
// Pinta el escenario
|
|
||||||
{
|
{
|
||||||
renderBackground();
|
gameOverMenu->checkInput();
|
||||||
renderBalloons();
|
|
||||||
renderBullets();
|
|
||||||
renderMessages();
|
|
||||||
renderItems();
|
|
||||||
renderSmartSprites();
|
|
||||||
renderScoreBoard();
|
|
||||||
renderPlayers();
|
|
||||||
|
|
||||||
if ((deathCounter <= 150) && !players.at(0)->isAlive())
|
// Comprueba si se ha seleccionado algún item del menú
|
||||||
|
switch (gameOverMenu->getItemSelected())
|
||||||
{
|
{
|
||||||
renderDeathFade(150 - deathCounter);
|
case 0: // YES
|
||||||
|
postFade = 0;
|
||||||
|
fade->activateFade();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: // NO
|
||||||
|
postFade = 1;
|
||||||
|
fade->activateFade();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gameCompleted) && (gameCompletedCounter >= GAME_COMPLETED_START_FADE))
|
|
||||||
{
|
|
||||||
renderDeathFade(gameCompletedCounter - GAME_COMPLETED_START_FADE);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderFlashEffect();
|
|
||||||
}
|
|
||||||
|
|
||||||
pauseMenu->render();
|
|
||||||
fade->render();
|
|
||||||
|
|
||||||
// Vuelca el contenido del renderizador en pantalla
|
|
||||||
screen->blit();
|
|
||||||
|
|
||||||
// Comprueba las entradas para el menu
|
|
||||||
pauseMenu->checkInput();
|
|
||||||
|
|
||||||
// Comprueba si se ha seleccionado algún item del menú
|
|
||||||
switch (pauseMenu->getItemSelected())
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
section.name = PROG_SECTION_GAME;
|
|
||||||
|
|
||||||
if (numPlayers == 1)
|
|
||||||
{
|
|
||||||
section.subsection = GAME_SECTION_PLAY_1P;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
section.subsection = GAME_SECTION_PLAY_2P;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (JA_GetMusicState() == JA_MUSIC_PAUSED)
|
|
||||||
{
|
|
||||||
JA_ResumeMusic();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
fade->setFadeType(FADE_CENTER);
|
|
||||||
fade->activateFade();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dibuja los elementos de la pantalla de game over
|
||||||
|
void Game::renderGameOverScreen()
|
||||||
|
{
|
||||||
|
// Prepara para empezar a dibujar en la textura de juego
|
||||||
|
screen->start();
|
||||||
|
|
||||||
|
// Limpia la pantalla
|
||||||
|
screen->clean(bgColor);
|
||||||
|
|
||||||
|
// Dibujo
|
||||||
|
if (!gameCompleted)
|
||||||
|
{ // Dibujo de haber perdido la partida
|
||||||
|
gameOverSprite->render();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Dinujo de haber completado la partida
|
||||||
|
gameOverEndSprite->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dibuja los objetos
|
||||||
|
if (numPlayers == 1)
|
||||||
|
{
|
||||||
|
// Congratulations!!
|
||||||
|
if (gameCompleted)
|
||||||
|
{
|
||||||
|
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 8), lang->getText(50));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Game Over
|
||||||
|
textBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 6), lang->getText(43));
|
||||||
|
|
||||||
|
// Your Score
|
||||||
|
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 3), lang->getText(44) + std::to_string(players.at(0)->getScore()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Congratulations!!
|
||||||
|
if (gameCompleted)
|
||||||
|
{
|
||||||
|
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 9), lang->getText(50));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Game Over
|
||||||
|
textBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 7), lang->getText(43));
|
||||||
|
|
||||||
|
// Player1 Score
|
||||||
|
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 4), lang->getText(77) + std::to_string(players.at(0)->getScore()));
|
||||||
|
|
||||||
|
// Player2 Score
|
||||||
|
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 2), lang->getText(78) + std::to_string(players.at(1)->getScore()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Continue?
|
||||||
|
if (!gameCompleted)
|
||||||
|
{ // Solo dibuja el menu de continuar en el caso de no haber completado la partida
|
||||||
|
text->writeCentered(199, PLAY_AREA_CENTER_Y + BLOCK * 3, lang->getText(45));
|
||||||
|
gameOverMenu->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pinta el fade
|
||||||
|
fade->render();
|
||||||
|
|
||||||
|
// Vuelca el contenido del renderizador en pantalla
|
||||||
|
screen->blit();
|
||||||
|
}
|
||||||
|
|
||||||
// Bucle para la pantalla de game over
|
// Bucle para la pantalla de game over
|
||||||
void Game::runGameOverScreen()
|
void Game::runGameOverScreen()
|
||||||
{
|
{
|
||||||
// Variables
|
|
||||||
int postFade = 0;
|
|
||||||
|
|
||||||
// Guarda los puntos
|
// Guarda los puntos
|
||||||
saveScoreFile();
|
saveScoreFile();
|
||||||
|
|
||||||
@@ -3387,127 +3577,8 @@ void Game::runGameOverScreen()
|
|||||||
|
|
||||||
while ((section.subsection == GAME_SECTION_GAMEOVER) && (section.name == PROG_SECTION_GAME))
|
while ((section.subsection == GAME_SECTION_GAMEOVER) && (section.name == PROG_SECTION_GAME))
|
||||||
{
|
{
|
||||||
// Comprueba los eventos que hay en la cola
|
updateGameOverScreen();
|
||||||
while (SDL_PollEvent(eventHandler) != 0)
|
renderGameOverScreen();
|
||||||
{
|
|
||||||
// Evento de salida de la aplicación
|
|
||||||
if (eventHandler->type == SDL_QUIT)
|
|
||||||
{
|
|
||||||
section.name = PROG_SECTION_QUIT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calcula la lógica de los objetos
|
|
||||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
|
||||||
{
|
|
||||||
// Actualiza el contador de ticks
|
|
||||||
ticks = SDL_GetTicks();
|
|
||||||
|
|
||||||
// Actualiza la lógica del menu
|
|
||||||
gameOverMenu->update();
|
|
||||||
fade->update();
|
|
||||||
if (fade->hasEnded())
|
|
||||||
{
|
|
||||||
switch (postFade)
|
|
||||||
{
|
|
||||||
case 0: // YES
|
|
||||||
if (!gameCompleted)
|
|
||||||
{ // Si el juego no se ha terminado, el menu actua normal
|
|
||||||
section.name = PROG_SECTION_GAME;
|
|
||||||
deleteAllVectorObjects();
|
|
||||||
init();
|
|
||||||
section.subsection = numPlayers == 1 ? GAME_SECTION_PLAY_1P : GAME_SECTION_PLAY_2P;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Si ha completado el juego, siempre vuelve a la pantalla de titulo
|
|
||||||
section.name = PROG_SECTION_TITLE;
|
|
||||||
section.subsection = TITLE_SECTION_1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1: // NO
|
|
||||||
section.name = PROG_SECTION_TITLE;
|
|
||||||
section.subsection = TITLE_SECTION_1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prepara para empezar a dibujar en la textura de juego
|
|
||||||
screen->start();
|
|
||||||
|
|
||||||
// Limpia la pantalla
|
|
||||||
screen->clean(bgColor);
|
|
||||||
|
|
||||||
// Dibujo
|
|
||||||
if (!gameCompleted)
|
|
||||||
{ // Dibujo de haber perdido la partida
|
|
||||||
gameOverSprite->render();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Dinujo de haber completado la partida
|
|
||||||
gameOverEndSprite->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dibuja los objetos
|
|
||||||
if (numPlayers == 1)
|
|
||||||
{
|
|
||||||
// Game Over
|
|
||||||
textBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 6), lang->getText(43));
|
|
||||||
|
|
||||||
// Your Score
|
|
||||||
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 3), lang->getText(44) + std::to_string(players.at(0)->getScore()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Game Over
|
|
||||||
textBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 7), lang->getText(43));
|
|
||||||
|
|
||||||
// Player1 Score
|
|
||||||
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 4), lang->getText(77) + std::to_string(players.at(0)->getScore()));
|
|
||||||
|
|
||||||
// Player2 Score
|
|
||||||
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 2), lang->getText(78) + std::to_string(players.at(1)->getScore()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Continue?
|
|
||||||
if (!gameCompleted)
|
|
||||||
{ // Solo dibuja el menu de continuar en el caso de no haber completado la partida
|
|
||||||
text->writeCentered(199, PLAY_AREA_CENTER_Y + BLOCK * 3, lang->getText(45));
|
|
||||||
gameOverMenu->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pinta el fade
|
|
||||||
fade->render();
|
|
||||||
|
|
||||||
// Vuelca el contenido del renderizador en pantalla
|
|
||||||
screen->blit();
|
|
||||||
|
|
||||||
// Comprueba las entradas para el menu
|
|
||||||
gameOverMenu->checkInput();
|
|
||||||
|
|
||||||
// Comprueba si se ha seleccionado algún item del menú
|
|
||||||
switch (gameOverMenu->getItemSelected())
|
|
||||||
{
|
|
||||||
case 0: // YES
|
|
||||||
postFade = 0;
|
|
||||||
fade->activateFade();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1: // NO
|
|
||||||
postFade = 1;
|
|
||||||
fade->activateFade();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3554,7 +3625,7 @@ void Game::initPaths()
|
|||||||
const int centerPoint = PLAY_AREA_CENTER_Y - (BLOCK * 2);
|
const int centerPoint = PLAY_AREA_CENTER_Y - (BLOCK * 2);
|
||||||
const int distance = (PLAY_AREA_BOTTOM) - (PLAY_AREA_CENTER_Y - 16);
|
const int distance = (PLAY_AREA_BOTTOM) - (PLAY_AREA_CENTER_Y - 16);
|
||||||
|
|
||||||
for (int i = 0; i < STAGE_COUNTER; i++)
|
for (int i = 0; i < STAGE_COUNTER; ++i)
|
||||||
{
|
{
|
||||||
if (i < firstPart)
|
if (i < firstPart)
|
||||||
{
|
{
|
||||||
@@ -3584,7 +3655,7 @@ void Game::initPaths()
|
|||||||
const float distance1 = finish1 - start1;
|
const float distance1 = finish1 - start1;
|
||||||
const float distance2 = finish2 - start2;
|
const float distance2 = finish2 - start2;
|
||||||
|
|
||||||
for (int i = 0; i < STAGE_COUNTER; i++)
|
for (int i = 0; i < STAGE_COUNTER; ++i)
|
||||||
{
|
{
|
||||||
if (i < firstPart)
|
if (i < firstPart)
|
||||||
{
|
{
|
||||||
@@ -3592,10 +3663,12 @@ void Game::initPaths()
|
|||||||
getReadyBitmapPath[i] *= distance1;
|
getReadyBitmapPath[i] *= distance1;
|
||||||
getReadyBitmapPath[i] -= size;
|
getReadyBitmapPath[i] -= size;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (i < secondPart)
|
else if (i < secondPart)
|
||||||
{
|
{
|
||||||
getReadyBitmapPath[i] = (int)finish1;
|
getReadyBitmapPath[i] = (int)finish1;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getReadyBitmapPath[i] = sin[(int)((i - 150) * 1.8f)];
|
getReadyBitmapPath[i] = sin[(int)((i - 150) * 1.8f)];
|
||||||
@@ -3676,6 +3749,15 @@ void Game::checkEventHandler()
|
|||||||
section.name = PROG_SECTION_QUIT;
|
section.name = PROG_SECTION_QUIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (eventHandler->type == SDL_WINDOWEVENT)
|
||||||
|
{
|
||||||
|
if (eventHandler->window.event == SDL_WINDOWEVENT_FOCUS_LOST)
|
||||||
|
{
|
||||||
|
section.subsection = GAME_SECTION_PAUSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else if (eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0)
|
else if (eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0)
|
||||||
{
|
{
|
||||||
switch (eventHandler->key.keysym.scancode)
|
switch (eventHandler->key.keysym.scancode)
|
||||||
@@ -3705,28 +3787,6 @@ void Game::checkEventHandler()
|
|||||||
reloadTextures();
|
reloadTextures();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_SCANCODE_P:
|
|
||||||
createPowerBall();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SDL_SCANCODE_O:
|
|
||||||
stopAllBalloons(200);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SDL_SCANCODE_I:
|
|
||||||
static bool toogle = true;
|
|
||||||
if (toogle)
|
|
||||||
{
|
|
||||||
players.at(0)->setPlayerTextures(player1Textures);
|
|
||||||
toogle = !toogle;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
players.at(0)->setPlayerTextures(player2Textures);
|
|
||||||
toogle = !toogle;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,11 +127,12 @@ private:
|
|||||||
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 *bulletTexture; // Textura para las balas
|
LTexture *bulletTexture; // Textura para las balas
|
||||||
std::vector<LTexture *> itemTextures; // Vector con las texturas de los items
|
std::vector<LTexture *> itemTextures; // Vector con las texturas de los items
|
||||||
std::vector<LTexture *> balloonTextures; // Vector con las texturas de los globos
|
std::vector<LTexture *> balloonTextures; // Vector con las texturas de los globos
|
||||||
std::vector<LTexture *> player1Textures; // Vector con las texturas del jugador
|
std::vector<LTexture *> player1Textures; // Vector con las texturas del jugador
|
||||||
std::vector<LTexture *> player2Textures; // Vector con las texturas del jugador
|
std::vector<LTexture *> player2Textures; // Vector con las texturas del jugador
|
||||||
|
std::vector<std::vector<LTexture *>> playerTextures; // Vector con todas las texturas de los jugadores;
|
||||||
|
|
||||||
LTexture *gameBuildingsTexture; // Textura con los edificios de fondo
|
LTexture *gameBuildingsTexture; // Textura con los edificios de fondo
|
||||||
LTexture *gameCloudsTexture; // Textura con las nubes de fondo
|
LTexture *gameCloudsTexture; // Textura con las nubes de fondo
|
||||||
@@ -192,10 +193,9 @@ private:
|
|||||||
JA_Music gameMusic; // Musica de fondo
|
JA_Music gameMusic; // Musica de fondo
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
int numPlayers; // Numero de jugadores
|
int numPlayers; // Numero de jugadores
|
||||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||||
Uint8 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
Uint8 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||||
|
|
||||||
Uint32 hiScore; // Puntuación máxima
|
Uint32 hiScore; // Puntuación máxima
|
||||||
bool hiScoreAchieved; // Indica si se ha superado la puntuación máxima
|
bool hiScoreAchieved; // Indica si se ha superado la puntuación máxima
|
||||||
section_t section; // Seccion actual dentro del juego
|
section_t section; // Seccion actual dentro del juego
|
||||||
@@ -235,6 +235,8 @@ private:
|
|||||||
demo_t demo; // Variable con todas las variables relacionadas con el modo demo
|
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 totalPowerToCompleteGame; // La suma del poder necesario para completar todas las fases
|
||||||
int cloudsSpeed; // Velocidad a la que se desplazan las nubes
|
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
|
// Actualiza el juego
|
||||||
void update();
|
void update();
|
||||||
@@ -464,9 +466,21 @@ 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();
|
||||||
|
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ void Instructions::checkEventHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bucle para la pantalla de instrucciones
|
// Bucle para la pantalla de instrucciones
|
||||||
void Instructions::run(mode_e mode)
|
section_t Instructions::run(mode_e mode)
|
||||||
{
|
{
|
||||||
this->mode = mode;
|
this->mode = mode;
|
||||||
|
|
||||||
@@ -245,4 +245,6 @@ void Instructions::run(mode_e mode)
|
|||||||
update();
|
update();
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return section;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
~Instructions();
|
~Instructions();
|
||||||
|
|
||||||
// Bucle principal
|
// Bucle principal
|
||||||
void run(mode_e mode);
|
section_t run(mode_e mode);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -58,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()
|
||||||
@@ -492,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
|
||||||
@@ -833,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
|
||||||
|
|||||||
@@ -235,8 +235,7 @@ void Player::setAnimation()
|
|||||||
aHeadCoffees = "_1C";
|
aHeadCoffees = "_1C";
|
||||||
}
|
}
|
||||||
|
|
||||||
//const std::string aPowerUp = powerUp ? "_pwr" : "";
|
const std::string aPowerUp = powerUp ? "_pwr" : "";
|
||||||
const std::string aPowerUp = "";
|
|
||||||
const std::string aWalking = statusWalking == PLAYER_STATUS_WALKING_STOP ? "stand" : "walk";
|
const std::string aWalking = statusWalking == PLAYER_STATUS_WALKING_STOP ? "stand" : "walk";
|
||||||
const std::string aFiring = statusFiring == PLAYER_STATUS_FIRING_UP ? "centershoot" : "sideshoot";
|
const std::string aFiring = statusFiring == PLAYER_STATUS_FIRING_UP ? "centershoot" : "sideshoot";
|
||||||
|
|
||||||
@@ -248,14 +247,14 @@ void Player::setAnimation()
|
|||||||
legsSprite->setFlip(flipWalk);
|
legsSprite->setFlip(flipWalk);
|
||||||
if (statusFiring == PLAYER_STATUS_FIRING_NO)
|
if (statusFiring == PLAYER_STATUS_FIRING_NO)
|
||||||
{ // No esta disparando
|
{ // No esta disparando
|
||||||
bodySprite->setCurrentAnimation(aWalking + aBodyCoffees);
|
bodySprite->setCurrentAnimation(aWalking + aBodyCoffees + aPowerUp);
|
||||||
bodySprite->setFlip(flipWalk);
|
bodySprite->setFlip(flipWalk);
|
||||||
headSprite->setCurrentAnimation(aWalking + aHeadCoffees + aPowerUp);
|
headSprite->setCurrentAnimation(aWalking + aHeadCoffees + aPowerUp);
|
||||||
headSprite->setFlip(flipWalk);
|
headSprite->setFlip(flipWalk);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Está disparando
|
{ // Está disparando
|
||||||
bodySprite->setCurrentAnimation(aFiring + aBodyCoffees);
|
bodySprite->setCurrentAnimation(aFiring + aBodyCoffees + aPowerUp);
|
||||||
bodySprite->setFlip(flipFire);
|
bodySprite->setFlip(flipFire);
|
||||||
headSprite->setCurrentAnimation(aFiring + aHeadCoffees + aPowerUp);
|
headSprite->setCurrentAnimation(aFiring + aHeadCoffees + aPowerUp);
|
||||||
headSprite->setFlip(flipFire);
|
headSprite->setFlip(flipFire);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
|||||||
|
|
||||||
this->section = section;
|
this->section = section;
|
||||||
|
|
||||||
// Reserva memoria para los punteros propios
|
// Reserva memoria para los punteros
|
||||||
eventHandler = new SDL_Event();
|
eventHandler = new SDL_Event();
|
||||||
fade = new Fade(renderer);
|
fade = new Fade(renderer);
|
||||||
|
|
||||||
@@ -33,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());
|
||||||
@@ -73,6 +74,7 @@ Title::~Title()
|
|||||||
|
|
||||||
delete menu.title;
|
delete menu.title;
|
||||||
delete menu.options;
|
delete menu.options;
|
||||||
|
delete menu.playerSelect;
|
||||||
|
|
||||||
JA_DeleteSound(crashSound);
|
JA_DeleteSound(crashSound);
|
||||||
JA_DeleteMusic(titleMusic);
|
JA_DeleteMusic(titleMusic);
|
||||||
@@ -299,7 +301,10 @@ void Title::update()
|
|||||||
if (demo)
|
if (demo)
|
||||||
{
|
{
|
||||||
runDemoGame();
|
runDemoGame();
|
||||||
runInstructions(m_auto);
|
if (section.name != PROG_SECTION_QUIT)
|
||||||
|
{
|
||||||
|
runInstructions(m_auto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
section.name = PROG_SECTION_LOGO;
|
section.name = PROG_SECTION_LOGO;
|
||||||
@@ -319,14 +324,13 @@ void Title::update()
|
|||||||
menu.active->update();
|
menu.active->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba si se ha seleccionado algún item del menú
|
// Comprueba si se ha seleccionado algún item del menú de titulo
|
||||||
if (menu.active->getName() == "TITLE")
|
if (menu.active->getName() == "TITLE")
|
||||||
{
|
{
|
||||||
switch (menu.active->getItemSelected())
|
switch (menu.active->getItemSelected())
|
||||||
{
|
{
|
||||||
case 0: // 1 PLAYER
|
case 0: // 1 PLAYER -> Cambia al manu de selección de jugador
|
||||||
postFade = 0;
|
menu.active = menu.playerSelect;
|
||||||
fade->activateFade();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // 2 PLAYERS
|
case 1: // 2 PLAYERS
|
||||||
@@ -349,6 +353,37 @@ void Title::update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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
|
// Comprueba si se ha seleccionado algún item de opciones
|
||||||
if (menu.active->getName() == "OPTIONS")
|
if (menu.active->getName() == "OPTIONS")
|
||||||
{
|
{
|
||||||
@@ -451,7 +486,10 @@ void Title::update()
|
|||||||
if (demo)
|
if (demo)
|
||||||
{
|
{
|
||||||
runDemoGame();
|
runDemoGame();
|
||||||
runInstructions(m_auto);
|
if (section.name != PROG_SECTION_QUIT)
|
||||||
|
{
|
||||||
|
runInstructions(m_auto);
|
||||||
|
}
|
||||||
init();
|
init();
|
||||||
demo = false;
|
demo = false;
|
||||||
counter = TITLE_COUNTER;
|
counter = TITLE_COUNTER;
|
||||||
@@ -873,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
|
||||||
@@ -899,19 +945,23 @@ section_t Title::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ejecuta la parte donde se muestran las instrucciones
|
// Ejecuta la parte donde se muestran las instrucciones
|
||||||
void Title::runInstructions(mode_e 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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -116,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(mode_e 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);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
28
todo.txt
28
todo.txt
@@ -1,28 +0,0 @@
|
|||||||
x los items se quedan pegados en el techo (comprobar si sigue pasando, he cambiado la coreción al chocar arriba. Si sigue fallando se quita la comprobación superior)
|
|
||||||
x la maquina de cafe no toca el suelo
|
|
||||||
x las bolas verdes nacen naranja al explotarlas
|
|
||||||
x falta el aura de superguerrero al pillar la maquina de cafe
|
|
||||||
x la powerball deja la mascara al explotarlas
|
|
||||||
x los menus de pausa y game over falta poner bien los textos
|
|
||||||
x cuando continuas la partida sigues muerto
|
|
||||||
poder elegir el personaje para jugar
|
|
||||||
x arreglar los smart sprites de muerte y de perder el cafe
|
|
||||||
x arreglar los items de las instrucciones
|
|
||||||
x que cicle la musica en el titulo, demo, instrucciones
|
|
||||||
NO que guarde el progreso del juego
|
|
||||||
x que aumente la velocidad de las nubes conforme avanzas
|
|
||||||
x retocar un poco la distancia entre los cambios de color del cielo, se llega al oscuro muy pronto
|
|
||||||
x las balas deberian llegar a salir de la pantalla
|
|
||||||
x hacer desaparecer los accesos a disco en el juego. cargar todos los recursos previamente y pasarlos por punteros
|
|
||||||
x la powerball se para con el reloj y sigue rodando
|
|
||||||
x acelerar la animacion de disparar recto
|
|
||||||
x no pone la animacion corecta al no disparar con el powerup
|
|
||||||
NO que grite "yiiijaa!" o algo parecido al coger la maquina de cafe
|
|
||||||
NO o que diga DIMONIS! en un globo de texto que se evapore
|
|
||||||
NO podrian salir comentarios aleatoriamente o con ciertos eventos (falta ver si no estorbará)
|
|
||||||
x que se vea el nivel de dificultad
|
|
||||||
x poner un dibujito en la pantalla de game over al terminar el juego
|
|
||||||
x y quizas otro en la propia pantalla de game over
|
|
||||||
x que las nubes al final se vuelva a frenar
|
|
||||||
quitar las cabezas powerup
|
|
||||||
x el modo 2P no arranca
|
|
||||||
Reference in New Issue
Block a user