step 8: intro_scene substituix doIntro() (revelat JAILGAMES lletra a lletra + cicle de paleta)

This commit is contained in:
2026-04-16 08:00:22 +02:00
parent 6125277d70
commit e18b7321eb
6 changed files with 300 additions and 244 deletions

View File

@@ -2,11 +2,7 @@
#include <stdlib.h>
#include <string>
#include "core/jail/jail_audio.hpp"
#include "core/jail/jdraw8.hpp"
#include "core/jail/jfile.hpp"
#include "core/jail/jgame.hpp"
#include "core/jail/jinput.hpp"
#include "game/options.hpp"
@@ -34,17 +30,18 @@ bool wait_frame_or_skip() {
int ModuleSequence::Go() {
if (info::ctx.num_piramide == 6 && info::ctx.diners < 200) info::ctx.num_piramide = 7;
switch (info::ctx.num_piramide) {
case 255: // Intro
doIntro();
break;
// case 0 (Menú) → migrat a scenes::MenuScene.
// case 1 i 7 (Slides) → migrat a scenes::SlidesScene.
// case 2..5 (Pre-piràmide) → migrat a scenes::BannerScene.
// case 6 (Pre-Secreta) → migrat a scenes::SecretaScene.
// case 8 (Credits) → migrat a scenes::CreditsScene.
// case 100 (Mort) → migrat a scenes::MortScene, dispatch via SceneRegistry.
}
// Totes les branques del vell switch han estat migrades a scenes:
// case 0 (Menú) → scenes::MenuScene
// case 1 i 7 (Slides) → scenes::SlidesScene
// case 2..5 (Banner) → scenes::BannerScene
// case 6 (Secreta) → scenes::SecretaScene
// case 8 (Credits) → scenes::CreditsScene
// case 100 (Mort) → scenes::MortScene
// case 255 (Intro) → scenes::IntroScene / scenes::IntroNewLogoScene
// El gameFiberEntry les dispatcha via SceneRegistry abans de caure a
// aquest Go() — així que en la pràctica ja no s'arriba ací. El codi
// que queda sota (JD8_FadeOut + transicions de num_piramide) serà
// eliminat al Step 10 del pla, junt amb ModuleSequence::Go() sencer.
JD8_FadeOut();
@@ -94,229 +91,6 @@ static void drawIntroWordmark(JD8_Surface gfx) {
}
}
void play_music(const char* music, bool loop = -1) {
int size;
char* buffer = file_getfilebuffer(music, size);
JA_PlayMusic(JA_LoadMusic((Uint8*)buffer, size, music), loop);
}
void ModuleSequence::doIntro() {
// Branca `if (use_new_logo)` eliminada: scenes::IntroNewLogoScene
// agafa eixe camí via el SceneRegistry. Aquest `doIntro()` legacy
// només s'executa quan `use_new_logo == false`.
JG_SetUpdateTicks(1000);
play_music("00000003.ogg");
JD8_Surface gfx = JD8_LoadSurface("logo.gif");
JD8_Palette pal = JD8_LoadPalette("logo.gif");
JD8_SetScreenPalette(pal);
JD8_ClearScreen(0);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JG_SetUpdateTicks(100);
JD8_Blit(43, 78, gfx, 43, 155, 27, 45);
JD8_Blit(68, 78, gfx, 274, 155, 27, 45);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JD8_Blit(43, 78, gfx, 43, 155, 53, 45);
JD8_Blit(96, 78, gfx, 274, 155, 27, 45);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JD8_Blit(43, 78, gfx, 43, 155, 66, 45);
JD8_Blit(109, 78, gfx, 274, 155, 27, 45);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JG_SetUpdateTicks(200);
JD8_Blit(43, 78, gfx, 43, 155, 92, 45);
JD8_Blit(136, 78, gfx, 274, 155, 27, 45);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JD8_ClearScreen(0);
JD8_Blit(43, 78, gfx, 43, 155, 92, 45);
// JD8_Blit( 136, 78, gfx, 274, 155, 27, 45 );
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JG_SetUpdateTicks(100);
JD8_Blit(43, 78, gfx, 43, 155, 118, 45);
JD8_Blit(160, 78, gfx, 274, 155, 27, 45);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JD8_Blit(43, 78, gfx, 43, 155, 145, 45);
JD8_Blit(188, 78, gfx, 274, 155, 27, 45);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JD8_Blit(43, 78, gfx, 43, 155, 178, 45);
JD8_Blit(221, 78, gfx, 274, 155, 27, 45);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JD8_Blit(43, 78, gfx, 43, 155, 205, 45);
JD8_Blit(248, 78, gfx, 274, 155, 27, 45);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JG_SetUpdateTicks(200);
drawIntroWordmark(gfx);
JD8_Blit(274, 78, gfx, 274, 155, 27, 45);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JD8_ClearScreen(0);
drawIntroWordmark(gfx);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
drawIntroWordmark(gfx);
JD8_Blit(274, 78, gfx, 274, 155, 27, 45);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JD8_ClearScreen(0);
drawIntroWordmark(gfx);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
drawIntroWordmark(gfx);
JD8_Blit(274, 78, gfx, 274, 155, 27, 45);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
JD8_ClearScreen(0);
drawIntroWordmark(gfx);
JD8_Flip();
if (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
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 (wait_frame_or_skip()) {
JD8_FreeSurface(gfx);
return;
}
doIntroSprites(gfx);
}
void ModuleSequence::doIntroSprites(JD8_Surface gfx) {
JG_SetUpdateTicks(20);

View File

@@ -18,8 +18,8 @@ class ModuleSequence {
void doIntroSprites(Uint8* gfx);
private:
void doIntro();
void doIntroNewLogo();
// doIntro() → migrat a scenes::IntroScene
// doIntroNewLogo() → migrat a scenes::IntroNewLogoScene
// doMenu() → migrat a scenes::MenuScene
// doSlides() → migrat a scenes::SlidesScene
// doBanner() → migrat a scenes::BannerScene