From cc816f9cd70762d0134100ba7489597d6e41f625 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 22 Apr 2026 07:23:58 -0700
Subject: [PATCH] Only enable the continue dialog in cheat mode
Fixes https://github.com/libsdl-org/Maelstrom/issues/36
---
game/game.cpp | 2 +-
game/gameinfo.cpp | 5 ++++-
game/gameinfo.h | 6 +++++-
game/lobby.cpp | 2 +-
game/main.cpp | 4 ++--
5 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/game/game.cpp b/game/game.cpp
index ea2e8088..c80ed379 100644
--- a/game/game.cpp
+++ b/game/game.cpp
@@ -1144,7 +1144,7 @@ GamePanelDelegate::DoHousekeeping()
} else {
GameOver();
}
- } else if (!gGameInfo.IsMultiplayer() && !gShownContinue) {
+ } else if (gGameInfo.IsCheat() && !gShownContinue) {
gShownContinue = 1;
ui->ShowPanel(PANEL_CONTINUE);
} else {
diff --git a/game/gameinfo.cpp b/game/gameinfo.cpp
index 63071797..08985afd 100644
--- a/game/gameinfo.cpp
+++ b/game/gameinfo.cpp
@@ -50,7 +50,7 @@ GameInfo::Reset()
}
void
-GameInfo::SetHost(Uint8 wave, Uint8 lives, Uint8 turbo, bool deathmatch)
+GameInfo::SetHost(Uint8 wave, Uint8 lives, Uint8 turbo, bool deathmatch, bool cheat)
{
Reset();
@@ -60,6 +60,9 @@ GameInfo::SetHost(Uint8 wave, Uint8 lives, Uint8 turbo, bool deathmatch)
this->lives = lives;
this->turbo = turbo;
this->gameMode = 0;
+ if (cheat) {
+ this->gameMode |= GAME_MODE_CHEAT;
+ }
if (deathmatch) {
this->gameMode |= GAME_MODE_DEATHMATCH;
}
diff --git a/game/gameinfo.h b/game/gameinfo.h
index cccc2427..11ad7c31 100644
--- a/game/gameinfo.h
+++ b/game/gameinfo.h
@@ -47,6 +47,7 @@ enum GAME_MODE {
GAME_MODE_KIDS = 0x01,
GAME_MODE_CONTROL_BRAKES = 0x02,
GAME_MODE_DEATHMATCH = 0x04,
+ GAME_MODE_CHEAT = 0x08,
};
#define IS_LOCAL_CONTROL(X) (X & CONTROL_LOCAL)
@@ -137,7 +138,7 @@ class GameInfo
localID = uniqueID;
}
- void SetHost(Uint8 wave, Uint8 lives, Uint8 turbo, bool deathMatch);
+ void SetHost(Uint8 wave, Uint8 lives, Uint8 turbo, bool deathMatch, bool cheat);
void SetPlayerSlot(int slot, const char *name, Uint8 controlMask);
void SetPlayerName(int slot, const char *name);
@@ -209,6 +210,9 @@ class GameInfo
bool IsDeathmatch() const {
return (gameMode & GAME_MODE_DEATHMATCH) != 0;
}
+ bool IsCheat() const {
+ return (gameMode & GAME_MODE_CHEAT) != 0;
+ }
bool IsKidMode() const {
return (gameMode & GAME_MODE_KIDS) != 0;
}
diff --git a/game/lobby.cpp b/game/lobby.cpp
index 9ac49289..e4697203 100644
--- a/game/lobby.cpp
+++ b/game/lobby.cpp
@@ -522,7 +522,7 @@ LobbyDialogDelegate::SetState(LOBBY_STATE state)
} else {
lives = prefs->GetNumber(PREFERENCES_MULTIPLAYER_LIVES, DEFAULT_START_LIVES);
}
- m_game.SetHost(DEFAULT_START_WAVE, lives, DEFAULT_START_TURBO, deathmatch);
+ m_game.SetHost(DEFAULT_START_WAVE, lives, DEFAULT_START_TURBO, deathmatch, false);
// Set up the controls for this game
for (i = 0; i < MAX_PLAYERS; ++i) {
diff --git a/game/main.cpp b/game/main.cpp
index 4496a64a..97b01041 100644
--- a/game/main.cpp
+++ b/game/main.cpp
@@ -123,7 +123,7 @@ static void CheatDialogDone(void*, UIDialog *dialog, int status)
Delay(SOUND_DELAY);
sound->PlaySound(gNewLife, 5);
Delay(SOUND_DELAY);
- gGameInfo.SetHost(wave, lives, turbo, false);
+ gGameInfo.SetHost(wave, lives, turbo, false, true);
gGameInfo.SetPlayerSlot(0, prefs->GetString(PREFERENCES_HANDLE), CONTROL_LOCAL);
RunSinglePlayerGame();
}
@@ -461,7 +461,7 @@ MainPanelDelegate::OnAction(UIBaseElement *sender, const char *action)
void
MainPanelDelegate::OnActionPlay()
{
- gGameInfo.SetHost(DEFAULT_START_WAVE, DEFAULT_START_LIVES, DEFAULT_START_TURBO, false);
+ gGameInfo.SetHost(DEFAULT_START_WAVE, DEFAULT_START_LIVES, DEFAULT_START_TURBO, false, false);
gGameInfo.SetPlayerSlot(0, prefs->GetString(PREFERENCES_HANDLE), CONTROL_LOCAL);
RunSinglePlayerGame();
}