logo alternatiu opcional
This commit is contained in:
23
source/external/gif.h
vendored
23
source/external/gif.h
vendored
@@ -256,8 +256,9 @@ void uncompress( int code_length,
|
||||
}
|
||||
}
|
||||
|
||||
static int read_sub_blocks( unsigned char* buffer, unsigned char **data )
|
||||
static int read_sub_blocks( unsigned char** buf_ptr, unsigned char **data )
|
||||
{
|
||||
unsigned char* buffer = *buf_ptr;
|
||||
int data_length;
|
||||
int index;
|
||||
unsigned char block_size;
|
||||
@@ -286,6 +287,7 @@ static int read_sub_blocks( unsigned char* buffer, unsigned char **data )
|
||||
index += block_size;
|
||||
}
|
||||
|
||||
*buf_ptr = buffer;
|
||||
return data_length;
|
||||
}
|
||||
|
||||
@@ -311,7 +313,7 @@ unsigned char* process_image_descriptor( unsigned char* buffer,
|
||||
|
||||
READ(&lzw_code_size, 1);
|
||||
|
||||
compressed_data_length = read_sub_blocks( buffer, &compressed_data );
|
||||
compressed_data_length = read_sub_blocks( &buffer, &compressed_data );
|
||||
|
||||
// width = image_descriptor.image_width;
|
||||
// height = image_descriptor.image_height;
|
||||
@@ -330,8 +332,9 @@ unsigned char* process_image_descriptor( unsigned char* buffer,
|
||||
return uncompressed_data;
|
||||
}
|
||||
|
||||
static int process_extension( unsigned char* buffer )
|
||||
static int process_extension( unsigned char** buf_ptr )
|
||||
{
|
||||
unsigned char* buffer = *buf_ptr;
|
||||
extension_t extension;
|
||||
graphic_control_extension_t gce;
|
||||
application_extension_t application;
|
||||
@@ -364,11 +367,12 @@ static int process_extension( unsigned char* buffer )
|
||||
|
||||
// All extensions are followed by data sub-blocks; even if it's
|
||||
// just a single data sub-block of length 0
|
||||
extension_data_length = read_sub_blocks( buffer, &extension_data );
|
||||
extension_data_length = read_sub_blocks( &buffer, &extension_data );
|
||||
|
||||
if ( extension_data != NULL )
|
||||
free( extension_data );
|
||||
|
||||
*buf_ptr = buffer;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -416,12 +420,13 @@ static unsigned char* process_gif_stream(unsigned char *buffer, unsigned short*
|
||||
READ(header, 6);
|
||||
header[ 6 ] = 0x0;
|
||||
|
||||
// XXX there's another format, GIF87a, that you may still find
|
||||
// floating around.
|
||||
if ( strcmp( "GIF89a", (char*)header ) )
|
||||
// Accept both GIF89a and GIF87a (89a is a superset; the blocks this
|
||||
// loader parses — LZW image data and palette — are identical in 87a).
|
||||
if ( strcmp( "GIF89a", (char*)header ) != 0 &&
|
||||
strcmp( "GIF87a", (char*)header ) != 0 )
|
||||
{
|
||||
fprintf( stderr,
|
||||
"Invalid GIF file (header is '%s', should be 'GIF89a')\n",
|
||||
"Invalid GIF file (header is '%s', should be 'GIF89a' or 'GIF87a')\n",
|
||||
header );
|
||||
return NULL;
|
||||
}
|
||||
@@ -462,7 +467,7 @@ static unsigned char* process_gif_stream(unsigned char *buffer, unsigned short*
|
||||
color_resolution_bits);
|
||||
break;
|
||||
case EXTENSION_INTRODUCER:
|
||||
if ( !process_extension( buffer ) )
|
||||
if ( !process_extension( &buffer ) )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -57,4 +57,5 @@ namespace Defaults::Game {
|
||||
constexpr int HABITACIO_INICIAL = 1;
|
||||
constexpr int PIRAMIDE_INICIAL = 255;
|
||||
constexpr int VIDES = 5;
|
||||
constexpr bool USE_NEW_LOGO = true;
|
||||
} // namespace Defaults::Game
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "core/jail/jfile.hpp"
|
||||
#include "core/jail/jgame.hpp"
|
||||
#include "core/jail/jinput.hpp"
|
||||
#include "game/options.hpp"
|
||||
|
||||
ModuleSequence::ModuleSequence() {
|
||||
}
|
||||
@@ -84,6 +85,17 @@ const int minim(const int a, const int b) {
|
||||
}
|
||||
}
|
||||
|
||||
// Pinta el wordmark JAILGAMES/Jailgames en el mateix lloc (y=78) durant les
|
||||
// animacions de sprites de l'intro. Branqueja entre logo vell i nou segons
|
||||
// Options::game.use_new_logo.
|
||||
static void drawIntroWordmark(JD8_Surface gfx) {
|
||||
if (Options::game.use_new_logo) {
|
||||
JD8_Blit(60, 78, gfx, 60, 158, 188, 28);
|
||||
} else {
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
}
|
||||
}
|
||||
|
||||
void play_music(const char* music, bool loop = -1) {
|
||||
int size;
|
||||
char* buffer = file_getfilebuffer(music, size);
|
||||
@@ -91,6 +103,11 @@ void play_music(const char* music, bool loop = -1) {
|
||||
}
|
||||
|
||||
void ModuleSequence::doIntro() {
|
||||
if (Options::game.use_new_logo) {
|
||||
doIntroNewLogo();
|
||||
return;
|
||||
}
|
||||
|
||||
JG_SetUpdateTicks(1000);
|
||||
|
||||
play_music("00000003.ogg");
|
||||
@@ -213,7 +230,7 @@ void ModuleSequence::doIntro() {
|
||||
}
|
||||
|
||||
JG_SetUpdateTicks(200);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
JD8_Blit(274, 78, gfx, 274, 155, 27, 45);
|
||||
JD8_Flip();
|
||||
while (!JG_ShouldUpdate()) {
|
||||
@@ -224,7 +241,7 @@ void ModuleSequence::doIntro() {
|
||||
}
|
||||
}
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
JD8_Flip();
|
||||
while (!JG_ShouldUpdate()) {
|
||||
JI_Update();
|
||||
@@ -233,7 +250,7 @@ void ModuleSequence::doIntro() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
JD8_Blit(274, 78, gfx, 274, 155, 27, 45);
|
||||
JD8_Flip();
|
||||
while (!JG_ShouldUpdate()) {
|
||||
@@ -244,7 +261,7 @@ void ModuleSequence::doIntro() {
|
||||
}
|
||||
}
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
JD8_Flip();
|
||||
while (!JG_ShouldUpdate()) {
|
||||
JI_Update();
|
||||
@@ -253,7 +270,7 @@ void ModuleSequence::doIntro() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
JD8_Blit(274, 78, gfx, 274, 155, 27, 45);
|
||||
JD8_Flip();
|
||||
while (!JG_ShouldUpdate()) {
|
||||
@@ -264,7 +281,7 @@ void ModuleSequence::doIntro() {
|
||||
}
|
||||
}
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
JD8_Flip();
|
||||
while (!JG_ShouldUpdate()) {
|
||||
JI_Update();
|
||||
@@ -296,6 +313,11 @@ void ModuleSequence::doIntro() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
doIntroSprites(gfx);
|
||||
}
|
||||
|
||||
void ModuleSequence::doIntroSprites(JD8_Surface gfx) {
|
||||
JG_SetUpdateTicks(20);
|
||||
|
||||
Uint16 fr1 = 13;
|
||||
@@ -345,7 +367,7 @@ void ModuleSequence::doIntro() {
|
||||
// camina cap a la DRETA }
|
||||
for (int i = 0; i <= 200; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_1[(i div 5) mod fr1],15,15,i,150);
|
||||
JD8_BlitCK(i, 150, gfx, fr_ani_1[(i / 5) % fr1], 0, 15, 15, 0);
|
||||
|
||||
@@ -363,7 +385,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 200; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_3[minim((i div 5),fr3-1)],15,15,200,150);
|
||||
JD8_BlitCK(200, 150, gfx, fr_ani_3[minim((i / 5), fr3 - 1)], 30, 15, 15, 0);
|
||||
|
||||
@@ -381,7 +403,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 200; i >= 0; i--) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_3[minim((i div 5),fr3-1)],15,15,200,150);
|
||||
JD8_BlitCK(200, 150, gfx, fr_ani_3[minim((i / 5), fr3 - 1)], 30, 15, 15, 0);
|
||||
|
||||
@@ -399,7 +421,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 200; i >= 80; i--) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_2[(i div 5) mod fr2],15,15,i,150);
|
||||
JD8_BlitCK(i, 150, gfx, fr_ani_2[(i / 5) % fr2], 15, 15, 15, 0);
|
||||
|
||||
@@ -417,7 +439,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 200; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_4[minim((i div 5),fr4-1)],15,15,80,150);
|
||||
JD8_BlitCK(80, 150, gfx, fr_ani_4[minim((i / 5), fr4 - 1)], 45, 15, 15, 0);
|
||||
|
||||
@@ -435,7 +457,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 300; i >= 95; i--) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_6[(i div 10) mod fr6],15,15,i,150);
|
||||
JD8_BlitCK(i, 150, gfx, fr_ani_6[(i / 5) % fr6], 60, 15, 15, 0);
|
||||
// Put_sprite(from,where,fr_ani_4[fr4-1],15,15,80,150);
|
||||
@@ -455,7 +477,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 50; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_1[1],15,15,80,150);
|
||||
JD8_BlitCK(80, 150, gfx, fr_ani_1[1], 0, 15, 15, 0);
|
||||
// Put_sprite(from,where,fr_ani_6[4],15,15,95,150);
|
||||
@@ -477,7 +499,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 49; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_5[minim((i div 5),fr5-1)],15,15,80,150-((i mod 50) div 5));
|
||||
JD8_BlitCK(80, 150 - ((i % 50) / 5), gfx, fr_ani_5[minim(i / 5, fr5 - 1)], 45, 15, 15, 0);
|
||||
// Put_sprite(from,where,fr_ani_6[4],15,15,95,150);
|
||||
@@ -497,7 +519,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 50; i <= 99; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_5[minim((i div 5),fr5-1)],15,15,80,140+((i mod 50) div 5));
|
||||
JD8_BlitCK(80, 140 + ((i % 50) / 5), gfx, fr_ani_5[minim(i / 5, fr5 - 1)], 45, 15, 15, 0);
|
||||
// Put_sprite(from,where,fr_ani_6[4],15,15,95,150);
|
||||
@@ -517,7 +539,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 80; i >= 0; i--) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_2[(i div 5) mod fr2],15,15,i,150);
|
||||
JD8_BlitCK(i, 150, gfx, fr_ani_2[(i / 5) % fr2], 15, 15, 15, 0);
|
||||
// Put_sprite(from,where,fr_ani_6[4],15,15,95,150);
|
||||
@@ -537,7 +559,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 150; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_6[4],15,15,95,150);
|
||||
JD8_BlitCK(95, 150, gfx, fr_ani_6[4], 60, 15, 15, 0);
|
||||
// Put_sprite(from,where,interrogant,15,15,95,133);
|
||||
@@ -552,7 +574,7 @@ void ModuleSequence::doIntro() {
|
||||
// camina cap a la DRETA }
|
||||
for (int i = 0; i <= 200; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,creu,15,15,200,155);
|
||||
JD8_BlitCK(200, 155, gfx, 0, creu, 15, 15, 255);
|
||||
// Put_sprite(from,where,fr_ani_1[(i div 5) mod fr1],15,15,i,150);
|
||||
@@ -572,7 +594,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 300; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,creu,15,15,200,155);
|
||||
JD8_BlitCK(200, 155, gfx, 0, creu, 15, 15, 255);
|
||||
// Put_sprite(from,where,fr_ani_3[minim((i div 5),fr3-1)],15,15,200,150);
|
||||
@@ -592,7 +614,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 100; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,creu,15,15,200,155);
|
||||
JD8_BlitCK(200, 155, gfx, 0, creu, 15, 15, 255);
|
||||
// Put_sprite(from,where,interrogant,15,15,200,134);
|
||||
@@ -614,7 +636,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 200; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,creu,15,15,200,155);
|
||||
JD8_BlitCK(200, 155, gfx, 0, creu, 15, 15, 255);
|
||||
// Put_sprite(from,where,fr_ani_7[minim((i div 5),fr7-1)],15,15,200,150);
|
||||
@@ -638,7 +660,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 75; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,creu,15,15,200,155);
|
||||
JD8_BlitCK(200, 155, gfx, 0, creu, 15, 15, 255);
|
||||
// Put_sprite(from,where,fr_ani_7[fr7-1],15,15,200,150);
|
||||
@@ -660,7 +682,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 19; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,creu,15,15,200,155);
|
||||
JD8_BlitCK(200, 155, gfx, 0, creu, 15, 15, 255);
|
||||
// Put_sprite(from,where,fr_ani_8[i div 10],15,15,200,150);
|
||||
@@ -680,7 +702,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 200; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,creu,15,15,200,155);
|
||||
JD8_BlitCK(200, 155, gfx, 0, creu, 15, 15, 255);
|
||||
// Put_sprite(from,where,fr_ani_8[1],15,15,200,150);
|
||||
@@ -704,7 +726,7 @@ void ModuleSequence::doIntro() {
|
||||
// camina cap a la DRETA }
|
||||
for (int i = 0; i <= 145; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_1[(i div 5) mod fr1],15,15,i,150);
|
||||
JD8_BlitCK(i, 150, gfx, fr_ani_1[(i / 5) % fr1], 0, 15, 15, 255);
|
||||
// Put_sprite(from,where,fr_ani_6[(i div 10) mod fr6],15,15,304-i,150);
|
||||
@@ -724,7 +746,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 100; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_1[1],15,15,145,150);
|
||||
JD8_BlitCK(145, 150, gfx, fr_ani_1[1], 0, 15, 15, 255);
|
||||
// Put_sprite(from,where,fr_ani_6[1],15,15,160,150);
|
||||
@@ -744,7 +766,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 50; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_11[(i div 10) mod 2],15,15,125,150);
|
||||
JD8_BlitCK(125, 150, gfx, fr_ani_11[(i / 10) % 2], 90, 15, 15, 255);
|
||||
// Put_sprite(from,where,fr_ani_1[1],15,15,145,150);
|
||||
@@ -766,7 +788,7 @@ void ModuleSequence::doIntro() {
|
||||
|
||||
for (int i = 0; i <= 800; i++) {
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(43, 78, gfx, 43, 155, 231, 45);
|
||||
drawIntroWordmark(gfx);
|
||||
// Put_sprite(from,where,fr_ani_9[(i div 10) mod fr9],15,15,145,150);
|
||||
JD8_BlitCK(145, 150, gfx, fr_ani_9[(i / 10) % fr9], 120, 15, 15, 255);
|
||||
// Put_sprite(from,where,fr_ani_10[(i div 10) mod fr10],15,15,160,150);
|
||||
@@ -790,6 +812,129 @@ void ModuleSequence::doIntro() {
|
||||
JD8_FreeSurface(gfx);
|
||||
}
|
||||
|
||||
void ModuleSequence::doIntroNewLogo() {
|
||||
// Coordenades mesurades del wordmark "Jailgames" dins logo/logo_new.gif
|
||||
// (imatge 320x200, fons negre = index 0, lletres en index 17 = verd brillant).
|
||||
// TUNE: ajusta aquests valors si canvies el logo.
|
||||
constexpr int LOGO_SRC_X = 60; // x d'inici de la 'J' a la imatge font
|
||||
constexpr int LOGO_SRC_Y = 158; // y del top del wordmark a la imatge font
|
||||
constexpr int LOGO_DST_Y = 78; // y de destinació en pantalla (igual que logo vell)
|
||||
constexpr int LOGO_HEIGHT = 28; // alçada del wordmark
|
||||
// Amplada del crop des de LOGO_SRC_X fins al final de cada lletra
|
||||
// (J, Ja, Jai, Jail, Jailg, Jailga, Jailgam, Jailgame, Jailgames):
|
||||
constexpr int LETTER_WIDTHS[9] = {16, 39, 50, 69, 92, 115, 146, 169, 188};
|
||||
// Cursor horitzontal (subratllat) al peu de la lletra següent que apareixerà.
|
||||
// x absolut en pantalla, on comença cada cursor (just després de l'última lletra revelada):
|
||||
constexpr int CURSOR_X[9] = {77, 100, 111, 130, 153, 176, 207, 230, 249};
|
||||
constexpr int CURSOR_W = 12;
|
||||
constexpr int CURSOR_H = 3;
|
||||
constexpr int CURSOR_Y = LOGO_DST_Y + LOGO_HEIGHT - CURSOR_H; // peu de la lletra (y=103)
|
||||
constexpr Uint8 CURSOR_COLOR = 17; // mateix index verd que les lletres (cicla amb el palette)
|
||||
|
||||
JG_SetUpdateTicks(1000);
|
||||
|
||||
play_music("00000003.ogg");
|
||||
|
||||
JD8_Surface gfx = JD8_LoadSurface("logo/logo_new.gif");
|
||||
JD8_Palette pal = JD8_LoadPalette("logo/logo_new.gif");
|
||||
JD8_SetScreenPalette(pal);
|
||||
|
||||
// Surface auxiliar plena amb el color del cursor, per poder "blittejar" rectangles.
|
||||
JD8_Surface cursor_surf = JD8_NewSurface();
|
||||
memset(cursor_surf, CURSOR_COLOR, 64000);
|
||||
|
||||
auto cleanup = [&]() {
|
||||
JD8_FreeSurface(gfx);
|
||||
JD8_FreeSurface(cursor_surf);
|
||||
};
|
||||
auto waitTick = [&]() -> bool {
|
||||
// Retorna true si cal sortir (tecla o quitting).
|
||||
while (!JG_ShouldUpdate()) {
|
||||
JI_Update();
|
||||
if (JI_AnyKey() || JG_Quitting()) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Flip();
|
||||
if (waitTick()) {
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
JG_SetUpdateTicks(150);
|
||||
|
||||
// Revelat progressiu lletra-a-lletra amb cursor parpadejant (subratllat horitzontal).
|
||||
for (int i = 0; i < 9; i++) {
|
||||
// Frame amb cursor visible
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(LOGO_SRC_X, LOGO_DST_Y, gfx, LOGO_SRC_X, LOGO_SRC_Y, LETTER_WIDTHS[i], LOGO_HEIGHT);
|
||||
JD8_Blit(CURSOR_X[i], CURSOR_Y, cursor_surf, 0, 0, CURSOR_W, CURSOR_H);
|
||||
JD8_Flip();
|
||||
if (waitTick()) {
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
// Frame sense cursor (parpadeig)
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(LOGO_SRC_X, LOGO_DST_Y, gfx, LOGO_SRC_X, LOGO_SRC_Y, LETTER_WIDTHS[i], LOGO_HEIGHT);
|
||||
JD8_Flip();
|
||||
if (waitTick()) {
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Mostra el logo complet amb el cursor final fix un moment més.
|
||||
JG_SetUpdateTicks(200);
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(LOGO_SRC_X, LOGO_DST_Y, gfx, LOGO_SRC_X, LOGO_SRC_Y, LETTER_WIDTHS[8], LOGO_HEIGHT);
|
||||
JD8_Blit(CURSOR_X[8], CURSOR_Y, cursor_surf, 0, 0, CURSOR_W, CURSOR_H);
|
||||
JD8_Flip();
|
||||
if (waitTick()) {
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
// Treu el cursor abans del cicle de paleta (els seus pixels cicla rien amb les lletres).
|
||||
JD8_ClearScreen(0);
|
||||
JD8_Blit(LOGO_SRC_X, LOGO_DST_Y, gfx, LOGO_SRC_X, LOGO_SRC_Y, LETTER_WIDTHS[8], LOGO_HEIGHT);
|
||||
JD8_Flip();
|
||||
|
||||
// Cicle de paleta final (mateix efecte que l'intro original, indexs 16-31).
|
||||
JG_SetUpdateTicks(20);
|
||||
for (int j = 0; j < 256; j++) {
|
||||
for (int i = 16; i < 32; i++) {
|
||||
if (i == 17) {
|
||||
if (pal[i].r < 255) pal[i].r++;
|
||||
if (pal[i].g < 255) pal[i].g++;
|
||||
if (pal[i].b < 255) pal[i].b++;
|
||||
}
|
||||
if (pal[i].b < pal[i].g) pal[i].b++;
|
||||
if (pal[i].b > pal[i].g) pal[i].b--;
|
||||
if (pal[i].r < pal[i].g) pal[i].r++;
|
||||
if (pal[i].r > pal[i].g) pal[i].r--;
|
||||
}
|
||||
JD8_Flip();
|
||||
if (waitTick()) {
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Espera abans d'entrar a les animacions de sprites (igual que l'intro vella).
|
||||
if (waitTick()) {
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
// doIntroSprites pren propietat de gfx i el allibera ell mateix.
|
||||
JD8_FreeSurface(cursor_surf);
|
||||
doIntroSprites(gfx);
|
||||
}
|
||||
|
||||
void ModuleSequence::doMenu() {
|
||||
JG_SetUpdateTicks(20);
|
||||
JD8_Surface fondo = JD8_LoadSurface("menu.gif");
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include "game/info.hpp"
|
||||
|
||||
class ModuleSequence {
|
||||
@@ -11,6 +13,8 @@ class ModuleSequence {
|
||||
|
||||
private:
|
||||
void doIntro();
|
||||
void doIntroNewLogo();
|
||||
void doIntroSprites(Uint8* gfx);
|
||||
void doMenu();
|
||||
void doSlides();
|
||||
void doBanner();
|
||||
|
||||
@@ -144,6 +144,8 @@ namespace Options {
|
||||
game.piramide_inicial = node["piramide_inicial"].get_value<int>();
|
||||
if (node.contains("vides"))
|
||||
game.vides = node["vides"].get_value<int>();
|
||||
if (node.contains("use_new_logo"))
|
||||
game.use_new_logo = node["use_new_logo"].get_value<bool>();
|
||||
}
|
||||
|
||||
// Carrega les opcions des del fitxer configurat
|
||||
@@ -274,6 +276,7 @@ namespace Options {
|
||||
file << " habitacio_inicial: " << game.habitacio_inicial << "\n";
|
||||
file << " piramide_inicial: " << game.piramide_inicial << "\n";
|
||||
file << " vides: " << game.vides << "\n";
|
||||
file << " use_new_logo: " << (game.use_new_logo ? "true" : "false") << "\n";
|
||||
file << "\n";
|
||||
|
||||
// CONTROLS
|
||||
|
||||
@@ -83,6 +83,7 @@ namespace Options {
|
||||
int habitacio_inicial{Defaults::Game::HABITACIO_INICIAL};
|
||||
int piramide_inicial{Defaults::Game::PIRAMIDE_INICIAL};
|
||||
int vides{Defaults::Game::VIDES};
|
||||
bool use_new_logo{Defaults::Game::USE_NEW_LOGO};
|
||||
};
|
||||
|
||||
// Preset PostFX
|
||||
|
||||
Reference in New Issue
Block a user