step 4: intro_new_logo_scene substituix doIntroNewLogo(); doIntroSprites exposat temporalment
This commit is contained in:
@@ -108,10 +108,9 @@ void play_music(const char* music, bool loop = -1) {
|
||||
}
|
||||
|
||||
void ModuleSequence::doIntro() {
|
||||
if (Options::game.use_new_logo) {
|
||||
doIntroNewLogo();
|
||||
return;
|
||||
}
|
||||
// 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);
|
||||
|
||||
@@ -820,128 +819,7 @@ void ModuleSequence::doIntroSprites(JD8_Surface gfx) {
|
||||
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);
|
||||
}
|
||||
// doIntroNewLogo() — migrat a scenes::IntroNewLogoScene (source/scenes/intro_new_logo_scene.cpp)
|
||||
|
||||
// doMenu() — migrat a scenes::MenuScene (source/scenes/menu_scene.cpp)
|
||||
|
||||
|
||||
@@ -11,10 +11,15 @@ class ModuleSequence {
|
||||
|
||||
int Go();
|
||||
|
||||
// Exposat temporalment (public) fins al Step 9 del pla de migració,
|
||||
// quan `doIntroSprites` es reescriurà com a scenes::IntroSpritesScene.
|
||||
// Mentrestant, scenes::IntroNewLogoScene el crida al final del seu
|
||||
// ciclo per delegar la part de les animacions de sprites.
|
||||
void doIntroSprites(Uint8* gfx);
|
||||
|
||||
private:
|
||||
void doIntro();
|
||||
void doIntroNewLogo();
|
||||
void doIntroSprites(Uint8* gfx);
|
||||
// doMenu() → migrat a scenes::MenuScene
|
||||
void doSlides();
|
||||
// doBanner() → migrat a scenes::BannerScene
|
||||
|
||||
Reference in New Issue
Block a user