La pantalla de titulo ya no acaba cuando termina la marquesina si la lista de logros está activa
This commit is contained in:
187
source/title.cpp
187
source/title.cpp
@@ -33,17 +33,8 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
|
||||
section->subsection = 0;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
longText = "HEY JAILERS!! IT'S 2022 AND WE'RE STILL ROCKING LIKE IT'S 1998!!! HAVE YOU HEARD IT? JAILGAMES ARE BACK!! YEEESSS BACK!! MORE THAN 10 TITLES ON JAILDOC'S KITCHEN!! THATS A LOOOOOOT OF JAILGAMES, BUT WHICH ONE WILL STRIKE FIRST? THERE IS ALSO A NEW DEVICE TO COME THAT WILL BLOW YOUR MIND WITH JAILGAMES ON THE GO: P.A.C.O. BUT WAIT! WHAT'S THAT BEAUTY I'M SEEING RIGHT OVER THERE?? OOOH THAT TINY MINIASCII IS PURE LOVE!! I WANT TO LICK EVERY BYTE OF IT!! OH SHIT! AND DON'T FORGET TO BRING BACK THOSE OLD AND FAT MS-DOS JAILGAMES TO GITHUB TO KEEP THEM ALIVE!! WHAT WILL BE THE NEXT JAILDOC RELEASE? WHAT WILL BE THE NEXT PROJECT TO COME ALIVE?? OH BABY WE DON'T KNOW BUT HERE YOU CAN FIND THE ANSWER, YOU JUST HAVE TO COMPLETE JAILDOCTOR'S DILEMMA ... COULD YOU?";
|
||||
for (int i = 0; i < (int)longText.length(); ++i)
|
||||
{
|
||||
letter_t l;
|
||||
l.letter = longText.substr(i, 1);
|
||||
l.x = 256;
|
||||
l.enabled = false;
|
||||
letters.push_back(l);
|
||||
}
|
||||
letters[0].enabled = true;
|
||||
marqueeSpeed = 3;
|
||||
initMarquee();
|
||||
|
||||
// Crea el cartel de PRESS ENTER
|
||||
#ifdef GAME_CONSOLE
|
||||
@@ -66,26 +57,28 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
|
||||
|
||||
// Crea la textura con el listado de logros
|
||||
cheevosTexture = new Texture(renderer);
|
||||
cheevosTexture->createBlank(renderer, GAMECANVAS_WIDTH - 16, GAMECANVAS_HEIGHT - 16, SDL_TEXTUREACCESS_TARGET);
|
||||
cheevosTexture->createBlank(renderer, GAMECANVAS_WIDTH - 8, GAMECANVAS_HEIGHT - 8, SDL_TEXTUREACCESS_TARGET);
|
||||
cheevosTexture->setAsRenderTarget(renderer);
|
||||
cheevosTexture->setBlendMode(SDL_BLENDMODE_BLEND);
|
||||
const color_t cheevosBGColor = stringToColor(options->palette, "bright_blue");
|
||||
const color_t cheevosBGColor = stringToColor(options->palette, "blue");
|
||||
SDL_SetRenderDrawColor(renderer, cheevosBGColor.r, cheevosBGColor.g, cheevosBGColor.b, 0xFF);
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderClear(renderer);
|
||||
const vector<cheevos_t> cheevosList = cheevos->list();
|
||||
int pos = 1;
|
||||
int pos = 2;
|
||||
const color_t cheevoLockedColor = stringToColor(options->palette, "white");
|
||||
const color_t cheevoUnlockedColor = stringToColor(options->palette, "white");
|
||||
color_t cheevoColor;
|
||||
for (auto cheevo : cheevosList)
|
||||
{
|
||||
cheevoColor = cheevo.completed ? cheevoUnlockedColor : cheevoLockedColor;
|
||||
infoText->writeColored(1, pos, cheevo.caption, cheevoColor);
|
||||
infoText->writeColored(2, pos, cheevo.caption, cheevoColor);
|
||||
pos += 6;
|
||||
infoText->writeColored(2, pos, cheevo.description, cheevoColor);
|
||||
pos += 8;
|
||||
}
|
||||
|
||||
// Crea el sprite para el listado de logros
|
||||
cheevosSprite = new Sprite(8, 8, cheevosTexture->getWidth(), cheevosTexture->getHeight(), cheevosTexture, renderer);
|
||||
cheevosSprite = new Sprite(4, 4, cheevosTexture->getWidth(), cheevosTexture->getHeight(), cheevosTexture, renderer);
|
||||
|
||||
// Cambia el color del borde
|
||||
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
||||
@@ -105,6 +98,22 @@ Title::~Title()
|
||||
delete infoText;
|
||||
}
|
||||
|
||||
// Inicializa la marquesina
|
||||
void Title::initMarquee()
|
||||
{
|
||||
letters.clear();
|
||||
longText = "HEY JAILERS!! IT'S 2022 AND WE'RE STILL ROCKING LIKE IT'S 1998!!! HAVE YOU HEARD IT? JAILGAMES ARE BACK!! YEEESSS BACK!! MORE THAN 10 TITLES ON JAILDOC'S KITCHEN!! THATS A LOOOOOOT OF JAILGAMES, BUT WHICH ONE WILL STRIKE FIRST? THERE IS ALSO A NEW DEVICE TO COME THAT WILL BLOW YOUR MIND WITH JAILGAMES ON THE GO: P.A.C.O. BUT WAIT! WHAT'S THAT BEAUTY I'M SEEING RIGHT OVER THERE?? OOOH THAT TINY MINIASCII IS PURE LOVE!! I WANT TO LICK EVERY BYTE OF IT!! OH SHIT! AND DON'T FORGET TO BRING BACK THOSE OLD AND FAT MS-DOS JAILGAMES TO GITHUB TO KEEP THEM ALIVE!! WHAT WILL BE THE NEXT JAILDOC RELEASE? WHAT WILL BE THE NEXT PROJECT TO COME ALIVE?? OH BABY WE DON'T KNOW BUT HERE YOU CAN FIND THE ANSWER, YOU JUST HAVE TO COMPLETE JAILDOCTOR'S DILEMMA ... COULD YOU?";
|
||||
for (int i = 0; i < (int)longText.length(); ++i)
|
||||
{
|
||||
letter_t l;
|
||||
l.letter = longText.substr(i, 1);
|
||||
l.x = 256;
|
||||
l.enabled = false;
|
||||
letters.push_back(l);
|
||||
}
|
||||
letters[0].enabled = true;
|
||||
}
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
void Title::checkEventHandler()
|
||||
{
|
||||
@@ -125,6 +134,10 @@ void Title::checkEventHandler()
|
||||
showCheevos = !showCheevos;
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_Z:
|
||||
initMarquee();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -249,85 +262,93 @@ void Title::update()
|
||||
// Comprueba si ha terminado la marquesina y acaba con el titulo
|
||||
if (letters[letters.size() - 1].x < -10)
|
||||
{
|
||||
section->name = SECTION_PROG_CREDITS;
|
||||
section->subsection = 0;
|
||||
if (!showCheevos)
|
||||
{
|
||||
section->name = SECTION_PROG_CREDITS;
|
||||
section->subsection = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Inicializa la marquesina
|
||||
initMarquee();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja en pantalla
|
||||
void Title::render()
|
||||
{
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
// Dibuja el fondo del titulo
|
||||
sprite->render();
|
||||
|
||||
// Dibuja el texto de PRESS ENTER TO PLAY
|
||||
if (counter % 80 < 60)
|
||||
// Dibuja en pantalla
|
||||
void Title::render()
|
||||
{
|
||||
pressEnterSprite->render();
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
// Dibuja el fondo del titulo
|
||||
sprite->render();
|
||||
|
||||
// Dibuja el texto de PRESS ENTER TO PLAY
|
||||
if (counter % 80 < 60)
|
||||
{
|
||||
pressEnterSprite->render();
|
||||
}
|
||||
|
||||
// Dibuja la marquesina
|
||||
renderMarquee();
|
||||
|
||||
// Dibuja la linea de información inferior
|
||||
renderInfo();
|
||||
|
||||
// Dibuja la información de logros
|
||||
if (showCheevos)
|
||||
{
|
||||
cheevosSprite->render();
|
||||
}
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||
|
||||
// Dibuja la marquesina
|
||||
renderMarquee();
|
||||
|
||||
// Dibuja la linea de información inferior
|
||||
renderInfo();
|
||||
|
||||
// Dibuja la información de logros
|
||||
if (showCheevos)
|
||||
// Bucle para el logo del juego
|
||||
void Title::run()
|
||||
{
|
||||
cheevosSprite->render();
|
||||
while (section->name == SECTION_PROG_TITLE)
|
||||
{
|
||||
update();
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||
// Recarga las texturas
|
||||
void Title::reLoadTextures()
|
||||
{
|
||||
// Carga la textura adecuada
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
// texture->loadFromFile(asset->get("loading_screen_color.png"), renderer);
|
||||
texture = resource->getTexture("loading_screen_color.png");
|
||||
}
|
||||
else if (options->palette == p_zxarne)
|
||||
{
|
||||
// texture->loadFromFile(asset->get("loading_screen_color_zxarne.png"), renderer);
|
||||
texture = resource->getTexture("loading_screen_color_zxarne.png");
|
||||
}
|
||||
|
||||
// Bucle para el logo del juego
|
||||
void Title::run()
|
||||
{
|
||||
while (section->name == SECTION_PROG_TITLE)
|
||||
{
|
||||
update();
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
// Recarga las texturas
|
||||
void Title::reLoadTextures()
|
||||
{
|
||||
// Carga la textura adecuada
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
// texture->loadFromFile(asset->get("loading_screen_color.png"), renderer);
|
||||
texture = resource->getTexture("loading_screen_color.png");
|
||||
}
|
||||
else if (options->palette == p_zxarne)
|
||||
{
|
||||
// texture->loadFromFile(asset->get("loading_screen_color_zxarne.png"), renderer);
|
||||
texture = resource->getTexture("loading_screen_color_zxarne.png");
|
||||
texture->reLoad();
|
||||
}
|
||||
|
||||
texture->reLoad();
|
||||
}
|
||||
|
||||
// Cambia la paleta
|
||||
void Title::switchPalette()
|
||||
{
|
||||
if (options->palette == p_zxspectrum)
|
||||
// Cambia la paleta
|
||||
void Title::switchPalette()
|
||||
{
|
||||
options->palette = p_zxarne;
|
||||
sprite->setTexture(resource->getTexture("loading_screen_color_zxarne.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
options->palette = p_zxspectrum;
|
||||
sprite->setTexture(resource->getTexture("loading_screen_color.png"));
|
||||
}
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
options->palette = p_zxarne;
|
||||
sprite->setTexture(resource->getTexture("loading_screen_color_zxarne.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
options->palette = p_zxspectrum;
|
||||
sprite->setTexture(resource->getTexture("loading_screen_color.png"));
|
||||
}
|
||||
|
||||
// Cambia el color del borde
|
||||
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
||||
}
|
||||
// Cambia el color del borde
|
||||
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
||||
}
|
||||
@@ -68,6 +68,9 @@ private:
|
||||
// Comprueba las entradas
|
||||
void checkInput();
|
||||
|
||||
// Inicializa la marquesina
|
||||
void initMarquee();
|
||||
|
||||
// Actualiza la marquesina
|
||||
void updateMarquee();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user