Ya va pasando del titulo a las instrucciones, a la demo, etc..
This commit is contained in:
383
source/title.cpp
383
source/title.cpp
@@ -50,7 +50,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
fade->init(0x17, 0x17, 0x26);
|
||||
demo = false;
|
||||
demo = true;
|
||||
|
||||
// Pone valores por defecto a las opciones de control
|
||||
options->input.clear();
|
||||
@@ -235,7 +235,7 @@ void Title::update()
|
||||
dustBitmapL->update();
|
||||
|
||||
step++;
|
||||
|
||||
|
||||
if (step == 33)
|
||||
{
|
||||
section.subsection = TITLE_SECTION_3;
|
||||
@@ -246,190 +246,214 @@ void Title::update()
|
||||
// Sección 3 - La pantalla de titulo con el menú y la música
|
||||
case TITLE_SECTION_3:
|
||||
{
|
||||
// Reproduce la música
|
||||
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
|
||||
{
|
||||
JA_PlayMusic(titleMusic);
|
||||
}
|
||||
|
||||
dustBitmapR->update();
|
||||
dustBitmapL->update();
|
||||
|
||||
// Actualiza la lógica del titulo
|
||||
fade->update();
|
||||
|
||||
if (fade->hasEnded())
|
||||
{
|
||||
switch (postFade)
|
||||
if (counter > 0)
|
||||
{ // Reproduce la música
|
||||
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
|
||||
{
|
||||
case 0: // 1 PLAYER
|
||||
section.name = PROG_SECTION_GAME;
|
||||
section.subsection = GAME_SECTION_PLAY_1P;
|
||||
JA_StopMusic();
|
||||
break;
|
||||
JA_PlayMusic(titleMusic);
|
||||
}
|
||||
|
||||
case 1: // 2 PLAYERS
|
||||
section.name = PROG_SECTION_GAME;
|
||||
section.subsection = GAME_SECTION_PLAY_2P;
|
||||
JA_StopMusic();
|
||||
break;
|
||||
dustBitmapR->update();
|
||||
dustBitmapL->update();
|
||||
|
||||
case 2: // QUIT
|
||||
section.name = PROG_SECTION_QUIT;
|
||||
JA_StopMusic();
|
||||
break;
|
||||
// Actualiza la lógica del titulo
|
||||
fade->update();
|
||||
|
||||
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();
|
||||
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ú
|
||||
if (menu.active->getName() == "TITLE")
|
||||
{
|
||||
switch (menu.active->getItemSelected())
|
||||
{
|
||||
case 0: // 1 PLAYER
|
||||
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
|
||||
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();
|
||||
runInstructions(m_auto);
|
||||
demo = false;
|
||||
counter = TITLE_COUNTER;
|
||||
menu.active->reset();
|
||||
if (demo)
|
||||
{
|
||||
runDemoGame();
|
||||
runInstructions(INSTRUCTIONS_MODE_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ú
|
||||
if (menu.active->getName() == "TITLE")
|
||||
{
|
||||
switch (menu.active->getItemSelected())
|
||||
else
|
||||
{
|
||||
case 0: // 1 PLAYER
|
||||
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;
|
||||
section.name = PROG_SECTION_LOGO;
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba si se ha seleccionado algún item de opciones
|
||||
if (menu.active->getName() == "OPTIONS")
|
||||
// Sección Instrucciones
|
||||
if (section.subsection == TITLE_SECTION_INSTRUCTIONS)
|
||||
{
|
||||
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(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--;
|
||||
runInstructions(m_auto);
|
||||
counter = TITLE_COUNTER;
|
||||
demo = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -821,20 +845,13 @@ section_t Title::run()
|
||||
{
|
||||
update();
|
||||
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;
|
||||
}
|
||||
|
||||
// Ejecuta la parte donde se muestran las instrucciones
|
||||
void Title::runInstructions(Uint8 mode)
|
||||
void Title::runInstructions(mode_e mode)
|
||||
{
|
||||
instructions = new Instructions(renderer, screen, asset, lang);
|
||||
instructions->run(mode);
|
||||
|
||||
Reference in New Issue
Block a user