Fase 9d: descomponer GameScene::update en sub-pasos privados

update() pasa de 339 LOC monolitico (cognitive complexity ~137) a
18 LOC orquestadores. Cada seccion logica vive en su propio metodo
privado con responsabilidad unica:

- stepPhysics(dt): physics_world.update + postUpdate.
- stepShootingInput(): SHOOT de P1/P2.
- stepMidGameJoin(): START de jugador inactivo o muerto sin vidas.
- stepContinueScreen(dt): wrapping del Systems::ContinueScreen +
  update de fondo. Devuelve true si frame debe terminar.
- stepGameOver(dt): timer final + transicion a TITLE. Devuelve true
  si frame debe terminar.
- stepDeathSequence(dt): death timer/respawn/transicion a CONTINUE.
- stepStageStateMachine(dt): despacha a runStage{InitHud,LevelStart,
  Playing,LevelCompleted} segun el estado actual.
- runCollisionDetections(): construye el Systems::Collision::Context
  y llama detectAll.

GameScene.cpp acumulado tras Fase 9 (a+b+c+d): 1429 -> 1015 LOC.
update() solo: 339 -> 18 LOC. Smoke test xvfb OK.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
JailDesignerandClaude Opus 4.7 committed 2026-05-20 07:57:36 +02:00
1 parent a4942fcbae
commit 808abb28ea
2 files changed
+287 -295

No files matched your search

+20
View File
@@ -96,4 +96,24 @@ class GameScene {
// [NEW] Función helper del marcador
[[nodiscard]] std::string buildScoreboard() const;
// Sub-pasos de update() (descompuestos en Fase 9d para reducir
// complejidad cognitiva; cada uno es responsable de una sección).
void stepPhysics(float delta_time);
void stepShootingInput();
void stepMidGameJoin();
// Devuelven true si el frame debe salir tras esta sección.
[[nodiscard]] auto stepContinueScreen(float delta_time) -> bool;
[[nodiscard]] auto stepGameOver(float delta_time) -> bool;
// Avanza el death timer / respawn / transition a CONTINUE. Devuelve
// true si algun jugador está en secuencia de muerte (para que el
// caller actualice efectos sin gameplay).
[[nodiscard]] auto stepDeathSequence(float delta_time) -> bool;
void stepStageStateMachine(float delta_time);
void runStageInitHud(float delta_time);
void runStageLevelStart(float delta_time);
void runStagePlaying(float delta_time);
void runStageLevelCompleted(float delta_time);
// Helper: ejecuta colisiones de gameplay con el Context preparado.
void runCollisionDetections();
};