corregits bugs dels sub-bucles aplanats

- Demo ja no entra en pausa ni game over (redirigeix a instruccions)
- Perdre el focus de la finestra només pausa durant el joc actiu (no en demo, game over ni pausa)
- Demo gestionat amb save/restore de section->name per evitar transició del Director

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 19:45:39 +02:00
parent 06d4712493
commit 85a47c1a2b
2 changed files with 21 additions and 2 deletions

View File

@@ -2944,6 +2944,15 @@ bool Game::isDeathShaking() {
// Ejecuta un frame del juego
void Game::iterate() {
// En modo demo, no hay pausa ni game over
if (demo.enabled) {
if (section->subsection == SUBSECTION_GAME_PAUSE || section->subsection == SUBSECTION_GAME_GAMEOVER) {
section->name = SECTION_PROG_TITLE;
section->subsection = SUBSECTION_TITLE_INSTRUCTIONS;
return;
}
}
// Sección juego en pausa
if (section->subsection == SUBSECTION_GAME_PAUSE) {
if (!pauseInitialized) {
@@ -3001,7 +3010,10 @@ void Game::handleEvent(SDL_Event *event) {
// SDL_EVENT_QUIT ya lo maneja Director
if (event->type == SDL_EVENT_WINDOW_FOCUS_LOST) {
section->subsection = SUBSECTION_GAME_PAUSE;
// Solo pausar durante el juego activo (no en demo, game over, ni ya en pausa)
if (!demo.enabled && (section->subsection == SUBSECTION_GAME_PLAY_1P || section->subsection == SUBSECTION_GAME_PLAY_2P)) {
section->subsection = SUBSECTION_GAME_PAUSE;
}
}
#ifdef PAUSE