Maelstrom: Changed deathmath from a radio group to a numeric frag count

From 762ee9207f19b77a69f60e46979875c010aee1c6 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 28 Nov 2025 12:19:51 -0800
Subject: [PATCH] Changed deathmath from a radio group to a numeric frag count

---
 Data/UI/lobby.xml | 24 ++++++------------------
 game/gameinfo.cpp |  3 ---
 game/gameinfo.h   |  5 ++---
 game/lobby.cpp    | 40 ++++++++++++++++++----------------------
 game/lobby.h      |  5 ++---
 5 files changed, 28 insertions(+), 49 deletions(-)

diff --git a/Data/UI/lobby.xml b/Data/UI/lobby.xml
index 08e97426..79dcf932 100644
--- a/Data/UI/lobby.xml
+++ b/Data/UI/lobby.xml
@@ -241,25 +241,13 @@
 					</Elements>
 				</Area>
 
-				<DialogLabel name="deathmatch_label" text="Deathmatch:">
-					<Anchor anchorFrom="BOTTOMLEFT" anchorTo="BOTTOMLEFT" x="12" y="-10"/>
+				<DialogLabel name="deathmatch_label" text="Deathmatch Frags:">
+					<Anchor anchorFrom="BOTTOMLEFT" anchorTo="BOTTOMLEFT" x="12" y="-13"/>
 				</DialogLabel>
-				<DialogRadioGroup name="deathmatch" bindValue="Network.Deathmatch">
-					<Elements>
-						<DialogRadioButton name="deathmatch_off" text="Off" checked="true" id="0">
-							<Anchor anchorFrom="LEFT" anchorTo="RIGHT" anchor="deathmatch_label" x="8"/>
-						</DialogRadioButton>
-						<DialogRadioButton name="deathmatch_3" text="3" id="3">
-							<Anchor anchorFrom="LEFT" anchorTo="RIGHT" anchor="deathmatch_off" x="6"/>
-						</DialogRadioButton>
-						<DialogRadioButton name="deathmatch_5" text="5" id="5">
-							<Anchor anchorFrom="LEFT" anchorTo="RIGHT" anchor="deathmatch_3" x="6"/>
-						</DialogRadioButton>
-						<DialogRadioButton name="deathmatch_8" text="8" id="8">
-							<Anchor anchorFrom="LEFT" anchorTo="RIGHT" anchor="deathmatch_5" x="6"/>
-						</DialogRadioButton>
-					</Elements>
-				</DialogRadioGroup>
+				<DialogEditbox name="deathmatch" numeric="true" maxlen="2" bindText="Network.Deathmatch" text="0">
+					<Size w="30" h="21"/>
+					<Anchor anchorFrom="LEFT" anchorTo="RIGHT" anchor="deathmatch_label" x="8"/>
+				</DialogEditbox>
 			</Elements>
 		</Area>
 
diff --git a/game/gameinfo.cpp b/game/gameinfo.cpp
index 9376be9a..f3421947 100644
--- a/game/gameinfo.cpp
+++ b/game/gameinfo.cpp
@@ -63,9 +63,6 @@ GameInfo::SetHost(Uint8 wave, Uint8 lives, Uint8 turbo, Uint8 deathMatch, bool k
 	if (kidMode) {
 		this->gameMode |= GAME_MODE_KIDS;
 	}
-	if (deathMatch) {
-		this->gameMode |= GAME_MODE_DEATHMATCH;
-	}
 	this->deathMatch = deathMatch;
 
 	// We are the host node
diff --git a/game/gameinfo.h b/game/gameinfo.h
index b0591353..ae782000 100644
--- a/game/gameinfo.h
+++ b/game/gameinfo.h
@@ -44,8 +44,7 @@ enum PLAYER_CONTROL {
 };
 
 enum GAME_MODE {
-	GAME_MODE_DEATHMATCH = 0x01,
-	GAME_MODE_KIDS       = 0x02,
+	GAME_MODE_KIDS       = 0x01,
 };
 
 #define IS_LOCAL_CONTROL(X)	(X & CONTROL_LOCAL)
@@ -189,7 +188,7 @@ class GameInfo
 	bool IsFull() const;
 
 	bool IsDeathmatch() const {
-		return (gameMode & GAME_MODE_DEATHMATCH) != 0;
+		return deathMatch != 0;
 	}
 	bool IsKidMode() const {
 		return (gameMode & GAME_MODE_KIDS) != 0;
diff --git a/game/lobby.cpp b/game/lobby.cpp
index 97dcf1b4..c8c3b07f 100644
--- a/game/lobby.cpp
+++ b/game/lobby.cpp
@@ -23,7 +23,6 @@
 #include "SDL_net.h"
 #include "Maelstrom_Globals.h"
 #include "../screenlib/UIElement.h"
-#include "../screenlib/UIElementCheckbox.h"
 #include "../screenlib/UIElementRadio.h"
 #include "lobby.h"
 #include "protocol.h"
@@ -153,17 +152,18 @@ LobbyDialogDelegate::OnLoad()
 
 	m_hostOrJoin = m_dialog->GetElement<UIElementRadioGroup>("hostOrJoin");
 	if (!m_hostOrJoin) {
-		fprintf(stderr, "Warning: Couldn't find radio group 'hostOrJoin'\n");
+		SDL_Log("Warning: Couldn't find radio group 'hostOrJoin'");
 		return false;
 	}
 	m_hostOrJoin->SetValueCallback(this, &LobbyDialogDelegate::SetHostOrJoin);
 
-	m_deathmatch = m_dialog->GetElement<UIElementRadioGroup>("deathmatch");
+	m_deathmatch = m_dialog->GetElement<UIElement>("deathmatch");
 	if (!m_deathmatch) {
-		fprintf(stderr, "Warning: Couldn't find radio group 'deathmatch'\n");
+		SDL_Log("Warning: Couldn't find editbox 'deathmatch'");
 		return false;
 	}
-	m_deathmatch->SetValueCallback(this, &LobbyDialogDelegate::SetDeathmatch);
+	m_deathmatch->SetTextCallback(this, &LobbyDialogDelegate::DeathmatchChanged, nullptr);
+
 	if (!GetElement("gamelist", m_gameListArea)) {
 		return false;
 	}
@@ -210,7 +210,7 @@ LobbyDialogDelegate::GetElement(const char *name, UIElement *&element)
 {
 	element = m_dialog->GetElement<UIElement>(name);
 	if (!element) {
-		fprintf(stderr, "Warning: Couldn't find element '%s'\n", name);
+		SDL_Log("Warning: Couldn't find element '%s'", name);
 		return false;
 	}
 	return true;
@@ -308,18 +308,6 @@ LobbyDialogDelegate::SetHostOrJoin(void*, int value)
 	}
 }
 
-void
-LobbyDialogDelegate::SetDeathmatch(void*, int value)
-{
-	if (value) {
-		m_game.gameMode |= GAME_MODE_DEATHMATCH;
-		m_game.deathMatch = (Uint8)value;
-	} else {
-		m_game.gameMode &= ~GAME_MODE_DEATHMATCH;
-		m_game.deathMatch = 0;
-	}
-}
-
 void
 LobbyDialogDelegate::JoinGameClicked(void *_element)
 {
@@ -333,6 +321,12 @@ LobbyDialogDelegate::JoinGameClicked(void *_element)
 	}
 }
 
