step 3: menu_scene substituix doMenu() + fix JI_Update al fiber loop

This commit is contained in:
2026-04-15 23:19:58 +02:00
parent 2cb38ffb49
commit 8720e775a0
6 changed files with 177 additions and 65 deletions

View File

@@ -38,9 +38,7 @@ int ModuleSequence::Go() {
case 255: // Intro
doIntro();
break;
case 0: // Men<65>
doMenu();
break;
// case 0 (Menú) → migrat a scenes::MenuScene.
case 1: // Slides
case 7:
doSlides();
@@ -945,67 +943,7 @@ void ModuleSequence::doIntroNewLogo() {
doIntroSprites(gfx);
}
void ModuleSequence::doMenu() {
JG_SetUpdateTicks(20);
JD8_Surface fondo = JD8_LoadSurface("menu.gif");
JD8_Surface gfx = JD8_LoadSurface("menu2.gif");
JD8_Palette pal = JD8_LoadPalette("menu2.gif");
JD8_Blit(fondo);
JD8_BlitCK(100, 25, gfx, 0, 74, 124, 68, 255); // logo
JD8_BlitCK(130, 100, gfx, 0, 0, 80, 74, 255);
JD8_BlitCK(0, 150, gfx, 0, 150, 320, 50, 255);
JD8_FadeToPal(pal);
contador = 0;
int palmeres = 0;
int horitzo = 0;
int camello = 0;
JI_Update();
while (!JI_AnyKey() && !JG_Quitting() && !JI_KeyPressed(SDL_SCANCODE_P)) {
JD8_Blit(0, 0, fondo, 0, 0, 320, 100); // fondo sol estatic
JD8_BlitCK(horitzo, 100, fondo, 0, 100, 320 - horitzo, 100, 255); // fondo moviment
JD8_BlitCK(0, 100, fondo, 320 - horitzo, 100, horitzo, 100, 255);
JD8_BlitCK(100, 25, gfx, 0, 74, 124, 68, 255); // logo
JD8_BlitCK(130, 100, gfx, camello * 80, 0, 80, 74, 255); // camello
JD8_BlitCK(palmeres, 150, gfx, 0, 150, 320 - palmeres, 50, 255); // palemeres moviment
JD8_BlitCK(0, 150, gfx, 320 - palmeres, 150, palmeres, 50, 255);
JD8_BlitCK(87, 167, gfx, 127, 124, 150, 24, 255); // jdes
JD8_BlitCK(303, 193, gfx, 305, 143, 15, 5, 255); // versio
if (contador % 100 > 30) JD8_BlitCK(98, 130, gfx, 161, 92, 127, 9, 255); // pulsa tecla...
if ((contador % 100 > 30) && info::ctx.nou_personatge) JD8_BlitCK(68, 141, gfx, 128, 105, 189, 9, 255); // 'p' per a personatge nou...
JD8_Flip();
if (JG_ShouldUpdate()) {
if (contador % 4 == 0) {
palmeres--;
if (palmeres < 0) palmeres = 319;
}
if (contador % 8 == 0) {
camello++;
if (camello == 4) camello = 0;
}
if (contador % 16 == 0) {
horitzo--;
if (horitzo < 0) horitzo = 319;
}
contador++;
JI_Update();
}
}
info::ctx.pepe_activat = JI_KeyPressed(SDL_SCANCODE_P);
JI_DisableKeyboard(60);
JD8_FreeSurface(fondo);
JD8_FreeSurface(gfx);
free(pal);
}
// doMenu() — migrat a scenes::MenuScene (source/scenes/menu_scene.cpp)
void ModuleSequence::doSlides() {
JG_SetUpdateTicks(20);

View File

@@ -15,7 +15,7 @@ class ModuleSequence {
void doIntro();
void doIntroNewLogo();
void doIntroSprites(Uint8* gfx);
void doMenu();
// doMenu() → migrat a scenes::MenuScene
void doSlides();
// doBanner() → migrat a scenes::BannerScene
void doSecreta();