step 6: credits_scene substituix doCredits() (scroll vertical + parallax condicional)

This commit is contained in:
2026-04-16 00:03:25 +02:00
parent 605c273173
commit 829d7431c1
9 changed files with 203 additions and 70 deletions

View File

@@ -44,9 +44,7 @@ int ModuleSequence::Go() {
case 6: // Pre-Secreta
doSecreta();
break;
case 8: // Credits
doCredits();
break;
// case 8 (Credits) → migrat a scenes::CreditsScene.
// case 100 (Mort) → migrat a scenes::MortScene, dispatch via SceneRegistry.
}
@@ -911,70 +909,6 @@ void ModuleSequence::doSecreta() {
free(pal_aux);
}
void ModuleSequence::doCredits() {
struct {
Uint16 x, y;
} frames_coche[8] = {{214, 152}, {214, 104}, {214, 56}, {214, 104}, {214, 152}, {214, 8}, {108, 152}, {214, 8}};
const Uint32 n_frames_coche = 8;
const Uint32 velocitat_coche = 3;
JD8_Surface vaddr2 = JD8_LoadSurface("final.gif");
JD8_Surface vaddr3 = JD8_LoadSurface("finals.gif");
JD8_Palette pal = JD8_LoadPalette("final.gif");
JD8_SetScreenPalette(pal);
int contador = 0;
bool exit = false;
contador = 1;
while (!exit && !JG_Quitting()) {
if (JG_ShouldUpdate()) {
JI_Update();
if (JI_AnyKey() || contador >= 3100) {
exit = true;
}
JD8_ClearScreen(255);
if (contador < 2750) {
JD8_BlitCKCut(115, 200 - (contador / 6), vaddr2, 0, 0, 80, 200, 0);
}
if ((contador > 1200) && (contador < 2280)) {
JD8_BlitCKCut(100, 200 - ((contador - 1200) / 6), vaddr2, 85, 0, 120, 140, 0);
} else if (contador >= 2250) {
JD8_BlitCK(100, 20, vaddr2, 85, 0, 120, 140, 0);
}
if (info::ctx.diamants == 16) {
// scroll_final_joc(vaddr3, vaddr, contador_final);
JD8_BlitCKScroll(50, vaddr3, ((contador >> 3) % 320) + 1, 0, 50, 255);
JD8_BlitCKScroll(50, vaddr3, ((contador >> 2) % 320) + 1, 50, 50, 255);
JD8_BlitCKScroll(50, vaddr3, ((contador >> 1) % 320) + 1, 100, 50, 255);
JD8_BlitCKScroll(50, vaddr3, (contador % 320) + 1, 150, 50, 255);
JD8_BlitCK(100, 50, vaddr2, frames_coche[(contador / velocitat_coche) % n_frames_coche].x, frames_coche[(contador / velocitat_coche) % n_frames_coche].y, 106, 48, 255);
} else {
JD8_BlitCK(0, 50, vaddr3, 0, 0, 320, 50, 255);
JD8_BlitCK(0, 50, vaddr3, 0, 50, 320, 50, 255);
}
JD8_FillSquare(0, 50, 255);
JD8_FillSquare(100, 10, 255);
JD8_Flip();
contador++;
}
}
FILE* ini = fopen("trick.ini", "wb");
fwrite("1", 1, 1, ini);
fclose(ini);
info::ctx.nou_personatge = true;
JD8_FreeSurface(vaddr3);
JD8_FreeSurface(vaddr2);
}
// doCredits() — migrat a scenes::CreditsScene (source/scenes/credits_scene.cpp)
// doMort() — migrat a scenes::MortScene (source/scenes/mort_scene.cpp)