Ya va pasando del titulo a las instrucciones, a la demo, etc..
This commit is contained in:
Binary file not shown.
@@ -3,206 +3,221 @@
|
||||
const Uint8 SELF = 0;
|
||||
|
||||
// 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
|
||||
mRenderer = renderer;
|
||||
mScreen = screen;
|
||||
this->mAsset = mAsset;
|
||||
mLang = lang;
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->asset = asset;
|
||||
this->lang = lang;
|
||||
|
||||
// Reserva memoria para los punteros
|
||||
mEventHandler = new SDL_Event();
|
||||
mItemTexture = new LTexture(mRenderer, mAsset->get("items.png"));
|
||||
mSprite = new Sprite(0, 0, GAME_WIDTH, GAME_HEIGHT, mItemTexture, mRenderer);
|
||||
mText = new Text(mAsset->get("smb2.png"), mAsset->get("smb2.txt"), mRenderer);
|
||||
eventHandler = new SDL_Event();
|
||||
itemTexture = new LTexture(renderer, asset->get("items.png"));
|
||||
sprite = new Sprite(0, 0, GAME_WIDTH, GAME_HEIGHT, itemTexture, renderer);
|
||||
text = new Text(asset->get("smb2.png"), asset->get("smb2.txt"), renderer);
|
||||
|
||||
// Crea un backbuffer para el renderizador
|
||||
mBackbuffer = SDL_CreateTexture(mRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAME_WIDTH, GAME_HEIGHT);
|
||||
if (mBackbuffer == nullptr)
|
||||
backbuffer = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAME_WIDTH, GAME_HEIGHT);
|
||||
if (backbuffer == nullptr)
|
||||
{
|
||||
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
|
||||
Instructions::~Instructions()
|
||||
{
|
||||
mItemTexture->unload();
|
||||
delete mItemTexture;
|
||||
itemTexture->unload();
|
||||
delete itemTexture;
|
||||
|
||||
delete mSprite;
|
||||
delete mEventHandler;
|
||||
delete mText;
|
||||
delete sprite;
|
||||
delete eventHandler;
|
||||
delete text;
|
||||
|
||||
SDL_DestroyTexture(mBackbuffer);
|
||||
SDL_DestroyTexture(backbuffer);
|
||||
}
|
||||
|
||||
// Inicializa las variables necesarias para la sección 'Instructions'
|
||||
void Instructions::init()
|
||||
// Actualiza las variables
|
||||
void Instructions::update()
|
||||
{
|
||||
// Inicializa variables
|
||||
mSection.name = SELF;
|
||||
mTicks = 0;
|
||||
mTicksSpeed = 15;
|
||||
mManualQuit = false;
|
||||
mCounter = 0;
|
||||
// Comprueba los eventos
|
||||
checkEventHandler();
|
||||
|
||||
// Actualiza las variables
|
||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||
{
|
||||
// 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->setPos(destRect1);
|
||||
srcRect.x = 0;
|
||||
srcRect.y = 16 * (((counter + 12) / 36) % 2);
|
||||
sprite->setSpriteClip(srcRect);
|
||||
sprite->render();
|
||||
|
||||
// Gavineixon
|
||||
sprite->setPos(destRect2);
|
||||
srcRect.x += srcRect.w;
|
||||
srcRect.y = 16 * (((counter + 9) / 36) % 2);
|
||||
sprite->setSpriteClip(srcRect);
|
||||
sprite->render();
|
||||
|
||||
// Pacmar
|
||||
sprite->setPos(destRect3);
|
||||
srcRect.x += srcRect.w;
|
||||
srcRect.y = 16 * (((counter + 6) / 36) % 2);
|
||||
sprite->setSpriteClip(srcRect);
|
||||
sprite->render();
|
||||
|
||||
// Time Stopper
|
||||
sprite->setPos(destRect4);
|
||||
srcRect.x += srcRect.w;
|
||||
srcRect.y = 16 * (((counter + 3) / 36) % 2);
|
||||
sprite->setSpriteClip(srcRect);
|
||||
sprite->render();
|
||||
|
||||
// Coffee
|
||||
sprite->setPos(destRect5);
|
||||
srcRect.x += (srcRect.w * 2); // Se salta el icono del TNT
|
||||
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
|
||||
{
|
||||
manualQuit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bucle para la pantalla de instrucciones
|
||||
void Instructions::run(Uint8 mode)
|
||||
void 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
|
||||
while (SDL_PollEvent(mEventHandler) != 0)
|
||||
{
|
||||
// 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();
|
||||
|
||||
if (mode == INSTRUCTIONS_MODE_AUTO)
|
||||
{ // Modo automático
|
||||
mCounter++;
|
||||
|
||||
if (mCounter == INSTRUCTIONS_COUNTER)
|
||||
{
|
||||
mSection.name = PROG_SECTION_TITLE;
|
||||
mSection.subsection = TITLE_SECTION_1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Modo manual
|
||||
++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();
|
||||
update();
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,31 +12,35 @@
|
||||
#ifndef INSTRUCTIONS_H
|
||||
#define INSTRUCTIONS_H
|
||||
|
||||
// Contadores
|
||||
#define INSTRUCTIONS_COUNTER 600
|
||||
|
||||
// Modo para las instrucciones
|
||||
#define INSTRUCTIONS_MODE_MANUAL 0
|
||||
#define INSTRUCTIONS_MODE_AUTO 1
|
||||
enum mode_e
|
||||
{
|
||||
m_manual,
|
||||
m_auto
|
||||
};
|
||||
|
||||
// Clase Instructions
|
||||
class Instructions
|
||||
{
|
||||
private:
|
||||
SDL_Renderer *mRenderer; // El renderizador de la ventana
|
||||
Screen *mScreen; // Objeto encargado de dibujar en pantalla
|
||||
LTexture *mItemTexture; // Textura con los graficos
|
||||
SDL_Event *mEventHandler; // Manejador de eventos
|
||||
SDL_Texture *mBackbuffer; // Textura para usar como backbuffer
|
||||
Sprite *mSprite; // Sprite con la textura de las instrucciones
|
||||
Asset *mAsset; // Objeto que gestiona todos los ficheros de recursos
|
||||
Lang *mLang; // Objeto para gestionar los textos en diferentes idiomas
|
||||
Text *mText; // Objeto para escribir texto
|
||||
Uint16 mCounter; // Contador
|
||||
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
|
||||
Uint32 mTicksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
bool mManualQuit; // Indica si se quiere salir del modo manual
|
||||
// Objetos
|
||||
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||
LTexture *itemTexture; // Textura con los graficos
|
||||
SDL_Event *eventHandler; // Manejador de eventos
|
||||
SDL_Texture *backbuffer; // Textura para usar como backbuffer
|
||||
Sprite *sprite; // Sprite con la textura de las instrucciones
|
||||
Asset *asset; // Objeto que gestiona todos los ficheros de recursos
|
||||
Lang *lang; // Objeto para gestionar los textos en diferentes idiomas
|
||||
Text *text; // Objeto para escribir texto
|
||||
|
||||
// Variables
|
||||
Uint16 counter; // Contador
|
||||
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
|
||||
void update();
|
||||
@@ -44,8 +48,8 @@ private:
|
||||
// Pinta en pantalla
|
||||
void render();
|
||||
|
||||
// Inicializa las variables
|
||||
void init();
|
||||
// Comprueba los eventos
|
||||
void checkEventHandler();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
@@ -55,7 +59,7 @@ public:
|
||||
~Instructions();
|
||||
|
||||
// Bucle principal
|
||||
void run(Uint8 mode);
|
||||
void run(mode_e mode);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
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);
|
||||
|
||||
@@ -113,7 +113,7 @@ private:
|
||||
void applyOptions();
|
||||
|
||||
// Ejecuta la parte donde se muestran las instrucciones
|
||||
void runInstructions(Uint8 mode);
|
||||
void runInstructions(mode_e mode);
|
||||
|
||||
// Ejecuta el juego en modo demo
|
||||
void runDemoGame();
|
||||
|
||||
2
todo.txt
2
todo.txt
@@ -3,7 +3,7 @@ x la maquina de cafe no toca el suelo
|
||||
x las bolas verdes nacen naranja al explotarlas
|
||||
falta el aura de superguerrero al pillar la maquina de cafe
|
||||
x la powerball deja la mascara al explotarlas
|
||||
los menus de pausa y game over falta poner bien los textos
|
||||
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
|
||||
arreglar los smart sprites de muerte y de perder el cafe
|
||||
|
||||
Reference in New Issue
Block a user