From e06f79d8c78ab8e6ab155aa7dbafca5a1288c308 Mon Sep 17 00:00:00 2001
From: Kevin Remisoski <kremisoski@gmail.com>
Date: Sun, 10 Mar 2024 01:07:54 -0500
Subject: [PATCH 1/3] Team Arena support

---
 code/qcommon/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/code/qcommon/common.c b/code/qcommon/common.c
index aeab6e2e81..151727ff14 100644
--- a/code/qcommon/common.c
+++ b/code/qcommon/common.c
@@ -39,7 +39,7 @@ int demo_protocols[] =
 #define MIN_DEDICATED_COMHUNKMEGS 1
 #define MIN_COMHUNKMEGS		56
 #define DEF_COMHUNKMEGS 	128
-#define DEF_COMZONEMEGS		24
+#define DEF_COMZONEMEGS		48
 #define DEF_COMHUNKMEGS_S	XSTRING(DEF_COMHUNKMEGS)
 #define DEF_COMZONEMEGS_S	XSTRING(DEF_COMZONEMEGS)
 

From 868352b70c7e4f713e84ed4eb4dffcbe5398a9a9 Mon Sep 17 00:00:00 2001
From: Kevin Remisoski <kremisoski@gmail.com>
Date: Fri, 5 Apr 2024 05:57:44 -0400
Subject: [PATCH 2/3] added Team Arena+ server support

---
 code/server/server.h  |  1 +
 code/server/sv_game.c | 37 ++++++++++++++++++++++++++++++++++++-
 code/server/sv_init.c |  2 ++
 code/server/sv_main.c |  2 ++
 4 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/code/server/server.h b/code/server/server.h
index ec1620aa89..13fc80f862 100644
--- a/code/server/server.h
+++ b/code/server/server.h
@@ -291,6 +291,7 @@ extern	cvar_t	*sv_gametype;
 extern	cvar_t	*sv_pure;
 extern	cvar_t	*sv_floodProtect;
 extern	cvar_t	*sv_lanForceRate;
+extern cvar_t *sv_entityPath;
 #ifndef STANDALONE
 extern	cvar_t	*sv_strictAuth;
 #endif
diff --git a/code/server/sv_game.c b/code/server/sv_game.c
index 161d975e63..546c1898a0 100644
--- a/code/server/sv_game.c
+++ b/code/server/sv_game.c
@@ -865,6 +865,37 @@ void SV_ShutdownGameProgs( void ) {
 	gvm = NULL;
 }
 
+/*
+==================
+SV_GetCustomEntityString
+Read custom entity string from entity file for current map if it exists
+Author: Wiz
+==================
+*/
+static char *SV_GetCustomEntityString(void)
+{
+    char filename[MAX_QPATH];
+    union {
+        char *c;
+        void *v;
+    } f;
+
+	if ( sv_entityPath->string[0] != '\0' )
+        Com_sprintf(filename, sizeof(filename), "%s%c%s.ent", sv_entityPath->string, PATH_SEP, sv_mapname->string);
+    else
+        Com_sprintf(filename, sizeof(filename), "%s.ent", sv_mapname->string);
+
+    FS_ReadFile(filename, &f.v);
+
+    if (!f.v)
+        return NULL;
+
+    FS_FreeFile(f.v);
+
+    return f.c;
+}
+
+
 /*
 ==================
 SV_InitGameVM
@@ -876,7 +907,11 @@ static void SV_InitGameVM( qboolean restart ) {
 	int		i;
 
 	// start the entity parsing at the beginning
-	sv.entityParsePoint = CM_EntityString();
+	//sv.entityParsePoint = CM_EntityString();
+
+	// now we can replace all entities on the map with out own
+	if ( !( sv.entityParsePoint = SV_GetCustomEntityString() ) )
+		sv.entityParsePoint = CM_EntityString();
 
 	// clear all gentity pointers that might still be set from
 	// a previous level
diff --git a/code/server/sv_init.c b/code/server/sv_init.c
index b8fb28c246..8c02ea7e66 100644
--- a/code/server/sv_init.c
+++ b/code/server/sv_init.c
@@ -669,6 +669,8 @@ void SV_Init (void)
 	sv_zombietime = Cvar_Get ("sv_zombietime", "2", CVAR_TEMP );
 	Cvar_Get ("nextmap", "", CVAR_TEMP );
 
+	sv_entityPath = Cvar_Get("sv_entityPath", "maps", CVAR_ARCHIVE );
+
 	sv_allowDownload = Cvar_Get ("sv_allowDownload", "0", CVAR_SERVERINFO);
 	Cvar_Get ("sv_dlURL", "", CVAR_SERVERINFO | CVAR_ARCHIVE);
 	
diff --git a/code/server/sv_main.c b/code/server/sv_main.c
index 4d94c1e32a..21845bae47 100644
--- a/code/server/sv_main.c
+++ b/code/server/sv_main.c
@@ -58,6 +58,8 @@ cvar_t	*sv_gametype;
 cvar_t	*sv_pure;
 cvar_t	*sv_floodProtect;
 cvar_t	*sv_lanForceRate; // dedicated 1 (LAN) server forces local client rates to 99999 (bug #491)
+
+cvar_t *sv_entityPath;
 #ifndef STANDALONE
 cvar_t	*sv_strictAuth;
 #endif

From 35ffb79b40df2addc4a1b791b7ad7bdb4cb444ed Mon Sep 17 00:00:00 2001
From: Kr3m <kr3m@dayentech.net>
Date: Tue, 7 May 2024 08:48:29 -0400
Subject: [PATCH 3/3] fixed typo in comment

---
 code/server/sv_game.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/code/server/sv_game.c b/code/server/sv_game.c
index 546c1898a0..4e1ccdb1b9 100644
--- a/code/server/sv_game.c
+++ b/code/server/sv_game.c
@@ -909,7 +909,7 @@ static void SV_InitGameVM( qboolean restart ) {
 	// start the entity parsing at the beginning
 	//sv.entityParsePoint = CM_EntityString();
 
-	// now we can replace all entities on the map with out own
+	// now we can replace all entities on the map with our own
 	if ( !( sv.entityParsePoint = SV_GetCustomEntityString() ) )
 		sv.entityParsePoint = CM_EntityString();