+void
+LobbyDialogDelegate::DeathmatchChanged(void *, const char *text)
+{
+	m_game.deathMatch = SDL_atoi(text);
+}
+
 void
 LobbyDialogDelegate::UpdateUI()
 {
@@ -356,7 +350,9 @@ LobbyDialogDelegate::UpdateUI()
 		for (int i = 0; i < MAX_PLAYERS; ++i) {
 			m_game.BindPlayerToUI(i, m_gameInfoPlayers[i]);
 		}
-		m_deathmatch->SetValue(m_game.deathMatch);
+
+		char deathmatch[10];
+		m_deathmatch->SetText(SDL_itoa(m_game.deathMatch, deathmatch, 10));
 	}
 	if (m_state == STATE_HOSTING) {
 		m_playButton->SetDisabled(false);
@@ -451,7 +447,7 @@ LobbyDialogDelegate::CheckPings()
 			GameInfo &game = m_gameList[i];
 			game.UpdatePingStatus(HOST_NODE);
 			if (game.GetPingStatus(HOST_NODE) == PING_TIMEDOUT) {
-//printf("Game timed out, removing from list\n");
+//SDL_Log("Game timed out, removing from list");
 				m_gameList.remove(game);
 				removed = true;
 			} else {
@@ -465,14 +461,14 @@ LobbyDialogDelegate::CheckPings()
 		m_game.UpdatePingStatus();
 		for (int i = 0; i < m_game.GetNumNodes(); ++i) {
 			if (m_game.GetPingStatus(i) == PING_TIMEDOUT) {
-//printf("Player timed out, removing from lobby\n");
+//SDL_Log("Player timed out, removing from lobby");
 				SendKick(i);
 			}
 		}
 	} else if (m_state == STATE_JOINED) {
 		m_game.UpdatePingStatus();
 		if (m_game.GetPingStatus(HOST_NODE) == PING_TIMEDOUT) {
-//printf("Game timed out, leaving lobbyn");
+//SDL_Log("Game timed out, leaving lobby");
 			SetState(STATE_LISTING);
 		}
 	}
diff --git a/game/lobby.h b/game/lobby.h
index bc0adaa7..6094f3d4 100644
--- a/game/lobby.h
+++ b/game/lobby.h
@@ -54,9 +54,8 @@ class LobbyDialogDelegate : public UIDialogDelegate
 protected:
 	bool GetElement(const char *name, UIElement *&element);
 	void SetHostOrJoin(void*, int value);
-	void GlobalGameChanged(void*);
-	void SetDeathmatch(void*, int value);
 	void JoinGameClicked(void *element);
+	void DeathmatchChanged(void *, const char *text);
 
 	void UpdateUI();
 
@@ -105,7 +104,7 @@ class LobbyDialogDelegate : public UIDialogDelegate
 	DynamicPacket m_packet, m_reply;
 
 	UIElementRadioGroup *m_hostOrJoin;
-	UIElementRadioGroup *m_deathmatch;
+	UIElement *m_deathmatch;
 	UIElement *m_gameListArea;
 	UIElement *m_gameListElements[5];
 	UIElement *m_gameInfoArea;