Added challenge mode

This commit is contained in:
2025-12-20 13:08:16 +01:00
parent fd29ae271e
commit 34447f0245
15 changed files with 535 additions and 1227 deletions

View File

@ -442,7 +442,7 @@ void MenuState::handleEvent(const SDL_Event& e) {
case SDL_SCANCODE_LEFT:
case SDL_SCANCODE_UP:
{
const int total = 6;
const int total = 7;
selectedButton = (selectedButton + total - 1) % total;
// brief bright flash on navigation
buttonFlash = 1.0;
@ -451,7 +451,7 @@ void MenuState::handleEvent(const SDL_Event& e) {
case SDL_SCANCODE_RIGHT:
case SDL_SCANCODE_DOWN:
{
const int total = 6;
const int total = 7;
selectedButton = (selectedButton + 1) % total;
// brief bright flash on navigation
buttonFlash = 1.0;
@ -465,9 +465,19 @@ void MenuState::handleEvent(const SDL_Event& e) {
}
switch (selectedButton) {
case 0:
// Endless play
if (ctx.game) ctx.game->setMode(GameMode::Endless);
triggerPlay();
break;
case 1:
// Start challenge run at level 1
if (ctx.game) {
ctx.game->setMode(GameMode::Challenge);
ctx.game->startChallengeRun(1);
}
triggerPlay();
break;
case 2:
// Toggle inline level selector HUD (show/hide)
if (!levelPanelVisible && !levelPanelAnimating) {
levelPanelAnimating = true;
@ -479,7 +489,7 @@ void MenuState::handleEvent(const SDL_Event& e) {
levelDirection = -1; // hide
}
break;
case 2:
case 3:
// Toggle the options panel with an animated slide-in/out.
if (!optionsVisible && !optionsAnimating) {
optionsAnimating = true;
@ -489,7 +499,7 @@ void MenuState::handleEvent(const SDL_Event& e) {
optionsDirection = -1; // hide
}
break;
case 3:
case 4:
// Toggle the inline HELP HUD (show/hide)
if (!helpPanelVisible && !helpPanelAnimating) {
helpPanelAnimating = true;
@ -500,7 +510,7 @@ void MenuState::handleEvent(const SDL_Event& e) {
helpDirection = -1; // hide
}
break;
case 4:
case 5:
// Toggle the inline ABOUT HUD (show/hide)
if (!aboutPanelVisible && !aboutPanelAnimating) {
aboutPanelAnimating = true;
@ -510,7 +520,7 @@ void MenuState::handleEvent(const SDL_Event& e) {
aboutDirection = -1;
}
break;
case 5:
case 6:
// Show the inline exit HUD
if (!exitPanelVisible && !exitPanelAnimating) {
exitPanelAnimating = true;